rx: Only use printf in the AIX kernel 18/15118/8
authorBen Huntsman <ben@huntsmans.net>
Thu, 18 Aug 2022 00:19:55 +0000 (17:19 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 22 Sep 2022 03:49:36 +0000 (23:49 -0400)
An earlier version of the OpenAFS code used an unusual preprocessor
macro for the function osi_Msg and osi_VMsg.  This causes problems
on newer Linux kernels.  The macro was replaced with a function
leveraging vprintf, etc.  These functions are not available in the
AIX kernel, where our only option is printf.  However, AIX does
provide these functions in libc.  This change ensures we only use
printf when building the AIX kernel module.

Change-Id: Ib46c4712516846a489cc66fda0833907612b3316
Reviewed-on: https://gerrit.openafs.org/15118
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/rx/rx_internal.h
src/rx/rx_kcommon.c
src/rx/rx_kernel.h

index fe72f03..992682f 100644 (file)
@@ -77,5 +77,7 @@ extern void rxi_SendRaw(struct rx_call *call, struct rx_connection *conn,
                        int type, char *data, int bytes, int istack);
 extern struct rx_packet *rxi_SplitJumboPacket(struct rx_packet *p);
 
+#if !defined(AFS_AIX_ENV) || (defined(AFS_AIX_ENV) && (!defined(KERNEL) || defined(UKERNEL)))
 /* rx_kcommon.c / rx_user.c */
 extern void osi_Msg(const char *fmt, ...) AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
+#endif
index 98f1b45..d40758b 100644 (file)
@@ -1288,18 +1288,20 @@ osi_StopListener(void)
 # endif /* RXK_LISTENER_ENV */
 #endif /* !UKERNEL */
 
+#if !defined(AFS_AIX_ENV) || (defined(AFS_AIX_ENV) && (!defined(KERNEL) || defined(UKERNEL)))
 void
 osi_Msg(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-#if defined(AFS_LINUX_ENV)
+# if defined(AFS_LINUX_ENV)
     vprintk(fmt, ap);
-#else
+# else
     vprintf(fmt, ap);
-#endif
+# endif
     va_end(ap);
 }
+#endif
 
 #if !defined(AFS_LINUX_ENV)
 void
index 6b96ff3..ec50709 100644 (file)
@@ -58,6 +58,10 @@ extern void osi_Panic(char *fmt, ...)
     (void)((exp) || (osi_AssertFailK( #exp , __FILE__, __LINE__), 0))
 #endif
 
+#if (defined(AFS_AIX_ENV) && defined(KERNEL))
+# define osi_Msg printf
+#endif
+
 #define        osi_YieldIfPossible()
 #define        osi_WakeupAndYieldIfPossible(x)     rx_Wakeup(x)