Am 30.10.2011 11:35, schrieb Supriya Kannery: > Struct BDRVReopenState along with three reopen related functions > introduced for handling reopen state of images safely. This can be > extended by each of the block drivers to reopen respective > image files. > > Signed-off-by: Supriya Kannery <supri...@linux.vnet.ibm.com>
> Index: qemu/block_int.h > =================================================================== > --- qemu.orig/block_int.h > +++ qemu/block_int.h > @@ -55,6 +55,14 @@ struct BlockDriver { > 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, int flags); > + > + /* For handling image reopen for split or non-split files */ > + int (*bdrv_reopen_prepare)(BlockDriverState *bs, BDRVReopenState **rs, > + int flags); > + void (*bdrv_reopen_commit)(BlockDriverState *bs, BDRVReopenState *rs, > + int flags); > + void (*bdrv_reopen_abort)(BlockDriverState *bs, BDRVReopenState *rs); > + > 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); > @@ -211,6 +219,14 @@ struct BlockDriverState { > void *private; > }; > > +struct BDRVReopenState { > + BlockDriverState *bs; > + int reopen_flags; > + > + /* For raw-posix */ > + int reopen_fd; > +}; I think I commented the same on the previous version: BDRVReopenState shouldn't contain any format specific fields. raw-posix must extend the struct like this and use container_of() to get it from a BDRVReopenState pointer: struct BDRVRawReopenState { BDRVReopenState common; int reopen_fd; }; Kevin