From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrYpO-0000zZ-B6 for qemu-devel@nongnu.org; Fri, 13 Dec 2013 14:55:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrYpE-00085P-Pc for qemu-devel@nongnu.org; Fri, 13 Dec 2013 14:55:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrYpE-00081k-HS for qemu-devel@nongnu.org; Fri, 13 Dec 2013 14:55:04 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBDJt22i022975 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 13 Dec 2013 14:55:03 -0500 Date: Fri, 13 Dec 2013 20:54:59 +0100 From: Kevin Wolf Message-ID: <20131213195459.GW3916@dhcp-200-207.str.redhat.com> References: <1386954633-28905-1-git-send-email-mreitz@redhat.com> <1386954633-28905-10-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1386954633-28905-10-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 09/22] block: Allow reference for bdrv_file_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Fam Zheng , qemu-devel@nongnu.org, Stefan Hajnoczi Am 13.12.2013 um 18:10 hat Max Reitz geschrieben: > Allow specifying a reference to an existing block device (by name) for > bdrv_file_open() instead of a filename and/or options. > > Signed-off-by: Max Reitz > @@ -872,6 +873,24 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, > options = qdict_new(); > } > > + if (reference) { > + if (filename || qdict_size(options)) { > + error_setg(errp, "Cannot reference an existing block device with " > + "additional options or a new filename"); > + return -EINVAL; > + } I suspect this could in fact be an assertion. Users shouldn't have any way to provoke a call with a reference _and_ options/filename set. Doesn't make the code less correct, of course, so: Reviewed-by: Kevin Wolf