diff options
author | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2006-02-08 12:03:52 +0000 |
---|---|---|
committer | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2006-02-08 12:03:52 +0000 |
commit | aaf087246484df8d659c8225f768d31264ccb3c8 (patch) | |
tree | 8139d6f55290d116e8663abb899c89c7440a464f /tools/xenstore/xenstored_domain.c | |
parent | 5ceb0a4532bcce03ab7219831ef70214fde8ccfe (diff) | |
download | xen-aaf087246484df8d659c8225f768d31264ccb3c8.tar.gz xen-aaf087246484df8d659c8225f768d31264ccb3c8.tar.bz2 xen-aaf087246484df8d659c8225f768d31264ccb3c8.zip |
Use /dev/kmem to map dom0 xenstore page instead of abusing the foreign mapping interface.
Change /proc/xen/xsd_mfn to /proc/xen/xsd_kva containing the kernel
virtual address of the dom0 xenstore page. Update xenstored to use
/proc/xen/xsd_kva.
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/xenstore/xenstored_domain.c')
-rw-r--r-- | tools/xenstore/xenstored_domain.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index fb73771787..563f07e596 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -27,6 +27,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <paths.h> //#define DEBUG #include "utils.h" @@ -256,7 +257,7 @@ static char *talloc_domain_path(void *context, unsigned int domid) } static struct domain *new_domain(void *context, unsigned int domid, - unsigned long mfn, int port) + int port) { struct domain *domain; struct ioctl_evtchn_bind_interdomain bind; @@ -268,11 +269,6 @@ static struct domain *new_domain(void *context, unsigned int domid, domain->shutdown = 0; domain->domid = domid; domain->path = talloc_domain_path(domain, domid); - domain->interface = xc_map_foreign_range( - *xc_handle, domain->domid, - getpagesize(), PROT_READ|PROT_WRITE, mfn); - if (!domain->interface) - return NULL; list_add(&domain->list, &domains); talloc_set_destructor(domain, destroy_domain); @@ -290,7 +286,6 @@ static struct domain *new_domain(void *context, unsigned int domid, domain->conn->id = domid; domain->remote_port = port; - domain->mfn = mfn; return domain; } @@ -341,11 +336,19 @@ void do_introduce(struct connection *conn, struct buffered_data *in) if (domain == NULL) { /* Hang domain off "in" until we're finished. */ - domain = new_domain(in, domid, mfn, port); + domain = new_domain(in, domid, port); if (!domain) { send_error(conn, errno); return; } + domain->interface = xc_map_foreign_range( + *xc_handle, domid, + getpagesize(), PROT_READ|PROT_WRITE, mfn); + if (!domain->interface) { + send_error(conn, errno); + return; + } + domain->mfn = mfn; /* Now domain belongs to its connection. */ talloc_steal(domain->conn, domain); @@ -463,11 +466,11 @@ static int dom0_init(void) { int rc, fd; evtchn_port_t port; - unsigned long mfn; + unsigned long kva; char str[20]; struct domain *dom0; - fd = open(XENSTORED_PROC_MFN, O_RDONLY); + fd = open(XENSTORED_PROC_KVA, O_RDONLY); if (fd == -1) return -1; @@ -475,7 +478,7 @@ static int dom0_init(void) if (rc == -1) goto outfd; str[rc] = '\0'; - mfn = strtoul(str, NULL, 0); + kva = strtoul(str, NULL, 0); close(fd); @@ -491,7 +494,19 @@ static int dom0_init(void) close(fd); - dom0 = new_domain(NULL, 0, mfn, port); + dom0 = new_domain(NULL, 0, port); + + fd = open(_PATH_KMEM, O_RDWR); + if (fd == -1) + return -1; + + dom0->interface = mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE, + MAP_SHARED, fd, kva); + if (dom0->interface == MAP_FAILED) + goto outfd; + + close(fd); + talloc_steal(dom0->conn, dom0); evtchn_notify(dom0->port); |