]> xenbits.xensource.com Git - people/liuw/qemu.git/commitdiff
xen: don't hardcode xenstore path
authorWei Liu <wei.liu2@citrix.com>
Tue, 10 Mar 2015 17:10:29 +0000 (17:10 +0000)
committerWei Liu <wei.liu2@citrix.com>
Fri, 16 Oct 2015 15:18:44 +0000 (16:18 +0100)
Blindly reading from / writing to /local/domain/0 is wrong because QEMU
might be running in another domain. Use relative path to let xenstore
machinery figure out the final path to write to.

We don't currently support running upstream QEMU as a stubdom, so it
only runs in Dom0. That means QEMU is still writing to /local/domain/0
as before.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
xen-hvm.c

index 3a7fd5885a2ce23ca3a3a4015ef30255bb5e16a9..8dd4ec327505dd8a332859e5f4cf7457f173794d 100644 (file)
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -370,14 +370,14 @@ go_physmap:
                                    XEN_DOMCTL_MEM_CACHEATTR_WB);
 
     snprintf(path, sizeof(path),
-            "/local/domain/0/device-model/%d/physmap/%"PRIx64"/start_addr",
+            "device-model/%d/physmap/%"PRIx64"/start_addr",
             xen_domid, (uint64_t)phys_offset);
     snprintf(value, sizeof(value), "%"PRIx64, (uint64_t)start_addr);
     if (!xs_write(state->xenstore, 0, path, value, strlen(value))) {
         return -1;
     }
     snprintf(path, sizeof(path),
-            "/local/domain/0/device-model/%d/physmap/%"PRIx64"/size",
+            "device-model/%d/physmap/%"PRIx64"/size",
             xen_domid, (uint64_t)phys_offset);
     snprintf(value, sizeof(value), "%"PRIx64, (uint64_t)size);
     if (!xs_write(state->xenstore, 0, path, value, strlen(value))) {
@@ -385,7 +385,7 @@ go_physmap:
     }
     if (mr_name) {
         snprintf(path, sizeof(path),
-                "/local/domain/0/device-model/%d/physmap/%"PRIx64"/name",
+                "device-model/%d/physmap/%"PRIx64"/name",
                 xen_domid, (uint64_t)phys_offset);
         if (!xs_write(state->xenstore, 0, path, mr_name, strlen(mr_name))) {
             return -1;
@@ -1117,7 +1117,7 @@ static void xen_read_physmap(XenIOState *state)
     char **entries = NULL;
 
     snprintf(path, sizeof(path),
-            "/local/domain/0/device-model/%d/physmap", xen_domid);
+            "device-model/%d/physmap", xen_domid);
     entries = xs_directory(state->xenstore, 0, path, &num);
     if (entries == NULL)
         return;
@@ -1126,7 +1126,7 @@ static void xen_read_physmap(XenIOState *state)
         physmap = g_malloc(sizeof (XenPhysmap));
         physmap->phys_offset = strtoull(entries[i], NULL, 16);
         snprintf(path, sizeof(path),
-                "/local/domain/0/device-model/%d/physmap/%s/start_addr",
+                "device-model/%d/physmap/%s/start_addr",
                 xen_domid, entries[i]);
         value = xs_read(state->xenstore, 0, path, &len);
         if (value == NULL) {
@@ -1137,7 +1137,7 @@ static void xen_read_physmap(XenIOState *state)
         free(value);
 
         snprintf(path, sizeof(path),
-                "/local/domain/0/device-model/%d/physmap/%s/size",
+                "device-model/%d/physmap/%s/size",
                 xen_domid, entries[i]);
         value = xs_read(state->xenstore, 0, path, &len);
         if (value == NULL) {
@@ -1148,7 +1148,7 @@ static void xen_read_physmap(XenIOState *state)
         free(value);
 
         snprintf(path, sizeof(path),
-                "/local/domain/0/device-model/%d/physmap/%s/name",
+                "device-model/%d/physmap/%s/name",
                 xen_domid, entries[i]);
         physmap->name = xs_read(state->xenstore, 0, path, &len);