6ae9ed
From ca46f81dba9a8f4619d43e0c3ba96092b4536086 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <ca46f81dba9a8f4619d43e0c3ba96092b4536086@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Wed, 24 Aug 2016 16:10:49 -0400
6ae9ed
Subject: [PATCH] qemu: domain: Add vcpu private data structure
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
6ae9ed
6ae9ed
Members will be added in follow-up patches.
6ae9ed
6ae9ed
(cherry picked from commit 2540c932036ba2f8fcb64b6d0509f739f18a67b4)
6ae9ed
---
6ae9ed
 src/qemu/qemu_domain.c | 41 +++++++++++++++++++++++++++++++++++++++++
6ae9ed
 src/qemu/qemu_domain.h | 13 +++++++++++++
6ae9ed
 2 files changed, 54 insertions(+)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
6ae9ed
index cc726dc..c213a9f 100644
6ae9ed
--- a/src/qemu/qemu_domain.c
6ae9ed
+++ b/src/qemu/qemu_domain.c
6ae9ed
@@ -813,6 +813,46 @@ qemuDomainHostdevPrivateDispose(void *obj)
6ae9ed
 }
6ae9ed
 
6ae9ed
 
6ae9ed
+static virClassPtr qemuDomainVcpuPrivateClass;
6ae9ed
+static void qemuDomainVcpuPrivateDispose(void *obj);
6ae9ed
+
6ae9ed
+static int
6ae9ed
+qemuDomainVcpuPrivateOnceInit(void)
6ae9ed
+{
6ae9ed
+    qemuDomainVcpuPrivateClass = virClassNew(virClassForObject(),
6ae9ed
+                                             "qemuDomainVcpuPrivate",
6ae9ed
+                                             sizeof(qemuDomainVcpuPrivate),
6ae9ed
+                                             qemuDomainVcpuPrivateDispose);
6ae9ed
+    if (!qemuDomainVcpuPrivateClass)
6ae9ed
+        return -1;
6ae9ed
+    else
6ae9ed
+        return 0;
6ae9ed
+}
6ae9ed
+
6ae9ed
+VIR_ONCE_GLOBAL_INIT(qemuDomainVcpuPrivate)
6ae9ed
+
6ae9ed
+static virObjectPtr
6ae9ed
+qemuDomainVcpuPrivateNew(void)
6ae9ed
+{
6ae9ed
+    qemuDomainVcpuPrivatePtr priv;
6ae9ed
+
6ae9ed
+    if (qemuDomainVcpuPrivateInitialize() < 0)
6ae9ed
+        return NULL;
6ae9ed
+
6ae9ed
+    if (!(priv = virObjectNew(qemuDomainVcpuPrivateClass)))
6ae9ed
+        return NULL;
6ae9ed
+
6ae9ed
+    return (virObjectPtr) priv;
6ae9ed
+}
6ae9ed
+
6ae9ed
+
6ae9ed
+static void
6ae9ed
+qemuDomainVcpuPrivateDispose(void *obj ATTRIBUTE_UNUSED)
6ae9ed
+{
6ae9ed
+    return;
6ae9ed
+}
6ae9ed
+
6ae9ed
+
6ae9ed
 /* qemuDomainSecretPlainSetup:
6ae9ed
  * @conn: Pointer to connection
6ae9ed
  * @secinfo: Pointer to secret info
6ae9ed
@@ -1668,6 +1708,7 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
6ae9ed
     .alloc = qemuDomainObjPrivateAlloc,
6ae9ed
     .free = qemuDomainObjPrivateFree,
6ae9ed
     .diskNew = qemuDomainDiskPrivateNew,
6ae9ed
+    .vcpuNew = qemuDomainVcpuPrivateNew,
6ae9ed
     .hostdevNew = qemuDomainHostdevPrivateNew,
6ae9ed
     .parse = qemuDomainObjPrivateXMLParse,
6ae9ed
     .format = qemuDomainObjPrivateXMLFormat,
6ae9ed
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
6ae9ed
index 888732a..32433cf 100644
6ae9ed
--- a/src/qemu/qemu_domain.h
6ae9ed
+++ b/src/qemu/qemu_domain.h
6ae9ed
@@ -313,6 +313,19 @@ struct _qemuDomainDiskPrivate {
6ae9ed
 # define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev)	\
6ae9ed
     ((qemuDomainHostdevPrivatePtr) (hostdev)->privateData)
6ae9ed
 
6ae9ed
+
6ae9ed
+typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
6ae9ed
+typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
6ae9ed
+struct _qemuDomainVcpuPrivate {
6ae9ed
+    virObject parent;
6ae9ed
+
6ae9ed
+    int dummy;
6ae9ed
+};
6ae9ed
+
6ae9ed
+# define QEMU_DOMAIN_VCPU_PRIVATE(vcpu)    \
6ae9ed
+    ((qemuDomainVcpuPrivatePtr) (vcpu)->privateData)
6ae9ed
+
6ae9ed
+
6ae9ed
 struct qemuDomainDiskInfo {
6ae9ed
     bool removable;
6ae9ed
     bool locked;
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed