From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel De Graaf Subject: [PATCH 6/6] xenstored: add --master-domid to support domain builder Date: Tue, 4 Mar 2014 17:51:34 -0500 Message-ID: <1393973494-29411-7-git-send-email-dgdegra@tycho.nsa.gov> References: <1393973494-29411-1-git-send-email-dgdegra@tycho.nsa.gov> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1393973494-29411-1-git-send-email-dgdegra@tycho.nsa.gov> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Daniel De Graaf , Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org 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 Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell --- 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