fs/affs/namei.c
Source file repositories/reference/linux-study-clean/fs/affs/namei.c
File Facts
- System
- Linux kernel
- Corpus path
fs/affs/namei.c- Extension
.c- Size
- 13659 bytes
- Lines
- 584
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
affs.hlinux/exportfs.h
Detected Declarations
function affs_toupperfunction affs_intl_toupperfunction affs_get_toupperfunction __affs_hash_dentryfunction affs_hash_dentryfunction affs_intl_hash_dentryfunction __affs_compare_dentryfunction affs_compare_dentryfunction affs_intl_compare_dentryfunction affs_matchfunction affs_hash_namefunction affs_find_entryfunction affs_lookupfunction affs_unlinkfunction affs_createfunction affs_mkdirfunction affs_rmdirfunction affs_symlinkfunction affs_linkfunction affs_renamefunction affs_xrenamefunction affs_rename2
Annotated Snippet
switch (be32_to_cpu(AFFS_TAIL(sb, bh)->stype)) {
//link to dirs disabled
//case ST_LINKDIR:
case ST_LINKFILE:
ino = be32_to_cpu(AFFS_TAIL(sb, bh)->original);
}
affs_brelse(bh);
inode = affs_iget(sb, ino);
}
res = d_splice_alias(inode, dentry);
if (!IS_ERR_OR_NULL(res))
res->d_fsdata = dentry->d_fsdata;
affs_unlock_dir(dir);
return res;
}
int
affs_unlink(struct inode *dir, struct dentry *dentry)
{
pr_debug("%s(dir=%llu, %llu \"%pd\")\n", __func__, dir->i_ino,
d_inode(dentry)->i_ino, dentry);
return affs_remove_header(dentry);
}
int
affs_create(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry, umode_t mode, bool excl)
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
int error;
pr_debug("%s(%llu,\"%pd\",0%ho)\n",
__func__, dir->i_ino, dentry, mode);
inode = affs_new_inode(dir);
if (!inode)
return -ENOSPC;
inode->i_mode = mode;
affs_mode_to_prot(inode);
mark_inode_dirty(inode);
inode->i_op = &affs_file_inode_operations;
inode->i_fop = &affs_file_operations;
inode->i_mapping->a_ops = affs_test_opt(AFFS_SB(sb)->s_flags, SF_OFS) ?
&affs_aops_ofs : &affs_aops;
error = affs_add_entry(dir, inode, dentry, ST_FILE);
if (error) {
clear_nlink(inode);
iput(inode);
return error;
}
return 0;
}
struct dentry *
affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry, umode_t mode)
{
struct inode *inode;
int error;
pr_debug("%s(%llu,\"%pd\",0%ho)\n",
__func__, dir->i_ino, dentry, mode);
inode = affs_new_inode(dir);
if (!inode)
return ERR_PTR(-ENOSPC);
inode->i_mode = S_IFDIR | mode;
affs_mode_to_prot(inode);
inode->i_op = &affs_dir_inode_operations;
inode->i_fop = &affs_dir_operations;
error = affs_add_entry(dir, inode, dentry, ST_USERDIR);
if (error) {
clear_nlink(inode);
mark_inode_dirty(inode);
iput(inode);
return ERR_PTR(error);
}
return NULL;
}
int
affs_rmdir(struct inode *dir, struct dentry *dentry)
{
Annotation
- Immediate include surface: `affs.h`, `linux/exportfs.h`.
- Detected declarations: `function affs_toupper`, `function affs_intl_toupper`, `function affs_get_toupper`, `function __affs_hash_dentry`, `function affs_hash_dentry`, `function affs_intl_hash_dentry`, `function __affs_compare_dentry`, `function affs_compare_dentry`, `function affs_intl_compare_dentry`, `function affs_match`.
- 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.