Commit bde98197 authored by Joe Perches's avatar Joe Perches Committed by Steve French

cifs: Make CIFS_DEBUG possible to undefine

Make the compilation work again when CIFS_DEBUG is not #define'd.

Add format and argument verification for the various macros when
CIFS_DEBUG is not #define'd.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
parent 52c0f4ad
...@@ -37,6 +37,9 @@ void dump_smb(void *, int); ...@@ -37,6 +37,9 @@ void dump_smb(void *, int);
#define CIFS_RC 0x02 #define CIFS_RC 0x02
#define CIFS_TIMER 0x04 #define CIFS_TIMER 0x04
extern int cifsFYI;
extern int cifsERROR;
/* /*
* debug ON * debug ON
* -------- * --------
...@@ -44,36 +47,33 @@ void dump_smb(void *, int); ...@@ -44,36 +47,33 @@ void dump_smb(void *, int);
#ifdef CIFS_DEBUG #ifdef CIFS_DEBUG
/* information message: e.g., configuration, major event */ /* information message: e.g., configuration, major event */
extern int cifsFYI; #define cifsfyi(fmt, ...) \
#define cifsfyi(fmt, arg...) \
do { \ do { \
if (cifsFYI & CIFS_INFO) \ if (cifsFYI & CIFS_INFO) \
printk(KERN_DEBUG "%s: " fmt "\n", __FILE__, ##arg); \ printk(KERN_DEBUG "%s: " fmt "\n", \
__FILE__, ##__VA_ARGS__); \
} while (0) } while (0)
#define cFYI(set, fmt, arg...) \ #define cFYI(set, fmt, ...) \
do { \ do { \
if (set) \ if (set) \
cifsfyi(fmt, ##arg); \ cifsfyi(fmt, ##__VA_ARGS__); \
} while (0) } while (0)
#define cifswarn(fmt, arg...) \ #define cifswarn(fmt, ...) \
printk(KERN_WARNING fmt "\n", ##arg) printk(KERN_WARNING fmt "\n", ##__VA_ARGS__)
/* debug event message: */
extern int cifsERROR;
/* error event message: e.g., i/o error */ /* error event message: e.g., i/o error */
#define cifserror(fmt, arg...) \ #define cifserror(fmt, ...) \
do { \ do { \
if (cifsERROR) \ if (cifsERROR) \
printk(KERN_ERR "CIFS VFS: " fmt "\n", ##arg); \ printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__); \
} while (0) } while (0)
#define cERROR(set, fmt, arg...) \ #define cERROR(set, fmt, ...) \
do { \ do { \
if (set) \ if (set) \
cifserror(fmt, ##arg); \ cifserror(fmt, ##__VA_ARGS__); \
} while (0) } while (0)
/* /*
...@@ -81,9 +81,27 @@ do { \ ...@@ -81,9 +81,27 @@ do { \
* --------- * ---------
*/ */
#else /* _CIFS_DEBUG */ #else /* _CIFS_DEBUG */
#define cERROR(set, fmt, arg...) #define cifsfyi(fmt, ...) \
#define cFYI(set, fmt, arg...) do { \
#define cifserror(fmt, arg...) if (0) \
printk(KERN_DEBUG "%s: " fmt "\n", \
__FILE__, ##__VA_ARGS__); \
} while (0)
#define cFYI(set, fmt, ...) \
do { \
if (0 && set) \
cifsfyi(fmt, ##__VA_ARGS__); \
} while (0)
#define cifserror(fmt, ...) \
do { \
if (0) \
printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__); \
} while (0)
#define cERROR(set, fmt, ...) \
do { \
if (0 && set) \
cifserror(fmt, ##__VA_ARGS__); \
} while (0)
#endif /* _CIFS_DEBUG */ #endif /* _CIFS_DEBUG */
#endif /* _H_CIFS_DEBUG */ #endif /* _H_CIFS_DEBUG */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment