Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *
0004  * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
0005  *
0006  * Useful functions for debugging.
0007  *
0008  */
0009 
0010 // clang-format off
0011 #ifndef _LINUX_NTFS3_DEBUG_H
0012 #define _LINUX_NTFS3_DEBUG_H
0013 
0014 struct super_block;
0015 struct inode;
0016 
0017 #ifndef Add2Ptr
0018 #define Add2Ptr(P, I)       ((void *)((u8 *)(P) + (I)))
0019 #define PtrOffset(B, O)     ((size_t)((size_t)(O) - (size_t)(B)))
0020 #endif
0021 
0022 #ifdef CONFIG_PRINTK
0023 __printf(2, 3)
0024 void ntfs_printk(const struct super_block *sb, const char *fmt, ...);
0025 __printf(2, 3)
0026 void ntfs_inode_printk(struct inode *inode, const char *fmt, ...);
0027 #else
0028 static inline __printf(2, 3)
0029 void ntfs_printk(const struct super_block *sb, const char *fmt, ...)
0030 {
0031 }
0032 
0033 static inline __printf(2, 3)
0034 void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
0035 {
0036 }
0037 #endif
0038 
0039 /*
0040  * Logging macros. Thanks Joe Perches <joe@perches.com> for implementation.
0041  */
0042 
0043 #define ntfs_err(sb, fmt, ...)  ntfs_printk(sb, KERN_ERR fmt, ##__VA_ARGS__)
0044 #define ntfs_warn(sb, fmt, ...) ntfs_printk(sb, KERN_WARNING fmt, ##__VA_ARGS__)
0045 #define ntfs_info(sb, fmt, ...) ntfs_printk(sb, KERN_INFO fmt, ##__VA_ARGS__)
0046 #define ntfs_notice(sb, fmt, ...)                                              \
0047     ntfs_printk(sb, KERN_NOTICE fmt, ##__VA_ARGS__)
0048 
0049 #define ntfs_inode_err(inode, fmt, ...)                                        \
0050     ntfs_inode_printk(inode, KERN_ERR fmt, ##__VA_ARGS__)
0051 #define ntfs_inode_warn(inode, fmt, ...)                                       \
0052     ntfs_inode_printk(inode, KERN_WARNING fmt, ##__VA_ARGS__)
0053 
0054 #endif /* _LINUX_NTFS3_DEBUG_H */
0055 // clang-format on