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 55c39cb..0ca5af9 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 518ac1b..afa81ed 100644 --- a/generator/c.ml +++ b/generator/c.ml @@ -121,7 +121,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 -> @@ -852,6 +852,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 @@ -969,6 +970,7 @@ and generate_client_actions hash () = function | String n (* strings *) | Device n + | Mountable n | Pathname n | Dev_or_Path n | FileIn n @@ -1284,7 +1286,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 de54e62..e2fcb42 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 9362b3f..a075bdc 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 357335b..004aee4 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 b93f4fc..eacca37 100644 --- a/generator/fish.ml +++ b/generator/fish.ml @@ -324,7 +324,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 @@ -407,7 +407,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 @@ -619,7 +619,7 @@ Guestfish will prompt for these separately." ) (List.rev optargs); List.iter ( function - | Device _ | String _ + | Device _ | Mountable _ | String _ | OptString _ | BufferIn _ -> () | Bool name @@ -852,7 +852,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 9b18de1..5a36bfc 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 dc19259..2033dbf 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 75732e8..ad53ba3 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 @@ -798,7 +798,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 @@ -867,7 +867,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 @@ -924,7 +924,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 @@ -991,7 +991,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 691b966..04a3941 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 80ab596..6302298 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 db11cb6..3b4108a 100644 --- a/generator/perl.ml +++ b/generator/perl.ml @@ -342,7 +342,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 -> @@ -491,8 +491,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 @@ -920,6 +920,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 @@ -1092,7 +1093,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 6618ce5..cf23863 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 9bff5b9..cff3049 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 -> @@ -773,7 +773,7 @@ class GuestFS(object): *) 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 23ce1fe..b98c7ff 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -505,7 +505,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 -> @@ -607,7 +607,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 e97e4ef..9cc047c 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 c618add..d928724 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 67a6747..6a94009 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 3b79b33..976a958 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 -- 1.8.1