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