Richard W.M. Jones
2017-Jan-25 14:37 UTC
[Libguestfs] [PATCH v2 0/7] Rename src/ to lib/ and move common code to common/
Previous patch series was posted here: https://www.redhat.com/archives/libguestfs/2017-January/msg00059.html v2 simply extends this patch series to cover the extra directories common/edit, common/progress, common/windows and common/parallel. The only remaining item is to consider whether we should rename mllib to something else, mlcommon was my suggestion. Rich.
Richard W.M. Jones
2017-Jan-25 14:37 UTC
[Libguestfs] [PATCH v2 1/7] lib: Share common protocol and errnostring libraries with the library and daemon.
This commit, which is just code motion, moves the common XDR protocol code (libprotocol) and the common errno handling (liberrnostring) into libraries which are each built once and shared between the library and daemon. --- .gitignore | 20 +++++-------- Makefile.am | 1 + common/errnostring/Makefile.am | 45 +++++++++++++++++++++++++++++ common/protocol/Makefile.am | 60 ++++++++++++++++++++++++++++++++++++++ configure.ac | 2 ++ daemon/Makefile.am | 53 +++++++--------------------------- docs/guestfs-hacking.pod | 20 +++++++++++++ docs/guestfs-internals.pod | 2 +- generator/main.ml | 9 +++--- m4/guestfs_ocaml.m4 | 2 +- po/POTFILES | 6 ++-- src/Makefile.am | 65 ++++++------------------------------------ tests/protocol/Makefile.am | 4 ++- 13 files changed, 166 insertions(+), 123 deletions(-) create mode 100644 common/errnostring/Makefile.am create mode 100644 common/protocol/Makefile.am diff --git a/.gitignore b/.gitignore index 76a16c5..5a13d1d 100644 --- a/.gitignore +++ b/.gitignore @@ -116,6 +116,13 @@ Makefile.in /cat/virt-tail /cat/virt-tail.1 /ChangeLog +/common/errnostring/errnostring.c +/common/errnostring/errnostring-gperf.c +/common/errnostring/errnostring-gperf.gperf +/common/errnostring/errnostring.h +/common/protocol/guestfs_protocol.c +/common/protocol/guestfs_protocol.h +/common/protocol/guestfs_protocol.x /compile /config.cache /config.guess @@ -139,15 +146,9 @@ Makefile.in /customize/virt-customize.1 /daemon/actions.h /daemon/dispatch.c -/daemon/errnostring.c -/daemon/errnostring-gperf.c -/daemon/errnostring-gperf.gperf -/daemon/errnostring.h /daemon/guestfsd /daemon/guestfsd.8 /daemon/guestfsd.exe -/daemon/guestfs_protocol.c -/daemon/guestfs_protocol.h /daemon/install-sh /daemon/missing /daemon/names.c @@ -495,10 +496,6 @@ Makefile.in /src/actions-?.c /src/actions-variants.c /src/bindtests.c -/src/errnostring.c -/src/errnostring-gperf.c -/src/errnostring-gperf.gperf -/src/errnostring.h /src/event-string.c /src/guestfs.3 /src/guestfs-actions.pod @@ -506,9 +503,6 @@ Makefile.in /src/guestfs.h /src/guestfs-internal-actions.h /src/guestfs-internal-frontend-cleanups.h -/src/guestfs_protocol.c -/src/guestfs_protocol.h -/src/guestfs_protocol.x /src/guestfs-structs.pod /src/libguestfs.3 /src/libguestfs.pc diff --git a/Makefile.am b/Makefile.am index 0e9ab74..6049e64 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,6 +38,7 @@ SUBDIRS += gnulib/tests endif # Basic source for the library. +SUBDIRS += common/errnostring common/protocol SUBDIRS += src docs examples po # The daemon and the appliance. diff --git a/common/errnostring/Makefile.am b/common/errnostring/Makefile.am new file mode 100644 index 0000000..2fe5b24 --- /dev/null +++ b/common/errnostring/Makefile.am @@ -0,0 +1,45 @@ +# 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 = \ + errnostring-gperf.gperf \ + errnostring.c \ + errnostring.h + +BUILT_SOURCES = \ + $(generator_built) \ + errnostring-gperf.c + +EXTRA_DIST = \ + $(BUILT_SOURCES) + +noinst_LTLIBRARIES = liberrnostring.la + +# Build the errnostring perfect hash code. The generated code has lots +# of warnings so we must compile it in a separate mini-library. +liberrnostring_la_SOURCES = \ + errnostring-gperf.c \ + errnostring.h \ + errnostring.c +liberrnostring_la_CFLAGS = $(GCC_VISIBILITY_HIDDEN) + +errnostring-gperf.c: errnostring-gperf.gperf + rm -f $@ + $(GPERF) -t $< > $@-t + mv $@-t $@ diff --git a/common/protocol/Makefile.am b/common/protocol/Makefile.am new file mode 100644 index 0000000..079580c --- /dev/null +++ b/common/protocol/Makefile.am @@ -0,0 +1,60 @@ +# 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 = \ + guestfs_protocol.x + +BUILT_SOURCES = \ + $(generator_built) \ + guestfs_protocol.c \ + guestfs_protocol.h + +EXTRA_DIST = \ + $(BUILT_SOURCES) + +noinst_LTLIBRARIES = libprotocol.la + +# Because rpcgen generates archaic code, we cannot use ordinary +# warnings here. +libprotocol_la_SOURCES = guestfs_protocol.c guestfs_protocol.h +libprotocol_la_CFLAGS = \ + -Wall -Wno-unused -fno-strict-aliasing $(GCC_VISIBILITY_HIDDEN) + +if HAVE_RPCGEN +RPCGEN_DEFS +if HAVE_XDR_U_INT64_T +RPCGEN_DEFS += -DHAVE_XDR_U_INT64_T=1 +else +if HAVE_XDR_UINT64_T +RPCGEN_DEFS += -DHAVE_XDR_UINT64_T=1 +endif +endif + +guestfs_protocol.c: guestfs_protocol.x + rm -f $@-t $@-t2 + $(RPCGEN) $(RPCGEN_DEFS) -c -o $@-t $< + $(SED) 's,\.\./\(\.\./\)*src,.,' < $@-t > $@-t2 + rm $@-t + mv $@-t2 $@ + +guestfs_protocol.h: guestfs_protocol.x + rm -f $@-t + $(RPCGEN) $(RPCGEN_DEFS) -h -o $@-t $< + mv $@-t $@ +endif diff --git a/configure.ac b/configure.ac index 29c4670..359b255 100644 --- a/configure.ac +++ b/configure.ac @@ -180,6 +180,8 @@ AC_CONFIG_FILES([Makefile builder/test-simplestreams/virt-builder/repos.d/cirros.conf builder/test-website/virt-builder/repos.d/libguestfs.conf cat/Makefile + common/errnostring/Makefile + common/protocol/Makefile csharp/Makefile customize/Makefile daemon/Makefile diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 23f60eb..15e1b7e 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -30,52 +30,13 @@ generator_built = \ stubs-5.c \ stubs-6.c -shared_with_library = \ - guestfs_protocol.c \ - guestfs_protocol.h \ - errnostring-gperf.gperf \ - errnostring.c \ - errnostring.h - BUILT_SOURCES = \ - $(generator_built) \ - $(shared_with_library) \ - errnostring-gperf.c + $(generator_built) EXTRA_DIST = \ $(BUILT_SOURCES) \ guestfsd.pod -$(shared_with_library): %: $(top_srcdir)/src/% - rm -f $@ - ln $< $@ - -noinst_LIBRARIES = libprotocol.a - -# This convenience library is solely to compile its generated sources with -# custom flags. -libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h -libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing - -$(top_builddir)/src/guestfs_protocol.c: force - $(MAKE) -C $(top_builddir)/src guestfs_protocol.c -$(top_builddir)/src/guestfs_protocol.h: force - $(MAKE) -C $(top_builddir)/src guestfs_protocol.h - -# Build the errnostring perfect hash code. The generated code has lots -# of warnings so we must compile it in a separate mini-library. -noinst_LIBRARIES += liberrnostring.a -liberrnostring_a_SOURCES = \ - errnostring-gperf.c \ - errnostring.h \ - errnostring.c -liberrnostring_a_CFLAGS - -errnostring-gperf.c: errnostring-gperf.gperf - rm -f $@ - $(GPERF) -t $< > $@-t - mv $@-t $@ - if INSTALL_DAEMON sbin_PROGRAMS = guestfsd else @@ -83,6 +44,8 @@ noinst_PROGRAMS = guestfsd endif guestfsd_SOURCES = \ + ../common/errnostring/errnostring.h \ + ../common/protocol/guestfs_protocol.h \ 9p.c \ acl.c \ actions.h \ @@ -204,8 +167,8 @@ guestfsd_SOURCES = \ zerofree.c guestfsd_LDADD = \ - liberrnostring.a \ - libprotocol.a \ + ../common/errnostring/liberrnostring.la \ + ../common/protocol/libprotocol.la \ $(ACL_LIBS) \ $(CAP_LIBS) \ $(YAJL_LIBS) \ @@ -228,7 +191,11 @@ guestfsd_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/src \ - -I$(top_builddir)/src + -I$(top_builddir)/src \ + -I$(top_srcdir)/common/errnostring \ + -I$(top_builddir)/common/errnostring \ + -I$(top_srcdir)/common/protocol \ + -I$(top_builddir)/common/protocol guestfsd_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(AUGEAS_CFLAGS) \ diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index a963264..4633a8a 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -76,6 +76,26 @@ L<virt-builder(1)> command and documentation. The L<virt-cat(1)>, L<virt-filesystems(1)>, L<virt-log(1)>, L<virt-ls(1)> and L<virt-tail(1)> commands and documentation. +=item F<common> + +Various libraries of internal code can be found in the F<common> +subdirectory: + +=over 4 + +=item F<common/errnostring> + +The communication protocol used between the library and the daemon +running inside the appliance has to encode errnos as strings, which is +handled by this library. + +=item F<common/protocol> + +The XDR-based communication protocol used between the library +and the daemon running inside the appliance is defined here. + +=back + =item F<contrib> Outside contributions, experimental parts. diff --git a/docs/guestfs-internals.pod b/docs/guestfs-internals.pod index 32d1266..a77b522 100644 --- a/docs/guestfs-internals.pod +++ b/docs/guestfs-internals.pod @@ -209,7 +209,7 @@ The protocol used to talk between the library and the daemon running inside the qemu virtual machine is a simple RPC mechanism built on top of XDR (RFC 1014, RFC 1832, RFC 4506). -The detailed format of structures is in F<src/guestfs_protocol.x> +The detailed format of structures is in F<common/protocol/guestfs_protocol.x> (note: this file is automatically generated). There are two broad cases, ordinary functions that don't have any diff --git a/generator/main.ml b/generator/main.ml index 846ab16..cef4a9b 100644 --- a/generator/main.ml +++ b/generator/main.ml @@ -94,7 +94,11 @@ Run it from the top source directory using the command perror "lock: BUGS" exn; exit 1); - output_to "src/guestfs_protocol.x" generate_xdr; + output_to "common/errnostring/errnostring-gperf.gperf" + generate_errnostring_gperf; + output_to "common/errnostring/errnostring.c" generate_errnostring_c; + output_to "common/errnostring/errnostring.h" generate_errnostring_h; + output_to "common/protocol/guestfs_protocol.x" generate_xdr; output_to "src/guestfs.h" generate_guestfs_h; output_to "src/guestfs-internal-actions.h" generate_internal_actions_h; output_to "src/guestfs-internal-frontend-cleanups.h" @@ -103,9 +107,6 @@ Run it from the top source directory using the command output_to "src/guestfs-structs.pod" generate_structs_pod; output_to "src/guestfs-actions.pod" generate_actions_pod; output_to "src/guestfs-availability.pod" generate_availability_pod; - output_to "src/errnostring-gperf.gperf" generate_errnostring_gperf; - output_to "src/errnostring.c" generate_errnostring_c; - output_to "src/errnostring.h" generate_errnostring_h; output_to "src/event-string.c" generate_event_string_c; output_to "src/MAX_PROC_NR" generate_max_proc_nr; output_to "src/libguestfs.syms" generate_linker_script; diff --git a/m4/guestfs_ocaml.m4 b/m4/guestfs_ocaml.m4 index 0deff61..0479e70 100644 --- a/m4/guestfs_ocaml.m4 +++ b/m4/guestfs_ocaml.m4 @@ -50,7 +50,7 @@ AM_CONDITIONAL([HAVE_OCAMLDOC], dnl OCaml is required if we need to run the generator. AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"],[ - AS_IF([! test -f $srcdir/src/guestfs_protocol.x],[ + AS_IF([! test -f $srcdir/common/protocol/guestfs_protocol.x],[ AC_MSG_FAILURE([OCaml compiler and findlib is required to build from git. If you don't have OCaml available, you should build from a tarball from http://libguestfs.org/download]) diff --git a/po/POTFILES b/po/POTFILES index 7a468c3..1328e88 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -13,6 +13,8 @@ cat/log.c cat/ls.c cat/tail.c cat/visit.c +common/errnostring/errnostring-gperf.c +common/errnostring/errnostring.c customize/crypt-c.c customize/dummy.c customize/perl_edit-c.c @@ -46,8 +48,6 @@ daemon/dmesg.c daemon/dropcaches.c daemon/du.c daemon/echo-daemon.c -daemon/errnostring-gperf.c -daemon/errnostring.c daemon/ext2.c daemon/fallocate.c daemon/file.c @@ -395,8 +395,6 @@ src/copy-in-out.c src/create.c src/dbdump.c src/drives.c -src/errnostring-gperf.c -src/errnostring.c src/errors.c src/event-string.c src/events.c diff --git a/src/Makefile.am b/src/Makefile.am index c315c5d..4cc928a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,7 +20,6 @@ include $(top_srcdir)/subdir-rules.mk noinst_PROGRAMS generator_built = \ - guestfs_protocol.x \ guestfs.h \ guestfs-internal-actions.h \ guestfs-internal-frontend-cleanups.h \ @@ -33,9 +32,6 @@ generator_built = \ actions-6.c \ actions-variants.c \ bindtests.c \ - errnostring-gperf.gperf \ - errnostring.c \ - errnostring.h \ event-string.c \ guestfs-actions.pod \ guestfs-availability.pod \ @@ -49,10 +45,7 @@ generator_built = \ structs-print.h BUILT_SOURCES = \ - $(generator_built) \ - guestfs_protocol.c \ - guestfs_protocol.h \ - errnostring-gperf.c + $(generator_built) EXTRA_DIST = \ $(BUILT_SOURCES) \ @@ -65,12 +58,13 @@ include_HEADERS = guestfs.h lib_LTLIBRARIES = libguestfs.la libguestfs_la_SOURCES = \ + ../common/errnostring/errnostring.h \ + ../common/protocol/guestfs_protocol.h \ guestfs.h \ guestfs-internal.h \ guestfs-internal-all.h \ guestfs-internal-frontend.h \ guestfs-internal-frontend-cleanups.h \ - guestfs_protocol.h \ actions-0.c \ actions-1.c \ actions-2.c \ @@ -143,6 +137,8 @@ libguestfs_la_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_PRIVATE=1 \ -DLIBOSINFO_DB_PATH='"$(datadir)/libosinfo/db"' \ + -I$(top_srcdir)/common/errnostring -I$(top_builddir)/common/errnostring \ + -I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib libguestfs_la_CFLAGS = \ @@ -154,8 +150,8 @@ libguestfs_la_CFLAGS = \ $(YAJL_CFLAGS) libguestfs_la_LIBADD = \ - liberrnostring.la \ - libprotocol.la \ + ../common/errnostring/liberrnostring.la \ + ../common/protocol/libprotocol.la \ libutils.la \ $(PCRE_LIBS) $(MAGIC_LIBS) \ $(LIBVIRT_LIBS) $(LIBXML2_LIBS) \ @@ -184,53 +180,10 @@ libguestfs_la_CFLAGS += $(FUSE_CFLAGS) libguestfs_la_LIBADD += $(FUSE_LIBS) endif -# Convenience libraries. -noinst_LTLIBRARIES = liberrnostring.la libprotocol.la libutils.la - -# Build the errnostring perfect hash code. The generated code has lots -# of warnings so we must compile it in a separate mini-library. -liberrnostring_la_SOURCES = \ - errnostring-gperf.c \ - errnostring.h \ - errnostring.c -liberrnostring_la_CFLAGS = $(GCC_VISIBILITY_HIDDEN) - -errnostring-gperf.c: errnostring-gperf.gperf - rm -f $@ - $(GPERF) -t $< > $@-t - mv $@-t $@ - -# This convenience library is solely to compile its generated sources with -# custom flags. -libprotocol_la_SOURCES = guestfs_protocol.c guestfs_protocol.h -libprotocol_la_CFLAGS = \ - -Wall -Wno-unused -fno-strict-aliasing $(GCC_VISIBILITY_HIDDEN) - -if HAVE_RPCGEN -RPCGEN_DEFS -if HAVE_XDR_U_INT64_T -RPCGEN_DEFS += -DHAVE_XDR_U_INT64_T=1 -else -if HAVE_XDR_UINT64_T -RPCGEN_DEFS += -DHAVE_XDR_UINT64_T=1 -endif -endif - -guestfs_protocol.c: guestfs_protocol.x - rm -f $@-t $@-t2 - $(RPCGEN) $(RPCGEN_DEFS) -c -o $@-t $< - $(SED) 's,\.\./\(\.\./\)*src,.,' < $@-t > $@-t2 - rm $@-t - mv $@-t2 $@ - -guestfs_protocol.h: guestfs_protocol.x - rm -f $@-t - $(RPCGEN) $(RPCGEN_DEFS) -h -o $@-t $< - mv $@-t $@ -endif - # libutils.la contains code outside libguestfs which is also # included in tools and bindings. +noinst_LTLIBRARIES = libutils.la + libutils_la_SOURCES = \ cleanup.c \ structs-cleanup.c \ diff --git a/tests/protocol/Makefile.am b/tests/protocol/Makefile.am index 8f3487d..d54a403 100644 --- a/tests/protocol/Makefile.am +++ b/tests/protocol/Makefile.am @@ -41,10 +41,12 @@ TESTS = \ check_PROGRAMS = test-error-messages test_error_messages_SOURCES = \ + ../../common/protocol/guestfs_protocol.h \ test-error-messages.c test_error_messages_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol test_error_messages_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_error_messages_LDADD = \ -- 2.9.3
Richard W.M. Jones
2017-Jan-25 14:37 UTC
[Libguestfs] [PATCH v2 2/7] lib: Move utilities to new directory common/utils.
Just code motion. This commit makes it clearer what is a utility and what is part of the library. It also makes it clear that we should rename: guestfs-internal-frontend.h -> utils.h guestfs-internal-frontend-cleanups.h -> cleanups.h (?) but this commit does not make that change. --- .gitignore | 10 ++--- Makefile.am | 2 +- align/Makefile.am | 3 +- builder/Makefile.am | 3 ++ cat/Makefile.am | 15 ++++--- common/utils/Makefile.am | 53 +++++++++++++++++++++++ {src => common/utils}/cleanup.c | 0 {src => common/utils}/guestfs-internal-frontend.h | 0 {src => common/utils}/utils.c | 0 configure.ac | 1 + customize/Makefile.am | 2 + df/Makefile.am | 3 +- dib/Makefile.am | 2 + diff/Makefile.am | 3 +- docs/C_SOURCE_FILES | 16 +++---- docs/guestfs-hacking.pod | 4 ++ edit/Makefile.am | 3 +- erlang/Makefile.am | 3 +- fish/Makefile.am | 6 ++- format/Makefile.am | 3 +- fuse/Makefile.am | 15 ++++--- generator/main.ml | 13 +++--- generator/ocaml.ml | 3 +- generator/perl.ml | 2 +- generator/php.ml | 2 +- generator/ruby.ml | 2 +- get-kernel/Makefile.am | 2 + inspector/Makefile.am | 3 +- java/Makefile.am | 1 + lua/Makefile.am | 3 +- make-fs/Makefile.am | 3 +- mllib/Makefile.am | 2 + ocaml/Makefile.am | 7 +-- ocaml/guestfs-c.h | 2 - p2v/Makefile.am | 3 +- php/Makefile.am | 2 +- po/POTFILES | 10 ++--- python/Makefile.am | 9 ++-- rescue/Makefile.am | 3 +- resize/Makefile.am | 2 + ruby/Rakefile.in | 2 +- sparsify/Makefile.am | 2 + src/Makefile.am | 24 +++------- src/appliance-uefi.c | 2 +- sysprep/Makefile.am | 2 + test-tool/Makefile.am | 3 +- tests/c-api/Makefile.am | 26 ++++++++++- tests/charsets/Makefile.am | 3 +- tests/events/Makefile.am | 3 +- tests/mount-local/Makefile.am | 3 +- tests/parallel/Makefile.am | 3 +- tests/protocol/Makefile.am | 7 +-- tests/regressions/Makefile.am | 11 ++++- utils/boot-analysis/Makefile.am | 3 +- utils/boot-benchmark/Makefile.am | 3 +- utils/qemu-boot/Makefile.am | 3 +- utils/qemu-speed-test/Makefile.am | 3 +- v2v/Makefile.am | 3 ++ v2v/input_libvirtxml.ml | 2 +- v2v/test-harness/Makefile.am | 2 + v2v/utils.ml | 2 +- 61 files changed, 234 insertions(+), 99 deletions(-) create mode 100644 common/utils/Makefile.am rename {src => common/utils}/cleanup.c (100%) rename {src => common/utils}/guestfs-internal-frontend.h (100%) rename {src => common/utils}/utils.c (100%) diff --git a/.gitignore b/.gitignore index 5a13d1d..f7d7864 100644 --- a/.gitignore +++ b/.gitignore @@ -123,6 +123,11 @@ Makefile.in /common/protocol/guestfs_protocol.c /common/protocol/guestfs_protocol.h /common/protocol/guestfs_protocol.x +/common/utils/guestfs-internal-frontend-cleanups.h +/common/utils/structs-cleanup.c +/common/utils/structs-print.c +/common/utils/structs-print.h +/common/utils/uefi.c /compile /config.cache /config.guess @@ -502,7 +507,6 @@ Makefile.in /src/guestfs-availability.pod /src/guestfs.h /src/guestfs-internal-actions.h -/src/guestfs-internal-frontend-cleanups.h /src/guestfs-structs.pod /src/libguestfs.3 /src/libguestfs.pc @@ -510,13 +514,9 @@ Makefile.in /src/.libs/libguestfs.so /src/libvirt-is-version /src/stamp-guestfs.pod -/src/structs-cleanup.c /src/structs-compare.c /src/structs-copy.c /src/structs-free.c -/src/structs-print.c -/src/structs-print.h -/src/uefi.c /src/unit-tests /stamp-h1 /sysprep/.depend diff --git a/Makefile.am b/Makefile.am index 6049e64..5910a09 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,7 @@ SUBDIRS += gnulib/tests endif # Basic source for the library. -SUBDIRS += common/errnostring common/protocol +SUBDIRS += common/errnostring common/protocol common/utils SUBDIRS += src docs examples po # The daemon and the appliance. diff --git a/align/Makefile.am b/align/Makefile.am index aaa0453..86975a3 100644 --- a/align/Makefile.am +++ b/align/Makefile.am @@ -39,6 +39,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)/src -I$(top_builddir)/src \ -I$(top_srcdir)/df \ -I$(top_srcdir)/fish \ @@ -52,7 +53,7 @@ virt_alignment_scan_CFLAGS = \ $(LIBVIRT_CFLAGS) virt_alignment_scan_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/builder/Makefile.am b/builder/Makefile.am index 2a9f89b..85c754f 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -100,6 +100,7 @@ virt_builder_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/gnulib/lib \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src \ -I$(top_srcdir)/fish virt_builder_CFLAGS = \ @@ -119,6 +120,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ @@ -334,6 +336,7 @@ virt_index_validate_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src virt_index_validate_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ diff --git a/cat/Makefile.am b/cat/Makefile.am index 8a549b6..66d9356 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -43,6 +43,7 @@ virt_cat_SOURCES = \ virt_cat_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -52,7 +53,7 @@ virt_cat_CFLAGS = \ $(LIBXML2_CFLAGS) virt_cat_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ @@ -67,6 +68,7 @@ virt_filesystems_SOURCES = \ virt_filesystems_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -76,7 +78,7 @@ virt_filesystems_CFLAGS = \ $(LIBXML2_CFLAGS) virt_filesystems_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ @@ -91,6 +93,7 @@ virt_log_SOURCES = \ virt_log_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -100,7 +103,7 @@ virt_log_CFLAGS = \ $(LIBXML2_CFLAGS) virt_log_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ @@ -117,6 +120,7 @@ virt_ls_SOURCES = \ virt_ls_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -126,7 +130,7 @@ virt_ls_CFLAGS = \ $(LIBXML2_CFLAGS) virt_ls_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ @@ -141,6 +145,7 @@ virt_tail_SOURCES = \ virt_tail_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -150,7 +155,7 @@ virt_tail_CFLAGS = \ $(LIBXML2_CFLAGS) virt_tail_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am new file mode 100644 index 0000000..d1ad261 --- /dev/null +++ b/common/utils/Makefile.am @@ -0,0 +1,53 @@ +# 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 = \ + guestfs-internal-frontend-cleanups.h \ + structs-cleanup.c \ + structs-print.c \ + structs-print.h \ + uefi.c + +BUILT_SOURCES = \ + $(generator_built) + +EXTRA_DIST = \ + $(BUILT_SOURCES) + +noinst_LTLIBRARIES = libutils.la + +libutils_la_SOURCES = \ + ../src/guestfs.h \ + cleanup.c \ + guestfs-internal-frontend.h \ + guestfs-internal-frontend-cleanups.h \ + structs-cleanup.c \ + structs-print.c \ + structs-print.h \ + uefi.c \ + utils.c +libutils_la_CPPFLAGS = \ + -DGUESTFS_WARN_DEPRECATED=1 \ + -DGUESTFS_PRIVATE=1 \ + -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/src -I$(top_builddir)/src +libutils_la_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + $(GCC_VISIBILITY_HIDDEN) \ + $(LIBXML2_CFLAGS) diff --git a/src/cleanup.c b/common/utils/cleanup.c similarity index 100% rename from src/cleanup.c rename to common/utils/cleanup.c diff --git a/src/guestfs-internal-frontend.h b/common/utils/guestfs-internal-frontend.h similarity index 100% rename from src/guestfs-internal-frontend.h rename to common/utils/guestfs-internal-frontend.h diff --git a/src/utils.c b/common/utils/utils.c similarity index 100% rename from src/utils.c rename to common/utils/utils.c diff --git a/configure.ac b/configure.ac index 359b255..2cf0fde 100644 --- a/configure.ac +++ b/configure.ac @@ -182,6 +182,7 @@ AC_CONFIG_FILES([Makefile cat/Makefile common/errnostring/Makefile common/protocol/Makefile + common/utils/Makefile csharp/Makefile customize/Makefile daemon/Makefile diff --git a/customize/Makefile.am b/customize/Makefile.am index 959fdaa..0f4ea83 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -96,6 +96,7 @@ libcustomize_a_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src \ -I$(top_srcdir)/fish libcustomize_a_CFLAGS = \ @@ -118,6 +119,7 @@ endif # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ diff --git a/df/Makefile.am b/df/Makefile.am index 405f44f..cddcbab 100644 --- a/df/Makefile.am +++ b/df/Makefile.am @@ -41,6 +41,7 @@ virt_df_SOURCES = \ virt_df_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -52,7 +53,7 @@ virt_df_CFLAGS = \ $(LIBVIRT_CFLAGS) virt_df_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/dib/Makefile.am b/dib/Makefile.am index 2ac362f..99912b5 100644 --- a/dib/Makefile.am +++ b/dib/Makefile.am @@ -47,6 +47,7 @@ virt_dib_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/gnulib/lib \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src virt_dib_CFLAGS = \ -pthread \ @@ -61,6 +62,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ diff --git a/diff/Makefile.am b/diff/Makefile.am index b9aa495..33e6b54 100644 --- a/diff/Makefile.am +++ b/diff/Makefile.am @@ -35,6 +35,7 @@ virt_diff_SOURCES = \ virt_diff_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/cat -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -44,7 +45,7 @@ virt_diff_CFLAGS = \ $(LIBXML2_CFLAGS) virt_diff_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index d87fa7b..0d1ca30 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -13,6 +13,14 @@ cat/ls.c cat/tail.c cat/visit.c cat/visit.h +common/utils/cleanup.c +common/utils/guestfs-internal-frontend-cleanups.h +common/utils/guestfs-internal-frontend.h +common/utils/structs-cleanup.c +common/utils/structs-print.c +common/utils/structs-print.h +common/utils/uefi.c +common/utils/utils.c customize/crypt-c.c customize/dummy.c customize/perl_edit-c.c @@ -318,7 +326,6 @@ src/appliance.c src/available.c src/bindtests.c src/canonical-name.c -src/cleanup.c src/command.c src/conn-socket.c src/copy-in-out.c @@ -333,8 +340,6 @@ src/filearch.c src/fuse.c src/guestfs-internal-actions.h src/guestfs-internal-all.h -src/guestfs-internal-frontend-cleanups.h -src/guestfs-internal-frontend.h src/guestfs-internal.h src/guestfs.h src/guid.c @@ -365,18 +370,13 @@ src/private-data.c src/proto.c src/qemu.c src/stringsbuf.c -src/structs-cleanup.c src/structs-compare.c src/structs-copy.c src/structs-free.c -src/structs-print.c -src/structs-print.h src/tmpdirs.c src/tsk.c -src/uefi.c src/umask.c src/unit-tests.c -src/utils.c src/version.c src/wait.c src/whole-file.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index 4633a8a..6e7c7b6 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -94,6 +94,10 @@ handled by this library. The XDR-based communication protocol used between the library and the daemon running inside the appliance is defined here. +=item F<common/utils> + +Various utility functions used throughout the library and tools. + =back =item F<contrib> diff --git a/edit/Makefile.am b/edit/Makefile.am index 40a1afb..06f45d8 100644 --- a/edit/Makefile.am +++ b/edit/Makefile.am @@ -37,6 +37,7 @@ virt_edit_SOURCES = \ virt_edit_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -46,7 +47,7 @@ virt_edit_CFLAGS = \ $(LIBXML2_CFLAGS) virt_edit_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/erlang/Makefile.am b/erlang/Makefile.am index 6c9aef8..64f0e44 100644 --- a/erlang/Makefile.am +++ b/erlang/Makefile.am @@ -80,6 +80,7 @@ erl_guestfs_SOURCES = \ erl_guestfs_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib \ -I$(ERLANG_LIB_DIR_erl_interface)/include @@ -91,7 +92,7 @@ erl_guestfs_LDADD = \ $(ERLANG_LIB_DIR_erl_interface)/lib/liberl_interface.a \ $(ERLANG_LIB_DIR_erl_interface)/lib/libei.a \ -lpthread \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/fish/Makefile.am b/fish/Makefile.am index 8165772..8460b6d 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -97,6 +97,7 @@ libfishcommon_la_SOURCES = \ $(FISHCOMMON_SOURCE_FILES) libfishcommon_la_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish -I$(top_builddir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -104,8 +105,8 @@ libfishcommon_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBXML2_CFLAGS) libfishcommon_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ - $(top_builddir)/src/libutils.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) @@ -162,6 +163,7 @@ guestfish_CPPFLAGS = \ -DCOMPILING_GUESTFISH=1 \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish -I$(top_builddir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -175,8 +177,8 @@ guestfish_LDADD = \ $(LIBCONFIG_LIBS) \ $(LIBREADLINE) \ $(LIBTINFO_LIBS) \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ - $(top_builddir)/src/libutils.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ -lm diff --git a/format/Makefile.am b/format/Makefile.am index 1079ed7..627a38d 100644 --- a/format/Makefile.am +++ b/format/Makefile.am @@ -30,6 +30,7 @@ virt_format_SOURCES = \ virt_format_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -40,7 +41,7 @@ virt_format_CFLAGS = \ $(LIBVIRT_CFLAGS) virt_format_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/fuse/Makefile.am b/fuse/Makefile.am index f46005a..ca09733 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -44,6 +44,7 @@ guestmount_SOURCES = \ guestmount_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -57,7 +58,7 @@ guestmount_CFLAGS = \ guestmount_LDADD = \ $(FUSE_LIBS) \ $(LIBCONFIG_LIBS) \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ @@ -74,6 +75,7 @@ guestunmount_SOURCES = \ guestunmount_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -82,7 +84,7 @@ guestunmount_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) guestunmount_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -144,6 +146,7 @@ test_fuse_SOURCES = \ test-fuse.c test_fuse_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -151,7 +154,7 @@ test_fuse_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_fuse_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -162,6 +165,7 @@ test_guestmount_fd_SOURCES = \ test-guestmount-fd.c test_guestmount_fd_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -169,7 +173,7 @@ test_guestmount_fd_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_guestmount_fd_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -180,6 +184,7 @@ test_guestunmount_fd_SOURCES = \ test-guestunmount-fd.c test_guestunmount_fd_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -187,7 +192,7 @@ test_guestunmount_fd_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_guestunmount_fd_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/generator/main.ml b/generator/main.ml index cef4a9b..b1007f6 100644 --- a/generator/main.ml +++ b/generator/main.ml @@ -99,10 +99,15 @@ Run it from the top source directory using the command output_to "common/errnostring/errnostring.c" generate_errnostring_c; output_to "common/errnostring/errnostring.h" generate_errnostring_h; output_to "common/protocol/guestfs_protocol.x" generate_xdr; + output_to "common/utils/guestfs-internal-frontend-cleanups.h" + generate_internal_frontend_cleanups_h; + output_to "common/utils/structs-cleanup.c" generate_client_structs_cleanup; + output_to "common/utils/structs-print.c" generate_client_structs_print_c; + output_to "common/utils/structs-print.h" generate_client_structs_print_h; + output_to "common/utils/uefi.c" generate_uefi_c; + output_to "src/guestfs.h" generate_guestfs_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; output_to "src/bindtests.c" generate_bindtests; output_to "src/guestfs-structs.pod" generate_structs_pod; output_to "src/guestfs-actions.pod" generate_actions_pod; @@ -114,9 +119,6 @@ Run it from the top source directory using the command output_to "src/structs-compare.c" generate_client_structs_compare; output_to "src/structs-copy.c" generate_client_structs_copy; output_to "src/structs-free.c" generate_client_structs_free; - output_to "src/structs-cleanup.c" generate_client_structs_cleanup; - output_to "src/structs-print.c" generate_client_structs_print_c; - output_to "src/structs-print.h" generate_client_structs_print_h; output_to "src/actions-variants.c" generate_client_actions_variants; output_to_subset "src/actions-%d.c" generate_client_actions; output_to "daemon/actions.h" generate_daemon_actions_h; @@ -236,7 +238,6 @@ Run it from the top source directory using the command generate_gobject_session_header; output_to "gobject/src/session.c" generate_gobject_session_source; - output_to "src/uefi.c" generate_uefi_c; output_to "v2v/uefi.ml" generate_uefi_ml; output_to "v2v/uefi.mli" generate_uefi_mli; diff --git a/generator/ocaml.ml b/generator/ocaml.ml index 6d7fb19..083e505 100644 --- a/generator/ocaml.ml +++ b/generator/ocaml.ml @@ -417,7 +417,8 @@ and generate_ocaml_c () #include <caml/mlvalues.h> #include <caml/signals.h> -#include \"guestfs.h\" +#include <guestfs.h> +#include \"guestfs-internal-frontend.h\" #include \"guestfs-c.h\" diff --git a/generator/perl.ml b/generator/perl.ml index 2b8dfbd..3a87f16 100644 --- a/generator/perl.ml +++ b/generator/perl.ml @@ -56,7 +56,7 @@ let rec generate_perl_xs () #endif #include <guestfs.h> -#include \"guestfs-internal-frontend.h\" +#include \"guestfs-internal-all.h\" static SV * my_newSVll(long long val) { diff --git a/generator/php.ml b/generator/php.ml index 5f6365d..90869ef 100644 --- a/generator/php.ml +++ b/generator/php.ml @@ -90,7 +90,7 @@ and generate_php_c () #include <php_guestfs_php.h> #include \"guestfs.h\" -#include \"guestfs-internal-frontend.h\" +#include \"guestfs-internal-frontend.h\" /* Only for POINTER_NOT_IMPLEMENTED */ static int res_guestfs_h; diff --git a/generator/ruby.ml b/generator/ruby.ml index 6b5745f..c938bc9 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -55,7 +55,7 @@ let rec generate_ruby_h () #endif #include \"guestfs.h\" -#include \"guestfs-internal-frontend.h\" +#include \"guestfs-internal-frontend.h\" /* Only for POINTER_NOT_IMPLEMENTED */ #include \"extconf.h\" diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am index 55b3577..d2f6d6d 100644 --- a/get-kernel/Makefile.am +++ b/get-kernel/Makefile.am @@ -43,6 +43,7 @@ virt_get_kernel_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/gnulib/lib \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src \ -I$(top_srcdir)/fish virt_get_kernel_CFLAGS = \ @@ -58,6 +59,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ diff --git a/inspector/Makefile.am b/inspector/Makefile.am index 4bf55cc..1456966 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -58,6 +58,7 @@ virt_inspector_SOURCES = \ virt_inspector_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -67,7 +68,7 @@ virt_inspector_CFLAGS = \ $(LIBXML2_CFLAGS) virt_inspector_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/java/Makefile.am b/java/Makefile.am index bc88162..b165f5a 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -108,6 +108,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)/src -I$(top_builddir)/src libguestfs_jni_la_CFLAGS = \ diff --git a/lua/Makefile.am b/lua/Makefile.am index 5c2efca..30ec4fb 100644 --- a/lua/Makefile.am +++ b/lua/Makefile.am @@ -41,6 +41,7 @@ libluaguestfs_la_SOURCES = lua-guestfs.c libluaguestfs_la_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src libluaguestfs_la_CFLAGS = \ @@ -48,7 +49,7 @@ libluaguestfs_la_CFLAGS = \ $(LUA_CFLAGS) libluaguestfs_la_LIBADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am index 8d068b3..fde3dea 100644 --- a/make-fs/Makefile.am +++ b/make-fs/Makefile.am @@ -30,6 +30,7 @@ virt_make_fs_SOURCES = \ virt_make_fs_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -39,7 +40,7 @@ virt_make_fs_CFLAGS = \ $(LIBXML2_CFLAGS) virt_make_fs_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ diff --git a/mllib/Makefile.am b/mllib/Makefile.am index c8a9bca..40f2212 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -110,6 +110,7 @@ libmllib_a_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src \ -I$(top_srcdir)/cat \ -I$(top_srcdir)/fish @@ -126,6 +127,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index 100b046..8377a83 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -69,19 +69,20 @@ stamp-mlguestfs: libguestfsocaml.a $(guestfs_cmm) $(libguestfsocaml_a_OBJECTS) guestfs.cmo \ $(LDFLAGS) \ $(LTLIBINTL) \ - -L$(top_builddir)/src/.libs -lguestfs + -L../src/.libs -lguestfs if HAVE_OCAMLOPT $(OCAMLMKLIB) -o mlguestfs \ $(libguestfsocaml_a_OBJECTS) guestfs.cmx \ $(LDFLAGS) \ $(LTLIBINTL) \ - -L$(top_builddir)/src/.libs -lguestfs + -L../src/.libs -lguestfs endif touch $@ libguestfsocaml_a_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/gnulib/lib -I../gnulib/lib @@ -93,7 +94,7 @@ libguestfsocaml_a_SOURCES = \ guestfs-c.c \ guestfs-c-actions.c \ guestfs-c-errnos.c \ - ../src/utils.c + ../common/utils/utils.c if HAVE_OCAMLDOC diff --git a/ocaml/guestfs-c.h b/ocaml/guestfs-c.h index 21cdaa6..9380cf9 100644 --- a/ocaml/guestfs-c.h +++ b/ocaml/guestfs-c.h @@ -19,8 +19,6 @@ #ifndef GUESTFS_OCAML_C_H #define GUESTFS_OCAML_C_H -#include "guestfs-internal-frontend.h" - #define Guestfs_val(v) (*((guestfs_h **)Data_custom_val(v))) extern void guestfs_int_ocaml_raise_error (guestfs_h *g, const char *func) Noreturn; diff --git a/p2v/Makefile.am b/p2v/Makefile.am index ef96f34..1cefd62 100644 --- a/p2v/Makefile.am +++ b/p2v/Makefile.am @@ -92,6 +92,7 @@ virt_p2v_SOURCES = \ virt_p2v_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -104,7 +105,7 @@ virt_p2v_CFLAGS = \ $(DBUS_CFLAGS) virt_p2v_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(PCRE_LIBS) \ $(LIBXML2_LIBS) \ $(GTK_LIBS) \ diff --git a/php/Makefile.am b/php/Makefile.am index 4db7d84..4dda499 100644 --- a/php/Makefile.am +++ b/php/Makefile.am @@ -38,7 +38,7 @@ php_DATA = guestfs_php.ini # and we need to add the library to EXTRA_LDFLAGS. all: check-builddir-equals-srcdir extension/config.h $(MAKE) -C extension \ - EXTRA_INCLUDES="-I$(abs_srcdir)/../src" \ + EXTRA_INCLUDES="-I$(abs_srcdir)/../common/utils -I$(abs_srcdir)/../src" \ EXTRA_LDFLAGS="-L$(abs_srcdir)/../src/.libs -lguestfs" \ EXTRA_CFLAGS="-DGUESTFS_PRIVATE=1" \ all diff --git a/po/POTFILES b/po/POTFILES index 1328e88..05e3631 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -15,6 +15,11 @@ cat/tail.c cat/visit.c common/errnostring/errnostring-gperf.c common/errnostring/errnostring.c +common/utils/cleanup.c +common/utils/structs-cleanup.c +common/utils/structs-print.c +common/utils/uefi.c +common/utils/utils.c customize/crypt-c.c customize/dummy.c customize/perl_edit-c.c @@ -388,7 +393,6 @@ src/appliance.c src/available.c src/bindtests.c src/canonical-name.c -src/cleanup.c src/command.c src/conn-socket.c src/copy-in-out.c @@ -429,17 +433,13 @@ src/private-data.c src/proto.c src/qemu.c src/stringsbuf.c -src/structs-cleanup.c src/structs-compare.c src/structs-copy.c src/structs-free.c -src/structs-print.c src/tmpdirs.c src/tsk.c -src/uefi.c src/umask.c src/unit-tests.c -src/utils.c src/version.c src/wait.c src/whole-file.c diff --git a/python/Makefile.am b/python/Makefile.am index 0a03f73..ec99570 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -67,13 +67,14 @@ libguestfsmod_la_SOURCES = \ libguestfsmod_la_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ $(PYTHON_CFLAGS) \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src libguestfsmod_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) libguestfsmod_la_LIBADD = \ - $(top_builddir)/src/libutils_la-utils.lo \ + $(top_builddir)/common/utils/libutils_la-utils.lo \ $(top_builddir)/src/libguestfs.la libguestfsmod_la_LDFLAGS = -avoid-version -shared -module -shrext $(PYTHON_EXT_SUFFIX) @@ -117,13 +118,13 @@ guestfs-internal-all.h: ln $(top_srcdir)/src/guestfs-internal-all.h $@ guestfs-internal-frontend-cleanups.h: - ln $(top_srcdir)/src/guestfs-internal-frontend-cleanups.h $@ + ln $(top_srcdir)/common/utils/guestfs-internal-frontend-cleanups.h $@ guestfs-internal-frontend.h: - ln $(top_srcdir)/src/guestfs-internal-frontend.h $@ + ln $(top_srcdir)/common/utils/guestfs-internal-frontend.h $@ utils.c: - ln $(top_srcdir)/src/utils.c $@ + ln $(top_srcdir)/common/utils/utils.c $@ # Tests. diff --git a/rescue/Makefile.am b/rescue/Makefile.am index 2ffb2fa..4159944 100644 --- a/rescue/Makefile.am +++ b/rescue/Makefile.am @@ -46,6 +46,7 @@ virt_rescue_CPPFLAGS = \ -DCOMPILING_VIRT_RESCUE=1 \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -57,7 +58,7 @@ virt_rescue_CFLAGS = \ virt_rescue_LDADD = \ $(LIBCONFIG_LIBS) \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/resize/Makefile.am b/resize/Makefile.am index 9dfba2d..a767c83 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -41,6 +41,7 @@ virt_resize_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src \ -I$(top_srcdir)/fish virt_resize_CFLAGS = \ @@ -55,6 +56,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in index 879159e..1d6cb87 100644 --- a/ruby/Rakefile.in +++ b/ruby/Rakefile.in @@ -65,7 +65,7 @@ CLOBBER.include [ "@builddir@/config.save", "@builddir@/ext/**/mkmf.log", # Build locally file MAKEFILE => EXT_CONF do |t| - unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/guestfs; cd @builddir@/ext/guestfs; @RUBY@ #{EXT_CONF} --with-_guestfs-include=$top_srcdir/src:$top_builddir --with-_guestfs-lib=$top_builddir/src/.libs" + unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/guestfs; cd @builddir@/ext/guestfs; @RUBY@ #{EXT_CONF} --with-_guestfs-include=$top_srcdir/common/utils:$top_srcdir/src:$top_builddir --with-_guestfs-lib=$top_builddir/src/.libs" $stderr.puts "Failed to run extconf" break end diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index ecfcd41..8df0c93 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -47,6 +47,7 @@ virt_sparsify_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src \ -I$(top_srcdir)/fish virt_sparsify_CFLAGS = \ @@ -60,6 +61,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ diff --git a/src/Makefile.am b/src/Makefile.am index 4cc928a..0f6a258 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,7 +22,6 @@ noinst_PROGRAMS generator_built = \ guestfs.h \ guestfs-internal-actions.h \ - guestfs-internal-frontend-cleanups.h \ actions-0.c \ actions-1.c \ actions-2.c \ @@ -60,11 +59,11 @@ lib_LTLIBRARIES = libguestfs.la libguestfs_la_SOURCES = \ ../common/errnostring/errnostring.h \ ../common/protocol/guestfs_protocol.h \ + ../common/utils/guestfs-internal-frontend.h \ + ../common/utils/guestfs-internal-frontend-cleanups.h \ guestfs.h \ guestfs-internal.h \ guestfs-internal-all.h \ - guestfs-internal-frontend.h \ - guestfs-internal-frontend-cleanups.h \ actions-0.c \ actions-1.c \ actions-2.c \ @@ -139,6 +138,7 @@ libguestfs_la_CPPFLAGS = \ -DLIBOSINFO_DB_PATH='"$(datadir)/libosinfo/db"' \ -I$(top_srcdir)/common/errnostring -I$(top_builddir)/common/errnostring \ -I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib libguestfs_la_CFLAGS = \ @@ -152,7 +152,7 @@ libguestfs_la_CFLAGS = \ libguestfs_la_LIBADD = \ ../common/errnostring/liberrnostring.la \ ../common/protocol/libprotocol.la \ - libutils.la \ + ../common/utils/libutils.la \ $(PCRE_LIBS) $(MAGIC_LIBS) \ $(LIBVIRT_LIBS) $(LIBXML2_LIBS) \ $(SELINUX_LIBS) \ @@ -180,20 +180,6 @@ libguestfs_la_CFLAGS += $(FUSE_CFLAGS) libguestfs_la_LIBADD += $(FUSE_LIBS) endif -# libutils.la contains code outside libguestfs which is also -# included in tools and bindings. -noinst_LTLIBRARIES = libutils.la - -libutils_la_SOURCES = \ - cleanup.c \ - structs-cleanup.c \ - structs-print.c \ - structs-print.h \ - uefi.c \ - utils.c -libutils_la_CPPFLAGS = $(libguestfs_la_CPPFLAGS) -libutils_la_CFLAGS = $(libguestfs_la_CFLAGS) - if HAVE_LIBVIRT # Small utility to check for a needed libvirt version; # to be used in shell/script-based tests. @@ -225,6 +211,7 @@ check_PROGRAMS = unit-tests 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)/src -I. unit_tests_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) @@ -232,6 +219,7 @@ unit_tests_CFLAGS = \ # non-exported functions we have to link with the objects not the # library. unit_tests_LDADD = \ + ../common/utils/libutils.la \ $(libguestfs_la_OBJECTS) \ $(libguestfs_la_LIBADD) diff --git a/src/appliance-uefi.c b/src/appliance-uefi.c index 814214c..1612c5d 100644 --- a/src/appliance-uefi.c +++ b/src/appliance-uefi.c @@ -19,7 +19,7 @@ /** * Find the UEFI firmware needed to boot the appliance. * - * See also F<src/uefi.c> (autogenerated file) containing the + * See also F<common/utils/uefi.c> (autogenerated file) containing the * firmware file locations. */ diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index a106a20..975a664 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -92,6 +92,7 @@ virt_sysprep_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src \ -I$(top_srcdir)/fish virt_sysprep_CFLAGS = \ @@ -106,6 +107,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am index df285a2..095f116 100644 --- a/test-tool/Makefile.am +++ b/test-tool/Makefile.am @@ -25,6 +25,7 @@ man_MANS = libguestfs-test-tool.1 libguestfs_test_tool_SOURCES = test-tool.c libguestfs_test_tool_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -DGUESTFS_WARN_DEPRECATED=1 \ @@ -35,8 +36,8 @@ libguestfs_test_tool_CFLAGS = \ $(LIBXML2_CFLAGS) libguestfs_test_tool_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ - $(top_builddir)/src/libutils.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am index 599e499..9d4898b 100644 --- a/tests/c-api/Makefile.am +++ b/tests/c-api/Makefile.am @@ -92,13 +92,14 @@ tests_SOURCES = \ 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)/src -I$(top_builddir)/src tests_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(PCRE_CFLAGS) tests_LDADD = \ $(PCRE_LIBS) \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -136,10 +137,12 @@ endif test_create_handle_SOURCES = test-create-handle.c test_create_handle_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_create_handle_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_create_handle_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la if HAVE_LIBDL @@ -155,90 +158,107 @@ endif test_config_SOURCES = test-config.c test_config_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_config_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_config_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la test_add_drive_opts_SOURCES = test-add-drive-opts.c test_add_drive_opts_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_add_drive_opts_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_add_drive_opts_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la test_last_errno_SOURCES = test-last-errno.c test_last_errno_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_last_errno_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_last_errno_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la test_backend_settings_SOURCES = test-backend-settings.c test_backend_settings_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_backend_settings_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_backend_settings_LDADD = \ - $(top_builddir)/src/libutils_la-utils.lo \ + $(top_builddir)/common/utils/libutils.la \ $(LTLIBINTL) \ $(top_builddir)/src/libguestfs.la test_private_data_SOURCES = test-private-data.c test_private_data_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_private_data_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_private_data_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la test_user_cancel_SOURCES = test-user-cancel.c test_user_cancel_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_user_cancel_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_user_cancel_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la -lm \ $(top_builddir)/gnulib/lib/libgnu.la test_debug_to_file_SOURCES = test-debug-to-file.c test_debug_to_file_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib test_debug_to_file_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_debug_to_file_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la test_environment_SOURCES = test-environment.c test_environment_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib test_environment_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_environment_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la test_event_string_SOURCES = test-event-string.c test_event_string_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib test_event_string_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_event_string_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la @@ -246,6 +266,7 @@ test_event_string_LDADD = \ if HAVE_LIBVIRT test_add_libvirt_dom_SOURCES = test-add-libvirt-dom.c test_add_libvirt_dom_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib @@ -253,6 +274,7 @@ test_add_libvirt_dom_CFLAGS = \ $(LIBVIRT_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_add_libvirt_dom_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ $(LTLIBTHREAD) $(top_builddir)/gnulib/lib/libgnu.la diff --git a/tests/charsets/Makefile.am b/tests/charsets/Makefile.am index a285867..5715402 100644 --- a/tests/charsets/Makefile.am +++ b/tests/charsets/Makefile.am @@ -27,11 +27,12 @@ check_PROGRAMS = $(TESTS) test_charset_fidelity_SOURCES = test-charset-fidelity.c test_charset_fidelity_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_charset_fidelity_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_charset_fidelity_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/tests/events/Makefile.am b/tests/events/Makefile.am index 0231a6b..d2d2e4c 100644 --- a/tests/events/Makefile.am +++ b/tests/events/Makefile.am @@ -34,12 +34,13 @@ check_PROGRAMS += test-libvirt-auth-callbacks test_libvirt_auth_callbacks_SOURCES = test-libvirt-auth-callbacks.c test_libvirt_auth_callbacks_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_libvirt_auth_callbacks_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBVIRT_CFLAGS) test_libvirt_auth_callbacks_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBVIRT_LIBS) \ $(LIBXML2_LIBS) \ diff --git a/tests/mount-local/Makefile.am b/tests/mount-local/Makefile.am index 2d851a0..f0bba80 100644 --- a/tests/mount-local/Makefile.am +++ b/tests/mount-local/Makefile.am @@ -33,6 +33,7 @@ test_parallel_mount_local_SOURCES = \ test_parallel_mount_local_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/df test_parallel_mount_local_CFLAGS = \ @@ -41,7 +42,7 @@ test_parallel_mount_local_CFLAGS = \ $(FUSE_CFLAGS) test_parallel_mount_local_LDADD = \ $(FUSE_LIBS) \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/tests/parallel/Makefile.am b/tests/parallel/Makefile.am index c5c3ef7..cf67232 100644 --- a/tests/parallel/Makefile.am +++ b/tests/parallel/Makefile.am @@ -28,12 +28,13 @@ test_parallel_SOURCES = test-parallel.c test_parallel_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_parallel_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_parallel_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la diff --git a/tests/protocol/Makefile.am b/tests/protocol/Makefile.am index d54a403..6c7a76c 100644 --- a/tests/protocol/Makefile.am +++ b/tests/protocol/Makefile.am @@ -45,12 +45,13 @@ test_error_messages_SOURCES = \ test-error-messages.c test_error_messages_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ - -I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol \ + -I$(top_srcdir)/src -I$(top_builddir)/src test_error_messages_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_error_messages_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am index fa8079a..4f78178 100644 --- a/tests/regressions/Makefile.am +++ b/tests/regressions/Makefile.am @@ -104,52 +104,61 @@ check_PROGRAMS = \ rhbz501893_SOURCES = rhbz501893.c rhbz501893_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src rhbz501893_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) rhbz501893_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la rhbz790721_SOURCES = rhbz790721.c rhbz790721_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src rhbz790721_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) rhbz790721_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la rhbz914931_SOURCES = rhbz914931.c rhbz914931_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -DGUESTFS_PRIVATE=1 rhbz914931_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) rhbz914931_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(LTLIBINTL) \ $(top_builddir)/src/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la rhbz1055452_SOURCES = rhbz1055452.c rhbz1055452_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src rhbz1055452_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) rhbz1055452_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la test_big_heap_SOURCES = test-big-heap.c test_big_heap_CPPFLAGS = \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src test_big_heap_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_big_heap_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la SLOW_TESTS = \ diff --git a/utils/boot-analysis/Makefile.am b/utils/boot-analysis/Makefile.am index 5539de9..d472884 100644 --- a/utils/boot-analysis/Makefile.am +++ b/utils/boot-analysis/Makefile.am @@ -29,13 +29,14 @@ boot_analysis_SOURCES = \ boot-analysis-utils.h boot_analysis_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src boot_analysis_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(PCRE_CFLAGS) boot_analysis_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(PCRE_LIBS) \ $(LIBXML2_LIBS) \ diff --git a/utils/boot-benchmark/Makefile.am b/utils/boot-benchmark/Makefile.am index 4b65f83..e77e5d9 100644 --- a/utils/boot-benchmark/Makefile.am +++ b/utils/boot-benchmark/Makefile.am @@ -31,12 +31,13 @@ boot_benchmark_SOURCES = \ ../boot-analysis/boot-analysis-utils.h boot_benchmark_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/utils/boot-analysis boot_benchmark_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) boot_benchmark_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ diff --git a/utils/qemu-boot/Makefile.am b/utils/qemu-boot/Makefile.am index c6df3f0..4f0d6a9 100644 --- a/utils/qemu-boot/Makefile.am +++ b/utils/qemu-boot/Makefile.am @@ -25,13 +25,14 @@ qemu_boot_SOURCES = \ qemu-boot.c qemu_boot_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/df qemu_boot_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) qemu_boot_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/utils/qemu-speed-test/Makefile.am b/utils/qemu-speed-test/Makefile.am index e09b414..c8ee0ec 100644 --- a/utils/qemu-speed-test/Makefile.am +++ b/utils/qemu-speed-test/Makefile.am @@ -23,12 +23,13 @@ qemu_speed_test_SOURCES = \ qemu-speed-test.c qemu_speed_test_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/df qemu_speed_test_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) qemu_speed_test_LDADD = \ - $(top_builddir)/src/libutils.la \ + $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/src/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/v2v/Makefile.am b/v2v/Makefile.am index 1f32942..b0fe917 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -115,6 +115,7 @@ virt_v2v_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src virt_v2v_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ @@ -132,6 +133,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ @@ -172,6 +174,7 @@ virt_v2v_copy_to_local_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ + -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/src virt_v2v_copy_to_local_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml index f2866aa..b19ac79 100644 --- a/v2v/input_libvirtxml.ml +++ b/v2v/input_libvirtxml.ml @@ -35,7 +35,7 @@ and parsed_source | P_dont_rewrite (* Turn string like "hda" into controller slot number. See also - * src/utils.c:guestfs_int_drive_index which this function calls. + * common/utils/utils.c:guestfs_int_drive_index which this function calls. *) let get_drive_slot str offset let len = String.length str in diff --git a/v2v/test-harness/Makefile.am b/v2v/test-harness/Makefile.am index 1a1a1a7..e2ba15c 100644 --- a/v2v/test-harness/Makefile.am +++ b/v2v/test-harness/Makefile.am @@ -38,6 +38,7 @@ if HAVE_OCAML_PKG_LIBVIRT # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix,libvirt \ + -I $(top_builddir)/common/utils/.libs \ -I $(top_builddir)/src/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ @@ -71,6 +72,7 @@ noinst_LIBRARIES = libv2vth.a libv2vth_a_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/src -I$(top_builddir)/src \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib diff --git a/v2v/utils.ml b/v2v/utils.ml index 1b48974..17ad8a2 100644 --- a/v2v/utils.ml +++ b/v2v/utils.ml @@ -51,7 +51,7 @@ let qemu_supports_sound_card = function (* Find the UEFI firmware. *) let find_uefi_firmware guest_arch let files - (* The lists of firmware are actually defined in src/uefi.c. *) + (* The lists of firmware are actually defined in common/utils/uefi.c. *) match guest_arch with | "i386" | "i486" | "i586" | "i686" -> Uefi.uefi_i386_firmware | "x86_64" -> Uefi.uefi_x86_64_firmware -- 2.9.3
--- .gitignore | 40 ++++----- Makefile.am | 2 +- align/Makefile.am | 4 +- builder/Makefile.am | 8 +- cat/Makefile.am | 20 ++--- cfg.mk | 2 +- common/protocol/Makefile.am | 2 +- common/utils/Makefile.am | 4 +- common/utils/guestfs-internal-frontend.h | 2 +- common/utils/utils.c | 2 +- configure.ac | 4 +- contrib/README | 2 +- contrib/windows-icons.pl | 2 +- customize/Makefile.am | 6 +- daemon/Makefile.am | 4 +- df/Makefile.am | 4 +- dib/Makefile.am | 6 +- diff/Makefile.am | 4 +- docs/C_SOURCE_FILES | 142 +++++++++++++++---------------- docs/guestfs-hacking.pod | 16 ++-- docs/make-internal-documentation.pl | 8 +- edit/Makefile.am | 4 +- erlang/Makefile.am | 4 +- examples/Makefile.am | 34 ++++---- fish/Makefile.am | 8 +- format/Makefile.am | 4 +- fuse/Makefile.am | 20 ++--- generator/actions.ml | 4 +- generator/actions.mli | 2 +- generator/main.ml | 30 +++---- get-kernel/Makefile.am | 6 +- gobject/Makefile.am | 8 +- haskell/Makefile.am | 4 +- inspector/Makefile.am | 4 +- installcheck.sh.in | 10 +-- java/Makefile.am | 4 +- {src => lib}/MAX_PROC_NR | 0 {src => lib}/Makefile.am | 2 +- {src => lib}/actions-support.c | 2 +- {src => lib}/alloc.c | 0 {src => lib}/appliance-cpu.c | 0 {src => lib}/appliance-kcmdline.c | 0 {src => lib}/appliance-uefi.c | 0 {src => lib}/appliance.c | 0 {src => lib}/available.c | 0 {src => lib}/canonical-name.c | 0 {src => lib}/command.c | 0 {src => lib}/conn-socket.c | 0 {src => lib}/copy-in-out.c | 0 {src => lib}/create.c | 0 {src => lib}/dbdump.c | 0 {src => lib}/drives.c | 0 {src => lib}/errors.c | 0 {src => lib}/events.c | 0 {src => lib}/file.c | 0 {src => lib}/filearch.c | 0 {src => lib}/fuse.c | 0 {src => lib}/guestfs-internal-all.h | 4 +- {src => lib}/guestfs-internal.h | 12 +-- {src => lib}/guestfs.pod | 0 {src => lib}/guid.c | 0 {src => lib}/handle.c | 0 {src => lib}/info.c | 0 {src => lib}/inspect-apps.c | 0 {src => lib}/inspect-fs-cd.c | 0 {src => lib}/inspect-fs-unix.c | 0 {src => lib}/inspect-fs-windows.c | 0 {src => lib}/inspect-fs.c | 0 {src => lib}/inspect-icon.c | 0 {src => lib}/inspect.c | 2 +- {src => lib}/journal.c | 0 {src => lib}/launch-direct.c | 0 {src => lib}/launch-libvirt.c | 0 {src => lib}/launch-uml.c | 0 {src => lib}/launch-unix.c | 0 {src => lib}/launch.c | 4 +- {src => lib}/libguestfs.pc.in | 0 {src => lib}/libvirt-auth.c | 0 {src => lib}/libvirt-domain.c | 0 {src => lib}/libvirt-is-version.c | 0 {src => lib}/listfs.c | 0 {src => lib}/lpj.c | 0 {src => lib}/match.c | 0 {src => lib}/mountable.c | 0 {src => lib}/osinfo.c | 0 {src => lib}/private-data.c | 0 {src => lib}/proto.c | 2 +- {src => lib}/qemu.c | 0 {src => lib}/stringsbuf.c | 0 {src => lib}/tmpdirs.c | 0 {src => lib}/tsk.c | 0 {src => lib}/umask.c | 0 {src => lib}/unit-tests.c | 2 +- {src => lib}/version.c | 0 {src => lib}/wait.c | 0 {src => lib}/whole-file.c | 0 lua/Makefile.am | 4 +- m4/guestfs_libraries.m4 | 2 +- make-fs/Makefile.am | 4 +- mllib/Makefile.am | 10 +-- ocaml/Makefile.am | 10 +-- ocaml/examples/Makefile.am | 2 +- p2v/Makefile.am | 4 +- p2v/conversion.c | 2 +- perl/Build.PL.in | 6 +- php/Makefile.am | 4 +- po/POTFILES | 138 +++++++++++++++--------------- python/Makefile.am | 6 +- python/setup.py.in | 2 +- rescue/Makefile.am | 4 +- resize/Makefile.am | 6 +- ruby/Rakefile.in | 2 +- run.in | 12 +-- sparsify/Makefile.am | 6 +- sysprep/Makefile.am | 6 +- test-tool/Makefile.am | 4 +- tests/c-api/Makefile.am | 60 ++++++------- tests/charsets/Makefile.am | 4 +- tests/disks/test-qemu-drive-libvirt.sh | 4 +- tests/events/Makefile.am | 4 +- tests/mount-local/Makefile.am | 4 +- tests/mountable/Makefile.am | 4 +- tests/parallel/Makefile.am | 4 +- tests/protocol/Makefile.am | 4 +- tests/regressions/Makefile.am | 22 ++--- tests/regressions/rhbz1044014.sh | 4 +- utils/boot-analysis/Makefile.am | 4 +- utils/boot-benchmark/Makefile.am | 4 +- utils/qemu-boot/Makefile.am | 4 +- utils/qemu-speed-test/Makefile.am | 4 +- v2v/Makefile.am | 8 +- v2v/domainxml-c.c | 2 +- v2v/test-harness/Makefile.am | 6 +- 133 files changed, 418 insertions(+), 422 deletions(-) rename {src => lib}/MAX_PROC_NR (100%) rename {src => lib}/Makefile.am (99%) rename {src => lib}/actions-support.c (97%) rename {src => lib}/alloc.c (100%) rename {src => lib}/appliance-cpu.c (100%) rename {src => lib}/appliance-kcmdline.c (100%) rename {src => lib}/appliance-uefi.c (100%) rename {src => lib}/appliance.c (100%) rename {src => lib}/available.c (100%) rename {src => lib}/canonical-name.c (100%) rename {src => lib}/command.c (100%) rename {src => lib}/conn-socket.c (100%) rename {src => lib}/copy-in-out.c (100%) rename {src => lib}/create.c (100%) rename {src => lib}/dbdump.c (100%) rename {src => lib}/drives.c (100%) rename {src => lib}/errors.c (100%) rename {src => lib}/events.c (100%) rename {src => lib}/file.c (100%) rename {src => lib}/filearch.c (100%) rename {src => lib}/fuse.c (100%) rename {src => lib}/guestfs-internal-all.h (97%) rename {src => lib}/guestfs-internal.h (99%) rename {src => lib}/guestfs.pod (100%) rename {src => lib}/guid.c (100%) rename {src => lib}/handle.c (100%) rename {src => lib}/info.c (100%) rename {src => lib}/inspect-apps.c (100%) rename {src => lib}/inspect-fs-cd.c (100%) rename {src => lib}/inspect-fs-unix.c (100%) rename {src => lib}/inspect-fs-windows.c (100%) rename {src => lib}/inspect-fs.c (100%) rename {src => lib}/inspect-icon.c (100%) rename {src => lib}/inspect.c (99%) rename {src => lib}/journal.c (100%) rename {src => lib}/launch-direct.c (100%) rename {src => lib}/launch-libvirt.c (100%) rename {src => lib}/launch-uml.c (100%) rename {src => lib}/launch-unix.c (100%) rename {src => lib}/launch.c (98%) rename {src => lib}/libguestfs.pc.in (100%) rename {src => lib}/libvirt-auth.c (100%) rename {src => lib}/libvirt-domain.c (100%) rename {src => lib}/libvirt-is-version.c (100%) rename {src => lib}/listfs.c (100%) rename {src => lib}/lpj.c (100%) rename {src => lib}/match.c (100%) rename {src => lib}/mountable.c (100%) rename {src => lib}/osinfo.c (100%) rename {src => lib}/private-data.c (100%) rename {src => lib}/proto.c (99%) rename {src => lib}/qemu.c (100%) rename {src => lib}/stringsbuf.c (100%) rename {src => lib}/tmpdirs.c (100%) rename {src => lib}/tsk.c (100%) rename {src => lib}/umask.c (100%) rename {src => lib}/unit-tests.c (99%) rename {src => lib}/version.c (100%) rename {src => lib}/wait.c (100%) rename {src => lib}/whole-file.c (100%) diff --git a/.gitignore b/.gitignore index f7d7864..ff6bbbb 100644 --- a/.gitignore +++ b/.gitignore @@ -305,6 +305,26 @@ Makefile.in /java/doc-stamp /java/examples/guestfs-java.3 /java/examples/stamp-guestfs-java.pod +/lib/actions-?.c +/lib/actions-variants.c +/lib/bindtests.c +/lib/event-string.c +/lib/guestfs.3 +/lib/guestfs-actions.pod +/lib/guestfs-availability.pod +/lib/guestfs.h +/lib/guestfs-internal-actions.h +/lib/guestfs-structs.pod +/lib/libguestfs.3 +/lib/libguestfs.pc +/lib/libguestfs.syms +/lib/.libs/libguestfs.so +/lib/libvirt-is-version +/lib/stamp-guestfs.pod +/lib/structs-compare.c +/lib/structs-copy.c +/lib/structs-free.c +/lib/unit-tests /libguestfs.spec /libguestfs-*.tar.gz /libtool @@ -498,26 +518,6 @@ Makefile.in /sparsify/stamp-virt-sparsify.pod /sparsify/virt-sparsify /sparsify/virt-sparsify.1 -/src/actions-?.c -/src/actions-variants.c -/src/bindtests.c -/src/event-string.c -/src/guestfs.3 -/src/guestfs-actions.pod -/src/guestfs-availability.pod -/src/guestfs.h -/src/guestfs-internal-actions.h -/src/guestfs-structs.pod -/src/libguestfs.3 -/src/libguestfs.pc -/src/libguestfs.syms -/src/.libs/libguestfs.so -/src/libvirt-is-version -/src/stamp-guestfs.pod -/src/structs-compare.c -/src/structs-copy.c -/src/structs-free.c -/src/unit-tests /stamp-h1 /sysprep/.depend /sysprep/stamp-script1.sh diff --git a/Makefile.am b/Makefile.am index 5910a09..8267e64 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,7 @@ endif # Basic source for the library. SUBDIRS += common/errnostring common/protocol common/utils -SUBDIRS += src docs examples po +SUBDIRS += lib docs examples po # The daemon and the appliance. if ENABLE_DAEMON diff --git a/align/Makefile.am b/align/Makefile.am index 86975a3..0568efb 100644 --- a/align/Makefile.am +++ b/align/Makefile.am @@ -40,7 +40,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)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/df \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib \ @@ -54,7 +54,7 @@ virt_alignment_scan_CFLAGS = \ virt_alignment_scan_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/builder/Makefile.am b/builder/Makefile.am index 85c754f..d56b394 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -101,7 +101,7 @@ virt_builder_CPPFLAGS = \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/gnulib/lib \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/fish virt_builder_CFLAGS = \ -pthread \ @@ -115,13 +115,13 @@ virt_builder_CFLAGS = \ BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib \ @@ -337,7 +337,7 @@ virt_index_validate_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src + -I$(top_srcdir)/lib virt_index_validate_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ -Wno-unused-macros diff --git a/cat/Makefile.am b/cat/Makefile.am index 66d9356..4ebcdac 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -44,7 +44,7 @@ virt_cat_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -54,7 +54,7 @@ virt_cat_CFLAGS = \ virt_cat_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -69,7 +69,7 @@ virt_filesystems_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -79,7 +79,7 @@ virt_filesystems_CFLAGS = \ virt_filesystems_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -94,7 +94,7 @@ virt_log_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -104,7 +104,7 @@ virt_log_CFLAGS = \ virt_log_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -121,7 +121,7 @@ virt_ls_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -131,7 +131,7 @@ virt_ls_CFLAGS = \ virt_ls_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -146,7 +146,7 @@ virt_tail_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -156,7 +156,7 @@ virt_tail_CFLAGS = \ virt_tail_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/cfg.mk b/cfg.mk index 4cb307a..8ad9b95 100644 --- a/cfg.mk +++ b/cfg.mk @@ -33,7 +33,7 @@ exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^test-data/|\.patch$| exclude_file_name_regexp--sc_prohibit_magic_number_exit = ^(po|po-docs)/|\.pod$|^fuse/guestunmount\.c exclude_file_name_regexp--sc_prohibit_strcmp = ^(examples|po-docs)/|\.pod$ exclude_file_name_regexp--sc_prohibit_strcmp_and_strncmp = ^(examples|po-docs)/|\.pod$ -exclude_file_name_regexp--sc_prohibit_strncpy = ^src/launch-.*\.c$ +exclude_file_name_regexp--sc_prohibit_strncpy = ^lib/launch-.*\.c$ exclude_file_name_regexp--sc_require_config_h = ^examples/|^tests/c-api/test-just-header\.c$ exclude_file_name_regexp--sc_require_config_h_first = ^examples/|^tests/c-api/test-just-header\.c$|^python/guestfs-py-byhand\.c$ diff --git a/common/protocol/Makefile.am b/common/protocol/Makefile.am index 079580c..c426f26 100644 --- a/common/protocol/Makefile.am +++ b/common/protocol/Makefile.am @@ -49,7 +49,7 @@ endif guestfs_protocol.c: guestfs_protocol.x rm -f $@-t $@-t2 $(RPCGEN) $(RPCGEN_DEFS) -c -o $@-t $< - $(SED) 's,\.\./\(\.\./\)*src,.,' < $@-t > $@-t2 + $(SED) 's,\.\./\(\.\./\)*lib,.,' < $@-t > $@-t2 rm $@-t mv $@-t2 $@ diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am index d1ad261..fa1ca94 100644 --- a/common/utils/Makefile.am +++ b/common/utils/Makefile.am @@ -33,7 +33,7 @@ EXTRA_DIST = \ noinst_LTLIBRARIES = libutils.la libutils_la_SOURCES = \ - ../src/guestfs.h \ + ../lib/guestfs.h \ cleanup.c \ guestfs-internal-frontend.h \ guestfs-internal-frontend-cleanups.h \ @@ -46,7 +46,7 @@ libutils_la_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib libutils_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(GCC_VISIBILITY_HIDDEN) \ diff --git a/common/utils/guestfs-internal-frontend.h b/common/utils/guestfs-internal-frontend.h index e2598ca..3b57204 100644 --- a/common/utils/guestfs-internal-frontend.h +++ b/common/utils/guestfs-internal-frontend.h @@ -22,7 +22,7 @@ * * The daemon does B<not> use this header. If you need a place to put * something shared with absolutely everything including the daemon, - * put it in F<src/guestfs-internal-all.h> + * put it in F<lib/guestfs-internal-all.h> * * If a definition is only needed by a single component of libguestfs * (eg. just the library, or just a single virt tool) then it should diff --git a/common/utils/utils.c b/common/utils/utils.c index 252c6f9..bdc8449 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -366,7 +366,7 @@ guestfs_int_is_true (const char *str) /** * Check a string for validity, that it contains only certain * characters, and minimum and maximum length. This function is - * usually wrapped in a VALID_* macro, see F<src/drives.c> for an + * usually wrapped in a VALID_* macro, see F<lib/drives.c> for an * example. * * C<str> is the string to check. diff --git a/configure.ac b/configure.ac index 2cf0fde..c7efbea 100644 --- a/configure.ac +++ b/configure.ac @@ -211,6 +211,8 @@ AC_CONFIG_FILES([Makefile inspector/Makefile java/Makefile java/examples/Makefile + lib/Makefile + lib/libguestfs.pc lua/Makefile lua/examples/Makefile make-fs/Makefile @@ -238,8 +240,6 @@ AC_CONFIG_FILES([Makefile ruby/examples/Makefile ruby/ext/guestfs/extconf.rb sparsify/Makefile - src/Makefile - src/libguestfs.pc sysprep/Makefile test-data/Makefile test-data/binaries/Makefile diff --git a/contrib/README b/contrib/README index 6a7acca..fb359f9 100644 --- a/contrib/README +++ b/contrib/README @@ -21,7 +21,7 @@ make-check-on-installed.pl windows-icons.pl This script lets you extract all the icons from a Windows guest. We use this to locate the Windows logo in new releases - of Windows (see src/inspect-icon.c). + of Windows (see lib/inspect-icon.c). visualize-alignment/ Tests for visualizing block device reads and writes and diff --git a/contrib/windows-icons.pl b/contrib/windows-icons.pl index fc93af0..d04829f 100755 --- a/contrib/windows-icons.pl +++ b/contrib/windows-icons.pl @@ -18,7 +18,7 @@ # This script lets you extract all the icons from a Windows guest. We # use this to locate the Windows logo in new releases of Windows (see -# src/inspect-icon.c). +# lib/inspect-icon.c). # # Use it like this: # ./run ./contrib/windows-icons.pl /path/to/windows-disk.img diff --git a/customize/Makefile.am b/customize/Makefile.am index 0f4ea83..5cc5c05 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -97,7 +97,7 @@ libcustomize_a_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/fish libcustomize_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ @@ -114,13 +114,13 @@ else OBJECTS = $(XOBJECTS) endif -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib \ diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 15e1b7e..3e301ad 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -190,8 +190,8 @@ guestfsd_LDADD = \ guestfsd_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src \ + -I$(top_srcdir)/lib \ + -I$(top_builddir)/lib \ -I$(top_srcdir)/common/errnostring \ -I$(top_builddir)/common/errnostring \ -I$(top_srcdir)/common/protocol \ diff --git a/df/Makefile.am b/df/Makefile.am index cddcbab..d921372 100644 --- a/df/Makefile.am +++ b/df/Makefile.am @@ -42,7 +42,7 @@ virt_df_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -54,7 +54,7 @@ virt_df_CFLAGS = \ virt_df_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/dib/Makefile.am b/dib/Makefile.am index 99912b5..2672321 100644 --- a/dib/Makefile.am +++ b/dib/Makefile.am @@ -48,7 +48,7 @@ virt_dib_CPPFLAGS = \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/gnulib/lib \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src + -I$(top_srcdir)/lib virt_dib_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) @@ -57,13 +57,13 @@ BOBJECTS = \ $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib diff --git a/diff/Makefile.am b/diff/Makefile.am index 33e6b54..5728205 100644 --- a/diff/Makefile.am +++ b/diff/Makefile.am @@ -36,7 +36,7 @@ virt_diff_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/cat -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -46,7 +46,7 @@ virt_diff_CFLAGS = \ virt_diff_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index 0d1ca30..f77cd22 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -248,6 +248,77 @@ java/actions-4.c java/actions-5.c java/actions-6.c java/handle.c +lib/actions-0.c +lib/actions-1.c +lib/actions-2.c +lib/actions-3.c +lib/actions-4.c +lib/actions-5.c +lib/actions-6.c +lib/actions-support.c +lib/actions-variants.c +lib/alloc.c +lib/appliance-cpu.c +lib/appliance-kcmdline.c +lib/appliance-uefi.c +lib/appliance.c +lib/available.c +lib/bindtests.c +lib/canonical-name.c +lib/command.c +lib/conn-socket.c +lib/copy-in-out.c +lib/create.c +lib/dbdump.c +lib/drives.c +lib/errors.c +lib/event-string.c +lib/events.c +lib/file.c +lib/filearch.c +lib/fuse.c +lib/guestfs-internal-actions.h +lib/guestfs-internal-all.h +lib/guestfs-internal.h +lib/guestfs.h +lib/guid.c +lib/handle.c +lib/info.c +lib/inspect-apps.c +lib/inspect-fs-cd.c +lib/inspect-fs-unix.c +lib/inspect-fs-windows.c +lib/inspect-fs.c +lib/inspect-icon.c +lib/inspect.c +lib/journal.c +lib/launch-direct.c +lib/launch-libvirt.c +lib/launch-uml.c +lib/launch-unix.c +lib/launch.c +lib/libvirt-auth.c +lib/libvirt-domain.c +lib/libvirt-is-version.c +lib/listfs.c +lib/lpj.c +lib/match.c +lib/mountable.c +lib/osinfo.c +lib/private-data.c +lib/proto.c +lib/qemu.c +lib/stringsbuf.c +lib/structs-compare.c +lib/structs-copy.c +lib/structs-free.c +lib/tmpdirs.c +lib/tsk.c +lib/umask.c +lib/unit-tests.c +lib/version.c +lib/wait.c +lib/whole-file.c lua/lua-guestfs.c make-fs/make-fs.c mllib/common_utils-c.c @@ -309,77 +380,6 @@ ruby/ext/guestfs/actions.h ruby/ext/guestfs/handle.c ruby/ext/guestfs/module.c sparsify/dummy.c -src/actions-0.c -src/actions-1.c -src/actions-2.c -src/actions-3.c -src/actions-4.c -src/actions-5.c -src/actions-6.c -src/actions-support.c -src/actions-variants.c -src/alloc.c -src/appliance-cpu.c -src/appliance-kcmdline.c -src/appliance-uefi.c -src/appliance.c -src/available.c -src/bindtests.c -src/canonical-name.c -src/command.c -src/conn-socket.c -src/copy-in-out.c -src/create.c -src/dbdump.c -src/drives.c -src/errors.c -src/event-string.c -src/events.c -src/file.c -src/filearch.c -src/fuse.c -src/guestfs-internal-actions.h -src/guestfs-internal-all.h -src/guestfs-internal.h -src/guestfs.h -src/guid.c -src/handle.c -src/info.c -src/inspect-apps.c -src/inspect-fs-cd.c -src/inspect-fs-unix.c -src/inspect-fs-windows.c -src/inspect-fs.c -src/inspect-icon.c -src/inspect.c -src/journal.c -src/launch-direct.c -src/launch-libvirt.c -src/launch-uml.c -src/launch-unix.c -src/launch.c -src/libvirt-auth.c -src/libvirt-domain.c -src/libvirt-is-version.c -src/listfs.c -src/lpj.c -src/match.c -src/mountable.c -src/osinfo.c -src/private-data.c -src/proto.c -src/qemu.c -src/stringsbuf.c -src/structs-compare.c -src/structs-copy.c -src/structs-free.c -src/tmpdirs.c -src/tsk.c -src/umask.c -src/unit-tests.c -src/version.c -src/wait.c -src/whole-file.c sysprep/dummy.c test-tool/test-tool.c utils/boot-analysis/boot-analysis-timeline.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index 6e7c7b6..ffb959f 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -21,7 +21,7 @@ Libguestfs uses an autotools-based build system, with the main files being F<configure.ac> and F<Makefile.am>. See L</THE BUILD SYSTEM>. The F<generator> subdirectory contains the generator, plus files -describing the API. The F<src> subdirectory contains source for the +describing the API. The F<lib> subdirectory contains source for the library. The F<appliance> and F<daemon> subdirectories contain the source for the code that builds the appliance, and the code that runs in the appliance respectively. Other directories are covered in the @@ -31,7 +31,7 @@ Apart from the fact that all API entry points go via some generated code, the library is straightforward. (In fact, even the generated code is designed to be readable, and should be read as ordinary code). Some actions run entirely in the library, and are written as C -functions in files under F<src>. Others are forwarded to the daemon +functions in files under F<lib>. Others are forwarded to the daemon where (after some generated RPC marshalling) they appear as C functions in files under F<daemon>. @@ -40,7 +40,7 @@ To build from source, first read the L<guestfs-building(1)>. =head1 SOURCE CODE SUBDIRECTORIES There are a lot of subdirectories in the source tree! Which ones -should you concentrate on first? F<src> and F<daemon> which contain +should you concentrate on first? F<lib> and F<daemon> which contain the source code of the core library. F<generator> is the code generator described above, so that is important. The F<Makefile.am> in the root directory will tell you in which order the subdirectories @@ -169,6 +169,10 @@ under here. L<virt-inspector(1)>, the virtual machine image inspector. +=item F<lib> + +Source code to the C library. + =item F<logo> Logo used on the website. The fish is called Arthur by the way. @@ -213,10 +217,6 @@ L<virt-resize(1)> command and documentation. L<virt-sparsify(1)> command and documentation. -=item F<src> - -Source code to the C library. - =item F<sysprep> L<virt-sysprep(1)> command and documentation. @@ -348,7 +348,7 @@ For daemon actions, implement the function C<do_E<lt>nameE<gt>> in the C<daemon/> directory. For library actions, implement the function C<guestfs_impl_E<lt>nameE<gt>> -in the C<src/> directory. +in the C<lib/> directory. In either case, use another function as an example of what to do. diff --git a/docs/make-internal-documentation.pl b/docs/make-internal-documentation.pl index 0ab4de9..b440b8b 100755 --- a/docs/make-internal-documentation.pl +++ b/docs/make-internal-documentation.pl @@ -148,7 +148,7 @@ foreach $input (@ARGV) { } } -# Sort the input files into directory sections. Put the 'src' +# Sort the input files into directory sections. Put the 'lib' # directory first, and the rest follow in alphabetical order. my %dirs = (); foreach $input (@inputs) { @@ -157,9 +157,9 @@ foreach $input (@inputs) { push @{$dirs{$1}}, $2 } sub src_first { - if ($a eq "src" && $b eq "src") { return 0 } - elsif ($a eq "src") { return -1 } - elsif ($b eq "src") { return 1 } + if ($a eq "lib" && $b eq "lib") { return 0 } + elsif ($a eq "lib") { return -1 } + elsif ($b eq "lib") { return 1 } else { return $a cmp $b } } my @dirs = sort src_first (keys %dirs); diff --git a/edit/Makefile.am b/edit/Makefile.am index 06f45d8..602bced 100644 --- a/edit/Makefile.am +++ b/edit/Makefile.am @@ -38,7 +38,7 @@ virt_edit_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -48,7 +48,7 @@ virt_edit_CFLAGS = \ virt_edit_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/erlang/Makefile.am b/erlang/Makefile.am index 64f0e44..75b3ec9 100644 --- a/erlang/Makefile.am +++ b/erlang/Makefile.am @@ -81,7 +81,7 @@ erl_guestfs_SOURCES = \ erl_guestfs_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib \ -I$(ERLANG_LIB_DIR_erl_interface)/include @@ -93,7 +93,7 @@ erl_guestfs_LDADD = \ $(ERLANG_LIB_DIR_erl_interface)/lib/libei.a \ -lpthread \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/examples/Makefile.am b/examples/Makefile.am index 1c69f24..17e0e1f 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -44,88 +44,88 @@ if HAVE_LIBVIRT copy_over_SOURCES = copy-over.c copy_over_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib copy_over_CFLAGS = \ $(LIBVIRT_CFLAGS) \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) copy_over_LDADD = \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBVIRT_LIBS) libvirt_auth_SOURCES = libvirt-auth.c libvirt_auth_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib libvirt_auth_CFLAGS = \ $(LIBVIRT_CFLAGS) \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) libvirt_auth_LDADD = \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBVIRT_LIBS) endif create_disk_SOURCES = create-disk.c create_disk_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib create_disk_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) create_disk_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la debug_logging_SOURCES = debug-logging.c debug_logging_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib debug_logging_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) debug_logging_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la display_icon_SOURCES = display-icon.c display_icon_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib display_icon_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) display_icon_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la inspect_vm_SOURCES = inspect-vm.c inspect_vm_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib inspect_vm_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) inspect_vm_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la if HAVE_FUSE mount_local_SOURCES = mount-local.c mount_local_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib mount_local_CFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ $(FUSE_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) mount_local_LDADD = \ $(FUSE_LIBS) \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la endif if HAVE_HIVEX virt_dhcp_address_SOURCES = virt-dhcp-address.c virt_dhcp_address_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib virt_dhcp_address_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) virt_dhcp_address_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la endif man_MANS = guestfs-examples.3 diff --git a/fish/Makefile.am b/fish/Makefile.am index 8460b6d..b0e783c 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -98,7 +98,7 @@ libfishcommon_la_SOURCES = \ libfishcommon_la_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish -I$(top_builddir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib libfishcommon_la_CFLAGS = \ @@ -106,7 +106,7 @@ libfishcommon_la_CFLAGS = \ $(LIBXML2_CFLAGS) libfishcommon_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) @@ -164,7 +164,7 @@ guestfish_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish -I$(top_builddir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -178,7 +178,7 @@ guestfish_LDADD = \ $(LIBREADLINE) \ $(LIBTINFO_LIBS) \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ -lm diff --git a/format/Makefile.am b/format/Makefile.am index 627a38d..85bdb62 100644 --- a/format/Makefile.am +++ b/format/Makefile.am @@ -31,7 +31,7 @@ virt_format_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -42,7 +42,7 @@ virt_format_CFLAGS = \ virt_format_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/fuse/Makefile.am b/fuse/Makefile.am index ca09733..d234215 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -45,7 +45,7 @@ guestmount_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -59,7 +59,7 @@ guestmount_LDADD = \ $(FUSE_LIBS) \ $(LIBCONFIG_LIBS) \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ @@ -76,7 +76,7 @@ guestunmount_SOURCES = \ guestunmount_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -85,7 +85,7 @@ guestunmount_CFLAGS = \ guestunmount_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -147,7 +147,7 @@ test_fuse_SOURCES = \ test_fuse_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib test_fuse_CFLAGS = \ @@ -155,7 +155,7 @@ test_fuse_CFLAGS = \ test_fuse_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(ACL_LIBS) \ @@ -166,7 +166,7 @@ test_guestmount_fd_SOURCES = \ test_guestmount_fd_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib test_guestmount_fd_CFLAGS = \ @@ -174,7 +174,7 @@ test_guestmount_fd_CFLAGS = \ test_guestmount_fd_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -185,7 +185,7 @@ test_guestunmount_fd_SOURCES = \ test_guestunmount_fd_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib test_guestunmount_fd_CFLAGS = \ @@ -193,7 +193,7 @@ test_guestunmount_fd_CFLAGS = \ test_guestunmount_fd_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/generator/actions.ml b/generator/actions.ml index 59afa2e..e8b0ba5 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -13658,9 +13658,9 @@ let () | { proc_nr = None } -> () ) non_daemon_functions -(* This is used to generate the src/MAX_PROC_NR file which +(* This is used to generate the lib/MAX_PROC_NR file which * contains the maximum procedure number, a surrogate for the - * ABI version number. See src/Makefile.am for the details. + * ABI version number. See lib/Makefile.am for the details. *) let max_proc_nr let proc_nrs = List.map ( diff --git a/generator/actions.mli b/generator/actions.mli index a812789..c943cb9 100644 --- a/generator/actions.mli +++ b/generator/actions.mli @@ -57,5 +57,5 @@ val fish_commands : Types.action list (** Non-API meta-commands available only in guestfish. *) val max_proc_nr : int -(** The largest procedure number used (also saved in [src/MAX_PROC_NR] and +(** The largest procedure number used (also saved in [lib/MAX_PROC_NR] and used as the minor version number of the shared library). *) diff --git a/generator/main.ml b/generator/main.ml index b1007f6..806735f 100644 --- a/generator/main.ml +++ b/generator/main.ml @@ -106,21 +106,21 @@ Run it from the top source directory using the command output_to "common/utils/structs-print.h" generate_client_structs_print_h; output_to "common/utils/uefi.c" generate_uefi_c; - output_to "src/guestfs.h" generate_guestfs_h; - output_to "src/guestfs-internal-actions.h" generate_internal_actions_h; - output_to "src/bindtests.c" generate_bindtests; - output_to "src/guestfs-structs.pod" generate_structs_pod; - output_to "src/guestfs-actions.pod" generate_actions_pod; - output_to "src/guestfs-availability.pod" generate_availability_pod; - output_to "src/event-string.c" generate_event_string_c; - output_to "src/MAX_PROC_NR" generate_max_proc_nr; - output_to "src/libguestfs.syms" generate_linker_script; - - output_to "src/structs-compare.c" generate_client_structs_compare; - output_to "src/structs-copy.c" generate_client_structs_copy; - output_to "src/structs-free.c" generate_client_structs_free; - output_to "src/actions-variants.c" generate_client_actions_variants; - output_to_subset "src/actions-%d.c" generate_client_actions; + output_to "lib/guestfs.h" generate_guestfs_h; + output_to "lib/guestfs-internal-actions.h" generate_internal_actions_h; + output_to "lib/bindtests.c" generate_bindtests; + output_to "lib/guestfs-structs.pod" generate_structs_pod; + output_to "lib/guestfs-actions.pod" generate_actions_pod; + output_to "lib/guestfs-availability.pod" generate_availability_pod; + output_to "lib/event-string.c" generate_event_string_c; + output_to "lib/MAX_PROC_NR" generate_max_proc_nr; + output_to "lib/libguestfs.syms" generate_linker_script; + + output_to "lib/structs-compare.c" generate_client_structs_compare; + output_to "lib/structs-copy.c" generate_client_structs_copy; + output_to "lib/structs-free.c" generate_client_structs_free; + output_to "lib/actions-variants.c" generate_client_actions_variants; + output_to_subset "lib/actions-%d.c" generate_client_actions; output_to "daemon/actions.h" generate_daemon_actions_h; output_to "daemon/stubs.h" generate_daemon_stubs_h; output_to_subset "daemon/stubs-%d.c" generate_daemon_stubs; diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am index d2f6d6d..bda3a8d 100644 --- a/get-kernel/Makefile.am +++ b/get-kernel/Makefile.am @@ -44,7 +44,7 @@ virt_get_kernel_CPPFLAGS = \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/gnulib/lib \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/fish virt_get_kernel_CFLAGS = \ -pthread \ @@ -54,13 +54,13 @@ virt_get_kernel_CFLAGS = \ BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib diff --git a/gobject/Makefile.am b/gobject/Makefile.am index c47d65a..1c7750c 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -52,11 +52,11 @@ libguestfs_gobject_1_0_ladir = $(includedir)/guestfs-gobject libguestfs_gobject_1_0_la_HEADERS = $(guestfs_gobject_headers) libguestfs_gobject_1_0_la_SOURCES = $(guestfs_gobject_sources) -libguestfs_gobject_1_0_la_CFLAGS = -I$(top_srcdir)/src -I$(srcdir)/include \ +libguestfs_gobject_1_0_la_CFLAGS = -I$(top_srcdir)/lib -I$(srcdir)/include \ -DGUESTFS_PRIVATE=1 \ $(GOBJECT_CFLAGS) -libguestfs_gobject_1_0_la_LDFLAGS = $(LDFLAGS) -L$(top_builddir)/src -libguestfs_gobject_1_0_la_LIBADD = $(top_builddir)/src/libguestfs.la $(GOBJECT_LIBS) $(GIO_LIBS) +libguestfs_gobject_1_0_la_LDFLAGS = $(LDFLAGS) -L$(top_builddir)/lib +libguestfs_gobject_1_0_la_LIBADD = $(top_builddir)/lib/libguestfs.la $(GOBJECT_LIBS) $(GIO_LIBS) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libguestfs-gobject-1.0.pc @@ -81,7 +81,7 @@ introspection_sources = \ Guestfs-1.0.gir: $(libname) Guestfs_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 Guestfs_1_0_gir_CFLAGS = $(INCLUDES) -I$(srcdir)/include -Guestfs_1_0_gir_LIBS = $(libname) $(top_builddir)/src/libguestfs.la +Guestfs_1_0_gir_LIBS = $(libname) $(top_builddir)/lib/libguestfs.la Guestfs_1_0_gir_FILES = $(patsubst %,$(srcdir)/%,$(introspection_sources)) INTROSPECTION_GIRS += Guestfs-1.0.gir diff --git a/haskell/Makefile.am b/haskell/Makefile.am index b09b06b..a0b7e25 100644 --- a/haskell/Makefile.am +++ b/haskell/Makefile.am @@ -39,10 +39,10 @@ endif ENABLE_APPLIANCE #check_DATA = Bindtests -GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs -i$(srcdir) +GHCFLAGS = -I$(top_builddir)/lib -L$(top_builddir)/lib/.libs -i$(srcdir) all_targets = Guestfs010Load Guestfs030Config Guestfs050LVCreate -$(all_targets): $(top_builddir)/src/libguestfs.la +$(all_targets): $(top_builddir)/lib/libguestfs.la all: $(all_targets) diff --git a/inspector/Makefile.am b/inspector/Makefile.am index 1456966..358a3f9 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -59,7 +59,7 @@ virt_inspector_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -69,7 +69,7 @@ virt_inspector_CFLAGS = \ virt_inspector_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/installcheck.sh.in b/installcheck.sh.in index e239b12..6b05ab8 100644 --- a/installcheck.sh.in +++ b/installcheck.sh.in @@ -35,10 +35,10 @@ exec_prefix=@exec_prefix@ find -name 'lt-*' | grep '/.libs/lt-' | xargs -r rm # Copy the installed library into libtool directory. -rm -f src/.libs/libguestfs.so* -cp @libdir@/libguestfs.so src/.libs/ -cp @libdir@/libguestfs.so.0 src/.libs/ -cp @libdir@/libguestfs.so.0.* src/.libs/ +rm -f lib/.libs/libguestfs.so* +cp @libdir@/libguestfs.so lib/.libs/ +cp @libdir@/libguestfs.so.0 lib/.libs/ +cp @libdir@/libguestfs.so.0.* lib/.libs/ # Copy installed binaries into the right places. cp @bindir@/libguestfs-test-tool test-tool/ @@ -100,7 +100,7 @@ compare () { exit 1 fi } -compare @libdir@/libguestfs.so src/.libs/libguestfs.so +compare @libdir@/libguestfs.so lib/.libs/libguestfs.so compare @bindir@/guestfish fish/guestfish compare @bindir@/guestmount fuse/guestmount compare @bindir@/virt-df df/virt-df diff --git a/java/Makefile.am b/java/Makefile.am index b165f5a..06d0fc7 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -109,13 +109,13 @@ libguestfs_jni_la_SOURCES = \ libguestfs_jni_la_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib libguestfs_jni_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(JNI_CFLAGS) -libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la +libguestfs_jni_la_LIBADD = $(top_builddir)/lib/libguestfs.la libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO) -shared diff --git a/src/MAX_PROC_NR b/lib/MAX_PROC_NR similarity index 100% rename from src/MAX_PROC_NR rename to lib/MAX_PROC_NR diff --git a/src/Makefile.am b/lib/Makefile.am similarity index 99% rename from src/Makefile.am rename to lib/Makefile.am index 0f6a258..86dab24 100644 --- a/src/Makefile.am +++ b/lib/Makefile.am @@ -212,7 +212,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)/src -I. + -I$(top_srcdir)/lib -I. unit_tests_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) # We have to link this to libguestfs, but because we want to test diff --git a/src/actions-support.c b/lib/actions-support.c similarity index 97% rename from src/actions-support.c rename to lib/actions-support.c index 1312f99..1ace45f 100644 --- a/src/actions-support.c +++ b/lib/actions-support.c @@ -17,7 +17,7 @@ */ /** - * Helper functions for the actions code in F<src/actions-*.c>. + * Helper functions for the actions code in F<lib/actions-*.c>. */ #include <config.h> diff --git a/src/alloc.c b/lib/alloc.c similarity index 100% rename from src/alloc.c rename to lib/alloc.c diff --git a/src/appliance-cpu.c b/lib/appliance-cpu.c similarity index 100% rename from src/appliance-cpu.c rename to lib/appliance-cpu.c diff --git a/src/appliance-kcmdline.c b/lib/appliance-kcmdline.c similarity index 100% rename from src/appliance-kcmdline.c rename to lib/appliance-kcmdline.c diff --git a/src/appliance-uefi.c b/lib/appliance-uefi.c similarity index 100% rename from src/appliance-uefi.c rename to lib/appliance-uefi.c diff --git a/src/appliance.c b/lib/appliance.c similarity index 100% rename from src/appliance.c rename to lib/appliance.c diff --git a/src/available.c b/lib/available.c similarity index 100% rename from src/available.c rename to lib/available.c diff --git a/src/canonical-name.c b/lib/canonical-name.c similarity index 100% rename from src/canonical-name.c rename to lib/canonical-name.c diff --git a/src/command.c b/lib/command.c similarity index 100% rename from src/command.c rename to lib/command.c diff --git a/src/conn-socket.c b/lib/conn-socket.c similarity index 100% rename from src/conn-socket.c rename to lib/conn-socket.c diff --git a/src/copy-in-out.c b/lib/copy-in-out.c similarity index 100% rename from src/copy-in-out.c rename to lib/copy-in-out.c diff --git a/src/create.c b/lib/create.c similarity index 100% rename from src/create.c rename to lib/create.c diff --git a/src/dbdump.c b/lib/dbdump.c similarity index 100% rename from src/dbdump.c rename to lib/dbdump.c diff --git a/src/drives.c b/lib/drives.c similarity index 100% rename from src/drives.c rename to lib/drives.c diff --git a/src/errors.c b/lib/errors.c similarity index 100% rename from src/errors.c rename to lib/errors.c diff --git a/src/events.c b/lib/events.c similarity index 100% rename from src/events.c rename to lib/events.c diff --git a/src/file.c b/lib/file.c similarity index 100% rename from src/file.c rename to lib/file.c diff --git a/src/filearch.c b/lib/filearch.c similarity index 100% rename from src/filearch.c rename to lib/filearch.c diff --git a/src/fuse.c b/lib/fuse.c similarity index 100% rename from src/fuse.c rename to lib/fuse.c diff --git a/src/guestfs-internal-all.h b/lib/guestfs-internal-all.h similarity index 97% rename from src/guestfs-internal-all.h rename to lib/guestfs-internal-all.h index bae42c2..dbf9735 100644 --- a/src/guestfs-internal-all.h +++ b/lib/guestfs-internal-all.h @@ -22,9 +22,9 @@ * tools (ie. I<all> C code). * * If you need a definition used by only the library, put it in - * F<src/guestfs-internal.h> instead. If you need a definition used + * F<lib/guestfs-internal.h> instead. If you need a definition used * by only the frontend (non-daemon) parts of libguestfs, try - * F<src/guestfs-internal-frontend.h>. If a definition is used by + * F<lib/guestfs-internal-frontend.h>. If a definition is used by * only a single tool, it should not be in any shared header file at * all. */ diff --git a/src/guestfs-internal.h b/lib/guestfs-internal.h similarity index 99% rename from src/guestfs-internal.h rename to lib/guestfs-internal.h index 24a248e..04d087b 100644 --- a/src/guestfs-internal.h +++ b/lib/guestfs-internal.h @@ -17,11 +17,11 @@ */ /** - * This header file is included in the libguestfs library (F<src/>) + * This header file is included in the libguestfs library (F<lib/>) * only. * - * See also F<src/guestfs-internal-frontend.h> and - * F<src/guestfs-internal-all.h> + * See also F<lib/guestfs-internal-frontend.h> and + * F<lib/guestfs-internal-all.h> */ #ifndef GUESTFS_INTERNAL_H_ @@ -387,7 +387,7 @@ struct error_cb_stack { /** * Cache of queried features. * - * Used to cache the appliance features (see F<src/available.c>). + * Used to cache the appliance features (see F<lib/available.c>). */ struct cached_feature { char *group; @@ -524,7 +524,7 @@ struct guestfs_h { #endif #ifdef HAVE_LIBVIRT_BACKEND - /* Used by src/libvirt-auth.c. */ + /* Used by lib/libvirt-auth.c. */ #define NR_CREDENTIAL_TYPES 9 unsigned int nr_supported_credentials; int supported_credentials[NR_CREDENTIAL_TYPES]; @@ -541,7 +541,7 @@ struct guestfs_h { /** * Used for storing major.minor.micro version numbers. - * See F<src/version.c> for more information. + * See F<lib/version.c> for more information. */ struct version { int v_major; diff --git a/src/guestfs.pod b/lib/guestfs.pod similarity index 100% rename from src/guestfs.pod rename to lib/guestfs.pod diff --git a/src/guid.c b/lib/guid.c similarity index 100% rename from src/guid.c rename to lib/guid.c diff --git a/src/handle.c b/lib/handle.c similarity index 100% rename from src/handle.c rename to lib/handle.c diff --git a/src/info.c b/lib/info.c similarity index 100% rename from src/info.c rename to lib/info.c diff --git a/src/inspect-apps.c b/lib/inspect-apps.c similarity index 100% rename from src/inspect-apps.c rename to lib/inspect-apps.c diff --git a/src/inspect-fs-cd.c b/lib/inspect-fs-cd.c similarity index 100% rename from src/inspect-fs-cd.c rename to lib/inspect-fs-cd.c diff --git a/src/inspect-fs-unix.c b/lib/inspect-fs-unix.c similarity index 100% rename from src/inspect-fs-unix.c rename to lib/inspect-fs-unix.c diff --git a/src/inspect-fs-windows.c b/lib/inspect-fs-windows.c similarity index 100% rename from src/inspect-fs-windows.c rename to lib/inspect-fs-windows.c diff --git a/src/inspect-fs.c b/lib/inspect-fs.c similarity index 100% rename from src/inspect-fs.c rename to lib/inspect-fs.c diff --git a/src/inspect-icon.c b/lib/inspect-icon.c similarity index 100% rename from src/inspect-icon.c rename to lib/inspect-icon.c diff --git a/src/inspect.c b/lib/inspect.c similarity index 99% rename from src/inspect.c rename to lib/inspect.c index f6d0840..da80e47 100644 --- a/src/inspect.c +++ b/lib/inspect.c @@ -17,7 +17,7 @@ */ /** - * This file, and the other C<src/inspect*.c> files, handle + * This file, and the other C<lib/inspect*.c> files, handle * inspection. See L<guestfs(3)/INSPECTION>. */ diff --git a/src/journal.c b/lib/journal.c similarity index 100% rename from src/journal.c rename to lib/journal.c diff --git a/src/launch-direct.c b/lib/launch-direct.c similarity index 100% rename from src/launch-direct.c rename to lib/launch-direct.c diff --git a/src/launch-libvirt.c b/lib/launch-libvirt.c similarity index 100% rename from src/launch-libvirt.c rename to lib/launch-libvirt.c diff --git a/src/launch-uml.c b/lib/launch-uml.c similarity index 100% rename from src/launch-uml.c rename to lib/launch-uml.c diff --git a/src/launch-unix.c b/lib/launch-unix.c similarity index 100% rename from src/launch-unix.c rename to lib/launch-unix.c diff --git a/src/launch.c b/lib/launch.c similarity index 98% rename from src/launch.c rename to lib/launch.c index 17c4cee..f0ac4be 100644 --- a/src/launch.c +++ b/lib/launch.c @@ -21,7 +21,7 @@ * * Most of the work is done by the backends (see * L<guestfs(3)/BACKEND>), which are implemented in - * F<src/launch-direct.c>, F<src/launch-libvirt.c> etc, so this file + * F<lib/launch-direct.c>, F<lib/launch-libvirt.c> etc, so this file * mostly passes calls through to the current backend. */ @@ -129,7 +129,7 @@ guestfs_impl_launch (guestfs_h *g) * * =item 3. * - * There is a hack in F<src/proto.c> to make this work. + * There is a hack in F<lib/proto.c> to make this work. * * =back */ diff --git a/src/libguestfs.pc.in b/lib/libguestfs.pc.in similarity index 100% rename from src/libguestfs.pc.in rename to lib/libguestfs.pc.in diff --git a/src/libvirt-auth.c b/lib/libvirt-auth.c similarity index 100% rename from src/libvirt-auth.c rename to lib/libvirt-auth.c diff --git a/src/libvirt-domain.c b/lib/libvirt-domain.c similarity index 100% rename from src/libvirt-domain.c rename to lib/libvirt-domain.c diff --git a/src/libvirt-is-version.c b/lib/libvirt-is-version.c similarity index 100% rename from src/libvirt-is-version.c rename to lib/libvirt-is-version.c diff --git a/src/listfs.c b/lib/listfs.c similarity index 100% rename from src/listfs.c rename to lib/listfs.c diff --git a/src/lpj.c b/lib/lpj.c similarity index 100% rename from src/lpj.c rename to lib/lpj.c diff --git a/src/match.c b/lib/match.c similarity index 100% rename from src/match.c rename to lib/match.c diff --git a/src/mountable.c b/lib/mountable.c similarity index 100% rename from src/mountable.c rename to lib/mountable.c diff --git a/src/osinfo.c b/lib/osinfo.c similarity index 100% rename from src/osinfo.c rename to lib/osinfo.c diff --git a/src/private-data.c b/lib/private-data.c similarity index 100% rename from src/private-data.c rename to lib/private-data.c diff --git a/src/proto.c b/lib/proto.c similarity index 99% rename from src/proto.c rename to lib/proto.c index 99a4f4c..83491da 100644 --- a/src/proto.c +++ b/lib/proto.c @@ -19,7 +19,7 @@ /** * This is the code used to send and receive RPC messages and (for * certain types of message) to perform file transfers. This code is - * driven from the generated actions (F<src/actions-*.c>). There + * driven from the generated actions (F<lib/actions-*.c>). There * are five different cases to consider: * * =over 4 diff --git a/src/qemu.c b/lib/qemu.c similarity index 100% rename from src/qemu.c rename to lib/qemu.c diff --git a/src/stringsbuf.c b/lib/stringsbuf.c similarity index 100% rename from src/stringsbuf.c rename to lib/stringsbuf.c diff --git a/src/tmpdirs.c b/lib/tmpdirs.c similarity index 100% rename from src/tmpdirs.c rename to lib/tmpdirs.c diff --git a/src/tsk.c b/lib/tsk.c similarity index 100% rename from src/tsk.c rename to lib/tsk.c diff --git a/src/umask.c b/lib/umask.c similarity index 100% rename from src/umask.c rename to lib/umask.c diff --git a/src/unit-tests.c b/lib/unit-tests.c similarity index 99% rename from src/unit-tests.c rename to lib/unit-tests.c index 517262e..d44bc41 100644 --- a/src/unit-tests.c +++ b/lib/unit-tests.c @@ -433,7 +433,7 @@ test_stringsbuf (void) guestfs_close (g); } -/* Use the same macros as in src/drives.c */ +/* Use the same macros as in lib/drives.c */ #define VALID_FORMAT_IFACE(str) \ guestfs_int_string_is_valid ((str), 1, 0, \ VALID_FLAG_ALPHA|VALID_FLAG_DIGIT, "-_") diff --git a/src/version.c b/lib/version.c similarity index 100% rename from src/version.c rename to lib/version.c diff --git a/src/wait.c b/lib/wait.c similarity index 100% rename from src/wait.c rename to lib/wait.c diff --git a/src/whole-file.c b/lib/whole-file.c similarity index 100% rename from src/whole-file.c rename to lib/whole-file.c diff --git a/lua/Makefile.am b/lua/Makefile.am index 30ec4fb..f90c1d7 100644 --- a/lua/Makefile.am +++ b/lua/Makefile.am @@ -42,7 +42,7 @@ libluaguestfs_la_SOURCES = lua-guestfs.c libluaguestfs_la_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib libluaguestfs_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ @@ -50,7 +50,7 @@ libluaguestfs_la_CFLAGS = \ libluaguestfs_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ ../gnulib/lib/libgnu.la diff --git a/m4/guestfs_libraries.m4 b/m4/guestfs_libraries.m4 index bff9df3..ac71b39 100644 --- a/m4/guestfs_libraries.m4 +++ b/m4/guestfs_libraries.m4 @@ -282,5 +282,5 @@ AC_DEFINE_UNQUOTED([PATH_SEPARATOR],["$PATH_SEPARATOR"], [Character that separates path elements in search paths]) dnl Library versioning. -MAX_PROC_NR=`cat $srcdir/src/MAX_PROC_NR` +MAX_PROC_NR=`cat $srcdir/lib/MAX_PROC_NR` AC_SUBST(MAX_PROC_NR) diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am index fde3dea..8d8971a 100644 --- a/make-fs/Makefile.am +++ b/make-fs/Makefile.am @@ -31,7 +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)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -41,7 +41,7 @@ virt_make_fs_CFLAGS = \ virt_make_fs_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ diff --git a/mllib/Makefile.am b/mllib/Makefile.am index 40f2212..87c3032 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -111,7 +111,7 @@ libmllib_a_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/cat \ -I$(top_srcdir)/fish libmllib_a_CFLAGS = \ @@ -122,13 +122,13 @@ libmllib_a_CFLAGS = \ BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(builddir) @@ -177,7 +177,7 @@ common_utils_tests_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ - -I$(top_srcdir)/src + -I$(top_srcdir)/lib common_utils_tests_BOBJECTS = common_utils_tests.cmo common_utils_tests_XOBJECTS = $(common_utils_tests_BOBJECTS:.cmo=.cmx) @@ -186,7 +186,7 @@ getopt_tests_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ - -I$(top_srcdir)/src + -I$(top_srcdir)/lib getopt_tests_BOBJECTS = getopt_tests.cmo getopt_tests_XOBJECTS = $(getopt_tests_BOBJECTS:.cmo=.cmx) diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index 8377a83..57ecd60 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -69,13 +69,13 @@ stamp-mlguestfs: libguestfsocaml.a $(guestfs_cmm) $(libguestfsocaml_a_OBJECTS) guestfs.cmo \ $(LDFLAGS) \ $(LTLIBINTL) \ - -L../src/.libs -lguestfs + -L../lib/.libs -lguestfs if HAVE_OCAMLOPT $(OCAMLMKLIB) -o mlguestfs \ $(libguestfsocaml_a_OBJECTS) guestfs.cmx \ $(LDFLAGS) \ $(LTLIBINTL) \ - -L../src/.libs -lguestfs + -L../lib/.libs -lguestfs endif touch $@ @@ -83,7 +83,7 @@ libguestfsocaml_a_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/gnulib/lib -I../gnulib/lib libguestfsocaml_a_CFLAGS = \ @@ -159,12 +159,12 @@ check_DATA += bindtests.opt endif %.bc: %.cmo mlguestfs.cma - $(guestfs_am_v_ocamlc)$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \ + $(guestfs_am_v_ocamlc)$(top_builddir)/libtool -dlopen $(top_builddir)/lib/.libs/libguestfs.la --mode=execute \ $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@ if HAVE_OCAMLOPT %.opt: %.cmx mlguestfs.cmxa - $(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@ + $(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/lib/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@ endif check-valgrind: diff --git a/ocaml/examples/Makefile.am b/ocaml/examples/Makefile.am index 35f410b..14e534b 100644 --- a/ocaml/examples/Makefile.am +++ b/ocaml/examples/Makefile.am @@ -48,7 +48,7 @@ if HAVE_OCAML noinst_SCRIPTS = create_disk debug_logging inspect_vm -OCAMLFINDFLAGS = -cclib -L$(top_builddir)/src/.libs +OCAMLFINDFLAGS = -cclib -L$(top_builddir)/lib/.libs if HAVE_OCAMLOPT create_disk: create_disk.ml diff --git a/p2v/Makefile.am b/p2v/Makefile.am index 1cefd62..86d905e 100644 --- a/p2v/Makefile.am +++ b/p2v/Makefile.am @@ -93,7 +93,7 @@ virt_p2v_SOURCES = \ virt_p2v_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_p2v_CFLAGS = \ @@ -302,7 +302,7 @@ test-virt-p2v-pxe.sshd_config: test-virt-p2v-pxe.sshd_config.in test-virt-p2v-pxe.authorized_keys: test-virt-p2v-pxe.id_rsa.pub $(top_builddir)/run rm -f $@ $@-t - $(top_builddir)/run sh -c 'echo -n environment=\"PATH=$$PATH\",environment=\"LD_LIBRARY_PATH=$(abs_top_builddir)/src/.libs\"\ ' > $@-t + $(top_builddir)/run sh -c 'echo -n environment=\"PATH=$$PATH\",environment=\"LD_LIBRARY_PATH=$(abs_top_builddir)/lib/.libs\"\ ' > $@-t cat $< >> $@-t mv $@-t $@ diff --git a/p2v/conversion.c b/p2v/conversion.c index b8bab34..b25f272 100644 --- a/p2v/conversion.c +++ b/p2v/conversion.c @@ -704,7 +704,7 @@ cleanup_data_conns (struct data_conn *data_conns, size_t nr) } } -/* Macros "inspired" by src/launch-libvirt.c */ +/* Macros "inspired" by lib/launch-libvirt.c */ /* <element */ #define start_element(element) \ if (xmlTextWriterStartElement (xo, BAD_CAST (element)) == -1) \ diff --git a/perl/Build.PL.in b/perl/Build.PL.in index 01f67a1..451030a 100755 --- a/perl/Build.PL.in +++ b/perl/Build.PL.in @@ -60,11 +60,11 @@ my $build = Module::Build->new ( split (' ', '@CFLAGS@'), ], include_dirs => [ - '@top_builddir@/src', - '@top_srcdir@/src', + '@top_builddir@/lib', + '@top_srcdir@/lib', ], extra_linker_flags => [ - '-L@top_builddir@/src/.libs', + '-L@top_builddir@/lib/.libs', '-lguestfs', ], ); diff --git a/php/Makefile.am b/php/Makefile.am index 4dda499..a974cdf 100644 --- a/php/Makefile.am +++ b/php/Makefile.am @@ -38,8 +38,8 @@ php_DATA = guestfs_php.ini # and we need to add the library to EXTRA_LDFLAGS. all: check-builddir-equals-srcdir extension/config.h $(MAKE) -C extension \ - EXTRA_INCLUDES="-I$(abs_srcdir)/../common/utils -I$(abs_srcdir)/../src" \ - EXTRA_LDFLAGS="-L$(abs_srcdir)/../src/.libs -lguestfs" \ + EXTRA_INCLUDES="-I$(abs_srcdir)/../common/utils -I$(abs_srcdir)/../lib" \ + EXTRA_LDFLAGS="-L$(abs_srcdir)/../lib/.libs -lguestfs" \ EXTRA_CFLAGS="-DGUESTFS_PRIVATE=1" \ all diff --git a/po/POTFILES b/po/POTFILES index 05e3631..25ddf01 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -1,7 +1,5 @@ align/scan.c -builder/index-parse.c builder/index-parser-c.c -builder/index-scan.c builder/index-struct.c builder/index-validate.c builder/pxzcat-c.c @@ -158,7 +156,6 @@ erlang/dispatch.c erlang/main.c erlang/structs.c fish/alloc.c -fish/cmds-gperf.c fish/cmds.c fish/completion.c fish/config.c @@ -318,6 +315,73 @@ java/actions-4.c java/actions-5.c java/actions-6.c java/handle.c +lib/actions-0.c +lib/actions-1.c +lib/actions-2.c +lib/actions-3.c +lib/actions-4.c +lib/actions-5.c +lib/actions-6.c +lib/actions-support.c +lib/actions-variants.c +lib/alloc.c +lib/appliance-cpu.c +lib/appliance-kcmdline.c +lib/appliance-uefi.c +lib/appliance.c +lib/available.c +lib/bindtests.c +lib/canonical-name.c +lib/command.c +lib/conn-socket.c +lib/copy-in-out.c +lib/create.c +lib/dbdump.c +lib/drives.c +lib/errors.c +lib/event-string.c +lib/events.c +lib/file.c +lib/filearch.c +lib/fuse.c +lib/guid.c +lib/handle.c +lib/info.c +lib/inspect-apps.c +lib/inspect-fs-cd.c +lib/inspect-fs-unix.c +lib/inspect-fs-windows.c +lib/inspect-fs.c +lib/inspect-icon.c +lib/inspect.c +lib/journal.c +lib/launch-direct.c +lib/launch-libvirt.c +lib/launch-uml.c +lib/launch-unix.c +lib/launch.c +lib/libvirt-auth.c +lib/libvirt-domain.c +lib/libvirt-is-version.c +lib/listfs.c +lib/lpj.c +lib/match.c +lib/mountable.c +lib/osinfo.c +lib/private-data.c +lib/proto.c +lib/qemu.c +lib/stringsbuf.c +lib/structs-compare.c +lib/structs-copy.c +lib/structs-free.c +lib/tmpdirs.c +lib/tsk.c +lib/umask.c +lib/unit-tests.c +lib/version.c +lib/wait.c +lib/whole-file.c lua/lua-guestfs.c make-fs/make-fs.c mllib/common_utils-c.c @@ -349,7 +413,6 @@ p2v/ssh.c p2v/utils.c p2v/whole-file.c perl/bindtests.pl -perl/lib/Sys/Guestfs.c perl/lib/Sys/Guestfs.pm php/extension/guestfs_php.c python/actions-0.c @@ -376,73 +439,6 @@ ruby/ext/guestfs/actions-6.c ruby/ext/guestfs/handle.c ruby/ext/guestfs/module.c sparsify/dummy.c -src/actions-0.c -src/actions-1.c -src/actions-2.c -src/actions-3.c -src/actions-4.c -src/actions-5.c -src/actions-6.c -src/actions-support.c -src/actions-variants.c -src/alloc.c -src/appliance-cpu.c -src/appliance-kcmdline.c -src/appliance-uefi.c -src/appliance.c -src/available.c -src/bindtests.c -src/canonical-name.c -src/command.c -src/conn-socket.c -src/copy-in-out.c -src/create.c -src/dbdump.c -src/drives.c -src/errors.c -src/event-string.c -src/events.c -src/file.c -src/filearch.c -src/fuse.c -src/guid.c -src/handle.c -src/info.c -src/inspect-apps.c -src/inspect-fs-cd.c -src/inspect-fs-unix.c -src/inspect-fs-windows.c -src/inspect-fs.c -src/inspect-icon.c -src/inspect.c -src/journal.c -src/launch-direct.c -src/launch-libvirt.c -src/launch-uml.c -src/launch-unix.c -src/launch.c -src/libvirt-auth.c -src/libvirt-domain.c -src/libvirt-is-version.c -src/listfs.c -src/lpj.c -src/match.c -src/mountable.c -src/osinfo.c -src/private-data.c -src/proto.c -src/qemu.c -src/stringsbuf.c -src/structs-compare.c -src/structs-copy.c -src/structs-free.c -src/tmpdirs.c -src/tsk.c -src/umask.c -src/unit-tests.c -src/version.c -src/wait.c -src/whole-file.c sysprep/dummy.c test-tool/test-tool.c utils/boot-analysis/boot-analysis-timeline.c diff --git a/python/Makefile.am b/python/Makefile.am index ec99570..ae90aa0 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -68,14 +68,14 @@ libguestfsmod_la_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ $(PYTHON_CFLAGS) \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib libguestfsmod_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) libguestfsmod_la_LIBADD = \ $(top_builddir)/common/utils/libutils_la-utils.lo \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la libguestfsmod_la_LDFLAGS = -avoid-version -shared -module -shrext $(PYTHON_EXT_SUFFIX) @@ -115,7 +115,7 @@ ignore-value.h: ln $(top_srcdir)/gnulib/lib/ignore-value.h $@ guestfs-internal-all.h: - ln $(top_srcdir)/src/guestfs-internal-all.h $@ + ln $(top_srcdir)/lib/guestfs-internal-all.h $@ guestfs-internal-frontend-cleanups.h: ln $(top_srcdir)/common/utils/guestfs-internal-frontend-cleanups.h $@ diff --git a/python/setup.py.in b/python/setup.py.in index 6561426..e3d7973 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -64,7 +64,7 @@ This package contains the Python bindings for libguestfs. 'structs.c', 'utils.c'], - include_dirs=['.', '../src'], + include_dirs=['.', '../lib'], libraries=['guestfs'], define_macros=[('GUESTFS_PRIVATE', '1')], ) diff --git a/rescue/Makefile.am b/rescue/Makefile.am index 4159944..92ebc4a 100644 --- a/rescue/Makefile.am +++ b/rescue/Makefile.am @@ -47,7 +47,7 @@ virt_rescue_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -59,7 +59,7 @@ virt_rescue_CFLAGS = \ virt_rescue_LDADD = \ $(LIBCONFIG_LIBS) \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/resize/Makefile.am b/resize/Makefile.am index a767c83..e097dd6 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -42,7 +42,7 @@ virt_resize_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/fish virt_resize_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ @@ -51,13 +51,13 @@ virt_resize_CFLAGS = \ BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in index 1d6cb87..18ec311 100644 --- a/ruby/Rakefile.in +++ b/ruby/Rakefile.in @@ -65,7 +65,7 @@ CLOBBER.include [ "@builddir@/config.save", "@builddir@/ext/**/mkmf.log", # Build locally file MAKEFILE => EXT_CONF do |t| - unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/guestfs; cd @builddir@/ext/guestfs; @RUBY@ #{EXT_CONF} --with-_guestfs-include=$top_srcdir/common/utils:$top_srcdir/src:$top_builddir --with-_guestfs-lib=$top_builddir/src/.libs" + unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/guestfs; cd @builddir@/ext/guestfs; @RUBY@ #{EXT_CONF} --with-_guestfs-include=$top_srcdir/common/utils:$top_srcdir/lib:$top_builddir --with-_guestfs-lib=$top_builddir/lib/.libs" $stderr.puts "Failed to run extconf" break end diff --git a/run.in b/run.in index 4cad130..0e2e6af 100755 --- a/run.in +++ b/run.in @@ -111,10 +111,10 @@ export PATH # Set LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to contain library. prepend LD_LIBRARY_PATH "$b/gobject/.libs" prepend LD_LIBRARY_PATH "$b/java/.libs" -prepend LD_LIBRARY_PATH "$b/src/.libs" +prepend LD_LIBRARY_PATH "$b/lib/.libs" prepend DYLD_LIBRARY_PATH "$b/gobject/.libs" prepend DYLD_LIBRARY_PATH "$b/java/.libs" -prepend DYLD_LIBRARY_PATH "$b/src/.libs" +prepend DYLD_LIBRARY_PATH "$b/lib/.libs" export LD_LIBRARY_PATH export DYLD_LIBRARY_PATH @@ -189,15 +189,15 @@ export GOLANG="@GOLANG@" prepend GOPATH "$b/golang" export GOPATH if [ -z "$CGO_CFLAGS" ]; then - CGO_CFLAGS="-I$s/src" + CGO_CFLAGS="-I$s/lib" else - CGO_CFLAGS="$CGO_CFLAGS -I$s/src" + CGO_CFLAGS="$CGO_CFLAGS -I$s/lib" fi export CGO_CFLAGS if [ -z "$CGO_LDFLAGS" ]; then - CGO_LDFLAGS="-L$b/src/.libs" + CGO_LDFLAGS="-L$b/lib/.libs" else - CGO_LDFLAGS="$CGO_LDFLAGS -L$b/src/.libs" + CGO_LDFLAGS="$CGO_LDFLAGS -L$b/lib/.libs" fi export CGO_LDFLAGS diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index 8df0c93..b7229ff 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -48,7 +48,7 @@ virt_sparsify_CPPFLAGS = \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/fish virt_sparsify_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) @@ -56,13 +56,13 @@ virt_sparsify_CFLAGS = \ BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index 975a664..bb8948d 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -93,7 +93,7 @@ virt_sysprep_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/fish virt_sysprep_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ @@ -102,13 +102,13 @@ virt_sysprep_CFLAGS = \ BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib \ diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am index 095f116..c4a1b18 100644 --- a/test-tool/Makefile.am +++ b/test-tool/Makefile.am @@ -26,7 +26,7 @@ libguestfs_test_tool_SOURCES = test-tool.c libguestfs_test_tool_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" @@ -37,7 +37,7 @@ libguestfs_test_tool_CFLAGS = \ libguestfs_test_tool_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am index 9d4898b..cb653f7 100644 --- a/tests/c-api/Makefile.am +++ b/tests/c-api/Makefile.am @@ -93,14 +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)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib tests_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(PCRE_CFLAGS) tests_LDADD = \ $(PCRE_LIBS) \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -119,39 +119,39 @@ test_pwd_LDFLAGS = -all-static test_just_header_SOURCES = test-just-header.c test_just_header_CPPFLAGS = \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_just_header_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_just_header_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la if HAVE_CXX test_just_header_cxx_SOURCES = test-just-header-cxx.cpp test_just_header_cxx_CPPFLAGS = \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_just_header_cxx_CXXFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_just_header_cxx_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la endif test_create_handle_SOURCES = test-create-handle.c test_create_handle_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_create_handle_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_create_handle_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la if HAVE_LIBDL test_dlopen_SOURCES = test-dlopen.c test_dlopen_CPPFLAGS = \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_dlopen_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - -DLIBRARY=\"$(top_builddir)/src/.libs/libguestfs.so.0\" + -DLIBRARY=\"$(top_builddir)/lib/.libs/libguestfs.so.0\" test_dlopen_LDADD = \ -ldl endif @@ -159,107 +159,107 @@ endif test_config_SOURCES = test-config.c test_config_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_config_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_config_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la test_add_drive_opts_SOURCES = test-add-drive-opts.c test_add_drive_opts_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_add_drive_opts_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_add_drive_opts_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la test_last_errno_SOURCES = test-last-errno.c test_last_errno_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_last_errno_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_last_errno_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la test_backend_settings_SOURCES = test-backend-settings.c test_backend_settings_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_backend_settings_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_backend_settings_LDADD = \ $(top_builddir)/common/utils/libutils.la \ $(LTLIBINTL) \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la test_private_data_SOURCES = test-private-data.c test_private_data_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_private_data_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_private_data_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la test_user_cancel_SOURCES = test-user-cancel.c test_user_cancel_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_user_cancel_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_user_cancel_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la -lm \ + $(top_builddir)/lib/libguestfs.la -lm \ $(top_builddir)/gnulib/lib/libgnu.la test_debug_to_file_SOURCES = test-debug-to-file.c test_debug_to_file_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib test_debug_to_file_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_debug_to_file_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la test_environment_SOURCES = test-environment.c test_environment_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib test_environment_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_environment_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la test_event_string_SOURCES = test-event-string.c test_event_string_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib test_event_string_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_event_string_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la @@ -267,7 +267,7 @@ if HAVE_LIBVIRT test_add_libvirt_dom_SOURCES = test-add-libvirt-dom.c test_add_libvirt_dom_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib test_add_libvirt_dom_CFLAGS = \ @@ -275,7 +275,7 @@ test_add_libvirt_dom_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_add_libvirt_dom_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la $(LIBVIRT_LIBS) \ + $(top_builddir)/lib/libguestfs.la $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ $(LTLIBTHREAD) $(top_builddir)/gnulib/lib/libgnu.la endif diff --git a/tests/charsets/Makefile.am b/tests/charsets/Makefile.am index 5715402..7621dc2 100644 --- a/tests/charsets/Makefile.am +++ b/tests/charsets/Makefile.am @@ -28,12 +28,12 @@ test_charset_fidelity_SOURCES = test-charset-fidelity.c test_charset_fidelity_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_charset_fidelity_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_charset_fidelity_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh index 3a78dab..316a263 100755 --- a/tests/disks/test-qemu-drive-libvirt.sh +++ b/tests/disks/test-qemu-drive-libvirt.sh @@ -31,12 +31,12 @@ if [ -z "$abs_builddir" ]; then exit 1 fi -if [ ! -x ../../src/libvirt-is-version ]; then +if [ ! -x ../../lib/libvirt-is-version ]; then echo "$0: test skipped because libvirt-is-version is not built yet" exit 77 fi -if ! ../../src/libvirt-is-version 1 1 3; then +if ! ../../lib/libvirt-is-version 1 1 3; then echo "$0: test skipped because libvirt is too old (< 1.1.3)" exit 77 fi diff --git a/tests/events/Makefile.am b/tests/events/Makefile.am index d2d2e4c..944011c 100644 --- a/tests/events/Makefile.am +++ b/tests/events/Makefile.am @@ -35,13 +35,13 @@ test_libvirt_auth_callbacks_SOURCES = test-libvirt-auth-callbacks.c test_libvirt_auth_callbacks_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_libvirt_auth_callbacks_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBVIRT_CFLAGS) test_libvirt_auth_callbacks_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBVIRT_LIBS) \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ diff --git a/tests/mount-local/Makefile.am b/tests/mount-local/Makefile.am index f0bba80..19335b3 100644 --- a/tests/mount-local/Makefile.am +++ b/tests/mount-local/Makefile.am @@ -34,7 +34,7 @@ test_parallel_mount_local_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/df test_parallel_mount_local_CFLAGS = \ -pthread \ @@ -43,7 +43,7 @@ test_parallel_mount_local_CFLAGS = \ test_parallel_mount_local_LDADD = \ $(FUSE_LIBS) \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/tests/mountable/Makefile.am b/tests/mountable/Makefile.am index 0e2cedd..c1a1ebf 100644 --- a/tests/mountable/Makefile.am +++ b/tests/mountable/Makefile.am @@ -30,9 +30,9 @@ test_internal_parse_mountable_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DGUESTFS_PRIVATE=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_internal_parse_mountable_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_internal_parse_mountable_LDADD = \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la diff --git a/tests/parallel/Makefile.am b/tests/parallel/Makefile.am index cf67232..7f61440 100644 --- a/tests/parallel/Makefile.am +++ b/tests/parallel/Makefile.am @@ -29,13 +29,13 @@ test_parallel_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_parallel_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_parallel_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la diff --git a/tests/protocol/Makefile.am b/tests/protocol/Makefile.am index 6c7a76c..8dafc98 100644 --- a/tests/protocol/Makefile.am +++ b/tests/protocol/Makefile.am @@ -47,12 +47,12 @@ test_error_messages_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/protocol -I$(top_builddir)/common/protocol \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_error_messages_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_error_messages_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(top_builddir)/gnulib/lib/libgnu.la diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am index 4f78178..aef6982 100644 --- a/tests/regressions/Makefile.am +++ b/tests/regressions/Makefile.am @@ -92,7 +92,7 @@ tests_not_run = \ rhbz727178.sh TESTS_ENVIRONMENT = \ - NOEXEC_CHECK="$(top_builddir)/src/.libs/libguestfs.so $(top_builddir)/daemon/guestfsd" \ + NOEXEC_CHECK="$(top_builddir)/lib/.libs/libguestfs.so $(top_builddir)/daemon/guestfsd" \ $(top_builddir)/run --test check_PROGRAMS = \ @@ -105,31 +105,31 @@ check_PROGRAMS = \ rhbz501893_SOURCES = rhbz501893.c rhbz501893_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib rhbz501893_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) rhbz501893_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la rhbz790721_SOURCES = rhbz790721.c rhbz790721_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib rhbz790721_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) rhbz790721_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la rhbz914931_SOURCES = rhbz914931.c rhbz914931_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -DGUESTFS_PRIVATE=1 rhbz914931_CFLAGS = \ -pthread \ @@ -137,29 +137,29 @@ rhbz914931_CFLAGS = \ rhbz914931_LDADD = \ $(top_builddir)/common/utils/libutils.la \ $(LTLIBINTL) \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/gnulib/lib/libgnu.la rhbz1055452_SOURCES = rhbz1055452.c rhbz1055452_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib rhbz1055452_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) rhbz1055452_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la test_big_heap_SOURCES = test-big-heap.c test_big_heap_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib test_big_heap_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) test_big_heap_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/lib/libguestfs.la SLOW_TESTS = \ rhbz909624.sh diff --git a/tests/regressions/rhbz1044014.sh b/tests/regressions/rhbz1044014.sh index 8e0df2a..f9e0455 100755 --- a/tests/regressions/rhbz1044014.sh +++ b/tests/regressions/rhbz1044014.sh @@ -34,12 +34,12 @@ if [[ ! ( "$backend" =~ ^libvirt ) ]]; then exit 77 fi -if [ ! -x ../../src/libvirt-is-version ]; then +if [ ! -x ../../lib/libvirt-is-version ]; then echo "$0: test skipped because libvirt-is-version is not built yet" exit 77 fi -if ! ../../src/libvirt-is-version 1 2 1; then +if ! ../../lib/libvirt-is-version 1 2 1; then echo "$0: test skipped because libvirt is too old (< 1.2.1)" exit 77 fi diff --git a/utils/boot-analysis/Makefile.am b/utils/boot-analysis/Makefile.am index d472884..4d9149e 100644 --- a/utils/boot-analysis/Makefile.am +++ b/utils/boot-analysis/Makefile.am @@ -30,14 +30,14 @@ boot_analysis_SOURCES = \ boot_analysis_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/lib -I$(top_builddir)/lib boot_analysis_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(PCRE_CFLAGS) boot_analysis_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(PCRE_LIBS) \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ diff --git a/utils/boot-benchmark/Makefile.am b/utils/boot-benchmark/Makefile.am index e77e5d9..2e6ca46 100644 --- a/utils/boot-benchmark/Makefile.am +++ b/utils/boot-benchmark/Makefile.am @@ -32,13 +32,13 @@ boot_benchmark_SOURCES = \ boot_benchmark_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/utils/boot-analysis boot_benchmark_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) boot_benchmark_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ $(top_builddir)/gnulib/lib/libgnu.la \ diff --git a/utils/qemu-boot/Makefile.am b/utils/qemu-boot/Makefile.am index 4f0d6a9..7507116 100644 --- a/utils/qemu-boot/Makefile.am +++ b/utils/qemu-boot/Makefile.am @@ -26,14 +26,14 @@ qemu_boot_SOURCES = \ qemu_boot_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/df qemu_boot_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) qemu_boot_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/utils/qemu-speed-test/Makefile.am b/utils/qemu-speed-test/Makefile.am index c8ee0ec..d7bf59a 100644 --- a/utils/qemu-speed-test/Makefile.am +++ b/utils/qemu-speed-test/Makefile.am @@ -24,13 +24,13 @@ qemu_speed_test_SOURCES = \ qemu_speed_test_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/df qemu_speed_test_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) qemu_speed_test_LDADD = \ $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/v2v/Makefile.am b/v2v/Makefile.am index b0fe917..9189aaf 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -116,7 +116,7 @@ virt_v2v_CPPFLAGS = \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src + -I$(top_srcdir)/lib virt_v2v_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBXML2_CFLAGS) \ @@ -128,13 +128,13 @@ BOBJECTS = \ $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib \ @@ -175,7 +175,7 @@ virt_v2v_copy_to_local_CPPFLAGS = \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/src + -I$(top_srcdir)/lib virt_v2v_copy_to_local_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBXML2_CFLAGS) \ diff --git a/v2v/domainxml-c.c b/v2v/domainxml-c.c index 98a6539..c75574a 100644 --- a/v2v/domainxml-c.c +++ b/v2v/domainxml-c.c @@ -79,7 +79,7 @@ get_dom_state (virDomainPtr dom) return -1; } -/* See src/libvirt-auth.c for why we need this. */ +/* See lib/libvirt-auth.c for why we need this. */ static int libvirt_auth_default_wrapper (virConnectCredentialPtr cred, unsigned int ncred, diff --git a/v2v/test-harness/Makefile.am b/v2v/test-harness/Makefile.am index e2ba15c..1395e66 100644 --- a/v2v/test-harness/Makefile.am +++ b/v2v/test-harness/Makefile.am @@ -33,13 +33,13 @@ SOURCES_ML = \ if HAVE_OCAML if HAVE_OCAML_PKG_LIBVIRT -# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L +# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L # option to be passed to gcc, so we don't try linking against an # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix,libvirt \ -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/src/.libs \ + -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/mllib \ @@ -73,7 +73,7 @@ libv2vth_a_CPPFLAGS = \ -DGUESTFS_PRIVATE=1 \ -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib libv2vth_a_CFLAGS = \ -- 2.9.3
Richard W.M. Jones
2017-Jan-25 14:37 UTC
[Libguestfs] [PATCH v2 4/7] cat: Move visit library to new directory common/visit.
Just code motion. --- Makefile.am | 3 +++ cat/Makefile.am | 6 +++--- common/visit/Makefile.am | 33 +++++++++++++++++++++++++++++++++ {cat => common/visit}/visit.c | 0 {cat => common/visit}/visit.h | 0 configure.ac | 1 + diff/Makefile.am | 7 ++----- docs/C_SOURCE_FILES | 4 ++-- docs/guestfs-hacking.pod | 4 ++++ mllib/Makefile.am | 4 ++-- po/POTFILES | 2 +- 11 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 common/visit/Makefile.am rename {cat => common/visit}/visit.c (100%) rename {cat => common/visit}/visit.h (100%) diff --git a/Makefile.am b/Makefile.am index 8267e64..a7fddd4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -88,6 +88,9 @@ SUBDIRS += tests/regressions SUBDIRS += tests/tsk endif +# Common code used by the tools. +SUBDIRS += common/visit + # libguestfs-test-tool SUBDIRS += test-tool diff --git a/cat/Makefile.am b/cat/Makefile.am index 4ebcdac..632f4c0 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -113,15 +113,14 @@ virt_log_LDADD = \ virt_ls_SOURCES = \ $(SHARED_SOURCE_FILES) \ - ls.c \ - visit.c \ - visit.h + ls.c virt_ls_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/visit \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -130,6 +129,7 @@ virt_ls_CFLAGS = \ $(LIBXML2_CFLAGS) virt_ls_LDADD = \ + $(top_builddir)/common/visit/libvisit.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ diff --git a/common/visit/Makefile.am b/common/visit/Makefile.am new file mode 100644 index 0000000..e95954a --- /dev/null +++ b/common/visit/Makefile.am @@ -0,0 +1,33 @@ +# 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 + +noinst_LTLIBRARIES = libvisit.la + +libvisit_la_SOURCES = \ + visit.c \ + visit.h +libvisit_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 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils +libvisit_la_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + $(GCC_VISIBILITY_HIDDEN) diff --git a/cat/visit.c b/common/visit/visit.c similarity index 100% rename from cat/visit.c rename to common/visit/visit.c diff --git a/cat/visit.h b/common/visit/visit.h similarity index 100% rename from cat/visit.h rename to common/visit/visit.h diff --git a/configure.ac b/configure.ac index c7efbea..a85a802 100644 --- a/configure.ac +++ b/configure.ac @@ -183,6 +183,7 @@ AC_CONFIG_FILES([Makefile common/errnostring/Makefile common/protocol/Makefile common/utils/Makefile + common/visit/Makefile csharp/Makefile customize/Makefile daemon/Makefile diff --git a/diff/Makefile.am b/diff/Makefile.am index 5728205..8c9be75 100644 --- a/diff/Makefile.am +++ b/diff/Makefile.am @@ -24,12 +24,7 @@ EXTRA_DIST = \ bin_PROGRAMS = virt-diff -SHARED_SOURCE_FILES = \ - ../cat/visit.h \ - ../cat/visit.c - virt_diff_SOURCES = \ - $(SHARED_SOURCE_FILES) \ diff.c virt_diff_CPPFLAGS = \ @@ -37,6 +32,7 @@ virt_diff_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/visit -I$(top_builddir)/common/visit \ -I$(top_srcdir)/cat -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -45,6 +41,7 @@ virt_diff_CFLAGS = \ $(LIBXML2_CFLAGS) virt_diff_LDADD = \ + $(top_builddir)/common/visit/libvisit.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(top_builddir)/fish/libfishcommon.la \ diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index f77cd22..d48209f 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -11,8 +11,6 @@ cat/filesystems.c cat/log.c cat/ls.c cat/tail.c -cat/visit.c -cat/visit.h common/utils/cleanup.c common/utils/guestfs-internal-frontend-cleanups.h common/utils/guestfs-internal-frontend.h @@ -21,6 +19,8 @@ common/utils/structs-print.c common/utils/structs-print.h common/utils/uefi.c common/utils/utils.c +common/visit/visit.c +common/visit/visit.h customize/crypt-c.c customize/dummy.c customize/perl_edit-c.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index ffb959f..2df78ba 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -98,6 +98,10 @@ and the daemon running inside the appliance is defined here. Various utility functions used throughout the library and tools. +=item F<common/visit> + +Recursively visit a guestfs filesystem hierarchy. + =back =item F<contrib> diff --git a/mllib/Makefile.am b/mllib/Makefile.am index 87c3032..b9a6cf3 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -70,7 +70,7 @@ SOURCES_ML = \ checksums.ml SOURCES_C = \ - ../cat/visit.c \ + ../common/visit/visit.c \ ../fish/decrypt.c \ ../fish/keys.c \ ../fish/progress.c \ @@ -112,7 +112,7 @@ libmllib_a_CPPFLAGS = \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/lib \ - -I$(top_srcdir)/cat \ + -I$(top_srcdir)/common/visit \ -I$(top_srcdir)/fish libmllib_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ diff --git a/po/POTFILES b/po/POTFILES index 25ddf01..2eddd75 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -10,7 +10,6 @@ cat/filesystems.c cat/log.c cat/ls.c cat/tail.c -cat/visit.c common/errnostring/errnostring-gperf.c common/errnostring/errnostring.c common/utils/cleanup.c @@ -18,6 +17,7 @@ common/utils/structs-cleanup.c common/utils/structs-print.c common/utils/uefi.c common/utils/utils.c +common/visit/visit.c customize/crypt-c.c customize/dummy.c customize/perl_edit-c.c -- 2.9.3
Richard W.M. Jones
2017-Jan-25 14:37 UTC
[Libguestfs] [PATCH v2 5/7] fish: Move fishcommon library to common/options.
This is mostly code motion but: (1) I had to remove the compile-time COMPILING_GUESTFISH and COMPILING_VIRT_RESCUE macros and replace them with runtime constants and checks. (2) I moved the fish/config.c file into this library. --- Makefile.am | 2 +- align/Makefile.am | 3 +- align/scan.c | 2 ++ cat/Makefile.am | 15 ++++++--- cat/cat.c | 2 ++ cat/filesystems.c | 2 ++ cat/log.c | 2 ++ cat/ls.c | 2 ++ cat/tail.c | 2 ++ common/options/Makefile.am | 50 +++++++++++++++++++++++++++++ {fish => common/options}/config.c | 0 {fish => common/options}/decrypt.c | 0 {fish => common/options}/display-options.c | 0 {fish => common/options}/display-options.h | 0 {fish => common/options}/domain.c | 0 {fish => common/options}/inspect.c | 1 - {fish => common/options}/keys.c | 0 {fish => common/options}/options.c | 12 +++---- {fish => common/options}/options.h | 13 ++------ {fish => common/options}/uri.c | 0 {fish => common/options}/uri.h | 0 configure.ac | 1 + df/Makefile.am | 3 +- df/main.c | 6 ++++ diff/Makefile.am | 3 +- diff/diff.c | 2 ++ docs/C_SOURCE_FILES | 22 ++++++------- docs/guestfs-hacking.pod | 4 +++ edit/Makefile.am | 3 +- edit/edit.c | 2 ++ fish/Makefile.am | 51 +++--------------------------- fish/fish.c | 2 ++ format/Makefile.am | 3 +- format/format.c | 2 ++ fuse/Makefile.am | 16 +++------- fuse/guestmount.c | 2 ++ inspector/Makefile.am | 3 +- inspector/inspector.c | 2 ++ make-fs/Makefile.am | 3 +- make-fs/make-fs.c | 2 ++ mllib/Makefile.am | 7 ++-- po/POTFILES | 17 +++++----- rescue/Makefile.am | 20 ++---------- rescue/rescue.c | 2 ++ 44 files changed, 157 insertions(+), 129 deletions(-) create mode 100644 common/options/Makefile.am rename {fish => common/options}/config.c (100%) rename {fish => common/options}/decrypt.c (100%) rename {fish => common/options}/display-options.c (100%) rename {fish => common/options}/display-options.h (100%) rename {fish => common/options}/domain.c (100%) rename {fish => common/options}/inspect.c (99%) rename {fish => common/options}/keys.c (100%) rename {fish => common/options}/options.c (98%) rename {fish => common/options}/options.h (98%) rename {fish => common/options}/uri.c (100%) rename {fish => common/options}/uri.h (100%) diff --git a/Makefile.am b/Makefile.am index a7fddd4..604ca51 100644 --- a/Makefile.am +++ b/Makefile.am @@ -89,7 +89,7 @@ SUBDIRS += tests/tsk endif # Common code used by the tools. -SUBDIRS += common/visit +SUBDIRS += common/visit common/options # libguestfs-test-tool SUBDIRS += test-tool diff --git a/align/Makefile.am b/align/Makefile.am index 0568efb..9854313 100644 --- a/align/Makefile.am +++ b/align/Makefile.am @@ -41,6 +41,7 @@ virt_alignment_scan_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/df \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib \ @@ -53,9 +54,9 @@ virt_alignment_scan_CFLAGS = \ $(LIBVIRT_CFLAGS) virt_alignment_scan_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/align/scan.c b/align/scan.c index 953ee91..175df1e 100644 --- a/align/scan.c +++ b/align/scan.c @@ -66,6 +66,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 0; +int in_guestfish = 0; +int in_virt_rescue = 0; static int quiet = 0; /* --quiet */ static int uuid = 0; /* --uuid */ diff --git a/cat/Makefile.am b/cat/Makefile.am index 632f4c0..14d23b0 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -45,6 +45,7 @@ virt_cat_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -53,9 +54,9 @@ virt_cat_CFLAGS = \ $(LIBXML2_CFLAGS) virt_cat_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -70,6 +71,7 @@ virt_filesystems_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -78,9 +80,9 @@ virt_filesystems_CFLAGS = \ $(LIBXML2_CFLAGS) virt_filesystems_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -95,6 +97,7 @@ virt_log_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -103,9 +106,9 @@ virt_log_CFLAGS = \ $(LIBXML2_CFLAGS) virt_log_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -121,6 +124,7 @@ virt_ls_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/visit \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -129,10 +133,10 @@ virt_ls_CFLAGS = \ $(LIBXML2_CFLAGS) virt_ls_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/visit/libvisit.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -147,6 +151,7 @@ virt_tail_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -155,9 +160,9 @@ virt_tail_CFLAGS = \ $(LIBXML2_CFLAGS) virt_tail_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/cat/cat.c b/cat/cat.c index 1ac32d7..90f6fb0 100644 --- a/cat/cat.c +++ b/cat/cat.c @@ -47,6 +47,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 1; +int in_guestfish = 0; +int in_virt_rescue = 0; static int do_cat (int argc, char *argv[]); diff --git a/cat/filesystems.c b/cat/filesystems.c index 73967d7..1036c6f 100644 --- a/cat/filesystems.c +++ b/cat/filesystems.c @@ -49,6 +49,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 0; +int in_guestfish = 0; +int in_virt_rescue = 0; static int csv = 0; /* --csv */ static int human = 0; /* --human-readable|-h */ diff --git a/cat/log.c b/cat/log.c index 84528bd..cc180ec 100644 --- a/cat/log.c +++ b/cat/log.c @@ -51,6 +51,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 1; +int in_guestfish = 0; +int in_virt_rescue = 0; #define JOURNAL_DIR "/var/log/journal" diff --git a/cat/ls.c b/cat/ls.c index 2e327d9..e0b5ff8 100644 --- a/cat/ls.c +++ b/cat/ls.c @@ -52,6 +52,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 1; +int in_guestfish = 0; +int in_virt_rescue = 0; static int csv = 0; static int human = 0; diff --git a/cat/tail.c b/cat/tail.c index 0066be7..8785d45 100644 --- a/cat/tail.c +++ b/cat/tail.c @@ -51,6 +51,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 1; +int in_guestfish = 0; +int in_virt_rescue = 0; static int do_tail (int argc, char *argv[], struct drv *drvs, struct mp *mps); static time_t disk_mtime (struct drv *drvs); diff --git a/common/options/Makefile.am b/common/options/Makefile.am new file mode 100644 index 0000000..4aab6b1 --- /dev/null +++ b/common/options/Makefile.am @@ -0,0 +1,50 @@ +# libguestfs +# Copyright (C) 2009-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 + +# liboptions.la contains guestfish code which is used in other +# C tools for options parsing and a few other things +noinst_LTLIBRARIES = liboptions.la + +liboptions_la_SOURCES = \ + config.c \ + decrypt.c \ + display-options.h \ + display-options.c \ + domain.c \ + inspect.c \ + keys.c \ + options.h \ + options.c \ + uri.h \ + uri.c +liboptions_la_CPPFLAGS = \ + -DGUESTFS_WARN_DEPRECATED=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib +liboptions_la_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + $(LIBCONFIG_CFLAGS) \ + $(LIBXML2_CFLAGS) +liboptions_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/lib/libguestfs.la \ + $(LIBCONFIG_LIBS) \ + $(LIBXML2_LIBS) \ + $(LTLIBINTL) diff --git a/fish/config.c b/common/options/config.c similarity index 100% rename from fish/config.c rename to common/options/config.c diff --git a/fish/decrypt.c b/common/options/decrypt.c similarity index 100% rename from fish/decrypt.c rename to common/options/decrypt.c diff --git a/fish/display-options.c b/common/options/display-options.c similarity index 100% rename from fish/display-options.c rename to common/options/display-options.c diff --git a/fish/display-options.h b/common/options/display-options.h similarity index 100% rename from fish/display-options.h rename to common/options/display-options.h diff --git a/fish/domain.c b/common/options/domain.c similarity index 100% rename from fish/domain.c rename to common/options/domain.c diff --git a/fish/inspect.c b/common/options/inspect.c similarity index 99% rename from fish/inspect.c rename to common/options/inspect.c index edfd2d4..bb4ee87 100644 --- a/fish/inspect.c +++ b/common/options/inspect.c @@ -38,7 +38,6 @@ #include "guestfs.h" /* These definitions ensure we get all extern definitions from the header. */ -#define COMPILING_GUESTFISH 1 #include "options.h" /* Global that saves the root device between inspect_mount and diff --git a/fish/keys.c b/common/options/keys.c similarity index 100% rename from fish/keys.c rename to common/options/keys.c diff --git a/fish/options.c b/common/options/options.c similarity index 98% rename from fish/options.c rename to common/options/options.c index b88c194..a531e2e 100644 --- a/fish/options.c +++ b/common/options/options.c @@ -198,8 +198,8 @@ add_drives_handle (guestfs_h *g, struct drv *drv, char next_drive) next_drive += r; break; -#if COMPILING_GUESTFISH case drv_N: + if (!in_guestfish) abort (); /* -N option is not affected by --ro */ r = guestfs_add_drive_opts (g, drv->N.filename, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", @@ -210,10 +210,9 @@ add_drives_handle (guestfs_h *g, struct drv *drv, char next_drive) drv->nr_drives = 1; next_drive++; break; -#endif -#if COMPILING_VIRT_RESCUE case drv_scratch: + if (!in_virt_rescue) abort (); r = guestfs_add_drive_scratch (g, drv->scratch.size, -1); if (r == -1) exit (EXIT_FAILURE); @@ -221,7 +220,6 @@ add_drives_handle (guestfs_h *g, struct drv *drv, char next_drive) drv->nr_drives = 1; next_drive++; break; -#endif default: /* keep GCC happy */ abort (); @@ -341,17 +339,15 @@ free_drives (struct drv *drv) case drv_d: /* d.filename is optarg, don't free it */ break; -#if COMPILING_GUESTFISH case drv_N: + if (!in_guestfish) abort (); free (drv->N.filename); drv->N.data_free (drv->N.data); break; -#endif -#if COMPILING_VIRT_RESCUE case drv_scratch: + if (!in_virt_rescue) abort (); /* nothing */ break; -#endif default: ; /* keep GCC happy */ } free (drv); diff --git a/fish/options.h b/common/options/options.h similarity index 98% rename from fish/options.h rename to common/options/options.h index a0863ad..1598daf 100644 --- a/fish/options.h +++ b/common/options/options.h @@ -34,6 +34,8 @@ extern int inspector; extern int keys_from_stdin; extern int echo_keys; extern const char *libvirt_uri; +extern int in_guestfish; +extern int in_virt_rescue; /* List of drives added via -a, -d or -N options. NB: Unused fields * in this struct MUST be zeroed, ie. use calloc, not malloc. @@ -54,12 +56,8 @@ struct drv { drv_a, /* -a option (without URI) */ drv_uri, /* -a option (with URI) */ drv_d, /* -d option */ -#if COMPILING_GUESTFISH drv_N, /* -N option (guestfish only) */ -#endif -#if COMPILING_VIRT_RESCUE drv_scratch, /* --scratch option (virt-rescue only) */ -#endif } type; union { struct { @@ -80,18 +78,14 @@ struct drv { struct { char *guest; /* guest name */ } d; -#if COMPILING_GUESTFISH struct { char *filename; /* disk filename (testX.img) */ void *data; /* prepared type */ void (*data_free)(void*); /* function to free 'data' */ } N; -#endif -#if COMPILING_VIRT_RESCUE struct { int64_t size; /* size of the disk in bytes */ } scratch; -#endif }; /* Opaque pointer. Not used by the options-parsing code, and so @@ -121,10 +115,7 @@ extern int add_libvirt_drives (guestfs_h *g, const char *guest); extern void inspect_mount_handle (guestfs_h *g); extern void inspect_mount_root (guestfs_h *g, const char *root); #define inspect_mount() inspect_mount_handle (g) - -#if COMPILING_GUESTFISH extern void print_inspect_prompt (void); -#endif /* in key.c */ extern char *read_key (const char *param); diff --git a/fish/uri.c b/common/options/uri.c similarity index 100% rename from fish/uri.c rename to common/options/uri.c diff --git a/fish/uri.h b/common/options/uri.h similarity index 100% rename from fish/uri.h rename to common/options/uri.h diff --git a/configure.ac b/configure.ac index a85a802..dbf5ce5 100644 --- a/configure.ac +++ b/configure.ac @@ -181,6 +181,7 @@ AC_CONFIG_FILES([Makefile builder/test-website/virt-builder/repos.d/libguestfs.conf cat/Makefile common/errnostring/Makefile + common/options/Makefile common/protocol/Makefile common/utils/Makefile common/visit/Makefile diff --git a/df/Makefile.am b/df/Makefile.am index d921372..e2eef59 100644 --- a/df/Makefile.am +++ b/df/Makefile.am @@ -43,6 +43,7 @@ virt_df_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -53,9 +54,9 @@ virt_df_CFLAGS = \ $(LIBVIRT_CFLAGS) virt_df_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/df/main.c b/df/main.c index b4fe0e0..29a1a1d 100644 --- a/df/main.c +++ b/df/main.c @@ -55,6 +55,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 0; +int in_guestfish = 0; +int in_virt_rescue = 0; int csv = 0; /* --csv */ int human = 0; /* --human-readable|-h */ @@ -349,6 +351,10 @@ single_drive_display_name (struct drv *drvs) if (name == NULL) error (EXIT_FAILURE, errno, "strdup"); break; + + case drv_N: + case drv_scratch: + abort (); /* Only used in guestfish or virt-rescue. */ } if (!name) diff --git a/diff/Makefile.am b/diff/Makefile.am index 8c9be75..5e71b74 100644 --- a/diff/Makefile.am +++ b/diff/Makefile.am @@ -33,6 +33,7 @@ virt_diff_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/visit -I$(top_builddir)/common/visit \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/cat -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -41,10 +42,10 @@ virt_diff_CFLAGS = \ $(LIBXML2_CFLAGS) virt_diff_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/visit/libvisit.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/diff/diff.c b/diff/diff.c index 724c7d7..fc31ad3 100644 --- a/diff/diff.c +++ b/diff/diff.c @@ -60,6 +60,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 1; +int in_guestfish = 0; +int in_virt_rescue = 0; static int atime = 0; static int csv = 0; diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index d48209f..5c9478c 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -11,6 +11,17 @@ cat/filesystems.c cat/log.c cat/ls.c cat/tail.c +common/options/config.c +common/options/decrypt.c +common/options/display-options.c +common/options/display-options.h +common/options/domain.c +common/options/inspect.c +common/options/keys.c +common/options/options.c +common/options/options.h +common/options/uri.c +common/options/uri.h common/utils/cleanup.c common/utils/guestfs-internal-frontend-cleanups.h common/utils/guestfs-internal-frontend.h @@ -170,14 +181,9 @@ erlang/structs.c fish/alloc.c fish/cmds.c fish/completion.c -fish/config.c fish/copy.c -fish/decrypt.c fish/destpaths.c -fish/display-options.c -fish/display-options.h fish/display.c -fish/domain.c fish/echo.c fish/edit.c fish/entries-0.c @@ -197,13 +203,9 @@ fish/fish.h fish/glob.c fish/help.c fish/hexedit.c -fish/inspect.c -fish/keys.c fish/lcd.c fish/man.c fish/more.c -fish/options.c -fish/options.h fish/prep-boot.c fish/prep-disk.c fish/prep-fs.c @@ -228,8 +230,6 @@ fish/setenv.c fish/supported.c fish/tilde.c fish/time.c -fish/uri.c -fish/uri.h fish/windows.c fish/windows.h format/format.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index 2df78ba..1244cd6 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -89,6 +89,10 @@ The communication protocol used between the library and the daemon running inside the appliance has to encode errnos as strings, which is handled by this library. +=item F<common/options> + +Common options parsing for guestfish, guestmount and some virt tools. + =item F<common/protocol> The XDR-based communication protocol used between the library diff --git a/edit/Makefile.am b/edit/Makefile.am index 602bced..317937b 100644 --- a/edit/Makefile.am +++ b/edit/Makefile.am @@ -39,6 +39,7 @@ virt_edit_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -47,9 +48,9 @@ virt_edit_CFLAGS = \ $(LIBXML2_CFLAGS) virt_edit_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/edit/edit.c b/edit/edit.c index 1e1781d..2f986a3 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -52,6 +52,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 1; +int in_guestfish = 0; +int in_virt_rescue = 0; static const char *backup_extension = NULL; static const char *perl_expr = NULL; diff --git a/fish/Makefile.am b/fish/Makefile.am index b0e783c..3a50398 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -67,52 +67,8 @@ EXTRA_DIST = \ virt-tar-in.pod \ virt-tar-out.pod -# These source files (mostly related to option parsing) are shared -# between guestfish, guestmount and some other virt tools. Keep a -# convenient list here just so we know which ones are shared. These -# files must not include other guestfish files. -FISHCOMMON_SOURCE_FILES = \ - decrypt.c \ - display-options.h \ - display-options.c \ - domain.c \ - inspect.c \ - keys.c \ - options.h \ - options.c \ - uri.h \ - uri.c - -SHARED_SOURCE_FILES = \ - $(FISHCOMMON_SOURCE_FILES) \ - config.c \ - progress.h \ - progress.c - -# libfishcommon.la contains guestfish code which is used in other -# C tools. Note this convenience static library is *not* used in -# guestfish, as the sources are built with extra defines -# (e.g. -DCOMPILING_GUESTFISH) in that case. -libfishcommon_la_SOURCES = \ - $(FISHCOMMON_SOURCE_FILES) -libfishcommon_la_CPPFLAGS = \ - -DGUESTFS_WARN_DEPRECATED=1 \ - -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ - -I$(top_srcdir)/lib -I$(top_builddir)/lib \ - -I$(top_srcdir)/fish -I$(top_builddir)/fish \ - -I$(srcdir)/../gnulib/lib -I../gnulib/lib -libfishcommon_la_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBXML2_CFLAGS) -libfishcommon_la_LIBADD = \ - $(top_builddir)/common/utils/libutils.la \ - $(top_builddir)/lib/libguestfs.la \ - $(LIBXML2_LIBS) \ - $(LTLIBINTL) - guestfish_SOURCES = \ $(generator_built) \ - $(SHARED_SOURCE_FILES) \ alloc.c \ cmds-gperf.h \ copy.c \ @@ -137,6 +93,8 @@ guestfish_SOURCES = \ prep-fs.c \ prep-lv.c \ prep-boot.c \ + progress.h \ + progress.c \ rc.c \ reopen.c \ setenv.c \ @@ -160,11 +118,11 @@ cmds-gperf.c: cmds-gperf.gperf mv $@-t $@ guestfish_CPPFLAGS = \ - -DCOMPILING_GUESTFISH=1 \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish -I$(top_builddir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -177,6 +135,7 @@ guestfish_LDADD = \ $(LIBCONFIG_LIBS) \ $(LIBREADLINE) \ $(LIBTINFO_LIBS) \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ @@ -184,7 +143,7 @@ guestfish_LDADD = \ -lm # Make guestfish use the convenience libraries. -noinst_LTLIBRARIES = libcmds.la librc_protocol.la libfishcommon.la +noinst_LTLIBRARIES = libcmds.la librc_protocol.la guestfish_LDADD += libcmds.la librc_protocol.la ../gnulib/lib/libgnu.la if HAVE_RPCGEN diff --git a/fish/fish.c b/fish/fish.c index f9271cf..b7d63cf 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -105,6 +105,8 @@ int progress_bars = 0; int is_interactive = 0; const char *input_file = NULL; int input_lineno = 0; +int in_guestfish = 1; +int in_virt_rescue = 0; static void __attribute__((noreturn)) usage (int status) diff --git a/format/Makefile.am b/format/Makefile.am index 85bdb62..2d3cc77 100644 --- a/format/Makefile.am +++ b/format/Makefile.am @@ -32,6 +32,7 @@ virt_format_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -41,9 +42,9 @@ virt_format_CFLAGS = \ $(LIBVIRT_CFLAGS) virt_format_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/format/format.c b/format/format.c index e70f32d..f23113b 100644 --- a/format/format.c +++ b/format/format.c @@ -47,6 +47,8 @@ int keys_from_stdin = 0; int echo_keys = 0; int inspector = 0; const char *libvirt_uri = NULL; +int in_guestfish = 0; +int in_virt_rescue = 0; static const char *filesystem = NULL; static const char *vg = NULL, *lv = NULL; diff --git a/fuse/Makefile.am b/fuse/Makefile.am index d234215..c3d4398 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -30,15 +30,9 @@ bin_PROGRAMS = \ guestmount \ guestunmount -# These source files (all related to option parsing) are shared -# between guestfish and guestmount. -SHARED_SOURCE_FILES = \ - ../fish/config.c - # guestmount guestmount_SOURCES = \ - $(SHARED_SOURCE_FILES) \ guestmount.c guestmount_CPPFLAGS = \ @@ -46,21 +40,21 @@ guestmount_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib guestmount_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBCONFIG_CFLAGS) \ $(LIBXML2_CFLAGS) \ $(FUSE_CFLAGS) guestmount_LDADD = \ $(FUSE_LIBS) \ - $(LIBCONFIG_LIBS) \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ + $(LIBCONFIG_LIBS) \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ @@ -69,14 +63,13 @@ guestmount_LDADD = \ # guestunmount guestunmount_SOURCES = \ - ../fish/display-options.c \ - ../fish/display-options.h \ guestunmount.c guestunmount_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -84,6 +77,7 @@ guestunmount_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) guestunmount_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/fuse/guestmount.c b/fuse/guestmount.c index 27bda06..3839397 100644 --- a/fuse/guestmount.c +++ b/fuse/guestmount.c @@ -84,6 +84,8 @@ int inspector = 0; int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri; +int in_guestfish = 0; +int in_virt_rescue = 0; static void __attribute__((noreturn)) fuse_help (void) diff --git a/inspector/Makefile.am b/inspector/Makefile.am index 358a3f9..753e2c9 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -60,6 +60,7 @@ virt_inspector_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -68,9 +69,9 @@ virt_inspector_CFLAGS = \ $(LIBXML2_CFLAGS) virt_inspector_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/inspector/inspector.c b/inspector/inspector.c index 8f9d04d..7a115c0 100644 --- a/inspector/inspector.c +++ b/inspector/inspector.c @@ -53,6 +53,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 1; +int in_guestfish = 0; +int in_virt_rescue = 0; static const char *xpath = NULL; static int inspect_apps = 1; static int inspect_icon = 1; diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am index 8d8971a..bef0e7b 100644 --- a/make-fs/Makefile.am +++ b/make-fs/Makefile.am @@ -32,6 +32,7 @@ virt_make_fs_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -40,9 +41,9 @@ virt_make_fs_CFLAGS = \ $(LIBXML2_CFLAGS) virt_make_fs_LDADD = \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ - $(top_builddir)/fish/libfishcommon.la \ $(LIBXML2_LIBS) \ $(LTLIBINTL) \ ../gnulib/lib/libgnu.la diff --git a/make-fs/make-fs.c b/make-fs/make-fs.c index 7a3ecd3..4fbef2d 100644 --- a/make-fs/make-fs.c +++ b/make-fs/make-fs.c @@ -48,6 +48,8 @@ const char *libvirt_uri; int live; int read_only; int verbose; +int in_guestfish = 0; +int in_virt_rescue = 0; static const char *format = "raw", *label = NULL, *partition = NULL, *size_str = NULL, *type = "ext2"; diff --git a/mllib/Makefile.am b/mllib/Makefile.am index b9a6cf3..9cb244c 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -71,10 +71,10 @@ SOURCES_ML = \ SOURCES_C = \ ../common/visit/visit.c \ - ../fish/decrypt.c \ - ../fish/keys.c \ + ../common/options/decrypt.c \ + ../common/options/keys.c \ + ../common/options/uri.c \ ../fish/progress.c \ - ../fish/uri.c \ common_utils-c.c \ dev_t-c.c \ exit-c.c \ @@ -113,6 +113,7 @@ libmllib_a_CPPFLAGS = \ -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/common/visit \ + -I$(top_srcdir)/common/options \ -I$(top_srcdir)/fish libmllib_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ diff --git a/po/POTFILES b/po/POTFILES index 2eddd75..5796a62 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -12,6 +12,14 @@ cat/ls.c cat/tail.c common/errnostring/errnostring-gperf.c common/errnostring/errnostring.c +common/options/config.c +common/options/decrypt.c +common/options/display-options.c +common/options/domain.c +common/options/inspect.c +common/options/keys.c +common/options/options.c +common/options/uri.c common/utils/cleanup.c common/utils/structs-cleanup.c common/utils/structs-print.c @@ -156,15 +164,12 @@ erlang/dispatch.c erlang/main.c erlang/structs.c fish/alloc.c +fish/cmds-gperf.c fish/cmds.c fish/completion.c -fish/config.c fish/copy.c -fish/decrypt.c fish/destpaths.c -fish/display-options.c fish/display.c -fish/domain.c fish/echo.c fish/edit.c fish/entries-0.c @@ -181,12 +186,9 @@ fish/fish.c fish/glob.c fish/help.c fish/hexedit.c -fish/inspect.c -fish/keys.c fish/lcd.c fish/man.c fish/more.c -fish/options.c fish/prep-boot.c fish/prep-disk.c fish/prep-fs.c @@ -208,7 +210,6 @@ fish/setenv.c fish/supported.c fish/tilde.c fish/time.c -fish/uri.c fish/windows.c format/format.c fuse/guestmount.c diff --git a/rescue/Makefile.am b/rescue/Makefile.am index 92ebc4a..7919aaf 100644 --- a/rescue/Makefile.am +++ b/rescue/Makefile.am @@ -25,41 +25,27 @@ EXTRA_DIST = \ bin_PROGRAMS = virt-rescue -SHARED_SOURCE_FILES = \ - ../fish/config.c \ - ../fish/decrypt.c \ - ../fish/display-options.h \ - ../fish/display-options.c \ - ../fish/domain.c \ - ../fish/inspect.c \ - ../fish/keys.c \ - ../fish/options.h \ - ../fish/options.c \ - ../fish/uri.h \ - ../fish/uri.c - virt_rescue_SOURCES = \ - $(SHARED_SOURCE_FILES) \ rescue.c virt_rescue_CPPFLAGS = \ - -DCOMPILING_VIRT_RESCUE=1 \ -DGUESTFS_WARN_DEPRECATED=1 \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_rescue_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBCONFIG_CFLAGS) \ $(LIBXML2_CFLAGS) virt_rescue_LDADD = \ - $(LIBCONFIG_LIBS) \ + $(top_builddir)/common/options/liboptions.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ + $(LIBCONFIG_LIBS) \ $(LIBXML2_LIBS) \ $(LIBVIRT_LIBS) \ $(LTLIBINTL) \ diff --git a/rescue/rescue.c b/rescue/rescue.c index 6730085..ed40ba6 100644 --- a/rescue/rescue.c +++ b/rescue/rescue.c @@ -51,6 +51,8 @@ int keys_from_stdin = 0; int echo_keys = 0; const char *libvirt_uri = NULL; int inspector = 0; +int in_guestfish = 0; +int in_virt_rescue = 1; static void __attribute__((noreturn)) usage (int status) -- 2.9.3
Richard W.M. Jones
2017-Jan-25 14:37 UTC
[Libguestfs] [PATCH v2 6/7] fish: Move edit, progress, windows under common/
Three more pieces of common code are moved under the common/ subdirectory. This is just code motion. Note that windows.[ch] wasn't even being used by guestfish. That code was only used in other virt tools. --- Makefile.am | 6 +++++- cat/Makefile.am | 22 ++++++++------------- common/edit/Makefile.am | 35 ++++++++++++++++++++++++++++++++++ {fish => common/edit}/file-edit.c | 4 ++-- {fish => common/edit}/file-edit.h | 0 common/progress/Makefile.am | 37 ++++++++++++++++++++++++++++++++++++ {fish => common/progress}/progress.c | 0 {fish => common/progress}/progress.h | 0 common/windows/Makefile.am | 37 ++++++++++++++++++++++++++++++++++++ {fish => common/windows}/windows.c | 0 {fish => common/windows}/windows.h | 0 configure.ac | 3 +++ customize/Makefile.am | 6 +++--- docs/C_SOURCE_FILES | 12 ++++++------ docs/guestfs-hacking.pod | 13 +++++++++++++ edit/Makefile.am | 12 ++++-------- fish/Makefile.am | 9 ++++----- mllib/Makefile.am | 4 ++-- po/POTFILES | 6 +++--- 19 files changed, 162 insertions(+), 44 deletions(-) create mode 100644 common/edit/Makefile.am rename {fish => common/edit}/file-edit.c (100%) rename {fish => common/edit}/file-edit.h (100%) create mode 100644 common/progress/Makefile.am rename {fish => common/progress}/progress.c (100%) rename {fish => common/progress}/progress.h (100%) create mode 100644 common/windows/Makefile.am rename {fish => common/windows}/windows.c (100%) rename {fish => common/windows}/windows.h (100%) diff --git a/Makefile.am b/Makefile.am index 604ca51..49aed47 100644 --- a/Makefile.am +++ b/Makefile.am @@ -89,7 +89,11 @@ SUBDIRS += tests/tsk endif # Common code used by the tools. -SUBDIRS += common/visit common/options +SUBDIRS += common/edit +SUBDIRS += common/options +SUBDIRS += common/progress +SUBDIRS += common/visit +SUBDIRS += common/windows # libguestfs-test-tool SUBDIRS += test-tool diff --git a/cat/Makefile.am b/cat/Makefile.am index 14d23b0..4b91719 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -32,12 +32,7 @@ EXTRA_DIST = \ bin_PROGRAMS = virt-cat virt-filesystems virt-log virt-ls virt-tail -SHARED_SOURCE_FILES = \ - ../fish/windows.h \ - ../fish/windows.c - virt_cat_SOURCES = \ - $(SHARED_SOURCE_FILES) \ cat.c virt_cat_CPPFLAGS = \ @@ -46,7 +41,7 @@ virt_cat_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_cat_CFLAGS = \ @@ -55,6 +50,7 @@ virt_cat_CFLAGS = \ virt_cat_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/windows/libwindows.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ @@ -63,7 +59,6 @@ virt_cat_LDADD = \ ../gnulib/lib/libgnu.la virt_filesystems_SOURCES = \ - $(SHARED_SOURCE_FILES) \ filesystems.c virt_filesystems_CPPFLAGS = \ @@ -72,7 +67,7 @@ virt_filesystems_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_filesystems_CFLAGS = \ @@ -81,6 +76,7 @@ virt_filesystems_CFLAGS = \ virt_filesystems_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/windows/libwindows.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ @@ -89,7 +85,6 @@ virt_filesystems_LDADD = \ ../gnulib/lib/libgnu.la virt_log_SOURCES = \ - $(SHARED_SOURCE_FILES) \ log.c virt_log_CPPFLAGS = \ @@ -98,7 +93,7 @@ virt_log_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_log_CFLAGS = \ @@ -115,7 +110,6 @@ virt_log_LDADD = \ ../gnulib/lib/libgnu.la virt_ls_SOURCES = \ - $(SHARED_SOURCE_FILES) \ ls.c virt_ls_CPPFLAGS = \ @@ -125,7 +119,7 @@ virt_ls_CPPFLAGS = \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/visit \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_ls_CFLAGS = \ @@ -143,7 +137,6 @@ virt_ls_LDADD = \ ../gnulib/lib/libgnu.la virt_tail_SOURCES = \ - $(SHARED_SOURCE_FILES) \ tail.c virt_tail_CPPFLAGS = \ @@ -152,7 +145,7 @@ virt_tail_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_tail_CFLAGS = \ @@ -161,6 +154,7 @@ virt_tail_CFLAGS = \ virt_tail_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/windows/libwindows.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/common/edit/Makefile.am b/common/edit/Makefile.am new file mode 100644 index 0000000..592f6fc --- /dev/null +++ b/common/edit/Makefile.am @@ -0,0 +1,35 @@ +# libguestfs +# Copyright (C) 2009-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 + +# libedit.la contains the common code used by virt-edit, guestfish +# 'edit' command, virt-customize and virt-builder. +noinst_LTLIBRARIES = libedit.la + +libedit_la_SOURCES = \ + file-edit.c \ + file-edit.h +libedit_la_CPPFLAGS = \ + -DGUESTFS_WARN_DEPRECATED=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib +libedit_la_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) +libedit_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/lib/libguestfs.la diff --git a/fish/file-edit.c b/common/edit/file-edit.c similarity index 100% rename from fish/file-edit.c rename to common/edit/file-edit.c index e3bd7fe..a730011 100644 --- a/fish/file-edit.c +++ b/common/edit/file-edit.c @@ -27,8 +27,6 @@ #include <config.h> -#include "file-edit.h" - #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -45,6 +43,8 @@ #include "guestfs-internal-frontend.h" +#include "file-edit.h" + static int do_download (guestfs_h *g, const char *filename, char **tempfile); static int do_upload (guestfs_h *g, const char *filename, const char *tempfile, const char *backup_extension); diff --git a/fish/file-edit.h b/common/edit/file-edit.h similarity index 100% rename from fish/file-edit.h rename to common/edit/file-edit.h diff --git a/common/progress/Makefile.am b/common/progress/Makefile.am new file mode 100644 index 0000000..afb03c8 --- /dev/null +++ b/common/progress/Makefile.am @@ -0,0 +1,37 @@ +# libguestfs +# Copyright (C) 2009-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 + +# libprogress.la contains common code for printing progress bars, used +# by guestfish and other tools. +noinst_LTLIBRARIES = libprogress.la + +libprogress_la_SOURCES = \ + progress.c \ + progress.h +libprogress_la_CPPFLAGS = \ + -DGUESTFS_WARN_DEPRECATED=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib +libprogress_la_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + $(LIBTINFO_CFLAGS) +libprogress_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/lib/libguestfs.la \ + $(LIBTINFO_LIBS) diff --git a/fish/progress.c b/common/progress/progress.c similarity index 100% rename from fish/progress.c rename to common/progress/progress.c diff --git a/fish/progress.h b/common/progress/progress.h similarity index 100% rename from fish/progress.h rename to common/progress/progress.h diff --git a/common/windows/Makefile.am b/common/windows/Makefile.am new file mode 100644 index 0000000..043252b --- /dev/null +++ b/common/windows/Makefile.am @@ -0,0 +1,37 @@ +# libguestfs +# Copyright (C) 2009-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 + +# libwindows.la contains common code for handling Windows drive +# letters, which is used by virt-cat, virt-edit and virt-tail. +noinst_LTLIBRARIES = libwindows.la + +libwindows_la_SOURCES = \ + windows.c \ + windows.h +libwindows_la_CPPFLAGS = \ + -DGUESTFS_WARN_DEPRECATED=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib +libwindows_la_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) +libwindows_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/lib/libguestfs.la \ + $(LTLIBINTL) diff --git a/fish/windows.c b/common/windows/windows.c similarity index 100% rename from fish/windows.c rename to common/windows/windows.c diff --git a/fish/windows.h b/common/windows/windows.h similarity index 100% rename from fish/windows.h rename to common/windows/windows.h diff --git a/configure.ac b/configure.ac index dbf5ce5..21a3961 100644 --- a/configure.ac +++ b/configure.ac @@ -181,10 +181,13 @@ AC_CONFIG_FILES([Makefile builder/test-website/virt-builder/repos.d/libguestfs.conf cat/Makefile common/errnostring/Makefile + common/edit/Makefile common/options/Makefile + common/progress/Makefile common/protocol/Makefile common/utils/Makefile common/visit/Makefile + common/windows/Makefile csharp/Makefile customize/Makefile daemon/Makefile diff --git a/customize/Makefile.am b/customize/Makefile.am index 5cc5c05..c7eed43 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -68,8 +68,8 @@ SOURCES_ML = \ customize_run.ml SOURCES_C = \ - ../fish/file-edit.c \ - ../fish/file-edit.h \ + ../common/edit/file-edit.c \ + ../common/edit/file-edit.h \ crypt-c.c \ perl_edit-c.c @@ -98,7 +98,7 @@ libcustomize_a_CPPFLAGS = \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/lib \ - -I$(top_srcdir)/fish + -I$(top_srcdir)/common/edit libcustomize_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBVIRT_CFLAGS) \ diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index 5c9478c..30293b6 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -11,6 +11,8 @@ cat/filesystems.c cat/log.c cat/ls.c cat/tail.c +common/edit/file-edit.c +common/edit/file-edit.h common/options/config.c common/options/decrypt.c common/options/display-options.c @@ -22,6 +24,8 @@ common/options/options.c common/options/options.h common/options/uri.c common/options/uri.h +common/progress/progress.c +common/progress/progress.h common/utils/cleanup.c common/utils/guestfs-internal-frontend-cleanups.h common/utils/guestfs-internal-frontend.h @@ -32,6 +36,8 @@ common/utils/uefi.c common/utils/utils.c common/visit/visit.c common/visit/visit.h +common/windows/windows.c +common/windows/windows.h customize/crypt-c.c customize/dummy.c customize/perl_edit-c.c @@ -195,8 +201,6 @@ fish/entries-5.c fish/entries-6.c fish/event-names.c fish/events.c -fish/file-edit.c -fish/file-edit.h fish/fish-cmds.h fish/fish.c fish/fish.h @@ -214,8 +218,6 @@ fish/prep-part.c fish/prep.c fish/prepopts.c fish/prepopts.h -fish/progress.c -fish/progress.h fish/rc.c fish/reopen.c fish/run-0.c @@ -230,8 +232,6 @@ fish/setenv.c fish/supported.c fish/tilde.c fish/time.c -fish/windows.c -fish/windows.h format/format.c fuse/guestmount.c fuse/guestunmount.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index 1244cd6..c3084d6 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -83,6 +83,11 @@ subdirectory: =over 4 +=item F<common/edit> + +Common code for interactively and non-interactively editing files +within a libguestfs filesystem. + =item F<common/errnostring> The communication protocol used between the library and the daemon @@ -93,6 +98,10 @@ handled by this library. Common options parsing for guestfish, guestmount and some virt tools. +=item F<common/progress> + +Common code for printing progress bars. + =item F<common/protocol> The XDR-based communication protocol used between the library @@ -106,6 +115,10 @@ Various utility functions used throughout the library and tools. Recursively visit a guestfs filesystem hierarchy. +=item F<common/windows> + +Utility functions for handling Windows drive letters. + =back =item F<contrib> diff --git a/edit/Makefile.am b/edit/Makefile.am index 317937b..f98e374 100644 --- a/edit/Makefile.am +++ b/edit/Makefile.am @@ -24,14 +24,7 @@ EXTRA_DIST = \ bin_PROGRAMS = virt-edit -SHARED_SOURCE_FILES = \ - ../fish/file-edit.h \ - ../fish/file-edit.c \ - ../fish/windows.h \ - ../fish/windows.c - virt_edit_SOURCES = \ - $(SHARED_SOURCE_FILES) \ edit.c virt_edit_CPPFLAGS = \ @@ -39,8 +32,9 @@ virt_edit_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -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 \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/windows -I$(top_builddir)/common/windows \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_edit_CFLAGS = \ @@ -48,7 +42,9 @@ virt_edit_CFLAGS = \ $(LIBXML2_CFLAGS) virt_edit_LDADD = \ + $(top_builddir)/common/edit/libedit.la \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/windows/libwindows.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/fish/Makefile.am b/fish/Makefile.am index 3a50398..38409cb 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -77,8 +77,6 @@ guestfish_SOURCES = \ echo.c \ edit.c \ events.c \ - file-edit.c \ - file-edit.h \ fish.c \ fish.h \ glob.c \ @@ -93,8 +91,6 @@ guestfish_SOURCES = \ prep-fs.c \ prep-lv.c \ prep-boot.c \ - progress.h \ - progress.c \ rc.c \ reopen.c \ setenv.c \ @@ -122,7 +118,9 @@ guestfish_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -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 \ + -I$(top_srcdir)/common/progress -I$(top_builddir)/common/progress \ -I$(top_srcdir)/fish -I$(top_builddir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib @@ -134,8 +132,9 @@ guestfish_CFLAGS = \ guestfish_LDADD = \ $(LIBCONFIG_LIBS) \ $(LIBREADLINE) \ - $(LIBTINFO_LIBS) \ + $(top_builddir)/common/edit/libedit.la \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/progress/libprogress.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/mllib/Makefile.am b/mllib/Makefile.am index 9cb244c..78fdf02 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -74,7 +74,7 @@ SOURCES_C = \ ../common/options/decrypt.c \ ../common/options/keys.c \ ../common/options/uri.c \ - ../fish/progress.c \ + ../common/progress/progress.c \ common_utils-c.c \ dev_t-c.c \ exit-c.c \ @@ -114,7 +114,7 @@ libmllib_a_CPPFLAGS = \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/common/visit \ -I$(top_srcdir)/common/options \ - -I$(top_srcdir)/fish + -I$(top_srcdir)/common/progress libmllib_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \ diff --git a/po/POTFILES b/po/POTFILES index 5796a62..75a9799 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -10,6 +10,7 @@ cat/filesystems.c cat/log.c cat/ls.c cat/tail.c +common/edit/file-edit.c common/errnostring/errnostring-gperf.c common/errnostring/errnostring.c common/options/config.c @@ -20,12 +21,14 @@ common/options/inspect.c common/options/keys.c common/options/options.c common/options/uri.c +common/progress/progress.c common/utils/cleanup.c common/utils/structs-cleanup.c common/utils/structs-print.c common/utils/uefi.c common/utils/utils.c common/visit/visit.c +common/windows/windows.c customize/crypt-c.c customize/dummy.c customize/perl_edit-c.c @@ -181,7 +184,6 @@ fish/entries-5.c fish/entries-6.c fish/event-names.c fish/events.c -fish/file-edit.c fish/fish.c fish/glob.c fish/help.c @@ -196,7 +198,6 @@ fish/prep-lv.c fish/prep-part.c fish/prep.c fish/prepopts.c -fish/progress.c fish/rc.c fish/reopen.c fish/run-0.c @@ -210,7 +211,6 @@ fish/setenv.c fish/supported.c fish/tilde.c fish/time.c -fish/windows.c format/format.c fuse/guestmount.c fuse/guestunmount.c -- 2.9.3
Richard W.M. Jones
2017-Jan-25 14:37 UTC
[Libguestfs] [PATCH v2 7/7] df: Move framework for processing domains in parallel to common/parallel.
Just code motion. --- Makefile.am | 1 + align/Makefile.am | 13 +------ common/parallel/Makefile.am | 51 ++++++++++++++++++++++++++ {df => common/parallel}/domains.c | 0 {df => common/parallel}/domains.h | 0 {df => common/parallel}/estimate-max-threads.c | 0 {df => common/parallel}/estimate-max-threads.h | 0 {df => common/parallel}/parallel.c | 0 {df => common/parallel}/parallel.h | 0 configure.ac | 1 + df/Makefile.am | 11 ++---- docs/C_SOURCE_FILES | 12 +++--- docs/guestfs-hacking.pod | 4 ++ po/POTFILES | 6 +-- tests/mount-local/Makefile.am | 6 +-- utils/qemu-boot/Makefile.am | 4 +- 16 files changed, 76 insertions(+), 33 deletions(-) create mode 100644 common/parallel/Makefile.am rename {df => common/parallel}/domains.c (100%) rename {df => common/parallel}/domains.h (100%) rename {df => common/parallel}/estimate-max-threads.c (100%) rename {df => common/parallel}/estimate-max-threads.h (100%) rename {df => common/parallel}/parallel.c (100%) rename {df => common/parallel}/parallel.h (100%) diff --git a/Makefile.am b/Makefile.am index 49aed47..cd60120 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,6 +91,7 @@ endif # Common code used by the tools. SUBDIRS += common/edit SUBDIRS += common/options +SUBDIRS += common/parallel SUBDIRS += common/progress SUBDIRS += common/visit SUBDIRS += common/windows diff --git a/align/Makefile.am b/align/Makefile.am index 9854313..e949e2a 100644 --- a/align/Makefile.am +++ b/align/Makefile.am @@ -25,16 +25,7 @@ EXTRA_DIST = \ bin_PROGRAMS = virt-alignment-scan -SHARED_SOURCE_FILES = \ - ../df/domains.c \ - ../df/domains.h \ - ../df/estimate-max-threads.c \ - ../df/estimate-max-threads.h \ - ../df/parallel.c \ - ../df/parallel.h - virt_alignment_scan_SOURCES = \ - $(SHARED_SOURCE_FILES) \ scan.c virt_alignment_scan_CPPFLAGS = \ @@ -42,8 +33,7 @@ virt_alignment_scan_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/df \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" @@ -55,6 +45,7 @@ virt_alignment_scan_CFLAGS = \ virt_alignment_scan_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/parallel/libparallel.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/common/parallel/Makefile.am b/common/parallel/Makefile.am new file mode 100644 index 0000000..5518e89 --- /dev/null +++ b/common/parallel/Makefile.am @@ -0,0 +1,51 @@ +# libguestfs virt-df +# Copyright (C) 2010-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 + +# libparallel.la contains a framework used for processing multiple +# libvirt domains in parallel. It is used by virt-df and +# virt-alignment-scan. +noinst_LTLIBRARIES = libparallel.la + +libparallel_la_SOURCES = \ + domains.c \ + domains.h \ + estimate-max-threads.c \ + estimate-max-threads.h \ + parallel.c \ + parallel.h +libparallel_la_CPPFLAGS = \ + -DGUESTFS_WARN_DEPRECATED=1 \ + -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ + -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib +libparallel_la_CFLAGS = \ + -pthread \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + $(LIBXML2_CFLAGS) \ + $(LIBVIRT_CFLAGS) +libparallel_la_LIBADD = \ + $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/lib/libguestfs.la \ + $(LIBXML2_LIBS) \ + $(LIBVIRT_LIBS) \ + $(LTLIBINTL) \ + $(top_builddir)/gnulib/lib/libgnu.la \ + -lm diff --git a/df/domains.c b/common/parallel/domains.c similarity index 100% rename from df/domains.c rename to common/parallel/domains.c diff --git a/df/domains.h b/common/parallel/domains.h similarity index 100% rename from df/domains.h rename to common/parallel/domains.h diff --git a/df/estimate-max-threads.c b/common/parallel/estimate-max-threads.c similarity index 100% rename from df/estimate-max-threads.c rename to common/parallel/estimate-max-threads.c diff --git a/df/estimate-max-threads.h b/common/parallel/estimate-max-threads.h similarity index 100% rename from df/estimate-max-threads.h rename to common/parallel/estimate-max-threads.h diff --git a/df/parallel.c b/common/parallel/parallel.c similarity index 100% rename from df/parallel.c rename to common/parallel/parallel.c diff --git a/df/parallel.h b/common/parallel/parallel.h similarity index 100% rename from df/parallel.h rename to common/parallel/parallel.h diff --git a/configure.ac b/configure.ac index 21a3961..e2e9c66 100644 --- a/configure.ac +++ b/configure.ac @@ -183,6 +183,7 @@ AC_CONFIG_FILES([Makefile common/errnostring/Makefile common/edit/Makefile common/options/Makefile + common/parallel/Makefile common/progress/Makefile common/protocol/Makefile common/utils/Makefile diff --git a/df/Makefile.am b/df/Makefile.am index e2eef59..616e587 100644 --- a/df/Makefile.am +++ b/df/Makefile.am @@ -28,15 +28,9 @@ bin_PROGRAMS = virt-df virt_df_SOURCES = \ virt-df.h \ - domains.c \ - domains.h \ df.c \ - estimate-max-threads.c \ - estimate-max-threads.h \ main.c \ - output.c \ - parallel.c \ - parallel.h + output.c virt_df_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ @@ -44,7 +38,7 @@ virt_df_CPPFLAGS = \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ -I$(top_srcdir)/common/options -I$(top_builddir)/common/options \ - -I$(top_srcdir)/fish \ + -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib virt_df_CFLAGS = \ @@ -55,6 +49,7 @@ virt_df_CFLAGS = \ virt_df_LDADD = \ $(top_builddir)/common/options/liboptions.la \ + $(top_builddir)/common/parallel/libparallel.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 30293b6..a00fc22 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -24,6 +24,12 @@ common/options/options.c common/options/options.h common/options/uri.c common/options/uri.h +common/parallel/domains.c +common/parallel/domains.h +common/parallel/estimate-max-threads.c +common/parallel/estimate-max-threads.h +common/parallel/parallel.c +common/parallel/parallel.h common/progress/progress.c common/progress/progress.h common/utils/cleanup.c @@ -161,14 +167,8 @@ daemon/xfs.c daemon/zero.c daemon/zerofree.c df/df.c -df/domains.c -df/domains.h -df/estimate-max-threads.c -df/estimate-max-threads.h df/main.c df/output.c -df/parallel.c -df/parallel.h df/virt-df.h dib/dummy.c diff/diff.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index c3084d6..b44e5f7 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -98,6 +98,10 @@ handled by this library. Common options parsing for guestfish, guestmount and some virt tools. +=item F<common/parallel> + +A framework used for processing multiple libvirt domains in parallel. + =item F<common/progress> Common code for printing progress bars. diff --git a/po/POTFILES b/po/POTFILES index 75a9799..b12fb18 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -21,6 +21,9 @@ common/options/inspect.c common/options/keys.c common/options/options.c common/options/uri.c +common/parallel/domains.c +common/parallel/estimate-max-threads.c +common/parallel/parallel.c common/progress/progress.c common/utils/cleanup.c common/utils/structs-cleanup.c @@ -147,11 +150,8 @@ daemon/xfs.c daemon/zero.c daemon/zerofree.c df/df.c -df/domains.c -df/estimate-max-threads.c df/main.c df/output.c -df/parallel.c dib/dummy.c diff/diff.c docs/make-internal-documentation.pl diff --git a/tests/mount-local/Makefile.am b/tests/mount-local/Makefile.am index 19335b3..fc48624 100644 --- a/tests/mount-local/Makefile.am +++ b/tests/mount-local/Makefile.am @@ -27,14 +27,13 @@ LOG_COMPILER = $(VG) check_PROGRAMS = $(TESTS) test_parallel_mount_local_SOURCES = \ - test-parallel-mount-local.c \ - ../../df/estimate-max-threads.c \ - ../../df/estimate-max-threads.h + test-parallel-mount-local.c test_parallel_mount_local_CPPFLAGS = \ -DGUESTFS_WARN_DEPRECATED=1 \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ -I$(top_srcdir)/df test_parallel_mount_local_CFLAGS = \ -pthread \ @@ -42,6 +41,7 @@ test_parallel_mount_local_CFLAGS = \ $(FUSE_CFLAGS) test_parallel_mount_local_LDADD = \ $(FUSE_LIBS) \ + $(top_builddir)/common/parallel/libparallel.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ diff --git a/utils/qemu-boot/Makefile.am b/utils/qemu-boot/Makefile.am index 7507116..3936a07 100644 --- a/utils/qemu-boot/Makefile.am +++ b/utils/qemu-boot/Makefile.am @@ -20,18 +20,18 @@ include $(top_srcdir)/subdir-rules.mk noinst_PROGRAMS = qemu-boot qemu_boot_SOURCES = \ - ../../df/estimate-max-threads.c \ - ../../df/estimate-max-threads.h \ qemu-boot.c qemu_boot_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \ -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + -I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \ -I$(top_srcdir)/df qemu_boot_CFLAGS = \ -pthread \ $(WARN_CFLAGS) $(WERROR_CFLAGS) qemu_boot_LDADD = \ + $(top_builddir)/common/parallel/libparallel.la \ $(top_builddir)/common/utils/libutils.la \ $(top_builddir)/lib/libguestfs.la \ $(LIBXML2_LIBS) \ -- 2.9.3
Pino Toscano
2017-Jan-26 15:57 UTC
Re: [Libguestfs] [PATCH v2 1/7] lib: Share common protocol and errnostring libraries with the library and daemon.
On Wednesday, 25 January 2017 14:37:10 CET Richard W.M. Jones wrote:> This commit, which is just code motion, moves the common XDR protocol > code (libprotocol) and the common errno handling (liberrnostring) into > libraries which are each built once and shared between the library and > daemon. > --- > guestfsd_SOURCES = \ > + ../common/errnostring/errnostring.h \ > + ../common/protocol/guestfs_protocol.h \> [...]> libguestfs_la_SOURCES = \ > + ../common/errnostring/errnostring.h \ > + ../common/protocol/guestfs_protocol.h \Are these two changes needed? The targets already depend on the .la. -- Pino Toscano
Pino Toscano
2017-Jan-26 16:15 UTC
Re: [Libguestfs] [PATCH v2 2/7] lib: Move utilities to new directory common/utils.
On Wednesday, 25 January 2017 14:37:11 CET Richard W.M. Jones wrote:> Just code motion. > > This commit makes it clearer what is a utility and what is part of the > library. It also makes it clear that we should rename: > > guestfs-internal-frontend.h -> utils.h > guestfs-internal-frontend-cleanups.h -> cleanups.h (?)I'd not name an header as "utils.h": in the past, I've been bitten by a library naming a public installed header (!) as /usr/include/utils.h, nicely colliding with the utils.h in my own project. -- Pino Toscano
Pino Toscano
2017-Jan-26 16:30 UTC
Re: [Libguestfs] [PATCH v2 0/7] Rename src/ to lib/ and move common code to common/
On Wednesday, 25 January 2017 14:37:09 CET Richard W.M. Jones wrote:> Previous patch series was posted here: > https://www.redhat.com/archives/libguestfs/2017-January/msg00059.html > > v2 simply extends this patch series to cover the extra directories > common/edit, common/progress, common/windows and common/parallel.Except from the comments, the rest seems fine (although IMHO a bit too much overly split).> The only remaining item is to consider whether we should rename mllib > to something else, mlcommon was my suggestion.Hm dunno about this, mllib seems fine IMHO. Thanks, -- Pino Toscano
Apparently Analagous Threads
- [PATCH 0/5] Rename src/ to lib/ and move common code to common/
- [PATCH 1/3] build: remove extra libconfig linkage
- [PATCH 00/12] Refactor utility functions.
- [PATCH v5 00/32] Refactor utilities, implement some APIs in OCaml.
- [PATCH 0/9] Small bits of non-Linux porting - #2