From 0e49de5232f47c9e58adb82c28d4f42be933d891 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 3 Aug 2011 15:07:41 +0200 Subject: block: Generalize change_cb() to BlockDevOps So we can more easily add device model callbacks. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- block.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'block.h') diff --git a/block.h b/block.h index c8eea67..a72cfc9 100644 --- a/block.h +++ b/block.h @@ -28,6 +28,10 @@ typedef struct QEMUSnapshotInfo { uint64_t vm_clock_nsec; /* VM clock relative to boot */ } QEMUSnapshotInfo; +typedef struct BlockDevOps { + void (*change_cb)(void *opaque, int reason); +} BlockDevOps; + #define BDRV_O_RDWR 0x0002 #define BDRV_O_SNAPSHOT 0x0008 /* open the file read only and save writes in a snapshot */ #define BDRV_O_NOCACHE 0x0020 /* do not use the host page cache */ @@ -78,6 +82,8 @@ int bdrv_attach_dev(BlockDriverState *bs, void *dev); void bdrv_attach_dev_nofail(BlockDriverState *bs, void *dev); void bdrv_detach_dev(BlockDriverState *bs, void *dev); void *bdrv_get_attached_dev(BlockDriverState *bs); +void bdrv_set_dev_ops(BlockDriverState *bs, const BlockDevOps *ops, + void *opaque); int bdrv_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors); int bdrv_write(BlockDriverState *bs, int64_t sector_num, @@ -193,9 +199,6 @@ int bdrv_media_changed(BlockDriverState *bs); int bdrv_is_locked(BlockDriverState *bs); void bdrv_set_locked(BlockDriverState *bs, int locked); int bdrv_eject(BlockDriverState *bs, int eject_flag); -void bdrv_set_change_cb(BlockDriverState *bs, - void (*change_cb)(void *opaque, int reason), - void *opaque); void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size); BlockDriverState *bdrv_find(const char *name); BlockDriverState *bdrv_next(BlockDriverState *bs); -- cgit v1.1