fs/afs/super.c
Source file repositories/reference/linux-study-clean/fs/afs/super.c
File Facts
- System
- Linux kernel
- Corpus path
fs/afs/super.c- Extension
.c- Size
- 18013 bytes
- Lines
- 771
- 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/kernel.hlinux/module.hlinux/mount.hlinux/init.hlinux/slab.hlinux/fs.hlinux/pagemap.hlinux/fs_parser.hlinux/statfs.hlinux/sched.hlinux/nsproxy.hlinux/magic.hnet/net_namespace.hinternal.h
Detected Declarations
enum afs_paramfunction afs_fs_initfunction afs_fs_exitfunction afs_show_devnamefunction afs_show_optionsfunction afs_parse_sourcefunction afs_parse_paramfunction afs_validate_fcfunction afs_test_superfunction afs_dynroot_test_superfunction afs_set_superfunction afs_fill_superfunction afs_destroy_sbifunction afs_kill_superfunction afs_get_treefunction afs_free_fcfunction afs_init_fs_contextfunction afs_alloc_inodefunction afs_free_inodefunction afs_destroy_inodefunction afs_get_volume_status_successfunction afs_statfs
Annotated Snippet
if (strcmp(name, "none") == 0) {
ctx->no_cell = true;
return 0;
}
printk(KERN_ERR "kAFS: unparsable volume name\n");
return -EINVAL;
}
/* determine the type of volume we're looking for */
if (name[0] == '%') {
ctx->type = AFSVL_RWVOL;
ctx->force = true;
}
name++;
/* split the cell name out if there is one */
ctx->volname = strchr(name, ':');
if (ctx->volname) {
cellname = name;
cellnamesz = ctx->volname - name;
ctx->volname++;
} else {
ctx->volname = name;
cellname = NULL;
cellnamesz = 0;
}
/* the volume type is further affected by a possible suffix */
suffix = strrchr(ctx->volname, '.');
if (suffix) {
if (strcmp(suffix, ".readonly") == 0) {
ctx->type = AFSVL_ROVOL;
ctx->force = true;
} else if (strcmp(suffix, ".backup") == 0) {
ctx->type = AFSVL_BACKVOL;
ctx->force = true;
} else if (suffix[1] == 0) {
} else {
suffix = NULL;
}
}
ctx->volnamesz = suffix ?
suffix - ctx->volname : strlen(ctx->volname);
_debug("cell %*.*s [%p]",
cellnamesz, cellnamesz, cellname ?: "", ctx->cell);
/* lookup the cell record */
if (cellname) {
cell = afs_lookup_cell(ctx->net, cellname, cellnamesz,
NULL, AFS_LOOKUP_CELL_DIRECT_MOUNT,
afs_cell_trace_use_lookup_mount);
if (IS_ERR(cell)) {
pr_err("kAFS: unable to lookup cell '%*.*s'\n",
cellnamesz, cellnamesz, cellname ?: "");
return PTR_ERR(cell);
}
afs_unuse_cell(ctx->cell, afs_cell_trace_unuse_parse);
afs_see_cell(cell, afs_cell_trace_see_source);
ctx->cell = cell;
}
_debug("CELL:%s [%p] VOLUME:%*.*s SUFFIX:%s TYPE:%d%s",
ctx->cell->name, ctx->cell,
ctx->volnamesz, ctx->volnamesz, ctx->volname,
suffix ?: "-", ctx->type, ctx->force ? " FORCE" : "");
fc->source = param->string;
param->string = NULL;
return 0;
}
/*
* Parse a single mount parameter.
*/
static int afs_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
struct fs_parse_result result;
struct afs_fs_context *ctx = fc->fs_private;
int opt;
opt = fs_parse(fc, afs_fs_parameters, param, &result);
if (opt < 0)
return opt;
switch (opt) {
case Opt_source:
return afs_parse_source(fc, param);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/mount.h`, `linux/init.h`, `linux/slab.h`, `linux/fs.h`, `linux/pagemap.h`, `linux/fs_parser.h`.
- Detected declarations: `enum afs_param`, `function afs_fs_init`, `function afs_fs_exit`, `function afs_show_devname`, `function afs_show_options`, `function afs_parse_source`, `function afs_parse_param`, `function afs_validate_fc`, `function afs_test_super`, `function afs_dynroot_test_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.