fs/overlayfs/params.c
Source file repositories/reference/linux-study-clean/fs/overlayfs/params.c
File Facts
- System
- Linux kernel
- Corpus path
fs/overlayfs/params.c- Extension
.c- Size
- 28041 bytes
- Lines
- 1105
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/module.hlinux/namei.hlinux/fs_context.hlinux/fs_parser.hlinux/posix_acl_xattr.hlinux/seq_file.hlinux/xattr.hoverlayfs.hparams.h
Detected Declarations
enum ovl_optfunction ovl_uuid_deffunction ovl_xino_deffunction ovl_redirect_mode_deffunction ovl_verity_mode_deffunction ovl_fsync_mode_deffunction ovl_parse_monolithicfunction ovl_parse_param_split_lowerdirsfunction ovl_mount_dir_noescfunction ovl_unescapefunction ovl_mount_dirfunction ovl_mount_dir_checkfunction ovl_ctx_realloc_lowerfunction ovl_add_layerfunction is_upper_layerfunction ovl_kern_pathfunction ovl_do_parse_layerfunction ovl_parse_layerfunction ovl_reset_lowerdirsfunction ovl_parse_param_lowerdirfunction ovl_parse_paramfunction ovl_get_treefunction ovl_fs_context_freefunction ovl_freefunction ovl_reconfigurefunction fsopenfunction ovl_free_fsfunction ovl_fs_params_verifyfunction ovl_show_options
Annotated Snippet
if (*p == '\\') {
p++;
if (!*p)
break;
} else if (*p == ',') {
*p = '\0';
*s = p + 1;
return sbegin;
}
}
*s = NULL;
return sbegin;
}
static int ovl_parse_monolithic(struct fs_context *fc, void *data)
{
return vfs_parse_monolithic_sep(fc, data, ovl_next_opt);
}
static ssize_t ovl_parse_param_split_lowerdirs(char *str)
{
ssize_t nr_layers = 1, nr_colons = 0;
char *s, *d;
for (s = d = str;; s++, d++) {
if (*s == '\\') {
/* keep esc chars in split lowerdir */
*d++ = *s++;
} else if (*s == ':') {
bool next_colon = (*(s + 1) == ':');
nr_colons++;
if (nr_colons == 2 && next_colon) {
pr_err("only single ':' or double '::' sequences of unescaped colons in lowerdir mount option allowed.\n");
return -EINVAL;
}
/* count layers, not colons */
if (!next_colon)
nr_layers++;
*d = '\0';
continue;
}
*d = *s;
if (!*s) {
/* trailing colons */
if (nr_colons) {
pr_err("unescaped trailing colons in lowerdir mount option.\n");
return -EINVAL;
}
break;
}
nr_colons = 0;
}
return nr_layers;
}
static int ovl_mount_dir_noesc(const char *name, struct path *path)
{
int err = -EINVAL;
if (!*name) {
pr_err("empty lowerdir\n");
goto out;
}
err = kern_path(name, LOOKUP_FOLLOW, path);
if (err) {
pr_err("failed to resolve '%s': %i\n", name, err);
goto out;
}
return 0;
out:
return err;
}
static void ovl_unescape(char *s)
{
char *d = s;
for (;; s++, d++) {
if (*s == '\\')
s++;
*d = *s;
if (!*s)
break;
}
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/module.h`, `linux/namei.h`, `linux/fs_context.h`, `linux/fs_parser.h`, `linux/posix_acl_xattr.h`, `linux/seq_file.h`, `linux/xattr.h`.
- Detected declarations: `enum ovl_opt`, `function ovl_uuid_def`, `function ovl_xino_def`, `function ovl_redirect_mode_def`, `function ovl_verity_mode_def`, `function ovl_fsync_mode_def`, `function ovl_parse_monolithic`, `function ovl_parse_param_split_lowerdirs`, `function ovl_mount_dir_noesc`, `function ovl_unescape`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- 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.