diff --git a/ChangeLog b/ChangeLog index 3cace25011..13e9e73094 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Nov 12 16:13:42 GMT 2008 Daniel P. Berrange + + * src/storage_backend.c, src/storage_backend.h, src/storage_driver.c: + Revert previous patch which breaks "test" driver's storage APIs. + Tue Nov 11 15:51:42 GMT 2008 Daniel P. Berrange * src/storage_backend.c, src/storage_backend.h, src/storage_driver.c: diff --git a/src/storage_backend.c b/src/storage_backend.c index dc55989e6a..d146cb75fa 100644 --- a/src/storage_backend.c +++ b/src/storage_backend.c @@ -47,27 +47,49 @@ #include "storage_backend.h" +#if WITH_STORAGE_LVM +#include "storage_backend_logical.h" +#endif +#if WITH_STORAGE_ISCSI +#include "storage_backend_iscsi.h" +#endif +#if WITH_STORAGE_DISK +#include "storage_backend_disk.h" +#endif +#if WITH_STORAGE_DIR +#include "storage_backend_fs.h" +#endif + VIR_ENUM_IMPL(virStorageBackendPartTable, VIR_STORAGE_POOL_DISK_LAST, "unknown", "dos", "dvh", "gpt", "mac", "bsd", "pc98", "sun", "lvm2"); -static unsigned nbackends = 0; -static virStorageBackendPtr *backends = NULL; +static virStorageBackendPtr backends[] = { +#if WITH_STORAGE_DIR + &virStorageBackendDirectory, +#endif +#if WITH_STORAGE_FS + &virStorageBackendFileSystem, + &virStorageBackendNetFileSystem, +#endif +#if WITH_STORAGE_LVM + &virStorageBackendLogical, +#endif +#if WITH_STORAGE_ISCSI + &virStorageBackendISCSI, +#endif +#if WITH_STORAGE_DISK + &virStorageBackendDisk, +#endif + NULL +}; -int virStorageBackendRegister(virStorageBackendPtr bk) { - if (VIR_REALLOC_N(backends, nbackends+1) < 0) - return -1; - - backends[nbackends++] = bk; - return 0; -} - virStorageBackendPtr virStorageBackendForType(int type) { unsigned int i; - for (i = 0; i < nbackends; i++) + for (i = 0; backends[i]; i++) if (backends[i]->type == type) return backends[i]; diff --git a/src/storage_backend.h b/src/storage_backend.h index c667faea5f..46311c60e5 100644 --- a/src/storage_backend.h +++ b/src/storage_backend.h @@ -121,7 +121,6 @@ struct _virStorageBackend { int volType; }; -int virStorageBackendRegister(virStorageBackendPtr bk); virStorageBackendPtr virStorageBackendForType(int type); virStorageBackendPoolOptionsPtr virStorageBackendPoolOptionsForType(int type); diff --git a/src/storage_driver.c b/src/storage_driver.c index ad540c982f..46bb42302e 100644 --- a/src/storage_driver.c +++ b/src/storage_driver.c @@ -41,20 +41,6 @@ #include "memory.h" #include "storage_backend.h" - -#if WITH_STORAGE_LVM -#include "storage_backend_logical.h" -#endif -#if WITH_STORAGE_ISCSI -#include "storage_backend_iscsi.h" -#endif -#if WITH_STORAGE_DISK -#include "storage_backend_disk.h" -#endif -#if WITH_STORAGE_DIR -#include "storage_backend_fs.h" -#endif - #define storageLog(msg...) fprintf(stderr, msg) static virStorageDriverStatePtr driverState; @@ -111,29 +97,6 @@ storageDriverStartup(void) { char *base = NULL; char driverConf[PATH_MAX]; -#if WITH_STORAGE_DIR - if (virStorageBackendRegister(&virStorageBackendDirectory) < 0) - return -1; -#endif -#if WITH_STORAGE_FS - if (virStorageBackendRegister(&virStorageBackendFileSystem) < 0) - return -1; - if (virStorageBackendRegister(&virStorageBackendNetFileSystem) < 0) - return -1; -#endif -#if WITH_STORAGE_LVM - if (virStorageBackendRegister(&virStorageBackendLogical) < 0) - return -1; -#endif -#if WITH_STORAGE_ISCSI - if (virStorageBackendRegister(&virStorageBackendISCSI) < 0) - return -1; -#endif -#if WITH_STORAGE_DISK - if (virStorageBackendRegister(&virStorageBackendDisk) < 0) - return -1; -#endif - if (VIR_ALLOC(driverState) < 0) return -1;