[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/4] include/sysemu/blockdev.c: introduce block_if_name
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v2 2/4] include/sysemu/blockdev.c: introduce block_if_name |
Date: |
Tue, 30 Nov 2021 04:46:31 -0500 |
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(+)
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);
--
2.31.1