SHA256
1
0
forked from pool/openafs
openafs/63801cf.diff
Christof Hanke 709654e78b Accepting request 1114718 from home:hauky:branches:filesystems
- apply upstream-patches for kernel 6.5: 
  * 63801cf.diff
  * d15c7ab.diff
  * fef2457.diff
  * 538f450.diff
  * 474750a.diff

OBS-URL: https://build.opensuse.org/request/show/1114718
OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=111
2023-10-02 07:54:59 +00:00

100 lines
3.4 KiB
Diff

From 63801cfd1fc06ec3259fcfd67229f3a3c70447ed Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Thu, 13 Jul 2023 10:54:22 -0600
Subject: [PATCH] Linux 6.5: Use register_sysctl()
The linux 6.5 commit:
"sysctl: Remove register_sysctl_table" (b8cbc0855a)
removed the Linux function register_sysctl_table(). The replacement
function is register_sysctl(), which offers a simpler interface.
Add an autoconf test for the Linux function register_sysctl and add a
call to register_sysctl when available.
Notes:
The Linux function register_sysctl was added in Linux 3.3 with the
commit:
'sysctl: Add register_sysctl for normal sysctl users' (fea478d410)
with a note that it is a simpler interface.
The function register_sysctl_table was marked as deprecated with the
Linux 6.3 commit:
'proc_sysctl: enhance documentation' (1dc8689e4c)
Reviewed-on: https://gerrit.openafs.org/15500
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit fb31d299e6caa015f6288ba9186da6277d3d6a8d)
Change-Id: I60f68f1dd95c32bada7179e98250fd44d7c2ddf3
Reviewed-on: https://gerrit.openafs.org/15522
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
---
diff --git a/src/afs/LINUX/osi_sysctl.c b/src/afs/LINUX/osi_sysctl.c
index 894c494..a0a0398 100644
--- a/src/afs/LINUX/osi_sysctl.c
+++ b/src/afs/LINUX/osi_sysctl.c
@@ -79,7 +79,7 @@
.procname = 0
}
};
-
+# if !defined(HAVE_LINUX_REGISTER_SYSCTL)
static struct ctl_table fs_sysctl_table[] = {
{
AFS_SYSCTL_NAME(1)
@@ -91,11 +91,13 @@
.procname = 0
}
};
-
+# endif
int
osi_sysctl_init(void)
{
-# if defined(REGISTER_SYSCTL_TABLE_NOFLAG)
+# if defined(HAVE_LINUX_REGISTER_SYSCTL)
+ afs_sysctl = register_sysctl("afs", afs_sysctl_table);
+# elif defined(REGISTER_SYSCTL_TABLE_NOFLAG)
afs_sysctl = register_sysctl_table(fs_sysctl_table);
# else
afs_sysctl = register_sysctl_table(fs_sysctl_table, 0);
diff --git a/src/cf/linux-kernel-assorted.m4 b/src/cf/linux-kernel-assorted.m4
index 03d5f65..b3a11bc 100644
--- a/src/cf/linux-kernel-assorted.m4
+++ b/src/cf/linux-kernel-assorted.m4
@@ -39,7 +39,9 @@
LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
LINUX_KEY_ALLOC_NEEDS_CRED
LINUX_INIT_WORK_HAS_DATA
-LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
+dnl Don't bother checking register_sysctl_table if using register_sysctl
+AS_IF([test "x$ac_cv_linux_func_register_sysctl" != "xyes"],
+ [LINUX_REGISTER_SYSCTL_TABLE_NOFLAG])
LINUX_HAVE_DCACHE_LOCK
LINUX_D_COUNT_IS_INT
LINUX_IOP_GETATTR_TAKES_PATH_STRUCT
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
index ee22158..8119549 100644
--- a/src/cf/linux-kernel-func.m4
+++ b/src/cf/linux-kernel-func.m4
@@ -217,6 +217,14 @@
#include <linux/buffer_head.h>],
[block_dirty_folio(NULL, NULL);])
+dnl Linux 6.5 removed the Linux function register_sysctl_table(), which
+dnl was deprecated in Linux 6.3 in favor of register_sysctl() which was
+dnl introduced in Linux 3.3
+AC_CHECK_LINUX_FUNC([register_sysctl],
+ [#include <linux/kernel.h>
+ #include <linux/sysctl.h>],
+ [(void)register_sysctl(NULL, NULL);])
+
dnl Consequences - things which get set as a result of the
dnl above tests
AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],