summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-12-21 05:43:32 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2020-02-07 20:48:32 +0100
commit3fbb8d5554a1481d9c5f54ee7dc59f416650efb1 (patch)
treed7506d2e2e3e4c04212ec700ddc61561497e581d
parentteach logfc() to handle prefices, give it saner calling conventions (diff)
downloadlinux-3fbb8d5554a1481d9c5f54ee7dc59f416650efb1.tar.xz
linux-3fbb8d5554a1481d9c5f54ee7dc59f416650efb1.zip
struct p_log, variants of warnf() et.al. taking that one instead
primitives for prefixed logging Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/block/rbd.c1
-rw-r--r--include/linux/fs_context.h11
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 9fc686be81ca..1dd758e8f955 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -6353,6 +6353,7 @@ static int rbd_parse_param(struct fs_parameter *param,
{
struct rbd_options *opt = pctx->opts;
struct fs_parse_result result;
+ struct p_log log = {.prefix = "rbd"};
int token, ret;
ret = ceph_parse_param(param, pctx->copts, NULL);
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index d18ff422e942..6a7eeb252084 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -73,6 +73,11 @@ struct fs_parameter {
int dirfd;
};
+struct p_log {
+ const char *prefix;
+ struct fc_log *log;
+};
+
/*
* Filesystem context for holding the parameters used in the creation or
* reconfiguration of a superblock.
@@ -188,6 +193,8 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
struct fs_context *__fc = (fc); \
logfc(__fc ? __fc->log : NULL, NULL, \
l, fmt, ## __VA_ARGS__);})
+#define __plog(p, l, fmt, ...) logfc((p)->log, (p)->prefix, \
+ l, fmt, ## __VA_ARGS__)
/**
* infof - Store supplementary informational message
* @fc: The context in which to log the informational message
@@ -197,6 +204,7 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
* has enabled the facility.
*/
#define infof(fc, fmt, ...) __logfc(fc, 'i', fmt, ## __VA_ARGS__)
+#define info_plog(p, fmt, ...) __plog(p, 'i', fmt, ## __VA_ARGS__)
/**
* warnf - Store supplementary warning message
@@ -207,6 +215,7 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
* enabled the facility.
*/
#define warnf(fc, fmt, ...) __logfc(fc, 'w', fmt, ## __VA_ARGS__)
+#define warn_plog(p, fmt, ...) __plog(p, 'w', fmt, ## __VA_ARGS__)
/**
* errorf - Store supplementary error message
@@ -217,6 +226,7 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
* enabled the facility.
*/
#define errorf(fc, fmt, ...) __logfc(fc, 'e', fmt, ## __VA_ARGS__)
+#define error_plog(p, fmt, ...) __plog(p, 'e', fmt, ## __VA_ARGS__)
/**
* invalf - Store supplementary invalid argument error message
@@ -227,5 +237,6 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
* enabled the facility and return -EINVAL.
*/
#define invalf(fc, fmt, ...) (errorf(fc, fmt, ## __VA_ARGS__), -EINVAL)
+#define inval_plog(p, fmt, ...) (error_plog(p, fmt, ## __VA_ARGS__), -EINVAL)
#endif /* _LINUX_FS_CONTEXT_H */