qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/8] qemu-nbd: move srcpath into struct NbdClientOpts


From: Eric Blake
Subject: Re: [PATCH 3/8] qemu-nbd: move srcpath into struct NbdClientOpts
Date: Thu, 7 Sep 2023 16:43:01 -0500
User-agent: NeoMutt/20230517

On Wed, Sep 06, 2023 at 11:32:05AM +0200, Denis V. Lunev wrote:
> We pass other parameters into nbd_client_thread() in this way. This patch
> makes the code more consistent.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Eric Blake <eblake@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>  qemu-nbd.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 

> @@ -1059,19 +1060,19 @@ int main(int argc, char **argv)
>      bdrv_init();
>      atexit(qemu_nbd_shutdown);
>  
> -    srcpath = argv[optind];
> +    opts.srcpath = argv[optind];
>      if (imageOpts) {
> -        QemuOpts *opts;
> +        QemuOpts *o;
>          if (fmt) {
>              error_report("--image-opts and -f are mutually exclusive");
>              exit(EXIT_FAILURE);
>          }
> -        opts = qemu_opts_parse_noisily(&file_opts, srcpath, true);
> -        if (!opts) {
> +        o = qemu_opts_parse_noisily(&file_opts, opts.srcpath, true);
> +        if (!o) {

Hmm - this would have been flagged by -Wshadow, and there are other
series working to clean up tree-wide issues that shadowing can cause.
Looking again, the shadowing was previously introduced before this
series, but only when HAVE_NBD_DEVICE was defined; then patch 2/8 made
the shadowing unconditional.  Reworking the series to clean up the
shadowing earlier in 2/8 is just churn, so I don't mind that it took
us to this point to notice it; however, I'm inclined to add a note to
the commit message that it is a (happy) side-effect.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]