messages.h (9b569ea0be6fb27a4985acc9325896a3edc95ede) messages.h (bbde07a40a13cc5a3483eaeb52e9bb3b61d2cf57)
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef BTRFS_MESSAGES_H
4#define BTRFS_MESSAGES_H
5
6#include <linux/types.h>
7
8struct btrfs_fs_info;
9struct btrfs_trans_handle;
10
11static inline __printf(2, 3) __cold
12void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
13{
14}
15
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef BTRFS_MESSAGES_H
4#define BTRFS_MESSAGES_H
5
6#include <linux/types.h>
7
8struct btrfs_fs_info;
9struct btrfs_trans_handle;
10
11static inline __printf(2, 3) __cold
12void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
13{
14}
15
16#ifdef CONFIG_PRINTK_INDEX
16#ifdef CONFIG_PRINTK
17
17
18#define btrfs_printk(fs_info, fmt, args...) \
19do { \
20 printk_index_subsys_emit("%sBTRFS %s (device %s): ", NULL, fmt); \
21 _btrfs_printk(fs_info, fmt, ##args); \
22} while (0)
23
24__printf(2, 3)
25__cold
26void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
27
28#elif defined(CONFIG_PRINTK)
29
30#define btrfs_printk(fs_info, fmt, args...) \
31 _btrfs_printk(fs_info, fmt, ##args)
32
33__printf(2, 3)
34__cold
35void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
36
37#else

--- 180 unchanged lines hidden (view full) ---

218 "Transaction aborted (error %d)", \
219 (errno)); \
220 } \
221 } \
222 __btrfs_abort_transaction((trans), __func__, \
223 __LINE__, (errno), first); \
224} while (0)
225
18#define btrfs_printk(fs_info, fmt, args...) \
19 _btrfs_printk(fs_info, fmt, ##args)
20
21__printf(2, 3)
22__cold
23void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
24
25#else

--- 180 unchanged lines hidden (view full) ---

206 "Transaction aborted (error %d)", \
207 (errno)); \
208 } \
209 } \
210 __btrfs_abort_transaction((trans), __func__, \
211 __LINE__, (errno), first); \
212} while (0)
213
226#ifdef CONFIG_PRINTK_INDEX
227
228#define btrfs_handle_fs_error(fs_info, errno, fmt, args...) \
214#define btrfs_handle_fs_error(fs_info, errno, fmt, args...) \
229do { \
230 printk_index_subsys_emit( \
231 "BTRFS: error (device %s%s) in %s:%d: errno=%d %s", \
232 KERN_CRIT, fmt); \
233 __btrfs_handle_fs_error((fs_info), __func__, __LINE__, \
215 __btrfs_handle_fs_error((fs_info), __func__, __LINE__, \
234 (errno), fmt, ##args); \
235} while (0)
236
237#else
238
239#define btrfs_handle_fs_error(fs_info, errno, fmt, args...) \
240 __btrfs_handle_fs_error((fs_info), __func__, __LINE__, \
241 (errno), fmt, ##args)
242
216 (errno), fmt, ##args)
217
243#endif
244
245__printf(5, 6)
246__cold
247void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
248 unsigned int line, int errno, const char *fmt, ...);
249/*
250 * If BTRFS_MOUNT_PANIC_ON_FATAL_ERROR is in mount_opt, __btrfs_panic
251 * will panic(). Otherwise we BUG() here.
252 */
253#define btrfs_panic(fs_info, errno, fmt, args...) \
254do { \
255 __btrfs_panic(fs_info, __func__, __LINE__, errno, fmt, ##args); \
256 BUG(); \
257} while (0)
258
259#endif
218__printf(5, 6)
219__cold
220void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
221 unsigned int line, int errno, const char *fmt, ...);
222/*
223 * If BTRFS_MOUNT_PANIC_ON_FATAL_ERROR is in mount_opt, __btrfs_panic
224 * will panic(). Otherwise we BUG() here.
225 */
226#define btrfs_panic(fs_info, errno, fmt, args...) \
227do { \
228 __btrfs_panic(fs_info, __func__, __LINE__, errno, fmt, ##args); \
229 BUG(); \
230} while (0)
231
232#endif