[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH libguestfs 10/23] update generator to emit each RESOLVE_DEVICE call



From: Jim Meyering <meyering redhat com>

* src/generator.ml: Emit RESOLVE_DEVICE (device, goto done);
just before each Device-enabled do_$FUNCTION.
---
 src/generator.ml |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/generator.ml b/src/generator.ml
index 8159027..20fe5c1 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4475,7 +4475,6 @@ check_state (guestfs_h *g, const char *caller)
        | args ->
            List.iter (
              function
-	     (* FIXME *)
              | Device n | String n ->
                  pr "  args.%s = (char *) %s;\n" n n
              | OptString n ->
@@ -4685,7 +4684,6 @@ and generate_daemon_actions () =
                 * allow device name translation.  This is safe because
                 * we can modify the string (passed from RPC).
                 *)
-	       (* FIXME *)
              | Device n | String n
              | OptString n -> pr "  char *%s;\n" n
              | StringList n -> pr "  char **%s;\n" n
@@ -4707,7 +4705,10 @@ and generate_daemon_actions () =
            pr "  }\n";
            List.iter (
              function
-             | Device n | String n -> pr "  %s = args.%s;\n" n n
+             | Device n ->
+                 pr "  %s = args.%s;\n" n n;
+                 pr "  RESOLVE_DEVICE (%s, goto done);" n;
+             | String n -> pr "  %s = args.%s;\n" n n
              | OptString n -> pr "  %s = args.%s ? *args.%s : NULL;\n" n n n
              | StringList n ->
                  pr "  %s = realloc (args.%s.%s_val,\n" n n n;
@@ -6232,7 +6233,6 @@ and generate_prototype ?(extern = true) ?(static = false) ?(semicolon = true)
       | String n
       | OptString n ->
           next ();
-(* FIXME *)
           if not in_daemon then pr "const char *%s" n
           else pr "char *%s" n
       | StringList n ->
@@ -7448,7 +7448,7 @@ py_guestfs_close (PyObject *self, PyObject *args)
       List.iter (
         function
         | Device _ | String _
-	| FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ -> ()
+        | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ -> ()
         | StringList n ->
             pr "  %s = get_string_list (py_%s);\n" n n;
             pr "  if (!%s) return NULL;\n" n
@@ -7463,7 +7463,7 @@ py_guestfs_close (PyObject *self, PyObject *args)
       List.iter (
         function
         | Device _ | String _
-	| FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ -> ()
+        | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ -> ()
         | StringList n ->
             pr "  free (%s);\n" n
       ) (snd style);
@@ -7824,7 +7824,7 @@ static VALUE ruby_guestfs_close (VALUE gv)
       List.iter (
         function
         | Device _ | String _
-	| FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ -> ()
+        | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ -> ()
         | StringList n ->
             pr "  free (%s);\n" n
       ) (snd style);
-- 
1.6.4.337.g5420e


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]