[Libguestfs] [PATCH 2/3] generator: Don't hard-code name in DeviceList check.
Richard W.M. Jones
rjones at redhat.com
Fri Jul 16 12:05:33 UTC 2010
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
-------------- next part --------------
>From d77d63c56c03b367df5b6757e8f356e40ca5f386 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Fri, 16 Jul 2010 12:57:24 +0100
Subject: [PATCH 2/3] generator: Don't hard-code name in DeviceList check.
Only one function currently uses DeviceList. The generated code
unfortunately hard-coded the argument name from that function.
---
src/generator.ml | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/generator.ml b/src/generator.ml
index d640343..cb3f773 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -6484,9 +6484,12 @@ and generate_daemon_actions () =
| DeviceList n ->
pr_list_handling_code n;
pr " /* Ensure that each is a device,\n";
- pr " * and perform device name translation. */\n";
- pr " { int pvi; for (pvi = 0; physvols[pvi] != NULL; ++pvi)\n";
- pr " RESOLVE_DEVICE (physvols[pvi], %s, goto done);\n"
+ pr " * and perform device name translation.\n";
+ pr " */\n";
+ pr " {\n";
+ pr " int i;\n";
+ pr " for (i = 0; %s[i] != NULL; ++i)\n" n;
+ pr " RESOLVE_DEVICE (%s[i], %s, goto done);\n" n
(if is_filein then "cancel_receive ()" else "0");
pr " }\n";
| Bool n -> pr " %s = args.%s;\n" n n
--
1.7.1
More information about the Libguestfs
mailing list