fs/squashfs/symlink.c
Source file repositories/reference/linux-study-clean/fs/squashfs/symlink.c
File Facts
- System
- Linux kernel
- Corpus path
fs/squashfs/symlink.c- Extension
.c- Size
- 3093 bytes
- Lines
- 110
- 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.
- 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/vfs.hlinux/kernel.hlinux/string.hlinux/pagemap.hlinux/xattr.hsquashfs_fs.hsquashfs_fs_sb.hsquashfs_fs_i.hsquashfs.hxattr.h
Detected Declarations
function Copyright
Annotated Snippet
if (bytes < 0) {
ERROR("Unable to read symlink [%llx:%x]\n",
squashfs_i(inode)->start,
squashfs_i(inode)->offset);
error = bytes;
goto out;
}
}
/*
* Read length bytes from symlink metadata. Squashfs_read_metadata
* is not used here because it can sleep and we want to use
* kmap_local to map the folio. Instead call the underlying
* squashfs_cache_get routine. As length bytes may overlap metadata
* blocks, we may need to call squashfs_cache_get multiple times.
*/
for (bytes = 0; bytes < length; offset = 0, bytes += copied) {
entry = squashfs_cache_get(sb, msblk->block_cache, block, 0);
if (entry->error) {
ERROR("Unable to read symlink [%llx:%x]\n",
squashfs_i(inode)->start,
squashfs_i(inode)->offset);
squashfs_cache_put(entry);
error = entry->error;
goto out;
}
pageaddr = kmap_local_folio(folio, 0);
copied = squashfs_copy_data(pageaddr + bytes, entry, offset,
length - bytes);
if (copied == length - bytes)
memset(pageaddr + length, 0, PAGE_SIZE - length);
else
block = entry->next_index;
kunmap_local(pageaddr);
squashfs_cache_put(entry);
}
flush_dcache_folio(folio);
error = 0;
out:
folio_end_read(folio, error == 0);
return error;
}
const struct address_space_operations squashfs_symlink_aops = {
.read_folio = squashfs_symlink_read_folio
};
const struct inode_operations squashfs_symlink_inode_ops = {
.get_link = page_get_link,
.listxattr = squashfs_listxattr
};
Annotation
- Immediate include surface: `linux/fs.h`, `linux/vfs.h`, `linux/kernel.h`, `linux/string.h`, `linux/pagemap.h`, `linux/xattr.h`, `squashfs_fs.h`, `squashfs_fs_sb.h`.
- Detected declarations: `function Copyright`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.