blob: 6fdef388f12944da514c5feb9e15ac5f542f5e68 [file] [log] [blame]
Thomas Gleixnera1d312d2019-05-22 09:51:42 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * debug.h - NTFS kernel debug support. Part of the Linux-NTFS project.
4 *
5 * Copyright (c) 2001-2004 Anton Altaparmakov
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
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
17extern int debug_msgs;
18
Joe Perchesb9075fa2011-10-31 17:11:33 -070019extern __printf(4, 5)
20void __ntfs_debug(const char *file, int line, const char *function,
21 const char *format, ...);
Linus Torvalds1da177e2005-04-16 15:20:36 -070022/**
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#define ntfs_debug(f, a...) \
Harvey Harrison8e24eea2008-04-30 00:55:09 -070031 __ntfs_debug(__FILE__, __LINE__, __func__, f, ##a)
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33extern void ntfs_debug_dump_runlist(const runlist_element *rl);
34
35#else /* !DEBUG */
36
Fabian Frederick87c1b492014-04-07 15:36:53 -070037#define ntfs_debug(fmt, ...) \
38do { \
39 if (0) \
40 no_printk(fmt, ##__VA_ARGS__); \
41} while (0)
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#define ntfs_debug_dump_runlist(rl) do {} while (0)
44
45#endif /* !DEBUG */
46
Joe Perchesb9075fa2011-10-31 17:11:33 -070047extern __printf(3, 4)
48void __ntfs_warning(const char *function, const struct super_block *sb,
49 const char *fmt, ...);
Harvey Harrison8e24eea2008-04-30 00:55:09 -070050#define ntfs_warning(sb, f, a...) __ntfs_warning(__func__, sb, f, ##a)
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
Joe Perchesb9075fa2011-10-31 17:11:33 -070052extern __printf(3, 4)
53void __ntfs_error(const char *function, const struct super_block *sb,
54 const char *fmt, ...);
Harvey Harrison8e24eea2008-04-30 00:55:09 -070055#define ntfs_error(sb, f, a...) __ntfs_error(__func__, sb, f, ##a)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
57#endif /* _LINUX_NTFS_DEBUG_H */