From cfb4ebb141e5f5625c4ec9a42e8a84e7ebda1104 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 27 Aug 2018 14:30:35 +0100 Subject: sys-fs/{spl,zfs} : kernel 4.18 compat --- sys-fs/spl-utils/files/kernel-4.18.patch | 173 +++++++++++++++++++++++++++++ sys-fs/spl-utils/spl-utils-0.7.9-r1.ebuild | 61 ++++++++++ sys-fs/spl-utils/spl-utils-0.7.9.ebuild | 60 ---------- 3 files changed, 234 insertions(+), 60 deletions(-) create mode 100644 sys-fs/spl-utils/files/kernel-4.18.patch create mode 100644 sys-fs/spl-utils/spl-utils-0.7.9-r1.ebuild delete mode 100644 sys-fs/spl-utils/spl-utils-0.7.9.ebuild (limited to 'sys-fs/spl-utils') diff --git a/sys-fs/spl-utils/files/kernel-4.18.patch b/sys-fs/spl-utils/files/kernel-4.18.patch new file mode 100644 index 00000000..deae22fb --- /dev/null +++ b/sys-fs/spl-utils/files/kernel-4.18.patch @@ -0,0 +1,173 @@ +From 80f801afe5ab42bdd363eed21faf7ef711404ba7 Mon Sep 17 00:00:00 2001 +From: Brian Behlendorf +Date: Sun, 12 Aug 2018 18:22:54 -0400 +Subject: [PATCH] Linux 4.18 compat: inode timespec -> timespec64 + +Commit torvalds/linux@95582b0 changes the inode i_atime, i_mtime, +and i_ctime members form timespec's to timespec64's to make them +2038 safe. As part of this change the current_time() function was +also updated to return the timespec64 type. + +Resolve this issue by introducing a new inode_timespec_t type which +is defined to match the timespec type used by the inode. It should +be used when working with inode timestamps to ensure matching types. + +The timestruc_t type under Illumos was used in a similar fashion but +was specified to always be a timespec_t. Rather than incorrectly +define this type all timespec_t types have been replaced by the new +inode_timespec_t type. + +Finally, the kernel and user space 'sys/time.h' headers were aligned +with each other. They define as appropriate for the context several +constants as macros and include static inline implementation of +gethrestime(), gethrestime_sec(), and gethrtime(). + +Reviewed-by: Chunwei Chen +Signed-off-by: Brian Behlendorf +Closes #7643 +Backported-by: Richard Yao +--- + config/kernel-inode-times.m4 | 25 +++++++++++++++++++++++++ + config/spl-build.m4 | 1 + + include/sys/condvar.h | 1 + + include/sys/time.h | 25 +++++++++++++++++++------ + include/sys/types.h | 3 --- + include/sys/vnode.h | 6 +++--- + 6 files changed, 49 insertions(+), 12 deletions(-) + create mode 100644 config/kernel-inode-times.m4 + +diff --git a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4 +new file mode 100644 +index 00000000..3a6acd8b +--- /dev/null ++++ b/config/kernel-inode-times.m4 +@@ -0,0 +1,25 @@ ++dnl # ++dnl # 4.18 API change ++dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64. ++dnl # ++AC_DEFUN([SPL_AC_KERNEL_INODE_TIMES], [ ++ AC_MSG_CHECKING([whether inode->i_*time's are timespec64]) ++ tmp_flags="$EXTRA_KCFLAGS" ++ EXTRA_KCFLAGS="-Werror" ++ SPL_LINUX_TRY_COMPILE([ ++ #include ++ ],[ ++ struct inode ip; ++ struct timespec ts; ++ ++ memset(&ip, 0, sizeof(ip)); ++ ts = ip.i_mtime; ++ ],[ ++ AC_MSG_RESULT(no) ++ ],[ ++ AC_MSG_RESULT(yes) ++ AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1, ++ [inode->i_*time's are timespec64]) ++ ]) ++ EXTRA_KCFLAGS="$tmp_flags" ++]) +diff --git a/config/spl-build.m4 b/config/spl-build.m4 +index 5c6c02af..0dc5be81 100644 +--- a/config/spl-build.m4 ++++ b/config/spl-build.m4 +@@ -43,6 +43,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ + SPL_AC_2ARGS_VFS_GETATTR + SPL_AC_USLEEP_RANGE + SPL_AC_KMEM_CACHE_ALLOCFLAGS ++ SPL_AC_KERNEL_INODE_TIMES + SPL_AC_WAIT_ON_BIT + SPL_AC_INODE_LOCK + SPL_AC_GROUP_INFO_GID +diff --git a/include/sys/condvar.h b/include/sys/condvar.h +index 5fcc9068..ce3149aa 100644 +--- a/include/sys/condvar.h ++++ b/include/sys/condvar.h +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + /* + * The kcondvar_t struct is protected by mutex taken externally before +diff --git a/include/sys/time.h b/include/sys/time.h +index ddda6dea..59557afd 100644 +--- a/include/sys/time.h ++++ b/include/sys/time.h +@@ -52,15 +52,28 @@ + #define NSEC2SEC(n) ((n) / (NANOSEC / SEC)) + #define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC)) + ++typedef longlong_t hrtime_t; ++typedef struct timespec timespec_t; ++ + static const int hz = HZ; + + #define TIMESPEC_OVERFLOW(ts) \ + ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX) + ++#if defined(HAVE_INODE_TIMESPEC64_TIMES) ++typedef struct timespec64 inode_timespec_t; ++#else ++typedef struct timespec inode_timespec_t; ++#endif ++ + static inline void +-gethrestime(timestruc_t *now) +-{ +- *now = current_kernel_time(); ++gethrestime(inode_timespec_t *ts) ++ { ++#if defined(HAVE_INODE_TIMESPEC64_TIMES) ++ *ts = current_kernel_time64(); ++#else ++ *ts = current_kernel_time(); ++#endif + } + + static inline time_t +@@ -74,9 +87,9 @@ gethrestime_sec(void) + static inline hrtime_t + gethrtime(void) + { +- struct timespec now; +- getrawmonotonic(&now); +- return (((hrtime_t)now.tv_sec * NSEC_PER_SEC) + now.tv_nsec); ++ struct timespec ts; ++ getrawmonotonic(&ts); ++ return (((hrtime_t)ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec); + } + + #endif /* _SPL_TIME_H */ +diff --git a/include/sys/types.h b/include/sys/types.h +index 2fe63b73..b9584622 100644 +--- a/include/sys/types.h ++++ b/include/sys/types.h +@@ -49,9 +49,6 @@ typedef long long offset_t; + typedef struct task_struct kthread_t; + typedef struct task_struct proc_t; + typedef short pri_t; +-typedef struct timespec timestruc_t; /* definition per SVr4 */ +-typedef struct timespec timespec_t; +-typedef longlong_t hrtime_t; + typedef unsigned short ushort_t; + typedef u_longlong_t len_t; + typedef longlong_t diskaddr_t; +diff --git a/include/sys/vnode.h b/include/sys/vnode.h +index 0ed47948..87f12d66 100644 +--- a/include/sys/vnode.h ++++ b/include/sys/vnode.h +@@ -129,9 +129,9 @@ typedef struct vattr { + long va_nodeid; /* node # */ + uint32_t va_nlink; /* # links */ + uint64_t va_size; /* file size */ +- struct timespec va_atime; /* last acc */ +- struct timespec va_mtime; /* last mod */ +- struct timespec va_ctime; /* last chg */ ++ inode_timespec_t va_atime; /* last acc */ ++ inode_timespec_t va_mtime; /* last mod */ ++ inode_timespec_t va_ctime; /* last chg */ + dev_t va_rdev; /* dev */ + uint64_t va_nblocks; /* space used */ + uint32_t va_blksize; /* block size */ diff --git a/sys-fs/spl-utils/spl-utils-0.7.9-r1.ebuild b/sys-fs/spl-utils/spl-utils-0.7.9-r1.ebuild new file mode 100644 index 00000000..d9679ac1 --- /dev/null +++ b/sys-fs/spl-utils/spl-utils-0.7.9-r1.ebuild @@ -0,0 +1,61 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="5" +inherit flag-o-matic autotools-utils + +MY_PN="spl" +MY_P="${MY_PN}-${PV}" + +SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/${MY_P}.tar.gz" + +DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs" +HOMEPAGE="http://zfsonlinux.org/" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64" +IUSE="debug" + +RESTRICT="debug? ( strip ) test" + +S="${WORKDIR}/${MY_P}" + +COMMON_DEPEND="dev-lang/perl + virtual/awk" +DEPEND="${COMMON_DEPEND}" +RDEPEND="${COMMON_DEPEND} + !sys-devel/spl" + +AT_M4DIR="config" +AUTOTOOLS_IN_SOURCE_BUILD="1" + +DOCS=( AUTHORS DISCLAIMER ) + +src_prepare() { + epatch "${FILESDIR}/kernel-4.18.patch" + # Workaround for hard coded path + sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \ + die "Cannot patch check.sh" + + # splat is unnecessary unless we are debugging + use debug || { sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in" || die ; } + + # Set module revision number + [ ${PV} != "9999" ] && \ + { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-redcore/" "${S}/META" || die "Could not set Redcore release"; } + + autotools-utils_src_prepare +} + +src_configure() { + filter-ldflags -Wl,* + + local myeconfargs=( + --bindir="${EPREFIX}/bin" + --sbindir="${EPREFIX}/sbin" + --with-config=user + $(use_enable debug) + ) + autotools-utils_src_configure +} diff --git a/sys-fs/spl-utils/spl-utils-0.7.9.ebuild b/sys-fs/spl-utils/spl-utils-0.7.9.ebuild deleted file mode 100644 index 02a1ed1b..00000000 --- a/sys-fs/spl-utils/spl-utils-0.7.9.ebuild +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI="5" -inherit flag-o-matic autotools-utils - -MY_PN="spl" -MY_P="${MY_PN}-${PV}" - -SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/${MY_P}.tar.gz" - -DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs" -HOMEPAGE="http://zfsonlinux.org/" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="amd64" -IUSE="debug" - -RESTRICT="debug? ( strip ) test" - -S="${WORKDIR}/${MY_P}" - -COMMON_DEPEND="dev-lang/perl - virtual/awk" -DEPEND="${COMMON_DEPEND}" -RDEPEND="${COMMON_DEPEND} - !sys-devel/spl" - -AT_M4DIR="config" -AUTOTOOLS_IN_SOURCE_BUILD="1" - -DOCS=( AUTHORS DISCLAIMER ) - -src_prepare() { - # Workaround for hard coded path - sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \ - die "Cannot patch check.sh" - - # splat is unnecessary unless we are debugging - use debug || { sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in" || die ; } - - # Set module revision number - [ ${PV} != "9999" ] && \ - { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-redcore/" "${S}/META" || die "Could not set Redcore release"; } - - autotools-utils_src_prepare -} - -src_configure() { - filter-ldflags -Wl,* - - local myeconfargs=( - --bindir="${EPREFIX}/bin" - --sbindir="${EPREFIX}/sbin" - --with-config=user - $(use_enable debug) - ) - autotools-utils_src_configure -} -- cgit v1.2.3