summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Armbruster2011-09-06 18:58:47 +0200
committerKevin Wolf2011-09-12 15:17:20 +0200
commit025e849a50259447aad49a0b45f0133c6a0f5d16 (patch)
treef8d35912c6c0728d7cac71325eec762afb4a9dc7
parentblock: Drop medium lock tracking, ask device models instead (diff)
downloadqemu-025e849a50259447aad49a0b45f0133c6a0f5d16.tar.gz
qemu-025e849a50259447aad49a0b45f0133c6a0f5d16.tar.xz
qemu-025e849a50259447aad49a0b45f0133c6a0f5d16.zip
block: Rename bdrv_set_locked() to bdrv_lock_medium()
While there, make the locked parameter bool. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block.c8
-rw-r--r--block.h2
-rw-r--r--block/raw-posix.c8
-rw-r--r--block/raw.c6
-rw-r--r--block_int.h2
-rw-r--r--hw/ide/atapi.c2
-rw-r--r--hw/scsi-disk.c2
-rw-r--r--trace-events2
8 files changed, 16 insertions, 16 deletions
diff --git a/block.c b/block.c
index 1e4be7301b..7225b15bdf 100644
--- a/block.c
+++ b/block.c
@@ -3072,14 +3072,14 @@ void bdrv_eject(BlockDriverState *bs, int eject_flag)
* Lock or unlock the media (if it is locked, the user won't be able
* to eject it manually).
*/
-void bdrv_set_locked(BlockDriverState *bs, int locked)
+void bdrv_lock_medium(BlockDriverState *bs, bool locked)
{
BlockDriver *drv = bs->drv;
- trace_bdrv_set_locked(bs, locked);
+ trace_bdrv_lock_medium(bs, locked);
- if (drv && drv->bdrv_set_locked) {
- drv->bdrv_set_locked(bs, locked);
+ if (drv && drv->bdrv_lock_medium) {
+ drv->bdrv_lock_medium(bs, locked);
}
}
diff --git a/block.h b/block.h
index 396ca0ede2..4691090c8a 100644
--- a/block.h
+++ b/block.h
@@ -212,7 +212,7 @@ 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);
-void bdrv_set_locked(BlockDriverState *bs, int locked);
+void bdrv_lock_medium(BlockDriverState *bs, bool locked);
void bdrv_eject(BlockDriverState *bs, int eject_flag);
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
BlockDriverState *bdrv_find(const char *name);
diff --git a/block/raw-posix.c b/block/raw-posix.c
index bcf50b2cf7..a624f56f86 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1362,7 +1362,7 @@ static void cdrom_eject(BlockDriverState *bs, int eject_flag)
}
}
-static void cdrom_set_locked(BlockDriverState *bs, int locked)
+static void cdrom_lock_medium(BlockDriverState *bs, bool locked)
{
BDRVRawState *s = bs->opaque;
@@ -1400,7 +1400,7 @@ static BlockDriver bdrv_host_cdrom = {
/* removable device support */
.bdrv_is_inserted = cdrom_is_inserted,
.bdrv_eject = cdrom_eject,
- .bdrv_set_locked = cdrom_set_locked,
+ .bdrv_lock_medium = cdrom_lock_medium,
/* generic scsi device */
.bdrv_ioctl = hdev_ioctl,
@@ -1481,7 +1481,7 @@ static void cdrom_eject(BlockDriverState *bs, int eject_flag)
cdrom_reopen(bs);
}
-static void cdrom_set_locked(BlockDriverState *bs, int locked)
+static void cdrom_lock_medium(BlockDriverState *bs, bool locked)
{
BDRVRawState *s = bs->opaque;
@@ -1521,7 +1521,7 @@ static BlockDriver bdrv_host_cdrom = {
/* removable device support */
.bdrv_is_inserted = cdrom_is_inserted,
.bdrv_eject = cdrom_eject,
- .bdrv_set_locked = cdrom_set_locked,
+ .bdrv_lock_medium = cdrom_lock_medium,
};
#endif /* __FreeBSD__ */
diff --git a/block/raw.c b/block/raw.c
index f197479645..63cf2d3bf3 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -85,9 +85,9 @@ static void raw_eject(BlockDriverState *bs, int eject_flag)
bdrv_eject(bs->file, eject_flag);
}
-static void raw_set_locked(BlockDriverState *bs, int locked)
+static void raw_lock_medium(BlockDriverState *bs, bool locked)
{
- bdrv_set_locked(bs->file, locked);
+ bdrv_lock_medium(bs->file, locked);
}
static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
@@ -144,7 +144,7 @@ static BlockDriver bdrv_raw = {
.bdrv_is_inserted = raw_is_inserted,
.bdrv_media_changed = raw_media_changed,
.bdrv_eject = raw_eject,
- .bdrv_set_locked = raw_set_locked,
+ .bdrv_lock_medium = raw_lock_medium,
.bdrv_ioctl = raw_ioctl,
.bdrv_aio_ioctl = raw_aio_ioctl,
diff --git a/block_int.h b/block_int.h
index 4f7ff3be96..f42af2c33a 100644
--- a/block_int.h
+++ b/block_int.h
@@ -120,7 +120,7 @@ struct BlockDriver {
int (*bdrv_is_inserted)(BlockDriverState *bs);
int (*bdrv_media_changed)(BlockDriverState *bs);
void (*bdrv_eject)(BlockDriverState *bs, int eject_flag);
- void (*bdrv_set_locked)(BlockDriverState *bs, int locked);
+ void (*bdrv_lock_medium)(BlockDriverState *bs, bool locked);
/* to control generic scsi devices */
int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf);
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index afb27c60a2..06778f3bca 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -833,7 +833,7 @@ static void cmd_test_unit_ready(IDEState *s, uint8_t *buf)
static void cmd_prevent_allow_medium_removal(IDEState *s, uint8_t* buf)
{
s->tray_locked = buf[4] & 1;
- bdrv_set_locked(s->bs, buf[4] & 1);
+ bdrv_lock_medium(s->bs, buf[4] & 1);
ide_atapi_cmd_ok(s);
}
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 42682d0865..4e89bb1c9a 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -887,7 +887,7 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r, uint8_t *outbuf)
break;
case ALLOW_MEDIUM_REMOVAL:
s->tray_locked = req->cmd.buf[4] & 1;
- bdrv_set_locked(s->bs, req->cmd.buf[4] & 1);
+ bdrv_lock_medium(s->bs, req->cmd.buf[4] & 1);
break;
case READ_CAPACITY_10:
/* The normal LEN field for this command is zero. */
diff --git a/trace-events b/trace-events
index a8e76841a4..8bed3bea7a 100644
--- a/trace-events
+++ b/trace-events
@@ -62,7 +62,7 @@ bdrv_aio_multiwrite_latefail(void *mcb, int i) "mcb %p i %d"
bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
bdrv_aio_readv(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
-bdrv_set_locked(void *bs, int locked) "bs %p locked %d"
+bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
bdrv_co_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
bdrv_co_writev(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
bdrv_co_io(int is_write, void *acb) "is_write %d acb %p"