From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UINtA-0007Zg-Nu for qemu-devel@nongnu.org; Wed, 20 Mar 2013 14:37:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UINt3-00031g-Lw for qemu-devel@nongnu.org; Wed, 20 Mar 2013 14:37:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UINt3-00031K-Eg for qemu-devel@nongnu.org; Wed, 20 Mar 2013 14:37:21 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2KIbKrG023692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Mar 2013 14:37:20 -0400 Date: Wed, 20 Mar 2013 19:37:18 +0100 From: Kevin Wolf Message-ID: <20130320183718.GK3074@dhcp-200-207.str.redhat.com> References: <1363627441-8297-1-git-send-email-kwolf@redhat.com> <1363627441-8297-11-git-send-email-kwolf@redhat.com> <51491E8A.5010305@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51491E8A.5010305@redhat.com> Subject: Re: [Qemu-devel] [PATCH 10/11] block: Allow omitting the file name when using driver-specific options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: pbonzini@redhat.com, qemu-devel@nongnu.org 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