[libvirt] [PATCH 3/9] util: Refactor virResctrlAllocFormat of virresctrl

bing.niu bing.niu at intel.com
Wed Jul 25 03:42:04 UTC 2018



On 2018年07月25日 06:03, John Ferlan wrote:
> 
> 
> On 07/18/2018 03:57 AM, bing.niu at intel.com wrote:
>> From: Bing Niu <bing.niu at intel.com>
>>
>> Refactor virResctrlAllocFormat so that it is easy to support other
>> resource allocation technologies.
>>
>> Signed-off-by: Bing Niu <bing.niu at 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.
Thanks for that. ;)
> 
> Reviewed-by: John Ferlan <jferlan at redhat.com>
> 
> John
> 




More information about the libvir-list mailing list