Patchwork [v2,19/45] block: Rename bdrv_set_locked() to bdrv_lock_medium()

login
register
mail settings
Submitter Markus Armbruster
Date Aug. 3, 2011, 1:07 p.m.
Message ID <1312376904-16115-20-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/108261/
State New
Headers show

Comments

Markus Armbruster - Aug. 3, 2011, 1:07 p.m.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block.c           |    8 ++++----
 block.h           |    2 +-
 block/raw-posix.c |    8 ++++----
 block/raw.c       |    6 +++---
 block_int.h       |    2 +-
 hw/ide/atapi.c    |    2 +-
 hw/scsi-disk.c    |    2 +-
 trace-events      |    2 +-
 8 files changed, 16 insertions(+), 16 deletions(-)
Kevin Wolf - Sept. 2, 2011, 11:30 a.m.
Am 03.08.2011 15:07, schrieb Markus Armbruster:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block.c           |    8 ++++----
>  block.h           |    2 +-
>  block/raw-posix.c |    8 ++++----
>  block/raw.c       |    6 +++---
>  block_int.h       |    2 +-
>  hw/ide/atapi.c    |    2 +-
>  hw/scsi-disk.c    |    2 +-
>  trace-events      |    2 +-
>  8 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 3a8a4e6..10c1b1a 100644
> --- a/block.c
> +++ b/block.c
> @@ -3037,14 +3037,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, int locked)

Make locked a bool while we're changing the signature everywhere?

Kevin
Markus Armbruster - Sept. 2, 2011, 2:58 p.m.
Kevin Wolf <kwolf@redhat.com> writes:

> Am 03.08.2011 15:07, schrieb Markus Armbruster:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  block.c           |    8 ++++----
>>  block.h           |    2 +-
>>  block/raw-posix.c |    8 ++++----
>>  block/raw.c       |    6 +++---
>>  block_int.h       |    2 +-
>>  hw/ide/atapi.c    |    2 +-
>>  hw/scsi-disk.c    |    2 +-
>>  trace-events      |    2 +-
>>  8 files changed, 16 insertions(+), 16 deletions(-)
>> 
>> diff --git a/block.c b/block.c
>> index 3a8a4e6..10c1b1a 100644
>> --- a/block.c
>> +++ b/block.c
>> @@ -3037,14 +3037,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, int locked)
>
> Make locked a bool while we're changing the signature everywhere?

Good idea.

Patch

diff --git a/block.c b/block.c
index 3a8a4e6..10c1b1a 100644
--- a/block.c
+++ b/block.c
@@ -3037,14 +3037,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, int 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 37d9048..4a6b957 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, int 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 c5c9944..b429baf 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1358,7 +1358,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, int locked)
 {
     BDRVRawState *s = bs->opaque;
 
@@ -1396,7 +1396,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,
@@ -1477,7 +1477,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, int locked)
 {
     BDRVRawState *s = bs->opaque;
 
@@ -1517,7 +1517,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 cb6203e..fa74ef1 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -80,9 +80,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, int 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)
@@ -138,7 +138,7 @@  static BlockDriver bdrv_raw = {
 
     .bdrv_is_inserted   = raw_is_inserted,
     .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 9eff892..eb7f46d 100644
--- a/block_int.h
+++ b/block_int.h
@@ -119,7 +119,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, int 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 6cb8f0e..1be6cbf 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -822,7 +822,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 6f5ec0d..79d7737 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -901,7 +901,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 19d31e3..f113042 100644
--- a/trace-events
+++ b/trace-events
@@ -65,7 +65,7 @@  disable bdrv_aio_multiwrite_latefail(void *mcb, int i) "mcb %p i %d"
 disable bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
 disable bdrv_aio_readv(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
 disable bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
-disable bdrv_set_locked(void *bs, int locked) "bs %p locked %d"
+disable bdrv_lock_medium(void *bs, int locked) "bs %p locked %d"
 disable bdrv_co_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
 disable bdrv_co_writev(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
 disable bdrv_co_io(int is_write, void *acb) "is_write %d acb %p"