aboutsummaryrefslogtreecommitdiff
path: root/block.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-09-06 18:58:46 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-12 15:17:20 +0200
commitf107639a6ff0c8d02f6a2dfdfce3a9d9f1e2eb27 (patch)
tree0c5368f533034b7e1adbd02be5dcff6367cf3a94 /block.h
parentfdec4404ddfaf9e121bef84eac1303a8a0e47d75 (diff)
block: Drop medium lock tracking, ask device models instead
Requires new BlockDevOps member is_medium_locked(). Implement for IDE and SCSI CD-ROMs. 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.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/block.h b/block.h
index 5d941e9aff..396ca0ede2 100644
--- a/block.h
+++ b/block.h
@@ -37,6 +37,11 @@ typedef struct BlockDevOps {
*/
void (*change_media_cb)(void *opaque);
/*
+ * Is the virtual medium locked into the device?
+ * Device models implement this only when device has such a lock.
+ */
+ bool (*is_medium_locked)(void *opaque);
+ /*
* Runs when the size changed (e.g. monitor command block_resize)
*/
void (*resize_cb)(void *opaque);
@@ -94,6 +99,7 @@ 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);
+bool bdrv_dev_is_medium_locked(BlockDriverState *bs);
int bdrv_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors);
int bdrv_write(BlockDriverState *bs, int64_t sector_num,
@@ -206,7 +212,6 @@ int bdrv_is_sg(BlockDriverState *bs);
int bdrv_enable_write_cache(BlockDriverState *bs);
int bdrv_is_inserted(BlockDriverState *bs);
int bdrv_media_changed(BlockDriverState *bs);
-int bdrv_is_locked(BlockDriverState *bs);
void bdrv_set_locked(BlockDriverState *bs, int locked);
void bdrv_eject(BlockDriverState *bs, int eject_flag);
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);