generator: Don't hard-code name in DeviceList check.
authorRichard Jones <rjones@redhat.com>
Fri, 16 Jul 2010 11:57:24 +0000 (12:57 +0100)
committerRichard Jones <rjones@redhat.com>
Tue, 17 Aug 2010 14:29:03 +0000 (15:29 +0100)
Only one function currently uses DeviceList.  The generated code
unfortunately hard-coded the argument name from that function.
(cherry picked from commit aac51942aab63a9355ad6724345ea923148bf2a9)

src/generator.ml

index d640343..cb3f773 100755 (executable)
@@ -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