fs/jfs/namei.c
Source file repositories/reference/linux-study-clean/fs/jfs/namei.c
File Facts
- System
- Linux kernel
- Corpus path
fs/jfs/namei.c- Extension
.c- Size
- 37975 bytes
- Lines
- 1622
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
linux/fs.hlinux/filelock.hlinux/namei.hlinux/ctype.hlinux/quotaops.hlinux/exportfs.hjfs_incore.hjfs_superblock.hjfs_inode.hjfs_dinode.hjfs_dmap.hjfs_unicode.hjfs_metapage.hjfs_xattr.hjfs_acl.hjfs_debug.h
Detected Declarations
function free_ea_wmapfunction jfs_createfunction rmdirfunction unlinkfunction commitZeroLinkfunction jfs_free_zero_linkfunction linkfunction jfs_symlinkfunction jfs_renamefunction jfs_mknodfunction jfs_ci_hashfunction jfs_ci_comparefunction jfs_ci_revalidate
Annotated Snippet
const struct file_operations jfs_dir_operations = {
.read = generic_read_dir,
.iterate_shared = shared_jfs_readdir,
.fsync = jfs_fsync,
.unlocked_ioctl = jfs_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.llseek = generic_file_llseek,
.setlease = generic_setlease,
};
static int jfs_ci_hash(const struct dentry *dir, struct qstr *this)
{
unsigned long hash;
int i;
hash = init_name_hash(dir);
for (i=0; i < this->len; i++)
hash = partial_name_hash(tolower(this->name[i]), hash);
this->hash = end_name_hash(hash);
return 0;
}
static int jfs_ci_compare(const struct dentry *dentry,
unsigned int len, const char *str, const struct qstr *name)
{
int i, result = 1;
if (len != name->len)
goto out;
for (i=0; i < len; i++) {
if (tolower(str[i]) != tolower(name->name[i]))
goto out;
}
result = 0;
out:
return result;
}
static int jfs_ci_revalidate(struct inode *dir, const struct qstr *name,
struct dentry *dentry, unsigned int flags)
{
/*
* This is not negative dentry. Always valid.
*
* Note, rename() to existing directory entry will have ->d_inode,
* and will use existing name which isn't specified name by user.
*
* We may be able to drop this positive dentry here. But dropping
* positive dentry isn't good idea. So it's unsupported like
* rename("filename", "FILENAME") for now.
*/
if (d_really_is_positive(dentry))
return 1;
/*
* This may be nfsd (or something), anyway, we can't see the
* intent of this. So, since this can be for creation, drop it.
*/
if (!flags)
return 0;
/*
* Drop the negative dentry, in order to make sure to use the
* case sensitive name which is specified by user if this is
* for creation.
*/
if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
return 0;
return 1;
}
const struct dentry_operations jfs_ci_dentry_operations =
{
.d_hash = jfs_ci_hash,
.d_compare = jfs_ci_compare,
.d_revalidate = jfs_ci_revalidate,
};
Annotation
- Immediate include surface: `linux/fs.h`, `linux/filelock.h`, `linux/namei.h`, `linux/ctype.h`, `linux/quotaops.h`, `linux/exportfs.h`, `jfs_incore.h`, `jfs_superblock.h`.
- Detected declarations: `function free_ea_wmap`, `function jfs_create`, `function rmdir`, `function unlink`, `function commitZeroLink`, `function jfs_free_zero_link`, `function link`, `function jfs_symlink`, `function jfs_rename`, `function jfs_mknod`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern 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.