On 2014-10-29 at 06:04, Fam Zheng wrote:
This returns the node name of a BDS. Remove the TODO comment and expect
the callers to be explicit.

Signed-off-by: Fam Zheng <f...@redhat.com>
---
  block.c               | 6 +++++-
  include/block/block.h | 1 +
  2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index c92a913..1448e38 100644
--- a/block.c
+++ b/block.c
@@ -3791,7 +3791,11 @@ BlockDriverState *bdrv_next(BlockDriverState *bs)
      return QTAILQ_NEXT(bs, device_list);
  }
-/* TODO check what callers really want: bs->node_name or blk_name() */

Well, we still need to check this, don't we? cscope tells me there are 61 callers of bdrv_get_device_name() and not all of them look like they always query a BDS with a BB.

Max

+const char *bdrv_get_node_name(const BlockDriverState *bs)
+{
+    return bs->node_name;
+}
+
  const char *bdrv_get_device_name(const BlockDriverState *bs)
  {
      return bs->blk ? blk_name(bs->blk) : "";
diff --git a/include/block/block.h b/include/block/block.h
index 25acd81..71fff2c 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -373,6 +373,7 @@ int bdrv_set_key(BlockDriverState *bs, const char *key);
  int bdrv_query_missing_keys(void);
  void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
                           void *opaque);
+const char *bdrv_get_node_name(const BlockDriverState *bs);
  const char *bdrv_get_device_name(const BlockDriverState *bs);
  int bdrv_get_flags(BlockDriverState *bs);
  int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,


Reply via email to