From 1050ef9e6963cf336591b7243d0ff84cb2de1257 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 8 Jun 2010 08:01:50 +0100 Subject: [PATCH] blktap2: Remove tapdisk-ipc module. Obsoleted with blktapctrl. Signed-off-by: Jake Wires Signed-off-by: Daniel Stodden --- tools/blktap2/drivers/Makefile | 1 - tools/blktap2/drivers/img2qcow.c | 4 +- tools/blktap2/drivers/qcow2raw.c | 6 +- tools/blktap2/drivers/tapdisk-diff.c | 4 +- tools/blktap2/drivers/tapdisk-ipc.c | 353 ------------------------- tools/blktap2/drivers/tapdisk-ipc.h | 47 ---- tools/blktap2/drivers/tapdisk-server.c | 35 +-- tools/blktap2/drivers/tapdisk-server.h | 3 +- tools/blktap2/drivers/tapdisk-stream.c | 4 +- tools/blktap2/drivers/tapdisk-vbd.c | 14 +- tools/blktap2/drivers/tapdisk-vbd.h | 5 +- tools/blktap2/drivers/tapdisk2.c | 4 +- 12 files changed, 17 insertions(+), 463 deletions(-) delete mode 100644 tools/blktap2/drivers/tapdisk-ipc.c delete mode 100644 tools/blktap2/drivers/tapdisk-ipc.h diff --git a/tools/blktap2/drivers/Makefile b/tools/blktap2/drivers/Makefile index a123b3d71a..56ddfd94d3 100644 --- a/tools/blktap2/drivers/Makefile +++ b/tools/blktap2/drivers/Makefile @@ -62,7 +62,6 @@ PORTABLE-OBJS-$(CONFIG_Linux) += blk_linux.o PORTABLE-OBJS-$(CONFIG_NetBSD) += blk_netbsd.o TAP-OBJS-y := scheduler.o -TAP-OBJS-y += tapdisk-ipc.o TAP-OBJS-y += tapdisk-vbd.o TAP-OBJS-y += tapdisk-image.o TAP-OBJS-y += tapdisk-driver.o diff --git a/tools/blktap2/drivers/img2qcow.c b/tools/blktap2/drivers/img2qcow.c index 455f0eb053..08f3335dbb 100644 --- a/tools/blktap2/drivers/img2qcow.c +++ b/tools/blktap2/drivers/img2qcow.c @@ -200,13 +200,13 @@ int main(int argc, const char *argv[]) (uint64_t)info.size); /* Open Qcow image*/ - err = tapdisk_server_initialize(NULL, NULL); + err = tapdisk_server_initialize(); if( err ) { DPRINTF("qcow2raw Couldn't initialize server instance.\n"); return err; } - err=tapdisk_vbd_initialize(-1,-1, QCOW_VBD); + err=tapdisk_vbd_initialize(QCOW_VBD); if( err ) { DPRINTF("qcow2raw Couldn't initialize qcow vbd.\n"); return err; diff --git a/tools/blktap2/drivers/qcow2raw.c b/tools/blktap2/drivers/qcow2raw.c index 45f20ade19..e581b1e40e 100644 --- a/tools/blktap2/drivers/qcow2raw.c +++ b/tools/blktap2/drivers/qcow2raw.c @@ -217,13 +217,13 @@ int main(int argc, const char *argv[]) exit(-1); } - err = tapdisk_server_initialize(NULL, NULL); + err = tapdisk_server_initialize(); if( err ) { DPRINTF("qcow2raw Couldn't initialize server instance.\n"); return err; } - err=tapdisk_vbd_initialize(-1,-1, QCOW_VBD); + err=tapdisk_vbd_initialize(QCOW_VBD); if( err ) { DPRINTF("qcow2raw Couldn't initialize qcow vbd.\n"); return err; @@ -335,7 +335,7 @@ int main(int argc, const char *argv[]) } //Now the output file should be there, reopen it as an aio VBD - err=tapdisk_vbd_initialize(-1,-1, AIO_VBD); + err=tapdisk_vbd_initialize(AIO_VBD); if( err ) { DPRINTF("qcow2raw Couldn't initialize aio vbd.\n"); return err; diff --git a/tools/blktap2/drivers/tapdisk-diff.c b/tools/blktap2/drivers/tapdisk-diff.c index 0a36c430d4..2c4994888d 100644 --- a/tools/blktap2/drivers/tapdisk-diff.c +++ b/tools/blktap2/drivers/tapdisk-diff.c @@ -540,7 +540,7 @@ tapdisk_stream_open_image(struct tapdisk_stream *s, const char *path, int type) s->id = tapdisk_stream_count++; - err = tapdisk_vbd_initialize(-1, -1, s->id); + err = tapdisk_vbd_initialize(s->id); if (err) goto out; @@ -755,7 +755,7 @@ main(int argc, char *argv[]) tapdisk_start_logging("tapdisk-diff"); - err = tapdisk_server_initialize(NULL, NULL); + err = tapdisk_server_initialize(); if (err) goto out; diff --git a/tools/blktap2/drivers/tapdisk-ipc.c b/tools/blktap2/drivers/tapdisk-ipc.c deleted file mode 100644 index 988e1c2c8f..0000000000 --- a/tools/blktap2/drivers/tapdisk-ipc.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Copyright (c) 2008, 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 -#include -#include -#include -#include -#include - -#include "tapdisk.h" -#include "tapdisk-ipc.h" -#include "tapdisk-vbd.h" -#include "tapdisk-server.h" - -static void -tapdisk_ipc_read_event(event_id_t id, char mode, void *private) -{ - td_ipc_t *ipc = private; - tapdisk_ipc_read(ipc); -} - -static void -__tapdisk_ipc_init(td_ipc_t *ipc) -{ - ipc->rfd = -1; - ipc->wfd = -1; - ipc->rfd_event = -1; -} - -int -tapdisk_ipc_open(td_ipc_t *ipc, const char *read, const char *write) -{ - int err; - - memset(ipc, 0, sizeof(td_ipc_t)); - __tapdisk_ipc_init(ipc); - - if (read) { - ipc->rfd = open(read, O_RDWR | O_NONBLOCK); - if (ipc->rfd < 0) { - err = -errno; - EPRINTF("FD open failed %s: %d\n", read, err); - goto fail; - } - - ipc->rfd_event = - tapdisk_server_register_event(SCHEDULER_POLL_READ_FD, - ipc->rfd, 0, - tapdisk_ipc_read_event, - ipc); - if (ipc->rfd_event < 0) { - err = ipc->rfd_event; - goto fail; - } - } - - if (write) { - ipc->wfd = open(write, O_RDWR | O_NONBLOCK); - if (ipc->wfd < 0) { - err = -errno; - EPRINTF("FD open failed %s, %d\n", write, err); - goto fail; - } - } - - return 0; - -fail: - tapdisk_ipc_close(ipc); - return err; -} - -void -tapdisk_ipc_close(td_ipc_t *ipc) -{ - if (ipc->rfd > 0) - close(ipc->rfd); - - if (ipc->wfd > 0) - close(ipc->wfd); - - if (ipc->rfd_event >= 0) - tapdisk_server_unregister_event(ipc->rfd_event); - - __tapdisk_ipc_init(ipc); -} - -static int -tapdisk_ipc_write_message(int fd, tapdisk_message_t *message, int timeout) -{ - fd_set writefds; - int ret, len, offset; - struct timeval tv, *t; - - t = NULL; - offset = 0; - len = sizeof(tapdisk_message_t); - - if (timeout) { - tv.tv_sec = timeout; - tv.tv_usec = 0; - t = &tv; - } - - DPRINTF("sending '%s' message (uuid = %u)\n", - tapdisk_message_name(message->type), message->cookie); - - while (offset < len) { - FD_ZERO(&writefds); - FD_SET(fd, &writefds); - - /* we don't bother reinitializing tv. at worst, it will wait a - * bit more time than expected. */ - - ret = select(fd + 1, NULL, &writefds, NULL, t); - if (ret == -1) - break; - else if (FD_ISSET(fd, &writefds)) { - ret = write(fd, message + offset, len - offset); - if (ret <= 0) - break; - offset += ret; - } else - break; - } - - if (offset != len) { - EPRINTF("failure writing message\n"); - return -EIO; - } - - return 0; -} - -int -tapdisk_ipc_write(td_ipc_t *ipc, int type) -{ - tapdisk_message_t message; - - if (ipc->wfd == -1) - return 0; - - memset(&message, 0, sizeof(tapdisk_message_t)); - message.type = type; - message.cookie = ipc->uuid; - - return tapdisk_ipc_write_message(ipc->wfd, &message, 2); -} - -int -tapdisk_ipc_write_error(td_ipc_t *ipc, const char *text) -{ - tapdisk_message_t message; - - memset(&message, 0, sizeof(message)); - message.type = TAPDISK_MESSAGE_RUNTIME_ERROR; - message.cookie = ipc->uuid; - snprintf(message.u.string.text, sizeof(message.u.string.text), "%s", text); - - return tapdisk_ipc_write_message(ipc->wfd, &message, 2); -} - -static int -tapdisk_ipc_read_message(int fd, tapdisk_message_t *message, int timeout) -{ - fd_set readfds; - int ret, len, offset; - struct timeval tv, *t; - - t = NULL; - offset = 0; - len = sizeof(tapdisk_message_t); - - if (timeout) { - tv.tv_sec = timeout; - tv.tv_usec = 0; - t = &tv; - } - - memset(message, 0, sizeof(tapdisk_message_t)); - - while (offset < len) { - FD_ZERO(&readfds); - FD_SET(fd, &readfds); - - /* we don't bother reinitializing tv. at worst, it will wait a - * bit more time than expected. */ - - ret = select(fd + 1, &readfds, NULL, NULL, t); - if (ret == -1) - break; - else if (FD_ISSET(fd, &readfds)) { - ret = read(fd, message + offset, len - offset); - if (ret <= 0) - break; - offset += ret; - } else - break; - } - - if (offset != len) { - EPRINTF("failure reading message\n"); - return -EIO; - } - - DPRINTF("received '%s' message (uuid = %u)\n", - tapdisk_message_name(message->type), message->cookie); - - return 0; -} - -int -tapdisk_ipc_read(td_ipc_t *ipc) -{ - int err; - td_vbd_t *vbd; - td_uuid_t uuid; - tapdisk_message_t message; - - err = tapdisk_ipc_read_message(ipc->rfd, &message, 2); - if (err) { - tapdisk_server_check_state(); - return err; - } - - uuid = message.cookie; - vbd = tapdisk_server_get_vbd(uuid); - - if (!vbd && message.type != TAPDISK_MESSAGE_PID) { - EPRINTF("received message for non-existing vbd: %u\n", uuid); - err = -EINVAL; - goto fail; - } - - switch (message.type) { - case TAPDISK_MESSAGE_PID: - err = tapdisk_vbd_initialize(ipc->rfd, ipc->wfd, uuid); - - memset(&message, 0, sizeof(tapdisk_message_t)); - message.cookie = uuid; - - if (!err) { - message.type = TAPDISK_MESSAGE_PID_RSP; - message.u.tapdisk_pid = getpid(); - } else - message.type = TAPDISK_MESSAGE_ERROR; - - return tapdisk_ipc_write_message(ipc->wfd, &message, 0); - - case TAPDISK_MESSAGE_OPEN: - { - image_t image; - char *devname; - td_flag_t flags; - - flags = 0; - - if (message.u.params.flags & TAPDISK_MESSAGE_FLAG_RDONLY) - flags |= TD_OPEN_RDONLY; - if (message.u.params.flags & TAPDISK_MESSAGE_FLAG_SHARED) - flags |= TD_OPEN_SHAREABLE; - if (message.u.params.flags & TAPDISK_MESSAGE_FLAG_ADD_CACHE) - flags |= TD_OPEN_ADD_CACHE; - if (message.u.params.flags & TAPDISK_MESSAGE_FLAG_VHD_INDEX) - flags |= TD_OPEN_VHD_INDEX; - if (message.u.params.flags & TAPDISK_MESSAGE_FLAG_LOG_DIRTY) - flags |= TD_OPEN_LOG_DIRTY; - - err = asprintf(&devname, "%s/%s%d", - BLKTAP_DEV_DIR, BLKTAP_DEV_NAME, - message.u.params.devnum); - if (err == -1) - goto fail; - - err = tapdisk_vbd_open(vbd, - message.u.params.path, - message.drivertype, - message.u.params.storage, - devname, flags); - free(devname); - if (err) - goto fail; - - err = tapdisk_vbd_get_image_info(vbd, &image); - if (err) - goto fail; - - memset(&message, 0, sizeof(tapdisk_message_t)); - message.cookie = uuid; - message.u.image.sectors = image.size; - message.u.image.sector_size = image.secsize; - message.u.image.info = image.info; - message.type = TAPDISK_MESSAGE_OPEN_RSP; - - return tapdisk_ipc_write_message(ipc->wfd, &message, 0); - } - - case TAPDISK_MESSAGE_PAUSE: - 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_CLOSE: - tapdisk_vbd_close(vbd); - return 0; /* response written asynchronously */ - - case TAPDISK_MESSAGE_EXIT: - return 0; - } - - err = -EINVAL; - EPRINTF("received unrecognized message %s, uuid = %d\n", - tapdisk_message_name(message.type), uuid); - -fail: - memset(&message, 0, sizeof(tapdisk_message_t)); - message.cookie = uuid; - message.type = TAPDISK_MESSAGE_ERROR; - tapdisk_ipc_write_message(ipc->wfd, &message, 2); - tapdisk_server_check_state(); - - return -err; -} diff --git a/tools/blktap2/drivers/tapdisk-ipc.h b/tools/blktap2/drivers/tapdisk-ipc.h deleted file mode 100644 index c213d17795..0000000000 --- a/tools/blktap2/drivers/tapdisk-ipc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2008, 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 _TAPDISK_IPC_H_ -#define _TAPDISK_IPC_H_ - -#include "tapdisk-message.h" -#include "scheduler.h" - -typedef struct td_ipc_handle { - int rfd; - int wfd; - event_id_t rfd_event; - td_uuid_t uuid; -} td_ipc_t; - -int tapdisk_ipc_open(td_ipc_t *ipc, const char *read, const char *write); -void tapdisk_ipc_close(td_ipc_t *ipc); -int tapdisk_ipc_read(td_ipc_t *ipc); -int tapdisk_ipc_write(td_ipc_t *ipc, int type); -int tapdisk_ipc_write_error(td_ipc_t *ipc, const char *message); - -#endif diff --git a/tools/blktap2/drivers/tapdisk-server.c b/tools/blktap2/drivers/tapdisk-server.c index 32cf4d3591..869fa239a1 100644 --- a/tools/blktap2/drivers/tapdisk-server.c +++ b/tools/blktap2/drivers/tapdisk-server.c @@ -212,27 +212,6 @@ tapdisk_server_stop_vbds(void) tapdisk_vbd_kill_queue(vbd); } -static void -tapdisk_server_send_error(const char *message) -{ - td_vbd_t *vbd, *tmp; - - tapdisk_server_for_each_vbd(vbd, tmp) - tapdisk_ipc_write_error(&vbd->ipc, message); -} - -static int -tapdisk_server_init_ipc(const char *read, const char *write) -{ - return tapdisk_ipc_open(&server.ipc, read, write); -} - -static void -tapdisk_server_close_ipc(void) -{ - tapdisk_ipc_close(&server.ipc); -} - static int tapdisk_server_init_aio(void) { @@ -250,7 +229,6 @@ static void tapdisk_server_close(void) { tapdisk_server_close_aio(); - tapdisk_server_close_ipc(); } static void @@ -292,7 +270,6 @@ tapdisk_server_signal_handler(int signal) if (xfsz_error_sent) break; - tapdisk_server_send_error("received SIGXFSZ, closing queues"); xfsz_error_sent = 1; break; @@ -303,7 +280,7 @@ tapdisk_server_signal_handler(int signal) } int -tapdisk_server_initialize(const char *read, const char *write) +tapdisk_server_initialize(void) { int err; @@ -312,21 +289,13 @@ tapdisk_server_initialize(const char *read, const char *write) scheduler_initialize(&server.scheduler); - err = tapdisk_server_init_ipc(read, write); - if (err) - goto fail; - err = tapdisk_server_init_aio(); if (err) - goto fail; + return err; server.run = 1; return 0; - -fail: - tapdisk_server_close_ipc(); - return err; } int diff --git a/tools/blktap2/drivers/tapdisk-server.h b/tools/blktap2/drivers/tapdisk-server.h index 53a9f82858..f401b049b2 100644 --- a/tools/blktap2/drivers/tapdisk-server.h +++ b/tools/blktap2/drivers/tapdisk-server.h @@ -47,14 +47,13 @@ event_id_t tapdisk_server_register_event(char, int, int, event_cb_t, void *); void tapdisk_server_unregister_event(event_id_t); void tapdisk_server_set_max_timeout(int); -int tapdisk_server_initialize(const char *, const char *); +int tapdisk_server_initialize(void); int tapdisk_server_run(void); #define TAPDISK_TIOCBS (TAPDISK_DATA_REQUESTS + 50) typedef struct tapdisk_server { int run; - td_ipc_t ipc; struct list_head vbds; scheduler_t scheduler; struct tqueue aio_queue; diff --git a/tools/blktap2/drivers/tapdisk-stream.c b/tools/blktap2/drivers/tapdisk-stream.c index 8fa9d9e0bf..4e0f9a8f12 100644 --- a/tools/blktap2/drivers/tapdisk-stream.c +++ b/tools/blktap2/drivers/tapdisk-stream.c @@ -333,11 +333,11 @@ tapdisk_stream_open_image(struct tapdisk_stream *s, const char *path, int type) s->id = tapdisk_stream_count++; - err = tapdisk_server_initialize(NULL, NULL); + err = tapdisk_server_initialize(); if (err) goto out; - err = tapdisk_vbd_initialize(-1, -1, s->id); + err = tapdisk_vbd_initialize(s->id); if (err) goto out; diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.c index c3321d5cc8..7dbd306257 100644 --- a/tools/blktap2/drivers/tapdisk-vbd.c +++ b/tools/blktap2/drivers/tapdisk-vbd.c @@ -82,7 +82,7 @@ tapdisk_vbd_initialize_vreq(td_vbd_request_t *vreq) } int -tapdisk_vbd_initialize(int rfd, int wfd, uint16_t uuid) +tapdisk_vbd_initialize(uint16_t uuid) { int i; td_vbd_t *vbd; @@ -100,9 +100,6 @@ tapdisk_vbd_initialize(int rfd, int wfd, uint16_t uuid) } vbd->uuid = uuid; - vbd->ipc.rfd = rfd; - vbd->ipc.wfd = wfd; - vbd->ipc.uuid = uuid; vbd->ring.fd = -1; /* default blktap ring completion */ @@ -995,7 +992,6 @@ tapdisk_vbd_shutdown(td_vbd_t *vbd) vbd->kicked); tapdisk_vbd_close_vdi(vbd); - tapdisk_ipc_write(&vbd->ipc, TAPDISK_MESSAGE_CLOSE_RSP); tapdisk_vbd_unregister_events(vbd); tapdisk_vbd_unmap_device(vbd); tapdisk_server_remove_vbd(vbd); @@ -1196,7 +1192,6 @@ tapdisk_vbd_pause(td_vbd_t *vbd) td_flag_clear(vbd->state, TD_VBD_PAUSE_REQUESTED); td_flag_set(vbd->state, TD_VBD_PAUSED); - tapdisk_ipc_write(&vbd->ipc, TAPDISK_MESSAGE_PAUSE_RSP); return 0; } @@ -1208,7 +1203,6 @@ tapdisk_vbd_resume(td_vbd_t *vbd, const char *path, uint16_t drivertype) if (!td_flag_test(vbd->state, TD_VBD_PAUSED)) { EPRINTF("resume request for unpaused vbd %s\n", vbd->name); - tapdisk_ipc_write(&vbd->ipc, TAPDISK_MESSAGE_ERROR); return -EINVAL; } @@ -1216,7 +1210,6 @@ tapdisk_vbd_resume(td_vbd_t *vbd, const char *path, uint16_t drivertype) vbd->name = strdup(path); if (!vbd->name) { EPRINTF("copying new vbd %s name failed\n", path); - tapdisk_ipc_write(&vbd->ipc, TAPDISK_MESSAGE_ERROR); return -EINVAL; } vbd->type = drivertype; @@ -1241,15 +1234,12 @@ tapdisk_vbd_resume(td_vbd_t *vbd, const char *path, uint16_t drivertype) sleep(TD_VBD_EIO_SLEEP); } - if (err) { - tapdisk_ipc_write(&vbd->ipc, TAPDISK_MESSAGE_ERROR); + if (err) return err; - } tapdisk_vbd_start_queue(vbd); td_flag_clear(vbd->state, TD_VBD_PAUSED); td_flag_clear(vbd->state, TD_VBD_PAUSE_REQUESTED); - tapdisk_ipc_write(&vbd->ipc, TAPDISK_MESSAGE_RESUME_RSP); return 0; } diff --git a/tools/blktap2/drivers/tapdisk-vbd.h b/tools/blktap2/drivers/tapdisk-vbd.h index a57691cfd9..033a6b796d 100644 --- a/tools/blktap2/drivers/tapdisk-vbd.h +++ b/tools/blktap2/drivers/tapdisk-vbd.h @@ -34,7 +34,6 @@ #include "tapdisk.h" #include "scheduler.h" -#include "tapdisk-ipc.h" #include "tapdisk-image.h" #define TD_VBD_MAX_RETRIES 100 @@ -101,8 +100,6 @@ struct td_vbd_handle { td_flag_t flags; td_flag_t state; - td_ipc_t ipc; - struct list_head images; struct list_head new_requests; @@ -171,7 +168,7 @@ tapdisk_vbd_next_image(td_image_t *image) return list_entry(image->next.next, td_image_t, next); } -int tapdisk_vbd_initialize(int, int, td_uuid_t); +int tapdisk_vbd_initialize(td_uuid_t); void tapdisk_vbd_set_callback(td_vbd_t *, td_vbd_cb_t, void *); int tapdisk_vbd_parse_stack(td_vbd_t *vbd, const char *path); int tapdisk_vbd_open(td_vbd_t *, const char *, uint16_t, diff --git a/tools/blktap2/drivers/tapdisk2.c b/tools/blktap2/drivers/tapdisk2.c index 961bad6c2f..237b856dde 100644 --- a/tools/blktap2/drivers/tapdisk2.c +++ b/tools/blktap2/drivers/tapdisk2.c @@ -249,7 +249,7 @@ tapdisk2_open_device(int type, const char *path, const char *name) char *devname; struct blktap2_params params; - err = tapdisk_vbd_initialize(-1, -1, TAPDISK2_VBD); + err = tapdisk_vbd_initialize(TAPDISK2_VBD); if (err) return err; @@ -349,7 +349,7 @@ tapdisk2_create_device(const char *params) if (err) goto out; - err = tapdisk_server_initialize(NULL, NULL); + err = tapdisk_server_initialize(); if (err) goto fail; -- 2.39.5