提交 7bf37fed 编写于 作者: M Markus Armbruster 提交者: Kevin Wolf

block: Make BlockDriver method bdrv_set_locked() return void

The only caller is bdrv_set_locked(), and it ignores the value.

Callees always return 0, except for FreeBSD's cdrom_set_locked(),
which returns -ENOTSUP when the device is in a terminally wedged
state.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 02266d54
...@@ -1363,7 +1363,7 @@ static int cdrom_eject(BlockDriverState *bs, int eject_flag) ...@@ -1363,7 +1363,7 @@ static int cdrom_eject(BlockDriverState *bs, int eject_flag)
return 0; return 0;
} }
static int cdrom_set_locked(BlockDriverState *bs, int locked) static void cdrom_set_locked(BlockDriverState *bs, int locked)
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
...@@ -1374,8 +1374,6 @@ static int cdrom_set_locked(BlockDriverState *bs, int locked) ...@@ -1374,8 +1374,6 @@ static int cdrom_set_locked(BlockDriverState *bs, int locked)
*/ */
/* perror("CDROM_LOCKDOOR"); */ /* perror("CDROM_LOCKDOOR"); */
} }
return 0;
} }
static BlockDriver bdrv_host_cdrom = { static BlockDriver bdrv_host_cdrom = {
...@@ -1486,12 +1484,12 @@ static int cdrom_eject(BlockDriverState *bs, int eject_flag) ...@@ -1486,12 +1484,12 @@ static int cdrom_eject(BlockDriverState *bs, int eject_flag)
return 0; return 0;
} }
static int cdrom_set_locked(BlockDriverState *bs, int locked) static void cdrom_set_locked(BlockDriverState *bs, int locked)
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
if (s->fd < 0) if (s->fd < 0)
return -ENOTSUP; return;
if (ioctl(s->fd, (locked ? CDIOCPREVENT : CDIOCALLOW)) < 0) { if (ioctl(s->fd, (locked ? CDIOCPREVENT : CDIOCALLOW)) < 0) {
/* /*
* Note: an error can happen if the distribution automatically * Note: an error can happen if the distribution automatically
...@@ -1499,8 +1497,6 @@ static int cdrom_set_locked(BlockDriverState *bs, int locked) ...@@ -1499,8 +1497,6 @@ static int cdrom_set_locked(BlockDriverState *bs, int locked)
*/ */
/* perror("CDROM_LOCKDOOR"); */ /* perror("CDROM_LOCKDOOR"); */
} }
return 0;
} }
static BlockDriver bdrv_host_cdrom = { static BlockDriver bdrv_host_cdrom = {
......
...@@ -80,10 +80,9 @@ static int raw_eject(BlockDriverState *bs, int eject_flag) ...@@ -80,10 +80,9 @@ static int raw_eject(BlockDriverState *bs, int eject_flag)
return bdrv_eject(bs->file, eject_flag); return bdrv_eject(bs->file, eject_flag);
} }
static int raw_set_locked(BlockDriverState *bs, int locked) static void raw_set_locked(BlockDriverState *bs, int locked)
{ {
bdrv_set_locked(bs->file, locked); bdrv_set_locked(bs->file, locked);
return 0;
} }
static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
......
...@@ -113,7 +113,7 @@ struct BlockDriver { ...@@ -113,7 +113,7 @@ struct BlockDriver {
int (*bdrv_is_inserted)(BlockDriverState *bs); int (*bdrv_is_inserted)(BlockDriverState *bs);
int (*bdrv_media_changed)(BlockDriverState *bs); int (*bdrv_media_changed)(BlockDriverState *bs);
int (*bdrv_eject)(BlockDriverState *bs, int eject_flag); int (*bdrv_eject)(BlockDriverState *bs, int eject_flag);
int (*bdrv_set_locked)(BlockDriverState *bs, int locked); void (*bdrv_set_locked)(BlockDriverState *bs, int locked);
/* to control generic scsi devices */ /* to control generic scsi devices */
int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf); int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册