qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, benoit.canet@nodalink.com, stefanha@redhat.com,
	mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v6 07/24] blockdev: Eliminate drive_del()
Date: Tue,  7 Oct 2014 13:59:09 +0200	[thread overview]
Message-ID: <1412683166-4934-8-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1412683166-4934-1-git-send-email-armbru@redhat.com>

drive_del() has become a trivial wrapper around blk_unref().  Get rid
of it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 blockdev.c                | 9 ++-------
 device-hotplug.c          | 3 ++-
 hw/ide/piix.c             | 4 +++-
 include/sysemu/blockdev.h | 1 -
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 63f797b..3038203 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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);
diff --git a/device-hotplug.c b/device-hotplug.c
index e6a1ffb..9e38cc4 100644
--- a/device-hotplug.c
+++ b/device-hotplug.c
@@ -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));
     }
 }
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 49e78a7..ec93977 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -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));
diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
index ccd4bf4..439844d 100644
--- a/include/sysemu/blockdev.h
+++ b/include/sysemu/blockdev.h
@@ -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 */
 
-- 
1.9.3

  parent reply	other threads:[~2014-10-07 11:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 11:59 [Qemu-devel] [PATCH v6 00/24] Split BlockBackend off BDS with an axe Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 01/24] block: Split bdrv_new_root() off bdrv_new() Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 02/24] block: New BlockBackend Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 03/24] block: Connect BlockBackend to BlockDriverState Markus Armbruster
2014-10-07 15:51   ` Max Reitz
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 04/24] block: Connect BlockBackend and DriveInfo Markus Armbruster
2014-10-07 15:59   ` Max Reitz
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 05/24] block: Code motion to get rid of stubs/blockdev.c Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 06/24] block: Make BlockBackend own its BlockDriverState Markus Armbruster
2014-10-07 11:59 ` Markus Armbruster [this message]
2014-10-07 16:04   ` [Qemu-devel] [PATCH v6 07/24] blockdev: Eliminate drive_del() Max Reitz
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 08/24] block: Eliminate bdrv_iterate(), use bdrv_next() Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 09/24] block: Eliminate BlockDriverState member device_name[] Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 10/24] block: Merge BlockBackend and BlockDriverState name spaces Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 11/24] block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo() Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 12/24] block: Rename BlockDriverAIOCB* to BlockAIOCB* Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 13/24] block: Rename BlockDriverCompletionFunc to BlockCompletionFunc Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 14/24] virtio-blk: Drop redundant VirtIOBlock member conf Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 15/24] virtio-blk: Rename VirtIOBlkConf variables to conf Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 16/24] hw: Convert from BlockDriverState to BlockBackend, mostly Markus Armbruster
2014-10-07 16:10   ` Max Reitz
2014-10-17 18:31   ` Kevin Wolf
2014-10-20  8:19     ` Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 17/24] ide: Complete conversion from BlockDriverState to BlockBackend Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 18/24] pc87312: Drop unused members of PC87312State Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 19/24] blockdev: Drop superfluous DriveInfo member id Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 20/24] blockdev: Fix blockdev-add not to create DriveInfo Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 21/24] block/qapi: Convert qmp_query_block() to BlockBackend Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 22/24] blockdev: Convert qmp_eject(), qmp_change_blockdev() " Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 23/24] block: Lift device model API into BlockBackend Markus Armbruster
2014-10-07 11:59 ` [Qemu-devel] [PATCH v6 24/24] block: Make device model's references to BlockBackend strong Markus Armbruster
2014-10-17 19:07 ` [Qemu-devel] [PATCH v6 00/24] Split BlockBackend off BDS with an axe Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412683166-4934-8-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=benoit.canet@nodalink.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).