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

xen-devel

[Top] [All Lists]

[Xen-devel] [PATCH 16 of 23] libxl: use more descriptive variable names

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 16 of 23] libxl: use more descriptive variable names in libxl__devices_destroy
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: 2011年9月30日 14:33:29 +0100
Cc: Jim Fehlig <jfehlig@xxxxxxxxxx>, Mike McClurg <mike.mcclurg@xxxxxxxxxx>, Dave Scott <Dave.Scott@xxxxxxxxxxxxx>, Jonathan Ludlam <Jonathan.Ludlam@xxxxxxxxxxxxx>
Delivery-date: 2011年9月30日 06:50:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1317389593@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1317389593@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1317389248 -3600
# Node ID b3e80fe9f014f03700ca4846dde58d3473236223
# Parent 7a8cd032b63cf91d3fe04501997405d53cf5d8b3
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>
diff -r 7a8cd032b63c -r b3e80fe9f014 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Fri Sep 30 14:27:28 2011 +0100
+++ b/tools/libxl/libxl_device.c Fri Sep 30 14:27:28 2011 +0100
@@ -460,39 +460,40 @@ int libxl__devices_destroy(libxl__gc *gc
 {
 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;
 if (kind == LIBXL__DEVICE_KIND_VBD)
 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_force_remove(gc, &dev);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
Previous by Date: [Xen-devel] [PATCH 14 of 23] libxl: use libxl__device in libxl_devices_destroy and libxl__device_pci_remove_xenstore , Ian Campbell
Next by Date: [Xen-devel] [PATCH 17 of 23] libxl: convert disk handling to device API , Ian Campbell
Previous by Thread: [Xen-devel] [PATCH 14 of 23] libxl: use libxl__device in libxl_devices_destroy and libxl__device_pci_remove_xenstore , Ian Campbell
Next by Thread: [Xen-devel] [PATCH 17 of 23] libxl: convert disk handling to device API , Ian Campbell
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /