Pino Toscano
2016-Nov-08 13:30 UTC
[Libguestfs] [PATCH 1/3] generator: c: move internal functions
Move the generate_all_structs and generate_all_headers functions, previously internal within the implementation of generate_guestfs_h, to be usable by other functions in the same "C" module (but not public). Only code motion. --- generator/c.ml | 163 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 82 insertions(+), 81 deletions(-) diff --git a/generator/c.ml b/generator/c.ml index 6f5a517..f0df5ea 100644 --- a/generator/c.ml +++ b/generator/c.ml @@ -585,21 +585,85 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char * /* Structures. */ "; - (* The structures are carefully written to have exactly the same - * in-memory format as the XDR structures that we use on the wire to - * the daemon. The reason for creating copies of these structures - * here is just so we don't have to export the whole of - * guestfs_protocol.h (which includes much unrelated and - * XDR-dependent stuff that we don't want to be public, or required - * by clients). - * - * To reiterate, we will pass these structures to and from the client - * with a simple assignment or memcpy, so the format must be - * identical to what rpcgen / the RFC defines. - *) - (* Public structures. *) - let generate_all_structs = List.iter ( + generate_all_structs external_structs; + + pr "\ +/* Actions. */ +"; + + generate_all_headers public_functions_sorted; + + pr "\ +#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. */ + +"; + + generate_all_headers private_functions_sorted; + + pr "\ +/* Private structures. */ + +"; + + generate_all_structs internal_structs; + +pr "\ + +#endif /* End of GUESTFS_PRIVATE. */ + +/* Deprecated macros. Use GUESTFS_HAVE_* instead. */ + +#define LIBGUESTFS_HAVE_CREATE_FLAGS 1 +#define LIBGUESTFS_HAVE_LAST_ERRNO 1 +#define LIBGUESTFS_HAVE_PUSH_ERROR_HANDLER 1 +#define LIBGUESTFS_HAVE_POP_ERROR_HANDLER 1 +#define LIBGUESTFS_HAVE_SET_EVENT_CALLBACK 1 +#define LIBGUESTFS_HAVE_DELETE_EVENT_CALLBACK 1 +#define LIBGUESTFS_HAVE_SET_CLOSE_CALLBACK 1 +#define LIBGUESTFS_HAVE_SET_PROGRESS_CALLBACK 1 +#define LIBGUESTFS_HAVE_SET_PRIVATE 1 +#define LIBGUESTFS_HAVE_GET_PRIVATE 1 +#define LIBGUESTFS_HAVE_FIRST_PRIVATE 1 +#define LIBGUESTFS_HAVE_NEXT_PRIVATE 1 + +"; + + List.iter ( + fun { name = shortname } -> + pr "#define LIBGUESTFS_HAVE_%s 1\n" (String.uppercase shortname); + ) public_functions_sorted; + + pr " +/* End of deprecated macros. */ + +#ifdef __cplusplus +} +#endif + +#endif /* GUESTFS_H_ */ +" + +(* The structures are carefully written to have exactly the same + * in-memory format as the XDR structures that we use on the wire to + * the daemon. The reason for creating copies of these structures + * here is just so we don't have to export the whole of + * guestfs_protocol.h (which includes much unrelated and + * XDR-dependent stuff that we don't want to be public, or required + * by clients). + * + * To reiterate, we will pass these structures to and from the client + * with a simple assignment or memcpy, so the format must be + * identical to what rpcgen / the RFC defines. + *) +and generate_all_structs structs + List.iter ( fun { s_name = typ; s_cols = cols } -> pr "#define GUESTFS_HAVE_STRUCT_%s 1\n" (String.uppercase typ); pr "\n"; @@ -634,14 +698,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" - ) in - - generate_all_structs external_structs; - - pr "\ -/* Actions. */ -"; + ) structs +and generate_all_headers actions let generate_action_header { name = shortname; style = ret, args, optargs as style; deprecated_by = deprecated_by } @@ -700,7 +759,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char * pr "\n" in - let generate_all_headers = List.iter ( + 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 @@ -712,65 +771,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char * ) else generate_action_header f - ) in - - generate_all_headers public_functions_sorted; - - pr "\ -#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. */ - -"; - - generate_all_headers private_functions_sorted; - - pr "\ -/* Private structures. */ - -"; - - generate_all_structs internal_structs; - -pr "\ - -#endif /* End of GUESTFS_PRIVATE. */ - -/* Deprecated macros. Use GUESTFS_HAVE_* instead. */ - -#define LIBGUESTFS_HAVE_CREATE_FLAGS 1 -#define LIBGUESTFS_HAVE_LAST_ERRNO 1 -#define LIBGUESTFS_HAVE_PUSH_ERROR_HANDLER 1 -#define LIBGUESTFS_HAVE_POP_ERROR_HANDLER 1 -#define LIBGUESTFS_HAVE_SET_EVENT_CALLBACK 1 -#define LIBGUESTFS_HAVE_DELETE_EVENT_CALLBACK 1 -#define LIBGUESTFS_HAVE_SET_CLOSE_CALLBACK 1 -#define LIBGUESTFS_HAVE_SET_PROGRESS_CALLBACK 1 -#define LIBGUESTFS_HAVE_SET_PRIVATE 1 -#define LIBGUESTFS_HAVE_GET_PRIVATE 1 -#define LIBGUESTFS_HAVE_FIRST_PRIVATE 1 -#define LIBGUESTFS_HAVE_NEXT_PRIVATE 1 - -"; - - List.iter ( - fun { name = shortname } -> - pr "#define LIBGUESTFS_HAVE_%s 1\n" (String.uppercase shortname); - ) public_functions_sorted; - - pr " -/* End of deprecated macros. */ - -#ifdef __cplusplus -} -#endif - -#endif /* GUESTFS_H_ */ -" + ) actions (* Generate the guestfs-internal-actions.h file. *) and generate_internal_actions_h () -- 2.7.4
Pino Toscano
2016-Nov-08 13:30 UTC
[Libguestfs] [PATCH 2/3] Split internal stuff out of guestfs.h
Create a new guestfs-private.h header, and move there the definitions of all the actions with visibility VInternal, and all the private structs: they are not meant to be used, not even seen, outside of the library. Include the new header where needed, which means also a couple of places outside the library (but they are tests, so it is acceptable for now). The result of this is mostly motion of function and structs declarations. --- .gitignore | 1 + generator/c.ml | 52 +++++++++++++++++++++---- generator/c.mli | 1 + generator/main.ml | 1 + generator/tests_c_api.ml | 1 + src/available.c | 1 + src/drives.c | 1 + src/file.c | 1 + src/handle.c | 1 + src/inspect-fs.c | 1 + src/journal.c | 1 + src/mountable.c | 1 + src/tsk.c | 1 + tests/mountable/test-internal-parse-mountable.c | 1 + tests/regressions/rhbz914931.c | 1 + 15 files changed, 58 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 633b39d..8235f77 100644 --- a/.gitignore +++ b/.gitignore @@ -505,6 +505,7 @@ Makefile.in /src/guestfs_protocol.c /src/guestfs_protocol.h /src/guestfs_protocol.x +/src/guestfs-private.h /src/guestfs-structs.pod /src/libguestfs.3 /src/libguestfs.pc diff --git a/generator/c.ml b/generator/c.ml index f0df5ea..4497c48 100644 --- a/generator/c.ml +++ b/generator/c.ml @@ -39,7 +39,13 @@ let is_public { visibility = v } = match v with | VPublic | VPublicNoFish | VStateTest | VDebug -> true | VBindTest | VInternal -> false -let is_private f = not (is_public f) +let is_private { visibility = v } = match v with + | VBindTest -> true + | VPublic | VPublicNoFish | VStateTest | VDebug | VInternal -> false + +let is_internal { visibility = v } = match v with + | VInternal -> true + | VPublic | VPublicNoFish | VStateTest | VDebug | VBindTest -> false let public_functions_sorted List.filter is_public (actions |> sort) @@ -47,6 +53,9 @@ let public_functions_sorted let private_functions_sorted List.filter is_private (actions |> sort) +let internal_functions_sorted + List.filter is_internal (actions |> sort) + (* Generate a C function prototype. *) let rec generate_prototype ?(extern = true) ?(static = false) ?(semicolon = true) @@ -607,13 +616,6 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char * generate_all_headers private_functions_sorted; - pr "\ -/* Private structures. */ - -"; - - generate_all_structs internal_structs; - pr "\ #endif /* End of GUESTFS_PRIVATE. */ @@ -650,6 +652,34 @@ pr "\ #endif /* GUESTFS_H_ */ " +(* Generate the guestfs-private.h file. *) +and generate_guestfs_private_h () + generate_header CStyle LGPLv2plus; + + pr "\ +#ifndef GUESTFS_PRIVATE_H_ +#define GUESTFS_PRIVATE_H_ + +#include \"guestfs.h\" + +/* Private functions. */ + +"; + + generate_all_headers internal_functions_sorted; + + pr "\ +/* Private structures. */ + +"; + + generate_all_structs internal_structs; + + pr "\ + +#endif /* GUESTFS_PRIVATE_H_ */ +" + (* The structures are carefully written to have exactly the same * in-memory format as the XDR structures that we use on the wire to * the daemon. The reason for creating copies of these structures @@ -856,6 +886,7 @@ and generate_client_structs_free () #include <stdlib.h> #include \"guestfs.h\" +#include \"guestfs-private.h\" #include \"guestfs-internal.h\" #include \"guestfs_protocol.h\" @@ -905,6 +936,7 @@ and generate_client_structs_compare () #include <errno.h> #include \"guestfs.h\" +#include \"guestfs-private.h\" #include \"guestfs-internal.h\" "; @@ -990,6 +1022,7 @@ and generate_client_structs_copy () #include <errno.h> #include \"guestfs.h\" +#include \"guestfs-private.h\" #include \"guestfs-internal.h\" "; @@ -1173,6 +1206,7 @@ and generate_client_structs_cleanup () #include <stdlib.h> #include \"guestfs.h\" +#include \"guestfs-private.h\" #include \"guestfs-internal-frontend.h\" "; @@ -1213,6 +1247,7 @@ and generate_client_structs_print_c () #include \"c-ctype.h\" #include \"guestfs.h\" +#include \"guestfs-private.h\" #include \"structs-print.h\" "; @@ -1341,6 +1376,7 @@ and generate_client_actions actions () #include <string.h> #include \"guestfs.h\" +#include \"guestfs-private.h\" #include \"guestfs-internal.h\" #include \"guestfs-internal-actions.h\" #include \"guestfs_protocol.h\" diff --git a/generator/c.mli b/generator/c.mli index 8c4e86c..2d4dcfa 100644 --- a/generator/c.mli +++ b/generator/c.mli @@ -34,6 +34,7 @@ val generate_client_structs_print_h : unit -> unit val generate_client_structs_print_c : unit -> unit val generate_event_string_c : unit -> unit val generate_guestfs_h : unit -> unit +val generate_guestfs_private_h : unit -> unit val generate_internal_actions_h : unit -> unit val generate_internal_frontend_cleanups_h : unit -> unit val generate_linker_script : unit -> unit diff --git a/generator/main.ml b/generator/main.ml index 8d385d1..9016063 100644 --- a/generator/main.ml +++ b/generator/main.ml @@ -96,6 +96,7 @@ Run it from the top source directory using the command output_to "src/guestfs_protocol.x" generate_xdr; output_to "src/guestfs.h" generate_guestfs_h; + output_to "src/guestfs-private.h" generate_guestfs_private_h; output_to "src/guestfs-internal-actions.h" generate_internal_actions_h; output_to "src/guestfs-internal-frontend-cleanups.h" generate_internal_frontend_cleanups_h; diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml index 21ef6e3..83a8332 100644 --- a/generator/tests_c_api.ml +++ b/generator/tests_c_api.ml @@ -46,6 +46,7 @@ let rec generate_c_api_tests () #include <errno.h> #include \"guestfs.h\" +#include \"guestfs-private.h\" #include \"guestfs-internal-frontend.h\" #include \"tests.h\" diff --git a/src/available.c b/src/available.c index ae0bd84..4609f34 100644 --- a/src/available.c +++ b/src/available.c @@ -22,6 +22,7 @@ #include <libintl.h> #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" diff --git a/src/drives.c b/src/drives.c index 1e3b0af..de0ab2b 100644 --- a/src/drives.c +++ b/src/drives.c @@ -37,6 +37,7 @@ #include "ignore-value.h" #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" diff --git a/src/file.c b/src/file.c index d57c4e1..2499000 100644 --- a/src/file.c +++ b/src/file.c @@ -30,6 +30,7 @@ #include "full-write.h" #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" diff --git a/src/handle.c b/src/handle.c index 0796015..1d89e4b 100644 --- a/src/handle.c +++ b/src/handle.c @@ -37,6 +37,7 @@ #include "getprogname.h" #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" diff --git a/src/inspect-fs.c b/src/inspect-fs.c index 5e5b004..244a0ee 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -34,6 +34,7 @@ #include "xstrtol.h" #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal.h" static int check_filesystem (guestfs_h *g, const char *mountable, diff --git a/src/journal.c b/src/journal.c index 22b81de..e79520d 100644 --- a/src/journal.c +++ b/src/journal.c @@ -42,6 +42,7 @@ #include "full-read.h" #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" diff --git a/src/mountable.c b/src/mountable.c index 9f7b451..45e7299 100644 --- a/src/mountable.c +++ b/src/mountable.c @@ -21,6 +21,7 @@ #include <errno.h> #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" diff --git a/src/tsk.c b/src/tsk.c index 1def9c9..b017550 100644 --- a/src/tsk.c +++ b/src/tsk.c @@ -29,6 +29,7 @@ #include <rpc/types.h> #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs_protocol.h" #include "guestfs-internal.h" #include "guestfs-internal-all.h" diff --git a/tests/mountable/test-internal-parse-mountable.c b/tests/mountable/test-internal-parse-mountable.c index ab86ccb..961ee25 100644 --- a/tests/mountable/test-internal-parse-mountable.c +++ b/tests/mountable/test-internal-parse-mountable.c @@ -27,6 +27,7 @@ #include <error.h> #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal-all.h" int diff --git a/tests/regressions/rhbz914931.c b/tests/regressions/rhbz914931.c index 93878db..6d09b19 100644 --- a/tests/regressions/rhbz914931.c +++ b/tests/regressions/rhbz914931.c @@ -31,6 +31,7 @@ #include <error.h> #include "guestfs.h" +#include "guestfs-private.h" #include "guestfs-internal-frontend.h" #include "getprogname.h" -- 2.7.4
Pino Toscano
2016-Nov-08 13:30 UTC
[Libguestfs] [PATCH 3/3] generator: do not output GUESTFS_HAVE_* defines for internal stuff
Output the GUESTFS_HAVE_* defines only for actions with visibility different than VInternal, and for structs not marked as internal. The reason is that all the above are usable only by the library itself (and at most by tests), and users of the library now cannot even get the function declarations. --- generator/c.ml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/generator/c.ml b/generator/c.ml index 4497c48..bee1ab0 100644 --- a/generator/c.ml +++ b/generator/c.ml @@ -694,9 +694,11 @@ and generate_guestfs_private_h () *) and generate_all_structs structs List.iter ( - fun { s_name = typ; s_cols = cols } -> - pr "#define GUESTFS_HAVE_STRUCT_%s 1\n" (String.uppercase typ); - pr "\n"; + fun { s_name = typ; s_cols = cols; s_internal = internal } -> + if not internal then ( + pr "#define GUESTFS_HAVE_STRUCT_%s 1\n" (String.uppercase typ); + pr "\n"; + ); pr "struct guestfs_%s {\n" typ; List.iter ( function @@ -731,10 +733,12 @@ and generate_all_structs structs ) structs and generate_all_headers actions - let generate_action_header { name = shortname; - style = ret, args, optargs as style; - deprecated_by = deprecated_by } - pr "#define GUESTFS_HAVE_%s 1\n" (String.uppercase shortname); + let generate_action_header ({ name = shortname; + style = ret, args, optargs as style; + deprecated_by = deprecated_by } as act) + let not_internal = not (is_internal act) in + if not_internal then + pr "#define GUESTFS_HAVE_%s 1\n" (String.uppercase shortname); if optargs <> [] then ( iteri ( -- 2.7.4
Richard W.M. Jones
2016-Dec-07 12:49 UTC
Re: [Libguestfs] [PATCH 2/3] Split internal stuff out of guestfs.h
On Tue, Nov 08, 2016 at 02:30:19PM +0100, Pino Toscano wrote:> Create a new guestfs-private.h header, and move there the definitions of > all the actions with visibility VInternal, and all the private structs: > they are not meant to be used, not even seen, outside of the library. > > Include the new header where needed, which means also a couple of places > outside the library (but they are tests, so it is acceptable for now). > > The result of this is mostly motion of function and structs > declarations.OK I understand why this change is made, but the naming of the new header is super-confusing. We already have guestfs-internal.h and guestfs-internal-actions.h (containing guestfs_impl_*), and now we're adding guestfs-private.h containing guestfs_internal_* functions. Hmm. So the idea is fine, but renaming things to make them more sensible. How about guestfs-internal-impl.h for guestfs_impl_* and guestfs-internal-apis.h for guestfs_internal_* ? Rich.> .gitignore | 1 + > generator/c.ml | 52 +++++++++++++++++++++---- > generator/c.mli | 1 + > generator/main.ml | 1 + > generator/tests_c_api.ml | 1 + > src/available.c | 1 + > src/drives.c | 1 + > src/file.c | 1 + > src/handle.c | 1 + > src/inspect-fs.c | 1 + > src/journal.c | 1 + > src/mountable.c | 1 + > src/tsk.c | 1 + > tests/mountable/test-internal-parse-mountable.c | 1 + > tests/regressions/rhbz914931.c | 1 + > 15 files changed, 58 insertions(+), 8 deletions(-) > > diff --git a/.gitignore b/.gitignore > index 633b39d..8235f77 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -505,6 +505,7 @@ Makefile.in > /src/guestfs_protocol.c > /src/guestfs_protocol.h > /src/guestfs_protocol.x > +/src/guestfs-private.h > /src/guestfs-structs.pod > /src/libguestfs.3 > /src/libguestfs.pc > diff --git a/generator/c.ml b/generator/c.ml > index f0df5ea..4497c48 100644 > --- a/generator/c.ml > +++ b/generator/c.ml > @@ -39,7 +39,13 @@ let is_public { visibility = v } = match v with > | VPublic | VPublicNoFish | VStateTest | VDebug -> true > | VBindTest | VInternal -> false > > -let is_private f = not (is_public f) > +let is_private { visibility = v } = match v with > + | VBindTest -> true > + | VPublic | VPublicNoFish | VStateTest | VDebug | VInternal -> false > + > +let is_internal { visibility = v } = match v with > + | VInternal -> true > + | VPublic | VPublicNoFish | VStateTest | VDebug | VBindTest -> false > > let public_functions_sorted > List.filter is_public (actions |> sort) > @@ -47,6 +53,9 @@ let public_functions_sorted > let private_functions_sorted > List.filter is_private (actions |> sort) > > +let internal_functions_sorted > + List.filter is_internal (actions |> sort) > + > (* Generate a C function prototype. *) > let rec generate_prototype ?(extern = true) ?(static = false) > ?(semicolon = true) > @@ -607,13 +616,6 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char * > > generate_all_headers private_functions_sorted; > > - pr "\ > -/* Private structures. */ > - > -"; > - > - generate_all_structs internal_structs; > - > pr "\ > > #endif /* End of GUESTFS_PRIVATE. */ > @@ -650,6 +652,34 @@ pr "\ > #endif /* GUESTFS_H_ */ > " > > +(* Generate the guestfs-private.h file. *) > +and generate_guestfs_private_h () > + generate_header CStyle LGPLv2plus; > + > + pr "\ > +#ifndef GUESTFS_PRIVATE_H_ > +#define GUESTFS_PRIVATE_H_ > + > +#include \"guestfs.h\" > + > +/* Private functions. */ > + > +"; > + > + generate_all_headers internal_functions_sorted; > + > + pr "\ > +/* Private structures. */ > + > +"; > + > + generate_all_structs internal_structs; > + > + pr "\ > + > +#endif /* GUESTFS_PRIVATE_H_ */ > +" > + > (* The structures are carefully written to have exactly the same > * in-memory format as the XDR structures that we use on the wire to > * the daemon. The reason for creating copies of these structures > @@ -856,6 +886,7 @@ and generate_client_structs_free () > #include <stdlib.h> > > #include \"guestfs.h\" > +#include \"guestfs-private.h\" > #include \"guestfs-internal.h\" > #include \"guestfs_protocol.h\" > > @@ -905,6 +936,7 @@ and generate_client_structs_compare () > #include <errno.h> > > #include \"guestfs.h\" > +#include \"guestfs-private.h\" > #include \"guestfs-internal.h\" > > "; > @@ -990,6 +1022,7 @@ and generate_client_structs_copy () > #include <errno.h> > > #include \"guestfs.h\" > +#include \"guestfs-private.h\" > #include \"guestfs-internal.h\" > > "; > @@ -1173,6 +1206,7 @@ and generate_client_structs_cleanup () > #include <stdlib.h> > > #include \"guestfs.h\" > +#include \"guestfs-private.h\" > #include \"guestfs-internal-frontend.h\" > > "; > @@ -1213,6 +1247,7 @@ and generate_client_structs_print_c () > #include \"c-ctype.h\" > > #include \"guestfs.h\" > +#include \"guestfs-private.h\" > #include \"structs-print.h\" > > "; > @@ -1341,6 +1376,7 @@ and generate_client_actions actions () > #include <string.h> > > #include \"guestfs.h\" > +#include \"guestfs-private.h\" > #include \"guestfs-internal.h\" > #include \"guestfs-internal-actions.h\" > #include \"guestfs_protocol.h\" > diff --git a/generator/c.mli b/generator/c.mli > index 8c4e86c..2d4dcfa 100644 > --- a/generator/c.mli > +++ b/generator/c.mli > @@ -34,6 +34,7 @@ val generate_client_structs_print_h : unit -> unit > val generate_client_structs_print_c : unit -> unit > val generate_event_string_c : unit -> unit > val generate_guestfs_h : unit -> unit > +val generate_guestfs_private_h : unit -> unit > val generate_internal_actions_h : unit -> unit > val generate_internal_frontend_cleanups_h : unit -> unit > val generate_linker_script : unit -> unit > diff --git a/generator/main.ml b/generator/main.ml > index 8d385d1..9016063 100644 > --- a/generator/main.ml > +++ b/generator/main.ml > @@ -96,6 +96,7 @@ Run it from the top source directory using the command > > output_to "src/guestfs_protocol.x" generate_xdr; > output_to "src/guestfs.h" generate_guestfs_h; > + output_to "src/guestfs-private.h" generate_guestfs_private_h; > output_to "src/guestfs-internal-actions.h" generate_internal_actions_h; > output_to "src/guestfs-internal-frontend-cleanups.h" > generate_internal_frontend_cleanups_h; > diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml > index 21ef6e3..83a8332 100644 > --- a/generator/tests_c_api.ml > +++ b/generator/tests_c_api.ml > @@ -46,6 +46,7 @@ let rec generate_c_api_tests () > #include <errno.h> > > #include \"guestfs.h\" > +#include \"guestfs-private.h\" > #include \"guestfs-internal-frontend.h\" > > #include \"tests.h\" > diff --git a/src/available.c b/src/available.c > index ae0bd84..4609f34 100644 > --- a/src/available.c > +++ b/src/available.c > @@ -22,6 +22,7 @@ > #include <libintl.h> > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal.h" > #include "guestfs-internal-actions.h" > > diff --git a/src/drives.c b/src/drives.c > index 1e3b0af..de0ab2b 100644 > --- a/src/drives.c > +++ b/src/drives.c > @@ -37,6 +37,7 @@ > #include "ignore-value.h" > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal.h" > #include "guestfs-internal-actions.h" > > diff --git a/src/file.c b/src/file.c > index d57c4e1..2499000 100644 > --- a/src/file.c > +++ b/src/file.c > @@ -30,6 +30,7 @@ > #include "full-write.h" > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal.h" > #include "guestfs-internal-actions.h" > > diff --git a/src/handle.c b/src/handle.c > index 0796015..1d89e4b 100644 > --- a/src/handle.c > +++ b/src/handle.c > @@ -37,6 +37,7 @@ > #include "getprogname.h" > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal.h" > #include "guestfs-internal-actions.h" > > diff --git a/src/inspect-fs.c b/src/inspect-fs.c > index 5e5b004..244a0ee 100644 > --- a/src/inspect-fs.c > +++ b/src/inspect-fs.c > @@ -34,6 +34,7 @@ > #include "xstrtol.h" > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal.h" > > static int check_filesystem (guestfs_h *g, const char *mountable, > diff --git a/src/journal.c b/src/journal.c > index 22b81de..e79520d 100644 > --- a/src/journal.c > +++ b/src/journal.c > @@ -42,6 +42,7 @@ > #include "full-read.h" > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal.h" > #include "guestfs-internal-actions.h" > > diff --git a/src/mountable.c b/src/mountable.c > index 9f7b451..45e7299 100644 > --- a/src/mountable.c > +++ b/src/mountable.c > @@ -21,6 +21,7 @@ > #include <errno.h> > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal.h" > #include "guestfs-internal-actions.h" > > diff --git a/src/tsk.c b/src/tsk.c > index 1def9c9..b017550 100644 > --- a/src/tsk.c > +++ b/src/tsk.c > @@ -29,6 +29,7 @@ > #include <rpc/types.h> > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs_protocol.h" > #include "guestfs-internal.h" > #include "guestfs-internal-all.h" > diff --git a/tests/mountable/test-internal-parse-mountable.c b/tests/mountable/test-internal-parse-mountable.c > index ab86ccb..961ee25 100644 > --- a/tests/mountable/test-internal-parse-mountable.c > +++ b/tests/mountable/test-internal-parse-mountable.c > @@ -27,6 +27,7 @@ > #include <error.h> > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal-all.h" > > int > diff --git a/tests/regressions/rhbz914931.c b/tests/regressions/rhbz914931.c > index 93878db..6d09b19 100644 > --- a/tests/regressions/rhbz914931.c > +++ b/tests/regressions/rhbz914931.c > @@ -31,6 +31,7 @@ > #include <error.h> > > #include "guestfs.h" > +#include "guestfs-private.h" > #include "guestfs-internal-frontend.h" > > #include "getprogname.h" > -- > 2.7.4 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfs-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Richard W.M. Jones
2016-Dec-07 12:49 UTC
Re: [Libguestfs] [PATCH 2/3] Split internal stuff out of guestfs.h
Oh and just make "guestfs-internal.h" include those other two files, and drop explicit includes of guestfs-internal-actions.h everywhere. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org