xen/blktapctrl-default-to-ioemu.patch

146 lines
3.4 KiB
Diff

Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
===================================================================
--- xen-3.3.1-testing.orig/tools/blktap/drivers/blktapctrl.c
+++ xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
@@ -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
return child;
}
+#ifndef ALWAYS_USE_IOEMU
static int launch_tapdisk(char *wrctldev, char *rdctldev)
{
char *argv[] = { "tapdisk", wrctldev, rdctldev, NULL };
@@ -483,6 +489,7 @@ static int launch_tapdisk(char *wrctldev
return 0;
}
+#endif
static int launch_tapdisk_ioemu(void)
{
@@ -554,6 +561,7 @@ static int connect_qemu(blkif_t *blkif,
return 0;
}
+#ifndef ALWAYS_USE_IOEMU
/* Launch tapdisk instance */
static int connect_tapdisk(blkif_t *blkif, int minor)
{
@@ -597,6 +605,7 @@ fail:
return ret;
}
+#endif
static int blktapctrl_new_blkif(blkif_t *blkif)
{
@@ -621,6 +630,10 @@ static int blktapctrl_new_blkif(blkif_t
blkif->cookie = next_cookie++;
if (!exist) {
+#ifdef ALWAYS_USE_IOEMU
+ if (connect_qemu(blkif, blkif->domid))
+ goto fail;
+#else
if (type == DISK_TYPE_IOEMU) {
if (connect_qemu(blkif, blkif->domid))
goto fail;
@@ -628,6 +641,7 @@ static int blktapctrl_new_blkif(blkif_t
if (connect_tapdisk(blkif, minor))
goto fail;
}
+#endif
} else {
DPRINTF("Process exists!\n");
Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h
===================================================================
--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.h
+++ xen-3.3.1-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