]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/fs_parser.h
add prefix to fs_context->log
[linux.git] / include / linux / fs_parser.h
index dee140db6240a7f8dfb21b7a2ca38ac11c9010e3..37459124c1c154453aa2b56e78c3c7944ece80c1 100644 (file)
@@ -53,18 +53,12 @@ struct fs_parameter_spec {
 #define fs_param_neg_with_no   0x0002  /* "noxxx" is negative param */
 #define fs_param_neg_with_empty        0x0004  /* "xxx=" is negative param */
 #define fs_param_deprecated    0x0008  /* The param is deprecated */
-};
-
-struct fs_parameter_enum {
-       u8              opt;            /* Option number (as fs_parameter_spec::opt) */
-       char            name[14];
-       u8              value;
+       const void              *data;
 };
 
 struct fs_parameter_description {
        const char      name[16];               /* Name for logging purposes */
        const struct fs_parameter_spec *specs;  /* List of param specifications */
-       const struct fs_parameter_enum *enums;  /* Enum values */
 };
 
 /*
@@ -72,7 +66,6 @@ struct fs_parameter_description {
  */
 struct fs_parse_result {
        bool                    negated;        /* T if param was "noxxx" */
-       bool                    has_value;      /* T if value supplied to param */
        union {
                bool            boolean;        /* For spec_bool */
                int             int_32;         /* For spec_s32/spec_enum */
@@ -81,18 +74,25 @@ struct fs_parse_result {
        };
 };
 
-extern int fs_parse(struct fs_context *fc,
+extern int __fs_parse(struct p_log *log,
                    const struct fs_parameter_description *desc,
                    struct fs_parameter *value,
                    struct fs_parse_result *result);
+
+static inline int fs_parse(struct fs_context *fc,
+            const struct fs_parameter_description *desc,
+            struct fs_parameter *param,
+            struct fs_parse_result *result)
+{
+       return __fs_parse(&fc->log, desc, param, result);
+}
+
 extern int fs_lookup_param(struct fs_context *fc,
                           struct fs_parameter *param,
                           bool want_bdev,
                           struct path *_path);
 
-extern int __lookup_constant(const struct constant_table tbl[], size_t tbl_size,
-                            const char *name, int not_found);
-#define lookup_constant(t, n, nf) __lookup_constant(t, ARRAY_SIZE(t), (n), (nf))
+extern int lookup_constant(const struct constant_table tbl[], const char *name, int not_found);
 
 #ifdef CONFIG_VALIDATE_FS_PARSER
 extern bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size,
@@ -115,33 +115,34 @@ static inline bool fs_validate_description(const struct fs_parameter_description
  * work, but any such case is probably a sign that new helper is needed.
  * Helpers will remain stable; low-level implementation may change.
  */
-#define __fsparam(TYPE, NAME, OPT, FLAGS) \
+#define __fsparam(TYPE, NAME, OPT, FLAGS, DATA) \
        { \
                .name = NAME, \
                .opt = OPT, \
                .type = TYPE, \
-               .flags = FLAGS \
+               .flags = FLAGS, \
+               .data = DATA \
        }
 
-#define fsparam_flag(NAME, OPT)        __fsparam(fs_param_is_flag, NAME, OPT, 0)
+#define fsparam_flag(NAME, OPT)        __fsparam(fs_param_is_flag, NAME, OPT, 0, NULL)
 #define fsparam_flag_no(NAME, OPT) \
                                __fsparam(fs_param_is_flag, NAME, OPT, \
-                                           fs_param_neg_with_no)
-#define fsparam_bool(NAME, OPT)        __fsparam(fs_param_is_bool, NAME, OPT, 0)
-#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0)
+                                           fs_param_neg_with_no, NULL)
+#define fsparam_bool(NAME, OPT)        __fsparam(fs_param_is_bool, NAME, OPT, 0, NULL)
+#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
 #define fsparam_u32oct(NAME, OPT) \
-                               __fsparam(fs_param_is_u32_octal, NAME, OPT, 0)
+                               __fsparam(fs_param_is_u32_octal, NAME, OPT, 0, NULL)
 #define fsparam_u32hex(NAME, OPT) \
-                               __fsparam(fs_param_is_u32_hex, NAME, OPT, 0)
-#define fsparam_s32(NAME, OPT) __fsparam(fs_param_is_s32, NAME, OPT, 0)
-#define fsparam_u64(NAME, OPT) __fsparam(fs_param_is_u64, NAME, OPT, 0)
-#define fsparam_enum(NAME, OPT)        __fsparam(fs_param_is_enum, NAME, OPT, 0)
+                               __fsparam(fs_param_is_u32_hex, NAME, OPT, 0, NULL)
+#define fsparam_s32(NAME, OPT) __fsparam(fs_param_is_s32, NAME, OPT, 0, NULL)
+#define fsparam_u64(NAME, OPT) __fsparam(fs_param_is_u64, NAME, OPT, 0, NULL)
+#define fsparam_enum(NAME, OPT, array) __fsparam(fs_param_is_enum, NAME, OPT, 0, array)
 #define fsparam_string(NAME, OPT) \
-                               __fsparam(fs_param_is_string, NAME, OPT, 0)
-#define fsparam_blob(NAME, OPT)        __fsparam(fs_param_is_blob, NAME, OPT, 0)
-#define fsparam_bdev(NAME, OPT)        __fsparam(fs_param_is_blockdev, NAME, OPT, 0)
-#define fsparam_path(NAME, OPT)        __fsparam(fs_param_is_path, NAME, OPT, 0)
-#define fsparam_fd(NAME, OPT)  __fsparam(fs_param_is_fd, NAME, OPT, 0)
+                               __fsparam(fs_param_is_string, NAME, OPT, 0, NULL)
+#define fsparam_blob(NAME, OPT)        __fsparam(fs_param_is_blob, NAME, OPT, 0, NULL)
+#define fsparam_bdev(NAME, OPT)        __fsparam(fs_param_is_blockdev, NAME, OPT, 0, NULL)
+#define fsparam_path(NAME, OPT)        __fsparam(fs_param_is_path, NAME, OPT, 0, NULL)
+#define fsparam_fd(NAME, OPT)  __fsparam(fs_param_is_fd, NAME, OPT, 0, NULL)
 
 
 #endif /* _LINUX_FS_PARSER_H */