[PATCH v3 2/5] src: Unify virObject member name

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

 



Whenever we declare a new object the first member of the struct
has to be virObject (or any other member of that family). Now, up
until now we did not care about the name of the struct member.
But lets unify it so that we can do some checks at compile time
later.

The unified name is 'parent'.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 src/datatypes.h               | 28 ++++++++++++++--------------
 src/libvirt-admin.c           |  2 +-
 src/libvirt-domain-snapshot.c |  2 +-
 src/libvirt-domain.c          |  2 +-
 src/libvirt-host.c            |  2 +-
 src/libvirt-interface.c       |  2 +-
 src/libvirt-network.c         |  2 +-
 src/libvirt-nodedev.c         |  2 +-
 src/libvirt-nwfilter.c        |  2 +-
 src/libvirt-secret.c          |  2 +-
 src/libvirt-storage.c         |  4 ++--
 src/libvirt-stream.c          |  2 +-
 src/qemu/qemu_capabilities.c  |  2 +-
 src/rpc/virnetclientprogram.c |  2 +-
 src/rpc/virnetserverprogram.c |  2 +-
 src/rpc/virnetserverservice.c |  2 +-
 src/util/virdnsmasq.c         |  2 +-
 src/util/virfilecache.c       |  2 +-
 tests/virfilecachetest.c      |  2 +-
 19 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/src/datatypes.h b/src/datatypes.h
index 66733b075c..192c86be80 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -453,7 +453,7 @@ struct _virAdmConnectCloseCallbackData {
  * Internal structure associated to a connection
  */
 struct _virConnect {
-    virObjectLockable object;
+    virObjectLockable parent;
 
     /* All the variables from here, until declared otherwise in one of
      * the following comments, are setup at time of connection open
@@ -496,7 +496,7 @@ struct _virConnect {
  * Internal structure associated to an admin connection
  */
 struct _virAdmConnect {
-    virObjectLockable object;
+    virObjectLockable parent;
     virURIPtr uri;
 
     void *privateData;
@@ -512,7 +512,7 @@ struct _virAdmConnect {
  * Internal structure associated to a daemon server
  */
 struct _virAdmServer {
-    virObject object;
+    virObject parent;
     virAdmConnectPtr conn;          /* pointer back to the admin connection */
     char *name;                     /* the server external name */
 };
@@ -523,7 +523,7 @@ struct _virAdmServer {
  * Internal structure associated to a client connected to daemon
  */
 struct _virAdmClient {
-    virObject object;
+    virObject parent;
     virAdmServerPtr srv;            /* pointer to the server client is
                                      * connected to, which also holds a
                                      * reference back to the admin connection
@@ -539,7 +539,7 @@ struct _virAdmClient {
 * Internal structure associated to a domain
 */
 struct _virDomain {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                  /* pointer back to the connection */
     char *name;                          /* the domain external name */
     int id;                              /* the domain ID */
@@ -552,7 +552,7 @@ struct _virDomain {
 * Internal structure associated to a domain
 */
 struct _virNetwork {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                  /* pointer back to the connection */
     char *name;                          /* the network external name */
     unsigned char uuid[VIR_UUID_BUFLEN]; /* the network unique identifier */
@@ -564,7 +564,7 @@ struct _virNetwork {
 * Internal structure associated to a physical host interface
 */
 struct _virInterface {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                  /* pointer back to the connection */
     char *name;                          /* the network external name */
     char *mac;                           /* the interface MAC address */
@@ -576,7 +576,7 @@ struct _virInterface {
 * Internal structure associated to a storage pool
 */
 struct _virStoragePool {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                  /* pointer back to the connection */
     char *name;                          /* the storage pool external name */
     unsigned char uuid[VIR_UUID_BUFLEN]; /* the storage pool unique identifier */
@@ -595,7 +595,7 @@ struct _virStoragePool {
 * Internal structure associated to a storage volume
 */
 struct _virStorageVol {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                  /* pointer back to the connection */
     char *pool;                          /* Pool name of owner */
     char *name;                          /* the storage vol external name */
@@ -615,7 +615,7 @@ struct _virStorageVol {
  * Internal structure associated with a node device
  */
 struct _virNodeDevice {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                 /* pointer back to the connection */
     char *name;                         /* device name (unique on node) */
     char *parentName;                   /* parent device name */
@@ -627,7 +627,7 @@ struct _virNodeDevice {
  * Internal structure associated with a secret
  */
 struct _virSecret {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                  /* pointer back to the connection */
     unsigned char uuid[VIR_UUID_BUFLEN]; /* the secret unique identifier */
     int usageType;                       /* the type of usage */
@@ -644,7 +644,7 @@ typedef int (*virStreamFinishFunc)(virStreamPtr, void *opaque);
  * Internal structure associated with an input stream
  */
 struct _virStream {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;
     unsigned int flags;
 
@@ -658,7 +658,7 @@ struct _virStream {
  * Internal structure associated with a domain snapshot
  */
 struct _virDomainSnapshot {
-    virObject object;
+    virObject parent;
     char *name;
     virDomainPtr domain;
 };
@@ -669,7 +669,7 @@ struct _virDomainSnapshot {
 * Internal structure associated to a network filter
 */
 struct _virNWFilter {
-    virObject object;
+    virObject parent;
     virConnectPtr conn;                  /* pointer back to the connection */
     char *name;                          /* the network filter external name */
     unsigned char uuid[VIR_UUID_BUFLEN]; /* the network filter unique identifier */
diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
index de595a9f7f..7f695311b4 100644
--- a/src/libvirt-admin.c
+++ b/src/libvirt-admin.c
@@ -340,7 +340,7 @@ int
 virAdmConnectRef(virAdmConnectPtr conn)
 {
     VIR_DEBUG("conn=%p refs=%d", conn,
-              conn ? conn->object.parent.u.s.refs : 0);
+              conn ? conn->parent.parent.u.s.refs : 0);
 
     virResetLastError();
     virCheckAdmConnectReturn(conn, -1);
diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c
index e44a1d1f38..100326a5e7 100644
--- a/src/libvirt-domain-snapshot.c
+++ b/src/libvirt-domain-snapshot.c
@@ -1159,7 +1159,7 @@ int
 virDomainSnapshotRef(virDomainSnapshotPtr snapshot)
 {
     VIR_DEBUG("snapshot=%p, refs=%d", snapshot,
-              snapshot ? snapshot->object.u.s.refs : 0);
+              snapshot ? snapshot->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 63d2ae23d7..2d86e48979 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -589,7 +589,7 @@ virDomainFree(virDomainPtr domain)
 int
 virDomainRef(virDomainPtr domain)
 {
-    VIR_DOMAIN_DEBUG(domain, "refs=%d", domain ? domain->object.u.s.refs : 0);
+    VIR_DOMAIN_DEBUG(domain, "refs=%d", domain ? domain->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
index 7ff7407a08..76087badd8 100644
--- a/src/libvirt-host.c
+++ b/src/libvirt-host.c
@@ -51,7 +51,7 @@ VIR_LOG_INIT("libvirt.host");
 int
 virConnectRef(virConnectPtr conn)
 {
-    VIR_DEBUG("conn=%p refs=%d", conn, conn ? conn->object.parent.u.s.refs : 0);
+    VIR_DEBUG("conn=%p refs=%d", conn, conn ? conn->parent.parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-interface.c b/src/libvirt-interface.c
index bb79101abe..69415293ed 100644
--- a/src/libvirt-interface.c
+++ b/src/libvirt-interface.c
@@ -642,7 +642,7 @@ virInterfaceDestroy(virInterfacePtr iface, unsigned int flags)
 int
 virInterfaceRef(virInterfacePtr iface)
 {
-    VIR_DEBUG("iface=%p refs=%d", iface, iface ? iface->object.u.s.refs : 0);
+    VIR_DEBUG("iface=%p refs=%d", iface, iface ? iface->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-network.c b/src/libvirt-network.c
index da33543001..9f9e0ddaf8 100644
--- a/src/libvirt-network.c
+++ b/src/libvirt-network.c
@@ -679,7 +679,7 @@ int
 virNetworkRef(virNetworkPtr network)
 {
     VIR_DEBUG("network=%p refs=%d", network,
-              network ? network->object.u.s.refs : 0);
+              network ? network->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
index 8ced3cea0e..10050b193b 100644
--- a/src/libvirt-nodedev.c
+++ b/src/libvirt-nodedev.c
@@ -477,7 +477,7 @@ virNodeDeviceFree(virNodeDevicePtr dev)
 int
 virNodeDeviceRef(virNodeDevicePtr dev)
 {
-    VIR_DEBUG("dev=%p refs=%d", dev, dev ? dev->object.u.s.refs : 0);
+    VIR_DEBUG("dev=%p refs=%d", dev, dev ? dev->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-nwfilter.c b/src/libvirt-nwfilter.c
index 43e2b164e8..948c30deef 100644
--- a/src/libvirt-nwfilter.c
+++ b/src/libvirt-nwfilter.c
@@ -504,7 +504,7 @@ int
 virNWFilterRef(virNWFilterPtr nwfilter)
 {
     VIR_DEBUG("nwfilter=%p refs=%d", nwfilter,
-              nwfilter ? nwfilter->object.u.s.refs : 0);
+              nwfilter ? nwfilter->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-secret.c b/src/libvirt-secret.c
index 1e1cd4e65b..711c4fc580 100644
--- a/src/libvirt-secret.c
+++ b/src/libvirt-secret.c
@@ -659,7 +659,7 @@ int
 virSecretRef(virSecretPtr secret)
 {
     VIR_DEBUG("secret=%p refs=%d", secret,
-              secret ? secret->object.u.s.refs : 0);
+              secret ? secret->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c
index 3845a5d55e..1879c6bd60 100644
--- a/src/libvirt-storage.c
+++ b/src/libvirt-storage.c
@@ -868,7 +868,7 @@ virStoragePoolFree(virStoragePoolPtr pool)
 int
 virStoragePoolRef(virStoragePoolPtr pool)
 {
-    VIR_DEBUG("pool=%p refs=%d", pool, pool ? pool->object.u.s.refs : 0);
+    VIR_DEBUG("pool=%p refs=%d", pool, pool ? pool->parent.u.s.refs : 0);
 
     virResetLastError();
 
@@ -1904,7 +1904,7 @@ virStorageVolFree(virStorageVolPtr vol)
 int
 virStorageVolRef(virStorageVolPtr vol)
 {
-    VIR_DEBUG("vol=%p refs=%d", vol, vol ? vol->object.u.s.refs : 0);
+    VIR_DEBUG("vol=%p refs=%d", vol, vol ? vol->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
index 3204b7b177..ef83696bcd 100644
--- a/src/libvirt-stream.c
+++ b/src/libvirt-stream.c
@@ -86,7 +86,7 @@ int
 virStreamRef(virStreamPtr stream)
 {
     VIR_DEBUG("stream=%p refs=%d", stream,
-              stream ? stream->object.u.s.refs : 0);
+              stream ? stream->parent.u.s.refs : 0);
 
     virResetLastError();
 
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 1dae540962..c6defb773f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -506,7 +506,7 @@ struct _virQEMUCapsHostCPUData {
  * And don't forget to update virQEMUCapsNewCopy.
  */
 struct _virQEMUCaps {
-    virObject object;
+    virObject parent;
 
     bool usedQMP;
 
diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c
index 505b40fc4b..d1e54a0892 100644
--- a/src/rpc/virnetclientprogram.c
+++ b/src/rpc/virnetclientprogram.c
@@ -40,7 +40,7 @@
 VIR_LOG_INIT("rpc.netclientprogram");
 
 struct _virNetClientProgram {
-    virObject object;
+    virObject parent;
 
     unsigned program;
     unsigned version;
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index 75b0052cdb..f28274fc22 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -37,7 +37,7 @@
 VIR_LOG_INIT("rpc.netserverprogram");
 
 struct _virNetServerProgram {
-    virObject object;
+    virObject parent;
 
     unsigned program;
     unsigned version;
diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index 4e5426ffea..d2350b2b91 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -34,7 +34,7 @@
 #define VIR_FROM_THIS VIR_FROM_RPC
 
 struct _virNetServerService {
-    virObject object;
+    virObject parent;
 
     size_t nsocks;
     virNetSocketPtr *socks;
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 1b78c1fadc..db5c51b6a2 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -620,7 +620,7 @@ dnsmasqReload(pid_t pid ATTRIBUTE_UNUSED)
  *
  */
 struct _dnsmasqCaps {
-    virObject object;
+    virObject parent;
     char *binaryPath;
     bool noRefresh;
     time_t mtime;
diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c
index 2577d711bc..e24eb5a68c 100644
--- a/src/util/virfilecache.c
+++ b/src/util/virfilecache.c
@@ -45,7 +45,7 @@ VIR_LOG_INIT("util.filecache")
 
 
 struct _virFileCache {
-    virObjectLockable object;
+    virObjectLockable parent;
 
     virHashTablePtr table;
 
diff --git a/tests/virfilecachetest.c b/tests/virfilecachetest.c
index ae7d08d257..d4a9d598ef 100644
--- a/tests/virfilecachetest.c
+++ b/tests/virfilecachetest.c
@@ -28,7 +28,7 @@
 
 
 struct _testFileCacheObj {
-    virObject object;
+    virObject parent;
     char *data;
 };
 typedef struct _testFileCacheObj testFileCacheObj;
-- 
2.16.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