From 0a9aaa7f0cc16f1771f492cce665bc5c5eb8e735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 22:47:56 +0200 Subject: [PATCH] cmd: move single-file binaries up, extract udev programs to udev/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #13316 --- cmd/Makefile.am | 106 +++++++++++++++--- cmd/{arc_summary/arc_summary3 => arc_summary} | 0 cmd/arc_summary/Makefile.am | 8 -- cmd/{arcstat => }/arcstat.in | 0 cmd/arcstat/Makefile.am | 4 - cmd/{dbufstat => }/dbufstat.in | 0 cmd/dbufstat/Makefile.am | 4 - cmd/{fsck_zfs => }/fsck.zfs.in | 0 cmd/fsck_zfs/Makefile.am | 5 - cmd/{mount_zfs => }/mount_zfs.c | 0 cmd/mount_zfs/Makefile.am | 20 ---- cmd/vdev_id/Makefile.am | 2 - cmd/{zfs_ids_to_path => }/zfs_ids_to_path.c | 0 cmd/zfs_ids_to_path/Makefile.am | 8 -- cmd/{zgenhostid => }/zgenhostid.c | 0 cmd/zgenhostid/Makefile.am | 5 - cmd/{zhack => }/zhack.c | 0 cmd/zhack/Makefile.am | 12 -- cmd/{ztest => }/ztest.c | 0 cmd/ztest/Makefile.am | 18 --- cmd/zvol_id/Makefile.am | 5 - cmd/{zvol_wait => }/zvol_wait | 0 cmd/zvol_wait/Makefile.am | 2 - scripts/Makefile.am | 2 + scripts/zfs-helpers.sh | 2 +- udev/.gitignore | 1 + udev/Makefile.am | 12 ++ {cmd/vdev_id => udev}/vdev_id | 0 cmd/zvol_id/zvol_id_main.c => udev/zvol_id.c | 0 29 files changed, 107 insertions(+), 109 deletions(-) rename cmd/{arc_summary/arc_summary3 => arc_summary} (100%) delete mode 100644 cmd/arc_summary/Makefile.am rename cmd/{arcstat => }/arcstat.in (100%) delete mode 100644 cmd/arcstat/Makefile.am rename cmd/{dbufstat => }/dbufstat.in (100%) delete mode 100644 cmd/dbufstat/Makefile.am rename cmd/{fsck_zfs => }/fsck.zfs.in (100%) delete mode 100644 cmd/fsck_zfs/Makefile.am rename cmd/{mount_zfs => }/mount_zfs.c (100%) delete mode 100644 cmd/mount_zfs/Makefile.am delete mode 100644 cmd/vdev_id/Makefile.am rename cmd/{zfs_ids_to_path => }/zfs_ids_to_path.c (100%) delete mode 100644 cmd/zfs_ids_to_path/Makefile.am rename cmd/{zgenhostid => }/zgenhostid.c (100%) delete mode 100644 cmd/zgenhostid/Makefile.am rename cmd/{zhack => }/zhack.c (100%) delete mode 100644 cmd/zhack/Makefile.am rename cmd/{ztest => }/ztest.c (100%) delete mode 100644 cmd/ztest/Makefile.am delete mode 100644 cmd/zvol_id/Makefile.am rename cmd/{zvol_wait => }/zvol_wait (100%) delete mode 100644 cmd/zvol_wait/Makefile.am create mode 100644 udev/.gitignore rename {cmd/vdev_id => udev}/vdev_id (100%) rename cmd/zvol_id/zvol_id_main.c => udev/zvol_id.c (100%) diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 2fa281cad2..9959760b52 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -2,38 +2,114 @@ bin_SCRIPTS = bin_PROGRAMS = sbin_SCRIPTS = sbin_PROGRAMS = -udev_PROGRAMS = dist_bin_SCRIPTS = zfsexec_PROGRAMS = -dist_udev_SCRIPTS = mounthelper_PROGRAMS = -include $(srcdir)/%D%/fsck_zfs/Makefile.am + +sbin_SCRIPTS += fsck.zfs +SHELLCHECKSCRIPTS += fsck.zfs +CLEANFILES += fsck.zfs +EXTRA_DIST += %D%/fsck.zfs.in +$(call SUBST,fsck.zfs,%D%/) + + +sbin_PROGRAMS += zfs_ids_to_path +CPPCHECKTARGETS += zfs_ids_to_path + +zfs_ids_to_path_SOURCES = \ + %D%/zfs_ids_to_path.c + +zfs_ids_to_path_LDADD = \ + libzfs.la + + +zhack_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) + +sbin_PROGRAMS += zhack +CPPCHECKTARGETS += zhack + +zhack_SOURCES = \ + %D%/zhack.c + +zhack_LDADD = \ + libzpool.la \ + libzfs_core.la \ + libnvpair.la + + +ztest_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) +# Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 +ztest_CFLAGS += $(NO_FORMAT_TRUNCATION) +ztest_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) + +sbin_PROGRAMS += ztest +CPPCHECKTARGETS += ztest + +ztest_SOURCES = \ + %D%/ztest.c + +ztest_LDADD = \ + libzpool.la \ + libzfs_core.la \ + libnvpair.la + +ztest_LDADD += -lm +ztest_LDFLAGS = -pthread + + include $(srcdir)/%D%/raidz_test/Makefile.am -include $(srcdir)/%D%/vdev_id/Makefile.am include $(srcdir)/%D%/zdb/Makefile.am include $(srcdir)/%D%/zfs/Makefile.am -include $(srcdir)/%D%/zfs_ids_to_path/Makefile.am -include $(srcdir)/%D%/zhack/Makefile.am include $(srcdir)/%D%/zinject/Makefile.am include $(srcdir)/%D%/zpool/Makefile.am include $(srcdir)/%D%/zpool_influxdb/Makefile.am include $(srcdir)/%D%/zstream/Makefile.am -include $(srcdir)/%D%/ztest/Makefile.am + if BUILD_LINUX -include $(srcdir)/%D%/mount_zfs/Makefile.am +mounthelper_PROGRAMS += mount.zfs +CPPCHECKTARGETS += mount.zfs + +mount_zfs_SOURCES = \ + %D%/mount_zfs.c + +mount_zfs_LDADD = \ + libzfs.la \ + libzfs_core.la \ + libnvpair.la + +mount_zfs_LDADD += $(LTLIBINTL) + +CPPCHECKTARGETS += raidz_test + + +sbin_PROGRAMS += zgenhostid +CPPCHECKTARGETS += zgenhostid + +zgenhostid_SOURCES = \ + %D%/zgenhostid.c + + +dist_bin_SCRIPTS += %D%/zvol_wait +SHELLCHECKSCRIPTS += %D%/zvol_wait + + include $(srcdir)/%D%/zed/Makefile.am -include $(srcdir)/%D%/zgenhostid/Makefile.am -include $(srcdir)/%D%/zvol_id/Makefile.am -include $(srcdir)/%D%/zvol_wait/Makefile.am endif + if USING_PYTHON -include $(srcdir)/%D%/arc_summary/Makefile.am -include $(srcdir)/%D%/arcstat/Makefile.am -include $(srcdir)/%D%/dbufstat/Makefile.am +bin_SCRIPTS += arc_summary arcstat dbufstat +CLEANFILES += arc_summary arcstat dbufstat +EXTRA_DIST += %D%/arc_summary %D%/arcstat.in %D%/dbufstat.in + +$(call SUBST,arcstat,%D%/) +$(call SUBST,dbufstat,%D%/) +arc_summary: %D%/arc_summary + $(AM_V_at)cp $< $@ endif + PHONY += cmd -cmd: $(bin_SCRIPTS) $(bin_PROGRAMS) $(sbin_SCRIPTS) $(sbin_PROGRAMS) $(udev_PROGRAMS) $(dist_bin_SCRIPTS) $(zfsexec_PROGRAMS) $(dist_udev_SCRIPTS) $(mounthelper_PROGRAMS) +cmd: $(bin_SCRIPTS) $(bin_PROGRAMS) $(sbin_SCRIPTS) $(sbin_PROGRAMS) $(dist_bin_SCRIPTS) $(zfsexec_PROGRAMS) $(mounthelper_PROGRAMS) diff --git a/cmd/arc_summary/arc_summary3 b/cmd/arc_summary similarity index 100% rename from cmd/arc_summary/arc_summary3 rename to cmd/arc_summary diff --git a/cmd/arc_summary/Makefile.am b/cmd/arc_summary/Makefile.am deleted file mode 100644 index 90dd981d96..0000000000 --- a/cmd/arc_summary/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_SCRIPTS += arc_summary -CLEANFILES += arc_summary - -EXTRA_DIST += %D%/arc_summary3 -ARC_SUMMARY = %D%/arc_summary3 - -arc_summary: $(ARC_SUMMARY) - $(AM_V_at)cp $< $@ diff --git a/cmd/arcstat/arcstat.in b/cmd/arcstat.in similarity index 100% rename from cmd/arcstat/arcstat.in rename to cmd/arcstat.in diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am deleted file mode 100644 index d7fd81074c..0000000000 --- a/cmd/arcstat/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_SCRIPTS += arcstat -CLEANFILES += arcstat -EXTRA_DIST += %D%/arcstat.in -$(call SUBST,arcstat,%D%/) diff --git a/cmd/dbufstat/dbufstat.in b/cmd/dbufstat.in similarity index 100% rename from cmd/dbufstat/dbufstat.in rename to cmd/dbufstat.in diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am deleted file mode 100644 index 107f35573d..0000000000 --- a/cmd/dbufstat/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_SCRIPTS += dbufstat -CLEANFILES += dbufstat -EXTRA_DIST += %D%/dbufstat.in -$(call SUBST,dbufstat,%D%/) diff --git a/cmd/fsck_zfs/fsck.zfs.in b/cmd/fsck.zfs.in similarity index 100% rename from cmd/fsck_zfs/fsck.zfs.in rename to cmd/fsck.zfs.in diff --git a/cmd/fsck_zfs/Makefile.am b/cmd/fsck_zfs/Makefile.am deleted file mode 100644 index a252e3d0cb..0000000000 --- a/cmd/fsck_zfs/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -sbin_SCRIPTS += fsck.zfs -SHELLCHECKSCRIPTS += fsck.zfs -CLEANFILES += fsck.zfs -EXTRA_DIST += %D%/fsck.zfs.in -$(call SUBST,fsck.zfs,%D%/) diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs.c similarity index 100% rename from cmd/mount_zfs/mount_zfs.c rename to cmd/mount_zfs.c diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am deleted file mode 100644 index 0ba61abe57..0000000000 --- a/cmd/mount_zfs/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# -# Ignore the prefix for the mount helper. It must be installed in /sbin/ -# because this path is hardcoded in the mount(8) for security reasons. -# However, if needed, the configure option --with-mounthelperdir= can be used -# to override the default install location. -# -mounthelper_PROGRAMS += mount.zfs -CPPCHECKTARGETS += mount.zfs - -mount_zfs_SOURCES = \ - %D%/mount_zfs.c - -mount_zfs_LDADD = \ - libzfs.la \ - libzfs_core.la \ - libnvpair.la - -mount_zfs_LDADD += $(LTLIBINTL) - -CPPCHECKTARGETS += raidz_test diff --git a/cmd/vdev_id/Makefile.am b/cmd/vdev_id/Makefile.am deleted file mode 100644 index ca57a9107c..0000000000 --- a/cmd/vdev_id/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -dist_udev_SCRIPTS += %D%/vdev_id -# TODO: #12084: SHELLCHECKSCRIPTS += %D%/vdev_id diff --git a/cmd/zfs_ids_to_path/zfs_ids_to_path.c b/cmd/zfs_ids_to_path.c similarity index 100% rename from cmd/zfs_ids_to_path/zfs_ids_to_path.c rename to cmd/zfs_ids_to_path.c diff --git a/cmd/zfs_ids_to_path/Makefile.am b/cmd/zfs_ids_to_path/Makefile.am deleted file mode 100644 index 09ddd81161..0000000000 --- a/cmd/zfs_ids_to_path/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -sbin_PROGRAMS += zfs_ids_to_path -CPPCHECKTARGETS += zfs_ids_to_path - -zfs_ids_to_path_SOURCES = \ - %D%/zfs_ids_to_path.c - -zfs_ids_to_path_LDADD = \ - libzfs.la diff --git a/cmd/zgenhostid/zgenhostid.c b/cmd/zgenhostid.c similarity index 100% rename from cmd/zgenhostid/zgenhostid.c rename to cmd/zgenhostid.c diff --git a/cmd/zgenhostid/Makefile.am b/cmd/zgenhostid/Makefile.am deleted file mode 100644 index 722950eb77..0000000000 --- a/cmd/zgenhostid/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -sbin_PROGRAMS += zgenhostid -CPPCHECKTARGETS += zgenhostid - -zgenhostid_SOURCES = \ - %D%/zgenhostid.c diff --git a/cmd/zhack/zhack.c b/cmd/zhack.c similarity index 100% rename from cmd/zhack/zhack.c rename to cmd/zhack.c diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am deleted file mode 100644 index 94fa76d142..0000000000 --- a/cmd/zhack/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -zhack_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS += zhack -CPPCHECKTARGETS += zhack - -zhack_SOURCES = \ - %D%/zhack.c - -zhack_LDADD = \ - libzpool.la \ - libzfs_core.la \ - libnvpair.la diff --git a/cmd/ztest/ztest.c b/cmd/ztest.c similarity index 100% rename from cmd/ztest/ztest.c rename to cmd/ztest.c diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am deleted file mode 100644 index e27643a446..0000000000 --- a/cmd/ztest/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -ztest_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) -# Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 -ztest_CFLAGS += $(NO_FORMAT_TRUNCATION) -ztest_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS += ztest -CPPCHECKTARGETS += ztest - -ztest_SOURCES = \ - %D%/ztest.c - -ztest_LDADD = \ - libzpool.la \ - libzfs_core.la \ - libnvpair.la - -ztest_LDADD += -lm -ztest_LDFLAGS = -pthread diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am deleted file mode 100644 index 7ba13205bc..0000000000 --- a/cmd/zvol_id/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -udev_PROGRAMS += zvol_id -CPPCHECKTARGETS += zvol_id - -zvol_id_SOURCES = \ - %D%/zvol_id_main.c diff --git a/cmd/zvol_wait/zvol_wait b/cmd/zvol_wait similarity index 100% rename from cmd/zvol_wait/zvol_wait rename to cmd/zvol_wait diff --git a/cmd/zvol_wait/Makefile.am b/cmd/zvol_wait/Makefile.am deleted file mode 100644 index 2d3736f756..0000000000 --- a/cmd/zvol_wait/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -dist_bin_SCRIPTS += %D%/zvol_wait -SHELLCHECKSCRIPTS += %D%/zvol_wait diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 586ead05b1..5a409484fe 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -35,6 +35,8 @@ export GDB="libtool --mode=execute gdb" export LDMOD=/sbin/insmod export CMD_DIR=$(abs_top_builddir) +export UDEV_SCRIPT_DIR=$(abs_top_srcdir)/udev +export UDEV_CMD_DIR=$(abs_top_builddir)/udev export UDEV_RULE_DIR=$(abs_top_builddir)/udev/rules.d export ZEDLET_ETC_DIR=$$CMD_DIR/cmd/zed/zed.d export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/cmd/zed/zed.d diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index 5fa932dcce..8dcb063012 100755 --- a/scripts/zfs-helpers.sh +++ b/scripts/zfs-helpers.sh @@ -156,7 +156,7 @@ if [ "${INSTALL}" = "yes" ]; then for cmd in "mount.zfs" "fsck.zfs"; do install "$CMD_DIR/$cmd" "$INSTALL_MOUNT_HELPER_DIR/$cmd" done - for udev in "$CMD_DIR/zvol_id" "$UDEV_SCRIPT_DIR/vdev_id"; do + for udev in "$UDEV_CMD_DIR/zvol_id" "$UDEV_SCRIPT_DIR/vdev_id"; do install "$udev" "$INSTALL_UDEV_DIR/${udev##*/}" done for rule in "60-zvol.rules" "69-vdev.rules" "90-zfs.rules"; do diff --git a/udev/.gitignore b/udev/.gitignore new file mode 100644 index 0000000000..4f5af11ae0 --- /dev/null +++ b/udev/.gitignore @@ -0,0 +1 @@ +/zvol_id diff --git a/udev/Makefile.am b/udev/Makefile.am index 27d45a36a4..6fd645b5c2 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -4,3 +4,15 @@ udevrule_DATA = \ %D%/rules.d/90-zfs.rules SUBSTFILES += $(udevrule_DATA) + + +dist_udev_SCRIPTS = %D%/vdev_id +# TODO: #12084: SHELLCHECKSCRIPTS += %D%/vdev_id + + +udev_PROGRAMS = %D%/zvol_id +CPPCHECKTARGETS += %D%/zvol_id + + +PHONY += udev +udev: $(dist_udev_SCRIPTS) $(udev_PROGRAMS) diff --git a/cmd/vdev_id/vdev_id b/udev/vdev_id similarity index 100% rename from cmd/vdev_id/vdev_id rename to udev/vdev_id diff --git a/cmd/zvol_id/zvol_id_main.c b/udev/zvol_id.c similarity index 100% rename from cmd/zvol_id/zvol_id_main.c rename to udev/zvol_id.c