scoutfs: add _sk console message wrappers

Add some _sk suffix variants of the message printing calls so that we
can use per-cpu key buffer arguments without the full SK_PCPU() wrapper.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-11-20 14:22:49 -08:00
committed by Mark Fasheh
parent a5fa9909f5
commit e67a5c9ba4
2 changed files with 20 additions and 0 deletions

View File

@@ -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, ...)
{

View File

@@ -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