[PATCH 2/2] libxl: Don't derive libxlDomainObjPrivate from virObjectLockable

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

 



The libxlDomainObjPrivate object is never locked and hence does not need to
be a virObjectLockable object.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_domain.c | 38 ++++++--------------------------------
 src/libxl/libxl_domain.h |  2 --
 2 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 4f61584ceb..0d94b85a0d 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -51,21 +51,6 @@ VIR_ENUM_IMPL(libxlDomainJob,
               "modify",
 );
 
-static virClass *libxlDomainObjPrivateClass;
-
-static void
-libxlDomainObjPrivateDispose(void *obj);
-
-static int
-libxlDomainObjPrivateOnceInit(void)
-{
-    if (!VIR_CLASS_NEW(libxlDomainObjPrivate, virClassForObjectLockable()))
-        return -1;
-
-    return 0;
-}
-
-VIR_ONCE_GLOBAL_INIT(libxlDomainObjPrivate);
 
 static int
 libxlDomainObjInitJob(libxlDomainObjPrivate *priv)
@@ -206,42 +191,31 @@ libxlDomainObjPrivateAlloc(void *opaque G_GNUC_UNUSED)
 {
     libxlDomainObjPrivate *priv;
 
-    if (libxlDomainObjPrivateInitialize() < 0)
-        return NULL;
-
-    if (!(priv = virObjectLockableNew(libxlDomainObjPrivateClass)))
-        return NULL;
+    priv = g_new0(libxlDomainObjPrivate, 1);
 
     if (!(priv->devs = virChrdevAlloc())) {
-        virObjectUnref(priv);
+        g_free(priv);
         return NULL;
     }
 
     if (libxlDomainObjInitJob(priv) < 0) {
         virChrdevFree(priv->devs);
-        virObjectUnref(priv);
+        g_free(priv);
         return NULL;
     }
 
     return priv;
 }
 
-static void
-libxlDomainObjPrivateDispose(void *obj)
-{
-    libxlDomainObjPrivate *priv = obj;
-
-    libxlDomainObjFreeJob(priv);
-    virChrdevFree(priv->devs);
-}
-
 static void
 libxlDomainObjPrivateFree(void *data)
 {
     libxlDomainObjPrivate *priv = data;
 
     g_free(priv->lockState);
-    virObjectUnref(priv);
+    libxlDomainObjFreeJob(priv);
+    virChrdevFree(priv->devs);
+    g_free(priv);
 }
 
 static int
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 8d36197faf..661610bd3f 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -51,8 +51,6 @@ struct libxlDomainJobObj {
 
 typedef struct _libxlDomainObjPrivate libxlDomainObjPrivate;
 struct _libxlDomainObjPrivate {
-    virObjectLockable parent;
-
     /* console */
     virChrdevs *devs;
     libxl_evgen_domain_death *deathW;
-- 
2.33.0





[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