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/
Home Products Support Community News


[Xen-changelog] [xen-unstable] libxl: do not read f.e. xenstore dir in d

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: do not read f.e. xenstore dir in disk list function
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Tue, 01 Nov 2011 23:55:12 +0000
Delivery-date: Tue, 01 Nov 2011 16:56:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1318941375 -3600
# Node ID 2b6d3f4b78fc3be33e40826769bbc719cd6f907b
# Parent  f2a50026376cb070df4f2023520395ebb722b41c
libxl: do not read f.e. xenstore dir in disk list function

Instead store a duplicate of the "device-type" node in the backend dir
and use that instead.

This maintains the invariant that the list function is always "safe".

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>

diff -r f2a50026376c -r 2b6d3f4b78fc tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Oct 18 10:35:56 2011 +0100
+++ b/tools/libxl/libxl.c       Tue Oct 18 13:36:15 2011 +0100
@@ -1018,6 +1018,8 @@
     flexarray_append(back, "mode");
     flexarray_append(back, disk->readwrite ? "w" : "r");
+    flexarray_append(back, "device-type");
+    flexarray_append(back, disk->is_cdrom ? "cdrom" : "disk");
     flexarray_append(front, "backend-id");
     flexarray_append(front, libxl__sprintf(&gc, "%d", disk->backend_domid));
@@ -1512,7 +1514,6 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     unsigned int len;
     char *tmp;
-    const char *fe_path; /* XXX unsafe */
     memset(disk, 0, sizeof(*disk));
@@ -1544,10 +1545,8 @@
         disk->readwrite = 0;
-    fe_path = libxl__xs_read(gc, XBT_NULL,
-                             libxl__sprintf(gc, "%s/frontend", be_path));
     tmp = libxl__xs_read(gc, XBT_NULL,
-                         libxl__sprintf(gc, "%s/device-type", fe_path));
+                         libxl__sprintf(gc, "%s/device-type", be_path));
     disk->is_cdrom = !strcmp(tmp, "cdrom");
     disk->format = LIBXL_DISK_FORMAT_UNKNOWN;

Xen-changelog mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: do not read f.e. xenstore dir in disk list function, Xen patchbot-unstable <=