utils: Split out structs cleanups and printing into common/structs.

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.
This commit is contained in:
Richard W.M. Jones
2017-06-08 15:39:33 +01:00
parent 78587cc3c6
commit 5efebd8c7e
44 changed files with 134 additions and 52 deletions

8
.gitignore vendored
View File

@@ -136,10 +136,10 @@ Makefile.in
/common/protocol/guestfs_protocol.h /common/protocol/guestfs_protocol.h
/common/protocol/guestfs_protocol.x /common/protocol/guestfs_protocol.x
/common/qemuopts/qemuopts-tests /common/qemuopts/qemuopts-tests
/common/utils/guestfs-internal-frontend-cleanups.h /common/structs/structs-cleanups.c
/common/utils/structs-cleanup.c /common/structs/structs-cleanups.h
/common/utils/structs-print.c /common/structs/structs-print.c
/common/utils/structs-print.h /common/structs/structs-print.h
/compile /compile
/config.cache /config.cache
/config.guess /config.guess

View File

@@ -38,7 +38,9 @@ SUBDIRS += gnulib/tests
endif endif
# Basic source for the library. # 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 SUBDIRS += lib docs examples po
# The daemon and the appliance. # The daemon and the appliance.

View File

@@ -31,6 +31,7 @@ virt_alignment_scan_SOURCES = \
virt_alignment_scan_CPPFLAGS = \ virt_alignment_scan_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \
@@ -46,6 +47,7 @@ virt_alignment_scan_CFLAGS = \
virt_alignment_scan_LDADD = \ virt_alignment_scan_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/parallel/libparallel.la \ $(top_builddir)/common/parallel/libparallel.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -41,6 +41,7 @@
#include "getprogname.h" #include "getprogname.h"
#include "guestfs.h" #include "guestfs.h"
#include "structs-cleanups.h"
#include "options.h" #include "options.h"
#include "display-options.h" #include "display-options.h"
#include "parallel.h" #include "parallel.h"

View File

@@ -39,6 +39,7 @@ virt_cat_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \
@@ -51,6 +52,7 @@ virt_cat_CFLAGS = \
virt_cat_LDADD = \ virt_cat_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/windows/libwindows.la \ $(top_builddir)/common/windows/libwindows.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \
@@ -65,6 +67,7 @@ virt_filesystems_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \
@@ -77,6 +80,7 @@ virt_filesystems_CFLAGS = \
virt_filesystems_LDADD = \ virt_filesystems_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/windows/libwindows.la \ $(top_builddir)/common/windows/libwindows.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \
@@ -91,6 +95,7 @@ virt_log_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \
@@ -102,6 +107,7 @@ virt_log_CFLAGS = \
virt_log_LDADD = \ virt_log_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \
@@ -116,6 +122,7 @@ virt_ls_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/visit \ -I$(top_srcdir)/common/visit \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
@@ -129,6 +136,7 @@ virt_ls_CFLAGS = \
virt_ls_LDADD = \ virt_ls_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/visit/libvisit.la \ $(top_builddir)/common/visit/libvisit.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \
@@ -143,6 +151,7 @@ virt_tail_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \
@@ -155,6 +164,7 @@ virt_tail_CFLAGS = \
virt_tail_LDADD = \ virt_tail_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/windows/libwindows.la \ $(top_builddir)/common/windows/libwindows.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -37,6 +37,7 @@
#include "getprogname.h" #include "getprogname.h"
#include "guestfs.h" #include "guestfs.h"
#include "structs-cleanups.h"
#include "options.h" #include "options.h"
#include "display-options.h" #include "display-options.h"

View File

@@ -38,6 +38,7 @@
#include "getprogname.h" #include "getprogname.h"
#include "guestfs.h" #include "guestfs.h"
#include "structs-cleanups.h"
#include "options.h" #include "options.h"
#include "display-options.h" #include "display-options.h"

View File

@@ -37,6 +37,7 @@
#include "ignore-value.h" #include "ignore-value.h"
#include "guestfs.h" #include "guestfs.h"
#include "structs-cleanups.h"
#include "options.h" #include "options.h"
#include "display-options.h" #include "display-options.h"
#include "windows.h" #include "windows.h"

View File

@@ -74,6 +74,7 @@ OCAMLPACKAGES = \
-I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \ -I $(top_builddir)/ocaml \
-I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/common/utils/.libs \
-I $(top_builddir)/common/structs/.libs \
-I $(top_builddir)/common/visit/.libs \ -I $(top_builddir)/common/visit/.libs \
-I $(builddir) -I $(builddir)
OCAMLPACKAGES_TESTS = $(MLVISIT_CMA) OCAMLPACKAGES_TESTS = $(MLVISIT_CMA)
@@ -115,7 +116,7 @@ visit_tests_DEPENDENCIES = \
$(top_srcdir)/ocaml-link.sh $(top_srcdir)/ocaml-link.sh
visit_tests_LINK = \ visit_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \ $(top_srcdir)/ocaml-link.sh \
-cclib '-lvisit -lutils $(LIBXML2_LIBS) -lgnu' -- \ -cclib '-lvisit -lstructs -lutils $(LIBXML2_LIBS) -lgnu' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \ $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \ $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(visit_tests_THEOBJECTS) -o $@ $(visit_tests_THEOBJECTS) -o $@

View File

@@ -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)

View File

@@ -17,18 +17,6 @@
include $(top_srcdir)/subdir-rules.mk 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 noinst_LTLIBRARIES = libutils.la
libutils_la_SOURCES = \ libutils_la_SOURCES = \
@@ -37,11 +25,7 @@ libutils_la_SOURCES = \
cleanups.h \ cleanups.h \
gnulib-cleanups.c \ gnulib-cleanups.c \
guestfs-internal-frontend.h \ guestfs-internal-frontend.h \
guestfs-internal-frontend-cleanups.h \
libxml2-cleanups.c \ libxml2-cleanups.c \
structs-cleanup.c \
structs-print.c \
structs-print.h \
utils.c utils.c
libutils_la_CPPFLAGS = \ libutils_la_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \

View File

@@ -63,11 +63,6 @@ extern void guestfs_int_fadvise_noreuse (int fd);
//extern void guestfs_int_fadvise_willneed (int fd); //extern void guestfs_int_fadvise_willneed (int fd);
extern char *guestfs_int_shell_unquote (const char *str); 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. /* Not all language bindings know how to deal with Pointer arguments.
* Those that don't will use this macro which complains noisily and * Those that don't will use this macro which complains noisily and
* returns NULL. * returns NULL.

View File

@@ -27,7 +27,8 @@ libvisit_la_CPPFLAGS = \
-DGUESTFS_PRIVATE=1 \ -DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib -I$(top_builddir)/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 = \ libvisit_la_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GCC_VISIBILITY_HIDDEN) $(GCC_VISIBILITY_HIDDEN)

View File

@@ -37,6 +37,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal-frontend.h" #include "guestfs-internal-frontend.h"
#include "structs-cleanups.h"
#include "visit.h" #include "visit.h"

View File

@@ -206,6 +206,7 @@ AC_CONFIG_FILES([Makefile
common/progress/Makefile common/progress/Makefile
common/protocol/Makefile common/protocol/Makefile
common/qemuopts/Makefile common/qemuopts/Makefile
common/structs/Makefile
common/utils/Makefile common/utils/Makefile
common/visit/Makefile common/visit/Makefile
common/windows/Makefile common/windows/Makefile

View File

@@ -36,6 +36,7 @@ virt_df_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \
@@ -50,6 +51,7 @@ virt_df_CFLAGS = \
virt_df_LDADD = \ virt_df_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/parallel/libparallel.la \ $(top_builddir)/common/parallel/libparallel.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -27,6 +27,7 @@
#include <errno.h> #include <errno.h>
#include "guestfs.h" #include "guestfs.h"
#include "structs-cleanups.h"
#include "options.h" #include "options.h"
#include "domains.h" #include "domains.h"
#include "virt-df.h" #include "virt-df.h"

View File

@@ -44,6 +44,7 @@ virt_diff_CFLAGS = \
virt_diff_LDADD = \ virt_diff_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/visit/libvisit.la \ $(top_builddir)/common/visit/libvisit.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -42,14 +42,14 @@ common/progress/progress.h
common/qemuopts/qemuopts-tests.c common/qemuopts/qemuopts-tests.c
common/qemuopts/qemuopts.c common/qemuopts/qemuopts.c
common/qemuopts/qemuopts.h 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.c
common/utils/cleanups.h common/utils/cleanups.h
common/utils/guestfs-internal-frontend-cleanups.h
common/utils/guestfs-internal-frontend.h common/utils/guestfs-internal-frontend.h
common/utils/libxml2-cleanups.c 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/utils/utils.c
common/visit/visit.c common/visit/visit.c
common/visit/visit.h common/visit/visit.h

View File

@@ -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. 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> =item F<common/utils>
Various utility functions used throughout the library and tools. Various utility functions used throughout the library and tools.

View File

@@ -108,10 +108,12 @@ librc_protocol_la_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
libcmds_la_SOURCES = cmds-gperf.c libcmds_la_SOURCES = cmds-gperf.c
libcmds_la_CPPFLAGS = \ libcmds_la_CPPFLAGS = \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib -I$(srcdir)/../gnulib/lib -I../gnulib/lib
libcmds_la_CFLAGS = libcmds_la_CFLAGS =
libcmds_la_LIBADD = \ libcmds_la_LIBADD = \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(LTLIBINTL) $(LTLIBINTL)
@@ -124,6 +126,7 @@ guestfish_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/edit -I$(top_builddir)/common/edit \ -I$(top_srcdir)/common/edit -I$(top_builddir)/common/edit \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -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/edit/libedit.la \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/progress/libprogress.la \ $(top_builddir)/common/progress/libprogress.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -794,20 +794,17 @@ and generate_internal_actions_h () =
pr "\n"; pr "\n";
pr "#endif /* GUESTFS_INTERNAL_ACTIONS_H_ */\n" pr "#endif /* GUESTFS_INTERNAL_ACTIONS_H_ */\n"
(* Generate guestfs-internal-frontend-cleanups.h file. *) (* Generate structs-cleanups.h file. *)
and generate_internal_frontend_cleanups_h () = and generate_client_structs_cleanups_h () =
generate_header CStyle LGPLv2plus; generate_header CStyle LGPLv2plus;
pr "\ pr "\
/* These CLEANUP_* macros automatically free the struct or struct list /* These CLEANUP_* macros automatically free the struct or struct list
* pointed to by the local variable at the end of the current scope. * 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_ #ifndef GUESTFS_STRUCTS_CLEANUPS_H_
#define GUESTFS_INTERNAL_FRONTEND_CLEANUPS_H_ #define GUESTFS_STRUCTS_CLEANUPS_H_
#ifdef HAVE_ATTRIBUTE_CLEANUP #ifdef HAVE_ATTRIBUTE_CLEANUP
"; ";
@@ -846,7 +843,7 @@ and generate_internal_frontend_cleanups_h () =
) structs; ) structs;
pr "\n"; pr "\n";
pr "#endif /* GUESTFS_INTERNAL_FRONTEND_CLEANUPS_H_ */\n" pr "#endif /* GUESTFS_STRUCTS_CLEANUPS_H_ */\n"
(* Functions to free structures. *) (* Functions to free structures. *)
and generate_client_structs_free () = and generate_client_structs_free () =
@@ -1166,7 +1163,7 @@ and generate_client_structs_copy () =
) structs ) structs
(* Functions to free structures used by the CLEANUP_* macros. *) (* Functions to free structures used by the CLEANUP_* macros. *)
and generate_client_structs_cleanup () = and generate_client_structs_cleanups_c () =
generate_header CStyle LGPLv2plus; generate_header CStyle LGPLv2plus;
pr "\ pr "\
@@ -1176,7 +1173,7 @@ and generate_client_structs_cleanup () =
#include <stdlib.h> #include <stdlib.h>
#include \"guestfs.h\" #include \"guestfs.h\"
#include \"guestfs-internal-frontend.h\" #include \"structs-cleanups.h\"
"; ";

View File

@@ -26,7 +26,8 @@ val generate_actions_pod : unit -> unit
val generate_availability_pod : unit -> unit val generate_availability_pod : unit -> unit
val generate_client_actions : Types.action list -> unit -> unit val generate_client_actions : Types.action list -> unit -> unit
val generate_client_actions_variants : 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_compare : unit -> unit
val generate_client_structs_copy : unit -> unit val generate_client_structs_copy : unit -> unit
val generate_client_structs_free : 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_event_string_c : unit -> unit
val generate_guestfs_h : unit -> unit val generate_guestfs_h : unit -> unit
val generate_internal_actions_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_linker_script : unit -> unit
val generate_max_proc_nr : unit -> unit val generate_max_proc_nr : unit -> unit
val generate_structs_pod : unit -> unit val generate_structs_pod : unit -> unit

View File

@@ -586,6 +586,7 @@ and generate_java_c actions () =
#include \"com_redhat_et_libguestfs_GuestFS.h\" #include \"com_redhat_et_libguestfs_GuestFS.h\"
#include \"guestfs.h\" #include \"guestfs.h\"
#include \"guestfs-internal-frontend.h\" #include \"guestfs-internal-frontend.h\"
#include \"structs-cleanups.h\"
/* Note that this function returns. The exception is not thrown /* Note that this function returns. The exception is not thrown
* until after the wrapper function returns. * until after the wrapper function returns.

View File

@@ -86,13 +86,13 @@ Run it from the top source directory using the command
Errnostring.generate_errnostring_h; Errnostring.generate_errnostring_h;
output_to "common/protocol/guestfs_protocol.x" output_to "common/protocol/guestfs_protocol.x"
XDR.generate_xdr; XDR.generate_xdr;
output_to "common/utils/guestfs-internal-frontend-cleanups.h" output_to "common/structs/structs-cleanups.h"
C.generate_internal_frontend_cleanups_h; C.generate_client_structs_cleanups_h;
output_to "common/utils/structs-cleanup.c" output_to "common/structs/structs-cleanups.c"
C.generate_client_structs_cleanup; C.generate_client_structs_cleanups_c;
output_to "common/utils/structs-print.c" output_to "common/structs/structs-print.c"
C.generate_client_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; C.generate_client_structs_print_h;
output_to "lib/uefi.c" output_to "lib/uefi.c"
UEFI.generate_uefi_c; UEFI.generate_uefi_c;

View File

@@ -48,6 +48,7 @@ let rec generate_c_api_tests () =
#include \"guestfs.h\" #include \"guestfs.h\"
#include \"guestfs-internal-frontend.h\" #include \"guestfs-internal-frontend.h\"
#include \"structs-cleanups.h\"
#include \"tests.h\" #include \"tests.h\"

View File

@@ -59,6 +59,7 @@ virt_inspector_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/fish \ -I$(top_srcdir)/fish \
@@ -70,6 +71,7 @@ virt_inspector_CFLAGS = \
virt_inspector_LDADD = \ virt_inspector_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -40,6 +40,7 @@
#include "getprogname.h" #include "getprogname.h"
#include "guestfs.h" #include "guestfs.h"
#include "structs-cleanups.h"
#include "options.h" #include "options.h"
#include "display-options.h" #include "display-options.h"

View File

@@ -109,6 +109,7 @@ libguestfs_jni_la_SOURCES = \
libguestfs_jni_la_CPPFLAGS = \ libguestfs_jni_la_CPPFLAGS = \
-DGUESTFS_PRIVATE=1 \ -DGUESTFS_PRIVATE=1 \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_builddir)/lib
libguestfs_jni_la_CFLAGS = \ libguestfs_jni_la_CFLAGS = \
@@ -116,6 +117,7 @@ libguestfs_jni_la_CFLAGS = \
$(JNI_CFLAGS) $(JNI_CFLAGS)
libguestfs_jni_la_LIBADD = \ libguestfs_jni_la_LIBADD = \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la $(top_builddir)/lib/libguestfs.la

View File

@@ -58,7 +58,7 @@ libguestfs_la_SOURCES = \
../common/protocol/guestfs_protocol.h \ ../common/protocol/guestfs_protocol.h \
../common/qemuopts/qemuopts.h \ ../common/qemuopts/qemuopts.h \
../common/utils/guestfs-internal-frontend.h \ ../common/utils/guestfs-internal-frontend.h \
../common/utils/guestfs-internal-frontend-cleanups.h \ ../common/structs/structs-cleanups.h \
guestfs.h \ guestfs.h \
guestfs-internal.h \ guestfs-internal.h \
guestfs-internal-all.h \ guestfs-internal-all.h \
@@ -140,6 +140,7 @@ libguestfs_la_CPPFLAGS = \
-I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol \ -I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol \
-I$(top_srcdir)/common/qemuopts -I$(top_builddir)/common/qemuopts \ -I$(top_srcdir)/common/qemuopts -I$(top_builddir)/common/qemuopts \
-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 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
libguestfs_la_CFLAGS = \ libguestfs_la_CFLAGS = \
@@ -155,6 +156,7 @@ libguestfs_la_LIBADD = \
../common/errnostring/liberrnostring.la \ ../common/errnostring/liberrnostring.la \
../common/protocol/libprotocol.la \ ../common/protocol/libprotocol.la \
../common/qemuopts/libqemuopts.la \ ../common/qemuopts/libqemuopts.la \
../common/structs/libstructs.la \
../common/utils/libutils.la \ ../common/utils/libutils.la \
$(PCRE_LIBS) $(MAGIC_LIBS) \ $(PCRE_LIBS) $(MAGIC_LIBS) \
$(LIBVIRT_LIBS) $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) $(LIBXML2_LIBS) \
@@ -216,6 +218,7 @@ unit_tests_SOURCES = unit-tests.c
unit_tests_CPPFLAGS = \ unit_tests_CPPFLAGS = \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/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 \
-I$(top_srcdir)/lib -I. -I$(top_srcdir)/lib -I.
unit_tests_CFLAGS = \ unit_tests_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) $(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -223,6 +226,7 @@ unit_tests_CFLAGS = \
# non-exported functions we have to link with the objects not the # non-exported functions we have to link with the objects not the
# library. # library.
unit_tests_LDADD = \ unit_tests_LDADD = \
../common/structs/libstructs.la \
../common/utils/libutils.la \ ../common/utils/libutils.la \
$(libguestfs_la_OBJECTS) \ $(libguestfs_la_OBJECTS) \
$(libguestfs_la_LIBADD) $(libguestfs_la_LIBADD)

View File

@@ -32,6 +32,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "guestfs-internal-actions.h" #include "guestfs-internal-actions.h"
#include "structs-cleanups.h"
static int static int
compare (const void *vp1, const void *vp2) compare (const void *vp1, const void *vp2)

View File

@@ -54,6 +54,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "guestfs-internal-actions.h" #include "guestfs-internal-actions.h"
#include "structs-cleanups.h"
#if HAVE_FUSE #if HAVE_FUSE

View File

@@ -43,6 +43,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "guestfs-internal-actions.h" #include "guestfs-internal-actions.h"
#include "structs-cleanups.h"
#ifdef DB_DUMP #ifdef DB_DUMP
static struct guestfs_application2_list *list_applications_rpm (guestfs_h *g, struct inspect_fs *fs); static struct guestfs_application2_list *list_applications_rpm (guestfs_h *g, struct inspect_fs *fs);

View File

@@ -32,6 +32,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "structs-cleanups.h"
/* Debian/Ubuntu install disks are easy ... /* Debian/Ubuntu install disks are easy ...
* *

View File

@@ -48,6 +48,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "guestfs-internal-actions.h" #include "guestfs-internal-actions.h"
#include "structs-cleanups.h"
COMPILE_REGEXP (re_windows_version, "^(\\d+)\\.(\\d+)", 0) COMPILE_REGEXP (re_windows_version, "^(\\d+)\\.(\\d+)", 0)
COMPILE_REGEXP (re_boot_ini_os_header, "^\\[operating systems\\]\\s*$", 0) COMPILE_REGEXP (re_boot_ini_os_header, "^\\[operating systems\\]\\s*$", 0)

View File

@@ -35,6 +35,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "structs-cleanups.h"
static int check_filesystem (guestfs_h *g, const char *mountable, static int check_filesystem (guestfs_h *g, const char *mountable,
const struct guestfs_internal_mountable *m, const struct guestfs_internal_mountable *m,

View File

@@ -45,6 +45,7 @@
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "guestfs-internal-actions.h" #include "guestfs-internal-actions.h"
#include "guestfs_protocol.h" #include "guestfs_protocol.h"
#include "structs-cleanups.h"
static struct backend { static struct backend {
struct backend *next; struct backend *next;

View File

@@ -25,6 +25,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "guestfs-internal-actions.h" #include "guestfs-internal-actions.h"
#include "structs-cleanups.h"
/* List filesystems. /* List filesystems.
* *

View File

@@ -23,7 +23,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal.h" #include "guestfs-internal.h"
#include "guestfs-internal-actions.h" #include "guestfs-internal-actions.h"
#include "structs-cleanups.h"
char * char *
guestfs_impl_mountable_device (guestfs_h *g, const char *mountable) guestfs_impl_mountable_device (guestfs_h *g, const char *mountable)

View File

@@ -31,6 +31,7 @@ virt_make_fs_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/fish \ -I$(top_srcdir)/fish \
@@ -42,6 +43,7 @@ virt_make_fs_CFLAGS = \
virt_make_fs_LDADD = \ virt_make_fs_LDADD = \
$(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -40,6 +40,7 @@
#include "xstrtol.h" #include "xstrtol.h"
#include "getprogname.h" #include "getprogname.h"
#include "structs-cleanups.h"
#include "options.h" #include "options.h"
#include "display-options.h" #include "display-options.h"

View File

@@ -108,6 +108,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx)
OCAMLPACKAGES = \ OCAMLPACKAGES = \
-package str,unix \ -package str,unix \
-I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/common/utils/.libs \
-I $(top_builddir)/common/structs/.libs \
-I $(top_builddir)/lib/.libs \ -I $(top_builddir)/lib/.libs \
-I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \ -I $(top_builddir)/ocaml \
@@ -122,6 +123,7 @@ endif
OCAMLCLIBS = \ OCAMLCLIBS = \
-lvisit \ -lvisit \
-lstructs \
-lutils \ -lutils \
$(LIBTINFO_LIBS) \ $(LIBTINFO_LIBS) \
$(LIBCRYPT_LIBS) \ $(LIBCRYPT_LIBS) \

View File

@@ -93,12 +93,14 @@ tests_CPPFLAGS = \
-DGUESTFS_PRIVATE=1 \ -DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/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 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_builddir)/lib
tests_CFLAGS = \ tests_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(PCRE_CFLAGS) $(PCRE_CFLAGS)
tests_LDADD = \ tests_LDADD = \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \ $(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \ $(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \ $(LIBXML2_LIBS) \

View File

@@ -38,6 +38,7 @@
#include "guestfs.h" #include "guestfs.h"
#include "guestfs-internal-frontend.h" #include "guestfs-internal-frontend.h"
#include "structs-cleanups.h"
#include "tests.h" #include "tests.h"