Blob Blame History Raw
From ca46f81dba9a8f4619d43e0c3ba96092b4536086 Mon Sep 17 00:00:00 2001
Message-Id: <ca46f81dba9a8f4619d43e0c3ba96092b4536086@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Aug 2016 16:10:49 -0400
Subject: [PATCH] qemu: domain: Add vcpu private data structure

https://bugzilla.redhat.com/show_bug.cgi?id=1097930
https://bugzilla.redhat.com/show_bug.cgi?id=1224341

Members will be added in follow-up patches.

(cherry picked from commit 2540c932036ba2f8fcb64b6d0509f739f18a67b4)
---
 src/qemu/qemu_domain.c | 41 +++++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h | 13 +++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cc726dc..c213a9f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -813,6 +813,46 @@ qemuDomainHostdevPrivateDispose(void *obj)
 }
 
 
+static virClassPtr qemuDomainVcpuPrivateClass;
+static void qemuDomainVcpuPrivateDispose(void *obj);
+
+static int
+qemuDomainVcpuPrivateOnceInit(void)
+{
+    qemuDomainVcpuPrivateClass = virClassNew(virClassForObject(),
+                                             "qemuDomainVcpuPrivate",
+                                             sizeof(qemuDomainVcpuPrivate),
+                                             qemuDomainVcpuPrivateDispose);
+    if (!qemuDomainVcpuPrivateClass)
+        return -1;
+    else
+        return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(qemuDomainVcpuPrivate)
+
+static virObjectPtr
+qemuDomainVcpuPrivateNew(void)
+{
+    qemuDomainVcpuPrivatePtr priv;
+
+    if (qemuDomainVcpuPrivateInitialize() < 0)
+        return NULL;
+
+    if (!(priv = virObjectNew(qemuDomainVcpuPrivateClass)))
+        return NULL;
+
+    return (virObjectPtr) priv;
+}
+
+
+static void
+qemuDomainVcpuPrivateDispose(void *obj ATTRIBUTE_UNUSED)
+{
+    return;
+}
+
+
 /* qemuDomainSecretPlainSetup:
  * @conn: Pointer to connection
  * @secinfo: Pointer to secret info
@@ -1668,6 +1708,7 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
     .alloc = qemuDomainObjPrivateAlloc,
     .free = qemuDomainObjPrivateFree,
     .diskNew = qemuDomainDiskPrivateNew,
+    .vcpuNew = qemuDomainVcpuPrivateNew,
     .hostdevNew = qemuDomainHostdevPrivateNew,
     .parse = qemuDomainObjPrivateXMLParse,
     .format = qemuDomainObjPrivateXMLFormat,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 888732a..32433cf 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -313,6 +313,19 @@ struct _qemuDomainDiskPrivate {
 # define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev)	\
     ((qemuDomainHostdevPrivatePtr) (hostdev)->privateData)
 
+
+typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
+typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
+struct _qemuDomainVcpuPrivate {
+    virObject parent;
+
+    int dummy;
+};
+
+# define QEMU_DOMAIN_VCPU_PRIVATE(vcpu)    \
+    ((qemuDomainVcpuPrivatePtr) (vcpu)->privateData)
+
+
 struct qemuDomainDiskInfo {
     bool removable;
     bool locked;
-- 
2.10.0