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] tools/libxl: libxl_device_generic_add: ha

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools/libxl: libxl_device_generic_add: handle NULL fents or bents
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Aug 2010 07:00:48 -0700
Delivery-date: Wed, 18 Aug 2010 07:04:27 -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 Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1281728049 -3600
# Node ID 1fffba3a48ffe3466bac9d8f97ae484ab2156d8d
# Parent  5decc6971f2a5ef4d72a7f52b7e4dab29c1042da
tools/libxl: libxl_device_generic_add: handle NULL fents or bents

This is going to be used by libxl_console_add in the next patch to
avoid creating the device/console path on xenstore for console 0.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_device.c |   30 +++++++++++++++---------------
 tools/libxl/libxl_xshelp.c |    3 +++
 2 files changed, 18 insertions(+), 15 deletions(-)

diff -r 5decc6971f2a -r 1fffba3a48ff tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Fri Aug 13 16:56:42 2010 +0100
+++ b/tools/libxl/libxl_device.c        Fri Aug 13 20:34:09 2010 +0100
@@ -76,21 +76,21 @@ retry_transaction:
     t = xs_transaction_start(ctx->xsh);
     /* FIXME: read frontend_path and check state before removing stuff */
 
-    xs_rm(ctx->xsh, t, frontend_path);
-    xs_rm(ctx->xsh, t, backend_path);
-
-    xs_mkdir(ctx->xsh, t, frontend_path);
-    xs_set_permissions(ctx->xsh, t, frontend_path, frontend_perms, 
ARRAY_SIZE(frontend_perms));
-
-    xs_mkdir(ctx->xsh, t, backend_path);
-    xs_set_permissions(ctx->xsh, t, backend_path, backend_perms, 
ARRAY_SIZE(backend_perms));
-
-    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/backend", frontend_path), 
backend_path, strlen(backend_path));
-    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/frontend", backend_path), 
frontend_path, strlen(frontend_path));
-
-    /* and write frontend kvs and backend kvs */
-    libxl_xs_writev(&gc, t, backend_path, bents);
-    libxl_xs_writev(&gc, t, frontend_path, fents);
+    if (fents) {
+        xs_rm(ctx->xsh, t, frontend_path);
+        xs_mkdir(ctx->xsh, t, frontend_path);
+        xs_set_permissions(ctx->xsh, t, frontend_path, frontend_perms, 
ARRAY_SIZE(frontend_perms));
+        xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/backend", frontend_path), 
backend_path, strlen(backend_path));
+        libxl_xs_writev(&gc, t, frontend_path, fents);
+    }
+
+    if (bents) {
+        xs_rm(ctx->xsh, t, backend_path);
+        xs_mkdir(ctx->xsh, t, backend_path);
+        xs_set_permissions(ctx->xsh, t, backend_path, backend_perms, 
ARRAY_SIZE(backend_perms));
+        xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/frontend", backend_path), 
frontend_path, strlen(frontend_path));
+        libxl_xs_writev(&gc, t, backend_path, bents);
+    }
 
     if (!xs_transaction_end(ctx->xsh, t, 0)) {
         if (errno == EAGAIN)
diff -r 5decc6971f2a -r 1fffba3a48ff tools/libxl/libxl_xshelp.c
--- a/tools/libxl/libxl_xshelp.c        Fri Aug 13 16:56:42 2010 +0100
+++ b/tools/libxl/libxl_xshelp.c        Fri Aug 13 20:34:09 2010 +0100
@@ -48,6 +48,9 @@ char **libxl_xs_kvs_of_flexarray(libxl_g
 {
     char **kvs;
     int i;
+
+    if (!length)
+        return NULL;
 
     kvs = libxl_calloc(gc, length + 2, sizeof(char *));
     if (kvs) {

_______________________________________________
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] tools/libxl: libxl_device_generic_add: handle NULL fents or bents, Xen patchbot-unstable <=