xref: /openbmc/linux/fs/ntfs/debug.h (revision 87c1b497)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * debug.h - NTFS kernel debug support. Part of the Linux-NTFS project.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Copyright (c) 2001-2004 Anton Altaparmakov
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  * This program/include file is free software; you can redistribute it and/or
71da177e4SLinus Torvalds  * modify it under the terms of the GNU General Public License as published
81da177e4SLinus Torvalds  * by the Free Software Foundation; either version 2 of the License, or
91da177e4SLinus Torvalds  * (at your option) any later version.
101da177e4SLinus Torvalds  *
111da177e4SLinus Torvalds  * This program/include file is distributed in the hope that it will be
121da177e4SLinus Torvalds  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
131da177e4SLinus Torvalds  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
141da177e4SLinus Torvalds  * GNU General Public License for more details.
151da177e4SLinus Torvalds  *
161da177e4SLinus Torvalds  * You should have received a copy of the GNU General Public License
171da177e4SLinus Torvalds  * along with this program (in the main directory of the Linux-NTFS
181da177e4SLinus Torvalds  * distribution in the file COPYING); if not, write to the Free Software
191da177e4SLinus Torvalds  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
201da177e4SLinus Torvalds  */
211da177e4SLinus Torvalds 
221da177e4SLinus Torvalds #ifndef _LINUX_NTFS_DEBUG_H
231da177e4SLinus Torvalds #define _LINUX_NTFS_DEBUG_H
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds #include <linux/fs.h>
261da177e4SLinus Torvalds 
271da177e4SLinus Torvalds #include "runlist.h"
281da177e4SLinus Torvalds 
291da177e4SLinus Torvalds #ifdef DEBUG
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds extern int debug_msgs;
321da177e4SLinus Torvalds 
33b9075fa9SJoe Perches extern __printf(4, 5)
34b9075fa9SJoe Perches void __ntfs_debug(const char *file, int line, const char *function,
35b9075fa9SJoe Perches 		  const char *format, ...);
361da177e4SLinus Torvalds /**
371da177e4SLinus Torvalds  * ntfs_debug - write a debug level message to syslog
381da177e4SLinus Torvalds  * @f:		a printf format string containing the message
391da177e4SLinus Torvalds  * @...:	the variables to substitute into @f
401da177e4SLinus Torvalds  *
411da177e4SLinus Torvalds  * ntfs_debug() writes a DEBUG level message to the syslog but only if the
421da177e4SLinus Torvalds  * driver was compiled with -DDEBUG. Otherwise, the call turns into a NOP.
431da177e4SLinus Torvalds  */
441da177e4SLinus Torvalds #define ntfs_debug(f, a...)						\
458e24eea7SHarvey Harrison 	__ntfs_debug(__FILE__, __LINE__, __func__, f, ##a)
461da177e4SLinus Torvalds 
471da177e4SLinus Torvalds extern void ntfs_debug_dump_runlist(const runlist_element *rl);
481da177e4SLinus Torvalds 
491da177e4SLinus Torvalds #else	/* !DEBUG */
501da177e4SLinus Torvalds 
5187c1b497SFabian Frederick #define ntfs_debug(fmt, ...)						\
5287c1b497SFabian Frederick do {									\
5387c1b497SFabian Frederick 	if (0)								\
5487c1b497SFabian Frederick 		no_printk(fmt, ##__VA_ARGS__);				\
5587c1b497SFabian Frederick } while (0)
5687c1b497SFabian Frederick 
571da177e4SLinus Torvalds #define ntfs_debug_dump_runlist(rl)	do {} while (0)
581da177e4SLinus Torvalds 
591da177e4SLinus Torvalds #endif	/* !DEBUG */
601da177e4SLinus Torvalds 
61b9075fa9SJoe Perches extern  __printf(3, 4)
62b9075fa9SJoe Perches void __ntfs_warning(const char *function, const struct super_block *sb,
63b9075fa9SJoe Perches 		    const char *fmt, ...);
648e24eea7SHarvey Harrison #define ntfs_warning(sb, f, a...)	__ntfs_warning(__func__, sb, f, ##a)
651da177e4SLinus Torvalds 
66b9075fa9SJoe Perches extern  __printf(3, 4)
67b9075fa9SJoe Perches void __ntfs_error(const char *function, const struct super_block *sb,
68b9075fa9SJoe Perches 		  const char *fmt, ...);
698e24eea7SHarvey Harrison #define ntfs_error(sb, f, a...)		__ntfs_error(__func__, sb, f, ##a)
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds #endif /* _LINUX_NTFS_DEBUG_H */
72