fs/autofs/inode.c
Source file repositories/reference/linux-study-clean/fs/autofs/inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/autofs/inode.c- Extension
.c- Size
- 10290 bytes
- Lines
- 456
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/seq_file.hlinux/pagemap.hautofs_i.h
Detected Declarations
struct autofs_fs_contextfunction autofs_clean_inofunction autofs_free_inofunction autofs_kill_sbfunction autofs_show_optionsfunction autofs_evict_inodefunction autofs_parse_fdfunction autofs_parse_paramfunction autofs_validate_protocolfunction autofs_fill_superfunction autofs_get_treefunction autofs_free_fcfunction autofs_init_fs_context
Annotated Snippet
struct autofs_fs_context {
kuid_t uid;
kgid_t gid;
int pgrp;
bool pgrp_set;
};
/*
* Open the fd. We do it here rather than in get_tree so that it's done in the
* context of the system call that passed the data and not the one that
* triggered the superblock creation, lest the fd gets reassigned.
*/
static int autofs_parse_fd(struct fs_context *fc, struct autofs_sb_info *sbi,
struct fs_parameter *param,
struct fs_parse_result *result)
{
struct file *pipe;
int ret;
if (param->type == fs_value_is_file) {
/* came through the new api */
pipe = param->file;
param->file = NULL;
} else {
pipe = fget(result->uint_32);
}
if (!pipe) {
errorf(fc, "could not open pipe file descriptor");
return -EBADF;
}
ret = autofs_check_pipe(pipe);
if (ret < 0) {
errorf(fc, "Invalid/unusable pipe");
fput(pipe);
return -EBADF;
}
autofs_set_packet_pipe_flags(pipe);
if (sbi->pipe)
fput(sbi->pipe);
sbi->pipefd = result->uint_32;
sbi->pipe = pipe;
return 0;
}
static int autofs_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
struct autofs_fs_context *ctx = fc->fs_private;
struct autofs_sb_info *sbi = fc->s_fs_info;
struct fs_parse_result result;
int opt;
opt = fs_parse(fc, autofs_param_specs, param, &result);
if (opt < 0)
return opt;
switch (opt) {
case Opt_fd:
return autofs_parse_fd(fc, sbi, param, &result);
case Opt_uid:
ctx->uid = result.uid;
break;
case Opt_gid:
ctx->gid = result.gid;
break;
case Opt_pgrp:
ctx->pgrp = result.uint_32;
ctx->pgrp_set = true;
break;
case Opt_minproto:
sbi->min_proto = result.uint_32;
break;
case Opt_maxproto:
sbi->max_proto = result.uint_32;
break;
case Opt_indirect:
set_autofs_type_indirect(&sbi->type);
break;
case Opt_direct:
set_autofs_type_direct(&sbi->type);
break;
case Opt_offset:
set_autofs_type_offset(&sbi->type);
break;
case Opt_strictexpire:
sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;
Annotation
- Immediate include surface: `linux/seq_file.h`, `linux/pagemap.h`, `autofs_i.h`.
- Detected declarations: `struct autofs_fs_context`, `function autofs_clean_ino`, `function autofs_free_ino`, `function autofs_kill_sb`, `function autofs_show_options`, `function autofs_evict_inode`, `function autofs_parse_fd`, `function autofs_parse_param`, `function autofs_validate_protocol`, `function autofs_fill_super`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.