aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-07-20 18:23:42 +0200
committerKevin Wolf <kwolf@redhat.com>2011-08-01 12:10:28 +0200
commit822e1cd17e8fa3ae98d0481c20f042316ace3fbc (patch)
tree7105535f346629f7d0ec761fee06a1221f037dd5 /block.c
parent7bf37feddcfa527304cfdc02bd2db8912ee9bf8c (diff)
downloadqemu-822e1cd17e8fa3ae98d0481c20f042316ace3fbc.zip
qemu-822e1cd17e8fa3ae98d0481c20f042316ace3fbc.tar.gz
qemu-822e1cd17e8fa3ae98d0481c20f042316ace3fbc.tar.bz2
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>
Diffstat (limited to 'block.c')
-rw-r--r--block.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/block.c b/block.c
index 81a8257..7c25fe4 100644
--- a/block.c
+++ b/block.c
@@ -2770,25 +2770,16 @@ int bdrv_media_changed(BlockDriverState *bs)
int bdrv_eject(BlockDriverState *bs, int eject_flag)
{
BlockDriver *drv = bs->drv;
- int ret;
if (bs->locked) {
return -EBUSY;
}
- if (!drv || !drv->bdrv_eject) {
- ret = -ENOTSUP;
- } else {
- ret = drv->bdrv_eject(bs, eject_flag);
- }
- if (ret == -ENOTSUP) {
- ret = 0;
+ if (drv && drv->bdrv_eject) {
+ drv->bdrv_eject(bs, eject_flag);
}
- if (ret >= 0) {
- bs->tray_open = eject_flag;
- }
-
- return ret;
+ bs->tray_open = eject_flag;
+ return 0;
}
int bdrv_is_locked(BlockDriverState *bs)