From 3c72bef6bd5ccb56d531d78ddea997140e1529ec Mon Sep 17 00:00:00 2001 From: Ameer Hamza Date: Tue, 20 Jun 2023 05:39:47 +0500 Subject: [PATCH] Adjust zfsd Makefiles for openzfs compatibility Signed-off-by: Ameer Hamza --- Makefile.am | 2 +- cmd/Makefile.am | 3 +++ cmd/zfsd/Makefile.am | 32 +++++++++++++++++--------------- etc/Makefile.am | 9 +++++++++ include/sys/zfs_context.h | 2 ++ 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index 76ec01f2aa..f49766a45a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -119,7 +119,7 @@ cstyle_line = -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} + endif CHECKS += cstyle cstyle: - $(AM_V_at)find $(top_srcdir) -name build -prune \ + $(AM_V_at)find $(top_srcdir) -name build -prune -o -name zfsd -prune \ -o -type f -name '*.[hc]' \ ! -name 'zfs_config.*' ! -name '*.mod.c' \ ! -name 'nfs41acl_xdr.c' ! -name 'nfs41acl.h' \ diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 6d6de4adb4..da6cd52aac 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -66,6 +66,9 @@ include $(srcdir)/%D%/zpool/Makefile.am include $(srcdir)/%D%/zpool_influxdb/Makefile.am include $(srcdir)/%D%/zstream/Makefile.am +if BUILD_FREEBSD +include $(srcdir)/%D%/zfsd/Makefile.am +endif if BUILD_LINUX mounthelper_PROGRAMS += mount.zfs diff --git a/cmd/zfsd/Makefile.am b/cmd/zfsd/Makefile.am index 2348b8a1b6..0371d389be 100644 --- a/cmd/zfsd/Makefile.am +++ b/cmd/zfsd/Makefile.am @@ -1,23 +1,25 @@ -include $(top_srcdir)/config/Rules.am +zfsd_CFLAGS = $(AM_CFLAGS) +zfsd_CXXFLAGS = $(AM_CXXFLAGS) +zfsd_CPPFLAGS = $(AM_CPPFLAGS) -sbin_PROGRAMS = zfsd +sbin_PROGRAMS += zfsd zfsd_SOURCES = \ - callout.cc \ - case_file.cc \ - vdev.cc \ - vdev_iterator.cc \ - zfsd.cc \ - zfsd_event.cc \ - zfsd_exception.cc \ - zfsd_main.cc \ - zpool_list.cc + %D%/callout.cc \ + %D%/case_file.cc \ + %D%/vdev.cc \ + %D%/vdev_iterator.cc \ + %D%/zfsd.cc \ + %D%/zfsd_event.cc \ + %D%/zfsd_exception.cc \ + %D%/zfsd_main.cc \ + %D%/zpool_list.cc zfsd_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + libnvpair.la \ + libuutil.la \ + libzfs_core.la \ + libzfs.la zfsd_LDADD += -lrt -lprivatedevdctl -lgeom -lbsdxml -lsbuf zfsd_LDFLAGS = -pthread diff --git a/etc/Makefile.am b/etc/Makefile.am index 7187762d38..30ee1df4d3 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -21,6 +21,15 @@ SUBSTFILES += $(sysconf_zfs_DATA) SHELLCHECKSCRIPTS += $(sysconf_zfs_DATA) $(call SHELLCHECK_OPTS,$(sysconf_zfs_DATA)): SHELLCHECK_SHELL = sh +if BUILD_FREEBSD +sysconf_zfsddir = $(sysconfdir)/rc.d + +sysconf_zfsd_DATA = %D%/rc.d/zfsd + +SUBSTFILES += $(sysconf_zfsd_DATA) +SHELLCHECKSCRIPTS += $(sysconf_zfsd_DATA) +$(call SHELLCHECK_OPTS,$(sysconf_zfsd_DATA)): SHELLCHECK_SHELL = sh +endif if BUILD_LINUX initconf_DATA = \ diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 0d31195447..6a337b49ed 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -695,8 +695,10 @@ extern char *kmem_asprintf(const char *fmt, ...); #define kmem_strfree(str) kmem_free((str), strlen(str) + 1) #define kmem_strdup(s) strdup(s) +#ifndef __cplusplus extern int kmem_scnprintf(char *restrict str, size_t size, const char *restrict fmt, ...); +#endif /* * Hostname information