[Libguestfs] [PATCH v2 4/7] cat: Move visit library to new directory common/visit.

Richard W.M. Jones rjones at redhat.com
Wed Jan 25 14:37:13 UTC 2017


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




More information about the Libguestfs mailing list