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.
This commit is contained in:
Artemis Tosini 2019-03-07 13:34:16 -05:00 committed by Dmitry Kalinkin
parent 34e67f3f9f
commit 357f51b93d
2 changed files with 30 additions and 64 deletions

View File

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

@ -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 }: , kernel, glibc, perl, libtool_2, kerberos }:
with (import ./srcs.nix { inherit fetchurl; }); with (import ./srcs.nix { inherit fetchurl; });
@ -11,7 +11,35 @@ in stdenv.mkDerivation rec {
name = "openafs-${version}-${kernel.modDirVersion}"; name = "openafs-${version}-${kernel.modDirVersion}";
inherit version src; 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 ] nativeBuildInputs = [ autoconf automake flex libtool_2 perl which yacc ]
++ kernel.moduleBuildDependencies; ++ kernel.moduleBuildDependencies;