On 07/18/2018 03:57 AM, bing.niu(a)intel.com wrote:
From: Bing Niu <bing.niu(a)intel.com>
Refactor virResctrlAllocFormat so that it is easy to support other
resource allocation technologies.
Signed-off-by: Bing Niu <bing.niu(a)intel.com>
---
src/util/virresctrl.c | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 98e7296..1515de2 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -848,17 +848,13 @@ virResctrlAllocGetID(virResctrlAllocPtr alloc)
}
-char *
-virResctrlAllocFormat(virResctrlAllocPtr alloc)
+static int
+virResctrlAllocFormatCache(virResctrlAllocPtr alloc, virBufferPtr buf)
One argument per line. I'll adjust.
{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
unsigned int level = 0;
unsigned int type = 0;
unsigned int cache = 0;
[...]
- virBufferCheckError(&buf);
+ if (virBufferCheckError(buf) < 0)
+ return -1;
+ else
+ return 0;
Just return virBufferCheckError(buf); directly
I'll adjust before pushing.
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John