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-changelog

[Xen-changelog] [xen-unstable] stubdom: add support for reading the comm

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] stubdom: add support for reading the command line from the config
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2008 05:40:30 -0700
Delivery-date: Thu, 20 Mar 2008 05:42:28 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1205839625 0
# Node ID 3d6d042144d744b766c38339eb8e156ceb09b59a
# Parent  312053c2da89204f9e1637373be0ee38cad4e1b3
stubdom: add support for reading the command line from the config
file, and merge the dmargs with it in the case of qemu.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/main.c          |   74 ++++++++++++++++++++++-------------------
 tools/python/xen/xend/image.py |    1 
 2 files changed, 41 insertions(+), 34 deletions(-)

diff -r 312053c2da89 -r 3d6d042144d7 extras/mini-os/main.c
--- a/extras/mini-os/main.c     Tue Mar 18 11:26:43 2008 +0000
+++ b/extras/mini-os/main.c     Tue Mar 18 11:27:05 2008 +0000
@@ -42,6 +42,9 @@ static void call_main(void *p)
 static void call_main(void *p)
 {
     char *args, /**path,*/ *msg, *c;
+#ifdef CONFIG_QEMU
+    char *domargs;
+#endif
     int argc;
     char **argv;
     char *envp[] = { NULL };
@@ -63,14 +66,12 @@ static void call_main(void *p)
     }
 
     /* Fetch argc, argv from XenStore */
-    char domid_s[10];
     int domid;
     domid = xenbus_read_integer("target");
     if (domid == -1) {
         printk("Couldn't read target\n");
         do_exit();
     }
-    snprintf(domid_s, sizeof(domid_s), "%d", domid);
 
     snprintf(path, sizeof(path), "/local/domain/%d/vm", domid);
     msg = xenbus_read(XBT_NIL, path, &vm);
@@ -78,59 +79,64 @@ static void call_main(void *p)
         printk("Couldn't read vm path\n");
         do_exit();
     }
-    printk("vm is at %s\n", vm);
-#else
+    printk("dom vm is at %s\n", vm);
+
+    snprintf(path, sizeof(path), "%s/image/dmargs", vm);
+    free(vm);
+    msg = xenbus_read(XBT_NIL, path, &domargs);
+
+    if (msg) {
+        printk("Couldn't get stubdom args: %s\n", msg);
+        domargs = strdup("");
+    }
+#endif
+
     msg = xenbus_read(XBT_NIL, "vm", &vm);
     if (msg) {
         printk("Couldn't read vm path\n");
         do_exit();
     }
-#endif
 
-    snprintf(path, sizeof(path), "%s/image/dmargs", vm);
+    printk("my vm is at %s\n", vm);
+    snprintf(path, sizeof(path), "%s/image/cmdline", vm);
     free(vm);
     msg = xenbus_read(XBT_NIL, path, &args);
 
     if (msg) {
-        printk("Couldn't get stubdom args: %s\n", msg);
+        printk("Couldn't get my args: %s\n", msg);
         args = strdup("");
     }
 
     argc = 1;
+
+#define PARSE_ARGS(ARGS,START,END) \
+    c = ARGS; \
+    while (*c) { \
+       if (*c != ' ') { \
+           START; \
+           while (*c && *c != ' ') \
+               c++; \
+       } else { \
+            END; \
+           while (*c == ' ') \
+               c++; \
+       } \
+    }
+
+    PARSE_ARGS(args, argc++, );
 #ifdef CONFIG_QEMU
-    argc += 2;
+    PARSE_ARGS(domargs, argc++, );
 #endif
-    c = args;
-    while (*c) {
-       if (*c != ' ') {
-           argc++;
-           while (*c && *c != ' ')
-               c++;
-       } else {
-           while (*c == ' ')
-               c++;
-       }
-    }
+
     argv = alloca((argc + 1) * sizeof(char *));
     argv[0] = "main";
     argc = 1;
+
+    PARSE_ARGS(args, argv[argc++] = c, *c++ = 0)
 #ifdef CONFIG_QEMU
-    argv[1] = "-d";
-    argv[2] = domid_s;
-    argc += 2;
+    PARSE_ARGS(domargs, argv[argc++] = c, *c++ = 0)
 #endif
-    c = args;
-    while (*c) {
-       if (*c != ' ') {
-           argv[argc++] = c;
-           while (*c && *c != ' ')
-               c++;
-       } else {
-           *c++ = 0;
-           while (*c == ' ')
-               c++;
-       }
-    }
+
     argv[argc] = NULL;
 
     for (i = 0; i < argc; i++)
diff -r 312053c2da89 -r 3d6d042144d7 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Mar 18 11:26:43 2008 +0000
+++ b/tools/python/xen/xend/image.py    Tue Mar 18 11:27:05 2008 +0000
@@ -90,6 +90,7 @@ class ImageHandler:
                         ("image/kernel", self.kernel),
                         ("image/cmdline", self.cmdline),
                         ("image/ramdisk", self.ramdisk))
+        self.vm.permissionsVm("image/cmdline", { 'dom': self.vm.getDomid(), 
'read': True } )
 
         self.device_model = vmConfig['platform'].get('device_model')
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] stubdom: add support for reading the command line from the config, Xen patchbot-unstable <=