|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 09 of 21 RESEND] blktap3/drivers: Introduce back-end driver types
This patch copies the back-end driver types from blktap2 with changes coming
from blktap2.5.
Signed-off-by: Thanos Makatos <thanos.makatos@xxxxxxxxxx>
diff --git a/tools/blktap2/drivers/tapdisk-disktype.c
b/tools/blktap3/drivers/tapdisk-disktype.c
copy from tools/blktap2/drivers/tapdisk-disktype.c
copy to tools/blktap3/drivers/tapdisk-disktype.c
--- a/tools/blktap2/drivers/tapdisk-disktype.c
+++ b/tools/blktap3/drivers/tapdisk-disktype.c
@@ -30,8 +30,10 @@
#include <string.h>
#include <errno.h>
+#include "blktap3.h"
+#include "tapdisk.h"
+
#include "tapdisk-disktype.h"
-#include "tapdisk-message.h"
static const disk_info_t aio_disk = {
"aio",
@@ -91,15 +93,39 @@ static const disk_info_t vhd_index_disk
static const disk_info_t log_disk = {
"log",
"write logger (log)",
- 0,
+ DISK_TYPE_FILTER,
};
-static const disk_info_t remus_disk = {
- "remus",
+static disk_info_t remus_disk = {
"remus disk replicator (remus)",
+ "remus",
+ 0,
+};
+
+static const disk_info_t lcache_disk = {
+ "lc",
+ "local parent cache (lc)",
+ DISK_TYPE_FILTER,
+};
+
+static const disk_info_t llpcache_disk = {
+ "llp",
+ "local leaf cache, persistent (llp)",
+ 0,
+};
+
+static const disk_info_t llecache_disk = {
+ "lle",
+ "local leaf cache, ephemeral (lle)",
0,
};
+static const disk_info_t valve_disk = {
+ "valve",
+ "group rate limiting (valve)",
+ DISK_TYPE_FILTER,
+};
+
const disk_info_t *tapdisk_disk_types[] = {
[DISK_TYPE_AIO] = &aio_disk,
[DISK_TYPE_SYNC] = &sync_disk,
@@ -109,47 +135,85 @@ const disk_info_t *tapdisk_disk_types[]
[DISK_TYPE_RAM] = &ram_disk,
[DISK_TYPE_QCOW] = &qcow_disk,
[DISK_TYPE_BLOCK_CACHE] = &block_cache_disk,
- [DISK_TYPE_LOG] = &log_disk,
[DISK_TYPE_VINDEX] = &vhd_index_disk,
+ [DISK_TYPE_LOG] = &log_disk,
[DISK_TYPE_REMUS] = &remus_disk,
+ [DISK_TYPE_LCACHE] = &lcache_disk,
+ [DISK_TYPE_VALVE] = &valve_disk,
+ [DISK_TYPE_LLPCACHE] = &llpcache_disk,
+ [DISK_TYPE_LLECACHE] = &llecache_disk,
0,
};
extern struct tap_disk tapdisk_aio;
+
+/*
+ * TODO Why commented out?
+ */
+#if 0
extern struct tap_disk tapdisk_sync;
extern struct tap_disk tapdisk_vmdk;
extern struct tap_disk tapdisk_vhdsync;
+#endif
+
extern struct tap_disk tapdisk_vhd;
extern struct tap_disk tapdisk_ram;
+
+/*
+ * TODO Why commented out?
+ */
+#if 0
extern struct tap_disk tapdisk_qcow;
-extern struct tap_disk tapdisk_block_cache;
+#endif
+
extern struct tap_disk tapdisk_vhd_index;
+
+/*
+ * TODO Why commented out?
+ */
+#if 0
extern struct tap_disk tapdisk_log;
-extern struct tap_disk tapdisk_remus;
+#endif
const struct tap_disk *tapdisk_disk_drivers[] = {
[DISK_TYPE_AIO] = &tapdisk_aio,
+
+/*
+ * TODO Why commented out?
+ */
#if 0
[DISK_TYPE_SYNC] = &tapdisk_sync,
[DISK_TYPE_VMDK] = &tapdisk_vmdk,
+ [DISK_TYPE_VHDSYNC] = &tapdisk_vhdsync_disk
#endif
- [DISK_TYPE_VHD] = &tapdisk_vhd,
- [DISK_TYPE_RAM] = &tapdisk_ram,
+
+/*
+ * TODO Why commented out?
+ */
+#if 0
[DISK_TYPE_QCOW] = &tapdisk_qcow,
- [DISK_TYPE_BLOCK_CACHE] = &tapdisk_block_cache,
- [DISK_TYPE_VINDEX] = &tapdisk_vhd_index,
+#endif
+
+/*
+ * TODO Why commented out?
+ */
+#if 0
[DISK_TYPE_LOG] = &tapdisk_log,
- [DISK_TYPE_REMUS] = &tapdisk_remus,
+#endif
0,
};
int
tapdisk_disktype_find(const char *name)
{
- const disk_info_t *info;
int i;
- for (i = 0; info = tapdisk_disk_types[i], info != NULL; ++i) {
+ for (i = 0; i < ARRAY_SIZE(tapdisk_disk_types); i++) {
+ const disk_info_t *info = tapdisk_disk_types[i];
+
+ if (!info)
+ continue;
+
if (strcmp(name, info->name))
continue;
@@ -183,22 +247,7 @@ tapdisk_disktype_parse_params(const char
type = tapdisk_disktype_find(name);
- if (type >= 0)
- *_path = params + len + 1;
+ *_path = params + len + 1;
return type;
}
-
-int
-tapdisk_parse_disk_type(const char *params, const char **_path, int *_type)
-{
- int type;
-
- type = tapdisk_disktype_parse_params(params, _path);
- if (type < 0)
- return type;
-
- *_type = type;
-
- return 0;
-}
diff --git a/tools/blktap2/drivers/tapdisk-disktype.h
b/tools/blktap3/drivers/tapdisk-disktype.h
copy from tools/blktap2/drivers/tapdisk-disktype.h
copy to tools/blktap3/drivers/tapdisk-disktype.h
--- a/tools/blktap2/drivers/tapdisk-disktype.h
+++ b/tools/blktap3/drivers/tapdisk-disktype.h
@@ -37,9 +37,13 @@
#define DISK_TYPE_RAM 5
#define DISK_TYPE_QCOW 6
#define DISK_TYPE_BLOCK_CACHE 7
-#define DISK_TYPE_LOG 8
-#define DISK_TYPE_REMUS 9
-#define DISK_TYPE_VINDEX 10
+#define DISK_TYPE_VINDEX 8
+#define DISK_TYPE_LOG 9
+#define DISK_TYPE_REMUS 10
+#define DISK_TYPE_LCACHE 11
+#define DISK_TYPE_LLECACHE 12
+#define DISK_TYPE_LLPCACHE 13
+#define DISK_TYPE_VALVE 14
#define DISK_TYPE_NAME_MAX 32
@@ -55,8 +59,10 @@ extern const struct tap_disk *tapdisk_di
/* one single controller for all instances of disk type */
#define DISK_TYPE_SINGLE_CONTROLLER (1<<0)
+/* filter driver without physical image data */
+#define DISK_TYPE_FILTER (1<<1)
+
int tapdisk_disktype_find(const char *name);
int tapdisk_disktype_parse_params(const char *params, const char **_path);
-int tapdisk_parse_disk_type(const char *, const char **, int *);
#endif
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |