[Libguestfs] [PATCH v2 7/7] df: Move framework for processing domains in parallel to common/parallel.

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


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




More information about the Libguestfs mailing list