fs/proc/inode.c
Source file repositories/reference/linux-study-clean/fs/proc/inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/proc/inode.c- Extension
.c- Size
- 17029 bytes
- Lines
- 681
- 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/cache.hlinux/time.hlinux/proc_fs.hlinux/kernel.hlinux/pid_namespace.hlinux/mm.hlinux/string.hlinux/stat.hlinux/completion.hlinux/poll.hlinux/printk.hlinux/file.hlinux/limits.hlinux/init.hlinux/module.hlinux/sysctl.hlinux/seq_file.hlinux/slab.hlinux/mount.hlinux/bug.hinternal.h
Detected Declarations
function Copyrightfunction proc_free_inodefunction init_oncefunction proc_init_kmemcachefunction proc_invalidate_siblings_dcachefunction proc_show_optionsfunction use_pdefunction unuse_pdefunction close_pdeofunction proc_entry_rundownfunction proc_reg_llseekfunction proc_reg_read_iterfunction pde_readfunction proc_reg_readfunction pde_writefunction proc_reg_writefunction pde_pollfunction proc_reg_pollfunction pde_ioctlfunction proc_reg_unlocked_ioctlfunction pde_compat_ioctlfunction proc_reg_compat_ioctlfunction pde_mmapfunction proc_reg_mmapfunction pde_get_unmapped_areafunction proc_reg_get_unmapped_areafunction proc_reg_openfunction proc_reg_releasefunction proc_put_link
Annotated Snippet
static const struct file_operations proc_reg_file_ops = {
.llseek = proc_reg_llseek,
.read = proc_reg_read,
.write = proc_reg_write,
.poll = proc_reg_poll,
.unlocked_ioctl = proc_reg_unlocked_ioctl,
.mmap = proc_reg_mmap,
.get_unmapped_area = proc_reg_get_unmapped_area,
.open = proc_reg_open,
.release = proc_reg_release,
};
static const struct file_operations proc_iter_file_ops = {
.llseek = proc_reg_llseek,
.read_iter = proc_reg_read_iter,
.write = proc_reg_write,
.splice_read = copy_splice_read,
.poll = proc_reg_poll,
.unlocked_ioctl = proc_reg_unlocked_ioctl,
.mmap = proc_reg_mmap,
.get_unmapped_area = proc_reg_get_unmapped_area,
.open = proc_reg_open,
.release = proc_reg_release,
};
#ifdef CONFIG_COMPAT
static const struct file_operations proc_reg_file_ops_compat = {
.llseek = proc_reg_llseek,
.read = proc_reg_read,
.write = proc_reg_write,
.poll = proc_reg_poll,
.unlocked_ioctl = proc_reg_unlocked_ioctl,
.compat_ioctl = proc_reg_compat_ioctl,
.mmap = proc_reg_mmap,
.get_unmapped_area = proc_reg_get_unmapped_area,
.open = proc_reg_open,
.release = proc_reg_release,
};
static const struct file_operations proc_iter_file_ops_compat = {
.llseek = proc_reg_llseek,
.read_iter = proc_reg_read_iter,
.splice_read = copy_splice_read,
.write = proc_reg_write,
.poll = proc_reg_poll,
.unlocked_ioctl = proc_reg_unlocked_ioctl,
.compat_ioctl = proc_reg_compat_ioctl,
.mmap = proc_reg_mmap,
.get_unmapped_area = proc_reg_get_unmapped_area,
.open = proc_reg_open,
.release = proc_reg_release,
};
#endif
static void proc_put_link(void *p)
{
unuse_pde(p);
}
static const char *proc_get_link(struct dentry *dentry,
struct inode *inode,
struct delayed_call *done)
{
struct proc_dir_entry *pde = PDE(inode);
if (!use_pde(pde))
return ERR_PTR(-EINVAL);
set_delayed_call(done, proc_put_link, pde);
return pde->data;
}
const struct inode_operations proc_link_inode_operations = {
.get_link = proc_get_link,
};
struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
{
struct inode *inode = new_inode(sb);
if (!inode) {
pde_put(de);
return NULL;
}
inode->i_private = de->data;
inode->i_ino = de->low_ino;
simple_inode_init_ts(inode);
PROC_I(inode)->pde = de;
if (is_empty_pde(de)) {
make_empty_dir_inode(inode);
return inode;
Annotation
- Immediate include surface: `linux/cache.h`, `linux/time.h`, `linux/proc_fs.h`, `linux/kernel.h`, `linux/pid_namespace.h`, `linux/mm.h`, `linux/string.h`, `linux/stat.h`.
- Detected declarations: `function Copyright`, `function proc_free_inode`, `function init_once`, `function proc_init_kmemcache`, `function proc_invalidate_siblings_dcache`, `function proc_show_options`, `function use_pde`, `function unuse_pde`, `function close_pdeo`, `function proc_entry_rundown`.
- 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.