These won't be used by the daemon, so interferes with us using common/utils in the daemon, so they are moved to a different library. --- .gitignore | 8 +++--- Makefile.am | 4 ++- align/Makefile.am | 2 ++ align/scan.c | 1 + cat/Makefile.am | 10 ++++++++ cat/filesystems.c | 1 + cat/log.c | 1 + cat/tail.c | 1 + common/mlvisit/Makefile.am | 3 ++- common/structs/Makefile.am | 44 ++++++++++++++++++++++++++++++++ common/utils/Makefile.am | 16 ------------ common/utils/guestfs-internal-frontend.h | 5 ---- common/visit/Makefile.am | 3 ++- common/visit/visit.c | 1 + configure.ac | 1 + df/Makefile.am | 2 ++ df/df.c | 1 + diff/Makefile.am | 1 + docs/C_SOURCE_FILES | 8 +++--- docs/guestfs-hacking.pod | 5 ++++ fish/Makefile.am | 4 +++ generator/c.ml | 17 +++++------- generator/c.mli | 4 +-- generator/java.ml | 1 + generator/main.ml | 12 ++++----- generator/tests_c_api.ml | 1 + inspector/Makefile.am | 2 ++ inspector/inspector.c | 1 + java/Makefile.am | 2 ++ lib/Makefile.am | 6 ++++- lib/file.c | 1 + lib/fuse.c | 1 + lib/inspect-apps.c | 1 + lib/inspect-fs-windows.c | 1 + lib/inspect-fs.c | 1 + lib/launch.c | 1 + lib/listfs.c | 1 + lib/mountable.c | 2 +- make-fs/Makefile.am | 2 ++ make-fs/make-fs.c | 1 + sysprep/Makefile.am | 2 ++ tests/c-api/Makefile.am | 2 ++ tests/c-api/tests-main.c | 1 + 43 files changed, 133 insertions(+), 52 deletions(-)
diff --git a/.gitignore b/.gitignore index ef3b9997f..019b96da5 100644 --- a/.gitignore +++ b/.gitignore @@ -137,10 +137,10 @@ Makefile.in /common/protocol/guestfs_protocol.h /common/protocol/guestfs_protocol.x /common/qemuopts/qemuopts-tests -/common/utils/guestfs-internal-frontend-cleanups.h -/common/utils/structs-cleanup.c -/common/utils/structs-print.c -/common/utils/structs-print.h +/common/structs/structs-cleanups.c +/common/structs/structs-cleanups.h +/common/structs/structs-print.c +/common/structs/structs-print.h /compile /config.cache /config.guess diff --git a/Makefile.am b/Makefile.am index 64ac23f2e..b14ce4813 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,9 @@ SUBDIRS += gnulib/tests endif # Basic source for the library. -SUBDIRS += common/errnostring common/protocol common/qemuopts common/utils +SUBDIRS += common/errnostring common/protocol common/qemuopts +SUBDIRS += common/utils +SUBDIRS += common/structs SUBDIRS += lib docs examples po # The daemon and the appliance. diff --git a/align/Makefile.am b/align/Makefile.am index 8d4fce11b..cc8df13f7 100644 --- a/align/Makefile.am +++ b/align/Makefile.am @@ -31,6 +31,7 @@ virt_alignment_scan_SOURCES = \ virt_alignment_scan_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ @@ -46,6 +47,7 @@ virt_alignment_scan_CFLAGS = \ virt_alignment_scan_LDADD = \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/parallel/libparallel.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/align/scan.c b/align/scan.c index 4fa95c0a3..b9f29868c 100644 --- a/align/scan.c +++ b/align/scan.c @@ -41,6 +41,7 @@ #include "getprogname.h" #include "guestfs.h" +#include "structs-cleanups.h" #include "options.h" #include "display-options.h" #include "parallel.h" diff --git a/cat/Makefile.am b/cat/Makefile.am index 4b9171937..3fb579769 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -39,6 +39,7 @@ virt_cat_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ @@ -51,6 +52,7 @@ virt_cat_CFLAGS = \ virt_cat_LDADD = \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/windows/libwindows.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ @@ -65,6 +67,7 @@ virt_filesystems_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ @@ -77,6 +80,7 @@ virt_filesystems_CFLAGS = \ virt_filesystems_LDADD = \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/windows/libwindows.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ @@ -91,6 +95,7 @@ virt_log_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ @@ -102,6 +107,7 @@ virt_log_CFLAGS = \ virt_log_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ @@ -116,6 +122,7 @@ virt_ls_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/visit \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ @@ -129,6 +136,7 @@ virt_ls_CFLAGS = \ virt_ls_LDADD = \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/visit/libvisit.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ @@ -143,6 +151,7 @@ virt_tail_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ @@ -155,6 +164,7 @@ virt_tail_CFLAGS = \ virt_tail_LDADD = \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/windows/libwindows.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/cat/filesystems.c b/cat/filesystems.c index f3dd265ab..74e994169 100644 --- a/cat/filesystems.c +++ b/cat/filesystems.c @@ -37,6 +37,7 @@ #include "getprogname.h" #include "guestfs.h" +#include "structs-cleanups.h" #include "options.h" #include "display-options.h" diff --git a/cat/log.c b/cat/log.c index 92272b8d1..6e445af0b 100644 --- a/cat/log.c +++ b/cat/log.c @@ -38,6 +38,7 @@ #include "getprogname.h" #include "guestfs.h" +#include "structs-cleanups.h" #include "options.h" #include "display-options.h" diff --git a/cat/tail.c b/cat/tail.c index 4ac73ad36..e932820e6 100644 --- a/cat/tail.c +++ b/cat/tail.c @@ -37,6 +37,7 @@ #include "ignore-value.h" #include "guestfs.h" +#include "structs-cleanups.h" #include "options.h" #include "display-options.h" #include "windows.h" diff --git a/common/mlvisit/Makefile.am b/common/mlvisit/Makefile.am index 51cbd2de6..2019efd75 100644 --- a/common/mlvisit/Makefile.am +++ b/common/mlvisit/Makefile.am @@ -74,6 +74,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/common/utils/.libs \ + -I $(top_builddir)/common/structs/.libs \ -I $(top_builddir)/common/visit/.libs \ -I $(builddir) OCAMLPACKAGES_TESTS = $(MLVISIT_CMA) @@ -115,7 +116,7 @@ visit_tests_DEPENDENCIES = \ $(top_srcdir)/ocaml-link.sh visit_tests_LINK = \ $(top_srcdir)/ocaml-link.sh \ - -cclib '-lvisit -lutils $(LIBXML2_LIBS) -lgnu' -- \ + -cclib '-lvisit -lstructs -lutils $(LIBXML2_LIBS) -lgnu' -- \ $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \ $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \ $(visit_tests_THEOBJECTS) -o $@ diff --git a/common/structs/Makefile.am b/common/structs/Makefile.am new file mode 100644 index 000000000..1762af276 --- /dev/null +++ b/common/structs/Makefile.am @@ -0,0 +1,44 @@ +# libguestfs +# Copyright (C) 2017 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +include $(top_srcdir)/subdir-rules.mk + +generator_built = \ + structs-cleanups.c \ + structs-cleanups.h \ + structs-print.c \ + structs-print.h + +BUILT_SOURCES = \ + $(generator_built) + +EXTRA_DIST = \ + $(BUILT_SOURCES) + +noinst_LTLIBRARIES = libstructs.la + +libstructs_la_SOURCES = \ + ../../lib/guestfs.h \ + $(BUILT_SOURCES) +libstructs_la_CPPFLAGS = \ + -DGUESTFS_WARN_DEPRECATED=1 \ + -DGUESTFS_PRIVATE=1 \ + -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib +libstructs_la_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + $(GCC_VISIBILITY_HIDDEN) diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am index 5c9728797..a86b715f6 100644 --- a/common/utils/Makefile.am +++ b/common/utils/Makefile.am @@ -17,18 +17,6 @@ include $(top_srcdir)/subdir-rules.mk -generator_built = \ - guestfs-internal-frontend-cleanups.h \ - structs-cleanup.c \ - structs-print.c \ - structs-print.h - -BUILT_SOURCES = \ - $(generator_built) - -EXTRA_DIST = \ - $(BUILT_SOURCES) - noinst_LTLIBRARIES = libutils.la libutils_la_SOURCES = \ @@ -36,11 +24,7 @@ libutils_la_SOURCES = \ cleanups.c \ cleanups.h \ guestfs-internal-frontend.h \ - guestfs-internal-frontend-cleanups.h \ libxml2-cleanups.c \ - structs-cleanup.c \ - structs-print.c \ - structs-print.h \ utils.c libutils_la_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ diff --git a/common/utils/guestfs-internal-frontend.h b/common/utils/guestfs-internal-frontend.h index 1d5a50664..3594d593e 100644 --- a/common/utils/guestfs-internal-frontend.h +++ b/common/utils/guestfs-internal-frontend.h @@ -63,11 +63,6 @@ extern void guestfs_int_fadvise_noreuse (int fd); //extern void guestfs_int_fadvise_willneed (int fd); extern char *guestfs_int_shell_unquote (const char *str); -/* These are in a separate header so the header can be generated. - * Don't include the following file directly: - */ -#include "guestfs-internal-frontend-cleanups.h" - /* Not all language bindings know how to deal with Pointer arguments. * Those that don't will use this macro which complains noisily and * returns NULL. diff --git a/common/visit/Makefile.am b/common/visit/Makefile.am index e95954a11..8b9136780 100644 --- a/common/visit/Makefile.am +++ b/common/visit/Makefile.am @@ -27,7 +27,8 @@ libvisit_la_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs libvisit_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(GCC_VISIBILITY_HIDDEN) diff --git a/common/visit/visit.c b/common/visit/visit.c index 5045f9f71..491f9dda3 100644 --- a/common/visit/visit.c +++ b/common/visit/visit.c @@ -37,6 +37,7 @@ #include "guestfs.h" #include "guestfs-internal-frontend.h" +#include "structs-cleanups.h" #include "visit.h" diff --git a/configure.ac b/configure.ac index eba149241..8c782368f 100644 --- a/configure.ac +++ b/configure.ac @@ -195,6 +195,7 @@ AC_CONFIG_FILES([Makefile common/progress/Makefile common/protocol/Makefile common/qemuopts/Makefile + common/structs/Makefile common/utils/Makefile common/visit/Makefile common/windows/Makefile diff --git a/df/Makefile.am b/df/Makefile.am index 8725402bc..89ec12a64 100644 --- a/df/Makefile.am +++ b/df/Makefile.am @@ -36,6 +36,7 @@ virt_df_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ @@ -50,6 +51,7 @@ virt_df_CFLAGS = \ virt_df_LDADD = \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/parallel/libparallel.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/df/df.c b/df/df.c index a13cc5910..66b1d8334 100644 --- a/df/df.c +++ b/df/df.c @@ -27,6 +27,7 @@ #include <errno.h> #include "guestfs.h" +#include "structs-cleanups.h" #include "options.h" #include "domains.h" #include "virt-df.h" diff --git a/diff/Makefile.am b/diff/Makefile.am index 5e71b74de..574981f8b 100644 --- a/diff/Makefile.am +++ b/diff/Makefile.am @@ -44,6 +44,7 @@ virt_diff_CFLAGS = \ virt_diff_LDADD = \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/visit/libvisit.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index e63eb3d7d..4ef563a83 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -42,14 +42,14 @@ common/progress/progress.h common/qemuopts/qemuopts-tests.c common/qemuopts/qemuopts.c common/qemuopts/qemuopts.h +common/structs/structs-cleanups.c +common/structs/structs-cleanups.h +common/structs/structs-print.c +common/structs/structs-print.h common/utils/cleanups.c common/utils/cleanups.h -common/utils/guestfs-internal-frontend-cleanups.h common/utils/guestfs-internal-frontend.h common/utils/libxml2-cleanups.c -common/utils/structs-cleanup.c -common/utils/structs-print.c -common/utils/structs-print.h common/utils/utils.c common/visit/visit.c common/visit/visit.h diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index beb44d2dc..fa00a9ab6 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -137,6 +137,11 @@ and the daemon running inside the appliance is defined here. Mini-library for writing qemu command lines and qemu config files. +=item F<common/structs> + +Common code for printing and freeing libguestfs structs, used by the +library and some tools. + =item F<common/utils> Various utility functions used throughout the library and tools. diff --git a/fish/Makefile.am b/fish/Makefile.am index 9c07761e2..a6efbb439 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -108,10 +108,12 @@ librc_protocol_la_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing libcmds_la_SOURCES = cmds-gperf.c libcmds_la_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib libcmds_la_CFLAGS = libcmds_la_LIBADD = \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(LTLIBINTL) @@ -124,6 +126,7 @@ guestfish_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/edit -I$(top_builddir)/common/edit \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ @@ -141,6 +144,7 @@ guestfish_LDADD = \ $(top_builddir)/common/edit/libedit.la \ $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/progress/libprogress.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/generator/c.ml b/generator/c.ml index 27bf1ebf9..c9fd867de 100644 --- a/generator/c.ml +++ b/generator/c.ml @@ -794,20 +794,17 @@ and generate_internal_actions_h () = pr "\n"; pr "#endif /* GUESTFS_INTERNAL_ACTIONS_H_ */\n" -(* Generate guestfs-internal-frontend-cleanups.h file. *) -and generate_internal_frontend_cleanups_h () = +(* Generate structs-cleanups.h file. *) +and generate_client_structs_cleanups_h () = generate_header CStyle LGPLv2plus; pr "\ /* These CLEANUP_* macros automatically free the struct or struct list * pointed to by the local variable at the end of the current scope. - * - * Don't include this file directly! To use these cleanups in library - * bindings and tools, include \"guestfs-internal-frontend.h\" only. */ -#ifndef GUESTFS_INTERNAL_FRONTEND_CLEANUPS_H_ -#define GUESTFS_INTERNAL_FRONTEND_CLEANUPS_H_ +#ifndef GUESTFS_STRUCTS_CLEANUPS_H_ +#define GUESTFS_STRUCTS_CLEANUPS_H_ #ifdef HAVE_ATTRIBUTE_CLEANUP "; @@ -846,7 +843,7 @@ and generate_internal_frontend_cleanups_h () = ) structs; pr "\n"; - pr "#endif /* GUESTFS_INTERNAL_FRONTEND_CLEANUPS_H_ */\n" + pr "#endif /* GUESTFS_STRUCTS_CLEANUPS_H_ */\n" (* Functions to free structures. *) and generate_client_structs_free () = @@ -1166,7 +1163,7 @@ and generate_client_structs_copy () = ) structs (* Functions to free structures used by the CLEANUP_* macros. *) -and generate_client_structs_cleanup () = +and generate_client_structs_cleanups_c () = generate_header CStyle LGPLv2plus; pr "\ @@ -1176,7 +1173,7 @@ and generate_client_structs_cleanup () = #include <stdlib.h> #include \"guestfs.h\" -#include \"guestfs-internal-frontend.h\" +#include \"structs-cleanups.h\" "; diff --git a/generator/c.mli b/generator/c.mli index 0884a8dfe..6d8cae891 100644 --- a/generator/c.mli +++ b/generator/c.mli @@ -26,7 +26,8 @@ val generate_actions_pod : unit -> unit val generate_availability_pod : unit -> unit val generate_client_actions : Types.action list -> unit -> unit val generate_client_actions_variants : unit -> unit -val generate_client_structs_cleanup : unit -> unit +val generate_client_structs_cleanups_h : unit -> unit +val generate_client_structs_cleanups_c : unit -> unit val generate_client_structs_compare : unit -> unit val generate_client_structs_copy : unit -> unit val generate_client_structs_free : unit -> unit @@ -35,7 +36,6 @@ val generate_client_structs_print_c : unit -> unit val generate_event_string_c : unit -> unit val generate_guestfs_h : unit -> unit val generate_internal_actions_h : unit -> unit -val generate_internal_frontend_cleanups_h : unit -> unit val generate_linker_script : unit -> unit val generate_max_proc_nr : unit -> unit val generate_structs_pod : unit -> unit diff --git a/generator/java.ml b/generator/java.ml index 7c3212a49..a7d0ed359 100644 --- a/generator/java.ml +++ b/generator/java.ml @@ -586,6 +586,7 @@ and generate_java_c actions () = #include \"com_redhat_et_libguestfs_GuestFS.h\" #include \"guestfs.h\" #include \"guestfs-internal-frontend.h\" +#include \"structs-cleanups.h\" /* Note that this function returns. The exception is not thrown * until after the wrapper function returns. diff --git a/generator/main.ml b/generator/main.ml index 8ff698130..33fe2b2ee 100644 --- a/generator/main.ml +++ b/generator/main.ml @@ -86,13 +86,13 @@ Run it from the top source directory using the command Errnostring.generate_errnostring_h; output_to "common/protocol/guestfs_protocol.x" XDR.generate_xdr; - output_to "common/utils/guestfs-internal-frontend-cleanups.h" - C.generate_internal_frontend_cleanups_h; - output_to "common/utils/structs-cleanup.c" - C.generate_client_structs_cleanup; - output_to "common/utils/structs-print.c" + output_to "common/structs/structs-cleanups.h" + C.generate_client_structs_cleanups_h; + output_to "common/structs/structs-cleanups.c" + C.generate_client_structs_cleanups_c; + output_to "common/structs/structs-print.c" C.generate_client_structs_print_c; - output_to "common/utils/structs-print.h" + output_to "common/structs/structs-print.h" C.generate_client_structs_print_h; output_to "lib/uefi.c" UEFI.generate_uefi_c; diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml index a680521f4..c3cb62c4d 100644 --- a/generator/tests_c_api.ml +++ b/generator/tests_c_api.ml @@ -48,6 +48,7 @@ let rec generate_c_api_tests () = #include \"guestfs.h\" #include \"guestfs-internal-frontend.h\" +#include \"structs-cleanups.h\" #include \"tests.h\" diff --git a/inspector/Makefile.am b/inspector/Makefile.am index 92c4e5e50..cd82ae918 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -50,6 +50,7 @@ virt_inspector_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ @@ -61,6 +62,7 @@ virt_inspector_CFLAGS = \ virt_inspector_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/inspector/inspector.c b/inspector/inspector.c index 8c531871e..3583c61df 100644 --- a/inspector/inspector.c +++ b/inspector/inspector.c @@ -40,6 +40,7 @@ #include "getprogname.h" #include "guestfs.h" +#include "structs-cleanups.h" #include "options.h" #include "display-options.h" diff --git a/java/Makefile.am b/java/Makefile.am index ea64f5525..a4fcc38cf 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -109,6 +109,7 @@ libguestfs_jni_la_SOURCES = \ libguestfs_jni_la_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib libguestfs_jni_la_CFLAGS = \ @@ -116,6 +117,7 @@ libguestfs_jni_la_CFLAGS = \ $(JNI_CFLAGS) libguestfs_jni_la_LIBADD = \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la diff --git a/lib/Makefile.am b/lib/Makefile.am index 1a736e4bd..da4b592be 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -58,7 +58,7 @@ libguestfs_la_SOURCES = \ ../common/protocol/guestfs_protocol.h \ ../common/qemuopts/qemuopts.h \ ../common/utils/guestfs-internal-frontend.h \ - ../common/utils/guestfs-internal-frontend-cleanups.h \ + ../common/structs/structs-cleanups.h \ guestfs.h \ guestfs-internal.h \ guestfs-internal-all.h \ @@ -137,6 +137,7 @@ libguestfs_la_CPPFLAGS = \ -I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol \ -I$(top_srcdir)/common/qemuopts -I$(top_builddir)/common/qemuopts \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib libguestfs_la_CFLAGS = \ @@ -152,6 +153,7 @@ libguestfs_la_LIBADD = \ ../common/errnostring/liberrnostring.la \ ../common/protocol/libprotocol.la \ ../common/qemuopts/libqemuopts.la \ + ../common/structs/libstructs.la \ ../common/utils/libutils.la \ $(PCRE_LIBS) $(MAGIC_LIBS) \ $(LIBVIRT_LIBS) $(LIBXML2_LIBS) \ @@ -213,6 +215,7 @@ unit_tests_SOURCES = unit-tests.c unit_tests_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I. unit_tests_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) @@ -220,6 +223,7 @@ unit_tests_CFLAGS = \ # non-exported functions we have to link with the objects not the # library. unit_tests_LDADD = \ + ../common/structs/libstructs.la \ ../common/utils/libutils.la \ $(libguestfs_la_OBJECTS) \ $(libguestfs_la_LIBADD) diff --git a/lib/file.c b/lib/file.c index 53b859d4b..73c983c2b 100644 --- a/lib/file.c +++ b/lib/file.c @@ -32,6 +32,7 @@ #include "guestfs.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" +#include "structs-cleanups.h" static int compare (const void *vp1, const void *vp2) diff --git a/lib/fuse.c b/lib/fuse.c index cde3783d9..de8c4d8f2 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -54,6 +54,7 @@ #include "guestfs.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" +#include "structs-cleanups.h" #if HAVE_FUSE diff --git a/lib/inspect-apps.c b/lib/inspect-apps.c index c324f3bf0..25192340c 100644 --- a/lib/inspect-apps.c +++ b/lib/inspect-apps.c @@ -43,6 +43,7 @@ #include "guestfs.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" +#include "structs-cleanups.h" #ifdef DB_DUMP static struct guestfs_application2_list *list_applications_rpm (guestfs_h *g, struct inspect_fs *fs); diff --git a/lib/inspect-fs-windows.c b/lib/inspect-fs-windows.c index 35f7cc821..b14dc2e14 100644 --- a/lib/inspect-fs-windows.c +++ b/lib/inspect-fs-windows.c @@ -48,6 +48,7 @@ #include "guestfs.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" +#include "structs-cleanups.h" COMPILE_REGEXP (re_windows_version, "^(\\d+)\\.(\\d+)", 0) COMPILE_REGEXP (re_boot_ini_os_header, "^\\[operating systems\\]\\s*$", 0) diff --git a/lib/inspect-fs.c b/lib/inspect-fs.c index 655b1fb8e..e320b3e78 100644 --- a/lib/inspect-fs.c +++ b/lib/inspect-fs.c @@ -35,6 +35,7 @@ #include "guestfs.h" #include "guestfs-internal.h" +#include "structs-cleanups.h" static int check_filesystem (guestfs_h *g, const char *mountable, const struct guestfs_internal_mountable *m, diff --git a/lib/launch.c b/lib/launch.c index 04d69d867..70e7f8897 100644 --- a/lib/launch.c +++ b/lib/launch.c @@ -45,6 +45,7 @@ #include "guestfs-internal.h" #include "guestfs-internal-actions.h" #include "guestfs_protocol.h" +#include "structs-cleanups.h" static struct backend { struct backend *next; diff --git a/lib/listfs.c b/lib/listfs.c index 88446cc9f..60aff3305 100644 --- a/lib/listfs.c +++ b/lib/listfs.c @@ -25,6 +25,7 @@ #include "guestfs.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" +#include "structs-cleanups.h" /* List filesystems. * diff --git a/lib/mountable.c b/lib/mountable.c index 9f7b451fd..6e4a0c293 100644 --- a/lib/mountable.c +++ b/lib/mountable.c @@ -23,7 +23,7 @@ #include "guestfs.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" - +#include "structs-cleanups.h" char * guestfs_impl_mountable_device (guestfs_h *g, const char *mountable) diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am index bef0e7bf8..28c274868 100644 --- a/make-fs/Makefile.am +++ b/make-fs/Makefile.am @@ -31,6 +31,7 @@ virt_make_fs_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ @@ -42,6 +43,7 @@ virt_make_fs_CFLAGS = \ virt_make_fs_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/make-fs/make-fs.c b/make-fs/make-fs.c index 27cdb9fd2..e30745a0f 100644 --- a/make-fs/make-fs.c +++ b/make-fs/make-fs.c @@ -40,6 +40,7 @@ #include "xstrtol.h" #include "getprogname.h" +#include "structs-cleanups.h" #include "options.h" #include "display-options.h" diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index c2adb1a6e..834baee6a 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -108,6 +108,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ + -I $(top_builddir)/common/structs/.libs \ -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ @@ -122,6 +123,7 @@ endif OCAMLCLIBS = \ -lvisit \ + -lstructs \ -lutils \ $(LIBTINFO_LIBS) \ $(LIBCRYPT_LIBS) \ diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am index cb653f7a6..d79b8ed52 100644 --- a/tests/c-api/Makefile.am +++ b/tests/c-api/Makefile.am @@ -93,12 +93,14 @@ tests_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \ -I$(top_srcdir)/lib -I$(top_builddir)/lib tests_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(PCRE_CFLAGS) tests_LDADD = \ $(PCRE_LIBS) \ + $(top_builddir)/common/structs/libstructs.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/tests/c-api/tests-main.c b/tests/c-api/tests-main.c index 0fd895423..f202a70ff 100644 --- a/tests/c-api/tests-main.c +++ b/tests/c-api/tests-main.c @@ -38,6 +38,7 @@ #include "guestfs.h" #include "guestfs-internal-frontend.h" +#include "structs-cleanups.h" #include "tests.h" -- 2.13.0 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs