static void
usage(void)
{
- printf("usage: create <-t type> <-f file> [-d device name]\n");
+ printf("usage: create <-a args> [-d device name]\n");
}
int
-_tap_ctl_create(const int type, const char *file, char **devname)
+_tap_ctl_create(const char *params, char **devname)
{
int err, id;
if (err)
goto destroy;
- err = tap_ctl_open(id, id, type, file);
+ err = tap_ctl_open(id, id, params);
if (err)
goto detach;
tap_ctl_create(int argc, char **argv)
{
int c, err, type;
- char *file, *devname;
+ char *args, *devname;
- type = -1;
- file = NULL;
+ args = NULL;
devname = NULL;
optind = 0;
- while ((c = getopt(argc, argv, "t:f:d:h")) != -1) {
+ while ((c = getopt(argc, argv, "a:d:h")) != -1) {
switch (c) {
- case 't':
- type = atoi(optarg);
- break;
- case 'f':
- file = optarg;
+ case 'a':
+ args = optarg;
break;
case 'd':
devname = optarg;
}
}
- if (!file || type == -1) {
+ if (!args) {
usage();
return EINVAL;
}
- err = _tap_ctl_create(type, file, &devname);
+ err = _tap_ctl_create(args, &devname);
if (!err)
printf("%s\n", devname);
#include "tap-ctl.h"
#include "blktap2.h"
#include "list.h"
-#include "disktypes.h"
+#include "tapdisk-disktype.h"
static void
free_list(tap_list_t *entry)
{
+ if (entry->type) {
+ free(entry->type);
+ entry->type = NULL;
+ }
+
if (entry->path) {
free(entry->path);
entry->path = NULL;
free(entry);
}
-static int
-init_list(tap_list_t *entry,
- int tap_id, pid_t tap_pid, int vbd_minor, int vbd_state,
- const char *driver, const char *vdi_path)
+int
+_parse_params(const char *params, char **type, char **path)
{
+ char *ptr;
+ size_t len;
- entry->id = tap_id;
- entry->pid = tap_pid;
- entry->minor = vbd_minor;
- entry->state = vbd_state;
- entry->driver = driver;
- entry->path = vdi_path ? strdup(vdi_path) : NULL;
+ ptr = strchr(params, ':');
+ if (!ptr)
+ return -EINVAL;
+
+ len = ptr - params;
+
+ *type = strndup(params, len);
+ *path = strdup(params + len + 1);
- if (vdi_path && !entry->path)
- return -ENOMEM;
+ if (!*type || !*path) {
+ free(*type);
+ *type = NULL;
+
+ free(*path);
+ *path = NULL;
+
+ return -errno;
+ }
return 0;
}
-static tap_list_t *
-alloc_list(int tap_id, pid_t tap_pid, int vbd_minor, int vbd_state, const char *vdi_driver, const char *vdi_path)
+static int
+init_list(tap_list_t *entry,
+ int tap_id, pid_t tap_pid, int vbd_minor, int vbd_state,
+ const char *params)
{
- tap_list_t *entry;
- int err;
+ int err = 0;
- entry = malloc(sizeof(tap_list_t));
- if (!entry)
- goto fail;
-
- err = init_list(entry, tap_id, tap_pid, vbd_minor, vbd_state, vdi_driver, vdi_path);
- if (err)
- goto fail;
-
- return entry;
+ entry->id = tap_id;
+ entry->pid = tap_pid;
+ entry->minor = vbd_minor;
+ entry->state = vbd_state;
-fail:
- if (entry)
- free_list(entry);
+ if (params)
+ err = _parse_params(params, &entry->type, &entry->path);
- return NULL;
+ return err;
}
void
struct tapdisk_list {
int minor;
int state;
- const char *driver;
- char *path;
+ char *params;
struct list_head entry;
};
-static int
-_tap_ctl_get_driver_handle(int id, const char **_handle)
-{
- disk_info_t *info;
- int n_drivers, i;
-
- n_drivers = sizeof(dtypes) / sizeof(dtypes[0]);
-
- for (i = 0; i < n_drivers; ++i) {
- info = dtypes[i];
- if (info->idnum == id)
- break;
- }
-
- if (i == n_drivers)
- return -ENOENT;
-
- if (info->idnum < 0)
- return -EINVAL;
-
- *_handle = info->handle;
-
- return 0;
-}
-
int
_tap_ctl_list_tapdisk(int id, struct list_head *_list)
{
tl->minor = message.u.list.minor;
tl->state = message.u.list.state;
- tl->path = NULL;
- tl->driver = NULL;
if (message.u.list.path[0] != 0) {
- tl->path = strndup(message.u.list.path,
- sizeof(message.u.list.path));
- if (!tl->path) {
+ tl->params = strndup(message.u.list.path,
+ sizeof(message.u.list.path));
+ if (!tl->params) {
err = -errno;
break;
}
+ } else
+ tl->params = NULL;
- err = _tap_ctl_get_driver_handle(message.drivertype,
- &tl->driver);
- if (err)
- break;
- }
list_add(&tl->entry, &list);
} while (1);
if (err)
list_for_each_entry_safe(tl, next, &list, entry) {
list_del(&tl->entry);
- free(tl->path);
+ free(tl->params);
free(tl);
}
for (tap = tapv; tap < &tapv[n_taps]; ++tap) {
struct tapdisk_list *tl;
- list_for_each_entry(tl, &tap->list, entry)
+ list_for_each_entry(tl, &tap->list, entry) {
+ free(tl->params);
free(tl);
+ }
}
free(tapv);
/* orphaned tapdisk */
if (list_empty(&tap->list)) {
- err = init_list(*_entry++, tap->id, tap->pid, -1, -1, NULL, NULL);
+ err = init_list(*_entry++, tap->id, tap->pid, -1, -1, NULL);
if (err)
goto fail;
continue;
err = init_list(*_entry++,
tap->id, tap->pid,
- tl->minor, tl->state, tl->driver, tl->path);
+ tl->minor, tl->state, tl->params);
if (err)
goto fail;
for (_m = 0; _m < n_minors; ++_m) {
int minor = minorv[_m];
if (minor >= 0) {
- err = init_list(*_entry++, -1, -1, minor, -1, NULL, NULL);
+ err = init_list(*_entry++, -1, -1, minor, -1, NULL);
if (err)
goto fail;
}
#include "tap-ctl.h"
#include "blktaplib.h"
-#include "disktypes.h"
int
-tap_ctl_open(const int id, const int minor, const int type, const char *file)
+tap_ctl_open(const int id, const int minor, const char *args)
{
int err;
tapdisk_message_t message;
memset(&message, 0, sizeof(message));
message.type = TAPDISK_MESSAGE_OPEN;
message.cookie = minor;
- message.drivertype = type;
message.u.params.storage = TAPDISK_STORAGE_TYPE_DEFAULT;
message.u.params.devnum = minor;
err = snprintf(message.u.params.path,
- sizeof(message.u.params.path) - 1, "%s", file);
+ sizeof(message.u.params.path) - 1, "%s", args);
if (err >= sizeof(message.u.params.path)) {
printf("name too long\n");
return ENAMETOOLONG;
return err;
}
-
-int
-tap_ctl_get_driver_id(const char *handle)
-{
- disk_info_t *info;
- int n_drivers, i;
-
- n_drivers = sizeof(dtypes) / sizeof(dtypes[0]);
-
- for (i = 0; i < n_drivers; ++i) {
- info = dtypes[i];
- if (!strncmp(handle, info->handle, sizeof(info->handle)))
- break;
- }
-
- if (i == n_drivers)
- return -ENOENT;
-
- if (info->idnum < 0)
- return -EINVAL;
-
- return info->idnum;
-}
#include "tap-ctl.h"
int
-tap_ctl_unpause(const int id, const int minor, const int type, const char *file)
+tap_ctl_unpause(const int id, const int minor, const char *params)
{
int err;
tapdisk_message_t message;
memset(&message, 0, sizeof(message));
message.type = TAPDISK_MESSAGE_RESUME;
message.cookie = minor;
- message.drivertype = type;
- if (file) {
- if (snprintf(message.u.params.path,
- sizeof(message.u.params.path) - 1, "%s", file) >=
- sizeof(message.u.params.path) - 1) {
- printf("invalid name\n");
- return ENAMETOOLONG;
- }
- }
+ if (params)
+ strncpy(message.u.params.path, params,
+ sizeof(message.u.params.path) - 1);
err = tap_ctl_connect_send_and_receive(id, &message, 15);
if (err)
tap_ctl_func_t func;
};
-static int
-tap_cli_get_driver_id(const char *handle)
-{
- int type;
-
- type = tap_ctl_get_driver_id(handle);
- if (type < 0)
- fprintf(stderr, "No such driver '%s': %d\n", handle, type);
-
- return type;
-}
-
static void
tap_cli_list_usage(FILE *stream)
{
tap_cli_list(int argc, char **argv)
{
tap_list_t **list, **_entry;
- int c, id, minor, type, err;
- const char *driver, *file;
+ int c, id, minor, err;
+ const char *type, *file;
pid_t pid;
err = tap_ctl_list(&list);
id = -1;
minor = -1;
pid = -1;
- type = -1;
- driver = NULL;
+ type = NULL;
file = NULL;
while ((c = getopt(argc, argv, "m:i:p:t:f:h")) != -1) {
pid = atoi(optarg);
break;
case 't':
- driver = optarg;
- type = tap_cli_get_driver_id(driver);
- if (type < 0)
- return -type;
+ type = optarg;
break;
case 'f':
file = optarg;
if (pid >= 0 && entry->pid != pid)
continue;
- if (driver && entry->driver && strcmp(entry->driver, driver))
+ if (type && entry->type && strcmp(entry->type, type))
continue;
if (file && entry->path && strcmp(entry->path, file))
printf("%-3s %2s %8s %4s %10s %s\n",
minor_str, id_str, pid_str, state_str,
- entry->driver ? : "-", entry->path ? : "-");
+ entry->type ? : "-", entry->path ? : "-");
}
tap_ctl_free_list(list);
static void
tap_cli_unpause_usage(FILE *stream)
{
- fprintf(stream, "usage: unpause <-i id> <-m minor> <-t type> <-f file>\n");
+ fprintf(stream, "usage: unpause <-p pid> <-m minor> [-a args]\n");
}
int
tap_cli_unpause(int argc, char **argv)
{
- char *file;
+ char *args;
int c, id, minor, type;
id = -1;
minor = -1;
- type = -1;
- file = NULL;
+ args = NULL;
optind = 0;
- while ((c = getopt(argc, argv, "i:m:t:f:h")) != -1) {
+ while ((c = getopt(argc, argv, "i:m:a:h")) != -1) {
switch (c) {
case 'i':
id = atoi(optarg);
case 'm':
minor = atoi(optarg);
break;
- case 't':
- type = atoi(optarg);
- break;
- case 'f':
- file = optarg;
+ case 'a':
+ args = optarg;
break;
case 'h':
tap_cli_unpause_usage(stdout);
}
}
- if (id == -1 || minor == -1) {
- tap_cli_unpause_usage(stderr);
- return EINVAL;
- }
+ if (id == -1 || minor == -1)
+ goto usage;
- return tap_ctl_unpause(id, minor, type, file);
+ return tap_ctl_unpause(id, minor, args);
+
+usage:
+ tap_cli_unpause_usage(stderr);
+ return EINVAL;
}
static void
static void
tap_cli_open_usage(FILE *stream)
{
- fprintf(stream, "usage: open <-t type> <-f file> <-i id> <-m minor>\n");
+ fprintf(stream, "usage: open <-i id> <-m minor> <-a args>\n");
}
static int
tap_cli_open(int argc, char **argv)
{
- const char *file;
- int c, id, minor, type;
+ const char *args;
+ int c, id, minor;
id = -1;
- type = -1;
minor = -1;
- file = NULL;
+ args = NULL;
optind = 0;
- while ((c = getopt(argc, argv, "i:m:t:f:h")) != -1) {
+ while ((c = getopt(argc, argv, "i:m:a:h")) != -1) {
switch (c) {
case 'i':
id = atoi(optarg);
case 'm':
minor = atoi(optarg);
break;
- case 't':
- type = tap_cli_get_driver_id(optarg);
- if (type < 0)
- return -type;
- break;
- case 'f':
- file = optarg;
+ case 'a':
+ args = optarg;
break;
case 'h':
tap_cli_open_usage(stdout);
}
}
- if (id == -1 || minor == -1 || type == -1 || !file)
+ if (id == -1 || minor == -1 || !args)
goto usage;
- return tap_ctl_open(id, minor, type, file);
+ return tap_ctl_open(id, minor, args);
usage:
tap_cli_open_usage(stderr);
pid_t pid;
int minor;
int state;
- const char *driver;
+ char *type;
char *path;
} tap_list_t;
int _tap_ctl_free(const int minor);
int tap_ctl_create(int argc, char **argv);
-int _tap_ctl_create(const int type, const char *name, char **devname);
+int _tap_ctl_create(const char *params, char **devname);
int tap_ctl_destroy(int argc, char **argv);
int _tap_ctl_destroy(const int id, const int minor);
int tap_ctl_detach(int argc, char **argv);
int _tap_ctl_detach(const int id, const int minor);
-int tap_ctl_open(const int id, const int minor, const int type, const char *file);
+int tap_ctl_open(const int id, const int minor, const char *params);
int tap_ctl_close(int argc, char **argv);
int _tap_ctl_close(const int id, const int minor, const int force);
int tap_ctl_pause(const int id, const int minor);
-int tap_ctl_unpause(const int id, const int minor, const int type, const char *file);
+int tap_ctl_unpause(const int id, const int minor, const char *args);
int tap_ctl_blk_major(void);
#include <sys/resource.h>
#include <xs.h>
-#include "disktypes.h"
#include "tapdisk-dispatch.h"
static inline const char*
memset(&message, 0, sizeof(tapdisk_message_t));
- len = strlen(channel->vdi_path);
-
message.type = TAPDISK_MESSAGE_OPEN;
message.cookie = channel->cookie;
- message.drivertype = channel->drivertype;
message.u.params.storage = channel->storage;
message.u.params.devnum = channel->minor;
message.u.params.domid = channel->domid;
- message.u.params.path_len = len;
- strncpy(message.u.params.path, channel->vdi_path, len);
+ snprintf(message.u.params.path, sizeof(message.u.params.path),
+ "%s:%s", channel->vdi_type, channel->vdi_path);
if (channel->mode == 'r')
message.u.params.flags |= TAPDISK_MESSAGE_FLAG_RDONLY;
memset(&message, 0, sizeof(tapdisk_message_t));
message.type = TAPDISK_MESSAGE_CLOSE;
- message.drivertype = channel->drivertype;
message.cookie = channel->cookie;
return tapdisk_channel_send_message(channel, &message, 2);
memset(&message, 0, sizeof(tapdisk_message_t));
message.type = TAPDISK_MESSAGE_FORCE_SHUTDOWN;
- message.drivertype = channel->drivertype;
message.cookie = channel->cookie;
-
+
return tapdisk_channel_send_message(channel, &message, 2);
}
memset(&message, 0, sizeof(tapdisk_message_t));
message.type = TAPDISK_MESSAGE_PID;
- message.drivertype = channel->drivertype;
message.cookie = channel->cookie;
err = tapdisk_channel_send_message(channel, &message, 2);
DPRINTF("pausing %s\n", channel->path);
message.type = TAPDISK_MESSAGE_PAUSE;
- message.drivertype = channel->drivertype;
message.cookie = channel->cookie;
return tapdisk_channel_send_message(channel, &message, 2);
DPRINTF("resuming %s\n", channel->path);
message.type = TAPDISK_MESSAGE_RESUME;
- message.drivertype = channel->drivertype;
message.cookie = channel->cookie;
- message.u.params.path_len = len;
- strncpy(message.u.params.path, channel->vdi_path, len);
+ snprintf(message.u.params.path, sizeof(message.u.params.path),
+ "%s:%s", channel->vdi_type, channel->vdi_path);
return tapdisk_channel_send_message(channel, &message, 2);
}
static int
tapdisk_channel_parse_params(tapdisk_channel_t *channel)
{
- int i, size, err;
- unsigned int len;
- char *ptr, *path, handle[10];
- char *vdi_type;
- char *vtype;
+ char *vdi_type_path;
+ char *ptr, *path;
+ size_t len;
+ int err;
path = channel->params;
- size = sizeof(dtypes) / sizeof(disk_info_t *);
-
- if (strlen(path) + 1 >= TAPDISK_MESSAGE_MAX_PATH_LENGTH)
- goto fail;
ptr = strchr(path, ':');
if (!ptr)
goto fail;
channel->vdi_path = ptr + 1;
- memcpy(handle, path, (ptr - path));
- ptr = handle + (ptr - path);
- *ptr = '\0';
+ channel->vdi_type = strndup(path, ptr - path);
- err = asprintf(&vdi_type, "%s/sm-data/vdi-type", channel->path);
+ err = asprintf(&vdi_type_path, "%s/sm-data/vdi-type", channel->path);
if (err == -1)
goto fail;
- if (xs_exists(channel->xsh, vdi_type)) {
- vtype = xs_read(channel->xsh, XBT_NULL, vdi_type, &len);
- free(vdi_type);
- if (!vtype)
- goto fail;
- if (len >= sizeof(handle) - 1) {
- free(vtype);
+ if (xs_exists(channel->xsh, vdi_type_path)) {
+ free(channel->vdi_type);
+
+ channel->vdi_type =
+ xs_read(channel->xsh, XBT_NULL, vdi_type_path, &len);
+ free(vdi_type_path);
+
+ if (!channel->vdi_type)
goto fail;
- }
- sprintf(handle, "%s", vtype);
- free(vtype);
}
- for (i = 0; i < size; i++) {
- if (strncmp(handle, dtypes[i]->handle, (ptr - path)))
- continue;
+ len = strlen(channel->vdi_type);
+ len += strlen(":");
+ len += strlen(channel->vdi_path);
- if (dtypes[i]->idnum == -1)
- goto fail;
+ if (len + 1 >= TAPDISK_MESSAGE_MAX_PATH_LENGTH)
+ goto fail;
- channel->drivertype = dtypes[i]->idnum;
- return 0;
- }
+ return 0;
fail:
EPRINTF("%s: invalid blktap params: %s\n",
channel->path, channel->params);
channel->vdi_path = NULL;
+ channel->vdi_type = NULL;
return -EINVAL;
}
#include <syslog.h>
#include <xs.h>
-#include "disktypes.h"
#include "tapdisk-dispatch.h"
#define TAPDISK_DAEMON_DOMID_WATCH "domid-watch"
DPRINTF("blktap-daemon: v1.0.2\n");
DPRINTF("Syslog facility %d\n", tapdisk_daemon_log_facility);
-
- size = sizeof(dtypes) / sizeof(disk_info_t *);
- for (i = 0; i < size; i++)
- DPRINTF("Found driver: [%s]\n", dtypes[i]->name);
}
static int
/* check if we already have a process started */
tapdisk_daemon_for_each_channel(c, tmp)
- if (c->drivertype == channel->drivertype) {
+ if (!strcmp(c->vdi_type, channel->vdi_type)) {
channel->write_fd = c->write_fd;
channel->read_fd = c->read_fd;
channel->channel_id = c->channel_id;
#include <sys/select.h>
#include "xs_api.h"
+#define TAPDISK
#include "blktaplib.h"
#include "tapdisk-message.h"
char *path;
char *frontpath;
char *params;
+ char *vdi_type;
char *vdi_path;
char *uuid_str;
char *start_str;
TAP-OBJS += tapdisk-vbd.o
TAP-OBJS += tapdisk-image.o
TAP-OBJS += tapdisk-driver.o
+TAP-OBJS += tapdisk-disktype.o
TAP-OBJS += tapdisk-interface.o
TAP-OBJS += tapdisk-server.o
TAP-OBJS += tapdisk-queue.o
#include "tapdisk.h"
#include "tapdisk-driver.h"
#include "tapdisk-interface.h"
-#include "disktypes.h"
+#include "tapdisk-disktype.h"
unsigned int SPB;
+++ /dev/null
-/*
- * Copyright (c) 2007, XenSource Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of XenSource Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __DISKTYPES_H__
-#define __DISKTYPES_H__
-
-typedef struct disk_info {
- int idnum;
- char name[50]; /* e.g. "RAMDISK" */
- char handle[10]; /* xend handle, e.g. 'ram' */
- int single_handler; /* is there a single controller for all */
- /* instances of disk type? */
-#ifdef TAPDISK
- struct tap_disk *drv;
-#endif
-} disk_info_t;
-
-extern struct tap_disk tapdisk_aio;
-/* extern struct tap_disk tapdisk_sync; */
-/* extern struct tap_disk tapdisk_vmdk; */
-/* extern struct tap_disk tapdisk_vhdsync; */
-extern struct tap_disk tapdisk_vhd;
-extern struct tap_disk tapdisk_ram;
-/* extern struct tap_disk tapdisk_qcow; */
-extern struct tap_disk tapdisk_block_cache;
-extern struct tap_disk tapdisk_vhd_index;
-extern struct tap_disk tapdisk_log;
-
-#define MAX_DISK_TYPES 20
-
-#define DISK_TYPE_AIO 0
-#define DISK_TYPE_SYNC 1
-#define DISK_TYPE_VMDK 2
-#define DISK_TYPE_VHDSYNC 3
-#define DISK_TYPE_VHD 4
-#define DISK_TYPE_RAM 5
-#define DISK_TYPE_QCOW 6
-#define DISK_TYPE_BLOCK_CACHE 7
-#define DISK_TYPE_VINDEX 8
-#define DISK_TYPE_LOG 9
-
-/*Define Individual Disk Parameters here */
-static disk_info_t null_disk = {
- -1,
- "null disk",
- "null",
- 0,
-#ifdef TAPDISK
- 0,
-#endif
-};
-
-static disk_info_t aio_disk = {
- DISK_TYPE_AIO,
- "raw image (aio)",
- "aio",
- 0,
-#ifdef TAPDISK
- &tapdisk_aio,
-#endif
-};
-/*
-static disk_info_t sync_disk = {
- DISK_TYPE_SYNC,
- "raw image (sync)",
- "sync",
- 0,
-#ifdef TAPDISK
- &tapdisk_sync,
-#endif
-};
-
-static disk_info_t vmdk_disk = {
- DISK_TYPE_VMDK,
- "vmware image (vmdk)",
- "vmdk",
- 1,
-#ifdef TAPDISK
- &tapdisk_vmdk,
-#endif
-};
-
-static disk_info_t vhdsync_disk = {
- DISK_TYPE_VHDSYNC,
- "virtual server image (vhd) - synchronous",
- "vhdsync",
- 1,
-#ifdef TAPDISK
- &tapdisk_vhdsync,
-#endif
-};
-*/
-
-static disk_info_t vhd_disk = {
- DISK_TYPE_VHD,
- "virtual server image (vhd)",
- "vhd",
- 0,
-#ifdef TAPDISK
- &tapdisk_vhd,
-#endif
-};
-
-
-static disk_info_t ram_disk = {
- DISK_TYPE_RAM,
- "ramdisk image (ram)",
- "ram",
- 1,
-#ifdef TAPDISK
- &tapdisk_ram,
-#endif
-};
-
-
-/*
-static disk_info_t qcow_disk = {
- DISK_TYPE_QCOW,
- "qcow disk (qcow)",
- "qcow",
- 0,
-#ifdef TAPDISK
- &tapdisk_qcow,
-#endif
-};
-*/
-
-static disk_info_t block_cache_disk = {
- DISK_TYPE_BLOCK_CACHE,
- "block cache image (bc)",
- "bc",
- 1,
-#ifdef TAPDISK
- &tapdisk_block_cache,
-#endif
-};
-
-static disk_info_t vhd_index_disk = {
- DISK_TYPE_VINDEX,
- "vhd index image (vhdi)",
- "vhdi",
- 1,
-#ifdef TAPDISK
- &tapdisk_vhd_index,
-#endif
-};
-
-static disk_info_t log_disk = {
- DISK_TYPE_LOG,
- "write logger (log)",
- "log",
- 0,
-#ifdef TAPDISK
- &tapdisk_log,
-#endif
-};
-
-/*Main disk info array */
-static disk_info_t *dtypes[] = {
- &aio_disk,
- &null_disk, /* &sync_disk, */
- &null_disk, /* &vmdk_disk, */
- &null_disk, /* &vhdsync_disk, */
- &vhd_disk,
- &ram_disk,
- &null_disk, /* &qcow_disk, */
- &block_cache_disk,
- &vhd_index_disk,
- &log_disk,
-};
-
-#endif
#include "tapdisk-utils.h"
#include "tapdisk-server.h"
#include "tapdisk-message.h"
+#include "tapdisk-disktype.h"
struct tapdisk_control {
char *path;
count++;
list_for_each_entry(vbd, head, next) {
- response.drivertype = vbd->type;
response.u.list.count = count--;
response.u.list.minor = vbd->minor;
response.u.list.state = vbd->state;
response.u.list.path[0] = 0;
if (vbd->name)
- strncpy(response.u.list.path, vbd->name,
- sizeof(response.u.list.path));
+ snprintf(response.u.list.path,
+ sizeof(response.u.list.path),
+ "%s:%s",
+ tapdisk_disk_types[vbd->type]->name,
+ vbd->name);
tapdisk_control_write_message(connection->socket, &response, 2);
}
goto out;
}
+ if (vbd->name) {
+ err = -EBUSY;
+ goto out;
+ }
+
tapdisk_vbd_detach(vbd);
if (list_empty(&vbd->images)) {
tapdisk_control_open_image(struct tapdisk_control_connection *connection,
tapdisk_message_t *request)
{
- int err;
+ int err, type;
image_t image;
td_vbd_t *vbd;
td_flag_t flags;
tapdisk_message_t response;
struct blktap2_params params;
+ const char *path;
vbd = tapdisk_server_get_vbd(request->cookie);
if (!vbd) {
if (request->u.params.flags & TAPDISK_MESSAGE_FLAG_LOG_DIRTY)
flags |= TD_OPEN_LOG_DIRTY;
+ type = tapdisk_disktype_parse_params(request->u.params.path, &path);
+ if (type < 0) {
+ err = type;
+ goto out;
+ }
+
err = tapdisk_vbd_open_vdi(vbd,
- request->u.params.path,
- request->drivertype,
+ type, path,
request->u.params.storage,
flags);
if (err)
int err;
td_vbd_t *vbd;
tapdisk_message_t response;
- const char *path;
- uint16_t type;
+ const char *path = NULL;
+ int type = -1;
size_t len;
memset(&response, 0, sizeof(response));
}
len = strnlen(request->u.params.path, sizeof(request->u.params.path));
- if (len)
- path = request->u.params.path;
- else
- path = NULL;
+ if (len) {
+ type = tapdisk_disktype_parse_params(request->u.params.path, &path);
+ if (type < 0) {
+ err = type;
+ goto out;
+ }
+ }
- err = tapdisk_vbd_resume(vbd, path, request->drivertype);
+ err = tapdisk_vbd_resume(vbd, type, path);
out:
response.cookie = request->cookie;
#include "scheduler.h"
#include "tapdisk-vbd.h"
#include "tapdisk-server.h"
+#include "tapdisk-disktype.h"
#include "libvhd.h"
-#include "disktypes.h"
#define POLL_READ 0
#define POLL_WRITE 1
tapdisk_vbd_set_callback(s->vbd, tapdisk_stream_dequeue, s);
- err = tapdisk_vbd_open_vdi(s->vbd, path, type,
+ err = tapdisk_vbd_open_vdi(s->vbd, type, path,
TAPDISK_STORAGE_TYPE_DEFAULT,
TD_OPEN_RDONLY);
if (err)
tapdisk_stream_open(struct tapdisk_stream *s, const char *arg)
{
int err, type;
- char *path;
+ const char *path;
- err = tapdisk_parse_disk_type(arg, &path, &type);
- if (err)
- return err;
+ type = tapdisk_disktype_parse_params(arg, &path);
+ if (type < 0)
+ return type;
tapdisk_stream_initialize(s);
{
int c, err, type1;
const char *arg1 = NULL, *arg2 = NULL;
- char *path1;
+ const disk_info_t *info;
+ const char *path1;
err = 0;
if (!arg1 || !arg2)
goto fail_usage;
- err = tapdisk_parse_disk_type(arg1, &path1, &type1);
- if (err)
- return err;
+ type1 = tapdisk_disktype_parse_params(arg1, &path1);
+ if (type1 < 0)
+ return type1;
+
if (type1 != DISK_TYPE_VHD) {
printf("error: first VDI is not VHD\n");
return EINVAL;
--- /dev/null
+/*
+ * Copyright (c) 2007, 2010, XenSource Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of XenSource Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stddef.h>
+#include <string.h>
+#include <errno.h>
+
+#include "tapdisk-disktype.h"
+
+static const disk_info_t aio_disk = {
+ "aio",
+ "raw image (aio)",
+ 0,
+};
+
+static const disk_info_t sync_disk = {
+ "sync",
+ "raw image (sync)",
+ 0,
+};
+
+static const disk_info_t vmdk_disk = {
+ "vmdk",
+ "vmware image (vmdk)",
+ 1,
+};
+
+static const disk_info_t vhdsync_disk = {
+ "vhdsync",
+ "virtual server image (vhd) - synchronous",
+ 1,
+};
+
+static const disk_info_t vhd_disk = {
+ "vhd",
+ "virtual server image (vhd)",
+ 0,
+};
+
+
+static const disk_info_t ram_disk = {
+ "ram",
+ "ramdisk image (ram)",
+ 1,
+};
+
+static const disk_info_t qcow_disk = {
+ "qcow",
+ "qcow disk (qcow)",
+ 0,
+};
+
+static const disk_info_t block_cache_disk = {
+ "bc",
+ "block cache image (bc)",
+ 1,
+};
+
+static const disk_info_t vhd_index_disk = {
+ "vhdi",
+ "vhd index image (vhdi)",
+ 1,
+};
+
+static const disk_info_t log_disk = {
+ "log",
+ "write logger (log)",
+ 0,
+};
+
+const disk_info_t *tapdisk_disk_types[] = {
+ [DISK_TYPE_AIO] = &aio_disk,
+ [DISK_TYPE_SYNC] = &sync_disk,
+ [DISK_TYPE_VMDK] = &vmdk_disk,
+ [DISK_TYPE_VHDSYNC] = &vhdsync_disk,
+ [DISK_TYPE_VHD] = &vhd_disk,
+ [DISK_TYPE_RAM] = &ram_disk,
+ [DISK_TYPE_QCOW] = &qcow_disk,
+ [DISK_TYPE_BLOCK_CACHE] = &block_cache_disk,
+ [DISK_TYPE_VINDEX] = &vhd_index_disk,
+ [DISK_TYPE_LOG] = &log_disk,
+ 0,
+};
+
+extern struct tap_disk tapdisk_aio;
+#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;
+#if 0
+extern struct tap_disk tapdisk_qcow;
+#endif
+extern struct tap_disk tapdisk_block_cache;
+extern struct tap_disk tapdisk_vhd_index;
+extern struct tap_disk tapdisk_log;
+
+const struct tap_disk *tapdisk_disk_drivers[] = {
+ [DISK_TYPE_AIO] = &tapdisk_aio,
+#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,
+#if 0
+ [DISK_TYPE_QCOW] = &tapdisk_qcow,
+#endif
+ [DISK_TYPE_BLOCK_CACHE] = &tapdisk_block_cache,
+ [DISK_TYPE_VINDEX] = &tapdisk_vhd_index,
+ [DISK_TYPE_LOG] = &tapdisk_log,
+ 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) {
+ if (strcmp(name, info->name))
+ continue;
+
+ if (!tapdisk_disk_drivers[i])
+ return -ENOSYS;
+
+ return i;
+ }
+
+ return -ENOENT;
+}
+
+int
+tapdisk_disktype_parse_params(const char *params, const char **_path)
+{
+ char name[DISK_TYPE_NAME_MAX], *ptr;
+ size_t len;
+ int type;
+
+ ptr = strchr(params, ':');
+ if (!ptr)
+ return -EINVAL;
+
+ len = ptr - params;
+
+ if (len > sizeof(name) - 1)
+ return -ENAMETOOLONG;
+
+ memset(name, 0, sizeof(name));
+ strncpy(name, params, len);
+
+ type = tapdisk_disktype_find(name);
+
+ if (type >= 0)
+ *_path = params + len + 1;
+
+ return type;
+}
--- /dev/null
+/*
+ * Copyright (c) 2007, 2010, XenSource Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of XenSource Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __DISKTYPES_H__
+#define __DISKTYPES_H__
+
+#define DISK_TYPE_AIO 0
+#define DISK_TYPE_SYNC 1
+#define DISK_TYPE_VMDK 2
+#define DISK_TYPE_VHDSYNC 3
+#define DISK_TYPE_VHD 4
+#define DISK_TYPE_RAM 5
+#define DISK_TYPE_QCOW 6
+#define DISK_TYPE_BLOCK_CACHE 7
+#define DISK_TYPE_VINDEX 8
+#define DISK_TYPE_LOG 9
+#define DISK_TYPE_REMUS 10
+
+#define DISK_TYPE_NAME_MAX 32
+
+typedef struct disk_info {
+ const char *name; /* driver name, e.g. 'aio' */
+ char *desc; /* e.g. "raw image" */
+ unsigned int flags;
+} disk_info_t;
+
+extern const disk_info_t *tapdisk_disk_types[];
+extern const struct tap_disk *tapdisk_disk_drivers[];
+
+/* one single controller for all instances of disk type */
+#define DISK_TYPE_SINGLE_CONTROLLER (1<<0)
+
+int tapdisk_disktype_find(const char *name);
+int tapdisk_disktype_parse_params(const char *params, const char **_path);
+
+#endif
#include "tapdisk-driver.h"
#include "tapdisk-server.h"
+#include "tapdisk-disktype.h"
td_driver_t *
tapdisk_driver_allocate(int type, char *name, td_flag_t flags, int storage)
{
int err;
td_driver_t *driver;
- struct tap_disk *ops;
+ const struct tap_disk *ops;
- ops = tapdisk_server_find_driver_interface(type);
+ ops = tapdisk_disk_drivers[type];
if (!ops)
return NULL;
td_disk_info_t info;
void *data;
- struct tap_disk *ops;
+ const struct tap_disk *ops;
struct list_head next;
};
#include "tapdisk-ipc.h"
#include "tapdisk-vbd.h"
#include "tapdisk-server.h"
+#include "tapdisk-disktype.h"
static void
tapdisk_ipc_read_event(event_id_t id, char mode, void *private)
image_t image;
char *devname;
td_flag_t flags;
+ int type;
+ const char *path;
flags = 0;
if (err == -1)
goto fail;
+ type = tapdisk_disktype_parse_params(message.u.params.path, &path);
+ if (type < 0) {
+ err = type;
+ goto fail;
+ }
+
err = tapdisk_vbd_open(vbd,
- message.u.params.path,
- message.drivertype,
+ type, path,
message.u.params.storage,
message.u.params.devnum,
devname, flags);
tapdisk_vbd_pause(vbd);
return 0; /* response written asynchronously */
- case TAPDISK_MESSAGE_RESUME:
- tapdisk_vbd_resume(vbd,
- message.u.params.path,
- message.drivertype);
- return 0; /* response written asynchronously */
+ case TAPDISK_MESSAGE_RESUME: {
+ int type;
+ const char *path;
+ type = tapdisk_disktype_parse_params(message.u.params.path, &path);
+ if (type < 0)
+ return type;
+
+ tapdisk_vbd_resume(vbd, type, path);
+ return 0; /* response written asynchronously */
+ }
case TAPDISK_MESSAGE_CLOSE:
tapdisk_vbd_close(vbd);
return 0; /* response written asynchronously */
#include <sys/ioctl.h>
#include <sys/signal.h>
-#define TAPDISK
#include "tapdisk-syslog.h"
#include "tapdisk-server.h"
#include "tapdisk-driver.h"
#include "tapdisk-interface.h"
#include "tapdisk-log.h"
-#include "disktypes.h"
#define DBG(_level, _f, _a...) tlog_write(_level, _f, ##_a)
#define ERR(_err, _f, _a...) tlog_error(_err, _f, ##_a)
#define tapdisk_server_for_each_vbd(vbd, tmp) \
list_for_each_entry_safe(vbd, tmp, &server.vbds, next)
-struct tap_disk *
-tapdisk_server_find_driver_interface(int type)
-{
- int n;
-
- n = sizeof(dtypes) / sizeof(struct disk_info_t *);
- if (type > n)
- return NULL;
-
- return dtypes[type]->drv;
-}
-
td_image_t *
tapdisk_server_get_shared_image(td_image_t *image)
{
#include "scheduler.h"
#include "tapdisk-vbd.h"
#include "tapdisk-server.h"
+#include "tapdisk-disktype.h"
#define POLL_READ 0
#define POLL_WRITE 1
tapdisk_vbd_set_callback(s->vbd, tapdisk_stream_dequeue, s);
- err = tapdisk_vbd_open_vdi(s->vbd, path, type,
+ err = tapdisk_vbd_open_vdi(s->vbd, type, path,
TAPDISK_STORAGE_TYPE_DEFAULT,
TD_OPEN_RDONLY);
if (err)
main(int argc, char *argv[])
{
int c, err, type;
- char *params, *path;
+ const char *params;
+ const disk_info_t *info;
+ const char *path;
uint64_t count, skip;
struct tapdisk_stream stream;
if (!params)
usage(argv[0], EINVAL);
- err = tapdisk_parse_disk_type(params, &path, &type);
- if (err) {
+ type = tapdisk_disktype_parse_params(params, &path);
+ if (type < 0) {
+ err = type;
fprintf(stderr, "invalid argument %s: %d\n", params, err);
return err;
}
#include <syslog.h>
#include "tapdisk.h"
-#include "disktypes.h"
#include "blktaplib.h"
#include "tapdisk-log.h"
#include "tapdisk-utils.h"
return 0;
}
-int
-tapdisk_parse_disk_type(const char *params, char **_path, int *_type)
-{
- int i, err, size;
- char *ptr, *path, handle[10];
-
- if (strlen(params) + 1 >= MAX_NAME_LEN)
- return -ENAMETOOLONG;
-
- ptr = strchr(params, ':');
- if (!ptr)
- return -EINVAL;
-
- path = ptr + 1;
- memcpy(handle, params, (ptr - params));
- handle[(ptr - params)] = '\0';
-
- size = sizeof(dtypes) / sizeof(disk_info_t *);
- for (i = 0; i < size; i++) {
- if (strncmp(handle, dtypes[i]->handle, (ptr - params)))
- continue;
-
- if (dtypes[i]->idnum == -1)
- return -ENODEV;
-
- *_type = dtypes[i]->idnum;
- *_path = path;
-
- return 0;
- }
-
- return -ENODEV;
-}
-
/*Get Image size, secsize*/
int
tapdisk_get_image_size(int fd, uint64_t *_sectors, uint32_t *_sector_size)
#include "tapdisk-image.h"
#include "tapdisk-driver.h"
#include "tapdisk-server.h"
+#include "tapdisk-vbd.h"
+#include "tapdisk-disktype.h"
#include "tapdisk-interface.h"
#include "blktap2.h"
-#include "disktypes.h"
#define DBG(_level, _f, _a...) tlog_write(_level, _f, ##_a)
#define ERR(_err, _f, _a...) tlog_error(_err, _f, ##_a)
}
int
-tapdisk_vbd_open_vdi(td_vbd_t *vbd, const char *path,
- uint16_t drivertype, uint16_t storage, td_flag_t flags)
+tapdisk_vbd_open_vdi(td_vbd_t *vbd, int type, const char *path,
+ uint16_t storage, td_flag_t flags)
{
+ const disk_info_t *info;
int i, err;
- struct tap_disk *ops;
- ops = tapdisk_server_find_driver_interface(drivertype);
- if (!ops)
+ info = tapdisk_disk_types[type];
+ if (!info)
return -EINVAL;
- DPRINTF("Loaded %s driver for vbd %u %s 0x%08x\n",
- ops->disk_type, vbd->uuid, path, flags);
+
+ DPRINTF("Loading driver '%s' for vbd %u %s 0x%08x\n",
+ info->name, vbd->uuid, path, flags);
err = tapdisk_namedup(&vbd->name, path);
if (err)
vbd->flags = flags;
vbd->storage = storage;
- vbd->type = drivertype;
+ vbd->type = type;
for (i = 0; i < TD_VBD_EIO_RETRIES; i++) {
err = __tapdisk_vbd_open_vdi(vbd, 0);
}
int
-tapdisk_vbd_open(td_vbd_t *vbd, const char *name, uint16_t type,
+tapdisk_vbd_open(td_vbd_t *vbd, int type, const char *path,
uint16_t storage, int minor, const char *ring, td_flag_t flags)
{
int err;
- err = tapdisk_vbd_open_vdi(vbd, name, type, storage, flags);
+ err = tapdisk_vbd_open_vdi(vbd, type, path, storage, flags);
if (err)
goto out;
}
int
-tapdisk_vbd_resume(td_vbd_t *vbd, const char *path, uint16_t drivertype)
+tapdisk_vbd_resume(td_vbd_t *vbd, int type, const char *path)
{
int i, err;
tapdisk_ipc_write(&vbd->ipc, TAPDISK_MESSAGE_ERROR);
return -EINVAL;
}
- vbd->type = drivertype;
+ vbd->type = type;
}
for (i = 0; i < TD_VBD_EIO_RETRIES; i++) {
tapdisk_vbd_resume_ring(td_vbd_t *vbd)
{
int i, err, type;
- char *path, message[BLKTAP2_MAX_MESSAGE_LEN];
+ char message[BLKTAP2_MAX_MESSAGE_LEN];
+ const char *path;
memset(message, 0, sizeof(message));
return err;
}
- err = tapdisk_parse_disk_type(message, &path, &type);
- if (err) {
+ type = tapdisk_disktype_parse_params(message, &path);
+ if (type < 0) {
+ err = type;
EPRINTF("%s: invalid resume string %s\n", vbd->name, message);
goto out;
}
td_vbd_t *tapdisk_vbd_create(td_uuid_t);
int tapdisk_vbd_initialize(int, int, td_uuid_t);
void tapdisk_vbd_set_callback(td_vbd_t *, td_vbd_cb_t, void *);
-int tapdisk_vbd_open(td_vbd_t *, const char *, uint16_t,
+int tapdisk_vbd_open(td_vbd_t *, int, const char *,
uint16_t, int, const char *, td_flag_t);
int tapdisk_vbd_close(td_vbd_t *);
-int tapdisk_vbd_open_vdi(td_vbd_t *, const char *,
- uint16_t, uint16_t, td_flag_t);
+int tapdisk_vbd_open_vdi(td_vbd_t *, int, const char *, uint16_t, td_flag_t);
void tapdisk_vbd_close_vdi(td_vbd_t *);
int tapdisk_vbd_attach(td_vbd_t *, const char *, int);
int tapdisk_vbd_issue_requests(td_vbd_t *);
int tapdisk_vbd_kill_queue(td_vbd_t *);
int tapdisk_vbd_pause(td_vbd_t *);
-int tapdisk_vbd_resume(td_vbd_t *, const char *, uint16_t);
+int tapdisk_vbd_resume(td_vbd_t *, int, const char *);
int tapdisk_vbd_kick(td_vbd_t *);
void tapdisk_vbd_check_state(td_vbd_t *);
void tapdisk_vbd_check_progress(td_vbd_t *);
struct tapdisk_message {
uint16_t type;
uint16_t cookie;
- uint16_t drivertype;
union {
pid_t tapdisk_pid;