diff options
author | Eric Blake <eblake@redhat.com> | 2011-07-06 16:51:23 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-07-13 09:04:54 -0600 |
commit | 64bd1b9dd5ad040f9744fc18baf776c88d38db8f (patch) | |
tree | b5cb15e6a65a33b91f3a663b82f0b8c8a5fb7c45 /src/storage/storage_driver.c | |
parent | node_device: reject unknown flags (diff) | |
download | libvirt-64bd1b9dd5ad040f9744fc18baf776c88d38db8f.tar.gz libvirt-64bd1b9dd5ad040f9744fc18baf776c88d38db8f.tar.bz2 libvirt-64bd1b9dd5ad040f9744fc18baf776c88d38db8f.zip |
storage: reject unknown flags
* src/storage/storage_backend.c (virStorageBackendCreateBlockFrom)
(virStorageBackendCreateQemuImg)
(virStorageBackendCreateQcowCreate): Reject unknown flags.
* src/storage/storage_backend_disk.c (virStorageBackendDiskBuildPool)
(virStorageBackendDiskDeleteVol): Likewise.
* src/storage/storage_backend_fs.c
(virStorageBackendFileSystemNetFindPoolSources)
(virStorageBackendFileSystemBuild)
(virStorageBackendFileSystemDelete, createFileDir)
(virStorageBackendFileSystemVolBuildFrom)
(virStorageBackendFileSystemVolDelete): Likewise.
* src/storage/storage_backend_iscsi.c
(virStorageBackendISCSIFindPoolSources): Likewise.
* src/storage/storage_backend_logical.c
(virStorageBackendLogicalFindPoolSources)
(virStorageBackendLogicalBuildPool)
(virStorageBackendLogicalDeletePool)
(virStorageBackendLogicalDeleteVol): Likewise.
* src/storage/storage_driver.c (storageOpen, storagePoolCreate)
(storagePoolDefine, storagePoolRefresh, storagePoolGetXMLDesc)
(storageVolumeCreateXML, storageVolumeCreateXMLFrom)
(storageVolumeGetXMLDesc): Likewise.
Diffstat (limited to 'src/storage/storage_driver.c')
-rw-r--r-- | src/storage/storage_driver.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index d1fef92cc..4f35be0cb 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -322,7 +322,10 @@ storagePoolLookupByVolume(virStorageVolPtr vol) { static virDrvOpenStatus storageOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ + virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); + if (!driverState) return VIR_DRV_OPEN_DECLINED; @@ -516,13 +519,16 @@ cleanup: static virStoragePoolPtr storagePoolCreate(virConnectPtr conn, const char *xml, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = conn->storagePrivateData; virStoragePoolDefPtr def; virStoragePoolObjPtr pool = NULL; virStoragePoolPtr ret = NULL; virStorageBackendPtr backend; + virCheckFlags(0, NULL); + storageDriverLock(driver); if (!(def = virStoragePoolDefParseString(xml))) goto cleanup; @@ -567,12 +573,15 @@ cleanup: static virStoragePoolPtr storagePoolDefine(virConnectPtr conn, const char *xml, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = conn->storagePrivateData; virStoragePoolDefPtr def; virStoragePoolObjPtr pool = NULL; virStoragePoolPtr ret = NULL; + virCheckFlags(0, NULL); + storageDriverLock(driver); if (!(def = virStoragePoolDefParseString(xml))) goto cleanup; @@ -657,12 +666,15 @@ cleanup: static int storagePoolStart(virStoragePoolPtr obj, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; virStorageBackendPtr backend; int ret = -1; + virCheckFlags(0, -1); + storageDriverLock(driver); pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid); storageDriverUnlock(driver); @@ -848,12 +860,15 @@ cleanup: static int storagePoolRefresh(virStoragePoolPtr obj, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; virStorageBackendPtr backend; int ret = -1; + virCheckFlags(0, -1); + storageDriverLock(driver); pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid); @@ -940,11 +955,14 @@ cleanup: static char * storagePoolGetXMLDesc(virStoragePoolPtr obj, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; char *ret = NULL; + virCheckFlags(0, NULL); + storageDriverLock(driver); pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid); storageDriverUnlock(driver); @@ -1261,13 +1279,16 @@ static int storageVolumeDelete(virStorageVolPtr obj, unsigned int flags); static virStorageVolPtr storageVolumeCreateXML(virStoragePoolPtr obj, const char *xmldesc, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; virStorageBackendPtr backend; virStorageVolDefPtr voldef = NULL; virStorageVolPtr ret = NULL, volobj = NULL; + virCheckFlags(0, NULL); + storageDriverLock(driver); pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid); storageDriverUnlock(driver); @@ -1383,7 +1404,8 @@ static virStorageVolPtr storageVolumeCreateXMLFrom(virStoragePoolPtr obj, const char *xmldesc, virStorageVolPtr vobj, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool, origpool = NULL; virStorageBackendPtr backend; @@ -1391,6 +1413,8 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj, virStorageVolPtr ret = NULL, volobj = NULL; int buildret; + virCheckFlags(0, NULL); + storageDriverLock(driver); pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid); if (pool && STRNEQ(obj->name, vobj->pool)) { @@ -2010,13 +2034,16 @@ cleanup: static char * storageVolumeGetXMLDesc(virStorageVolPtr obj, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; virStorageBackendPtr backend; virStorageVolDefPtr vol; char *ret = NULL; + virCheckFlags(0, NULL); + storageDriverLock(driver); pool = virStoragePoolObjFindByName(&driver->pools, obj->pool); storageDriverUnlock(driver); |