diff --git a/kmod/src/msg.c b/kmod/src/msg.c index 98235acf..f2ebc81f 100644 --- a/kmod/src/msg.c +++ b/kmod/src/msg.c @@ -3,6 +3,10 @@ #include "msg.h" +/* + * This can be called with pre-emption disabled if the caller is printing + * the contents of formated per-cpu key string buffers. + */ void scoutfs_msg(struct super_block *sb, const char *prefix, const char *str, const char *fmt, ...) { diff --git a/kmod/src/msg.h b/kmod/src/msg.h index 8e53290f..9cde9716 100644 --- a/kmod/src/msg.h +++ b/kmod/src/msg.h @@ -1,16 +1,32 @@ #ifndef _SCOUTFS_MSG_H_ #define _SCOUTFS_MSG_H_ +#include "key.h" + void __printf(4, 5) scoutfs_msg(struct super_block *sb, const char *prefix, const char *str, const char *fmt, ...); +/* + * The _sk variants wrap the message in the SK_PCPU calls which safely + * manage the use of per-cpu key buffers in the arguments. + */ + #define scoutfs_err(sb, fmt, args...) \ scoutfs_msg(sb, KERN_ERR, " error", fmt, ##args) +#define scoutfs_err_sk(sb, fmt, args...) \ + SK_PCPU(scoutfs_err(sb, fmt, ##args)) + #define scoutfs_warn(sb, fmt, args...) \ scoutfs_msg(sb, KERN_WARNING, " warning", fmt, ##args) +#define scoutfs_warn_sk(sb, fmt, args...) \ + SK_PCPU(scoutfs_warn(sb, fmt, ##args)) + #define scoutfs_info(sb, fmt, args...) \ scoutfs_msg(sb, KERN_INFO, "", fmt, ##args) +#define scoutfs_info_sk(sb, fmt, args...) \ + SK_PCPU(scoutfs_info(sb, fmt, ##args)) + #endif