diff options
author | Kevin Wolf <kwolf@redhat.com> | 2010-04-14 14:17:38 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-05-03 10:07:30 +0200 |
commit | 66f82ceed6781261c09e65fb440ca76842fd0500 (patch) | |
tree | 138160d48093543a87d4db02b94267d564e2d258 /block_int.h | |
parent | 579153325158d944be544ced96c6218e7d48802a (diff) | |
download | qemu-66f82ceed6781261c09e65fb440ca76842fd0500.zip qemu-66f82ceed6781261c09e65fb440ca76842fd0500.tar.gz qemu-66f82ceed6781261c09e65fb440ca76842fd0500.tar.bz2 |
block: Open the underlying image file in generic code
Format drivers shouldn't need to bother with things like file names, but rather
just get an open BlockDriverState for the underlying protocol. This patch
introduces this behaviour for bdrv_open implementation. For protocols which
need to access the filename to open their file/device/connection/... a new
callback bdrv_file_open is introduced which doesn't get an underlying file
opened.
For now, also some of the more obscure formats use bdrv_file_open because they
open() the file themselves instead of using the block.c functions. They need to
be fixed in later patches.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block_int.h')
-rw-r--r-- | block_int.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block_int.h b/block_int.h index d4067ff..a3afe63 100644 --- a/block_int.h +++ b/block_int.h @@ -51,7 +51,8 @@ struct BlockDriver { int instance_size; int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename); int (*bdrv_probe_device)(const char *filename); - int (*bdrv_open)(BlockDriverState *bs, const char *filename, int flags); + int (*bdrv_open)(BlockDriverState *bs, int flags); + int (*bdrv_file_open)(BlockDriverState *bs, const char *filename, int flags); int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors); int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num, @@ -155,6 +156,8 @@ struct BlockDriverState { int media_changed; BlockDriverState *backing_hd; + BlockDriverState *file; + /* async read/write emulation */ void *sync_aiocb; |