Contributing is becoming more and more difficult. I'll split the
message into two.

This is: 2/2

Hi,

for some reason I cannot push changes to Gerrit anymore and posting git
patches to the mailing list does not work either. I've spent too much
time on this already.

I've adapted the patches required to get OpenAFS running on Linux 5.17
to the 1.8.8.1 branch. They are attached to this mail. Maybe someone
else can feed them into Gerrit for review?

Best regards,
Michael



Am Mittwoch, dem 30.03.2022 um 18:20 -0400 schrieb
openafs-devel-ad...@openafs.org:
> Your mail to 'OpenAFS-devel' with the subject
> 
>     Patches to get OpenAFS 1.8.8.1 running on Linux 5.17
> 
> Is being held until the list moderator can review it for approval.
> 
> The reason it is being held:
> 
>     Message body is too big: 47157 bytes but there's a limit of 40 KB
> 
> Either the message will get posted to the list, or you will receive
> notification of the moderator's decision.

From a714e865efe41aa1112f6f9c8479112660dacd6f Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwi...@sinenomine.net>
Date: Thu, 27 Jan 2022 20:19:17 -0700
Subject: [PATCH 4/5] Linux-5.17: kernel func complete_and_exit renamed

Handle the Linux kernel function rename made in commit
 "exit: Rename complete_and_exit to kthread_complete_and_exit"
 (cead1855)

Add a new autoconf test for the linux function kthread_complete_and_exit
and if not found use a define to map kthread_complete_and_exit to
complete_and_exit.

Replace calls to complete_and_exit with kthread_complete_and_exit.

Reviewed-on: https://gerrit.openafs.org/14882
Tested-by: BuildBot <build...@rampaginggeek.com>
Reviewed-by: Andrew Deason <adea...@sinenomine.net>
Reviewed-by: Benjamin Kaduk <ka...@mit.edu>
(cherry picked from commit a651d4db7f86a24ea6784f6f27d5c8482667267b)

Change-Id: Ibe96b92a84a8f876dda4019c221c37dabde93244
---
 src/afs/LINUX/osi_compat.h  |  4 ++++
 src/afs/afs_call.c          | 18 ++++++++++--------
 src/cf/linux-kernel-func.m4 |  6 ++++++
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index 726b6559c..53a079b67 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -27,6 +27,10 @@
 # endif
 #endif
 
+#if !defined(HAVE_LINUX_KTHREAD_COMPLETE_AND_EXIT)
+# define kthread_complete_and_exit complete_and_exit
+#endif
+
 #if defined(STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT) && !defined(DCACHE_NEED_AUTOMOUNT)
 # define DCACHE_NEED_AUTOMOUNT DMANAGED_AUTOMOUNT
 #endif
diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c
index 32ad210c4..fab4c01ed 100644
--- a/src/afs/afs_call.c
+++ b/src/afs/afs_call.c
@@ -19,7 +19,9 @@
 #include "afs/afs_stats.h"
 #include "rx/rx_globals.h"
 #if !defined(UKERNEL)
-# if !defined(AFS_LINUX20_ENV)
+# if defined(AFS_LINUX20_ENV)
+#  include "osi_compat.h"
+# else
 #  include "net/if.h"
 #  ifdef AFS_SGI62_ENV
 #   include "h/hashing.h"
@@ -328,7 +330,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_callback");
 	afs_RXCallBackServer();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_AFS:
 	sprintf(current->comm, "afs_afsstart");
@@ -342,7 +344,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afsd");
 	afs_Daemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_BKG:
 #ifdef AFS_NEW_BKG
@@ -361,7 +363,7 @@ afsd_thread(void *rock)
 	afs_BackgroundDaemon();
 	AFS_GUNLOCK();
 #endif
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_TRUNCDAEMON:
 	sprintf(current->comm, "afs_trimstart");
@@ -372,7 +374,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_cachetrim");
 	afs_CacheTruncateDaemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_CS:
 	sprintf(current->comm, "afs_checkserver");
@@ -380,7 +382,7 @@ afsd_thread(void *rock)
 	complete(arg->complete);
 	afs_CheckServerDaemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_RXEVENT_DAEMON:
 	sprintf(current->comm, "afs_evtstart");
@@ -398,7 +400,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_rxevent");
 	afs_rxevent_daemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
 #ifdef RXK_LISTENER_ENV
     case AFSOP_RXLISTENER_DAEMON:
@@ -420,7 +422,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_rxlistener");
 	rxk_Listener();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
 #endif
     default:
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
index 0ca3e4463..cd4afe914 100644
--- a/src/cf/linux-kernel-func.m4
+++ b/src/cf/linux-kernel-func.m4
@@ -178,6 +178,12 @@ AC_CHECK_LINUX_FUNC([ip_sock_set],
                     [#include <net/ip.h>],
                     [ip_sock_set_mtu_discover(NULL, 0);])
 
+dnl Linux 5.17 renamed complete_and_exit to kthread_complete_and_exit
+AC_CHECK_LINUX_FUNC([kthread_complete_and_exit],
+                    [#include <linux/kernel.h>
+                     #include <linux/kthread.h>],
+                    [kthread_complete_and_exit(0, 0);])
+
 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"],
-- 
2.35.1

From 449d1faf87e2841e80be38cf2b4a5cf5ff4df2d8 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwi...@sinenomine.net>
Date: Fri, 28 Jan 2022 14:10:46 -0700
Subject: [PATCH 5/5] Linux-5.17: Kernel build uses -Wcast-function-type
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The linux 5.17 commit:
  "Makefile: Enable -Wcast-function-type" (552a23a0)
added the -Wcast-function-type compiler flag for kernel module builds.

This change catches a type mismatch in the external files obtained from
heimdal: hcrypto/evp.c and hcrypto/evp-algs.c and produces the following
type of compile time error messages.

  src/libafs/MODLOAD-.../evp.c: In function ‘hc_EVP_md_null’:
  src/libafs/MODLOAD-.../evp.c:501:2: error: cast between incompatible
      function types from ‘void (*)(void *)’ to ‘int (*)(EVP_MD_CTX *)’
          {aka ‘int (*)(struct hc_EVP_MD_CTX *)’}
          [-Werror=cast-function-type]
  501 |  (hc_evp_md_init)null_Init,
      |  ^

Use AX_APPEND_COMPILE_FLAGS to create a CFLAGS_NOCAST_FUNCTION_TYPE
macro to disable this warning and update the CFLAGS for these 2 files
for the Linux libafs build.

Update the CODING documentation to add the new exceptions.  In addition
add a brief description on how to set up autoconf to add a new build
macro to suppress compiler warnings.

Note: upstream heimdal has committed a fix for this in:

   hcrypto: Fix return type for null_Init, null_Update and null_Final
   (fc4b3ce49b)

Reviewed-on: https://gerrit.openafs.org/14881
Reviewed-by: Benjamin Kaduk <ka...@mit.edu>
Tested-by: BuildBot <build...@rampaginggeek.com>
Reviewed-by: Andrew Deason <adea...@sinenomine.net>
(cherry picked from commit 6bdfa976731ce07f3236893ecf12abb9e169b882)

Change-Id: Ibd354f663d5876c421a8b4e89b8943c9e3d59ebc
---
 CODING                            | 12 +++++++++++-
 src/cf/osconf.m4                  |  4 ++++
 src/libafs/MakefileProto.LINUX.in |  5 +++--
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/CODING b/CODING
index 5d62dbb0b..c26697934 100644
--- a/CODING
+++ b/CODING
@@ -265,7 +265,13 @@ the fix is to mark that warning as ignored, but only for clang. For example:
   # endif
   #endif
 
-If a pragma isn't available for your particular warning, you will need to
+If the source cannot be changed to add a pragma, you might be abe to use the
+autoconf function AX_APPEND_COMPILE_FLAGS to create a new macro that disables
+the warning and then use macro for the build options for that file. For an
+example, see how the autoconf macro CFLAGS_NOIMPLICIT_FALLTHROUGH is defined and
+used.
+
+Finally if there isn't a way to disable the specific warning, you will need to
 disable all warnings for the file in question. You can do this by supplying
 the autoconf macro @CFLAGS_NOERROR@ in the build options for the file. For
 example:
@@ -288,6 +294,10 @@ bucoord/commands.c   : all	     : Ubik_Call
 				     : signed vs unsigned for dates
 butc/tcudbprocs.c    : all	     : ubik_Call
 external/heimdal/hcrypto/validate.c: all: statement with empty body
+external/heimdal/hcrypto/evp.c:      cast-function-type
+             : Linux kernel build uses -Wcast-function-type
+external/heimdal/hcrypto/evp-algs.c: cast-function-type
+             : Linux kernel build uses -Wcast-function-type
 kauth/admin_tools.c  : strict-proto  : ubik_Call
 kauth/authclient.c   : strict-proto  : ubik_Call nonsense
 libadmin/kas/afs_kasAdmin.c: strict-proto : ubik_Call nonsense
diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4
index 1e1b08057..11f3eeae5 100644
--- a/src/cf/osconf.m4
+++ b/src/cf/osconf.m4
@@ -665,6 +665,7 @@ CFLAGS_NOERROR=
 CFLAGS_NOSTRICT=-fno-strict-aliasing
 CFLAGS_NOUNUSED=
 CFLAGS_NOOLDSTYLE=
+CFLAGS_NOCAST_FUNCTION_TYPE=
 XCFLAGS_NOCHECKING="$XCFLAGS"
 
 if test "x$GCC" = "xyes"; then
@@ -677,6 +678,8 @@ if test "x$GCC" = "xyes"; then
       CFLAGS_NOERROR="-Wno-error"
       CFLAGS_NOUNUSED="-Wno-unused"
       CFLAGS_NOOLDSTYLE="-Wno-old-style-definition"
+      AX_APPEND_COMPILE_FLAGS([-Wno-cast-function-type],
+                              [CFLAGS_NOCAST_FUNCTION_TYPE])
       AC_DEFINE(IGNORE_SOME_GCC_WARNINGS, 1, [define to disable some gcc warnings in warnings-as-errors mode])
     else
       CFLAGS_NOSTRICT=
@@ -753,6 +756,7 @@ AC_SUBST(CFLAGS_NOERROR)
 AC_SUBST(CFLAGS_NOSTRICT)
 AC_SUBST(CFLAGS_NOUNUSED)
 AC_SUBST(CFLAGS_NOOLDSTYLE)
+AC_SUBST(CFLAGS_NOCAST_FUNCTION_TYPE)
 AC_SUBST(XCFLAGS64)
 AC_SUBST(XLDFLAGS)
 AC_SUBST(XLDFLAGS64)
diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in
index d98fa05ad..8e98afd56 100644
--- a/src/libafs/MakefileProto.LINUX.in
+++ b/src/libafs/MakefileProto.LINUX.in
@@ -79,8 +79,9 @@ CFLAGS_rxkad_common.o = -I${TOP_SRCDIR}/rxkad -I$(TOP_OBJDIR)/src/rxkad
 CFLAGS_opr_rbtree.o = -I${TOP_SRCDIR}/opr
 
 CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
-	       -DHAVE_CONFIG_H
-CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+	       -DHAVE_CONFIG_H @CFLAGS_NOCAST_FUNCTION_TYPE@
+CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
+	       @CFLAGS_NOCAST_FUNCTION_TYPE@
 CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
-- 
2.35.1

Reply via email to