mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
195c52bdd5
Problem with these wrapper is that we cannot take off example GFP_NOFS flag. It is not recomended use those in all places. Also if we change one driver specific wrapper to kernel wrapper then it would look really weird. People should be most familiar with kernel wrappers so let's just use those ones. Driver specific alloc wrapper also confuse some static analyzing tools, good example is example kernels checkpatch tool. After we converter these to kernel specific then warnings is showed. Following Coccinelle script was used to automate changing. virtual patch @alloc depends on patch@ expression x; expression y; @@ ( - ntfs_malloc(x) + kmalloc(x, GFP_NOFS) | - ntfs_zalloc(x) + kzalloc(x, GFP_NOFS) | - ntfs_vmalloc(x) + kvmalloc(x, GFP_NOFS) | - ntfs_free(x) + kfree(x) | - ntfs_vfree(x) + kvfree(x) | - ntfs_memdup(x, y) + kmemdup(x, y, GFP_NOFS) ) Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kari Argillander <kari.argillander@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
52 lines
1.5 KiB
C
52 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
*
|
|
* Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
|
|
*
|
|
* useful functions for debugging
|
|
*/
|
|
|
|
// clang-format off
|
|
#ifndef _LINUX_NTFS3_DEBUG_H
|
|
#define _LINUX_NTFS3_DEBUG_H
|
|
|
|
#ifndef Add2Ptr
|
|
#define Add2Ptr(P, I) ((void *)((u8 *)(P) + (I)))
|
|
#define PtrOffset(B, O) ((size_t)((size_t)(O) - (size_t)(B)))
|
|
#endif
|
|
|
|
#ifdef CONFIG_PRINTK
|
|
__printf(2, 3)
|
|
void ntfs_printk(const struct super_block *sb, const char *fmt, ...);
|
|
__printf(2, 3)
|
|
void ntfs_inode_printk(struct inode *inode, const char *fmt, ...);
|
|
#else
|
|
static inline __printf(2, 3)
|
|
void ntfs_printk(const struct super_block *sb, const char *fmt, ...)
|
|
{
|
|
}
|
|
|
|
static inline __printf(2, 3)
|
|
void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* Logging macros ( thanks Joe Perches <joe@perches.com> for implementation )
|
|
*/
|
|
|
|
#define ntfs_err(sb, fmt, ...) ntfs_printk(sb, KERN_ERR fmt, ##__VA_ARGS__)
|
|
#define ntfs_warn(sb, fmt, ...) ntfs_printk(sb, KERN_WARNING fmt, ##__VA_ARGS__)
|
|
#define ntfs_info(sb, fmt, ...) ntfs_printk(sb, KERN_INFO fmt, ##__VA_ARGS__)
|
|
#define ntfs_notice(sb, fmt, ...) \
|
|
ntfs_printk(sb, KERN_NOTICE fmt, ##__VA_ARGS__)
|
|
|
|
#define ntfs_inode_err(inode, fmt, ...) \
|
|
ntfs_inode_printk(inode, KERN_ERR fmt, ##__VA_ARGS__)
|
|
#define ntfs_inode_warn(inode, fmt, ...) \
|
|
ntfs_inode_printk(inode, KERN_WARNING fmt, ##__VA_ARGS__)
|
|
|
|
#endif /* _LINUX_NTFS3_DEBUG_H */
|
|
// clang-format on
|