* [Qemu-devel] [PATCH] block: Probe file for specified format
@ 2012-12-15 11:35 Stefan Weil
2012-12-15 11:57 ` Stefan Weil
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2012-12-15 11:35 UTC (permalink / raw)
To: Stefan Hajnoczi, Kevin Wolf; +Cc: Stefan Weil, 1090600, qemu-devel
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 */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Probe file for specified format
2012-12-15 11:35 [Qemu-devel] [PATCH] block: Probe file for specified format Stefan Weil
@ 2012-12-15 11:57 ` Stefan Weil
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Weil @ 2012-12-15 11:57 UTC (permalink / raw)
To: Stefan Hajnoczi, Kevin Wolf; +Cc: 1090600, qemu-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-15 11:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-15 11:35 [Qemu-devel] [PATCH] block: Probe file for specified format Stefan Weil
2012-12-15 11:57 ` Stefan Weil
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.