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
*/
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 */

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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