mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
storage: Introduce virStoragePoolObjBuildTempFilePath
Create a function to return a temporary file path to be used in a mkostemp type call using the path to the stateDir + pool->def->name + vol->name Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
0330848207
commit
01f4a4a070
@ -3602,3 +3602,27 @@ virStoragePoolObjFindPoolByUUID(const unsigned char *uuid)
|
|||||||
storageDriverUnlock();
|
storageDriverUnlock();
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* virStoragePoolObjBuildTempFilePath
|
||||||
|
* @pool: pool object pointer
|
||||||
|
* @vol: volume definition
|
||||||
|
*
|
||||||
|
* Generate a name for a temporary file using the driver stateDir
|
||||||
|
* as a path, the pool name, and the volume name to be used as input
|
||||||
|
* for a mkostemp
|
||||||
|
*
|
||||||
|
* Returns a string pointer on success, NULL on failure
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr pool,
|
||||||
|
virStorageVolDefPtr vol)
|
||||||
|
|
||||||
|
{
|
||||||
|
char *tmp = NULL;
|
||||||
|
|
||||||
|
ignore_value(virAsprintf(&tmp, "%s/%s.%s.secret.XXXXXX",
|
||||||
|
driver->stateDir, pool->def->name, vol->name));
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
@ -65,6 +65,10 @@ storagePoolLookupByTargetPath(virConnectPtr conn,
|
|||||||
const char *path)
|
const char *path)
|
||||||
ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
|
char *virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr pool,
|
||||||
|
virStorageVolDefPtr vol)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
||||||
|
|
||||||
int storageRegister(void);
|
int storageRegister(void);
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_DRIVER_H__ */
|
#endif /* __VIR_STORAGE_DRIVER_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user