diff mbox

[v2,05/23] block: Code motion to get rid of stubs/blockdev.c

Message ID 1410620427-20089-6-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Sept. 13, 2014, 3 p.m. UTC
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/block-backend.c     | 15 +++++++++++++++
 blockdev.c                | 13 -------------
 include/sysemu/blockdev.h |  1 -
 stubs/Makefile.objs       |  1 -
 stubs/blockdev.c          | 12 ------------
 5 files changed, 15 insertions(+), 27 deletions(-)
 delete mode 100644 stubs/blockdev.c

Comments

Fam Zheng Sept. 15, 2014, 6:28 a.m. UTC | #1
On Sat, 09/13 17:00, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block/block-backend.c     | 15 +++++++++++++++
>  blockdev.c                | 13 -------------
>  include/sysemu/blockdev.h |  1 -
>  stubs/Makefile.objs       |  1 -
>  stubs/blockdev.c          | 12 ------------

Where is the stubs/blockdev.c from? I don't see it in qemu.git.

Fam
Markus Armbruster Sept. 15, 2014, 7:21 a.m. UTC | #2
Fam Zheng <famz@redhat.com> writes:

> On Sat, 09/13 17:00, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  block/block-backend.c     | 15 +++++++++++++++
>>  blockdev.c                | 13 -------------
>>  include/sysemu/blockdev.h |  1 -
>>  stubs/Makefile.objs       |  1 -
>>  stubs/blockdev.c          | 12 ------------
>
> Where is the stubs/blockdev.c from? I don't see it in qemu.git.

It's from
[PATCH 2/4] block: Keep DriveInfo alive until BlockDriverState dies
part of
[PATCH 0/4] Miscellaneous block fixes

See cover letter for additional dependencies.
Fam Zheng Sept. 15, 2014, 7:23 a.m. UTC | #3
On Mon, 09/15 09:21, Markus Armbruster wrote:
> Fam Zheng <famz@redhat.com> writes:
> 
> > On Sat, 09/13 17:00, Markus Armbruster wrote:
> >> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> >> ---
> >>  block/block-backend.c     | 15 +++++++++++++++
> >>  blockdev.c                | 13 -------------
> >>  include/sysemu/blockdev.h |  1 -
> >>  stubs/Makefile.objs       |  1 -
> >>  stubs/blockdev.c          | 12 ------------
> >
> > Where is the stubs/blockdev.c from? I don't see it in qemu.git.
> 
> It's from
> [PATCH 2/4] block: Keep DriveInfo alive until BlockDriverState dies
> part of
> [PATCH 0/4] Miscellaneous block fixes
> 
> See cover letter for additional dependencies.

Missed that, thanks!

Fam
Benoît Canet Sept. 16, 2014, 12:40 p.m. UTC | #4
On Sat, Sep 13, 2014 at 05:00:09PM +0200, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block/block-backend.c     | 15 +++++++++++++++
>  blockdev.c                | 13 -------------
>  include/sysemu/blockdev.h |  1 -
>  stubs/Makefile.objs       |  1 -
>  stubs/blockdev.c          | 12 ------------
>  5 files changed, 15 insertions(+), 27 deletions(-)
>  delete mode 100644 stubs/blockdev.c
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 7b8c062..0842abe 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -22,6 +22,8 @@ struct BlockBackend {
>      QTAILQ_ENTRY(BlockBackend) link; /* for blk_backends */
>  };
>  
> +static void drive_info_del(DriveInfo *dinfo);
> +
>  /* All the BlockBackends (except for hidden ones) */
>  static QTAILQ_HEAD(, BlockBackend) blk_backends =
>      QTAILQ_HEAD_INITIALIZER(blk_backends);
> @@ -92,6 +94,19 @@ static void blk_delete(BlockBackend *blk)
>      g_free(blk);
>  }
>  
> +static void drive_info_del(DriveInfo *dinfo)
> +{
> +    if (!dinfo) {
> +        return;
> +    }
> +    if (dinfo->opts) {
> +        qemu_opts_del(dinfo->opts);
> +    }
> +    g_free(dinfo->id);
> +    g_free(dinfo->serial);
> +    g_free(dinfo);
> +}
> +
>  /*
>   * Increment @blk's reference count.
>   * @blk must not be null.
> diff --git a/blockdev.c b/blockdev.c
> index aec9f0e..0ed108d 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -223,19 +223,6 @@ void drive_del(DriveInfo *dinfo)
>      blk_unref(blk_by_legacy_dinfo(dinfo));
>  }
>  
> -void drive_info_del(DriveInfo *dinfo)
> -{
> -    if (!dinfo) {
> -        return;
> -    }
> -    if (dinfo->opts) {
> -        qemu_opts_del(dinfo->opts);
> -    }
> -    g_free(dinfo->id);
> -    g_free(dinfo->serial);
> -    g_free(dinfo);
> -}
> -
>  typedef struct {
>      QEMUBH *bh;
>      BlockDriverState *bs;
> diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
> index 1dc5906..2ed297b 100644
> --- a/include/sysemu/blockdev.h
> +++ b/include/sysemu/blockdev.h
> @@ -60,7 +60,6 @@ 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);
> -void drive_info_del(DriveInfo *dinfo);
>  
>  /* device-hotplug */
>  
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index c0b1f6a..5e347d0 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -1,6 +1,5 @@
>  stub-obj-y += arch-query-cpu-def.o
>  stub-obj-y += bdrv-commit-all.o
> -stub-obj-y += blockdev.o
>  stub-obj-y += chr-baum-init.o
>  stub-obj-y += chr-msmouse.o
>  stub-obj-y += chr-testdev.o
> diff --git a/stubs/blockdev.c b/stubs/blockdev.c
> deleted file mode 100644
> index 5d0a79c..0000000
> --- a/stubs/blockdev.c
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -#include <assert.h>
> -#include "sysemu/blockdev.h"
> -
> -DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
> -{
> -    return NULL;
> -}
> -
> -void drive_info_del(DriveInfo *dinfo)
> -{
> -    assert(!dinfo);
> -}
> -- 
> 1.9.3
> 
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
diff mbox

Patch

diff --git a/block/block-backend.c b/block/block-backend.c
index 7b8c062..0842abe 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -22,6 +22,8 @@  struct BlockBackend {
     QTAILQ_ENTRY(BlockBackend) link; /* for blk_backends */
 };
 
+static void drive_info_del(DriveInfo *dinfo);
+
 /* All the BlockBackends (except for hidden ones) */
 static QTAILQ_HEAD(, BlockBackend) blk_backends =
     QTAILQ_HEAD_INITIALIZER(blk_backends);
@@ -92,6 +94,19 @@  static void blk_delete(BlockBackend *blk)
     g_free(blk);
 }
 
+static void drive_info_del(DriveInfo *dinfo)
+{
+    if (!dinfo) {
+        return;
+    }
+    if (dinfo->opts) {
+        qemu_opts_del(dinfo->opts);
+    }
+    g_free(dinfo->id);
+    g_free(dinfo->serial);
+    g_free(dinfo);
+}
+
 /*
  * Increment @blk's reference count.
  * @blk must not be null.
diff --git a/blockdev.c b/blockdev.c
index aec9f0e..0ed108d 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -223,19 +223,6 @@  void drive_del(DriveInfo *dinfo)
     blk_unref(blk_by_legacy_dinfo(dinfo));
 }
 
-void drive_info_del(DriveInfo *dinfo)
-{
-    if (!dinfo) {
-        return;
-    }
-    if (dinfo->opts) {
-        qemu_opts_del(dinfo->opts);
-    }
-    g_free(dinfo->id);
-    g_free(dinfo->serial);
-    g_free(dinfo);
-}
-
 typedef struct {
     QEMUBH *bh;
     BlockDriverState *bs;
diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
index 1dc5906..2ed297b 100644
--- a/include/sysemu/blockdev.h
+++ b/include/sysemu/blockdev.h
@@ -60,7 +60,6 @@  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);
-void drive_info_del(DriveInfo *dinfo);
 
 /* device-hotplug */
 
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index c0b1f6a..5e347d0 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -1,6 +1,5 @@ 
 stub-obj-y += arch-query-cpu-def.o
 stub-obj-y += bdrv-commit-all.o
-stub-obj-y += blockdev.o
 stub-obj-y += chr-baum-init.o
 stub-obj-y += chr-msmouse.o
 stub-obj-y += chr-testdev.o
diff --git a/stubs/blockdev.c b/stubs/blockdev.c
deleted file mode 100644
index 5d0a79c..0000000
--- a/stubs/blockdev.c
+++ /dev/null
@@ -1,12 +0,0 @@ 
-#include <assert.h>
-#include "sysemu/blockdev.h"
-
-DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
-{
-    return NULL;
-}
-
-void drive_info_del(DriveInfo *dinfo)
-{
-    assert(!dinfo);
-}