]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
new primitive: __fs_parse()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 21 Dec 2019 04:52:55 +0000 (23:52 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 7 Feb 2020 19:48:34 +0000 (14:48 -0500)
fs_parse() analogue taking p_log instead of fs_context.
fs_parse() turned into a wrapper, callers in ceph_common and rbd
switched to __fs_parse().

As the result, fs_parse() never gets NULL fs_context and neither
do fs_context-based logging primitives

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/block/rbd.c
fs/fs_parser.c
include/linux/fs_context.h
include/linux/fs_parser.h
net/ceph/ceph_common.c

index 596a1188d0c3dd254217760a6e07420317f9e8ea..47e82f076a124361c55e06825d2587ee0f68792a 100644 (file)
@@ -6360,7 +6360,7 @@ static int rbd_parse_param(struct fs_parameter *param,
        if (ret != -ENOPARAM)
                return ret;
 
-       token = fs_parse(NULL, &rbd_parameters, param, &result);
+       token = __fs_parse(&log, &rbd_parameters, param, &result);
        dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
        if (token < 0) {
                if (token == -ENOPARAM)
index dc5c6737c2807feb563795a6f128bba6f1d9cdf7..dadb6582874d49ac544c6ce16d79a903a1301179 100644 (file)
@@ -80,7 +80,7 @@ static const struct fs_parameter_spec *fs_lookup_key(
  * unknown parameters are okay and -EINVAL if there was a conversion issue or
  * the parameter wasn't recognised and unknowns aren't okay.
  */
-int fs_parse(struct fs_context *fc,
+int __fs_parse(struct p_log *log,
             const struct fs_parameter_description *desc,
             struct fs_parameter *param,
             struct fs_parse_result *result)
@@ -113,8 +113,7 @@ int fs_parse(struct fs_context *fc,
        }
 
        if (p->flags & fs_param_deprecated)
-               warnf(fc, "%s: Deprecated parameter '%s'",
-                     desc->name, param->key);
+               warn_plog(log, "Deprecated parameter '%s'", param->key);
 
        if (result->negated)
                goto okay;
@@ -152,8 +151,8 @@ int fs_parse(struct fs_context *fc,
        switch (p->type) {
        case fs_param_is_flag:
                if (param->type != fs_value_is_flag)
-                       return invalf(fc, "%s: Unexpected value for '%s'",
-                                     desc->name, param->key);
+                       return inval_plog(log, "Unexpected value for '%s'",
+                                     param->key);
                result->boolean = true;
                goto okay;
 
@@ -238,10 +237,20 @@ okay:
        return p->opt;
 
 bad_value:
-       return invalf(fc, "%s: Bad value for '%s'", desc->name, param->key);
+       return inval_plog(log, "Bad value for '%s'", param->key);
 unknown_parameter:
        return -ENOPARAM;
 }
+EXPORT_SYMBOL(__fs_parse);
+
+int fs_parse(struct fs_context *fc,
+            const struct fs_parameter_description *desc,
+            struct fs_parameter *param,
+            struct fs_parse_result *result)
+{
+       struct p_log log = {.prefix = desc->name, .log = fc->log};
+       return __fs_parse(&log, desc, param, result);
+}
 EXPORT_SYMBOL(fs_parse);
 
 /**
index 6a7eeb252084387e58e5559d09f70bd4f498e2e5..41f37d33e358a6a884fc3922cefcca0ac351a12b 100644 (file)
@@ -189,10 +189,8 @@ struct fc_log {
 extern __attribute__((format(printf, 4, 5)))
 void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt, ...);
 
-#define __logfc(fc, l, fmt, ...) ({            \
-       struct fs_context *__fc = (fc);         \
-       logfc(__fc ? __fc->log : NULL, NULL,    \
-               l, fmt, ## __VA_ARGS__);})
+#define __logfc(fc, l, fmt, ...) logfc((fc)->log, NULL, \
+                                       l, fmt, ## __VA_ARGS__)
 #define __plog(p, l, fmt, ...) logfc((p)->log, (p)->prefix, \
                                        l, fmt, ## __VA_ARGS__)
 /**
index 14bdaacf12182f8bc4fc0c51a273cc72d7f4c01d..b0fba26a4ffed24badfc2b42424eb2905830fd56 100644 (file)
@@ -74,6 +74,10 @@ struct fs_parse_result {
        };
 };
 
+extern int __fs_parse(struct p_log *log,
+                   const struct fs_parameter_description *desc,
+                   struct fs_parameter *value,
+                   struct fs_parse_result *result);
 extern int fs_parse(struct fs_context *fc,
                    const struct fs_parameter_description *desc,
                    struct fs_parameter *value,
index a3f4f00f2b72e277631db43f7a71af9c1bb8fab5..9f8bc962985d93ed809a6c1ca8fb6397a9dd97fb 100644 (file)
@@ -407,7 +407,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
        int token, err;
        struct p_log log = {.prefix = "libceph", .log = fc ? fc->log : NULL};
 
-       token = fs_parse(fc, &ceph_parameters, param, &result);
+       token = __fs_parse(&log, &ceph_parameters, param, &result);
        dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
        if (token < 0)
                return token;