From: Wei Liu Date: Tue, 10 Mar 2015 17:10:29 +0000 (+0000) Subject: xen: don't hardcode xenstore path X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1eaa21ea63ef551f0e2b5ec511fb78a8b284725c;p=people%2Fliuw%2Fqemu.git xen: don't hardcode xenstore path 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 --- diff --git a/xen-hvm.c b/xen-hvm.c index 3a7fd5885a..8dd4ec3275 100644 --- 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);