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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 28, 2016 at 05:14:54PM -0500, John Ferlan wrote:
> 
> [...]
> 
> >> @@ -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, \
>                                                  ^~~
> 

You've got the parentheses wrong...in both cases...

Also, once you do what I'm suggesting, the crash from 6/9 will be resolved,
however I still would like to see the @reply structure in
qemuDomainGetBlockIoTune initialized properly on the stack.

Erik

> 
> John

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux