fs/smb/client/readdir.c
Source file repositories/reference/linux-study-clean/fs/smb/client/readdir.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/readdir.c- Extension
.c- Size
- 34172 bytes
- Lines
- 1229
- 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/fs.hlinux/namei.hlinux/pagemap.hlinux/slab.hlinux/stat.hcifsglob.hcifsproto.hcifs_unicode.hcifs_debug.hcifs_fs_sb.hcifsfs.hsmb2proto.hfs_context.hcached_dir.hreparse.h
Detected Declarations
struct cifs_direntfunction Copyrightfunction dump_cifs_file_structfunction cifs_fill_common_infofunction cifs_posix_to_fattrfunction __dir_info_to_fattrfunction cifs_dir_info_to_fattrfunction cifs_fulldir_info_to_fattrfunction cifs_std_info_to_fattrfunction _initiate_cifs_searchfunction initiate_cifs_searchfunction cifs_unicode_bytelenfunction cifs_fill_dirent_posixfunction cifs_fill_dirent_unixfunction cifs_fill_dirent_dirfunction cifs_fill_dirent_fullfunction cifs_fill_dirent_searchfunction cifs_fill_dirent_bothfunction cifs_fill_dirent_stdfunction cifs_fill_direntfunction cifs_entry_is_dotfunction is_dir_changedfunction cifs_save_resume_keyfunction entryfunction is_dir_changedfunction emit_cached_direntsfunction list_for_each_entryfunction update_cached_dirents_countfunction finished_cached_dirents_countfunction add_cached_direntfunction cifs_dir_emitfunction cifs_filldirfunction cifs_readdir
Annotated Snippet
struct cifs_dirent {
const char *name;
size_t namelen;
u32 resume_key;
u64 ino;
};
static void cifs_fill_dirent_posix(struct cifs_dirent *de,
const struct smb2_posix_info *info)
{
struct smb2_posix_info_parsed parsed;
/* payload should have already been checked at this point */
if (posix_info_parse(info, NULL, &parsed) < 0) {
cifs_dbg(VFS, "Invalid POSIX info payload\n");
return;
}
de->name = parsed.name;
de->namelen = parsed.name_len;
de->resume_key = info->Ignored;
de->ino = le64_to_cpu(info->Inode);
}
static void cifs_fill_dirent_unix(struct cifs_dirent *de,
const FILE_UNIX_INFO *info, bool is_unicode)
{
de->name = &info->FileName[0];
if (is_unicode)
de->namelen = cifs_unicode_bytelen(de->name);
else
de->namelen = strnlen(de->name, PATH_MAX);
de->resume_key = info->ResumeKey;
de->ino = le64_to_cpu(info->basic.UniqueId);
}
static void cifs_fill_dirent_dir(struct cifs_dirent *de,
const FILE_DIRECTORY_INFO *info)
{
de->name = &info->FileName[0];
de->namelen = le32_to_cpu(info->FileNameLength);
de->resume_key = info->FileIndex;
}
static void cifs_fill_dirent_full(struct cifs_dirent *de,
const FILE_FULL_DIRECTORY_INFO *info)
{
de->name = &info->FileName[0];
de->namelen = le32_to_cpu(info->FileNameLength);
de->resume_key = info->FileIndex;
}
static void cifs_fill_dirent_search(struct cifs_dirent *de,
const FILE_ID_FULL_DIR_INFO *info)
{
de->name = &info->FileName[0];
de->namelen = le32_to_cpu(info->FileNameLength);
de->resume_key = info->FileIndex;
de->ino = le64_to_cpu(info->UniqueId);
}
static void cifs_fill_dirent_both(struct cifs_dirent *de,
const FILE_BOTH_DIRECTORY_INFO *info)
{
de->name = &info->FileName[0];
de->namelen = le32_to_cpu(info->FileNameLength);
de->resume_key = info->FileIndex;
}
static void cifs_fill_dirent_std(struct cifs_dirent *de,
const FIND_FILE_STANDARD_INFO *info)
{
de->name = &info->FileName[0];
/* one byte length, no endianness conversion */
de->namelen = info->FileNameLength;
de->resume_key = info->ResumeKey;
}
static int cifs_fill_dirent(struct cifs_dirent *de, const void *info,
u16 level, bool is_unicode)
{
memset(de, 0, sizeof(*de));
switch (level) {
case SMB_FIND_FILE_POSIX_INFO:
cifs_fill_dirent_posix(de, info);
break;
case SMB_FIND_FILE_UNIX:
cifs_fill_dirent_unix(de, info, is_unicode);
break;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/namei.h`, `linux/pagemap.h`, `linux/slab.h`, `linux/stat.h`, `cifsglob.h`, `cifsproto.h`, `cifs_unicode.h`.
- Detected declarations: `struct cifs_dirent`, `function Copyright`, `function dump_cifs_file_struct`, `function cifs_fill_common_info`, `function cifs_posix_to_fattr`, `function __dir_info_to_fattr`, `function cifs_dir_info_to_fattr`, `function cifs_fulldir_info_to_fattr`, `function cifs_std_info_to_fattr`, `function _initiate_cifs_search`.
- 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.