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