+Wed Nov 12 16:13:42 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
+
+ * 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 <berrange@redhat.com>
* src/storage_backend.c, src/storage_backend.h, src/storage_driver.c:
#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;
-
-
-int virStorageBackendRegister(virStorageBackendPtr bk) {
- if (VIR_REALLOC_N(backends, nbackends+1) < 0)
- return -1;
+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
+};
- 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];
#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;
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;