mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
virobject: Introduce VIR_CLASS_NEW() macro
So far we are repeating the following lines over and over: if (!(virSomeObjectClass = virClassNew(virClassForObject(), "virSomeObject", sizeof(virSomeObject), virSomeObjectDispose))) return -1; While this works, it is impossible to do some checking. Firstly, the class name (the 2nd argument) doesn't match the name in the code in all cases (the 3rd argument). Secondly, the current style is needlessly verbose. This commit turns example into following: if (!(VIR_CLASS_NEW(virSomeObject, virClassForObject))) return -1; Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
4e42981b36
commit
10f94828ea
@ -54,10 +54,7 @@ static void virAccessManagerDispose(void *obj);
|
||||
|
||||
static int virAccessManagerOnceInit(void)
|
||||
{
|
||||
if (!(virAccessManagerClass = virClassNew(virClassForObjectLockable(),
|
||||
"virAccessManagerClass",
|
||||
sizeof(virAccessManager),
|
||||
virAccessManagerDispose)))
|
||||
if (!VIR_CLASS_NEW(virAccessManager, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -36,10 +36,7 @@ static void virBhyveDriverConfigDispose(void *obj);
|
||||
|
||||
static int virBhyveConfigOnceInit(void)
|
||||
{
|
||||
if (!(virBhyveDriverConfigClass = virClassNew(virClassForObject(),
|
||||
"virBhyveDriverConfig",
|
||||
sizeof(virBhyveDriverConfig),
|
||||
virBhyveDriverConfigDispose)))
|
||||
if (!VIR_CLASS_NEW(virBhyveDriverConfig, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -62,10 +62,7 @@ static void virCapsDispose(void *obj);
|
||||
|
||||
static int virCapabilitiesOnceInit(void)
|
||||
{
|
||||
if (!(virCapsClass = virClassNew(virClassForObject(),
|
||||
"virCaps",
|
||||
sizeof(virCaps),
|
||||
virCapsDispose)))
|
||||
if (!VIR_CLASS_NEW(virCaps, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -40,17 +40,10 @@ static void virDomainCapsCPUModelsDispose(void *obj);
|
||||
|
||||
static int virDomainCapsOnceInit(void)
|
||||
{
|
||||
if (!(virDomainCapsClass = virClassNew(virClassForObjectLockable(),
|
||||
"virDomainCapsClass",
|
||||
sizeof(virDomainCaps),
|
||||
virDomainCapsDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainCaps, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
virDomainCapsCPUModelsClass = virClassNew(virClassForObject(),
|
||||
"virDomainCapsCPUModelsClass",
|
||||
sizeof(virDomainCapsCPUModels),
|
||||
virDomainCapsCPUModelsDispose);
|
||||
if (!virDomainCapsCPUModelsClass)
|
||||
if (!VIR_CLASS_NEW(virDomainCapsCPUModels, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -938,16 +938,10 @@ static void virDomainXMLOptionDispose(void *obj);
|
||||
|
||||
static int virDomainObjOnceInit(void)
|
||||
{
|
||||
if (!(virDomainObjClass = virClassNew(virClassForObjectLockable(),
|
||||
"virDomainObj",
|
||||
sizeof(virDomainObj),
|
||||
virDomainObjDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainObj, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virDomainXMLOptionClass = virClassNew(virClassForObject(),
|
||||
"virDomainXMLOption",
|
||||
sizeof(virDomainXMLOption),
|
||||
virDomainXMLOptionDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainXMLOption, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -12223,14 +12217,10 @@ static virClassPtr virDomainChrSourceDefClass;
|
||||
static int
|
||||
virDomainChrSourceDefOnceInit(void)
|
||||
{
|
||||
virDomainChrSourceDefClass = virClassNew(virClassForObject(),
|
||||
"virDomainChrSourceDef",
|
||||
sizeof(virDomainChrSourceDef),
|
||||
virDomainChrSourceDefDispose);
|
||||
if (!virDomainChrSourceDefClass)
|
||||
if (!VIR_CLASS_NEW(virDomainChrSourceDef, virClassForObject()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(virDomainChrSourceDef);
|
||||
|
@ -295,131 +295,47 @@ typedef virDomainEventBlockThreshold *virDomainEventBlockThresholdPtr;
|
||||
static int
|
||||
virDomainEventsOnceInit(void)
|
||||
{
|
||||
if (!(virDomainEventClass =
|
||||
virClassNew(virClassForObjectEvent(),
|
||||
"virDomainEvent",
|
||||
sizeof(virDomainEvent),
|
||||
virDomainEventDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEvent, virClassForObjectEvent()))
|
||||
return -1;
|
||||
if (!(virDomainEventLifecycleClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventLifecycle",
|
||||
sizeof(virDomainEventLifecycle),
|
||||
virDomainEventLifecycleDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventLifecycle, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventRTCChangeClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventRTCChange",
|
||||
sizeof(virDomainEventRTCChange),
|
||||
virDomainEventRTCChangeDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventRTCChange, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventWatchdogClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventWatchdog",
|
||||
sizeof(virDomainEventWatchdog),
|
||||
virDomainEventWatchdogDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventWatchdog, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventIOErrorClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventIOError",
|
||||
sizeof(virDomainEventIOError),
|
||||
virDomainEventIOErrorDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventIOError, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventGraphicsClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventGraphics",
|
||||
sizeof(virDomainEventGraphics),
|
||||
virDomainEventGraphicsDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventGraphics, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventBlockJobClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventBlockJob",
|
||||
sizeof(virDomainEventBlockJob),
|
||||
virDomainEventBlockJobDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventBlockJob, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventDiskChangeClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventDiskChange",
|
||||
sizeof(virDomainEventDiskChange),
|
||||
virDomainEventDiskChangeDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventDiskChange, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventTrayChangeClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventTrayChange",
|
||||
sizeof(virDomainEventTrayChange),
|
||||
virDomainEventTrayChangeDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventTrayChange, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventBalloonChangeClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventBalloonChange",
|
||||
sizeof(virDomainEventBalloonChange),
|
||||
virDomainEventBalloonChangeDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventBalloonChange, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventDeviceRemovedClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventDeviceRemoved",
|
||||
sizeof(virDomainEventDeviceRemoved),
|
||||
virDomainEventDeviceRemovedDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventDeviceRemoved, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventDeviceAddedClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventDeviceAdded",
|
||||
sizeof(virDomainEventDeviceAdded),
|
||||
virDomainEventDeviceAddedDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventDeviceAdded, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventPMClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventPM",
|
||||
sizeof(virDomainEventPM),
|
||||
virDomainEventPMDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventPM, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainQemuMonitorEventClass =
|
||||
virClassNew(virClassForObjectEvent(),
|
||||
"virDomainQemuMonitorEvent",
|
||||
sizeof(virDomainQemuMonitorEvent),
|
||||
virDomainQemuMonitorEventDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainQemuMonitorEvent, virClassForObjectEvent()))
|
||||
return -1;
|
||||
if (!(virDomainEventTunableClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventTunable",
|
||||
sizeof(virDomainEventTunable),
|
||||
virDomainEventTunableDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventTunable, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventAgentLifecycleClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventAgentLifecycle",
|
||||
sizeof(virDomainEventAgentLifecycle),
|
||||
virDomainEventAgentLifecycleDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventAgentLifecycle, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventMigrationIterationClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventMigrationIteration",
|
||||
sizeof(virDomainEventMigrationIteration),
|
||||
virDomainEventMigrationIterationDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventMigrationIteration, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventJobCompletedClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventJobCompleted",
|
||||
sizeof(virDomainEventJobCompleted),
|
||||
virDomainEventJobCompletedDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventJobCompleted, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventDeviceRemovalFailedClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventDeviceRemovalFailed",
|
||||
sizeof(virDomainEventDeviceRemovalFailed),
|
||||
virDomainEventDeviceRemovalFailedDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventDeviceRemovalFailed, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventMetadataChangeClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventMetadataChange",
|
||||
sizeof(virDomainEventMetadataChange),
|
||||
virDomainEventMetadataChangeDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventMetadataChange, virDomainEventClass))
|
||||
return -1;
|
||||
if (!(virDomainEventBlockThresholdClass =
|
||||
virClassNew(virDomainEventClass,
|
||||
"virDomainEventBlockThreshold",
|
||||
sizeof(virDomainEventBlockThreshold),
|
||||
virDomainEventBlockThresholdDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainEventBlockThreshold, virDomainEventClass))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -57,18 +57,12 @@ static void virNetworkEventLifecycleDispose(void *obj);
|
||||
static int
|
||||
virNetworkEventsOnceInit(void)
|
||||
{
|
||||
if (!(virNetworkEventClass =
|
||||
virClassNew(virClassForObjectEvent(),
|
||||
"virNetworkEvent",
|
||||
sizeof(virNetworkEvent),
|
||||
virNetworkEventDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetworkEvent, virClassForObjectEvent()))
|
||||
return -1;
|
||||
if (!(virNetworkEventLifecycleClass =
|
||||
virClassNew(virNetworkEventClass,
|
||||
"virNetworkEventLifecycle",
|
||||
sizeof(virNetworkEventLifecycle),
|
||||
virNetworkEventLifecycleDispose)))
|
||||
|
||||
if (!VIR_CLASS_NEW(virNetworkEventLifecycle, virNetworkEventClass))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -66,24 +66,15 @@ static void virNodeDeviceEventUpdateDispose(void *obj);
|
||||
static int
|
||||
virNodeDeviceEventsOnceInit(void)
|
||||
{
|
||||
if (!(virNodeDeviceEventClass =
|
||||
virClassNew(virClassForObjectEvent(),
|
||||
"virNodeDeviceEvent",
|
||||
sizeof(virNodeDeviceEvent),
|
||||
virNodeDeviceEventDispose)))
|
||||
if (!VIR_CLASS_NEW(virNodeDeviceEvent, virClassForObjectEvent()))
|
||||
return -1;
|
||||
if (!(virNodeDeviceEventLifecycleClass =
|
||||
virClassNew(virNodeDeviceEventClass,
|
||||
"virNodeDeviceEventLifecycle",
|
||||
sizeof(virNodeDeviceEventLifecycle),
|
||||
virNodeDeviceEventLifecycleDispose)))
|
||||
|
||||
if (!VIR_CLASS_NEW(virNodeDeviceEventLifecycle, virNodeDeviceEventClass))
|
||||
return -1;
|
||||
if (!(virNodeDeviceEventUpdateClass =
|
||||
virClassNew(virNodeDeviceEventClass,
|
||||
"virNodeDeviceEventUpdate",
|
||||
sizeof(virNodeDeviceEventUpdate),
|
||||
virNodeDeviceEventUpdateDispose)))
|
||||
|
||||
if (!VIR_CLASS_NEW(virNodeDeviceEventUpdate, virNodeDeviceEventClass))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -92,18 +92,10 @@ static void virObjectEventStateDispose(void *obj);
|
||||
static int
|
||||
virObjectEventOnceInit(void)
|
||||
{
|
||||
if (!(virObjectEventStateClass =
|
||||
virClassNew(virClassForObjectLockable(),
|
||||
"virObjectEventState",
|
||||
sizeof(virObjectEventState),
|
||||
virObjectEventStateDispose)))
|
||||
if (!VIR_CLASS_NEW(virObjectEventState, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virObjectEventClass =
|
||||
virClassNew(virClassForObject(),
|
||||
"virObjectEvent",
|
||||
sizeof(virObjectEvent),
|
||||
virObjectEventDispose)))
|
||||
if (!VIR_CLASS_NEW(virObjectEvent, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -65,24 +65,15 @@ static void virSecretEventValueChangedDispose(void *obj);
|
||||
static int
|
||||
virSecretEventsOnceInit(void)
|
||||
{
|
||||
if (!(virSecretEventClass =
|
||||
virClassNew(virClassForObjectEvent(),
|
||||
"virSecretEvent",
|
||||
sizeof(virSecretEvent),
|
||||
virSecretEventDispose)))
|
||||
if (!VIR_CLASS_NEW(virSecretEvent, virClassForObjectEvent()))
|
||||
return -1;
|
||||
if (!(virSecretEventLifecycleClass =
|
||||
virClassNew(virSecretEventClass,
|
||||
"virSecretEventLifecycle",
|
||||
sizeof(virSecretEventLifecycle),
|
||||
virSecretEventLifecycleDispose)))
|
||||
|
||||
if (!VIR_CLASS_NEW(virSecretEventLifecycle, virSecretEventClass))
|
||||
return -1;
|
||||
if (!(virSecretEventValueChangedClass =
|
||||
virClassNew(virSecretEventClass,
|
||||
"virSecretEventValueChanged",
|
||||
sizeof(virSecretEventValueChanged),
|
||||
virSecretEventValueChangedDispose)))
|
||||
|
||||
if (!VIR_CLASS_NEW(virSecretEventValueChanged, virSecretEventClass))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -66,24 +66,15 @@ static void virStoragePoolEventRefreshDispose(void *obj);
|
||||
static int
|
||||
virStoragePoolEventsOnceInit(void)
|
||||
{
|
||||
if (!(virStoragePoolEventClass =
|
||||
virClassNew(virClassForObjectEvent(),
|
||||
"virStoragePoolEvent",
|
||||
sizeof(virStoragePoolEvent),
|
||||
virStoragePoolEventDispose)))
|
||||
if (!VIR_CLASS_NEW(virStoragePoolEvent, virClassForObjectEvent()))
|
||||
return -1;
|
||||
if (!(virStoragePoolEventLifecycleClass =
|
||||
virClassNew(virStoragePoolEventClass,
|
||||
"virStoragePoolEventLifecycle",
|
||||
sizeof(virStoragePoolEventLifecycle),
|
||||
virStoragePoolEventLifecycleDispose)))
|
||||
|
||||
if (!VIR_CLASS_NEW(virStoragePoolEventLifecycle, virStoragePoolEventClass))
|
||||
return -1;
|
||||
if (!(virStoragePoolEventRefreshClass =
|
||||
virClassNew(virStoragePoolEventClass,
|
||||
"virStoragePoolEventRefresh",
|
||||
sizeof(virStoragePoolEventRefresh),
|
||||
virStoragePoolEventRefreshDispose)))
|
||||
|
||||
if (!VIR_CLASS_NEW(virStoragePoolEventRefresh, virStoragePoolEventClass))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,7 @@ struct _virDomainObjList {
|
||||
|
||||
static int virDomainObjListOnceInit(void)
|
||||
{
|
||||
if (!(virDomainObjListClass = virClassNew(virClassForObjectRWLockable(),
|
||||
"virDomainObjList",
|
||||
sizeof(virDomainObjList),
|
||||
virDomainObjListDispose)))
|
||||
if (!VIR_CLASS_NEW(virDomainObjList, virClassForObjectRWLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -58,16 +58,10 @@ static void virInterfaceObjListDispose(void *obj);
|
||||
static int
|
||||
virInterfaceObjOnceInit(void)
|
||||
{
|
||||
if (!(virInterfaceObjClass = virClassNew(virClassForObjectLockable(),
|
||||
"virInterfaceObj",
|
||||
sizeof(virInterfaceObj),
|
||||
virInterfaceObjDispose)))
|
||||
if (!VIR_CLASS_NEW(virInterfaceObj, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virInterfaceObjListClass = virClassNew(virClassForObjectRWLockable(),
|
||||
"virInterfaceObjList",
|
||||
sizeof(virInterfaceObjList),
|
||||
virInterfaceObjListDispose)))
|
||||
if (!VIR_CLASS_NEW(virInterfaceObjList, virClassForObjectRWLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -74,17 +74,12 @@ static void virNetworkObjListDispose(void *obj);
|
||||
static int
|
||||
virNetworkObjOnceInit(void)
|
||||
{
|
||||
if (!(virNetworkObjClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetworkObj",
|
||||
sizeof(virNetworkObj),
|
||||
virNetworkObjDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetworkObj, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virNetworkObjListClass = virClassNew(virClassForObjectRWLockable(),
|
||||
"virNetworkObjList",
|
||||
sizeof(virNetworkObjList),
|
||||
virNetworkObjListDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetworkObjList, virClassForObjectRWLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -58,16 +58,10 @@ static bool virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, int type);
|
||||
static int
|
||||
virNodeDeviceObjOnceInit(void)
|
||||
{
|
||||
if (!(virNodeDeviceObjClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNodeDeviceObj",
|
||||
sizeof(virNodeDeviceObj),
|
||||
virNodeDeviceObjDispose)))
|
||||
if (!VIR_CLASS_NEW(virNodeDeviceObj, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virNodeDeviceObjListClass = virClassNew(virClassForObjectRWLockable(),
|
||||
"virNodeDeviceObjList",
|
||||
sizeof(virNodeDeviceObjList),
|
||||
virNodeDeviceObjListDispose)))
|
||||
if (!VIR_CLASS_NEW(virNodeDeviceObjList, virClassForObjectRWLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -68,16 +68,10 @@ struct virSecretSearchData {
|
||||
static int
|
||||
virSecretObjOnceInit(void)
|
||||
{
|
||||
if (!(virSecretObjClass = virClassNew(virClassForObjectLockable(),
|
||||
"virSecretObj",
|
||||
sizeof(virSecretObj),
|
||||
virSecretObjDispose)))
|
||||
if (!VIR_CLASS_NEW(virSecretObj, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virSecretObjListClass = virClassNew(virClassForObjectRWLockable(),
|
||||
"virSecretObjList",
|
||||
sizeof(virSecretObjList),
|
||||
virSecretObjListDispose)))
|
||||
if (!VIR_CLASS_NEW(virSecretObjList, virClassForObjectRWLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -110,16 +110,10 @@ struct _virStoragePoolObjList {
|
||||
static int
|
||||
virStorageVolObjOnceInit(void)
|
||||
{
|
||||
if (!(virStorageVolObjClass = virClassNew(virClassForObjectLockable(),
|
||||
"virStorageVolObj",
|
||||
sizeof(virStorageVolObj),
|
||||
virStorageVolObjDispose)))
|
||||
if (!VIR_CLASS_NEW(virStorageVolObj, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virStorageVolObjListClass = virClassNew(virClassForObjectRWLockable(),
|
||||
"virStorageVolObjList",
|
||||
sizeof(virStorageVolObjList),
|
||||
virStorageVolObjListDispose)))
|
||||
if (!VIR_CLASS_NEW(virStorageVolObjList, virClassForObjectRWLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -207,16 +201,10 @@ virStorageVolObjListDispose(void *opaque)
|
||||
static int
|
||||
virStoragePoolObjOnceInit(void)
|
||||
{
|
||||
if (!(virStoragePoolObjClass = virClassNew(virClassForObjectLockable(),
|
||||
"virStoragePoolObj",
|
||||
sizeof(virStoragePoolObj),
|
||||
virStoragePoolObjDispose)))
|
||||
if (!VIR_CLASS_NEW(virStoragePoolObj, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virStoragePoolObjListClass = virClassNew(virClassForObjectRWLockable(),
|
||||
"virStoragePoolObjList",
|
||||
sizeof(virStoragePoolObjList),
|
||||
virStoragePoolObjListDispose)))
|
||||
if (!VIR_CLASS_NEW(virStoragePoolObjList, virClassForObjectRWLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -74,10 +74,7 @@ static int
|
||||
virDataTypesOnceInit(void)
|
||||
{
|
||||
#define DECLARE_CLASS_COMMON(basename, parent) \
|
||||
if (!(basename ## Class = virClassNew(parent, \
|
||||
#basename, \
|
||||
sizeof(basename), \
|
||||
basename ## Dispose))) \
|
||||
if (!(VIR_CLASS_NEW(basename, parent))) \
|
||||
return -1;
|
||||
#define DECLARE_CLASS(basename) \
|
||||
DECLARE_CLASS_COMMON(basename, virClassForObject())
|
||||
|
@ -55,11 +55,9 @@ static void virNetcfDriverStateDispose(void *obj);
|
||||
static int
|
||||
virNetcfDriverStateOnceInit(void)
|
||||
{
|
||||
if (!(virNetcfDriverStateClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetcfDriverState",
|
||||
sizeof(virNetcfDriverState),
|
||||
virNetcfDriverStateDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetcfDriverState, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -67,10 +67,7 @@ virAdmGlobalInit(void)
|
||||
if (!bindtextdomain(PACKAGE, LOCALEDIR))
|
||||
goto error;
|
||||
|
||||
if (!(remoteAdminPrivClass = virClassNew(virClassForObjectLockable(),
|
||||
"remoteAdminPriv",
|
||||
sizeof(remoteAdminPriv),
|
||||
remoteAdminPrivDispose)))
|
||||
if (!VIR_CLASS_NEW(remoteAdminPriv, virClassForObjectLockable()))
|
||||
goto error;
|
||||
|
||||
return;
|
||||
|
@ -63,10 +63,7 @@ static void libxlDriverConfigDispose(void *obj);
|
||||
|
||||
static int libxlConfigOnceInit(void)
|
||||
{
|
||||
if (!(libxlDriverConfigClass = virClassNew(virClassForObject(),
|
||||
"libxlDriverConfig",
|
||||
sizeof(libxlDriverConfig),
|
||||
libxlDriverConfigDispose)))
|
||||
if (!VIR_CLASS_NEW(libxlDriverConfig, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -58,10 +58,7 @@ libxlDomainObjPrivateDispose(void *obj);
|
||||
static int
|
||||
libxlDomainObjPrivateOnceInit(void)
|
||||
{
|
||||
if (!(libxlDomainObjPrivateClass = virClassNew(virClassForObjectLockable(),
|
||||
"libxlDomainObjPrivate",
|
||||
sizeof(libxlDomainObjPrivate),
|
||||
libxlDomainObjPrivateDispose)))
|
||||
if (!VIR_CLASS_NEW(libxlDomainObjPrivate, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -244,10 +244,7 @@ libxlMigrationDstArgsDispose(void *obj)
|
||||
static int
|
||||
libxlMigrationDstArgsOnceInit(void)
|
||||
{
|
||||
if (!(libxlMigrationDstArgsClass = virClassNew(virClassForObject(),
|
||||
"libxlMigrationDstArgs",
|
||||
sizeof(libxlMigrationDstArgs),
|
||||
libxlMigrationDstArgsDispose)))
|
||||
if (!VIR_CLASS_NEW(libxlMigrationDstArgs, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -76,10 +76,7 @@ static void virLogHandlerDispose(void *obj);
|
||||
static int
|
||||
virLogHandlerOnceInit(void)
|
||||
{
|
||||
if (!(virLogHandlerClass = virClassNew(virClassForObjectLockable(),
|
||||
"virLogHandler",
|
||||
sizeof(virLogHandler),
|
||||
virLogHandlerDispose)))
|
||||
if (!VIR_CLASS_NEW(virLogHandler, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -48,10 +48,7 @@ static void virLXCDriverConfigDispose(void *obj);
|
||||
|
||||
static int virLXCConfigOnceInit(void)
|
||||
{
|
||||
if (!(virLXCDriverConfigClass = virClassNew(virClassForObject(),
|
||||
"virLXCDriverConfig",
|
||||
sizeof(virLXCDriverConfig),
|
||||
virLXCDriverConfigDispose)))
|
||||
if (!VIR_CLASS_NEW(virLXCDriverConfig, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -51,10 +51,7 @@ static void virLXCMonitorDispose(void *obj);
|
||||
|
||||
static int virLXCMonitorOnceInit(void)
|
||||
{
|
||||
if (!(virLXCMonitorClass = virClassNew(virClassForObjectLockable(),
|
||||
"virLXCMonitor",
|
||||
sizeof(virLXCMonitor),
|
||||
virLXCMonitorDispose)))
|
||||
if (!VIR_CLASS_NEW(virLXCMonitor, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -93,10 +93,7 @@ udevEventDataDispose(void *obj)
|
||||
static int
|
||||
udevEventDataOnceInit(void)
|
||||
{
|
||||
if (!(udevEventDataClass = virClassNew(virClassForObjectLockable(),
|
||||
"udevEventData",
|
||||
sizeof(udevEventData),
|
||||
udevEventDataDispose)))
|
||||
if (!VIR_CLASS_NEW(udevEventData, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -138,10 +138,7 @@ static void qemuAgentDispose(void *obj);
|
||||
|
||||
static int qemuAgentOnceInit(void)
|
||||
{
|
||||
if (!(qemuAgentClass = virClassNew(virClassForObjectLockable(),
|
||||
"qemuAgent",
|
||||
sizeof(qemuAgent),
|
||||
qemuAgentDispose)))
|
||||
if (!VIR_CLASS_NEW(qemuAgent, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -552,10 +552,7 @@ static void virQEMUCapsDispose(void *obj);
|
||||
|
||||
static int virQEMUCapsOnceInit(void)
|
||||
{
|
||||
if (!(virQEMUCapsClass = virClassNew(virClassForObject(),
|
||||
"virQEMUCaps",
|
||||
sizeof(virQEMUCaps),
|
||||
virQEMUCapsDispose)))
|
||||
if (!VIR_CLASS_NEW(virQEMUCaps, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -80,15 +80,10 @@ static void virQEMUDriverConfigDispose(void *obj);
|
||||
|
||||
static int virQEMUConfigOnceInit(void)
|
||||
{
|
||||
virQEMUDriverConfigClass = virClassNew(virClassForObject(),
|
||||
"virQEMUDriverConfig",
|
||||
sizeof(virQEMUDriverConfig),
|
||||
virQEMUDriverConfigDispose);
|
||||
|
||||
if (!virQEMUDriverConfigClass)
|
||||
if (!VIR_CLASS_NEW(virQEMUDriverConfig, virClassForObject()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(virQEMUConfig)
|
||||
|
@ -131,16 +131,10 @@ static void qemuDomainSaveCookieDispose(void *obj);
|
||||
static int
|
||||
qemuDomainOnceInit(void)
|
||||
{
|
||||
if (!(qemuDomainLogContextClass = virClassNew(virClassForObject(),
|
||||
"qemuDomainLogContext",
|
||||
sizeof(qemuDomainLogContext),
|
||||
qemuDomainLogContextDispose)))
|
||||
if (!VIR_CLASS_NEW(qemuDomainLogContext, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
if (!(qemuDomainSaveCookieClass = virClassNew(virClassForObject(),
|
||||
"qemuDomainSaveCookie",
|
||||
sizeof(qemuDomainSaveCookie),
|
||||
qemuDomainSaveCookieDispose)))
|
||||
if (!VIR_CLASS_NEW(qemuDomainSaveCookie, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -992,14 +986,10 @@ static void qemuDomainDiskPrivateDispose(void *obj);
|
||||
static int
|
||||
qemuDomainDiskPrivateOnceInit(void)
|
||||
{
|
||||
qemuDomainDiskPrivateClass = virClassNew(virClassForObject(),
|
||||
"qemuDomainDiskPrivate",
|
||||
sizeof(qemuDomainDiskPrivate),
|
||||
qemuDomainDiskPrivateDispose);
|
||||
if (!qemuDomainDiskPrivateClass)
|
||||
if (!VIR_CLASS_NEW(qemuDomainDiskPrivate, virClassForObject()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(qemuDomainDiskPrivate)
|
||||
@ -1032,14 +1022,10 @@ static void qemuDomainStorageSourcePrivateDispose(void *obj);
|
||||
static int
|
||||
qemuDomainStorageSourcePrivateOnceInit(void)
|
||||
{
|
||||
qemuDomainStorageSourcePrivateClass = virClassNew(virClassForObject(),
|
||||
"qemuDomainStorageSourcePrivate",
|
||||
sizeof(qemuDomainStorageSourcePrivate),
|
||||
qemuDomainStorageSourcePrivateDispose);
|
||||
if (!qemuDomainStorageSourcePrivateClass)
|
||||
if (!VIR_CLASS_NEW(qemuDomainStorageSourcePrivate, virClassForObject()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(qemuDomainStorageSourcePrivate)
|
||||
@ -1075,14 +1061,10 @@ static void qemuDomainVcpuPrivateDispose(void *obj);
|
||||
static int
|
||||
qemuDomainVcpuPrivateOnceInit(void)
|
||||
{
|
||||
qemuDomainVcpuPrivateClass = virClassNew(virClassForObject(),
|
||||
"qemuDomainVcpuPrivate",
|
||||
sizeof(qemuDomainVcpuPrivate),
|
||||
qemuDomainVcpuPrivateDispose);
|
||||
if (!qemuDomainVcpuPrivateClass)
|
||||
if (!VIR_CLASS_NEW(qemuDomainVcpuPrivate, virClassForObject()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(qemuDomainVcpuPrivate)
|
||||
@ -1119,15 +1101,10 @@ static void qemuDomainChrSourcePrivateDispose(void *obj);
|
||||
static int
|
||||
qemuDomainChrSourcePrivateOnceInit(void)
|
||||
{
|
||||
qemuDomainChrSourcePrivateClass =
|
||||
virClassNew(virClassForObject(),
|
||||
"qemuDomainChrSourcePrivate",
|
||||
sizeof(qemuDomainChrSourcePrivate),
|
||||
qemuDomainChrSourcePrivateDispose);
|
||||
if (!qemuDomainChrSourcePrivateClass)
|
||||
if (!VIR_CLASS_NEW(qemuDomainChrSourcePrivate, virClassForObject()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(qemuDomainChrSourcePrivate)
|
||||
|
@ -165,10 +165,7 @@ static void qemuMonitorDispose(void *obj);
|
||||
|
||||
static int qemuMonitorOnceInit(void)
|
||||
{
|
||||
if (!(qemuMonitorClass = virClassNew(virClassForObjectLockable(),
|
||||
"qemuMonitor",
|
||||
sizeof(qemuMonitor),
|
||||
qemuMonitorDispose)))
|
||||
if (!VIR_CLASS_NEW(qemuMonitor, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -58,10 +58,7 @@ static void virKeepAliveDispose(void *obj);
|
||||
|
||||
static int virKeepAliveOnceInit(void)
|
||||
{
|
||||
if (!(virKeepAliveClass = virClassNew(virClassForObjectLockable(),
|
||||
"virKeepAlive",
|
||||
sizeof(virKeepAlive),
|
||||
virKeepAliveDispose)))
|
||||
if (!VIR_CLASS_NEW(virKeepAlive, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -120,10 +120,7 @@ static void virNetClientDispose(void *obj);
|
||||
|
||||
static int virNetClientOnceInit(void)
|
||||
{
|
||||
if (!(virNetClientClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetClient",
|
||||
sizeof(virNetClient),
|
||||
virNetClientDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetClient, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -54,10 +54,7 @@ static void virNetClientProgramDispose(void *obj);
|
||||
|
||||
static int virNetClientProgramOnceInit(void)
|
||||
{
|
||||
if (!(virNetClientProgramClass = virClassNew(virClassForObject(),
|
||||
"virNetClientProgram",
|
||||
sizeof(virNetClientProgram),
|
||||
virNetClientProgramDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetClientProgram, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -71,10 +71,7 @@ static void virNetClientStreamDispose(void *obj);
|
||||
|
||||
static int virNetClientStreamOnceInit(void)
|
||||
{
|
||||
if (!(virNetClientStreamClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetClientStream",
|
||||
sizeof(virNetClientStream),
|
||||
virNetClientStreamDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetClientStream, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -110,10 +110,7 @@ virNetDaemonDispose(void *obj)
|
||||
static int
|
||||
virNetDaemonOnceInit(void)
|
||||
{
|
||||
if (!(virNetDaemonClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetDaemon",
|
||||
sizeof(virNetDaemon),
|
||||
virNetDaemonDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetDaemon, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -161,10 +161,7 @@ virNetLibsshSessionOnceInit(void)
|
||||
{
|
||||
const char *dbgLevelStr;
|
||||
|
||||
if (!(virNetLibsshSessionClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetLibsshSession",
|
||||
sizeof(virNetLibsshSession),
|
||||
virNetLibsshSessionDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetLibsshSession, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (ssh_init() < 0) {
|
||||
|
@ -57,16 +57,10 @@ static void virNetSASLSessionDispose(void *obj);
|
||||
|
||||
static int virNetSASLContextOnceInit(void)
|
||||
{
|
||||
if (!(virNetSASLContextClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetSASLContext",
|
||||
sizeof(virNetSASLContext),
|
||||
virNetSASLContextDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetSASLContext, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virNetSASLSessionClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetSASLSession",
|
||||
sizeof(virNetSASLSession),
|
||||
virNetSASLSessionDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetSASLSession, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -93,10 +93,7 @@ static inline size_t virNetServerTrackCompletedAuthLocked(virNetServerPtr srv);
|
||||
|
||||
static int virNetServerOnceInit(void)
|
||||
{
|
||||
if (!(virNetServerClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetServer",
|
||||
sizeof(virNetServer),
|
||||
virNetServerDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetServer, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -129,10 +129,7 @@ static void virNetServerClientDispose(void *obj);
|
||||
|
||||
static int virNetServerClientOnceInit(void)
|
||||
{
|
||||
if (!(virNetServerClientClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetServerClient",
|
||||
sizeof(virNetServerClient),
|
||||
virNetServerClientDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetServerClient, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -51,10 +51,7 @@ static void virNetServerProgramDispose(void *obj);
|
||||
|
||||
static int virNetServerProgramOnceInit(void)
|
||||
{
|
||||
if (!(virNetServerProgramClass = virClassNew(virClassForObject(),
|
||||
"virNetServerProgram",
|
||||
sizeof(virNetServerProgram),
|
||||
virNetServerProgramDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetServerProgram, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -57,10 +57,7 @@ static void virNetServerServiceDispose(void *obj);
|
||||
|
||||
static int virNetServerServiceOnceInit(void)
|
||||
{
|
||||
if (!(virNetServerServiceClass = virClassNew(virClassForObject(),
|
||||
"virNetServerService",
|
||||
sizeof(virNetServerService),
|
||||
virNetServerServiceDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetServerService, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -124,10 +124,7 @@ static void virNetSocketDispose(void *obj);
|
||||
|
||||
static int virNetSocketOnceInit(void)
|
||||
{
|
||||
if (!(virNetSocketClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetSocket",
|
||||
sizeof(virNetSocket),
|
||||
virNetSocketDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetSocket, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -167,10 +167,7 @@ static virClassPtr virNetSSHSessionClass;
|
||||
static int
|
||||
virNetSSHSessionOnceInit(void)
|
||||
{
|
||||
if (!(virNetSSHSessionClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetSSHSession",
|
||||
sizeof(virNetSSHSession),
|
||||
virNetSSHSessionDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetSSHSession, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -90,16 +90,10 @@ static void virNetTLSSessionDispose(void *obj);
|
||||
|
||||
static int virNetTLSContextOnceInit(void)
|
||||
{
|
||||
if (!(virNetTLSContextClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetTLSContext",
|
||||
sizeof(virNetTLSContext),
|
||||
virNetTLSContextDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetTLSContext, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virNetTLSSessionClass = virClassNew(virClassForObjectLockable(),
|
||||
"virNetTLSSession",
|
||||
sizeof(virNetTLSSession),
|
||||
virNetTLSSessionDispose)))
|
||||
if (!VIR_CLASS_NEW(virNetTLSSession, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -59,10 +59,7 @@ void virSecurityManagerDispose(void *obj)
|
||||
static int
|
||||
virSecurityManagerOnceInit(void)
|
||||
{
|
||||
if (!(virSecurityManagerClass = virClassNew(virClassForObjectLockable(),
|
||||
"virSecurityManagerClass",
|
||||
sizeof(virSecurityManager),
|
||||
virSecurityManagerDispose)))
|
||||
if (!VIR_CLASS_NEW(virSecurityManager, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -53,15 +53,10 @@ static void virCloseCallbacksDispose(void *obj);
|
||||
|
||||
static int virCloseCallbacksOnceInit(void)
|
||||
{
|
||||
virCloseCallbacksClass = virClassNew(virClassForObjectLockable(),
|
||||
"virCloseCallbacks",
|
||||
sizeof(virCloseCallbacks),
|
||||
virCloseCallbacksDispose);
|
||||
|
||||
if (!virCloseCallbacksClass)
|
||||
if (!VIR_CLASS_NEW(virCloseCallbacks, virClassForObjectLockable()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(virCloseCallbacks)
|
||||
|
@ -641,12 +641,8 @@ dnsmasqCapsDispose(void *obj)
|
||||
|
||||
static int dnsmasqCapsOnceInit(void)
|
||||
{
|
||||
if (!(dnsmasqCapsClass = virClassNew(virClassForObject(),
|
||||
"dnsmasqCaps",
|
||||
sizeof(dnsmasqCaps),
|
||||
dnsmasqCapsDispose))) {
|
||||
if (!VIR_CLASS_NEW(dnsmasqCaps, virClassForObject()))
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -129,10 +129,7 @@ virFDStreamDataDispose(void *obj)
|
||||
|
||||
static int virFDStreamDataOnceInit(void)
|
||||
{
|
||||
if (!(virFDStreamDataClass = virClassNew(virClassForObjectLockable(),
|
||||
"virFDStreamData",
|
||||
sizeof(virFDStreamData),
|
||||
virFDStreamDataDispose)))
|
||||
if (!VIR_CLASS_NEW(virFDStreamData, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -86,10 +86,7 @@ virFileCacheDispose(void *obj)
|
||||
static int
|
||||
virFileCacheOnceInit(void)
|
||||
{
|
||||
if (!(virFileCacheClass = virClassNew(virClassForObjectLockable(),
|
||||
"virFileCache",
|
||||
sizeof(virFileCache),
|
||||
virFileCacheDispose)))
|
||||
if (!VIR_CLASS_NEW(virFileCache, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -77,15 +77,12 @@ static void virHashAtomicDispose(void *obj);
|
||||
|
||||
static int virHashAtomicOnceInit(void)
|
||||
{
|
||||
virHashAtomicClass = virClassNew(virClassForObjectLockable(),
|
||||
"virHashAtomic",
|
||||
sizeof(virHashAtomic),
|
||||
virHashAtomicDispose);
|
||||
if (!virHashAtomicClass)
|
||||
if (!VIR_CLASS_NEW(virHashAtomic, virClassForObjectLockable()))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(virHashAtomic)
|
||||
|
||||
|
||||
|
@ -120,10 +120,7 @@ static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAddressPtr devAddr, void *o
|
||||
|
||||
static int virHostdevManagerOnceInit(void)
|
||||
{
|
||||
if (!(virHostdevManagerClass = virClassNew(virClassForObject(),
|
||||
"virHostdevManager",
|
||||
sizeof(virHostdevManager),
|
||||
virHostdevManagerDispose)))
|
||||
if (!VIR_CLASS_NEW(virHostdevManager, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
if (!(manager = virHostdevManagerNew()))
|
||||
|
@ -54,10 +54,7 @@ static void virIdentityDispose(void *obj);
|
||||
|
||||
static int virIdentityOnceInit(void)
|
||||
{
|
||||
if (!(virIdentityClass = virClassNew(virClassForObject(),
|
||||
"virIdentity",
|
||||
sizeof(virIdentity),
|
||||
virIdentityDispose)))
|
||||
if (!VIR_CLASS_NEW(virIdentity, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
if (virThreadLocalInit(&virIdentityCurrent,
|
||||
|
@ -74,10 +74,7 @@ virMacMapDispose(void *obj)
|
||||
|
||||
static int virMacMapOnceInit(void)
|
||||
{
|
||||
if (!(virMacMapClass = virClassNew(virClassForObjectLockable(),
|
||||
"virMacMapClass",
|
||||
sizeof(virMacMap),
|
||||
virMacMapDispose)))
|
||||
if (!VIR_CLASS_NEW(virMacMap, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -58,10 +58,7 @@ virMediatedDeviceListDispose(void *obj);
|
||||
static int
|
||||
virMediatedOnceInit(void)
|
||||
{
|
||||
if (!(virMediatedDeviceListClass = virClassNew(virClassForObjectLockable(),
|
||||
"virMediatedDeviceList",
|
||||
sizeof(virMediatedDeviceList),
|
||||
virMediatedDeviceListDispose)))
|
||||
if (!VIR_CLASS_NEW(virMediatedDeviceList, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -81,16 +81,10 @@ virObjectOnceInit(void)
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
if (!(virObjectLockableClass = virClassNew(virObjectClass,
|
||||
"virObjectLockable",
|
||||
sizeof(virObjectLockable),
|
||||
virObjectLockableDispose)))
|
||||
if (!VIR_CLASS_NEW(virObjectLockable, virObjectClass))
|
||||
return -1;
|
||||
|
||||
if (!(virObjectRWLockableClass = virClassNew(virObjectClass,
|
||||
"virObjectRWLockable",
|
||||
sizeof(virObjectRWLockable),
|
||||
virObjectRWLockableDispose)))
|
||||
if (!VIR_CLASS_NEW(virObjectRWLockable, virObjectClass))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -74,6 +74,10 @@ virClassPtr virClassForObjectRWLockable(void);
|
||||
# ifndef VIR_PARENT_REQUIRED
|
||||
# define VIR_PARENT_REQUIRED ATTRIBUTE_NONNULL(1)
|
||||
# endif
|
||||
|
||||
# define VIR_CLASS_NEW(name, prnt) \
|
||||
(name##Class = virClassNew(prnt, #name, sizeof(name), name##Dispose))
|
||||
|
||||
virClassPtr
|
||||
virClassNew(virClassPtr parent,
|
||||
const char *name,
|
||||
|
@ -204,10 +204,7 @@ static void virPCIDeviceListDispose(void *obj);
|
||||
|
||||
static int virPCIOnceInit(void)
|
||||
{
|
||||
if (!(virPCIDeviceListClass = virClassNew(virClassForObjectLockable(),
|
||||
"virPCIDeviceList",
|
||||
sizeof(virPCIDeviceList),
|
||||
virPCIDeviceListDispose)))
|
||||
if (!VIR_CLASS_NEW(virPCIDeviceList, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -80,10 +80,7 @@ virPortAllocatorNew(void)
|
||||
static int
|
||||
virPortAllocatorOnceInit(void)
|
||||
{
|
||||
if (!(virPortAllocatorClass = virClassNew(virClassForObjectLockable(),
|
||||
"virPortAllocator",
|
||||
sizeof(virPortAllocator),
|
||||
virPortAllocatorDispose)))
|
||||
if (!VIR_CLASS_NEW(virPortAllocator, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
if (!(virPortAllocatorInstance = virPortAllocatorNew()))
|
||||
|
@ -133,10 +133,7 @@ virResctrlInfoDispose(void *obj)
|
||||
static int
|
||||
virResctrlInfoOnceInit(void)
|
||||
{
|
||||
if (!(virResctrlInfoClass = virClassNew(virClassForObject(),
|
||||
"virResctrlInfo",
|
||||
sizeof(virResctrlInfo),
|
||||
virResctrlInfoDispose)))
|
||||
if (!VIR_CLASS_NEW(virResctrlInfo, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -271,10 +268,7 @@ virResctrlAllocDispose(void *obj)
|
||||
static int
|
||||
virResctrlAllocOnceInit(void)
|
||||
{
|
||||
if (!(virResctrlAllocClass = virClassNew(virClassForObject(),
|
||||
"virResctrlAlloc",
|
||||
sizeof(virResctrlAlloc),
|
||||
virResctrlAllocDispose)))
|
||||
if (!VIR_CLASS_NEW(virResctrlAlloc, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -85,10 +85,7 @@ static void virSCSIDeviceListDispose(void *obj);
|
||||
static int
|
||||
virSCSIOnceInit(void)
|
||||
{
|
||||
if (!(virSCSIDeviceListClass = virClassNew(virClassForObjectLockable(),
|
||||
"virSCSIDeviceList",
|
||||
sizeof(virSCSIDeviceList),
|
||||
virSCSIDeviceListDispose)))
|
||||
if (!VIR_CLASS_NEW(virSCSIDeviceList, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -70,10 +70,7 @@ virSCSIVHostDeviceListDispose(void *obj)
|
||||
static int
|
||||
virSCSIVHostOnceInit(void)
|
||||
{
|
||||
if (!(virSCSIVHostDeviceListClass = virClassNew(virClassForObjectLockable(),
|
||||
"virSCSIVHostDeviceList",
|
||||
sizeof(virSCSIVHostDeviceList),
|
||||
virSCSIVHostDeviceListDispose)))
|
||||
if (!VIR_CLASS_NEW(virSCSIVHostDeviceList, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -80,10 +80,7 @@ static void virUSBDeviceListDispose(void *obj);
|
||||
|
||||
static int virUSBOnceInit(void)
|
||||
{
|
||||
if (!(virUSBDeviceListClass = virClassNew(virClassForObjectLockable(),
|
||||
"virUSBDeviceList",
|
||||
sizeof(virUSBDeviceList),
|
||||
virUSBDeviceListDispose)))
|
||||
if (!VIR_CLASS_NEW(virUSBDeviceList, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -118,10 +118,7 @@ vboxDriverDispose(void *obj)
|
||||
static int
|
||||
vboxDriverOnceInit(void)
|
||||
{
|
||||
if (!(vboxDriverClass = virClassNew(virClassForObjectLockable(),
|
||||
"vboxDriver",
|
||||
sizeof(vboxDriver),
|
||||
vboxDriverDispose)))
|
||||
if (!VIR_CLASS_NEW(vboxDriver, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -161,10 +161,7 @@ static void vzDriverDispose(void * obj)
|
||||
|
||||
static int vzDriverOnceInit(void)
|
||||
{
|
||||
if (!(vzDriverClass = virClassNew(virClassForObjectLockable(),
|
||||
"vzDriver",
|
||||
sizeof(vzDriver),
|
||||
vzDriverDispose)))
|
||||
if (!VIR_CLASS_NEW(vzDriver, virClassForObjectLockable()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -49,10 +49,7 @@ testFileCacheObjDispose(void *opaque)
|
||||
static int
|
||||
testFileCacheObjOnceInit(void)
|
||||
{
|
||||
if (!(testFileCacheObjClass = virClassNew(virClassForObject(),
|
||||
"testFileCacheObj",
|
||||
sizeof(testFileCacheObj),
|
||||
testFileCacheObjDispose)))
|
||||
if (!VIR_CLASS_NEW(testFileCacheObj, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user