xref: /OK3568_Linux_fs/kernel/fs/ntfs/debug.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * debug.h - NTFS kernel debug support. Part of the Linux-NTFS project.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (c) 2001-2004 Anton Altaparmakov
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef _LINUX_NTFS_DEBUG_H
9*4882a593Smuzhiyun #define _LINUX_NTFS_DEBUG_H
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include <linux/fs.h>
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #include "runlist.h"
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #ifdef DEBUG
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun extern int debug_msgs;
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun extern __printf(4, 5)
20*4882a593Smuzhiyun void __ntfs_debug(const char *file, int line, const char *function,
21*4882a593Smuzhiyun 		  const char *format, ...);
22*4882a593Smuzhiyun /**
23*4882a593Smuzhiyun  * ntfs_debug - write a debug level message to syslog
24*4882a593Smuzhiyun  * @f:		a printf format string containing the message
25*4882a593Smuzhiyun  * @...:	the variables to substitute into @f
26*4882a593Smuzhiyun  *
27*4882a593Smuzhiyun  * ntfs_debug() writes a DEBUG level message to the syslog but only if the
28*4882a593Smuzhiyun  * driver was compiled with -DDEBUG. Otherwise, the call turns into a NOP.
29*4882a593Smuzhiyun  */
30*4882a593Smuzhiyun #define ntfs_debug(f, a...)						\
31*4882a593Smuzhiyun 	__ntfs_debug(__FILE__, __LINE__, __func__, f, ##a)
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun extern void ntfs_debug_dump_runlist(const runlist_element *rl);
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #else	/* !DEBUG */
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #define ntfs_debug(fmt, ...)						\
38*4882a593Smuzhiyun do {									\
39*4882a593Smuzhiyun 	if (0)								\
40*4882a593Smuzhiyun 		no_printk(fmt, ##__VA_ARGS__);				\
41*4882a593Smuzhiyun } while (0)
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #define ntfs_debug_dump_runlist(rl)	do {} while (0)
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #endif	/* !DEBUG */
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun extern  __printf(3, 4)
48*4882a593Smuzhiyun void __ntfs_warning(const char *function, const struct super_block *sb,
49*4882a593Smuzhiyun 		    const char *fmt, ...);
50*4882a593Smuzhiyun #define ntfs_warning(sb, f, a...)	__ntfs_warning(__func__, sb, f, ##a)
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun extern  __printf(3, 4)
53*4882a593Smuzhiyun void __ntfs_error(const char *function, const struct super_block *sb,
54*4882a593Smuzhiyun 		  const char *fmt, ...);
55*4882a593Smuzhiyun #define ntfs_error(sb, f, a...)		__ntfs_error(__func__, sb, f, ##a)
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun #endif /* _LINUX_NTFS_DEBUG_H */
58