From 7234d69748a2b5a3d151f1c2acaf69afe04b7147 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 9 Aug 2025 10:44:05 +1000 Subject: [PATCH] libspl: move cmn_err definitions from zfs_context.h Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #17861 --- include/sys/zfs_context.h | 32 +------------------------------- lib/libspl/include/sys/cmn_err.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 564a8c489..25e00f502 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -122,6 +122,7 @@ extern "C" { #include #include #include +#include #include #include @@ -134,37 +135,6 @@ extern "C" { #define likely(x) __builtin_expect((x), 1) #define unlikely(x) __builtin_expect((x), 0) -/* - * Debugging - */ - -/* - * Note that we are not using the debugging levels. - */ - -#define CE_CONT 0 /* continuation */ -#define CE_NOTE 1 /* notice */ -#define CE_WARN 2 /* warning */ -#define CE_PANIC 3 /* panic */ -#define CE_IGNORE 4 /* print nothing */ - -/* - * ZFS debugging - */ - -extern void dprintf_setup(int *argc, char **argv); - -extern void cmn_err(int, const char *, ...) - __attribute__((format(printf, 2, 3))); -extern void vcmn_err(int, const char *, va_list) - __attribute__((format(printf, 2, 0))); -extern void panic(const char *, ...) - __attribute__((format(printf, 1, 2), noreturn)); -extern void vpanic(const char *, va_list) - __attribute__((format(printf, 1, 0), noreturn)); - -#define fm_panic panic - /* * DTrace SDT probes have different signatures in userland than they do in * the kernel. If they're being used in kernel code, re-define them out of diff --git a/lib/libspl/include/sys/cmn_err.h b/lib/libspl/include/sys/cmn_err.h index 32930adae..5e7136f7f 100644 --- a/lib/libspl/include/sys/cmn_err.h +++ b/lib/libspl/include/sys/cmn_err.h @@ -62,4 +62,31 @@ do { \ } \ } while (0) +/* + * Note that we are not using the debugging levels. + */ + +#define CE_CONT 0 /* continuation */ +#define CE_NOTE 1 /* notice */ +#define CE_WARN 2 /* warning */ +#define CE_PANIC 3 /* panic */ +#define CE_IGNORE 4 /* print nothing */ + +/* + * ZFS debugging + */ + +extern void dprintf_setup(int *argc, char **argv); + +extern void cmn_err(int, const char *, ...) + __attribute__((format(printf, 2, 3))); +extern void vcmn_err(int, const char *, va_list) + __attribute__((format(printf, 2, 0))); +extern void panic(const char *, ...) + __attribute__((format(printf, 1, 2), noreturn)); +extern void vpanic(const char *, va_list) + __attribute__((format(printf, 1, 0), noreturn)); + +#define fm_panic panic + #endif