[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 6/6] xenstored: add --master-domid to support domain builder



When a domain builder stub domain is used, the initial xenstore
connection to domain 0 may use a different domain ID as the endpoint;
allow this domain ID to be specified on the command line.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c   | 5 +++++
 tools/xenstore/xenstored_core.h   | 3 +++
 tools/xenstore/xenstored_domain.c | 2 +-
 tools/xenstore/xenstored_minios.c | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 2324e53..47f0722 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1795,6 +1795,7 @@ static struct option options[] = {
        { "entry-nb", 1, NULL, 'E' },
        { "pid-file", 1, NULL, 'F' },
        { "event", 1, NULL, 'e' },
+       { "master-domid", 1, NULL, 'm' },
        { "help", 0, NULL, 'H' },
        { "no-fork", 0, NULL, 'N' },
        { "priv-domid", 1, NULL, 'p' },
@@ -1810,6 +1811,7 @@ static struct option options[] = {
        { NULL, 0, NULL, 0 } };
 
 extern void dump_conn(struct connection *conn); 
+int dom0_domid = 0;
 int dom0_event = 0;
 int priv_domid = 0;
 
@@ -1871,6 +1873,9 @@ int main(int argc, char *argv[])
                case 'e':
                        dom0_event = strtol(optarg, NULL, 10);
                        break;
+               case 'm':
+                       dom0_domid = strtol(optarg, NULL, 10);
+                       break;
                case 'p':
                        priv_domid = strtol(optarg, NULL, 10);
                        break;
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index cfbcf6f..dcf95b5 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -170,6 +170,7 @@ void trace(const char *fmt, ...);
 void dtrace_io(const struct connection *conn, const struct buffered_data 
*data, int out);
 
 extern int event_fd;
+extern int dom0_domid;
 extern int dom0_event;
 extern int priv_domid;
 
@@ -177,6 +178,8 @@ extern int priv_domid;
 void *xenbus_map(void);
 void unmap_xenbus(void *interface);
 
+static inline int xenbus_master_domid(void) { return dom0_domid; }
+
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
 
diff --git a/tools/xenstore/xenstored_domain.c 
b/tools/xenstore/xenstored_domain.c
index f24bd6b..f7bbb03 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -606,7 +606,7 @@ static int dom0_init(void)
        if (port == -1)
                return -1;
 
-       dom0 = new_domain(NULL, 0, port); 
+       dom0 = new_domain(NULL, xenbus_master_domid(), port);
        if (dom0 == NULL)
                return -1;
 
diff --git a/tools/xenstore/xenstored_minios.c 
b/tools/xenstore/xenstored_minios.c
index 1c6f794..f9c921e 100644
--- a/tools/xenstore/xenstored_minios.c
+++ b/tools/xenstore/xenstored_minios.c
@@ -51,7 +51,7 @@ evtchn_port_t xenbus_evtchn(void)
 
 void *xenbus_map(void)
 {
-       return xc_gnttab_map_grant_ref(*xcg_handle, 0,
+       return xc_gnttab_map_grant_ref(*xcg_handle, xenbus_master_domid(),
                        GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE);
 }
 
-- 
1.8.5.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.