[libvirt] [REPOST PATCH v2 6/9] qemu: Add support for parsing iotune group setting

John Ferlan jferlan at redhat.com
Mon Nov 28 22:14:54 UTC 2016


[...]

>> @@ -4535,6 +4535,11 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result,
>>          GET_THROTTLE_STATS_OPTIONAL("iops_rd_max", read_iops_sec_max);
>>          GET_THROTTLE_STATS_OPTIONAL("iops_wr_max", write_iops_sec_max);
>>          GET_THROTTLE_STATS_OPTIONAL("iops_size", size_iops_sec);
>> +
>> +        if ((group_name = virJSONValueObjectGetString(inserted, "group")) &&
>> +            VIR_STRDUP(reply->group_name, group_name) < 0)
>> +            goto cleanup;
>> +
> 
> One more thing, you can make the GetString call directly from VIR_STRDUP and
> then get rid of the group_name variable.
> 
> Erik
> 

Ewww.... too overloaded for my taste... I'm sure behind the scenes the
compiler will optimize anyway.

FWIW: Doing so results in compiler errors:

   if (VIR_STRDUP(reply->group_name,
                  virJSONValueObjectGetString(inserted, "group") < 0) :

qemu/qemu_monitor_json.c: In function 'qemuMonitorJSONBlockIoThrottleInfo':
qemu/qemu_monitor_json.c:4539:67: error: ordered comparison of pointer
with integer zero [-Werror=extra]
                    virJSONValueObjectGetString(inserted, "group") < 0)
                                                                   ^
./util/virstring.h:152:49: note: in definition of macro 'VIR_STRDUP'
 # define VIR_STRDUP(dst, src) virStrdup(&(dst), src, true, VIR_FROM_THIS, \
                                                 ^~~
qemu/qemu_monitor_json.c:4539:20: error: passing argument 2 of
'virStrdup' makes pointer from integer without a cast
[-Werror=int-conversion]


OR:

   if (VIR_STRDUP(reply->group_name,
                  (virJSONValueObjectGetString(inserted, "group")) < 0)

In file included from qemu/qemu_monitor_json.c:46:0:
qemu/qemu_monitor_json.c: In function 'qemuMonitorJSONBlockIoThrottleInfo':
qemu/qemu_monitor_json.c:4539:73: error: ordered comparison of pointer
with integer zero [-Werror=extra]
                        (virJSONValueObjectGetString(inserted, "group"))
< 0)
                                                                         ^
./util/virstring.h:152:49: note: in definition of macro 'VIR_STRDUP'
 # define VIR_STRDUP(dst, src) virStrdup(&(dst), src, true, VIR_FROM_THIS, \
                                                 ^~~


John




More information about the libvir-list mailing list