diff mbox

[2/3] block: make bdrv_find_node() static

Message ID 25b0b758619647b1094ad69853c3c772811c165a.1444827043.git.jcody@redhat.com
State New
Headers show

Commit Message

Jeff Cody Oct. 14, 2015, 1:16 p.m. UTC
This patch does two things: it moves bdrv_find_node() up before the
first usage in block.c, and it makes the function static so that it
is only internal to block.c.

Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 block.c               | 30 +++++++++++++++---------------
 include/block/block.h |  1 -
 2 files changed, 15 insertions(+), 16 deletions(-)

Comments

Max Reitz Oct. 14, 2015, 5:41 p.m. UTC | #1
On 14.10.2015 15:16, Jeff Cody wrote:
> This patch does two things: it moves bdrv_find_node() up before the
> first usage in block.c, and it makes the function static so that it
> is only internal to block.c.
> 
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  block.c               | 30 +++++++++++++++---------------
>  include/block/block.h |  1 -
>  2 files changed, 15 insertions(+), 16 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>
Alberto Garcia Oct. 15, 2015, 12:01 p.m. UTC | #2
On Wed 14 Oct 2015 03:16:01 PM CEST, Jeff Cody wrote:
> This patch does two things: it moves bdrv_find_node() up before the
> first usage in block.c, and it makes the function static so that it
> is only internal to block.c.
>
> Signed-off-by: Jeff Cody <jcody@redhat.com>

Reviewed-by: Alberto Garcia <berto@igalia.com>
diff mbox

Patch

diff --git a/block.c b/block.c
index f95a59d..da1a6a9 100644
--- a/block.c
+++ b/block.c
@@ -759,6 +759,21 @@  static int bdrv_open_flags(BlockDriverState *bs, int flags)
     return open_flags;
 }
 
+/* This function is to find a node in the bs graph */
+static BlockDriverState *bdrv_find_node(const char *node_name)
+{
+    BlockDriverState *bs;
+
+    assert(node_name);
+
+    QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {
+        if (!strcmp(node_name, bs->node_name)) {
+            return bs;
+        }
+    }
+    return NULL;
+}
+
 static void bdrv_assign_node_name(BlockDriverState *bs,
                                   const char *node_name,
                                   Error **errp)
@@ -2720,21 +2735,6 @@  void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
     g_free(formats);
 }
 
-/* This function is to find a node in the bs graph */
-BlockDriverState *bdrv_find_node(const char *node_name)
-{
-    BlockDriverState *bs;
-
-    assert(node_name);
-
-    QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {
-        if (!strcmp(node_name, bs->node_name)) {
-            return bs;
-        }
-    }
-    return NULL;
-}
-
 /* Put this QMP function here so it can access the static graph_bdrv_states. */
 BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp)
 {
diff --git a/include/block/block.h b/include/block/block.h
index 1520dee..2b6e1b2 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -404,7 +404,6 @@  int bdrv_media_changed(BlockDriverState *bs);
 void bdrv_lock_medium(BlockDriverState *bs, bool locked);
 void bdrv_eject(BlockDriverState *bs, bool eject_flag);
 const char *bdrv_get_format_name(BlockDriverState *bs);
-BlockDriverState *bdrv_find_node(const char *node_name);
 BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp);
 BlockDriverState *bdrv_lookup_bs(const char *device,
                                  const char *node_name,