1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2011 Red Hat, Inc. All Rights Reserved.
9 #include "xfs_format.h"
10 #include "xfs_log_format.h"
11 #include "xfs_trans_resv.h"
12 #include "xfs_mount.h"
15 * XFS logging functions
20 const struct xfs_mount
*mp
,
21 struct va_format
*vaf
)
23 if (mp
&& mp
->m_fsname
) {
24 printk("%sXFS (%s): %pV\n", level
, mp
->m_fsname
, vaf
);
27 printk("%sXFS: %pV\n", level
, vaf
);
30 #define define_xfs_printk_level(func, kern_level) \
31 void func(const struct xfs_mount *mp, const char *fmt, ...) \
33 struct va_format vaf; \
37 va_start(args, fmt); \
42 __xfs_printk(kern_level, mp, &vaf); \
45 if (!kstrtoint(kern_level, 0, &level) && \
46 level <= LOGLEVEL_ERR && \
47 xfs_error_level >= XFS_ERRLEVEL_HIGH) \
51 define_xfs_printk_level(xfs_emerg, KERN_EMERG);
52 define_xfs_printk_level(xfs_alert
, KERN_ALERT
);
53 define_xfs_printk_level(xfs_crit
, KERN_CRIT
);
54 define_xfs_printk_level(xfs_err
, KERN_ERR
);
55 define_xfs_printk_level(xfs_warn
, KERN_WARNING
);
56 define_xfs_printk_level(xfs_notice
, KERN_NOTICE
);
57 define_xfs_printk_level(xfs_info
, KERN_INFO
);
59 define_xfs_printk_level(xfs_debug
, KERN_DEBUG
);
64 const struct xfs_mount
*mp
,
72 if (xfs_panic_mask
&& (xfs_panic_mask
& panic_tag
)) {
73 xfs_alert(mp
, "Transforming an alert into a BUG.");
82 __xfs_printk(KERN_ALERT
, mp
, &vaf
);
89 asswarn(char *expr
, char *file
, int line
)
91 xfs_warn(NULL
, "Assertion failed: %s, file: %s, line: %d",
97 assfail(char *expr
, char *file
, int line
)
99 xfs_emerg(NULL
, "Assertion failed: %s, file: %s, line: %d",
101 if (xfs_globals
.bug_on_assert
)
108 xfs_hex_dump(void *p
, int length
)
110 print_hex_dump(KERN_ALERT
, "", DUMP_PREFIX_ADDRESS
, 16, 1, p
, length
, 1);