From 357f51b93d33fa48a4266adf0576e3c2e1c40bbd Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Thu, 7 Mar 2019 13:34:16 -0500 Subject: [PATCH] openafs: Add support for Linux 5.0 to openafs_1_8 (#56859) OpenAFS 1.8.2 does has not yet merged support for Linux 4.20 or 5.0 This patch cherry-picks commits from the git repository, and includes them in the patches/ directory. This also replaces the amalgamated Linux 4.20 patches I added earlier with the original outputs from `git show`. This has been tested to build on Linux 4.4, 4.14, 4.20, and 5.0. This does not change the derivations of openafs_1_8, only linuxPackages_*.openafs_1_8. --- pkgs/servers/openafs/1.8/linux-4.20.patch | 62 ----------------------- pkgs/servers/openafs/1.8/module.nix | 32 +++++++++++- 2 files changed, 30 insertions(+), 64 deletions(-) delete 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 deleted file mode 100644 index bb896d82b693..000000000000 --- a/pkgs/servers/openafs/1.8/linux-4.20.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- 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 36a73bf5878b..38305a11bcc2 100644 --- a/pkgs/servers/openafs/1.8/module.nix +++ b/pkgs/servers/openafs/1.8/module.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, which, autoconf, automake, flex, yacc +{ stdenv, fetchurl, fetchpatch, which, autoconf, automake, flex, yacc , kernel, glibc, perl, libtool_2, kerberos }: with (import ./srcs.nix { inherit fetchurl; }); @@ -11,7 +11,35 @@ in stdenv.mkDerivation rec { name = "openafs-${version}-${kernel.modDirVersion}"; inherit version src; - patches = [ ./linux-4.20.patch ]; + patches = [ + # Linux 4.20 + (fetchpatch { + name = "openafs_1_8-do_settimeofday.patch"; + url = "http://git.openafs.org/?p=openafs.git;a=patch;h=aa80f892ec39e2984818090a6bb2047430836ee2"; + sha256 = "11zw676zqi9sj3vhp7n7ndxcxhp17cq9g2g41n030mcd3ap4g53h"; + }) + (fetchpatch { + name = "openafs_1_8-current_kernel_time.patch"; + url = "http://git.openafs.org/?p=openafs.git;a=patch;h=3c454b39d04f4886536267c211171dae30dc0344"; + sha256 = "16fl9kp0l95dqm166jx3x4ijbzhf2bc9ilnipn3k1j00mfy4lnia"; + }) + # Linux 5.0 + (fetchpatch { + name = "openafs_1_8-ktime_get_coarse_real_ts64.patch"; + url = "http://git.openafs.org/?p=openafs.git;a=patch;h=21ad6a0c826c150c4227ece50554101641ab4626"; + sha256 = "0cd2bzfn4gkb68qf27wpgcg9kvaky7kll22b8p2vmw5x4xkckq2y"; + }) + (fetchpatch { + name = "openafs_1_8-ktime_get_real_ts64.patch"; + url = "http://git.openafs.org/?p=openafs.git;a=patch;h=b892fb127815bdf72103ae41ee70aadd87931b0c"; + sha256 = "1xmf2l4g5nb9rhca7zn0swynvq8f9pd0k9drsx9bpnwp662y9l8m"; + }) + (fetchpatch { + name = "openafs_1_8-super_block.patch"; + url = "http://git.openafs.org/?p=openafs.git;a=patch;h=3969bbca6017eb0ce6e1c3099b135f210403f661"; + sha256 = "0cdd76s1h1bhxj0hl7r6mcha1jcy5vhlvc5dc8m2i83a6281yjsa"; + }) + ]; nativeBuildInputs = [ autoconf automake flex libtool_2 perl which yacc ] ++ kernel.moduleBuildDependencies;