Message ID | 1398762656-26079-4-git-send-email-cyliu@suse.com |
---|---|
State | New |
Headers | show |
On 04/29/2014 03:10 AM, Chunyan Liu wrote: > Currently this function is not used anywhere. In later patches, it will > replace print_option_parameters. To avoid print info changes, change > qemu_opts_print from fprintf stderr to printf to keep consistent with > print_option_parameters, remove last printf and print size/number with > opt->value.uint instead of opt->str. > > Signed-off-by: Chunyan Liu <cyliu@suse.com> > --- > util/qemu-option.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) I would prefer to see this patch first, and 2/32 second; I'd also prefer to see the signature change (changing int to void return, and dropping dummy parameter) in this patch. > + } else if ((desc->type == QEMU_OPT_SIZE || > + desc->type == QEMU_OPT_NUMBER) && opt) { > + printf("%s=%" PRId64 " ", desc->name, opt->value.uint); Shouldn't this be PRIu64, since you are printing an unsigned int?
>>> On 4/30/2014 at 12:30 AM, in message <535FD3B6.6020701@redhat.com>, Eric Blake <eblake@redhat.com> wrote: > On 04/29/2014 03:10 AM, Chunyan Liu wrote: > > Currently this function is not used anywhere. In later patches, it will > > replace print_option_parameters. To avoid print info changes, change > > qemu_opts_print from fprintf stderr to printf to keep consistent with > > print_option_parameters, remove last printf and print size/number with > > opt->value.uint instead of opt->str. > > > > Signed-off-by: Chunyan Liu <cyliu@suse.com> > > --- > > util/qemu-option.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > I would prefer to see this patch first, and 2/32 second; I'd also prefer > to see the signature change (changing int to void return, and dropping > dummy parameter) in this patch. > > > + } else if ((desc->type == QEMU_OPT_SIZE || > > + desc->type == QEMU_OPT_NUMBER) && opt) { > > + printf("%s=%" PRId64 " ", desc->name, opt->value.uint); > > Shouldn't this be PRIu64, since you are printing an unsigned int? print_option_parameters uses PRId64, so here using PRId64 too to keep output unchanged. In qemu-iotests, there are some tests having negative size, like 'size=-1024', changing to PRIu64 will cause such iotests failed. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > >
On Tue, Apr 29, 2014 at 05:10:27PM +0800, Chunyan Liu wrote: > Currently this function is not used anywhere. In later patches, it will > replace print_option_parameters. To avoid print info changes, change > qemu_opts_print from fprintf stderr to printf to keep consistent with > print_option_parameters, remove last printf and print size/number with > opt->value.uint instead of opt->str. > > Signed-off-by: Chunyan Liu <cyliu@suse.com> > --- > util/qemu-option.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff --git a/util/qemu-option.c b/util/qemu-option.c index 5346c90..2be6995 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -925,7 +925,7 @@ void qemu_opts_print(QemuOpts *opts) if (desc[0].name == NULL) { QTAILQ_FOREACH(opt, &opts->head, next) { - fprintf(stderr, "%s=\"%s\" ", opt->name, opt->str); + printf("%s=\"%s\" ", opt->name, opt->str); } return; } @@ -938,12 +938,14 @@ void qemu_opts_print(QemuOpts *opts) continue; } if (desc->type == QEMU_OPT_STRING) { - fprintf(stderr, "%s='%s' ", desc->name, value); + printf("%s='%s' ", desc->name, value); + } else if ((desc->type == QEMU_OPT_SIZE || + desc->type == QEMU_OPT_NUMBER) && opt) { + printf("%s=%" PRId64 " ", desc->name, opt->value.uint); } else { - fprintf(stderr, "%s=%s ", desc->name, value); + printf("%s=%s ", desc->name, value); } } - fprintf(stderr, "\n"); } static int opts_do_parse(QemuOpts *opts, const char *params,
Currently this function is not used anywhere. In later patches, it will replace print_option_parameters. To avoid print info changes, change qemu_opts_print from fprintf stderr to printf to keep consistent with print_option_parameters, remove last printf and print size/number with opt->value.uint instead of opt->str. Signed-off-by: Chunyan Liu <cyliu@suse.com> --- util/qemu-option.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)