In preparation for making a private object, create accessor API's for consumer storage functions to use: virStoragePoolObjGetDef virStoragePoolObjSetDef virStoragePoolObjGetNewDef virStoragePoolObjDefUseNewDef virStoragePoolObjGetConfigFile virStoragePoolObjSetConfigFile virStoragePoolObjGetAutostartLink virStoragePoolObjIsActive virStoragePoolObjSetActive virStoragePoolObjIsAutostart virStoragePoolObjSetAutostart virStoragePoolObjGetAsyncjobs virStoragePoolObjIncrAsyncjobs virStoragePoolObjDecrAsyncjobs Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/conf/virstorageobj.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++ src/conf/virstorageobj.h | 50 +++++++++++++++++++--- src/libvirt_private.syms | 14 ++++++ 3 files changed, 168 insertions(+), 5 deletions(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index e83044b..ebda9fe 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -37,6 +37,115 @@ VIR_LOG_INIT("conf.virstorageobj"); +virStoragePoolDefPtr +virStoragePoolObjGetDef(virStoragePoolObjPtr obj) +{ + return obj->def; +} + + +void +virStoragePoolObjSetDef(virStoragePoolObjPtr obj, + virStoragePoolDefPtr def) +{ + virStoragePoolDefFree(obj->def); + obj->def = def; +} + + +virStoragePoolDefPtr +virStoragePoolObjGetNewDef(virStoragePoolObjPtr obj) +{ + return obj->newDef; +} + + +void +virStoragePoolObjDefUseNewDef(virStoragePoolObjPtr obj) +{ + virStoragePoolDefFree(obj->def); + obj->def = obj->newDef; + obj->newDef = NULL; +} + + +char * +virStoragePoolObjGetConfigFile(virStoragePoolObjPtr obj) +{ + return obj->configFile; +} + + +void +virStoragePoolObjSetConfigFile(virStoragePoolObjPtr obj, + char *configFile) +{ + VIR_FREE(obj->configFile); + obj->configFile = configFile; +} + + +char * +virStoragePoolObjGetAutostartLink(virStoragePoolObjPtr obj) +{ + return obj->autostartLink; +} + + +bool +virStoragePoolObjIsActive(virStoragePoolObjPtr obj) +{ + return obj->active; +} + + +void +virStoragePoolObjSetActive(virStoragePoolObjPtr obj, + bool active) +{ + obj->active = active; +} + + +bool +virStoragePoolObjIsAutostart(virStoragePoolObjPtr obj) +{ + if (!obj->configFile) + return 0; + + return obj->autostart == 1; +} + + +void +virStoragePoolObjSetAutostart(virStoragePoolObjPtr obj, + int autostart) +{ + obj->autostart = autostart; +} + + +unsigned int +virStoragePoolObjGetAsyncjobs(virStoragePoolObjPtr obj) +{ + return obj->asyncjobs; +} + + +void +virStoragePoolObjIncrAsyncjobs(virStoragePoolObjPtr obj) +{ + obj->asyncjobs++; +} + + +void +virStoragePoolObjDecrAsyncjobs(virStoragePoolObjPtr obj) +{ + obj->asyncjobs--; +} + + void virStoragePoolObjFree(virStoragePoolObjPtr obj) { diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h index ac51b5f..a5ed8f8 100644 --- a/src/conf/virstorageobj.h +++ b/src/conf/virstorageobj.h @@ -70,11 +70,51 @@ typedef bool (*virStoragePoolObjListFilter)(virConnectPtr conn, virStoragePoolDefPtr def); -static inline int -virStoragePoolObjIsActive(virStoragePoolObjPtr obj) -{ - return obj->active; -} +virStoragePoolDefPtr +virStoragePoolObjGetDef(virStoragePoolObjPtr obj); + +void +virStoragePoolObjSetDef(virStoragePoolObjPtr obj, + virStoragePoolDefPtr def); + +virStoragePoolDefPtr +virStoragePoolObjGetNewDef(virStoragePoolObjPtr obj); + +void +virStoragePoolObjDefUseNewDef(virStoragePoolObjPtr obj); + +char * +virStoragePoolObjGetConfigFile(virStoragePoolObjPtr obj); + +void +virStoragePoolObjSetConfigFile(virStoragePoolObjPtr obj, + char *configFile); + +char * +virStoragePoolObjGetAutostartLink(virStoragePoolObjPtr obj); + +bool +virStoragePoolObjIsActive(virStoragePoolObjPtr obj); + +void +virStoragePoolObjSetActive(virStoragePoolObjPtr obj, + bool active); + +bool +virStoragePoolObjIsAutostart(virStoragePoolObjPtr obj); + +void +virStoragePoolObjSetAutostart(virStoragePoolObjPtr obj, + int autostart); + +unsigned int +virStoragePoolObjGetAsyncjobs(virStoragePoolObjPtr obj); + +void +virStoragePoolObjIncrAsyncjobs(virStoragePoolObjPtr obj); + +void +virStoragePoolObjDecrAsyncjobs(virStoragePoolObjPtr obj); int virStoragePoolObjLoadAllConfigs(virStoragePoolObjListPtr pools, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2149b11..8bb1cbc 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1051,10 +1051,20 @@ virSecretObjSetValueSize; # conf/virstorageobj.h virStoragePoolObjAssignDef; virStoragePoolObjClearVols; +virStoragePoolObjDecrAsyncjobs; +virStoragePoolObjDefUseNewDef; virStoragePoolObjDeleteDef; virStoragePoolObjFindByName; virStoragePoolObjFindByUUID; +virStoragePoolObjGetAsyncjobs; +virStoragePoolObjGetAutostartLink; +virStoragePoolObjGetConfigFile; +virStoragePoolObjGetDef; virStoragePoolObjGetNames; +virStoragePoolObjGetNewDef; +virStoragePoolObjIncrAsyncjobs; +virStoragePoolObjIsActive; +virStoragePoolObjIsAutostart; virStoragePoolObjIsDuplicate; virStoragePoolObjListExport; virStoragePoolObjListFree; @@ -1065,6 +1075,10 @@ virStoragePoolObjNumOfStoragePools; virStoragePoolObjNumOfVolumes; virStoragePoolObjRemove; virStoragePoolObjSaveDef; +virStoragePoolObjSetActive; +virStoragePoolObjSetAutostart; +virStoragePoolObjSetConfigFile; +virStoragePoolObjSetDef; virStoragePoolObjSourceFindDuplicate; virStoragePoolObjUnlock; virStoragePoolObjVolumeGetNames; -- 2.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list