2008-07-19 01:04:37 +02:00
|
|
|
Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c
|
|
|
|
===================================================================
|
|
|
|
--- xen-3.3.0-testing.orig/tools/blktap/drivers/blktapctrl.c
|
|
|
|
+++ xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c
|
2008-09-12 17:57:53 +02:00
|
|
|
@@ -65,6 +65,8 @@
|
|
|
|
#define MAX_RAND_VAL 0xFFFF
|
|
|
|
#define MAX_ATTEMPTS 10
|
|
|
|
|
|
|
|
+#undef ALWAYS_USE_IOEMU
|
|
|
|
+
|
|
|
|
int run = 1;
|
|
|
|
int max_timeout = MAX_TIMEOUT;
|
|
|
|
int ctlfd = 0;
|
|
|
|
@@ -174,7 +176,10 @@ static int test_path(char *path, char **
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found) {
|
|
|
|
- *type = dtypes[i]->idnum;
|
|
|
|
+ if (dtypes[i]->use_ioemu)
|
|
|
|
+ *type = DISK_TYPE_IOEMU;
|
|
|
|
+ else
|
|
|
|
+ *type = dtypes[i]->idnum;
|
|
|
|
|
|
|
|
if (dtypes[i]->single_handler == 1) {
|
|
|
|
/* Check whether tapdisk process
|
|
|
|
@@ -474,6 +479,7 @@ static int launch_tapdisk_provider(char
|
2008-07-19 01:04:37 +02:00
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
2008-09-12 17:57:53 +02:00
|
|
|
+#ifndef ALWAYS_USE_IOEMU
|
2008-07-19 01:04:37 +02:00
|
|
|
static int launch_tapdisk(char *wrctldev, char *rdctldev)
|
|
|
|
{
|
|
|
|
char *argv[] = { "tapdisk", wrctldev, rdctldev, NULL };
|
2008-09-12 17:57:53 +02:00
|
|
|
@@ -483,6 +489,7 @@ static int launch_tapdisk(char *wrctldev
|
2008-07-19 01:04:37 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
static int launch_tapdisk_ioemu(void)
|
|
|
|
{
|
2008-09-12 17:57:53 +02:00
|
|
|
@@ -554,6 +561,7 @@ static int connect_qemu(blkif_t *blkif,
|
2008-07-19 01:04:37 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-09-12 17:57:53 +02:00
|
|
|
+#ifndef ALWAYS_USE_IOEMU
|
2008-07-19 01:04:37 +02:00
|
|
|
/* Launch tapdisk instance */
|
|
|
|
static int connect_tapdisk(blkif_t *blkif, int minor)
|
|
|
|
{
|
2008-09-12 17:57:53 +02:00
|
|
|
@@ -597,6 +605,7 @@ fail:
|
2008-07-19 01:04:37 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
2008-08-18 00:24:29 +02:00
|
|
|
static int blktapctrl_new_blkif(blkif_t *blkif)
|
2008-07-19 01:04:37 +02:00
|
|
|
{
|
2008-09-12 17:57:53 +02:00
|
|
|
@@ -621,6 +630,10 @@ static int blktapctrl_new_blkif(blkif_t
|
2008-07-19 01:04:37 +02:00
|
|
|
blkif->cookie = next_cookie++;
|
|
|
|
|
|
|
|
if (!exist) {
|
2008-09-12 17:57:53 +02:00
|
|
|
+#ifdef ALWAYS_USE_IOEMU
|
|
|
|
+ if (connect_qemu(blkif, blkif->domid))
|
|
|
|
+ goto fail;
|
|
|
|
+#else
|
2008-07-19 01:04:37 +02:00
|
|
|
if (type == DISK_TYPE_IOEMU) {
|
|
|
|
if (connect_qemu(blkif, blkif->domid))
|
|
|
|
goto fail;
|
2008-09-12 17:57:53 +02:00
|
|
|
@@ -628,6 +641,7 @@ static int blktapctrl_new_blkif(blkif_t
|
2008-07-19 01:04:37 +02:00
|
|
|
if (connect_tapdisk(blkif, minor))
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
} else {
|
|
|
|
DPRINTF("Process exists!\n");
|
2008-09-12 17:57:53 +02:00
|
|
|
Index: xen-3.3.0-testing/tools/blktap/drivers/tapdisk.h
|
|
|
|
===================================================================
|
|
|
|
--- xen-3.3.0-testing.orig/tools/blktap/drivers/tapdisk.h
|
|
|
|
+++ xen-3.3.0-testing/tools/blktap/drivers/tapdisk.h
|
|
|
|
@@ -145,6 +145,8 @@ typedef struct disk_info {
|
|
|
|
char handle[10]; /* xend handle, e.g. 'ram' */
|
|
|
|
int single_handler; /* is there a single controller for all */
|
|
|
|
/* instances of disk type? */
|
|
|
|
+ int use_ioemu; /* backend provider: 0 = tapdisk; 1 = ioemu */
|
|
|
|
+
|
|
|
|
#ifdef TAPDISK
|
|
|
|
struct tap_disk *drv;
|
|
|
|
#endif
|
|
|
|
@@ -166,6 +168,7 @@ static disk_info_t aio_disk = {
|
|
|
|
"raw image (aio)",
|
|
|
|
"aio",
|
|
|
|
0,
|
|
|
|
+ 1,
|
|
|
|
#ifdef TAPDISK
|
|
|
|
&tapdisk_aio,
|
|
|
|
#endif
|
|
|
|
@@ -176,6 +179,7 @@ static disk_info_t sync_disk = {
|
|
|
|
"raw image (sync)",
|
|
|
|
"sync",
|
|
|
|
0,
|
|
|
|
+ 1,
|
|
|
|
#ifdef TAPDISK
|
|
|
|
&tapdisk_sync,
|
|
|
|
#endif
|
|
|
|
@@ -186,6 +190,7 @@ static disk_info_t vmdk_disk = {
|
|
|
|
"vmware image (vmdk)",
|
|
|
|
"vmdk",
|
|
|
|
1,
|
|
|
|
+ 1,
|
|
|
|
#ifdef TAPDISK
|
|
|
|
&tapdisk_vmdk,
|
|
|
|
#endif
|
|
|
|
@@ -196,6 +201,7 @@ static disk_info_t ram_disk = {
|
|
|
|
"ramdisk image (ram)",
|
|
|
|
"ram",
|
|
|
|
1,
|
|
|
|
+ 0,
|
|
|
|
#ifdef TAPDISK
|
|
|
|
&tapdisk_ram,
|
|
|
|
#endif
|
|
|
|
@@ -206,6 +212,7 @@ static disk_info_t qcow_disk = {
|
|
|
|
"qcow disk (qcow)",
|
|
|
|
"qcow",
|
|
|
|
0,
|
|
|
|
+ 1,
|
|
|
|
#ifdef TAPDISK
|
|
|
|
&tapdisk_qcow,
|
|
|
|
#endif
|
|
|
|
@@ -216,6 +223,7 @@ static disk_info_t qcow2_disk = {
|
|
|
|
"qcow2 disk (qcow2)",
|
|
|
|
"qcow2",
|
|
|
|
0,
|
|
|
|
+ 1,
|
|
|
|
#ifdef TAPDISK
|
|
|
|
&tapdisk_qcow2,
|
|
|
|
#endif
|
|
|
|
@@ -226,6 +234,7 @@ static disk_info_t ioemu_disk = {
|
|
|
|
"ioemu disk",
|
|
|
|
"ioemu",
|
|
|
|
1,
|
|
|
|
+ 1,
|
|
|
|
#ifdef TAPDISK
|
|
|
|
NULL
|
|
|
|
#endif
|