[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/11] block: Allow omitting the file name when
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 10/11] block: Allow omitting the file name when using driver-specific options |
Date: |
Wed, 20 Mar 2013 19:37:18 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 20.03.2013 um 03:27 hat Eric Blake geschrieben:
> > +++ b/block/nbd.c
> > @@ -174,7 +174,6 @@ static void nbd_parse_filename(const char *filename,
> > QDict *options,
> >
> > /* extract the host_spec - fail if it's not nbd:... */
> > if (!strstart(file, "nbd:", &host_spec)) {
> > - error_setg(errp, "File name string for NBD must start with
> > 'nbd:'");
> > goto out;
> > }
>
> Is this really right? The code allows me to pass both file= and
> file.driver= at once; so what if I pass -drive file.driver=nbd,file=xyz.
> Prior to this patch, I'd get a nice message about file=xyz not starting
> with nbd:, but now there is a silent failure.
>
> I think it might be better if you keep the error_setg(), and instead
> rewrite the if on the previous line:
>
> if (file && !strstart(file, "nbd:", &host_spec)) {
In fact, the additional check isn't even necessary because the function
is only called for file != NULL in the first place. I've put the error
back.
> Also, since it looks like the code allows me to pass both file.driver=
> and file= at once, if I pass both pieces of information, is there any
> sanity checking that the two are identical, and/or should we error out
> and declare that if driver options are used then nbd requires a NULL
> filename?
I've added another patch that checks that only one of host/port/filename
is specified.
Kevin
- Re: [Qemu-devel] [PATCH 09/11] block: Make find_image_format safe with NULL filename, (continued)
- [Qemu-devel] [PATCH 07/11] block: Introduce .bdrv_parse_filename callback, Kevin Wolf, 2013/03/18
- [Qemu-devel] [PATCH 06/11] nbd: Accept -drive options for the network connection, Kevin Wolf, 2013/03/18
- [Qemu-devel] [PATCH 08/11] block: Rename variable to avoid shadowing, Kevin Wolf, 2013/03/18
- [Qemu-devel] [PATCH 10/11] block: Allow omitting the file name when using driver-specific options, Kevin Wolf, 2013/03/18
- [Qemu-devel] [PATCH 11/11] nbd: Use default port if only host is specified, Kevin Wolf, 2013/03/18