From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MNjyj-0002jY-AV for qemu-devel@nongnu.org; Mon, 06 Jul 2009 04:55:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MNjye-0002eV-GY for qemu-devel@nongnu.org; Mon, 06 Jul 2009 04:55:12 -0400 Received: from [199.232.76.173] (port=55146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MNjye-0002eK-7c for qemu-devel@nongnu.org; Mon, 06 Jul 2009 04:55:08 -0400 Received: from mx2.redhat.com ([66.187.237.31]:46622) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MNjyd-0001cS-N2 for qemu-devel@nongnu.org; Mon, 06 Jul 2009 04:55:07 -0400 Message-ID: <4A51BBA1.4090307@redhat.com> Date: Mon, 06 Jul 2009 10:53:53 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] qemu-io: add flag to mark files growable References: <20090704155330.GA4825@lst.de> In-Reply-To: <20090704155330.GA4825@lst.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org Christoph Hellwig schrieb: > Add a -g flag to the open command and the main qemu-io command line to > allow opening a file growable. This is only allowed for protocols, > mirroring the limitation exposed through bdrv_file_open. This limitation doesn't look quite right. I'm not sure if growable images are used anywhere else, too, but their main usage is for the image file access in formats like qcow - that is, growable images are usually raw. And raw didn't have a protocol name until recently. > > > Signed-off-by: Christoph Hellwig > > > Index: qemu/qemu-io.c > =================================================================== > --- qemu.orig/qemu-io.c 2009-07-04 17:42:16.505239002 +0200 > +++ qemu/qemu-io.c 2009-07-04 17:52:26.432241152 +0200 > @@ -1172,7 +1172,7 @@ static const cmdinfo_t close_cmd = { > .oneline = "close the current open file", > }; > > -static int openfile(char *name, int flags) > +static int openfile(char *name, int flags, int growable) > { > if (bs) { > fprintf(stderr, "file open already, try 'help close'\n"); > @@ -1189,6 +1189,16 @@ static int openfile(char *name, int flag > return 1; > } > > + > + if (growable) { > + if (!bs->drv || !bs->drv->protocol_name) { > + fprintf(stderr, > + "%s: only protocols can be opened growable\n", > + progname); > + } > + bs->growable = 1; But you don't seem to enforce the limitation anyway, so in the end everything works. ;-) Kevin