src: Unify virObject member name

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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2018-04-13 13:51:23 +02:00
parent cbbbe7b448
commit 4e42981b36
19 changed files with 33 additions and 33 deletions

View File

@ -453,7 +453,7 @@ struct _virAdmConnectCloseCallbackData {
* Internal structure associated to a connection * Internal structure associated to a connection
*/ */
struct _virConnect { struct _virConnect {
virObjectLockable object; virObjectLockable parent;
/* All the variables from here, until declared otherwise in one of /* All the variables from here, until declared otherwise in one of
* the following comments, are setup at time of connection open * the following comments, are setup at time of connection open
@ -496,7 +496,7 @@ struct _virConnect {
* Internal structure associated to an admin connection * Internal structure associated to an admin connection
*/ */
struct _virAdmConnect { struct _virAdmConnect {
virObjectLockable object; virObjectLockable parent;
virURIPtr uri; virURIPtr uri;
void *privateData; void *privateData;
@ -512,7 +512,7 @@ struct _virAdmConnect {
* Internal structure associated to a daemon server * Internal structure associated to a daemon server
*/ */
struct _virAdmServer { struct _virAdmServer {
virObject object; virObject parent;
virAdmConnectPtr conn; /* pointer back to the admin connection */ virAdmConnectPtr conn; /* pointer back to the admin connection */
char *name; /* the server external name */ char *name; /* the server external name */
}; };
@ -523,7 +523,7 @@ struct _virAdmServer {
* Internal structure associated to a client connected to daemon * Internal structure associated to a client connected to daemon
*/ */
struct _virAdmClient { struct _virAdmClient {
virObject object; virObject parent;
virAdmServerPtr srv; /* pointer to the server client is virAdmServerPtr srv; /* pointer to the server client is
* connected to, which also holds a * connected to, which also holds a
* reference back to the admin connection * reference back to the admin connection
@ -539,7 +539,7 @@ struct _virAdmClient {
* Internal structure associated to a domain * Internal structure associated to a domain
*/ */
struct _virDomain { struct _virDomain {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
char *name; /* the domain external name */ char *name; /* the domain external name */
int id; /* the domain ID */ int id; /* the domain ID */
@ -552,7 +552,7 @@ struct _virDomain {
* Internal structure associated to a domain * Internal structure associated to a domain
*/ */
struct _virNetwork { struct _virNetwork {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
char *name; /* the network external name */ char *name; /* the network external name */
unsigned char uuid[VIR_UUID_BUFLEN]; /* the network unique identifier */ unsigned char uuid[VIR_UUID_BUFLEN]; /* the network unique identifier */
@ -564,7 +564,7 @@ struct _virNetwork {
* Internal structure associated to a physical host interface * Internal structure associated to a physical host interface
*/ */
struct _virInterface { struct _virInterface {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
char *name; /* the network external name */ char *name; /* the network external name */
char *mac; /* the interface MAC address */ char *mac; /* the interface MAC address */
@ -576,7 +576,7 @@ struct _virInterface {
* Internal structure associated to a storage pool * Internal structure associated to a storage pool
*/ */
struct _virStoragePool { struct _virStoragePool {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
char *name; /* the storage pool external name */ char *name; /* the storage pool external name */
unsigned char uuid[VIR_UUID_BUFLEN]; /* the storage pool unique identifier */ unsigned char uuid[VIR_UUID_BUFLEN]; /* the storage pool unique identifier */
@ -595,7 +595,7 @@ struct _virStoragePool {
* Internal structure associated to a storage volume * Internal structure associated to a storage volume
*/ */
struct _virStorageVol { struct _virStorageVol {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
char *pool; /* Pool name of owner */ char *pool; /* Pool name of owner */
char *name; /* the storage vol external name */ char *name; /* the storage vol external name */
@ -615,7 +615,7 @@ struct _virStorageVol {
* Internal structure associated with a node device * Internal structure associated with a node device
*/ */
struct _virNodeDevice { struct _virNodeDevice {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
char *name; /* device name (unique on node) */ char *name; /* device name (unique on node) */
char *parentName; /* parent device name */ char *parentName; /* parent device name */
@ -627,7 +627,7 @@ struct _virNodeDevice {
* Internal structure associated with a secret * Internal structure associated with a secret
*/ */
struct _virSecret { struct _virSecret {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
unsigned char uuid[VIR_UUID_BUFLEN]; /* the secret unique identifier */ unsigned char uuid[VIR_UUID_BUFLEN]; /* the secret unique identifier */
int usageType; /* the type of usage */ int usageType; /* the type of usage */
@ -644,7 +644,7 @@ typedef int (*virStreamFinishFunc)(virStreamPtr, void *opaque);
* Internal structure associated with an input stream * Internal structure associated with an input stream
*/ */
struct _virStream { struct _virStream {
virObject object; virObject parent;
virConnectPtr conn; virConnectPtr conn;
unsigned int flags; unsigned int flags;
@ -658,7 +658,7 @@ struct _virStream {
* Internal structure associated with a domain snapshot * Internal structure associated with a domain snapshot
*/ */
struct _virDomainSnapshot { struct _virDomainSnapshot {
virObject object; virObject parent;
char *name; char *name;
virDomainPtr domain; virDomainPtr domain;
}; };
@ -669,7 +669,7 @@ struct _virDomainSnapshot {
* Internal structure associated to a network filter * Internal structure associated to a network filter
*/ */
struct _virNWFilter { struct _virNWFilter {
virObject object; virObject parent;
virConnectPtr conn; /* pointer back to the connection */ virConnectPtr conn; /* pointer back to the connection */
char *name; /* the network filter external name */ char *name; /* the network filter external name */
unsigned char uuid[VIR_UUID_BUFLEN]; /* the network filter unique identifier */ unsigned char uuid[VIR_UUID_BUFLEN]; /* the network filter unique identifier */

View File

@ -340,7 +340,7 @@ int
virAdmConnectRef(virAdmConnectPtr conn) virAdmConnectRef(virAdmConnectPtr conn)
{ {
VIR_DEBUG("conn=%p refs=%d", 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(); virResetLastError();
virCheckAdmConnectReturn(conn, -1); virCheckAdmConnectReturn(conn, -1);

View File

@ -1159,7 +1159,7 @@ int
virDomainSnapshotRef(virDomainSnapshotPtr snapshot) virDomainSnapshotRef(virDomainSnapshotPtr snapshot)
{ {
VIR_DEBUG("snapshot=%p, refs=%d", snapshot, VIR_DEBUG("snapshot=%p, refs=%d", snapshot,
snapshot ? snapshot->object.u.s.refs : 0); snapshot ? snapshot->parent.u.s.refs : 0);
virResetLastError(); virResetLastError();

View File

@ -589,7 +589,7 @@ virDomainFree(virDomainPtr domain)
int int
virDomainRef(virDomainPtr domain) 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(); virResetLastError();

View File

@ -51,7 +51,7 @@ VIR_LOG_INIT("libvirt.host");
int int
virConnectRef(virConnectPtr conn) 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(); virResetLastError();

View File

@ -642,7 +642,7 @@ virInterfaceDestroy(virInterfacePtr iface, unsigned int flags)
int int
virInterfaceRef(virInterfacePtr iface) 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(); virResetLastError();

View File

@ -679,7 +679,7 @@ int
virNetworkRef(virNetworkPtr network) virNetworkRef(virNetworkPtr network)
{ {
VIR_DEBUG("network=%p refs=%d", network, VIR_DEBUG("network=%p refs=%d", network,
network ? network->object.u.s.refs : 0); network ? network->parent.u.s.refs : 0);
virResetLastError(); virResetLastError();

View File

@ -477,7 +477,7 @@ virNodeDeviceFree(virNodeDevicePtr dev)
int int
virNodeDeviceRef(virNodeDevicePtr dev) 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(); virResetLastError();

View File

@ -504,7 +504,7 @@ int
virNWFilterRef(virNWFilterPtr nwfilter) virNWFilterRef(virNWFilterPtr nwfilter)
{ {
VIR_DEBUG("nwfilter=%p refs=%d", nwfilter, VIR_DEBUG("nwfilter=%p refs=%d", nwfilter,
nwfilter ? nwfilter->object.u.s.refs : 0); nwfilter ? nwfilter->parent.u.s.refs : 0);
virResetLastError(); virResetLastError();

View File

@ -659,7 +659,7 @@ int
virSecretRef(virSecretPtr secret) virSecretRef(virSecretPtr secret)
{ {
VIR_DEBUG("secret=%p refs=%d", secret, VIR_DEBUG("secret=%p refs=%d", secret,
secret ? secret->object.u.s.refs : 0); secret ? secret->parent.u.s.refs : 0);
virResetLastError(); virResetLastError();

View File

@ -868,7 +868,7 @@ virStoragePoolFree(virStoragePoolPtr pool)
int int
virStoragePoolRef(virStoragePoolPtr pool) 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(); virResetLastError();
@ -1904,7 +1904,7 @@ virStorageVolFree(virStorageVolPtr vol)
int int
virStorageVolRef(virStorageVolPtr vol) 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(); virResetLastError();

View File

@ -86,7 +86,7 @@ int
virStreamRef(virStreamPtr stream) virStreamRef(virStreamPtr stream)
{ {
VIR_DEBUG("stream=%p refs=%d", stream, VIR_DEBUG("stream=%p refs=%d", stream,
stream ? stream->object.u.s.refs : 0); stream ? stream->parent.u.s.refs : 0);
virResetLastError(); virResetLastError();

View File

@ -510,7 +510,7 @@ struct _virQEMUCapsHostCPUData {
* And don't forget to update virQEMUCapsNewCopy. * And don't forget to update virQEMUCapsNewCopy.
*/ */
struct _virQEMUCaps { struct _virQEMUCaps {
virObject object; virObject parent;
bool usedQMP; bool usedQMP;

View File

@ -40,7 +40,7 @@
VIR_LOG_INIT("rpc.netclientprogram"); VIR_LOG_INIT("rpc.netclientprogram");
struct _virNetClientProgram { struct _virNetClientProgram {
virObject object; virObject parent;
unsigned program; unsigned program;
unsigned version; unsigned version;

View File

@ -37,7 +37,7 @@
VIR_LOG_INIT("rpc.netserverprogram"); VIR_LOG_INIT("rpc.netserverprogram");
struct _virNetServerProgram { struct _virNetServerProgram {
virObject object; virObject parent;
unsigned program; unsigned program;
unsigned version; unsigned version;

View File

@ -34,7 +34,7 @@
#define VIR_FROM_THIS VIR_FROM_RPC #define VIR_FROM_THIS VIR_FROM_RPC
struct _virNetServerService { struct _virNetServerService {
virObject object; virObject parent;
size_t nsocks; size_t nsocks;
virNetSocketPtr *socks; virNetSocketPtr *socks;

View File

@ -620,7 +620,7 @@ dnsmasqReload(pid_t pid ATTRIBUTE_UNUSED)
* *
*/ */
struct _dnsmasqCaps { struct _dnsmasqCaps {
virObject object; virObject parent;
char *binaryPath; char *binaryPath;
bool noRefresh; bool noRefresh;
time_t mtime; time_t mtime;

View File

@ -45,7 +45,7 @@ VIR_LOG_INIT("util.filecache")
struct _virFileCache { struct _virFileCache {
virObjectLockable object; virObjectLockable parent;
virHashTablePtr table; virHashTablePtr table;

View File

@ -28,7 +28,7 @@
struct _testFileCacheObj { struct _testFileCacheObj {
virObject object; virObject parent;
char *data; char *data;
}; };
typedef struct _testFileCacheObj testFileCacheObj; typedef struct _testFileCacheObj testFileCacheObj;