[PATCH 3/5] qemu: Introduce privateData object for virStorageSource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: John Ferlan <jferlan@xxxxxxxxxx>

Add the object definition and helpers to store security-related private
data for virStorageSources.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h | 17 +++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 41009331a..f44e1436d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -932,6 +932,49 @@ qemuDomainDiskPrivateDispose(void *obj)
 }


+static virClassPtr qemuDomainStorageSourcePrivateClass;
+static void qemuDomainStorageSourcePrivateDispose(void *obj);
+
+static int
+qemuDomainStorageSourcePrivateOnceInit(void)
+{
+    qemuDomainStorageSourcePrivateClass = virClassNew(virClassForObject(),
+                                                      "qemuDomainStorageSourcePrivate",
+                                                      sizeof(qemuDomainStorageSourcePrivate),
+                                                      qemuDomainStorageSourcePrivateDispose);
+    if (!qemuDomainStorageSourcePrivateClass)
+        return -1;
+    else
+        return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(qemuDomainStorageSourcePrivate)
+
+virObjectPtr
+qemuDomainStorageSourcePrivateNew(void)
+{
+    qemuDomainStorageSourcePrivatePtr priv;
+
+    if (qemuDomainStorageSourcePrivateInitialize() < 0)
+        return NULL;
+
+    if (!(priv = virObjectNew(qemuDomainStorageSourcePrivateClass)))
+        return NULL;
+
+    return (virObjectPtr) priv;
+}
+
+
+static void
+qemuDomainStorageSourcePrivateDispose(void *obj)
+{
+    qemuDomainStorageSourcePrivatePtr priv = obj;
+
+    qemuDomainSecretInfoFree(&priv->secinfo);
+    qemuDomainSecretInfoFree(&priv->encinfo);
+}
+
+
 static virClassPtr qemuDomainHostdevPrivateClass;
 static void qemuDomainHostdevPrivateDispose(void *obj);

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 7c9364f35..2e1515fa1 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -363,6 +363,23 @@ struct _qemuDomainDiskPrivate {
     bool removable; /* device media can be removed/changed */
 };

+# define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
+    ((qemuDomainStorageSourcePrivatePtr) (src)->privateData)
+
+typedef struct _qemuDomainStorageSourcePrivate qemuDomainStorageSourcePrivate;
+typedef qemuDomainStorageSourcePrivate *qemuDomainStorageSourcePrivatePtr;
+struct _qemuDomainStorageSourcePrivate {
+    virObject parent;
+
+    /* data required for authentication to the storage source */
+    qemuDomainSecretInfoPtr secinfo;
+
+    /* data required for decryption of encrypted storage source */
+    qemuDomainSecretInfoPtr encinfo;
+};
+
+virObjectPtr qemuDomainStorageSourcePrivateNew(void);
+
 # define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev)   \
     ((qemuDomainHostdevPrivatePtr) (hostdev)->privateData)

-- 
2.14.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux