fs/udf/namei.c
Source file repositories/reference/linux-study-clean/fs/udf/namei.c
File Facts
- System
- Linux kernel
- Corpus path
fs/udf/namei.c- Extension
.c- Size
- 26595 bytes
- Lines
- 1029
- 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
udfdecl.hudf_i.hudf_sb.hlinux/string.hlinux/errno.hlinux/mm.hlinux/slab.hlinux/sched.hlinux/crc-itu-t.hlinux/exportfs.hlinux/iversion.h
Detected Declarations
function udf_matchfunction udf_fiiter_find_entryfunction udf_expand_dir_adinicbfunction udf_fiiter_add_entryfunction udf_fiiter_delete_entryfunction udf_add_fid_counterfunction udf_add_nondirfunction udf_createfunction udf_tmpfilefunction udf_mknodfunction empty_dirfunction udf_rmdirfunction udf_unlinkfunction udf_symlinkfunction udf_linkfunction udf_renamefunction udf_encode_fh
Annotated Snippet
if (iter->fi.fileCharacteristics & FID_FILE_CHAR_DELETED) {
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNDELETE))
continue;
}
if (iter->fi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) {
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNHIDE))
continue;
}
if ((iter->fi.fileCharacteristics & FID_FILE_CHAR_PARENT) &&
isdotdot)
goto out_ok;
if (!iter->fi.lengthFileIdent)
continue;
flen = udf_get_filename(sb, iter->name,
iter->fi.lengthFileIdent, fname, UDF_NAME_LEN);
if (flen < 0) {
ret = flen;
goto out_err;
}
if (udf_match(flen, fname, child->len, child->name))
goto out_ok;
}
if (!ret)
ret = -ENOENT;
out_err:
udf_fiiter_release(iter);
out_ok:
kfree(fname);
return ret;
}
static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
struct inode *inode = NULL;
struct udf_fileident_iter iter;
int err;
if (dentry->d_name.len > UDF_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
err = udf_fiiter_find_entry(dir, &dentry->d_name, &iter);
if (err < 0 && err != -ENOENT)
return ERR_PTR(err);
if (err == 0) {
struct kernel_lb_addr loc;
loc = lelb_to_cpu(iter.fi.icb.extLocation);
udf_fiiter_release(&iter);
inode = udf_iget(dir->i_sb, &loc);
}
return d_splice_alias(inode, dentry);
}
static int udf_expand_dir_adinicb(struct inode *inode, udf_pblk_t *block)
{
udf_pblk_t newblock;
struct buffer_head *dbh = NULL;
struct kernel_lb_addr eloc;
struct extent_position epos;
uint8_t alloctype;
struct udf_inode_info *iinfo = UDF_I(inode);
struct udf_fileident_iter iter;
uint8_t *impuse;
int ret;
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
alloctype = ICBTAG_FLAG_AD_SHORT;
else
alloctype = ICBTAG_FLAG_AD_LONG;
if (!inode->i_size) {
iinfo->i_alloc_type = alloctype;
mark_inode_dirty(inode);
return 0;
}
/* alloc block, and copy data to it */
*block = udf_new_block(inode->i_sb, inode,
iinfo->i_location.partitionReferenceNum,
Annotation
- Immediate include surface: `udfdecl.h`, `udf_i.h`, `udf_sb.h`, `linux/string.h`, `linux/errno.h`, `linux/mm.h`, `linux/slab.h`, `linux/sched.h`.
- Detected declarations: `function udf_match`, `function udf_fiiter_find_entry`, `function udf_expand_dir_adinicb`, `function udf_fiiter_add_entry`, `function udf_fiiter_delete_entry`, `function udf_add_fid_counter`, `function udf_add_nondir`, `function udf_create`, `function udf_tmpfile`, `function udf_mknod`.
- 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.