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] libxl: use more descriptive variable name

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: use more descriptive variable names in libxl__devices_destroy.
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Tue, 01 Nov 2011 23:55:18 +0000
Delivery-date: Tue, 01 Nov 2011 16:57: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 Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1318941402 -3600
# Node ID ae1e145bdac024835980370473bc82269c9f9c67
# Parent  3505f6b5787bfb7b06f961019a1130b1ebe98882
libxl: use more descriptive variable names in libxl__devices_destroy.

It's not immediately clear that "l1" iterates over device types and "l2"
iterates over individual devices. Name things in a way which makes this more
obvious.

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 3505f6b5787b -r ae1e145bdac0 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c        Tue Oct 18 13:36:42 2011 +0100
@@ -464,37 +464,38 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path;
-    unsigned int num1, num2;
-    char **l1 = NULL, **l2 = NULL;
+    unsigned int num_kinds, num_devs;
+    char **kinds = NULL, **devs = NULL;
     int i, j, n_watches = 0;
     libxl__device dev;
     libxl__device_kind kind;
 
     path = libxl__sprintf(gc, "/local/domain/%d/device", domid);
-    l1 = libxl__xs_directory(gc, XBT_NULL, path, &num1);
-    if (!l1) {
+    kinds = libxl__xs_directory(gc, XBT_NULL, path, &num_kinds);
+    if (!kinds) {
         if (errno != ENOENT) {
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to get xenstore"
                              " device listing %s", path);
             goto out;
         }
-        num1 = 0;
+        num_kinds = 0;
     }
-    for (i = 0; i < num1; i++) {
-        if (libxl__device_kind_from_string(l1[i], &kind))
+    for (i = 0; i < num_kinds; i++) {
+        if (libxl__device_kind_from_string(kinds[i], &kind))
             continue;
-        path = libxl__sprintf(gc, "/local/domain/%d/device/%s", domid, l1[i]);
-        l2 = libxl__xs_directory(gc, XBT_NULL, path, &num2);
-        if (!l2)
+
+        path = libxl__sprintf(gc, "/local/domain/%d/device/%s", domid, 
kinds[i]);
+        devs = libxl__xs_directory(gc, XBT_NULL, path, &num_devs);
+        if (!devs)
             continue;
-        for (j = 0; j < num2; j++) {
+        for (j = 0; j < num_devs; j++) {
             path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend",
-                                  domid, l1[i], l2[j]);
+                                  domid, kinds[i], devs[j]);
             path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, path));
             if (path && libxl__parse_backend_path(gc, path, &dev) == 0) {
                 dev.domid = domid;
                 dev.kind = kind;
-                dev.devid = atoi(l2[j]);
+                dev.devid = atoi(devs[j]);
 
                 if (force) {
                     libxl__device_destroy(gc, &dev);

_______________________________________________
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] libxl: use more descriptive variable names in libxl__devices_destroy., Xen patchbot-unstable <=