From 71c68185e69bd0f5fd5a3a988bed07dc3c907666 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Wed, 20 Feb 2019 02:40:01 +0000 Subject: [PATCH] openafs_1_8: Include support for Linux 4.20 OpenAFS version 1.8.2 does not have support for Linux 4.20, meaning that linuxPackages_latest.openafs_1_8 would fail to build. This patch adds patches taken from the OpenAFS git to remove the references to deprecated functions. This has been tested on Linux 4.20 and Linux 4.14 This patch must be removed when OpenAFS 1.8.3 is released and improved when Linux 5.0 is added to Nix --- pkgs/servers/openafs/1.8/linux-4.20.patch | 62 +++++++++++++++++++++++ pkgs/servers/openafs/1.8/module.nix | 2 + 2 files changed, 64 insertions(+) create mode 100644 pkgs/servers/openafs/1.8/linux-4.20.patch diff --git a/pkgs/servers/openafs/1.8/linux-4.20.patch b/pkgs/servers/openafs/1.8/linux-4.20.patch new file mode 100644 index 000000000000..bb896d82b693 --- /dev/null +++ b/pkgs/servers/openafs/1.8/linux-4.20.patch @@ -0,0 +1,62 @@ +--- a/src/afs/LINUX/osi_machdep.h ++++ b/src/afs/LINUX/osi_machdep.h +@@ -75,7 +75,14 @@ + #if defined(HAVE_LINUX_CRED_H) + #include "h/cred.h" + #endif +-#if defined(HAVE_LINUX_CURRENT_KERNEL_TIME) ++ ++#if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64) ++static inline time_t osi_Time(void) { ++ struct timespec64 xtime; ++ ktime_get_coarse_real_ts64(&xtime); ++ return xtime.tv_sec; ++} ++#elif defined(HAVE_LINUX_CURRENT_KERNEL_TIME) + static inline time_t osi_Time(void) { + struct timespec xtime; + xtime = current_kernel_time(); +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -72,6 +72,10 @@ AC_CHECK_LINUX_FUNC([iter_file_splice_write], + AC_CHECK_LINUX_FUNC([kernel_setsockopt], + [#include ], + [kernel_setsockopt(NULL, 0, 0, NULL, 0);]) ++AC_CHECK_LINUX_FUNC([ktime_get_coarse_real_ts64], ++ [#include ], ++ [struct timespec64 *s; ++ ktime_get_coarse_real_ts64(s);]) + AC_CHECK_LINUX_FUNC([locks_lock_file_wait], + [#include ], + [locks_lock_file_wait(NULL, NULL);]) +--- a/src/afs/LINUX/osi_misc.c ++++ b/src/afs/LINUX/osi_misc.c +@@ -28,18 +28,6 @@ + int afs_osicred_initialized = 0; + afs_ucred_t afs_osi_cred; + +-void +-afs_osi_SetTime(osi_timeval_t * tvp) +-{ +- struct timespec tv; +- tv.tv_sec = tvp->tv_sec; +- tv.tv_nsec = tvp->tv_usec * NSEC_PER_USEC; +- +- AFS_STATCNT(osi_SetTime); +- +- do_settimeofday(&tv); +-} +- + void + osi_linux_mask(void) + { +--- a/src/afs/LINUX/osi_prototypes.h ++++ b/src/afs/LINUX/osi_prototypes.h +@@ -45,7 +45,6 @@ extern void osi_ioctl_init(void); + extern void osi_ioctl_clean(void); + + /* osi_misc.c */ +-extern void afs_osi_SetTime(osi_timeval_t * tvp); + extern int osi_lookupname_internal(char *aname, int followlink, + struct vfsmount **mnt, struct dentry **dpp); + extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink, diff --git a/pkgs/servers/openafs/1.8/module.nix b/pkgs/servers/openafs/1.8/module.nix index 958fcd578c2b..36a73bf5878b 100644 --- a/pkgs/servers/openafs/1.8/module.nix +++ b/pkgs/servers/openafs/1.8/module.nix @@ -11,6 +11,8 @@ in stdenv.mkDerivation rec { name = "openafs-${version}-${kernel.modDirVersion}"; inherit version src; + patches = [ ./linux-4.20.patch ]; + nativeBuildInputs = [ autoconf automake flex libtool_2 perl which yacc ] ++ kernel.moduleBuildDependencies;