aboutsummaryrefslogtreecommitdiff
path: root/block.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-08-03 15:07:41 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-06 11:23:51 +0200
commit0e49de5232f47c9e58adb82c28d4f42be933d891 (patch)
treec0204e2cf08f38a843060372a4165d89ca38de61 /block.h
parentfa879d62eb51253d00b6920ce1d1d9d261370a49 (diff)
block: Generalize change_cb() to BlockDevOps
So we can more easily add device model callbacks. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.h')
-rw-r--r--block.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/block.h b/block.h
index c8eea678d5..a72cfc9fe6 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);