All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Cc: 1090600@bugs.launchpad.net, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: Probe file for specified format
Date: Sat, 15 Dec 2012 12:57:49 +0100	[thread overview]
Message-ID: <50CC65BD.7090103@weilnetz.de> (raw)
In-Reply-To: <1355571343-19878-1-git-send-email-sw@weilnetz.de>

Am 15.12.2012 12:35, schrieb Stefan Weil:
> Probe for the file format if the file format was specified explicitly
> and a probe function is available.
>
> example: -drive file=myfile,format=qcow2
>
> Then myfile is probed and must be in qcow2 format.
>
> This fixes those bugs:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=556482
> https://bugs.launchpad.net/qemu/+bug/1090600
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> This patch can also be used for the latest stable version of QEMU.
>
>   blockdev.c |    7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/blockdev.c b/blockdev.c
> index 9a05e57..5a4cd56 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -411,6 +411,13 @@ DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType block_default_type)
>               error_report("'%s' invalid format", buf);
>               return NULL;
>           }
> +        if (file && drv->bdrv_probe) {
> +            uint8_t data[2048];
> +            if (drv->bdrv_probe(data, sizeof(data), file) == 0) {
> +                error_report("file '%s' not in '%s' format", file, buf);
> +                return NULL;
> +            }
> +        }
>       }
>   
>       /* disk I/O throttling */


Sorry, this patch was not tested enough. I'll send a v2.

- Stefan Weil

      reply	other threads:[~2012-12-15 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-15 11:35 [Qemu-devel] [PATCH] block: Probe file for specified format Stefan Weil
2012-12-15 11:57 ` Stefan Weil [this message]

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=50CC65BD.7090103@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=1090600@bugs.launchpad.net \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.