This function will be needed in the next commit where we will
want to find virtio-mem given its alias by QEMU on the monitor.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_conf.c | 17 +++++++++++++++++
src/conf/domain_conf.h | 5 +++++
src/libvirt_private.syms | 1 +
3 files changed, 23 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 37cc3c3343..b2b92726ab 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16621,6 +16621,23 @@ virDomainMemoryFindByDeviceInfo(virDomainDef *def,
}
+virDomainMemoryDef *
+virDomainMemoryFindByDeviceAlias(virDomainDef *def,
+ const char *alias)
+{
+ size_t i;
+
+ for (i = 0; i < def->nmems; i++) {
+ virDomainMemoryDef *tmp = def->mems[i];
+
+ if (STREQ_NULLABLE(tmp->info.alias, alias))
+ return tmp;
+ }
+
+ return NULL;
+}
+
+
/**
* virDomainMemoryInsert:
*
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b7f9e66487..e054c1508e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3816,6 +3816,11 @@ virDomainMemoryFindByDeviceInfo(virDomainDef *dev,
int *pos)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
+virDomainMemoryDef *
+virDomainMemoryFindByDeviceAlias(virDomainDef *def,
+ const char *alias)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
+
int virDomainShmemDefInsert(virDomainDef *def, virDomainShmemDef *shmem)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
bool virDomainShmemDefEquals(virDomainShmemDef *src, virDomainShmemDef *dst)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d77502922d..21d10ec7a3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -508,6 +508,7 @@ virDomainMemballoonModelTypeFromString;
virDomainMemballoonModelTypeToString;
virDomainMemoryDefFree;
virDomainMemoryFindByDef;
+virDomainMemoryFindByDeviceAlias;
virDomainMemoryFindByDeviceInfo;
virDomainMemoryFindInactiveByDef;
virDomainMemoryInsert;
--
2.32.0