diff --git a/customize/crypt-c.c b/customize/crypt-c.c index ecc57015f..70e6ea7f5 100644 --- a/customize/crypt-c.c +++ b/customize/crypt-c.c @@ -29,7 +29,7 @@ #pragma GCC diagnostic ignored "-Wmissing-prototypes" value -virt_sysprep_crypt (value keyv, value saltv) +virt_customize_crypt (value keyv, value saltv) { CAMLparam2 (keyv, saltv); CAMLlocal1 (rv); diff --git a/customize/crypt.ml b/customize/crypt.ml index 2c48c0d93..a5ba1ede4 100644 --- a/customize/crypt.ml +++ b/customize/crypt.ml @@ -16,4 +16,4 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -external crypt : string -> string -> string = "virt_sysprep_crypt" +external crypt : string -> string -> string = "virt_customize_crypt" diff --git a/customize/perl_edit-c.c b/customize/perl_edit-c.c index d467cb1d4..753d99045 100644 --- a/customize/perl_edit-c.c +++ b/customize/perl_edit-c.c @@ -48,7 +48,7 @@ virt_customize_edit_file_perl (value verbosev, value gv, value filev, r = edit_file_perl (g, String_val (filev), String_val (exprv), NULL, Bool_val (verbosev)); if (r == -1) - ocaml_guestfs_raise_error (g, "edit_file_perl"); + guestfs_int_ocaml_raise_error (g, "edit_file_perl"); CAMLreturn (Val_unit); } diff --git a/generator/ocaml.ml b/generator/ocaml.ml index 1de4a1b6f..1447bdc07 100644 --- a/generator/ocaml.ml +++ b/generator/ocaml.ml @@ -294,8 +294,8 @@ exception Error of string exception Handle_closed of string external create : ?environment:bool -> ?close_on_exit:bool -> unit -> t = - \"ocaml_guestfs_create\" -external close : t -> unit = \"ocaml_guestfs_close\" + \"guestfs_int_ocaml_create\" +external close : t -> unit = \"guestfs_int_ocaml_close\" type event = "; @@ -321,20 +321,20 @@ type event_handle = int type event_callback = event -> event_handle -> string -> int64 array -> unit external set_event_callback : t -> event_callback -> event list -> event_handle - = \"ocaml_guestfs_set_event_callback\" + = \"guestfs_int_ocaml_set_event_callback\" external delete_event_callback : t -> event_handle -> unit - = \"ocaml_guestfs_delete_event_callback\" + = \"guestfs_int_ocaml_delete_event_callback\" external event_to_string : event list -> string - = \"ocaml_guestfs_event_to_string\" + = \"guestfs_int_ocaml_event_to_string\" -external last_errno : t -> int = \"ocaml_guestfs_last_errno\" +external last_errno : t -> int = \"guestfs_int_ocaml_last_errno\" module Errno = struct "; List.iter ( fun e -> let le = String.lowercase e in - pr " external %s : unit -> int = \"ocaml_guestfs_get_%s\" \"noalloc\"\n" + pr " external %s : unit -> int = \"guestfs_int_ocaml_get_%s\" \"noalloc\"\n" le e; pr " let errno_%s = %s ()\n" e le ) ocaml_errnos; @@ -343,8 +343,8 @@ end (* Give the exceptions names, so they can be raised from the C code. *) let () = - Callback.register_exception \"ocaml_guestfs_error\" (Error \"\"); - Callback.register_exception \"ocaml_guestfs_closed\" (Handle_closed \"\") + Callback.register_exception \"guestfs_int_ocaml_error\" (Error \"\"); + Callback.register_exception \"guestfs_int_ocaml_closed\" (Handle_closed \"\") "; @@ -541,12 +541,12 @@ copy_table (char * const * argv) match ret with RConstOptString _ -> true | _ -> false in pr "/* Emit prototype to appease gcc's -Wmissing-prototypes. */\n"; - pr "value ocaml_guestfs_%s (value %s" name (List.hd params); + pr "value guestfs_int_ocaml_%s (value %s" name (List.hd params); List.iter (pr ", value %s") (List.tl params); pr ");\n"; pr "\n"; pr "value\n"; - pr "ocaml_guestfs_%s (value %s" name (List.hd params); + pr "guestfs_int_ocaml_%s (value %s" name (List.hd params); List.iter (pr ", value %s") (List.tl params); pr ")\n"; pr "{\n"; @@ -579,7 +579,7 @@ copy_table (char * const * argv) pr " guestfs_h *g = Guestfs_val (gv);\n"; pr " if (g == NULL)\n"; - pr " ocaml_guestfs_raise_closed (\"%s\");\n" name; + pr " guestfs_int_ocaml_raise_closed (\"%s\");\n" name; pr "\n"; List.iter ( @@ -601,7 +601,7 @@ copy_table (char * const * argv) pr " size_t %s_size = caml_string_length (%sv);\n" n n; pr " char *%s = guestfs_int_safe_memdup (g, String_val (%sv), %s_size);\n" n n n | StringList n | DeviceList n | FilenameList n -> - pr " char **%s = ocaml_guestfs_strings_val (g, %sv);\n" n n + pr " char **%s = guestfs_int_ocaml_strings_val (g, %sv);\n" n n | Bool n -> pr " int %s = Bool_val (%sv);\n" n n | Int n -> @@ -630,7 +630,7 @@ copy_table (char * const * argv) | OString _ -> pr "guestfs_int_safe_strdup (g, String_val (Field (%sv, 0)))" n | OStringList n -> - pr "ocaml_guestfs_strings_val (g, Field (%sv, 0))\n" n + pr "guestfs_int_ocaml_strings_val (g, Field (%sv, 0))\n" n ); pr ";\n"; pr " }\n"; @@ -696,10 +696,10 @@ copy_table (char * const * argv) | `CannotReturnError -> () | `ErrorIsMinusOne -> pr " if (r == -1)\n"; - pr " ocaml_guestfs_raise_error (g, \"%s\");\n" name; + pr " guestfs_int_ocaml_raise_error (g, \"%s\");\n" name; | `ErrorIsNULL -> pr " if (r == NULL)\n"; - pr " ocaml_guestfs_raise_error (g, \"%s\");\n" name; + pr " guestfs_int_ocaml_raise_error (g, \"%s\");\n" name; ); pr "\n"; @@ -747,13 +747,13 @@ copy_table (char * const * argv) if List.length params > 5 then ( pr "/* Emit prototype to appease gcc's -Wmissing-prototypes. */\n"; - pr "value ocaml_guestfs_%s_byte (value *argv, int argn);\n" name; + pr "value guestfs_int_ocaml_%s_byte (value *argv, int argn);\n" name; pr "\n"; pr "value\n"; - pr "ocaml_guestfs_%s_byte (value *argv, int argn ATTRIBUTE_UNUSED)\n" + pr "guestfs_int_ocaml_%s_byte (value *argv, int argn ATTRIBUTE_UNUSED)\n" name; pr "{\n"; - pr " return ocaml_guestfs_%s (argv[0]" name; + pr " return guestfs_int_ocaml_%s (argv[0]" name; iteri (fun i _ -> pr ", argv[%d]" (i+1)) (List.tl params); pr ");\n"; pr "}\n"; @@ -787,7 +787,7 @@ and generate_ocaml_c_errnos () = "; List.iter ( fun e -> - pr "value ocaml_guestfs_get_%s (value unitv);\n" e + pr "value guestfs_int_ocaml_get_%s (value unitv);\n" e ) ocaml_errnos; List.iter ( @@ -796,7 +796,7 @@ and generate_ocaml_c_errnos () = /* NB: \"noalloc\" function. */ value -ocaml_guestfs_get_%s (value unitv) +guestfs_int_ocaml_get_%s (value unitv) { return Val_int (%s); } @@ -829,8 +829,8 @@ and generate_ocaml_prototype ?(is_external = false) name style = pr " = "; let _, args, optargs = style in if List.length args + List.length optargs + 1 > 5 then - pr "\"ocaml_guestfs_%s_byte\" " name; - pr "\"ocaml_guestfs_%s\"" name + pr "\"guestfs_int_ocaml_%s_byte\" " name; + pr "\"guestfs_int_ocaml_%s\"" name ); pr "\n" diff --git a/mllib/fsync-c.c b/mllib/fsync-c.c index a4bf92afc..72e74ef9a 100644 --- a/mllib/fsync-c.c +++ b/mllib/fsync-c.c @@ -1,5 +1,5 @@ -/* virt-resize - interface to fsync - * Copyright (C) 2013 Red Hat Inc. +/* libguestfs OCaml tools common code + * Copyright (C) 2013-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,12 +38,12 @@ extern void unix_error (int errcode, char * cmdname, value arg) Noreturn; /* OCaml doesn't bind any *sync* calls. */ -extern value virt_resize_sync (value unitv); -extern value virt_resize_fsync_file (value filenamev); +extern value guestfs_int_mllib_sync (value unitv); +extern value guestfs_int_mllib_fsync_file (value filenamev); /* NB: This is a "noalloc" call. */ value -virt_resize_sync (value unitv) +guestfs_int_mllib_sync (value unitv) { sync (); return Val_unit; @@ -60,7 +60,7 @@ virt_resize_sync (value unitv) * http://pubs.opengroup.org/onlinepubs/007908775/xsh/fsync.html */ value -virt_resize_fsync_file (value filenamev) +guestfs_int_mllib_fsync_file (value filenamev) { CAMLparam1 (filenamev); const char *filename = String_val (filenamev); diff --git a/mllib/fsync.ml b/mllib/fsync.ml index f9961fb6d..56f1169e7 100644 --- a/mllib/fsync.ml +++ b/mllib/fsync.ml @@ -1,5 +1,5 @@ -(* virt-resize - * Copyright (C) 2013 Red Hat Inc. +(* libguestfs OCaml tools common code + * Copyright (C) 2013-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,5 +16,5 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -external sync : unit -> unit = "virt_resize_sync" "noalloc" -external file : string -> unit = "virt_resize_fsync_file" +external sync : unit -> unit = "guestfs_int_mllib_sync" "noalloc" +external file : string -> unit = "guestfs_int_mllib_fsync_file" diff --git a/mllib/mkdtemp-c.c b/mllib/mkdtemp-c.c index c9a84c092..a31e3a7bb 100644 --- a/mllib/mkdtemp-c.c +++ b/mllib/mkdtemp-c.c @@ -1,5 +1,5 @@ -/* virt-builder - * Copyright (C) 2014 Red Hat Inc. +/* libguestfs OCaml tools common code + * Copyright (C) 2014-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ extern void unix_error (int errcode, char * cmdname, value arg) Noreturn; #pragma GCC diagnostic ignored "-Wmissing-prototypes" value -virt_builder_mkdtemp (value val_pattern) +guestfs_int_mllib_mkdtemp (value val_pattern) { CAMLparam1 (val_pattern); CAMLlocal1 (rv); diff --git a/mllib/mkdtemp.ml b/mllib/mkdtemp.ml index 353b04ba4..9ebf560ce 100644 --- a/mllib/mkdtemp.ml +++ b/mllib/mkdtemp.ml @@ -1,5 +1,5 @@ -(* virt-builder - * Copyright (C) 2014 Red Hat Inc. +(* libguestfs OCaml tools common code + * Copyright (C) 2014-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ open Common_utils -external mkdtemp : string -> string = "virt_builder_mkdtemp" +external mkdtemp : string -> string = "guestfs_int_mllib_mkdtemp" let temp_dir ?(base_dir = Filename.temp_dir_name) prefix suffix = mkdtemp (base_dir // (prefix ^ "XXXXXX" ^ suffix)) diff --git a/mllib/progress-c.c b/mllib/progress-c.c index 70eb47eca..8e5efd368 100644 --- a/mllib/progress-c.c +++ b/mllib/progress-c.c @@ -1,5 +1,5 @@ -/* virt-resize - interface to progress bar mini library - * Copyright (C) 2011 Red Hat Inc. +/* libguestfs OCaml tools common code + * Copyright (C) 2011-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +56,7 @@ static struct custom_operations progress_bar_custom_operations = { }; value -virt_resize_progress_bar_init (value machine_readablev) +guestfs_int_mllib_progress_bar_init (value machine_readablev) { CAMLparam1 (machine_readablev); CAMLlocal1 (barv); @@ -84,7 +84,7 @@ virt_resize_progress_bar_init (value machine_readablev) /* NB: "noalloc" function. */ value -virt_resize_progress_bar_reset (value barv) +guestfs_int_mllib_progress_bar_reset (value barv) { struct progress_bar *bar = Bar_val (barv); @@ -95,8 +95,8 @@ virt_resize_progress_bar_reset (value barv) /* NB: "noalloc" function. */ value -virt_resize_progress_bar_set (value barv, - value positionv, value totalv) +guestfs_int_mllib_progress_bar_set (value barv, + value positionv, value totalv) { struct progress_bar *bar = Bar_val (barv); uint64_t position = Int64_val (positionv); diff --git a/mllib/progress.ml b/mllib/progress.ml index b6b3b60be..c2db53c5c 100644 --- a/mllib/progress.ml +++ b/mllib/progress.ml @@ -1,5 +1,5 @@ -(* virt-resize - * Copyright (C) 2010-2012 Red Hat Inc. +(* libguestfs OCaml tools common code + * Copyright (C) 2010-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,11 +23,11 @@ module G = Guestfs type progress_bar external progress_bar_init : machine_readable:bool -> progress_bar - = "virt_resize_progress_bar_init" + = "guestfs_int_mllib_progress_bar_init" external progress_bar_reset : progress_bar -> unit - = "virt_resize_progress_bar_reset" "noalloc" + = "guestfs_int_mllib_progress_bar_reset" "noalloc" external progress_bar_set : progress_bar -> int64 -> int64 -> unit - = "virt_resize_progress_bar_set" "noalloc" + = "guestfs_int_mllib_progress_bar_set" "noalloc" let set_up_progress_bar ?(machine_readable = false) (g : Guestfs.guestfs) = (* Only display progress bars if the machine_readable flag is set or diff --git a/mllib/uRI.ml b/mllib/uRI.ml index d4f752229..6f2b30a81 100644 --- a/mllib/uRI.ml +++ b/mllib/uRI.ml @@ -1,5 +1,5 @@ -(* virt-resize - interface to -a URI option parsing mini library - * Copyright (C) 2013 Red Hat Inc. +(* interface to -a URI option parsing mini library + * Copyright (C) 2013-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,4 +24,4 @@ type uri = { password : string option; } -external parse_uri : string -> uri = "virt_resize_parse_uri" +external parse_uri : string -> uri = "guestfs_int_mllib_parse_uri" diff --git a/mllib/uri-c.c b/mllib/uri-c.c index d12b7fffb..f3af817f3 100644 --- a/mllib/uri-c.c +++ b/mllib/uri-c.c @@ -1,5 +1,5 @@ -/* virt-resize - interface to -a URI option parsing mini library - * Copyright (C) 2013 Red Hat Inc. +/* interface to -a URI option parsing mini library + * Copyright (C) 2013-2016 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,10 +34,10 @@ #include "guestfs-internal-frontend.h" #include "uri.h" -extern value virt_resize_parse_uri (value argv); +extern value guestfs_int_mllib_parse_uri (value argv); value -virt_resize_parse_uri (value argv /* arg value, not an array! */) +guestfs_int_mllib_parse_uri (value argv /* arg value, not an array! */) { CAMLparam1 (argv); CAMLlocal4 (rv, sv, ssv, ov); diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c index b8a6e66e1..8f74c2131 100644 --- a/ocaml/guestfs-c.c +++ b/ocaml/guestfs-c.c @@ -57,12 +57,12 @@ static void event_callback_wrapper (guestfs_h *g, void *data, uint64_t event, in #endif /* These prototypes are solely to quiet gcc warning. */ -value ocaml_guestfs_create (value environmentv, value close_on_exitv, value unitv); -value ocaml_guestfs_close (value gv); -value ocaml_guestfs_set_event_callback (value gv, value closure, value events); -value ocaml_guestfs_delete_event_callback (value gv, value eh); -value ocaml_guestfs_event_to_string (value events); -value ocaml_guestfs_last_errno (value gv); +value guestfs_int_ocaml_create (value environmentv, value close_on_exitv, value unitv); +value guestfs_int_ocaml_close (value gv); +value guestfs_int_ocaml_set_event_callback (value gv, value closure, value events); +value guestfs_int_ocaml_delete_event_callback (value gv, value eh); +value guestfs_int_ocaml_event_to_string (value events); +value guestfs_int_ocaml_last_errno (value gv); /* Allocate handles and deal with finalization. */ static void @@ -116,7 +116,7 @@ Val_guestfs (guestfs_h *g) } void -ocaml_guestfs_raise_error (guestfs_h *g, const char *func) +guestfs_int_ocaml_raise_error (guestfs_h *g, const char *func) { CAMLparam0 (); CAMLlocal1 (v); @@ -128,24 +128,24 @@ ocaml_guestfs_raise_error (guestfs_h *g, const char *func) v = caml_copy_string (msg); else v = caml_copy_string (func); - caml_raise_with_arg (*caml_named_value ("ocaml_guestfs_error"), v); + caml_raise_with_arg (*caml_named_value ("guestfs_int_ocaml_error"), v); CAMLnoreturn; } void -ocaml_guestfs_raise_closed (const char *func) +guestfs_int_ocaml_raise_closed (const char *func) { CAMLparam0 (); CAMLlocal1 (v); v = caml_copy_string (func); - caml_raise_with_arg (*caml_named_value ("ocaml_guestfs_closed"), v); + caml_raise_with_arg (*caml_named_value ("guestfs_int_ocaml_closed"), v); CAMLnoreturn; } /* Guestfs.create */ value -ocaml_guestfs_create (value environmentv, value close_on_exitv, value unitv) +guestfs_int_ocaml_create (value environmentv, value close_on_exitv, value unitv) { CAMLparam3 (environmentv, close_on_exitv, unitv); CAMLlocal1 (gv); @@ -173,7 +173,7 @@ ocaml_guestfs_create (value environmentv, value close_on_exitv, value unitv) /* Guestfs.close */ value -ocaml_guestfs_close (value gv) +guestfs_int_ocaml_close (value gv) { CAMLparam1 (gv); @@ -187,7 +187,7 @@ ocaml_guestfs_close (value gv) /* Copy string array value. */ char ** -ocaml_guestfs_strings_val (guestfs_h *g, value sv) +guestfs_int_ocaml_strings_val (guestfs_h *g, value sv) { CAMLparam1 (sv); char **r; @@ -216,7 +216,7 @@ event_bitmask_of_event_list (value events) /* Guestfs.set_event_callback */ value -ocaml_guestfs_set_event_callback (value gv, value closure, value events) +guestfs_int_ocaml_set_event_callback (value gv, value closure, value events) { CAMLparam3 (gv, closure, events); char key[64]; @@ -235,7 +235,7 @@ ocaml_guestfs_set_event_callback (value gv, value closure, value events) if (eh == -1) { free (root); - ocaml_guestfs_raise_error (g, "set_event_callback"); + guestfs_int_ocaml_raise_error (g, "set_event_callback"); } caml_register_generational_global_root (root); @@ -248,7 +248,7 @@ ocaml_guestfs_set_event_callback (value gv, value closure, value events) /* Guestfs.delete_event_callback */ value -ocaml_guestfs_delete_event_callback (value gv, value ehv) +guestfs_int_ocaml_delete_event_callback (value gv, value ehv) { CAMLparam2 (gv, ehv); char key[64]; @@ -271,7 +271,7 @@ ocaml_guestfs_delete_event_callback (value gv, value ehv) /* Guestfs.event_to_string */ value -ocaml_guestfs_event_to_string (value events) +guestfs_int_ocaml_event_to_string (value events) { CAMLparam1 (events); CAMLlocal1 (rv); @@ -398,7 +398,7 @@ event_callback_wrapper (guestfs_h *g, } value -ocaml_guestfs_last_errno (value gv) +guestfs_int_ocaml_last_errno (value gv) { CAMLparam1 (gv); CAMLlocal1 (rv); @@ -407,7 +407,7 @@ ocaml_guestfs_last_errno (value gv) g = Guestfs_val (gv); if (g == NULL) - ocaml_guestfs_raise_closed ("last_errno"); + guestfs_int_ocaml_raise_closed ("last_errno"); r = guestfs_last_errno (g); diff --git a/ocaml/guestfs-c.h b/ocaml/guestfs-c.h index a7409f025..b99acebe5 100644 --- a/ocaml/guestfs-c.h +++ b/ocaml/guestfs-c.h @@ -22,10 +22,10 @@ #include "guestfs-internal-frontend.h" #define Guestfs_val(v) (*((guestfs_h **)Data_custom_val(v))) -extern void ocaml_guestfs_raise_error (guestfs_h *g, const char *func) +extern void guestfs_int_ocaml_raise_error (guestfs_h *g, const char *func) Noreturn; -extern void ocaml_guestfs_raise_closed (const char *func) +extern void guestfs_int_ocaml_raise_closed (const char *func) Noreturn; -extern char **ocaml_guestfs_strings_val (guestfs_h *g, value sv); +extern char **guestfs_int_ocaml_strings_val (guestfs_h *g, value sv); #endif /* GUESTFS_OCAML_C_H */