18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * debug.h - NTFS kernel debug support. Part of the Linux-NTFS project. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2001-2004 Anton Altaparmakov 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _LINUX_NTFS_DEBUG_H 98c2ecf20Sopenharmony_ci#define _LINUX_NTFS_DEBUG_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/fs.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include "runlist.h" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#ifdef DEBUG 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciextern int debug_msgs; 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciextern __printf(4, 5) 208c2ecf20Sopenharmony_civoid __ntfs_debug(const char *file, int line, const char *function, 218c2ecf20Sopenharmony_ci const char *format, ...); 228c2ecf20Sopenharmony_ci/** 238c2ecf20Sopenharmony_ci * ntfs_debug - write a debug level message to syslog 248c2ecf20Sopenharmony_ci * @f: a printf format string containing the message 258c2ecf20Sopenharmony_ci * @...: the variables to substitute into @f 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * ntfs_debug() writes a DEBUG level message to the syslog but only if the 288c2ecf20Sopenharmony_ci * driver was compiled with -DDEBUG. Otherwise, the call turns into a NOP. 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_ci#define ntfs_debug(f, a...) \ 318c2ecf20Sopenharmony_ci __ntfs_debug(__FILE__, __LINE__, __func__, f, ##a) 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciextern void ntfs_debug_dump_runlist(const runlist_element *rl); 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#else /* !DEBUG */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define ntfs_debug(fmt, ...) \ 388c2ecf20Sopenharmony_cido { \ 398c2ecf20Sopenharmony_ci if (0) \ 408c2ecf20Sopenharmony_ci no_printk(fmt, ##__VA_ARGS__); \ 418c2ecf20Sopenharmony_ci} while (0) 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define ntfs_debug_dump_runlist(rl) do {} while (0) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#endif /* !DEBUG */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciextern __printf(3, 4) 488c2ecf20Sopenharmony_civoid __ntfs_warning(const char *function, const struct super_block *sb, 498c2ecf20Sopenharmony_ci const char *fmt, ...); 508c2ecf20Sopenharmony_ci#define ntfs_warning(sb, f, a...) __ntfs_warning(__func__, sb, f, ##a) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciextern __printf(3, 4) 538c2ecf20Sopenharmony_civoid __ntfs_error(const char *function, const struct super_block *sb, 548c2ecf20Sopenharmony_ci const char *fmt, ...); 558c2ecf20Sopenharmony_ci#define ntfs_error(sb, f, a...) __ntfs_error(__func__, sb, f, ##a) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#endif /* _LINUX_NTFS_DEBUG_H */ 58