include/linux/fs_parser.h
Source file repositories/reference/linux-study-clean/include/linux/fs_parser.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/fs_parser.h- Extension
.h- Size
- 4600 bytes
- Lines
- 140
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs_context.h
Detected Declarations
struct pathstruct constant_tablestruct fs_parameter_specstruct fs_parse_resultstruct fs_parameter_specstruct fs_parse_resultfunction fs_parsefunction fs_validate_description
Annotated Snippet
struct constant_table {
const char *name;
int value;
};
struct fs_parameter_spec;
struct fs_parse_result;
typedef int fs_param_type(struct p_log *,
const struct fs_parameter_spec *,
struct fs_parameter *,
struct fs_parse_result *);
/*
* The type of parameter expected.
*/
fs_param_type fs_param_is_bool, fs_param_is_u32, fs_param_is_s32, fs_param_is_u64,
fs_param_is_enum, fs_param_is_string, fs_param_is_blockdev,
fs_param_is_fd, fs_param_is_uid, fs_param_is_gid,
fs_param_is_file_or_string;
/*
* Specification of the type of value a parameter wants.
*
* Note that the fsparam_flag(), fsparam_string(), fsparam_u32(), ... macros
* should be used to generate elements of this type.
*/
struct fs_parameter_spec {
const char *name;
fs_param_type *type; /* The desired parameter type */
u8 opt; /* Option number (returned by fs_parse()) */
unsigned short flags;
#define fs_param_neg_with_no 0x0002 /* "noxxx" is negative param */
#define fs_param_can_be_empty 0x0004 /* "xxx=" is allowed */
#define fs_param_deprecated 0x0008 /* The param is deprecated */
const void *data;
};
/*
* Result of parse.
*/
struct fs_parse_result {
bool negated; /* T if param was "noxxx" */
union {
bool boolean; /* For spec_bool */
int int_32; /* For spec_s32/spec_enum */
unsigned int uint_32; /* For spec_u32{,_octal,_hex}/spec_enum */
u64 uint_64; /* For spec_u64 */
kuid_t uid;
kgid_t gid;
};
};
extern int __fs_parse(struct p_log *log,
const struct fs_parameter_spec *desc,
struct fs_parameter *value,
struct fs_parse_result *result);
static inline int fs_parse(struct fs_context *fc,
const struct fs_parameter_spec *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,
unsigned int flags,
struct path *_path);
extern int lookup_constant(const struct constant_table tbl[], const char *name, int not_found);
#ifdef CONFIG_VALIDATE_FS_PARSER
extern bool fs_validate_description(const char *name,
const struct fs_parameter_spec *desc);
#else
static inline bool fs_validate_description(const char *name,
const struct fs_parameter_spec *desc)
{ return true; }
#endif
/*
* Parameter type, name, index and flags element constructors. Use as:
*
* fsparam_xxxx("foo", Opt_foo)
*
* If existing helpers are not enough, direct use of __fsparam() would
* work, but any such case is probably a sign that new helper is needed.
* Helpers will remain stable; low-level implementation may change.
*/
Annotation
- Immediate include surface: `linux/fs_context.h`.
- Detected declarations: `struct path`, `struct constant_table`, `struct fs_parameter_spec`, `struct fs_parse_result`, `struct fs_parameter_spec`, `struct fs_parse_result`, `function fs_parse`, `function fs_validate_description`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.