diff mbox series

[v2,2/4] include/sysemu/blockdev.c: introduce block_if_name

Message ID 20211130094633.277982-3-eesposit@redhat.com
State New
Headers show
Series block: minor refactoring in preparation to the block layer API split | expand

Commit Message

Emanuele Giuseppe Esposito Nov. 30, 2021, 9:46 a.m. UTC
Add a getter function for the if_name array, so that also
outside functions can access it.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 blockdev.c                | 5 +++++
 include/sysemu/blockdev.h | 1 +
 2 files changed, 6 insertions(+)

Comments

Stefan Hajnoczi Dec. 13, 2021, 3:40 p.m. UTC | #1
On Tue, Nov 30, 2021 at 04:46:31AM -0500, Emanuele Giuseppe Esposito wrote:
> Add a getter function for the if_name array, so that also
> outside functions can access it.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  blockdev.c                | 5 +++++
>  include/sysemu/blockdev.h | 1 +
>  2 files changed, 6 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox series

Patch

diff --git a/blockdev.c b/blockdev.c
index b35072644e..1581f0d2f5 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -83,6 +83,11 @@  static const char *const if_name[IF_COUNT] = {
     [IF_XEN] = "xen",
 };
 
+const char *block_if_name(BlockInterfaceType iface)
+{
+    return if_name[iface];
+}
+
 static int if_max_devs[IF_COUNT] = {
     /*
      * Do not change these numbers!  They govern how drive option
diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
index 32c2d6023c..b321286dee 100644
--- a/include/sysemu/blockdev.h
+++ b/include/sysemu/blockdev.h
@@ -42,6 +42,7 @@  DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
 DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo);
 BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo);
 
+const char *block_if_name(BlockInterfaceType iface);
 void override_max_devs(BlockInterfaceType type, int max_devs);
 
 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);