Skip to content

Commit 3fbb8d5

Browse files
author
Al Viro
committed
struct p_log, variants of warnf() et.al. taking that one instead
primitives for prefixed logging Signed-off-by: Al Viro <[email protected]>
1 parent 9f09f64 commit 3fbb8d5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

drivers/block/rbd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6353,6 +6353,7 @@ static int rbd_parse_param(struct fs_parameter *param,
63536353
{
63546354
struct rbd_options *opt = pctx->opts;
63556355
struct fs_parse_result result;
6356+
struct p_log log = {.prefix = "rbd"};
63566357
int token, ret;
63576358

63586359
ret = ceph_parse_param(param, pctx->copts, NULL);

include/linux/fs_context.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ struct fs_parameter {
7373
int dirfd;
7474
};
7575

76+
struct p_log {
77+
const char *prefix;
78+
struct fc_log *log;
79+
};
80+
7681
/*
7782
* Filesystem context for holding the parameters used in the creation or
7883
* reconfiguration of a superblock.
@@ -188,6 +193,8 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
188193
struct fs_context *__fc = (fc); \
189194
logfc(__fc ? __fc->log : NULL, NULL, \
190195
l, fmt, ## __VA_ARGS__);})
196+
#define __plog(p, l, fmt, ...) logfc((p)->log, (p)->prefix, \
197+
l, fmt, ## __VA_ARGS__)
191198
/**
192199
* infof - Store supplementary informational message
193200
* @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,
197204
* has enabled the facility.
198205
*/
199206
#define infof(fc, fmt, ...) __logfc(fc, 'i', fmt, ## __VA_ARGS__)
207+
#define info_plog(p, fmt, ...) __plog(p, 'i', fmt, ## __VA_ARGS__)
200208

201209
/**
202210
* warnf - Store supplementary warning message
@@ -207,6 +215,7 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
207215
* enabled the facility.
208216
*/
209217
#define warnf(fc, fmt, ...) __logfc(fc, 'w', fmt, ## __VA_ARGS__)
218+
#define warn_plog(p, fmt, ...) __plog(p, 'w', fmt, ## __VA_ARGS__)
210219

211220
/**
212221
* errorf - Store supplementary error message
@@ -217,6 +226,7 @@ void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt,
217226
* enabled the facility.
218227
*/
219228
#define errorf(fc, fmt, ...) __logfc(fc, 'e', fmt, ## __VA_ARGS__)
229+
#define error_plog(p, fmt, ...) __plog(p, 'e', fmt, ## __VA_ARGS__)
220230

221231
/**
222232
* 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,
227237
* enabled the facility and return -EINVAL.
228238
*/
229239
#define invalf(fc, fmt, ...) (errorf(fc, fmt, ## __VA_ARGS__), -EINVAL)
240+
#define inval_plog(p, fmt, ...) (error_plog(p, fmt, ## __VA_ARGS__), -EINVAL)
230241

231242
#endif /* _LINUX_FS_CONTEXT_H */

0 commit comments

Comments
 (0)