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
This commit is contained in:
Artemis Tosini 2019-02-20 02:40:01 +00:00
parent fa82ebccf6
commit 71c68185e6
No known key found for this signature in database
GPG Key ID: EE5227935FE3FF18
2 changed files with 64 additions and 0 deletions

View File

@ -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,

View File

@ -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;