qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu-io: add flag to mark files growable


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] qemu-io: add flag to mark files growable
Date: Mon, 06 Jul 2009 10:53:53 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

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 <address@hidden>
> 
> 
> 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




reply via email to

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