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 <jc...@redhat.com> --- block.c | 30 +++++++++++++++--------------- include/block/block.h | 1 - 2 files changed, 15 insertions(+), 16 deletions(-) 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, -- 1.9.3