WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 6/24] [xen-unstable.hg] don't hard code xenstore/cons

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 6/24] [xen-unstable.hg] don't hard code xenstore/console domid when seeding grant table of new domU
From: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
Date: Mon, 23 Mar 2009 15:20:47 +0000
Delivery-date: Mon, 23 Mar 2009 08:28:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (X11/20090105)



This patch implements a way to determine in which domains the console
and xenstore daemons reside. If each of the files
/var/run/{console,xenstore}.did contains an integer, this integer is
interpreted as the domain id for that daemon. The default or fallback is
domid=0, of course. Here, libxc is modified to use this mechanism for
the grant table entries.

A previous version of this patch was sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00610.html

Signed-off-by: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
Signed-off-by: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
---

diff -r 5ea8720ce31f tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c Fri Aug 01 16:50:30 2008 +0100
+++ b/tools/libxc/xc_dom_boot.c Fri Aug 01 16:50:31 2008 +0100
@@ -256,6 +256,31 @@
     return rc;
 }
 
+static uint32_t read_domid(const char *service)
+{
+    char buf[64];
+    int n;
+    FILE *f = NULL;
+    uint32_t domid = 0;
+
+    n = snprintf(buf, sizeof(buf), "/var/run/%s.did", service);
+    if ( n < 0 || n >= sizeof(buf) )
+        goto out;
+
+    f = fopen(buf, "r");
+    if ( f == NULL )
+        goto out;
+
+    if ( fscanf(f, "%" PRIu32, &domid) != 1 )
+        goto out;
+
+out:
+    if ( f != NULL )
+        fclose(f);
+
+    return domid;
+}
+
 static unsigned long xc_dom_gnttab_setup(int xc_handle, uint32_t domid)
 {
     DECLARE_HYPERCALL;
@@ -296,9 +321,8 @@
     unsigned long gnttab_gmfn;
     grant_entry_t *gnttab;
 
-    /* TODO: don't hard-code these */
-    console_domid = 0;
-    xenstore_domid = 0;
+    console_domid  = read_domid("console");
+    xenstore_domid = read_domid("xenstore");
 
     gnttab_gmfn = xc_dom_gnttab_setup(xc_handle, domid);
     if ( gnttab_gmfn == -1 )



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 6/24] [xen-unstable.hg] don't hard code xenstore/console domid when seeding grant table of new domU, Alex Zeffertt <=