block: support known backing format for image create and open (Uri Lublin)

Added a backing_format field to BlockDriverState.
Added bdrv_create2 and drv->bdrv_create2 to create an image with
a known backing file format.
Upon bdrv_open2 if backing format is known use it, instead of
probing the (backing) image.

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6908 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
aliguori 2009-03-28 17:55:10 +00:00
parent 9b80ddf346
commit 5eb456396d
3 changed files with 35 additions and 4 deletions

View file

@ -91,6 +91,12 @@ struct BlockDriver {
BlockDriverCompletionFunc *cb, void *opaque);
AIOPool aio_pool;
/* new create with backing file format */
int (*bdrv_create2)(const char *filename, int64_t total_sectors,
const char *backing_file, const char *backing_format,
int flags);
struct BlockDriver *next;
};
@ -113,6 +119,7 @@ struct BlockDriverState {
char filename[1024];
char backing_file[1024]; /* if non zero, the image is a diff of
this file image */
char backing_format[16]; /* if non-zero and backing_file exists */
int is_temporary;
int media_changed;