From 179096d9b2c461f02236bbf670b46597ff2d4c3c Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 24 Sep 2012 13:03:34 -0500 Subject: [PATCH] LINUX: Define printf/uprintf as variadic macros Instead of defining the string 'printf' itself, make printf (and uprintf) variadic macros. This avoids renaming printf to printk for things like '__attribute__((format(printf,X,Y)))'. Note that this is Linux-specific; compilers on other platforms may not support variadic macros. This avoids many warnings in the Linux kernel module build if we include Linux headers after AFS headers. Change-Id: I2b8ed67f25e93f559535e40680ecab6fe7579e9c Reviewed-on: http://gerrit.openafs.org/8150 Reviewed-by: Derrick Brashear Reviewed-by: Marc Dionne Tested-by: BuildBot --- src/afs/LINUX/osi_machdep.h | 4 ++-- src/rx/rx_kernel.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 9260733..906f474 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -133,8 +133,8 @@ static inline long copyinstr(char *from, char *to, int count, int *length) { #define copyout(F, T, C) (copy_to_user ((char*)(T), (char*)(F), (C)) > 0 ? EFAULT : 0) /* kernel print statements */ -#define printf printk -#define uprintf printk +#define printf(args...) printk(args) +#define uprintf(args...) printk(args) #ifndef NGROUPS diff --git a/src/rx/rx_kernel.h b/src/rx/rx_kernel.h index 1351d17..63f0930 100644 --- a/src/rx/rx_kernel.h +++ b/src/rx/rx_kernel.h @@ -38,7 +38,11 @@ typedef struct socket *osi_socket; extern int osi_utoa(char *buf, size_t len, unsigned long val); #define osi_Assert(exp) (void)((exp) || (osi_AssertFailK( #exp , __FILE__, __LINE__), 0)) -#define osi_Msg printf)( +#ifdef AFS_LINUX20_ENV +# define osi_Msg printk)( +#else +# define osi_Msg printf)( +#endif #define osi_VMsg vprintf)( #define osi_YieldIfPossible() -- 1.7.1