qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-io: add flag to mark files growable
Date: Mon, 06 Jul 2009 10:53:53 +0200	[thread overview]
Message-ID: <4A51BBA1.4090307@redhat.com> (raw)
In-Reply-To: <20090704155330.GA4825@lst.de>

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 <hch@lst.de>
> 
> 
> 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	other threads:[~2009-07-06  8:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-04 15:53 [Qemu-devel] [PATCH] qemu-io: add flag to mark files growable Christoph Hellwig
2009-07-06  8:53 ` Kevin Wolf [this message]
2009-07-06 10:20   ` Christoph Hellwig
2009-07-06 10:40     ` Kevin Wolf
2009-07-06 10:51       ` Christoph Hellwig
2009-07-06 11:04         ` Kevin Wolf
2009-07-06 11:14           ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A51BBA1.4090307@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).