]> git.proxmox.com Git - mirror_qemu.git/commitdiff
blockdev: Eliminate drive_del()
authorMarkus Armbruster <armbru@redhat.com>
Tue, 7 Oct 2014 11:59:09 +0000 (13:59 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 20 Oct 2014 11:41:26 +0000 (13:41 +0200)
drive_del() has become a trivial wrapper around blk_unref().  Get rid
of it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev.c
device-hotplug.c
hw/ide/piix.c
include/sysemu/blockdev.h

index 63f797b417095ef6a3846b68132ee7f1e74639cb..30382031b8e3bbf6d69b23338c7ecae68a748376 100644 (file)
@@ -134,7 +134,7 @@ void blockdev_auto_del(BlockDriverState *bs)
     DriveInfo *dinfo = blk_legacy_dinfo(blk);
 
     if (dinfo && dinfo->auto_del) {
-        drive_del(dinfo);
+        blk_unref(blk);
     }
 }
 
@@ -276,11 +276,6 @@ static void bdrv_format_print(void *opaque, const char *name)
     error_printf(" %s", name);
 }
 
-void drive_del(DriveInfo *dinfo)
-{
-    blk_unref(dinfo->bdrv->blk);
-}
-
 typedef struct {
     QEMUBH *bh;
     BlockDriverState *bs;
@@ -1867,7 +1862,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
         bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT,
                           BLOCKDEV_ON_ERROR_REPORT);
     } else {
-        drive_del(dinfo);
+        blk_unref(blk);
     }
 
     aio_context_release(aio_context);
index e6a1ffb9fabe3748909c3618e955d1ad57c91071..9e38cc4808f75c965b8284776bf138095f9a1889 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "hw/hw.h"
 #include "hw/boards.h"
+#include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "qemu/config-file.h"
 #include "sysemu/sysemu.h"
@@ -76,6 +77,6 @@ void drive_hot_add(Monitor *mon, const QDict *qdict)
 
 err:
     if (dinfo) {
-        drive_del(dinfo);
+        blk_unref(blk_by_legacy_dinfo(dinfo));
     }
 }
index 49e78a738af04992eb7d88027867022a5a70ebd6..ec93977e53a948a252522bab44d946805cd735ab 100644 (file)
@@ -27,6 +27,7 @@
 #include <hw/i386/pc.h>
 #include <hw/pci/pci.h>
 #include <hw/isa/isa.h>
+#include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/dma.h"
@@ -178,12 +179,13 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
     for (; i < 3; i++) {
         di = drive_get_by_index(IF_IDE, i);
         if (di != NULL && !di->media_cd) {
+            BlockBackend *blk = blk_by_legacy_dinfo(di);
             DeviceState *ds = bdrv_get_attached_dev(di->bdrv);
             if (ds) {
                 bdrv_detach_dev(di->bdrv, ds);
             }
             pci_ide->bus[di->bus].ifs[di->unit].bs = NULL;
-            drive_del(di);
+            blk_unref(blk);
         }
     }
     qdev_reset_all(DEVICE(dev));
index ccd4bf487e2e53d9bd7303b0798c34adfb3cb819..439844d6dd0de1c970c979e1ff551e4dbb2b9237 100644 (file)
@@ -64,7 +64,6 @@ QemuOpts *drive_def(const char *optstr);
 QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
                     const char *optstr);
 DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
-void drive_del(DriveInfo *dinfo);
 
 /* device-hotplug */