xref: /openbmc/linux/fs/ntfs3/debug.h (revision cde81f13)
14534a70bSKonstantin Komarov /* SPDX-License-Identifier: GPL-2.0 */
24534a70bSKonstantin Komarov /*
34534a70bSKonstantin Komarov  *
44534a70bSKonstantin Komarov  * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
54534a70bSKonstantin Komarov  *
6e8b8e97fSKari Argillander  * Useful functions for debugging.
7e8b8e97fSKari Argillander  *
84534a70bSKonstantin Komarov  */
94534a70bSKonstantin Komarov 
104534a70bSKonstantin Komarov // clang-format off
1187790b65SKari Argillander #ifndef _LINUX_NTFS3_DEBUG_H
1287790b65SKari Argillander #define _LINUX_NTFS3_DEBUG_H
1387790b65SKari Argillander 
14*cde81f13SKari Argillander struct super_block;
15*cde81f13SKari Argillander struct inode;
16*cde81f13SKari Argillander 
174534a70bSKonstantin Komarov #ifndef Add2Ptr
184534a70bSKonstantin Komarov #define Add2Ptr(P, I)		((void *)((u8 *)(P) + (I)))
194534a70bSKonstantin Komarov #define PtrOffset(B, O)		((size_t)((size_t)(O) - (size_t)(B)))
204534a70bSKonstantin Komarov #endif
214534a70bSKonstantin Komarov 
224534a70bSKonstantin Komarov #ifdef CONFIG_PRINTK
234534a70bSKonstantin Komarov __printf(2, 3)
244534a70bSKonstantin Komarov void ntfs_printk(const struct super_block *sb, const char *fmt, ...);
254534a70bSKonstantin Komarov __printf(2, 3)
264534a70bSKonstantin Komarov void ntfs_inode_printk(struct inode *inode, const char *fmt, ...);
274534a70bSKonstantin Komarov #else
284534a70bSKonstantin Komarov static inline __printf(2, 3)
ntfs_printk(const struct super_block * sb,const char * fmt,...)294534a70bSKonstantin Komarov void ntfs_printk(const struct super_block *sb, const char *fmt, ...)
304534a70bSKonstantin Komarov {
314534a70bSKonstantin Komarov }
324534a70bSKonstantin Komarov 
334534a70bSKonstantin Komarov static inline __printf(2, 3)
ntfs_inode_printk(struct inode * inode,const char * fmt,...)344534a70bSKonstantin Komarov void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
354534a70bSKonstantin Komarov {
364534a70bSKonstantin Komarov }
374534a70bSKonstantin Komarov #endif
384534a70bSKonstantin Komarov 
394534a70bSKonstantin Komarov /*
40e8b8e97fSKari Argillander  * Logging macros. Thanks Joe Perches <joe@perches.com> for implementation.
414534a70bSKonstantin Komarov  */
424534a70bSKonstantin Komarov 
434534a70bSKonstantin Komarov #define ntfs_err(sb, fmt, ...)  ntfs_printk(sb, KERN_ERR fmt, ##__VA_ARGS__)
444534a70bSKonstantin Komarov #define ntfs_warn(sb, fmt, ...) ntfs_printk(sb, KERN_WARNING fmt, ##__VA_ARGS__)
454534a70bSKonstantin Komarov #define ntfs_info(sb, fmt, ...) ntfs_printk(sb, KERN_INFO fmt, ##__VA_ARGS__)
464534a70bSKonstantin Komarov #define ntfs_notice(sb, fmt, ...)                                              \
474534a70bSKonstantin Komarov 	ntfs_printk(sb, KERN_NOTICE fmt, ##__VA_ARGS__)
484534a70bSKonstantin Komarov 
494534a70bSKonstantin Komarov #define ntfs_inode_err(inode, fmt, ...)                                        \
504534a70bSKonstantin Komarov 	ntfs_inode_printk(inode, KERN_ERR fmt, ##__VA_ARGS__)
514534a70bSKonstantin Komarov #define ntfs_inode_warn(inode, fmt, ...)                                       \
524534a70bSKonstantin Komarov 	ntfs_inode_printk(inode, KERN_WARNING fmt, ##__VA_ARGS__)
534534a70bSKonstantin Komarov 
5487790b65SKari Argillander #endif /* _LINUX_NTFS3_DEBUG_H */
554534a70bSKonstantin Komarov // clang-format on
56