mirror of https://gitee.com/openkylin/libvirt.git
storage: Create accessor API's for virStoragePoolObj
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@redhat.com>
This commit is contained in:
parent
b616ec65e2
commit
b31982868a
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1055,10 +1055,20 @@ virSecretObjSetValueSize;
|
|||
# conf/virstorageobj.h
|
||||
virStoragePoolObjAssignDef;
|
||||
virStoragePoolObjClearVols;
|
||||
virStoragePoolObjDecrAsyncjobs;
|
||||
virStoragePoolObjDefUseNewDef;
|
||||
virStoragePoolObjDeleteDef;
|
||||
virStoragePoolObjFindByName;
|
||||
virStoragePoolObjFindByUUID;
|
||||
virStoragePoolObjGetAsyncjobs;
|
||||
virStoragePoolObjGetAutostartLink;
|
||||
virStoragePoolObjGetConfigFile;
|
||||
virStoragePoolObjGetDef;
|
||||
virStoragePoolObjGetNames;
|
||||
virStoragePoolObjGetNewDef;
|
||||
virStoragePoolObjIncrAsyncjobs;
|
||||
virStoragePoolObjIsActive;
|
||||
virStoragePoolObjIsAutostart;
|
||||
virStoragePoolObjIsDuplicate;
|
||||
virStoragePoolObjListExport;
|
||||
virStoragePoolObjListFree;
|
||||
|
@ -1069,6 +1079,10 @@ virStoragePoolObjNumOfStoragePools;
|
|||
virStoragePoolObjNumOfVolumes;
|
||||
virStoragePoolObjRemove;
|
||||
virStoragePoolObjSaveDef;
|
||||
virStoragePoolObjSetActive;
|
||||
virStoragePoolObjSetAutostart;
|
||||
virStoragePoolObjSetConfigFile;
|
||||
virStoragePoolObjSetDef;
|
||||
virStoragePoolObjSourceFindDuplicate;
|
||||
virStoragePoolObjUnlock;
|
||||
virStoragePoolObjVolumeGetNames;
|
||||
|
|
Loading…
Reference in New Issue