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

[Libguestfs] [PATCH] Make internal-only functions and structures private



Certain functions are intended to be internal only, but we currently
export them anyway. This change moves them into a separate section of
guestfs.h protected by a GUESTFS_PRIVATE variable. This change also
enables private structs, but doesn't implement any.

This change only affects the C api. Language bindings aren't affected,
but probably should be in the future.
---
 align/Makefile.am              |  2 +-
 df/Makefile.am                 |  2 +-
 erlang/Makefile.am             |  1 +
 generator/actions.ml           | 46 +++++++++++++++++++++++--------------
 generator/actions.mli          | 12 ++++++++++
 generator/c.ml                 | 52 +++++++++++++++++++++++++++++++-----------
 generator/erlang.ml            |  2 +-
 generator/fish.ml              |  2 +-
 generator/gobject.ml           |  2 +-
 generator/main.ml              |  2 +-
 generator/ocaml.ml             |  4 ++--
 generator/python.ml            |  2 +-
 generator/structs.ml           |  8 ++++++-
 generator/structs.mli          |  7 ++++++
 generator/types.ml             |  2 ++
 gobject/Makefile.am            |  1 +
 java/Makefile.am               |  2 +-
 lua/Makefile.am                |  1 +
 ocaml/Makefile.am              |  2 +-
 perl/Makefile.PL.in            |  2 +-
 php/Makefile.am                |  1 +
 python/Makefile.am             |  2 +-
 ruby/ext/guestfs/extconf.rb.in |  2 +-
 src/Makefile.am                |  2 +-
 tests/c-api/Makefile.am        |  1 +
 25 files changed, 116 insertions(+), 46 deletions(-)

diff --git a/align/Makefile.am b/align/Makefile.am
index cd80c19..857253f 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -41,7 +41,7 @@ virt_alignment_scan_SOURCES = \
 
 virt_alignment_scan_CFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-DGUESTFS_PRIVATE_FUNCTIONS=1 \
+	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
diff --git a/df/Makefile.am b/df/Makefile.am
index eeec484..52cb4ab 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -44,7 +44,7 @@ virt_df_SOURCES = \
 
 virt_df_CFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-DGUESTFS_PRIVATE_FUNCTIONS=1 \
+	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
diff --git a/erlang/Makefile.am b/erlang/Makefile.am
index 8c1e887..c593630 100644
--- a/erlang/Makefile.am
+++ b/erlang/Makefile.am
@@ -45,6 +45,7 @@ erl_guestfs_CFLAGS = \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
 	-I$(ERLANG_LIB_DIR_erl_interface)/include \
+	-DGUESTFS_PRIVATE=1 \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(GPROF_CFLAGS) $(GCOV_CFLAGS)
 
diff --git a/generator/actions.ml b/generator/actions.ml
index 94f728f..a97b867 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -28,7 +28,7 @@ let defaults = { name = ""; style = RErr, [], []; proc_nr = None;
                  tests = []; shortdesc = ""; longdesc = "";
                  protocol_limit_warning = false; fish_alias = [];
                  fish_output = None; in_fish = true; in_docs = true;
-                 deprecated_by = None; optional = None;
+                 internal = false; deprecated_by = None; optional = None;
                  progress = false; camel_name = "";
                  cancellable = false; config_only = false;
                  once_had_no_optargs = false; blocking = true;
@@ -76,7 +76,7 @@ let test_functions = [
   { defaults with
     name = "internal_test";
     style = RErr, test_all_args, test_all_optargs;
-    in_fish = false; in_docs = false; cancellable = true;
+    in_fish = false; in_docs = false; internal = true; cancellable = true;
     blocking = false;
     shortdesc = "internal test function - do not use";
     longdesc = "\
@@ -92,7 +92,7 @@ You probably don't want to call this function." };
   { defaults with
     name = "internal_test_only_optargs";
     style = RErr, [], [OInt "test"];
-    in_fish = false; in_docs = false; cancellable = true;
+    in_fish = false; in_docs = false; internal = true; cancellable = true;
     blocking = false;
     shortdesc = "internal test function - do not use";
     longdesc = "\
@@ -108,7 +108,7 @@ You probably don't want to call this function." };
   { defaults with
     name = "internal_test_63_optargs";
     style = RErr, [], [OInt "opt1"; OInt "opt2"; OInt "opt3"; OInt "opt4"; OInt "opt5"; OInt "opt6"; OInt "opt7"; OInt "opt8"; OInt "opt9"; OInt "opt10"; OInt "opt11"; OInt "opt12"; OInt "opt13"; OInt "opt14"; OInt "opt15"; OInt "opt16"; OInt "opt17"; OInt "opt18"; OInt "opt19"; OInt "opt20"; OInt "opt21"; OInt "opt22"; OInt "opt23"; OInt "opt24"; OInt "opt25"; OInt "opt26"; OInt "opt27"; OInt "opt28"; OInt "opt29"; OInt "opt30"; OInt "opt31"; OInt "opt32"; OInt "opt33"; OInt "opt34"; OInt "opt35"; OInt "opt36"; OInt "opt37"; OInt "opt38"; OInt "opt39"; OInt "opt40"; OInt "opt41"; OInt "opt42"; OInt "opt43"; OInt "opt44"; OInt "opt45"; OInt "opt46"; OInt "opt47"; OInt "opt48"; OInt "opt49"; OInt "opt50"; OInt "opt51"; OInt "opt52"; OInt "opt53"; OInt "opt54"; OInt "opt55"; OInt "opt56"; OInt "opt57"; OInt "opt58"; OInt "opt59"; OInt "opt60"; OInt "opt61"; OInt "opt62"; OInt "opt63"];
-    in_fish = false; in_docs = false; cancellable = true;
+    in_fish = false; in_docs = false; internal = true; cancellable = true;
     blocking = false;
     shortdesc = "internal test function - do not use";
     longdesc = "\
@@ -128,7 +128,7 @@ You probably don't want to call this function." }
       { defaults with
         name = name;
         style = ret, [String "val"], [];
-        in_fish = false; in_docs = false;
+        in_fish = false; in_docs = false; internal = true;
         blocking = false;
         shortdesc = "internal test function - do not use";
         longdesc = "\
@@ -142,7 +142,7 @@ You probably don't want to call this function." };
       { defaults with
         name = name ^ "err";
         style = ret, [], [];
-        in_fish = false; in_docs = false;
+        in_fish = false; in_docs = false; internal = true;
         blocking = false;
         shortdesc = "internal test function - do not use";
         longdesc = "\
@@ -166,7 +166,7 @@ let non_daemon_functions = test_functions @ [
   { defaults with
     name = "internal_test_set_output";
     style = RErr, [String "filename"], [];
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     blocking = false;
     shortdesc = "internal test function - do not use";
     longdesc = "\
@@ -181,7 +181,7 @@ You probably don't want to call this function." };
   { defaults with
     name = "internal_test_close_output";
     style = RErr, [], [];
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     blocking = false;
     shortdesc = "internal test function - do not use";
     longdesc = "\
@@ -6825,7 +6825,7 @@ yourself (Augeas support makes this relatively easy)." };
     name = "internal_lstatlist";
     style = RStructList ("statbufs", "stat"), [Pathname "path"; StringList "names"], [];
     proc_nr = Some 204;
-    in_docs = false; in_fish = false;
+    in_docs = false; in_fish = false; internal = true;
     shortdesc = "lstat on multiple files";
     longdesc = "\
 This call allows you to perform the C<guestfs_lstat> operation
@@ -6849,7 +6849,7 @@ into smaller groups of names." };
     name = "internal_lxattrlist";
     style = RStructList ("xattrs", "xattr"), [Pathname "path"; StringList "names"], [];
     proc_nr = Some 205;
-    in_docs = false; in_fish = false;
+    in_docs = false; in_fish = false; internal = true;
     optional = Some "linuxxattrs";
     shortdesc = "lgetxattr on multiple files";
     longdesc = "\
@@ -6879,7 +6879,7 @@ into smaller groups of names." };
     name = "internal_readlinklist";
     style = RStringList "links", [Pathname "path"; StringList "names"], [];
     proc_nr = Some 206;
-    in_docs = false; in_fish = false;
+    in_docs = false; in_fish = false; internal = true;
     shortdesc = "readlink on multiple files";
     longdesc = "\
 This call allows you to do a C<readlink> operation
@@ -7677,7 +7677,7 @@ to ensure the length of the file is exactly C<len> bytes." };
     name = "internal_write";
     style = RErr, [Pathname "path"; BufferIn "content"], [];
     proc_nr = Some 246;
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     protocol_limit_warning = true;
     tests = [
       InitScratchFS, Always, TestOutput (
@@ -8391,7 +8391,7 @@ See also L<guestfs(3)/RESIZE2FS ERRORS>." };
     name = "internal_autosync";
     style = RErr, [], [];
     proc_nr = Some 282;
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     shortdesc = "internal autosync operation";
     longdesc = "\
 This command performs the autosync operation just before the
@@ -8537,7 +8537,7 @@ See also L<btrfs(8)>." };
     name = "internal_write_append";
     style = RErr, [Pathname "path"; BufferIn "content"], [];
     proc_nr = Some 290;
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     protocol_limit_warning = true;
     tests = [
       InitScratchFS, Always, TestOutput (
@@ -10302,7 +10302,7 @@ are the full raw block device and partition names
     name = "internal_hot_add_drive";
     style = RErr, [String "label"], [];
     proc_nr = Some 370;
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     tests = [];
     shortdesc = "internal hotplugging operation";
     longdesc = "\
@@ -10312,7 +10312,7 @@ This function is used internally when hotplugging drives." };
     name = "internal_hot_remove_drive_precheck";
     style = RErr, [String "label"], [];
     proc_nr = Some 371;
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     tests = [];
     shortdesc = "internal hotplugging operation";
     longdesc = "\
@@ -10322,7 +10322,7 @@ This function is used internally when hotplugging drives." };
     name = "internal_hot_remove_drive";
     style = RErr, [String "label"], [];
     proc_nr = Some 372;
-    in_fish = false; in_docs = false;
+    in_fish = false; in_docs = false; internal = true;
     tests = [];
     shortdesc = "internal hotplugging operation";
     longdesc = "\
@@ -11054,11 +11054,23 @@ let non_daemon_functions, daemon_functions =
 (* All functions. *)
 let all_functions = non_daemon_functions @ daemon_functions
 
+let external_functions =
+  List.filter (fun x -> not x.internal) all_functions
+
+let internal_functions =
+  List.filter (fun x -> x.internal) all_functions
+
 (* In some places we want the functions to be displayed sorted
  * alphabetically, so this is useful:
  *)
 let all_functions_sorted = List.sort action_compare all_functions
 
+let external_functions_sorted =
+  List.sort action_compare external_functions
+
+let internal_functions_sorted =
+  List.sort action_compare internal_functions
+
 (* This is used to generate the src/MAX_PROC_NR file which
  * contains the maximum procedure number, a surrogate for the
  * ABI version number.  See src/Makefile.am for the details.
diff --git a/generator/actions.mli b/generator/actions.mli
index 1ad509a..26ae7e9 100644
--- a/generator/actions.mli
+++ b/generator/actions.mli
@@ -29,9 +29,21 @@ val daemon_functions : Types.action list
 val all_functions : Types.action list
 (** Concatenation of [non_daemon_functions] and [daemon_functions] lists. *)
 
+val external_functions : Types.action list
+(** [all_functions] filtered for external functions **)
+
+val internal_functions : Types.action list
+(** [all_functions] filtered for internal functions **)
+
 val all_functions_sorted : Types.action list
 (** [all_functions] but sorted by name. *)
 
+val external_functions_sorted : Types.action list
+(** [external_functions] but sorted by name. *)
+
+val internal_functions_sorted : Types.action list
+(** [internal_functions] but sorted by name. *)
+
 val test_functions : Types.action list
 (** Internal test functions used to test the language bindings. *)
 
diff --git a/generator/c.ml b/generator/c.ml
index f0102df..76397d6 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -576,7 +576,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
    *)
 
   (* Public structures. *)
-  List.iter (
+  let generate_all_structs = List.iter (
     fun { s_name = typ; s_cols = cols } ->
       pr "struct guestfs_%s {\n" typ;
       List.iter (
@@ -603,7 +603,9 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
       pr "extern GUESTFS_DLL_PUBLIC void guestfs_free_%s (struct guestfs_%s *);\n" typ typ;
       pr "extern GUESTFS_DLL_PUBLIC void guestfs_free_%s_list (struct guestfs_%s_list *);\n" typ typ;
       pr "\n"
-  ) structs;
+  ) in
+  
+  generate_all_structs external_structs;
 
   pr "\
 /* Actions. */
@@ -673,7 +675,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
     pr "\n"
   in
 
-  List.iter (
+  let generate_all_headers = List.iter (
     fun ({ name = name; style = ret, args, _ } as f) ->
       (* If once_had_no_optargs is set, then we need to generate a
        * <name>_opts variant, plus a backwards-compatible wrapper
@@ -685,18 +687,19 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
       )
       else
         generate_action_header f
-  ) all_functions_sorted;
+  ) in
+  
+  generate_all_headers external_functions_sorted;
 
   pr "\
-#if GUESTFS_PRIVATE_FUNCTIONS
-
-/* Private functions.
- *
- * These are NOT part of the public, stable API, and can change at any
- * time!  We export them because they are used by some of the language
- * bindings.
+#if GUESTFS_PRIVATE
+/* Symbols protected by GUESTFS_PRIVATE are NOT part of the public,
+ * stable API, and can change at any time!  We export them because
+ * they are used by some of the language bindings.
  */
 
+/* Private functions. */
+
 extern GUESTFS_DLL_PUBLIC void *guestfs___safe_malloc (guestfs_h *g, size_t nbytes);
 extern GUESTFS_DLL_PUBLIC void *guestfs___safe_calloc (guestfs_h *g, size_t n, size_t s);
 extern GUESTFS_DLL_PUBLIC char *guestfs___safe_strdup (guestfs_h *g, const char *str);
@@ -704,7 +707,30 @@ extern GUESTFS_DLL_PUBLIC void *guestfs___safe_memdup (guestfs_h *g, const void
 
 extern GUESTFS_DLL_PUBLIC int guestfs___for_each_disk (guestfs_h *g, /* virDomainPtr */ void *dom, int (*)(guestfs_h *g, const char *filename, const char *format, int readonly, void *data), void *data);
 
-#endif /* End of private functions. */
+";
+
+  generate_all_headers internal_functions_sorted;
+
+  pr "\
+/* Private structures. */
+
+";
+
+  generate_all_structs internal_structs;
+
+pr "\
+/* Deprecated macros for internal functions. */
+
+";
+
+  List.iter (
+    fun { name = shortname } ->
+      pr "#define LIBGUESTFS_HAVE_%s 1\n" (String.uppercase shortname);
+  ) internal_functions_sorted;
+
+pr "\
+
+#endif /* End of GUESTFS_PRIVATE. */
 
 /* Deprecated macros.  Use GUESTFS_HAVE_* instead. */
 
@@ -727,7 +753,7 @@ extern GUESTFS_DLL_PUBLIC int guestfs___for_each_disk (guestfs_h *g, /* virDomai
   List.iter (
     fun { name = shortname } ->
       pr "#define LIBGUESTFS_HAVE_%s 1\n" (String.uppercase shortname);
-  ) all_functions_sorted;
+  ) external_functions_sorted;
 
   pr "
 /* End of deprecated macros. */
diff --git a/generator/erlang.ml b/generator/erlang.ml
index 90c7d08..b7d4e6c 100644
--- a/generator/erlang.ml
+++ b/generator/erlang.ml
@@ -270,7 +270,7 @@ extern void free_strings (char **r);
       pr "  return erl_mk_list (t, %d);\n" (List.length cols);
       pr "}\n";
       pr "\n";
-  ) structs;
+  ) external_structs;
 
   (* Emit a copy_TYPE_list function definition only if that function is used. *)
   List.iter (
diff --git a/generator/fish.ml b/generator/fish.ml
index f7e111f..077a0b4 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -279,7 +279,7 @@ Guestfish will prompt for these separately."
       ) cols;
       pr "}\n";
       pr "\n";
-  ) structs;
+  ) external_structs;
 
   (* Emit a print_TYPE_list function definition only if that function is used. *)
   List.iter (
diff --git a/generator/gobject.ml b/generator/gobject.ml
index 2000c13..519cb26 100644
--- a/generator/gobject.ml
+++ b/generator/gobject.ml
@@ -107,7 +107,7 @@ let filenames =
   "session" :: "tristate" ::
 
   (* structs *)
-  List.map (fun { s_name = typ } -> "struct-" ^ typ) structs @
+  List.map (fun { s_name = typ } -> "struct-" ^ typ) external_structs @
 
   (* optargs *)
   List.map (function { name = name } -> "optargs-" ^ name) (
diff --git a/generator/main.ml b/generator/main.ml
index 69ebe05..1d35a53 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -170,7 +170,7 @@ Run it from the top source directory using the command
       output_to filename (generate_gobject_struct_header short typ cols);
       let filename = sprintf "gobject/src/%s.c" short in
       output_to filename (generate_gobject_struct_source short typ cols)
-  ) structs;
+  ) external_structs;
   delete_except_generated "gobject/include/guestfs-gobject/struct-*.h";
   delete_except_generated "gobject/src/struct-*.c";
 
diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index 15efa80..0b1f96b 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
@@ -422,7 +422,7 @@ copy_table (char * const * argv)
       pr "  CAMLreturn (rv);\n";
       pr "}\n";
       pr "\n";
-  ) structs;
+  ) external_structs;
 
   (* Emit a copy_TYPE_list function definition only if that function is used. *)
   List.iter (
@@ -687,7 +687,7 @@ and generate_ocaml_structure_decls () =
       ) cols;
       pr "}\n";
       pr "\n"
-  ) structs
+  ) external_structs
 
 and generate_ocaml_prototype ?(is_external = false) name style =
   if is_external then pr "external " else pr "val ";
diff --git a/generator/python.ml b/generator/python.ml
index 5bfb1b1..3863c71 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -240,7 +240,7 @@ free_strings (char **argv)
       pr "};\n";
       pr "\n";
 
-  ) structs;
+  ) external_structs;
 
   (* Emit a put_TYPE_list function definition only if that function is used. *)
   List.iter (
diff --git a/generator/structs.ml b/generator/structs.ml
index 207da90..da52dfe 100644
--- a/generator/structs.ml
+++ b/generator/structs.ml
@@ -26,6 +26,7 @@ type struc = {
   s_name : string;
   s_cols : cols;
   s_camel_name : string;
+  s_internal : bool;
   s_unused : unit; (* Silences warning 23 when using 'defaults with ...' *)
 }
 
@@ -94,7 +95,8 @@ let lvm_lv_cols = [
   "modules", FString;
 ]
 
-let defaults = { s_name = ""; s_cols = []; s_camel_name = ""; s_unused = () }
+let defaults = { s_name = ""; s_cols = []; s_camel_name = "";
+                 s_internal = false; s_unused = () }
 
 (* Names and fields in all structures (in RStruct and RStructList)
  * that we support.
@@ -369,3 +371,7 @@ let lookup_struct name =
 let camel_name_of_struct name = (lookup_struct name).s_camel_name
 
 let cols_of_struct name = (lookup_struct name).s_cols
+
+let external_structs = List.filter (fun x -> not x.s_internal) structs
+
+let internal_structs = List.filter (fun x -> x.s_internal) structs
diff --git a/generator/structs.mli b/generator/structs.mli
index f0c2ba6..20fba86 100644
--- a/generator/structs.mli
+++ b/generator/structs.mli
@@ -27,6 +27,7 @@ type struc = {
   s_name : string;                      (** Regular name. *)
   s_cols : cols;                        (** Columns. *)
   s_camel_name : string;                (** Camel-cased name. *)
+  s_internal : bool;                    (** Internal only. *)
   s_unused : unit;
 }
 
@@ -48,3 +49,9 @@ val camel_name_of_struct : string -> string
 
 val cols_of_struct : string -> cols
 (** Lookup struct by name, return the s_cols field. *)
+
+val external_structs : struc list
+(** Only external structs *)
+
+val internal_structs : struc list
+(** Only internal structs *)
diff --git a/generator/types.ml b/generator/types.ml
index 178dda2..26bf746 100644
--- a/generator/types.ml
+++ b/generator/types.ml
@@ -385,6 +385,8 @@ type action = {
   fish_output : fish_output_t option; (* how to display output in guestfish *)
   in_fish : bool;                 (* export via guestfish *)
   in_docs : bool;                 (* add this function to documentation *)
+  internal: bool;                 (* function is not part of the
+                                     external api *)
   deprecated_by : string option;  (* function is deprecated, use .. instead *)
   optional : string option;       (* function is part of an optional group *)
   progress : bool;                (* function can generate progress messages *)
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index 864b6b1..a8efec3 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -52,6 +52,7 @@ libguestfs_gobject_1_0_ladir = $(includedir)/guestfs-gobject
 libguestfs_gobject_1_0_la_HEADERS = $(guestfs_gobject_headers)
 libguestfs_gobject_1_0_la_SOURCES = $(guestfs_gobject_sources)
 libguestfs_gobject_1_0_la_CFLAGS = -I$(top_srcdir)/src -I$(srcdir)/include \
+                                   -DGUESTFS_PRIVATE=1 \
                                    $(GOBJECT_CFLAGS)
 libguestfs_gobject_1_0_la_LIBS = $(GOBJECT_LIBS)
 libguestfs_gobject_1_0_la_LDFLAGS = $(LDFLAGS) -L$(top_builddir)/src
diff --git a/java/Makefile.am b/java/Makefile.am
index 449f40b..5f6499b 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -79,7 +79,7 @@ libguestfs_jni_la_SOURCES = \
 libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO) -shared
 libguestfs_jni_la_CFLAGS = \
-	-DGUESTFS_PRIVATE_FUNCTIONS=1 \
+	-DGUESTFS_PRIVATE=1 \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
 	$(JNI_CFLAGS)
diff --git a/lua/Makefile.am b/lua/Makefile.am
index 9b0f7de..621366e 100644
--- a/lua/Makefile.am
+++ b/lua/Makefile.am
@@ -41,6 +41,7 @@ libluaguestfs_la_SOURCES = lua-guestfs.c
 libluaguestfs_la_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-DGUESTFS_PRIVATE=1 \
 	$(LUA_CFLAGS)
 libluaguestfs_la_LIBADD = $(top_builddir)/src/libguestfs.la
 libluaguestfs_la_LDFLAGS = -avoid-version -shared
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 3bd2a78..f935282 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -64,7 +64,7 @@ mlguestfs.cmxa: libguestfsocaml.a guestfs.cmx
 	  -L$(top_builddir)/src/.libs -lguestfs
 
 libguestfsocaml_a_CFLAGS = \
-	-DGUESTFS_PRIVATE_FUNCTIONS=1 \
+	-DGUESTFS_PRIVATE=1 \
 	-I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in
index 11a976a..5487e98 100644
--- a/perl/Makefile.PL.in
+++ b/perl/Makefile.PL.in
@@ -27,5 +27,5 @@ WriteMakefile (
     LIBS => '-L top_builddir@/src/.libs -lguestfs',
     INC => '-I top_builddir@/src -I top_srcdir@/src',
     TYPEMAPS => [ '@srcdir@/typemap' ],
-    CCFLAGS => $Config{ccflags} . ' -DGUESTFS_PRIVATE_FUNCTIONS=1 @CFLAGS@',
+    CCFLAGS => $Config{ccflags} . ' -DGUESTFS_PRIVATE=1 @CFLAGS@',
     );
diff --git a/php/Makefile.am b/php/Makefile.am
index 220f13a..a369060 100644
--- a/php/Makefile.am
+++ b/php/Makefile.am
@@ -43,6 +43,7 @@ all: extension/config.h
 	$(MAKE) -C extension \
 	  EXTRA_INCLUDES="-I$(abs_srcdir)/../src" \
 	  EXTRA_LDFLAGS="-L$(abs_srcdir)/../src/.libs -lguestfs" \
+	  EXTRA_CFLAGS="-DGUESTFS_PRIVATE=1" \
 	  all
 
 extension/config.h: extension/config.m4 ../config.status
diff --git a/python/Makefile.am b/python/Makefile.am
index d03bfcf..209f9ca 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -41,7 +41,7 @@ python_LTLIBRARIES = libguestfsmod.la
 
 libguestfsmod_la_SOURCES = guestfs-py.c guestfs-py.h guestfs-py-byhand.c
 libguestfsmod_la_CFLAGS = \
-	-DGUESTFS_PRIVATE_FUNCTIONS=1 \
+	-DGUESTFS_PRIVATE=1 \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	-I$(PYTHON_INCLUDEDIR) \
 	-I$(top_srcdir)/src -I$(top_builddir)/src
diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in
index 15259ea..269ca81 100644
--- a/ruby/ext/guestfs/extconf.rb.in
+++ b/ruby/ext/guestfs/extconf.rb.in
@@ -30,7 +30,7 @@ unless have_library("guestfs", "guestfs_create", "guestfs.h")
 end
 
 $CFLAGS =
-  "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1 " <<
+  "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " <<
   "@WARN_CFLAGS@ @WERROR_CFLAGS@"
 
 create_header
diff --git a/src/Makefile.am b/src/Makefile.am
index 1057245..acdbe74 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -195,7 +195,7 @@ libguestfs_la_LIBADD += liberrnostring.la libprotocol.la
 libguestfs_la_CFLAGS = \
 	-DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-DGUESTFS_PRIVATE_FUNCTIONS=1 \
+	-DGUESTFS_PRIVATE=1 \
 	-DLIBOSINFO_DB_PATH='"$(datadir)/libosinfo/db"' \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am
index 25078c9..0b664d3 100644
--- a/tests/c-api/Makefile.am
+++ b/tests/c-api/Makefile.am
@@ -72,6 +72,7 @@ TESTS_ENVIRONMENT = \
 tests_SOURCES = tests.c
 tests_CFLAGS = \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-DGUESTFS_PRIVATE=1 \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(GPROF_CFLAGS) $(GCOV_CFLAGS)
 tests_LDADD = $(top_builddir)/src/libguestfs.la
-- 
1.8.1


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