mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
block: Make BlockDriver method bdrv_eject() return void
Callees always return 0, except for FreeBSD's cdrom_eject(), which
returns -ENOTSUP when the device is in a terminally wedged state.
The only caller is bdrv_eject(), and it maps -ENOTSUP to 0 since
commit 4be9762a
.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
7bf37feddc
commit
822e1cd17e
4 changed files with 12 additions and 27 deletions
|
@ -1254,7 +1254,7 @@ static int floppy_media_changed(BlockDriverState *bs)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int floppy_eject(BlockDriverState *bs, int eject_flag)
|
||||
static void floppy_eject(BlockDriverState *bs, int eject_flag)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
int fd;
|
||||
|
@ -1269,8 +1269,6 @@ static int floppy_eject(BlockDriverState *bs, int eject_flag)
|
|||
perror("FDEJECT");
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BlockDriver bdrv_host_floppy = {
|
||||
|
@ -1348,7 +1346,7 @@ static int cdrom_is_inserted(BlockDriverState *bs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cdrom_eject(BlockDriverState *bs, int eject_flag)
|
||||
static void cdrom_eject(BlockDriverState *bs, int eject_flag)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
|
||||
|
@ -1359,8 +1357,6 @@ static int cdrom_eject(BlockDriverState *bs, int eject_flag)
|
|||
if (ioctl(s->fd, CDROMCLOSETRAY, NULL) < 0)
|
||||
perror("CDROMEJECT");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cdrom_set_locked(BlockDriverState *bs, int locked)
|
||||
|
@ -1462,12 +1458,12 @@ static int cdrom_is_inserted(BlockDriverState *bs)
|
|||
return raw_getlength(bs) > 0;
|
||||
}
|
||||
|
||||
static int cdrom_eject(BlockDriverState *bs, int eject_flag)
|
||||
static void cdrom_eject(BlockDriverState *bs, int eject_flag)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
|
||||
if (s->fd < 0)
|
||||
return -ENOTSUP;
|
||||
return;
|
||||
|
||||
(void) ioctl(s->fd, CDIOCALLOW);
|
||||
|
||||
|
@ -1479,9 +1475,7 @@ static int cdrom_eject(BlockDriverState *bs, int eject_flag)
|
|||
perror("CDIOCCLOSE");
|
||||
}
|
||||
|
||||
if (cdrom_reopen(bs) < 0)
|
||||
return -ENOTSUP;
|
||||
return 0;
|
||||
cdrom_reopen(bs);
|
||||
}
|
||||
|
||||
static void cdrom_set_locked(BlockDriverState *bs, int locked)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue