|
|
127bba |
From 378bfb59a59c8b029c95f538fee46262a2c72116 Mon Sep 17 00:00:00 2001
|
|
|
127bba |
Message-Id: <378bfb59a59c8b029c95f538fee46262a2c72116@dist-git>
|
|
|
127bba |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
127bba |
Date: Fri, 4 Nov 2016 10:29:44 +0100
|
|
|
127bba |
Subject: [PATCH] conf: Add some shmem helpers for future use
|
|
|
127bba |
|
|
|
127bba |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
127bba |
(cherry picked from commit e5568193f4d663f6a9edebcf9044d527f90a031f)
|
|
|
127bba |
|
|
|
127bba |
https://bugzilla.redhat.com/show_bug.cgi?id=1392031
|
|
|
127bba |
|
|
|
127bba |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
127bba |
---
|
|
|
127bba |
src/conf/domain_conf.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
127bba |
src/conf/domain_conf.h | 9 ++++++
|
|
|
127bba |
src/libvirt_private.syms | 5 ++++
|
|
|
127bba |
3 files changed, 89 insertions(+)
|
|
|
127bba |
|
|
|
127bba |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
127bba |
index 415ab1c..57d5ec8 100644
|
|
|
127bba |
--- a/src/conf/domain_conf.c
|
|
|
127bba |
+++ b/src/conf/domain_conf.c
|
|
|
127bba |
@@ -14831,6 +14831,81 @@ virDomainRedirdevDefRemove(virDomainDefPtr def, size_t idx)
|
|
|
127bba |
}
|
|
|
127bba |
|
|
|
127bba |
|
|
|
127bba |
+int
|
|
|
127bba |
+virDomainShmemDefInsert(virDomainDefPtr def,
|
|
|
127bba |
+ virDomainShmemDefPtr shmem)
|
|
|
127bba |
+{
|
|
|
127bba |
+ return VIR_APPEND_ELEMENT(def->shmems, def->nshmems, shmem);
|
|
|
127bba |
+}
|
|
|
127bba |
+
|
|
|
127bba |
+
|
|
|
127bba |
+bool
|
|
|
127bba |
+virDomainShmemDefEquals(virDomainShmemDefPtr src,
|
|
|
127bba |
+ virDomainShmemDefPtr dst)
|
|
|
127bba |
+{
|
|
|
127bba |
+ if (STRNEQ_NULLABLE(src->name, dst->name))
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+
|
|
|
127bba |
+ if (src->size != dst->size)
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+
|
|
|
127bba |
+ if (src->server.enabled != dst->server.enabled)
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+
|
|
|
127bba |
+ if (src->server.enabled) {
|
|
|
127bba |
+ if (STRNEQ_NULLABLE(src->server.chr.data.nix.path,
|
|
|
127bba |
+ dst->server.chr.data.nix.path))
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+ }
|
|
|
127bba |
+
|
|
|
127bba |
+ if (src->msi.enabled != dst->msi.enabled)
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+
|
|
|
127bba |
+ if (src->msi.enabled) {
|
|
|
127bba |
+ if (src->msi.vectors != dst->msi.vectors)
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+ if (src->msi.ioeventfd != dst->msi.ioeventfd)
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+ }
|
|
|
127bba |
+
|
|
|
127bba |
+ if (src->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
|
|
|
127bba |
+ !virDomainDeviceInfoAddressIsEqual(&src->info, &dst->info))
|
|
|
127bba |
+ return false;
|
|
|
127bba |
+
|
|
|
127bba |
+ return true;
|
|
|
127bba |
+}
|
|
|
127bba |
+
|
|
|
127bba |
+
|
|
|
127bba |
+ssize_t
|
|
|
127bba |
+virDomainShmemDefFind(virDomainDefPtr def,
|
|
|
127bba |
+ virDomainShmemDefPtr shmem)
|
|
|
127bba |
+{
|
|
|
127bba |
+ size_t i;
|
|
|
127bba |
+
|
|
|
127bba |
+ for (i = 0; i < def->nshmems; i++) {
|
|
|
127bba |
+ if (virDomainShmemDefEquals(def->shmems[i], shmem))
|
|
|
127bba |
+ break;
|
|
|
127bba |
+ }
|
|
|
127bba |
+
|
|
|
127bba |
+ if (i < def->nshmems)
|
|
|
127bba |
+ return i;
|
|
|
127bba |
+
|
|
|
127bba |
+ return -1;
|
|
|
127bba |
+}
|
|
|
127bba |
+
|
|
|
127bba |
+
|
|
|
127bba |
+virDomainShmemDefPtr
|
|
|
127bba |
+virDomainShmemDefRemove(virDomainDefPtr def,
|
|
|
127bba |
+ size_t idx)
|
|
|
127bba |
+{
|
|
|
127bba |
+ virDomainShmemDefPtr ret = def->shmems[idx];
|
|
|
127bba |
+
|
|
|
127bba |
+ VIR_DELETE_ELEMENT(def->shmems, idx, def->nshmems);
|
|
|
127bba |
+
|
|
|
127bba |
+ return ret;
|
|
|
127bba |
+}
|
|
|
127bba |
+
|
|
|
127bba |
+
|
|
|
127bba |
char *
|
|
|
127bba |
virDomainDefGetDefaultEmulator(virDomainDefPtr def,
|
|
|
127bba |
virCapsPtr caps)
|
|
|
127bba |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
127bba |
index c674796..594982e 100644
|
|
|
127bba |
--- a/src/conf/domain_conf.h
|
|
|
127bba |
+++ b/src/conf/domain_conf.h
|
|
|
127bba |
@@ -2955,6 +2955,15 @@ int virDomainMemoryFindInactiveByDef(virDomainDefPtr def,
|
|
|
127bba |
virDomainMemoryDefPtr mem)
|
|
|
127bba |
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
|
|
127bba |
|
|
|
127bba |
+int virDomainShmemDefInsert(virDomainDefPtr def, virDomainShmemDefPtr shmem)
|
|
|
127bba |
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
|
|
127bba |
+bool virDomainShmemDefEquals(virDomainShmemDefPtr src, virDomainShmemDefPtr dst)
|
|
|
127bba |
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
|
|
127bba |
+ssize_t virDomainShmemDefFind(virDomainDefPtr def, virDomainShmemDefPtr shmem)
|
|
|
127bba |
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
|
|
127bba |
+virDomainShmemDefPtr virDomainShmemDefRemove(virDomainDefPtr def, size_t idx)
|
|
|
127bba |
+ ATTRIBUTE_NONNULL(1);
|
|
|
127bba |
+
|
|
|
127bba |
VIR_ENUM_DECL(virDomainTaint)
|
|
|
127bba |
VIR_ENUM_DECL(virDomainVirt)
|
|
|
127bba |
VIR_ENUM_DECL(virDomainBoot)
|
|
|
127bba |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
|
127bba |
index 5878360..9b7c26c 100644
|
|
|
127bba |
--- a/src/libvirt_private.syms
|
|
|
127bba |
+++ b/src/libvirt_private.syms
|
|
|
127bba |
@@ -455,6 +455,11 @@ virDomainSaveStatus;
|
|
|
127bba |
virDomainSaveXML;
|
|
|
127bba |
virDomainSeclabelTypeFromString;
|
|
|
127bba |
virDomainSeclabelTypeToString;
|
|
|
127bba |
+virDomainShmemDefEquals;
|
|
|
127bba |
+virDomainShmemDefFind;
|
|
|
127bba |
+virDomainShmemDefFree;
|
|
|
127bba |
+virDomainShmemDefInsert;
|
|
|
127bba |
+virDomainShmemDefRemove;
|
|
|
127bba |
virDomainShutdownReasonTypeFromString;
|
|
|
127bba |
virDomainShutdownReasonTypeToString;
|
|
|
127bba |
virDomainShutoffReasonTypeFromString;
|
|
|
127bba |
--
|
|
|
127bba |
2.10.2
|
|
|
127bba |
|