fs/exfat/namei.c
Source file repositories/reference/linux-study-clean/fs/exfat/namei.c
File Facts
- System
- Linux kernel
- Corpus path
fs/exfat/namei.c- Extension
.c- Size
- 35316 bytes
- Lines
- 1337
- 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
linux/iversion.hlinux/namei.hlinux/slab.hlinux/buffer_head.hlinux/nls.hexfat_raw.hexfat_fs.h
Detected Declarations
function Copyrightfunction exfat_d_version_setfunction exfat_d_revalidatefunction exfat_striptail_lenfunction exfat_d_hashfunction exfat_d_cmpfunction exfat_utf8_d_hashfunction exfat_utf8_d_cmpfunction exfat_search_empty_slotfunction exfat_check_max_dentriesfunction exfat_find_empty_entryfunction __exfat_resolve_pathfunction exfat_resolve_pathfunction exfat_resolve_path_for_lookupfunction exfat_make_i_posfunction exfat_add_entryfunction exfat_createfunction exfat_findfunction corruptedfunction exfat_unlinkfunction exfat_check_dir_emptyfunction exfat_rmdirfunction exfat_count_extra_entriesfunction exfat_rename_filefunction exfat_move_filefunction __exfat_renamefunction exfat_rename
Annotated Snippet
if (u_a <= 0xFFFF && u_b <= 0xFFFF) {
if (exfat_toupper(sb, u_a) != exfat_toupper(sb, u_b))
return 1;
} else {
if (u_a != u_b)
return 1;
}
}
return 0;
}
const struct dentry_operations exfat_utf8_dentry_ops = {
.d_revalidate = exfat_d_revalidate,
.d_hash = exfat_utf8_d_hash,
.d_compare = exfat_utf8_d_cmp,
};
/* search EMPTY CONTINUOUS "num_entries" entries */
static int exfat_search_empty_slot(struct super_block *sb,
struct exfat_hint_femp *hint_femp, struct exfat_chain *p_dir,
int num_entries, struct exfat_entry_set_cache *es)
{
int i, dentry, ret;
int dentries_per_clu;
struct exfat_chain clu;
struct exfat_sb_info *sbi = EXFAT_SB(sb);
unsigned int total_entries = exfat_cluster_to_dentries(sbi, p_dir->size);
dentries_per_clu = sbi->dentries_per_clu;
if (hint_femp->eidx != EXFAT_HINT_NONE) {
dentry = hint_femp->eidx;
/*
* If hint_femp->count is enough, it is needed to check if
* there are actual empty entries.
* Otherwise, and if "dentry + hint_famp->count" is also equal
* to "p_dir->size * dentries_per_clu", it means ENOSPC.
*/
if (dentry + hint_femp->count == total_entries &&
num_entries > hint_femp->count)
return -ENOSPC;
hint_femp->eidx = EXFAT_HINT_NONE;
exfat_chain_dup(&clu, &hint_femp->cur);
} else {
exfat_chain_dup(&clu, p_dir);
dentry = 0;
}
while (dentry + num_entries <= total_entries &&
clu.dir != EXFAT_EOF_CLUSTER) {
i = dentry & (dentries_per_clu - 1);
ret = exfat_get_empty_dentry_set(es, sb, &clu, i, num_entries);
if (ret < 0)
return ret;
else if (ret == 0)
return dentry;
dentry += ret;
i += ret;
while (i >= dentries_per_clu) {
if (exfat_chain_advance(sb, &clu, 1))
return -EIO;
i -= dentries_per_clu;
}
}
hint_femp->eidx = dentry;
hint_femp->count = 0;
if (dentry == total_entries || clu.dir == EXFAT_EOF_CLUSTER)
exfat_chain_set(&hint_femp->cur, EXFAT_EOF_CLUSTER, 0,
clu.flags);
else
hint_femp->cur = clu;
return -ENOSPC;
}
static int exfat_check_max_dentries(struct inode *inode)
{
if (exfat_bytes_to_dentries(i_size_read(inode)) >= MAX_EXFAT_DENTRIES) {
/*
* exFAT spec allows a dir to grow up to 8388608(256MB)
* dentries
*/
Annotation
- Immediate include surface: `linux/iversion.h`, `linux/namei.h`, `linux/slab.h`, `linux/buffer_head.h`, `linux/nls.h`, `exfat_raw.h`, `exfat_fs.h`.
- Detected declarations: `function Copyright`, `function exfat_d_version_set`, `function exfat_d_revalidate`, `function exfat_striptail_len`, `function exfat_d_hash`, `function exfat_d_cmp`, `function exfat_utf8_d_hash`, `function exfat_utf8_d_cmp`, `function exfat_search_empty_slot`, `function exfat_check_max_dentries`.
- 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.