From 6eee7b8d22296d21f1363ff69bb365648d74271e Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Thu, 6 Feb 2014 17:43:04 +0100
Subject: [PATCH] generator: add a GUID parameter type
At the moment it is basically the change as String, and it is mapped as
if it was such.
(cherry picked from commit b10dd601fb07eb3d8bf76b5f9fcac1c7fe59d4d5)
---
generator/bindtests.ml | 3 ++-
generator/c.ml | 11 +++++++----
generator/csharp.ml | 6 ++++--
generator/daemon.ml | 5 +++--
generator/erlang.ml | 3 ++-
generator/fish.ml | 11 +++++++----
generator/gobject.ml | 8 +++++---
generator/haskell.ml | 8 ++++----
generator/java.ml | 15 ++++++++++-----
generator/lua.ml | 6 +++---
generator/ocaml.ml | 9 ++++++---
generator/perl.ml | 8 ++++----
generator/php.ml | 12 +++++++-----
generator/python.ml | 12 ++++++------
generator/ruby.ml | 4 ++--
generator/tests_c_api.ml | 6 ++++--
generator/types.ml | 6 ++++++
generator/utils.ml | 3 ++-
generator/xdr.ml | 2 +-
19 files changed, 85 insertions(+), 53 deletions(-)
diff --git a/generator/bindtests.ml b/generator/bindtests.ml
index 4f99021..55b6a81 100644
--- a/generator/bindtests.ml
+++ b/generator/bindtests.ml
@@ -131,7 +131,8 @@ print_strings (guestfs_h *g, char *const *argv)
| String n
| FileIn n
| FileOut n
- | Key n -> pr " fprintf (fp, \"%%s\\n\", %s);\n" n
+ | Key n
+ | GUID n -> pr " fprintf (fp, \"%%s\\n\", %s);\n" n
| BufferIn n ->
pr " {\n";
pr " size_t i;\n";
diff --git a/generator/c.ml b/generator/c.ml
index 451c28d..1ce9e9f 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -124,7 +124,8 @@ let rec generate_prototype ?(extern = true) ?(static = false)
| Device n | Dev_or_Path n
| String n
| OptString n
- | Key n ->
+ | Key n
+ | GUID n ->
next ();
pr "const char *%s" n
| Mountable n | Mountable_or_Path n ->
@@ -962,7 +963,8 @@ and generate_client_actions hash () =
| StringList n
| DeviceList n
| Key n
- | Pointer (_, n) ->
+ | Pointer (_, n)
+ | GUID n ->
pr " if (%s == NULL) {\n" n;
pr " error (g, \"%%s: %%s: parameter cannot be NULL\",\n";
pr " \"%s\", \"%s\");\n" c_name n;
@@ -1075,7 +1077,8 @@ and generate_client_actions hash () =
| Pathname n
| Dev_or_Path n | Mountable_or_Path n
| FileIn n
- | FileOut n ->
+ | FileOut n
+ | GUID n ->
(* guestfish doesn't support string escaping, so neither do we *)
pr " fprintf (trace_buffer.fp, \" \\\"%%s\\\"\", %s);\n" n
| Key n ->
@@ -1397,7 +1400,7 @@ and generate_client_actions hash () =
function
| Pathname n | Device n | Mountable n | Dev_or_Path n
| Mountable_or_Path n | String n
- | Key n ->
+ | Key n | GUID n ->
pr " args.%s = (char *) %s;\n" n n
| OptString n ->
pr " args.%s = %s ? (char **) &%s : NULL;\n" n n n
diff --git a/generator/csharp.ml b/generator/csharp.ml
index 04ef94c..0facbde 100644
--- a/generator/csharp.ml
+++ b/generator/csharp.ml
@@ -192,7 +192,8 @@ namespace Guestfs
| OptString n
| FileIn n | FileOut n
| Key n
- | BufferIn n ->
+ | BufferIn n
+ | GUID n ->
pr ", [In] string %s" n
| StringList n | DeviceList n ->
pr ", [In] string[] %s" n
@@ -220,7 +221,8 @@ namespace Guestfs
| OptString n
| FileIn n | FileOut n
| Key n
- | BufferIn n ->
+ | BufferIn n
+ | GUID n ->
next (); pr "string %s" n
| StringList n | DeviceList n ->
next (); pr "string[] %s" n
diff --git a/generator/daemon.ml b/generator/daemon.ml
index b08a9c2..2e39783 100644
--- a/generator/daemon.ml
+++ b/generator/daemon.ml
@@ -219,7 +219,8 @@ and generate_daemon_actions () =
List.iter (
function
| Device n | Dev_or_Path n
- | Pathname n | String n | Key n | OptString n -> pr " char *%s;\n" n
+ | Pathname n | String n | Key n | OptString n | GUID n ->
+ pr " char *%s;\n" n
| Mountable n | Mountable_or_Path n -> pr " mountable_t %s;\n" n
| StringList n | DeviceList n -> pr " char **%s;\n" n
| Bool n -> pr " int %s;\n" n
@@ -323,7 +324,7 @@ and generate_daemon_actions () =
| Mountable_or_Path n ->
pr " REQUIRE_ROOT_OR_RESOLVE_MOUNTABLE(args.%s, %s, %s, goto done);\n"
n n (if is_filein then "cancel_receive ()" else "");
- | String n | Key n -> pr_args n
+ | String n | Key n | GUID n -> pr_args n
| OptString n -> pr " %s = args.%s ? *args.%s : NULL;\n" n n n
| StringList n ->
pr_list_handling_code n;
diff --git a/generator/erlang.ml b/generator/erlang.ml
index b52cf1f..f0c9c6a 100644
--- a/generator/erlang.ml
+++ b/generator/erlang.ml
@@ -297,7 +297,8 @@ extern int64_t get_int64 (ETERM *term);
| String n
| FileIn n
| FileOut n
- | Key n ->
+ | Key n
+ | GUID n ->
pr " CLEANUP_FREE char *%s = erl_iolist_to_string (ARG (%d));\n" n i
| OptString n ->
pr " CLEANUP_FREE char *%s;\n" n;
diff --git a/generator/fish.ml b/generator/fish.ml
index db4b39d..29923db 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -326,7 +326,8 @@ Guestfish will prompt for these separately."
function
| Device n | Mountable n
| String n
- | OptString n -> pr " const char *%s;\n" n
+ | OptString n
+ | GUID n -> pr " const char *%s;\n" n
| Pathname n
| Dev_or_Path n | Mountable_or_Path n
| FileIn n
@@ -408,7 +409,7 @@ Guestfish will prompt for these separately."
List.iter (
function
| Device name | Mountable name
- | String name ->
+ | String name | GUID name ->
pr " %s = argv[i++];\n" name
| Pathname name
| Dev_or_Path name | Mountable_or_Path name ->
@@ -621,7 +622,8 @@ Guestfish will prompt for these separately."
function
| Device _ | Mountable _ | String _
| OptString _
- | BufferIn _ -> ()
+ | BufferIn _
+ | GUID _ -> ()
| Bool name
| Int name | Int64 name ->
pr " out_%s:\n" name
@@ -853,7 +855,8 @@ and generate_fish_actions_pod () =
List.iter (
function
| Pathname n | Device n | Mountable n
- | Dev_or_Path n | Mountable_or_Path n | String n ->
+ | Dev_or_Path n | Mountable_or_Path n | String n
+ | GUID n ->
pr " %s" n
| OptString n -> pr " %s" n
| StringList n | DeviceList n -> pr " '%s ...'" n
diff --git a/generator/gobject.ml b/generator/gobject.ml
index 4159c1e..3cbc9c0 100644
--- a/generator/gobject.ml
+++ b/generator/gobject.ml
@@ -81,7 +81,8 @@ let generate_gobject_proto name ?(single_line = true)
| OptString n
| Key n
| FileIn n
- | FileOut n ->
+ | FileOut n
+ | GUID n ->
pr "const gchar *%s" n
| StringList n
| DeviceList n ->
@@ -1031,7 +1032,7 @@ guestfs_session_close(GuestfsSession *session, GError **err)
pr " (type gint32):"
| Int64 _ ->
pr " (type gint64):"
- | String _ | Key _ ->
+ | String _ | Key _ | GUID _ ->
pr " (transfer none) (type utf8):"
| OptString _ ->
pr " (transfer none) (type utf8) (allow-none):"
@@ -1190,7 +1191,8 @@ guestfs_session_close(GuestfsSession *session, GError **err)
| Bool n | Int n | Int64 n | String n | Device n | Mountable n
| Pathname n | Dev_or_Path n | Mountable_or_Path n
| OptString n | StringList n
- | DeviceList n | Key n | FileIn n | FileOut n ->
+ | DeviceList n | Key n | FileIn n | FileOut n
+ | GUID n ->
pr "%s" n
| Pointer _ ->
failwith "gobject bindings do not support Pointer arguments"
diff --git a/generator/haskell.ml b/generator/haskell.ml
index 0bf8551..2bd7625 100644
--- a/generator/haskell.ml
+++ b/generator/haskell.ml
@@ -142,7 +142,7 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
| FileOut n
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n
- | Key n ->
+ | Key n | GUID n ->
pr "withCString %s $ \\%s -> " n n
| BufferIn n ->
pr "withCStringLen %s $ \\(%s, %s_size) -> " n n n
@@ -162,7 +162,7 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
| Dev_or_Path n | Mountable_or_Path n
| String n | OptString n
| StringList n | DeviceList n
- | Key n -> n
+ | Key n | GUID n -> n
| BufferIn n -> sprintf "%s (fromIntegral %s_size)" n n
) args in
pr "withForeignPtr h (\\p -> c_%s %s)\n" name
@@ -218,7 +218,7 @@ and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
(match arg with
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _
- | Key _ ->
+ | Key _ | GUID _ ->
pr "CString"
| BufferIn _ ->
pr "CString -> CInt"
@@ -261,7 +261,7 @@ and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
(match arg with
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _
- | Key _ ->
+ | Key _ | GUID _ ->
pr "String"
| BufferIn _ ->
pr "String"
diff --git a/generator/java.ml b/generator/java.ml
index 98896e0..29d2641 100644
--- a/generator/java.ml
+++ b/generator/java.ml
@@ -452,7 +452,8 @@ and generate_java_prototype ?(public=false) ?(privat=false) ?(native=false)
| OptString n
| FileIn n
| FileOut n
- | Key n ->
+ | Key n
+ | GUID n ->
pr "String %s" n
| BufferIn n ->
pr "byte[] %s" n
@@ -812,7 +813,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
| OptString n
| FileIn n
| FileOut n
- | Key n ->
+ | Key n
+ | GUID n ->
pr ", jstring j%s" n
| BufferIn n ->
pr ", jbyteArray j%s" n
@@ -881,7 +883,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
| OptString n
| FileIn n
| FileOut n
- | Key n ->
+ | Key n
+ | GUID n ->
pr " const char *%s;\n" n
| BufferIn n ->
pr " char *%s;\n" n;
@@ -937,7 +940,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
| String n
| FileIn n
| FileOut n
- | Key n ->
+ | Key n
+ | GUID n ->
pr " %s = (*env)->GetStringUTFChars (env, j%s, NULL);\n" n n
| OptString n ->
(* This is completely undocumented, but Java null becomes
@@ -1004,7 +1008,8 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
| String n
| FileIn n
| FileOut n
- | Key n ->
+ | Key n
+ | GUID n ->
pr " (*env)->ReleaseStringUTFChars (env, j%s, %s);\n" n n
| OptString n ->
pr " if (j%s)\n" n;
diff --git a/generator/lua.ml b/generator/lua.ml
index f44c027..c8375af 100644
--- a/generator/lua.ml
+++ b/generator/lua.ml
@@ -459,7 +459,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
function
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n
- | FileIn n | FileOut n | Key n ->
+ | FileIn n | FileOut n | Key n | GUID n ->
pr " const char *%s;\n" n
| BufferIn n ->
pr " const char *%s;\n" n;
@@ -490,7 +490,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
function
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n
- | FileIn n | FileOut n | Key n ->
+ | FileIn n | FileOut n | Key n | GUID n ->
pr " %s = luaL_checkstring (L, %d);\n" n i
| BufferIn n ->
pr " %s = luaL_checklstring (L, %d, &%s_size);\n" n i n
@@ -554,7 +554,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
| FileIn _ | FileOut _ | Key _
| BufferIn _ | OptString _
| Bool _ | Int _ | Int64 _
- | Pointer _ -> ()
+ | Pointer _ | GUID _ -> ()
| StringList n | DeviceList n ->
pr " free (%s);\n" n
) args;
diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index 760e754..7af6d3f 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
@@ -501,7 +501,8 @@ copy_table (char * const * argv)
| String n
| FileIn n
| FileOut n
- | Key n ->
+ | Key n
+ | GUID n ->
(* Copy strings in case the GC moves them: RHBZ#604691 *)
pr " char *%s = guestfs___safe_strdup (g, String_val (%sv));\n" n n
| OptString n ->
@@ -585,7 +586,8 @@ copy_table (char * const * argv)
function
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n
- | OptString n | FileIn n | FileOut n | BufferIn n | Key n ->
+ | OptString n | FileIn n | FileOut n | BufferIn n
+ | Key n | GUID n ->
pr " free (%s);\n" n
| StringList n | DeviceList n ->
pr " guestfs___free_string_list (%s);\n" n;
@@ -715,7 +717,8 @@ and generate_ocaml_function_type ?(extra_unit = false) (ret, args, optargs) =
function
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _
- | FileIn _ | FileOut _ | BufferIn _ | Key _ -> pr "string -> "
+ | FileIn _ | FileOut _ | BufferIn _ | Key _
+ | GUID _ -> pr "string -> "
| OptString _ -> pr "string option -> "
| StringList _ | DeviceList _ -> pr "string array -> "
| Bool _ -> pr "bool -> "
diff --git a/generator/perl.ml b/generator/perl.ml
index 9b7c25a..312268c 100644
--- a/generator/perl.ml
+++ b/generator/perl.ml
@@ -354,7 +354,7 @@ PREINIT:
function
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n
- | FileIn n | FileOut n | Key n ->
+ | FileIn n | FileOut n | Key n | GUID n ->
pr " char *%s;\n" n
| BufferIn n ->
pr " char *%s;\n" n;
@@ -509,7 +509,7 @@ PREINIT:
| Dev_or_Path _ | Mountable_or_Path _ | String _
| OptString _ | Bool _ | Int _ | Int64 _
| FileIn _ | FileOut _
- | BufferIn _ | Key _ | Pointer _ -> ()
+ | BufferIn _ | Key _ | Pointer _ | GUID _ -> ()
| StringList n | DeviceList n -> pr " free (%s);\n" n
) args;
@@ -937,7 +937,7 @@ errnos:
| Dev_or_Path n -> pr "[ '%s', 'string(dev_or_path)', %d ]" n i
| Mountable_or_Path n ->
pr "[ '%s', 'string(mountable_or_path)', %d ]" n i
- | String n -> pr "[ '%s', 'string', %d ]" n i
+ | String n | GUID n -> pr "[ '%s', 'string', %d ]" n i
| FileIn n -> pr "[ '%s', 'string(filename)', %d ]" n i
| FileOut n -> pr "[ '%s', 'string(filename)', %d ]" n i
| Key n -> pr "[ '%s', 'string(key)', %d ]" n i
@@ -1105,7 +1105,7 @@ and generate_perl_prototype name (ret, args, optargs) =
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n
| OptString n | Bool n | Int n | Int64 n | FileIn n | FileOut n
- | BufferIn n | Key n | Pointer (_, n) ->
+ | BufferIn n | Key n | Pointer (_, n) | GUID n ->
pr "$%s" n
| StringList n | DeviceList n ->
pr "\\@%s" n
diff --git a/generator/php.ml b/generator/php.ml
index f27c5f4..650e10e 100644
--- a/generator/php.ml
+++ b/generator/php.ml
@@ -192,7 +192,8 @@ PHP_FUNCTION (guestfs_last_error)
| Dev_or_Path n | Mountable_or_Path n
| FileIn n | FileOut n | Key n
| OptString n
- | BufferIn n ->
+ | BufferIn n
+ | GUID n ->
pr " char *%s;\n" n;
pr " int %s_size;\n" n
| StringList n
@@ -235,7 +236,8 @@ PHP_FUNCTION (guestfs_last_error)
function
| String n | Device n | Mountable n | Pathname n
| Dev_or_Path n | Mountable_or_Path n
- | FileIn n | FileOut n | BufferIn n | Key n -> "s"
+ | FileIn n | FileOut n | BufferIn n | Key n
+ | GUID n -> "s"
| OptString n -> "s!"
| StringList n | DeviceList n -> "a"
| Bool n -> "b"
@@ -269,7 +271,7 @@ PHP_FUNCTION (guestfs_last_error)
| String n | Device n | Mountable n | Pathname n
| Dev_or_Path n | Mountable_or_Path n
| FileIn n | FileOut n | BufferIn n | Key n
- | OptString n ->
+ | OptString n | GUID n ->
pr ", &%s, &%s_size" n n
| StringList n | DeviceList n ->
pr ", &z_%s" n
@@ -303,7 +305,7 @@ PHP_FUNCTION (guestfs_last_error)
| String n | Device n | Mountable n | Pathname n
| Dev_or_Path n | Mountable_or_Path n
| FileIn n | FileOut n | Key n
- | OptString n ->
+ | OptString n | GUID n ->
(* Just need to check the string doesn't contain any ASCII
* NUL characters, which won't be supported by the C API.
*)
@@ -434,7 +436,7 @@ PHP_FUNCTION (guestfs_last_error)
| String n | Device n | Mountable n | Pathname n
| Dev_or_Path n | Mountable_or_Path n
| FileIn n | FileOut n | Key n
- | OptString n -> ()
+ | OptString n | GUID n -> ()
| BufferIn n -> ()
| StringList n
| DeviceList n ->
diff --git a/generator/python.ml b/generator/python.ml
index a3e2271..b0a5a2b 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -281,7 +281,7 @@ put_table (char * const * const argv)
function
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n | Key n
- | FileIn n | FileOut n ->
+ | FileIn n | FileOut n | GUID n ->
pr " const char *%s;\n" n
| OptString n -> pr " const char *%s;\n" n
| BufferIn n ->
@@ -319,7 +319,7 @@ put_table (char * const * const argv)
function
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
- | FileIn _ | FileOut _ -> pr "s"
+ | FileIn _ | FileOut _ | GUID _ -> pr "s"
| OptString _ -> pr "z"
| StringList _ | DeviceList _ -> pr "O"
| Bool _ -> pr "i" (* XXX Python has booleans? *)
@@ -341,7 +341,7 @@ put_table (char * const * const argv)
function
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n | Key n
- | FileIn n | FileOut n -> pr ", &%s" n
+ | FileIn n | FileOut n | GUID n -> pr ", &%s" n
| OptString n -> pr ", &%s" n
| StringList n | DeviceList n -> pr ", &py_%s" n
| Bool n -> pr ", &%s" n
@@ -365,7 +365,7 @@ put_table (char * const * const argv)
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
| FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
- | BufferIn _ -> ()
+ | BufferIn _ | GUID _ -> ()
| StringList n | DeviceList n ->
pr " %s = get_string_list (py_%s);\n" n n;
pr " if (!%s) goto out;\n" n
@@ -502,7 +502,7 @@ put_table (char * const * const argv)
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
| FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
- | BufferIn _ | Pointer _ -> ()
+ | BufferIn _ | Pointer _ | GUID _ -> ()
| StringList n | DeviceList n ->
pr " free (%s);\n" n
) args;
@@ -796,7 +796,7 @@ class GuestFS(object):
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
| FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
- | BufferIn _ | Pointer _ -> ()
+ | BufferIn _ | Pointer _ | GUID _ -> ()
| StringList n | DeviceList n ->
pr " %s = list (%s)\n" n n
) args;
diff --git a/generator/ruby.ml b/generator/ruby.ml
index d6ca430..3a7d05d 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -518,7 +518,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
function
| Pathname n | Device n | Mountable n
| Dev_or_Path n | Mountable_or_Path n | String n | Key n
- | FileIn n | FileOut n ->
+ | FileIn n | FileOut n | GUID n ->
pr " const char *%s = StringValueCStr (%sv);\n" n n;
| BufferIn n ->
pr " Check_Type (%sv, T_STRING);\n" n;
@@ -622,7 +622,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
| Pathname _ | Device _ | Mountable _
| Dev_or_Path _ | Mountable_or_Path _ | String _ | Key _
| FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
- | BufferIn _ | Pointer _ -> ()
+ | BufferIn _ | Pointer _ | GUID _ -> ()
| StringList n | DeviceList n ->
pr " free (%s);\n" n
) args;
diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml
index 1c85db8..e6a5d22 100644
--- a/generator/tests_c_api.ml
+++ b/generator/tests_c_api.ml
@@ -384,7 +384,8 @@ and generate_test_command_call ?(expect_error = false) ?test ?ret test_name cmd=
| Mountable_or_Path _, arg, sym
| String _, arg, sym
| OptString _, arg, sym
- | Key _, arg, sym ->
+ | Key _, arg, sym
+ | GUID _, arg, sym ->
pr " const char *%s = \"%s\";\n" sym (c_quote arg);
| BufferIn _, arg, sym ->
pr " const char *%s = \"%s\";\n" sym (c_quote arg);
@@ -504,7 +505,8 @@ and generate_test_command_call ?(expect_error = false) ?test ?ret test_name cmd=
| String _, _, sym
| OptString _, _, sym
| Key _, _, sym
- | FileIn _, _, sym -> pr ", %s" sym
+ | FileIn _, _, sym
+ | GUID _, _, sym -> pr ", %s" sym
| BufferIn _, _, sym -> pr ", %s, %s_size" sym sym
| FileOut _, arg, _ -> pr ", \"%s\"" (c_quote arg)
| StringList _, _, sym | DeviceList _, _, sym -> pr ", (char **) %s" sym
diff --git a/generator/types.ml b/generator/types.ml
index 9827395..963fd83 100644
--- a/generator/types.ml
+++ b/generator/types.ml
@@ -184,6 +184,12 @@ and argt =
* tests, although we should fix this in future.
*)
| Pointer of (string * string)
+ (* const char * which represents a GUID string.
+ *
+ * It cannot be NULL, and it will be validated using
+ * guestfs___validate_guid.
+ *)
+ | GUID of string
and optargs = optargt list
diff --git a/generator/utils.ml b/generator/utils.ml
index 21a47a3..1540a6b 100644
--- a/generator/utils.ml
+++ b/generator/utils.ml
@@ -253,7 +253,8 @@ let name_of_argt = function
| Pathname n | Device n | Mountable n | Dev_or_Path n
| Mountable_or_Path n | String n | OptString n
| StringList n | DeviceList n | Bool n | Int n | Int64 n
- | FileIn n | FileOut n | BufferIn n | Key n | Pointer (_, n) -> n
+ | FileIn n | FileOut n | BufferIn n | Key n | Pointer (_, n)
+ | GUID n -> n
let name_of_optargt = function
| OBool n | OInt n | OInt64 n | OString n | OStringList n -> n
diff --git a/generator/xdr.ml b/generator/xdr.ml
index 0d1b4e3..432389a 100644
--- a/generator/xdr.ml
+++ b/generator/xdr.ml
@@ -112,7 +112,7 @@ let generate_xdr () =
function
| Pathname n | Device n | Mountable n | Dev_or_Path n
| Mountable_or_Path n | String n
- | Key n ->
+ | Key n | GUID n ->
pr " string %s<>;\n" n
| OptString n -> pr " guestfs_str *%s;\n" n
| StringList n | DeviceList n -> pr " guestfs_str %s<>;\n" n
--
1.8.3.1