diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-08-16 13:32:04 +0100 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-08-16 13:32:04 +0100 |
commit | ce8ffdb5516b77e2ddb7f84aa0b61dc85f8fc2df (patch) | |
tree | 681c427fe28e46dfdcf2fcd7a4795d48a803dae0 /tools/console/daemon | |
parent | 4129c5a320bca20d94a76a99b6f133b384ada46d (diff) | |
download | xen-ce8ffdb5516b77e2ddb7f84aa0b61dc85f8fc2df.tar.gz xen-ce8ffdb5516b77e2ddb7f84aa0b61dc85f8fc2df.tar.bz2 xen-ce8ffdb5516b77e2ddb7f84aa0b61dc85f8fc2df.zip |
tools: xenconsole[d] and libxl: multiple console support
This patch implements the new protocol for handling pv consoles and
emulated serials as described in the document docs/misc/console.txt.
The changes are:
- xenconsoled: do not write the pty under serial in xenstore if
xenconsoled is handling a consolepath;
- xenconsole: implement support for an explicit console type parameter;
the parameter can be "pv", to specify that the user wants to
connect to a pv console, or "serial", to specify that the user wants to
connect to an emulated serial. If the type parameter hasn't been
specified be the user, xenconsole tries to guess which type of console
it has to connect to, defaulting to pv console for pv guests and
emulated serial for hvm guests.
- xenconsole: use the new xenstore paths;
- libxl: rename libxl_console_constype to libxl_console_consback:
constype is used to to specify whether qemu or xenconsoled provides the
backend, so I renamed it to libxl_console_consback to make it more
obvious that we are talking about backends;
- libxl: add a new libxl_console_constype to specify if the console is
an emulated serial or a pv console;
- libxl: support the new xenconsole "type" command line parameter;
- libxl: use the "output" node under console in xenstore to tell qemu
where do we want the output of this pv console to go;
- remove the legacy "serialpath" from xenconsoled altogether
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Also: update the QEMU_TAG to pull in the qemu part of these changes.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/console/daemon')
-rw-r--r-- | tools/console/daemon/io.c | 75 |
1 files changed, 13 insertions, 62 deletions
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 55e8027d43..691b0f2786 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -87,8 +87,6 @@ struct domain { struct buffer buffer; struct domain *next; char *conspath; - char *serialpath; - int use_consolepath; int ring_ref; evtchn_port_or_error_t local_port; evtchn_port_or_error_t remote_port; @@ -440,20 +438,8 @@ static int domain_create_tty(struct domain *dom) goto out; } - if (dom->use_consolepath) { - success = asprintf(&path, "%s/limit", dom->conspath) != - -1; - if (!success) - goto out; - data = xs_read(xs, XBT_NULL, path, &len); - if (data) { - dom->buffer.max_capacity = strtoul(data, 0, 0); - free(data); - } - free(path); - } - - success = asprintf(&path, "%s/limit", dom->serialpath) != -1; + success = asprintf(&path, "%s/limit", dom->conspath) != + -1; if (!success) goto out; data = xs_read(xs, XBT_NULL, path, &len); @@ -463,7 +449,7 @@ static int domain_create_tty(struct domain *dom) } free(path); - success = asprintf(&path, "%s/tty", dom->serialpath) != -1; + success = (asprintf(&path, "%s/tty", dom->conspath) != -1); if (!success) goto out; success = xs_write(xs, XBT_NULL, path, slave, strlen(slave)); @@ -471,16 +457,6 @@ static int domain_create_tty(struct domain *dom) if (!success) goto out; - if (dom->use_consolepath) { - success = (asprintf(&path, "%s/tty", dom->conspath) != -1); - if (!success) - goto out; - success = xs_write(xs, XBT_NULL, path, slave, strlen(slave)); - free(path); - if (!success) - goto out; - } - if (fcntl(dom->master_fd, F_SETFL, O_NONBLOCK) == -1) goto out; @@ -524,29 +500,20 @@ static int xs_gather(struct xs_handle *xs, const char *dir, ...) va_end(ap); return ret; } - + static int domain_create_ring(struct domain *dom) { int err, remote_port, ring_ref, rc; char *type, path[PATH_MAX]; - err = xs_gather(xs, dom->serialpath, + err = xs_gather(xs, dom->conspath, "ring-ref", "%u", &ring_ref, "port", "%i", &remote_port, NULL); - if (err) { - err = xs_gather(xs, dom->conspath, - "ring-ref", "%u", &ring_ref, - "port", "%i", &remote_port, - NULL); - if (err) - goto out; - dom->use_consolepath = 1; - } else - dom->use_consolepath = 0; + if (err) + goto out; - snprintf(path, sizeof(path), "%s/type", - dom->use_consolepath ? dom->conspath: dom->serialpath); + snprintf(path, sizeof(path), "%s/type", dom->conspath); type = xs_read(xs, XBT_NULL, path, NULL); if (type && strcmp(type, "xenconsoled") != 0) { free(type); @@ -628,16 +595,12 @@ static bool watch_domain(struct domain *dom, bool watch) snprintf(domid_str, sizeof(domid_str), "dom%u", dom->domid); if (watch) { - success = xs_watch(xs, dom->serialpath, domid_str); - if (success) { - success = xs_watch(xs, dom->conspath, domid_str); - if (success) - domain_create_ring(dom); - else - xs_unwatch(xs, dom->serialpath, domid_str); - } + success = xs_watch(xs, dom->conspath, domid_str); + if (success) + domain_create_ring(dom); + else + xs_unwatch(xs, dom->conspath, domid_str); } else { - success = xs_unwatch(xs, dom->serialpath, domid_str); success = xs_unwatch(xs, dom->conspath, domid_str); } @@ -666,14 +629,6 @@ static struct domain *create_domain(int domid) dom->domid = domid; - dom->serialpath = xs_get_domain_path(xs, dom->domid); - s = realloc(dom->serialpath, strlen(dom->serialpath) + - strlen("/serial/0") + 1); - if (s == NULL) - goto out; - dom->serialpath = s; - strcat(dom->serialpath, "/serial/0"); - dom->conspath = xs_get_domain_path(xs, dom->domid); s = realloc(dom->conspath, strlen(dom->conspath) + strlen("/console") + 1); @@ -712,7 +667,6 @@ static struct domain *create_domain(int domid) return dom; out: - free(dom->serialpath); free(dom->conspath); free(dom); return NULL; @@ -755,9 +709,6 @@ static void cleanup_domain(struct domain *d) free(d->buffer.data); d->buffer.data = NULL; - free(d->serialpath); - d->serialpath = NULL; - free(d->conspath); d->conspath = NULL; |