[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Use @releaseDomain watch-events.
# HG changeset patch # User cl349@xxxxxxxxxxxxxxxxxxxx # Node ID 83bcc68aaf32b3eb1184d8d9c970147b006f4160 # Parent 0922c82a4bf3f60d33d2e2ac84746a3f5eaf921e Use @releaseDomain watch-events. This replaces listening to the domain exception virq through xcs. Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx> diff -r 0922c82a4bf3 -r 83bcc68aaf32 tools/console/Makefile --- a/tools/console/Makefile Tue Sep 6 18:18:56 2005 +++ b/tools/console/Makefile Tue Sep 6 18:29:27 2005 @@ -11,7 +11,6 @@ CFLAGS += -Wall -Werror -g3 -CFLAGS += -I $(XEN_XCS) CFLAGS += -I $(XEN_LIBXC) CFLAGS += -I $(XEN_XENSTORE) diff -r 0922c82a4bf3 -r 83bcc68aaf32 tools/console/daemon/io.c --- a/tools/console/daemon/io.c Tue Sep 6 18:18:56 2005 +++ b/tools/console/daemon/io.c Tue Sep 6 18:29:27 2005 @@ -26,7 +26,6 @@ #include "xenctrl.h" #include "xs.h" #include "xen/io/domain_controller.h" -#include "xcs_proto.h" #include <malloc.h> #include <stdlib.h> @@ -462,18 +461,6 @@ (void)write_sync(dom->evtchn_fd, &v, sizeof(v)); } -static void handle_xcs_msg(int fd) -{ - xcs_msg_t msg; - - if (!read_sync(fd, &msg, sizeof(msg))) { - dolog(LOG_ERR, "read from xcs failed! %m"); - exit(1); - } - - enum_domains(); -} - static void handle_xs(int fd) { char **vec; @@ -484,7 +471,7 @@ if (!vec) return; - if (!strcmp(vec[1], "introduceDomain")) + if (!strcmp(vec[1], "domlist")) enum_domains(); else if (sscanf(vec[1], "dom%u", &domid) == 1) { dom = lookup_domain(domid); @@ -509,9 +496,6 @@ FD_ZERO(&readfds); FD_ZERO(&writefds); - FD_SET(xcs_data_fd, &readfds); - max_fd = MAX(xcs_data_fd, max_fd); - FD_SET(xs_fileno(xs), &readfds); max_fd = MAX(xs_fileno(xs), max_fd); @@ -536,9 +520,6 @@ if (FD_ISSET(xs_fileno(xs), &readfds)) handle_xs(xs_fileno(xs)); - if (FD_ISSET(xcs_data_fd, &readfds)) - handle_xcs_msg(xcs_data_fd); - for (d = dom_head; d; d = n) { n = d->next; if (d->evtchn_fd != -1 && diff -r 0922c82a4bf3 -r 83bcc68aaf32 tools/console/daemon/utils.c --- a/tools/console/daemon/utils.c Tue Sep 6 18:18:56 2005 +++ b/tools/console/daemon/utils.c Tue Sep 6 18:29:27 2005 @@ -35,15 +35,11 @@ #include "xenctrl.h" #include "xen/io/domain_controller.h" -#include "xcs_proto.h" #include "utils.h" struct xs_handle *xs; int xc; - -int xcs_ctrl_fd = -1; -int xcs_data_fd = -1; bool _read_write_sync(int fd, void *data, size_t size, bool do_read) { @@ -69,32 +65,6 @@ } return true; -} - -static int open_domain_socket(const char *path) -{ - struct sockaddr_un addr; - int sock; - size_t addr_len; - - if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) { - goto out; - } - - addr.sun_family = AF_UNIX; - strcpy(addr.sun_path, path); - addr_len = sizeof(addr.sun_family) + strlen(XCS_SUN_PATH) + 1; - - if (connect(sock, (struct sockaddr *)&addr, addr_len) == -1) { - goto out_close_sock; - } - - return sock; - - out_close_sock: - close(sock); - out: - return -1; } static void child_exit(int sig) @@ -155,34 +125,8 @@ signal(SIGTTIN, SIG_IGN); } -/* synchronized send/recv strictly for setting up xcs */ -/* always use asychronize callbacks any other time */ -static bool xcs_send_recv(int fd, xcs_msg_t *msg) -{ - bool ret = false; - - if (!write_sync(fd, msg, sizeof(*msg))) { - dolog(LOG_ERR, "Write failed at %s:%s():L%d? Possible bug.", - __FILE__, __FUNCTION__, __LINE__); - goto out; - } - - if (!read_sync(fd, msg, sizeof(*msg))) { - dolog(LOG_ERR, "Read failed at %s:%s():L%d? Possible bug.", - __FILE__, __FUNCTION__, __LINE__); - goto out; - } - - ret = true; - - out: - return ret; -} - bool xen_setup(void) { - int sock; - xcs_msg_t msg; xs = xs_daemon_open(); if (xs == NULL) { @@ -197,58 +141,23 @@ goto out; } - sock = open_domain_socket(XCS_SUN_PATH); - if (sock == -1) { - dolog(LOG_ERR, "Failed to contact xcs (%m). Is it running?"); - goto out_close_store; + if (!xs_watch(xs, "@introduceDomain", "domlist")) { + dolog(LOG_ERR, "xenstore watch on @introduceDomain fails."); + goto out; } - xcs_ctrl_fd = sock; - - sock = open_domain_socket(XCS_SUN_PATH); - if (sock == -1) { - dolog(LOG_ERR, "Failed to contact xcs (%m). Is it running?"); - goto out_close_ctrl; - } - - xcs_data_fd = sock; - - memset(&msg, 0, sizeof(msg)); - msg.type = XCS_CONNECT_CTRL; - if (!xcs_send_recv(xcs_ctrl_fd, &msg) || msg.result != XCS_RSLT_OK) { - dolog(LOG_ERR, "xcs control connect failed. Possible bug."); - goto out_close_data; - } - - msg.type = XCS_CONNECT_DATA; - if (!xcs_send_recv(xcs_data_fd, &msg) || msg.result != XCS_RSLT_OK) { - dolog(LOG_ERR, "xcs data connect failed. Possible bug."); - goto out_close_data; - } - - msg.type = XCS_VIRQ_BIND; - msg.u.virq.virq = VIRQ_DOM_EXC; - if (!xcs_send_recv(xcs_ctrl_fd, &msg) || msg.result != XCS_RSLT_OK) { - dolog(LOG_ERR, "xcs virq bind failed. Possible bug."); - goto out_close_data; - } - - if (!xs_watch(xs, "@introduceDomain", "introduceDomain")) { - dolog(LOG_ERR, "xenstore watch on @introduceDomain fails."); - goto out_close_data; + if (!xs_watch(xs, "@releaseDomain", "domlist")) { + dolog(LOG_ERR, "xenstore watch on @releaseDomain fails."); + goto out; } return true; - out_close_data: - close(xcs_data_fd); - xcs_data_fd = -1; - out_close_ctrl: - close(xcs_ctrl_fd); - xcs_ctrl_fd = -1; - out_close_store: - xs_daemon_close(xs); out: + if (xs) + xs_daemon_close(xs); + if (xc != -1) + xc_interface_close(xc); return false; } diff -r 0922c82a4bf3 -r 83bcc68aaf32 tools/console/daemon/utils.h --- a/tools/console/daemon/utils.h Tue Sep 6 18:18:56 2005 +++ b/tools/console/daemon/utils.h Tue Sep 6 18:29:27 2005 @@ -33,8 +33,6 @@ #define write_sync(fd, buffer, size) _read_write_sync(fd, buffer, size, false) bool _read_write_sync(int fd, void *data, size_t size, bool do_read); -extern int xcs_ctrl_fd; -extern int xcs_data_fd; extern struct xs_handle *xs; extern int xc; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |