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

Re: [Libguestfs] [PATCH 1/3] generator: Add new Mountable argument type



On Thu, Jan 24, 2013 at 10:19:48AM +0000, Matthew Booth wrote:
> This type is initially identical to Device.
> ---
>  generator/bindtests.ml   |  2 +-
>  generator/c.ml           |  7 +++++--
>  generator/csharp.ml      |  6 ++++--
>  generator/daemon.ml      |  4 ++--
>  generator/erlang.ml      |  6 +++---
>  generator/fish.ml        |  8 ++++----
>  generator/gobject.ml     | 11 ++++++-----
>  generator/haskell.ml     | 11 +++++++----
>  generator/java.ml        | 10 +++++-----
>  generator/lua.ml         |  6 +++---
>  generator/ocaml.ml       | 10 +++++-----
>  generator/perl.ml        |  9 +++++----
>  generator/php.ml         | 10 +++++-----
>  generator/python.ml      | 12 ++++++------
>  generator/ruby.ml        |  4 ++--
>  generator/tests_c_api.ml |  3 ++-
>  generator/types.ml       |  1 +
>  generator/utils.ml       |  2 +-
>  generator/xdr.ml         |  3 ++-
>  19 files changed, 69 insertions(+), 56 deletions(-)
> 
> diff --git a/generator/bindtests.ml b/generator/bindtests.ml
> index b707427..774a3f3 100644
> --- a/generator/bindtests.ml
> +++ b/generator/bindtests.ml
> @@ -127,7 +127,7 @@ print_strings (guestfs_h *g, char *const *argv)
>        List.iter (
>          function
>          | Pathname n
> -        | Device n | Dev_or_Path n
> +        | Device n | Mountable n | Dev_or_Path n
>          | String n
>          | FileIn n
>          | FileOut n
> diff --git a/generator/c.ml b/generator/c.ml
> index b9d4b35..c20f502 100644
> --- a/generator/c.ml
> +++ b/generator/c.ml
> @@ -109,7 +109,7 @@ let rec generate_prototype ?(extern = true) ?(static = false)
>      List.iter (
>        function
>        | Pathname n
> -      | Device n | Dev_or_Path n
> +      | Device n | Mountable n | Dev_or_Path n
>        | String n
>        | OptString n
>        | Key n ->
> @@ -793,6 +793,7 @@ and generate_client_actions hash () =
>        (* parameters which should not be NULL *)
>        | String n
>        | Device n
> +      | Mountable n
>        | Pathname n
>        | Dev_or_Path n
>        | FileIn n
> @@ -910,6 +911,7 @@ and generate_client_actions hash () =
>        function
>        | String n			(* strings *)
>        | Device n
> +      | Mountable n
>        | Pathname n
>        | Dev_or_Path n
>        | FileIn n
> @@ -1225,7 +1227,8 @@ and generate_client_actions hash () =
>      ) else (
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n | Key n ->
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
> +        | Key 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 803a4a5..9d4ea68 100644
> --- a/generator/csharp.ml
> +++ b/generator/csharp.ml
> @@ -187,7 +187,8 @@ namespace Guestfs
>            (c_return_type ()) c_function;
>          List.iter (
>            function
> -          | Pathname n | Device n | Dev_or_Path n | String n | OptString n
> +          | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
> +          | OptString n
>            | FileIn n | FileOut n
>            | Key n
>            | BufferIn n ->
> @@ -213,7 +214,8 @@ namespace Guestfs
>          in
>          List.iter (
>            function
> -          | Pathname n | Device n | Dev_or_Path n | String n | OptString n
> +          | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
> +          | OptString n
>            | FileIn n | FileOut n
>            | Key n
>            | BufferIn n ->
> diff --git a/generator/daemon.ml b/generator/daemon.ml
> index 3c2f949..a7096a1 100644
> --- a/generator/daemon.ml
> +++ b/generator/daemon.ml
> @@ -111,7 +111,7 @@ and generate_daemon_actions () =
>          pr "  struct guestfs_%s_args args;\n" name;
>          List.iter (
>            function
> -          | Device n | Dev_or_Path n
> +          | Device n | Mountable n | Dev_or_Path n
>            | Pathname n
>            | String n
>            | Key n
> @@ -205,7 +205,7 @@ and generate_daemon_actions () =
>                pr_args n;
>                pr "  ABS_PATH (%s, %s, goto done);\n"
>                  n (if is_filein then "cancel_receive ()" else "");
> -          | Device n ->
> +          | Device n | Mountable n ->
>                pr_args n;
>                pr "  RESOLVE_DEVICE (%s, %s, goto done);\n"
>                  n (if is_filein then "cancel_receive ()" else "");
> diff --git a/generator/erlang.ml b/generator/erlang.ml
> index 6c7eb70..ef1f01f 100644
> --- a/generator/erlang.ml
> +++ b/generator/erlang.ml
> @@ -293,7 +293,7 @@ extern void free_strings (char **r);
>          fun i ->
>            function
>            | Pathname n
> -          | Device n | Dev_or_Path n
> +          | Device n | Mountable n | Dev_or_Path n
>            | String n
>            | FileIn n
>            | FileOut n
> @@ -386,8 +386,8 @@ extern void free_strings (char **r);
>        (* Free strings if we copied them above. *)
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n | OptString n
> -        | FileIn n | FileOut n | Key n ->
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
> +        | OptString n | FileIn n | FileOut n | Key n ->
>              pr "  free (%s);\n" n
>          | StringList n | DeviceList n ->
>              pr "  free_strings (%s);\n" n;
> diff --git a/generator/fish.ml b/generator/fish.ml
> index 59c1114..c1686cf 100644
> --- a/generator/fish.ml
> +++ b/generator/fish.ml
> @@ -328,7 +328,7 @@ Guestfish will prompt for these separately."
>        );
>        List.iter (
>          function
> -        | Device n
> +        | Device n | Mountable n
>          | String n
>          | OptString n -> pr "  const char *%s;\n" n
>          | Pathname n
> @@ -411,7 +411,7 @@ Guestfish will prompt for these separately."
>  
>        List.iter (
>          function
> -        | Device name
> +        | Device name | Mountable name
>          | String name ->
>              pr "  %s = argv[i++];\n" name
>          | Pathname name
> @@ -616,7 +616,7 @@ Guestfish will prompt for these separately."
>        ) (List.rev optargs);
>        List.iter (
>          function
> -        | Device _ | String _
> +        | Device _ | Mountable _ | String _
>          | OptString _ | Bool _
>          | BufferIn _ -> ()
>          | Int name | Int64 name ->
> @@ -858,7 +858,7 @@ and generate_fish_actions_pod () =
>        pr " %s" name;
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n ->
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String 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 6c35e02..ea3fecc 100644
> --- a/generator/gobject.ml
> +++ b/generator/gobject.ml
> @@ -75,7 +75,7 @@ let generate_gobject_proto name ?(single_line = true)
>        | Int64 n->
>          pr "gint64 %s" n
>        | String n
> -      | Device n
> +      | Device n | Mountable n
>        | Pathname n
>        | Dev_or_Path n
>        | OptString n
> @@ -1033,7 +1033,8 @@ guestfs_session_close(GuestfsSession *session, GError **err)
>              pr " (transfer none) (type utf8):"
>            | OptString _ ->
>              pr " (transfer none) (type utf8) (allow-none):"
> -          | Device _ | Pathname _ | Dev_or_Path _ | FileIn _ | FileOut _ ->
> +          | Device _ | Mountable _ | Pathname _ | Dev_or_Path _
> +          | FileIn _ | FileOut _ ->
>              pr " (transfer none) (type filename):"
>            | StringList _ ->
>              pr " (transfer none) (array zero-terminated=1) (element-type utf8): an array of strings"
> @@ -1183,9 +1184,9 @@ guestfs_session_close(GuestfsSession *session, GError **err)
>            match argt with
>            | BufferIn n ->
>              pr "%s, %s_size" n n
> -          | Bool n | Int n | Int64 n | String n | Device n | Pathname n
> -          | Dev_or_Path n | OptString n | StringList n | DeviceList n
> -          | Key n | FileIn n | FileOut n ->
> +          | Bool n | Int n | Int64 n | String n | Device n | Mountable n
> +          | Pathname n | Dev_or_Path n | OptString n | StringList n
> +          | DeviceList n | Key n | FileIn n | FileOut n ->
>              pr "%s" n
>            | Pointer _ ->
>              failwith "gobject bindings do not support Pointer arguments"
> diff --git a/generator/haskell.ml b/generator/haskell.ml
> index abd0478..66628bd 100644
> --- a/generator/haskell.ml
> +++ b/generator/haskell.ml
> @@ -140,7 +140,8 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
>            function
>            | FileIn n
>            | FileOut n
> -          | Pathname n | Device n | Dev_or_Path n | String n | Key n ->
> +          | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
> +          | Key n ->
>                pr "withCString %s $ \\%s -> " n n
>            | BufferIn n ->
>                pr "withCStringLen %s $ \\(%s, %s_size) -> " n n n
> @@ -156,7 +157,7 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
>              | Int n -> sprintf "(fromIntegral %s)" n
>              | Int64 n | Pointer (_, n) -> sprintf "(fromIntegral %s)" n
>              | FileIn n | FileOut n
> -            | Pathname n | Device n | Dev_or_Path n
> +            | Pathname n | Device n | Mountable n | Dev_or_Path n
>              | String n | OptString n
>              | StringList n | DeviceList n
>              | Key n -> n
> @@ -213,7 +214,8 @@ and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
>      List.iter (
>        fun arg ->
>          (match arg with
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _ ->
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _
> +        | Key _ ->
>            pr "CString"
>          | BufferIn _ ->
>            pr "CString -> CInt"
> @@ -254,7 +256,8 @@ and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
>      List.iter (
>        fun arg ->
>          (match arg with
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _ ->
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _
> +        | Key _ ->
>            pr "String"
>          | BufferIn _ ->
>            pr "String"
> diff --git a/generator/java.ml b/generator/java.ml
> index 9ef09ad..9bb4739 100644
> --- a/generator/java.ml
> +++ b/generator/java.ml
> @@ -463,7 +463,7 @@ and generate_java_prototype ?(public=false) ?(privat=false) ?(native=false)
>  
>        match arg with
>        | Pathname n
> -      | Device n | Dev_or_Path n
> +      | Device n | Mountable n | Dev_or_Path n
>        | String n
>        | OptString n
>        | FileIn n
> @@ -797,7 +797,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
>        List.iter (
>          function
>          | Pathname n
> -        | Device n | Dev_or_Path n
> +        | Device n | Mountable n | Dev_or_Path n
>          | String n
>          | OptString n
>          | FileIn n
> @@ -866,7 +866,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
>        List.iter (
>          function
>          | Pathname n
> -        | Device n | Dev_or_Path n
> +        | Device n | Mountable n | Dev_or_Path n
>          | String n
>          | OptString n
>          | FileIn n
> @@ -923,7 +923,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
>        List.iter (
>          function
>          | Pathname n
> -        | Device n | Dev_or_Path n
> +        | Device n | Mountable n | Dev_or_Path n
>          | String n
>          | FileIn n
>          | FileOut n
> @@ -990,7 +990,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
>        List.iter (
>          function
>          | Pathname n
> -        | Device n | Dev_or_Path n
> +        | Device n | Mountable n | Dev_or_Path n
>          | String n
>          | FileIn n
>          | FileOut n
> diff --git a/generator/lua.ml b/generator/lua.ml
> index c4e3463..6c4b45d 100644
> --- a/generator/lua.ml
> +++ b/generator/lua.ml
> @@ -470,7 +470,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
>  
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
>          | FileIn n | FileOut n | Key n ->
>            pr "  const char *%s;\n" n
>          | BufferIn n ->
> @@ -500,7 +500,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
>          fun i ->
>            let i = i+2 in (* Lua indexes from 1(!), plus the handle. *)
>            function
> -          | Pathname n | Device n | Dev_or_Path n | String n
> +          | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
>            | FileIn n | FileOut n | Key n ->
>              pr "  %s = luaL_checkstring (L, %d);\n" n i
>            | BufferIn n ->
> @@ -560,7 +560,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
>        (* Free temporary data. *)
>        List.iter (
>          function
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _
>          | FileIn _ | FileOut _ | Key _
>          | BufferIn _ | OptString _
>          | Bool _ | Int _ | Int64 _
> diff --git a/generator/ocaml.ml b/generator/ocaml.ml
> index 1ecdea8..f4a6832 100644
> --- a/generator/ocaml.ml
> +++ b/generator/ocaml.ml
> @@ -497,7 +497,7 @@ copy_table (char * const * argv)
>        List.iter (
>          function
>          | Pathname n
> -        | Device n | Dev_or_Path n
> +        | Device n | Mountable n | Dev_or_Path n
>          | String n
>          | FileIn n
>          | FileOut n
> @@ -583,8 +583,8 @@ copy_table (char * const * argv)
>        (* Free strings if we copied them above. *)
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n | OptString n
> -        | FileIn n | FileOut n | BufferIn n | Key n ->
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
> +        | OptString n | FileIn n | FileOut n | BufferIn n | Key n ->
>              pr "  free (%s);\n" n
>          | StringList n | DeviceList n ->
>              pr "  ocaml_guestfs_free_strings (%s);\n" n;
> @@ -712,8 +712,8 @@ and generate_ocaml_function_type ?(extra_unit = false) (ret, args, optargs) =
>    ) optargs;
>    List.iter (
>      function
> -    | Pathname _ | Device _ | Dev_or_Path _ | String _ | FileIn _ | FileOut _
> -    | BufferIn _ | Key _ -> pr "string -> "
> +    | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _
> +    | FileIn _ | FileOut _ | BufferIn _ | Key _ -> 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 aa5ca26..9533105 100644
> --- a/generator/perl.ml
> +++ b/generator/perl.ml
> @@ -338,7 +338,7 @@ user_cancel (g)
>        iteri (
>          fun i ->
>            function
> -          | Pathname n | Device n | Dev_or_Path n | String n
> +          | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
>            | FileIn n | FileOut n | Key n ->
>                pr "      char *%s;\n" n
>            | BufferIn n ->
> @@ -487,8 +487,8 @@ user_cancel (g)
>        (* Cleanup any arguments. *)
>        List.iter (
>          function
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | OptString _
> -        | Bool _ | Int _ | Int64 _
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _
> +        | OptString _ | Bool _ | Int _ | Int64 _
>          | FileIn _ | FileOut _
>          | BufferIn _ | Key _ | Pointer _ -> ()
>          | StringList n | DeviceList n -> pr "      free (%s);\n" n
> @@ -909,6 +909,7 @@ handlers and threads.
>        let pr_type i = function
>          | Pathname n -> pr "[ '%s', 'string(path)', %d ]" n i
>          | Device n -> pr "[ '%s', 'string(device)', %d ]" n i
> +        | Mountable n -> pr "[ '%s', 'string(mountable)', %d ]" n i
>          | Dev_or_Path n -> pr "[ '%s', 'string(dev_or_path)', %d ]" n i
>          | String n -> pr "[ '%s', 'string', %d ]" n i
>          | FileIn n -> pr "[ '%s', 'string(filename)', %d ]" n i
> @@ -1081,7 +1082,7 @@ and generate_perl_prototype name (ret, args, optargs) =
>        if !comma then pr ", ";
>        comma := true;
>        match arg with
> -      | Pathname n | Device n | Dev_or_Path n | String n
> +      | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
>        | OptString n | Bool n | Int n | Int64 n | FileIn n | FileOut n
>        | BufferIn n | Key n | Pointer (_, n) ->
>            pr "$%s" n
> diff --git a/generator/php.ml b/generator/php.ml
> index 368248e..e777de9 100644
> --- a/generator/php.ml
> +++ b/generator/php.ml
> @@ -188,7 +188,7 @@ PHP_FUNCTION (guestfs_last_error)
>  
>        List.iter (
>          function
> -        | String n | Device n | Pathname n | Dev_or_Path n
> +        | String n | Device n | Mountable n | Pathname n | Dev_or_Path n
>          | FileIn n | FileOut n | Key n
>          | OptString n
>          | BufferIn n ->
> @@ -232,7 +232,7 @@ PHP_FUNCTION (guestfs_last_error)
>        let param_string = String.concat "" (
>          List.map (
>            function
> -          | String n | Device n | Pathname n | Dev_or_Path n
> +          | String n | Device n | Mountable n | Pathname n | Dev_or_Path n
>            | FileIn n | FileOut n | BufferIn n | Key n -> "s"
>            | OptString n -> "s!"
>            | StringList n | DeviceList n -> "a"
> @@ -260,7 +260,7 @@ PHP_FUNCTION (guestfs_last_error)
>        pr "        &z_g";
>        List.iter (
>          function
> -        | String n | Device n | Pathname n | Dev_or_Path n
> +        | String n | Device n | Mountable n | Pathname n | Dev_or_Path n
>          | FileIn n | FileOut n | BufferIn n | Key n
>          | OptString n ->
>              pr ", &%s, &%s_size" n n
> @@ -293,7 +293,7 @@ PHP_FUNCTION (guestfs_last_error)
>  
>        List.iter (
>          function
> -        | String n | Device n | Pathname n | Dev_or_Path n
> +        | String n | Device n | Mountable n | Pathname n | Dev_or_Path n
>          | FileIn n | FileOut n | Key n
>          | OptString n ->
>              (* Just need to check the string doesn't contain any ASCII
> @@ -420,7 +420,7 @@ PHP_FUNCTION (guestfs_last_error)
>        (* Free up parameters. *)
>        List.iter (
>          function
> -        | String n | Device n | Pathname n | Dev_or_Path n
> +        | String n | Device n | Mountable n | Pathname n | Dev_or_Path n
>          | FileIn n | FileOut n | Key n
>          | OptString n -> ()
>          | BufferIn n -> ()
> diff --git a/generator/python.ml b/generator/python.ml
> index 8752fd3..2d6e72f 100644
> --- a/generator/python.ml
> +++ b/generator/python.ml
> @@ -289,7 +289,7 @@ free_strings (char **argv)
>  
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n | Key n
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String n | Key n
>          | FileIn n | FileOut n ->
>              pr "  const char *%s;\n" n
>          | OptString n -> pr "  const char *%s;\n" n
> @@ -326,7 +326,7 @@ free_strings (char **argv)
>        pr "  if (!PyArg_ParseTuple (args, (char *) \"O";
>        List.iter (
>          function
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _ | Key _
>          | FileIn _ | FileOut _ -> pr "s"
>          | OptString _ -> pr "z"
>          | StringList _ | DeviceList _ -> pr "O"
> @@ -347,7 +347,7 @@ free_strings (char **argv)
>        pr "                         &py_g";
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n | Key n
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String n | Key n
>          | FileIn n | FileOut n -> pr ", &%s" n
>          | OptString n -> pr ", &%s" n
>          | StringList n | DeviceList n -> pr ", &py_%s" n
> @@ -369,7 +369,7 @@ free_strings (char **argv)
>        pr "  g = get_handle (py_g);\n";
>        List.iter (
>          function
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _ | Key _
>          | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
>          | BufferIn _ -> ()
>          | StringList n | DeviceList n ->
> @@ -505,7 +505,7 @@ free_strings (char **argv)
>  
>        List.iter (
>          function
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _ | Key _
>          | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
>          | BufferIn _ | Pointer _ -> ()
>          | StringList n | DeviceList n ->
> @@ -772,7 +772,7 @@ class GuestFS:
>         *)
>        List.iter (
>          function
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _ | Key _
>          | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
>          | BufferIn _ | Pointer _ -> ()
>          | StringList n | DeviceList n ->
> diff --git a/generator/ruby.ml b/generator/ruby.ml
> index 06f7d58..5ff6a2e 100644
> --- a/generator/ruby.ml
> +++ b/generator/ruby.ml
> @@ -500,7 +500,7 @@ ruby_user_cancel (VALUE gv)
>  
>        List.iter (
>          function
> -        | Pathname n | Device n | Dev_or_Path n | String n | Key n
> +        | Pathname n | Device n | Mountable n | Dev_or_Path n | String n | Key n
>          | FileIn n | FileOut n ->
>            pr "  const char *%s = StringValueCStr (%sv);\n" n n;
>          | BufferIn n ->
> @@ -602,7 +602,7 @@ ruby_user_cancel (VALUE gv)
>  
>        List.iter (
>          function
> -        | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _
> +        | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _ | Key _
>          | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
>          | BufferIn _ | Pointer _ -> ()
>          | StringList n | DeviceList n ->
> diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml
> index 2aa78df..75b59a2 100644
> --- a/generator/tests_c_api.ml
> +++ b/generator/tests_c_api.ml
> @@ -793,6 +793,7 @@ and generate_test_command_call ?(expect_error = false) ?test test_name cmd =
>          | OptString n, "NULL" -> ()
>          | Pathname n, arg
>          | Device n, arg
> +        | Mountable n, arg
>          | Dev_or_Path n, arg
>          | String n, arg
>          | OptString n, arg
> @@ -902,7 +903,7 @@ and generate_test_command_call ?(expect_error = false) ?test test_name cmd =
>          function
>          | OptString _, "NULL" -> pr ", NULL"
>          | Pathname n, _
> -        | Device n, _ | Dev_or_Path n, _
> +        | Device n, _ | Mountable n, _ | Dev_or_Path n, _
>          | String n, _
>          | OptString n, _
>          | Key n, _ ->
> diff --git a/generator/types.ml b/generator/types.ml
> index e6f56ec..7660c3d 100644
> --- a/generator/types.ml
> +++ b/generator/types.ml
> @@ -132,6 +132,7 @@ and argt =
>    | Int64 of string	(* any 64 bit int *)
>    | String of string	(* const char *name, cannot be NULL *)
>    | Device of string	(* /dev device name, cannot be NULL *)
> +  | Mountable of string	(* location of mountable filesystem, cannot be NULL *)
>    | Pathname of string	(* file name, cannot be NULL *)
>    | Dev_or_Path of string (* /dev device name or Pathname, cannot be NULL *)
>    | OptString of string	(* const char *name, may be NULL *)
> diff --git a/generator/utils.ml b/generator/utils.ml
> index 2d84bcd..ef1d028 100644
> --- a/generator/utils.ml
> +++ b/generator/utils.ml
> @@ -250,7 +250,7 @@ let map_chars f str =
>    List.map f (explode str)
>  
>  let name_of_argt = function
> -  | Pathname n | Device n | Dev_or_Path n | String n | OptString n
> +  | Pathname n | Device n | Mountable n | Dev_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
>  
> diff --git a/generator/xdr.ml b/generator/xdr.ml
> index 46b1c90..7073a1d 100644
> --- a/generator/xdr.ml
> +++ b/generator/xdr.ml
> @@ -106,7 +106,8 @@ let generate_xdr () =
>             pr "struct %s_args {\n" name;
>             List.iter (
>               function
> -             | Pathname n | Device n | Dev_or_Path n | String n | Key n ->
> +             | Pathname n | Device n | Mountable n | Dev_or_Path n | String n
> +             | Key n ->
>                   pr "  string %s<>;\n" n
>               | OptString n -> pr "  guestfs_str *%s;\n" n
>               | StringList n | DeviceList n -> pr "  guestfs_str %s<>;\n" n

I must be missing the place where a RESOLVE_MOUNTABLE call is made
(cf. RESOLVE_DEVICE).  This is because you need to both check the
parameter is reasonable, and may need to do device name translation on
it.

Rich.

-- 
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://people.redhat.com/~rjones/virt-top


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