about summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorArtemis Tosini <me@artem.ist>2019-02-20 02:40:01 +0000
committerArtemis Tosini <me@artem.ist>2019-02-20 02:45:11 +0000
commit71c68185e69bd0f5fd5a3a988bed07dc3c907666 (patch)
treefe1abdc238ee126987e4fb8458d410f8ca54e247 /pkgs/servers
parentfa82ebccf66eef185d063d49a9e294a7a1e15d36 (diff)
downloadnixlib-71c68185e69bd0f5fd5a3a988bed07dc3c907666.tar
nixlib-71c68185e69bd0f5fd5a3a988bed07dc3c907666.tar.gz
nixlib-71c68185e69bd0f5fd5a3a988bed07dc3c907666.tar.bz2
nixlib-71c68185e69bd0f5fd5a3a988bed07dc3c907666.tar.lz
nixlib-71c68185e69bd0f5fd5a3a988bed07dc3c907666.tar.xz
nixlib-71c68185e69bd0f5fd5a3a988bed07dc3c907666.tar.zst
nixlib-71c68185e69bd0f5fd5a3a988bed07dc3c907666.zip
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
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/openafs/1.8/linux-4.20.patch62
-rw-r--r--pkgs/servers/openafs/1.8/module.nix2
2 files changed, 64 insertions, 0 deletions
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 <linux/net.h>],
+                     [kernel_setsockopt(NULL, 0, 0, NULL, 0);])
++AC_CHECK_LINUX_FUNC([ktime_get_coarse_real_ts64],
++                    [#include <linux/time.h>],
++                    [struct timespec64 *s;
++                    ktime_get_coarse_real_ts64(s);])
+ AC_CHECK_LINUX_FUNC([locks_lock_file_wait],
+                     [#include <linux/fs.h>],
+                     [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;