fs/dlm/plock.c
Source file repositories/reference/linux-study-clean/fs/dlm/plock.c
File Facts
- System
- Linux kernel
- Corpus path
fs/dlm/plock.c- Extension
.c- Size
- 14359 bytes
- Lines
- 631
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/filelock.hlinux/miscdevice.hlinux/poll.hlinux/dlm.hlinux/dlm_plock.hlinux/slab.htrace/events/dlm.hdlm_internal.hlockspace.h
Detected Declarations
struct plock_async_datastruct plock_opfunction set_versionfunction list_for_each_entryfunction check_versionfunction dlm_release_plock_opfunction send_opfunction do_lock_cancelfunction dlm_posix_lockfunction dlm_plock_callbackfunction dlm_posix_unlockfunction wait_eventfunction dlm_posix_getfunction dev_readfunction dev_writefunction list_for_each_entryfunction dev_pollfunction dlm_plock_initfunction dlm_plock_exitexport dlm_posix_lockexport dlm_posix_unlockexport dlm_posix_cancelexport dlm_posix_get
Annotated Snippet
static const struct file_operations dev_fops = {
.read = dev_read,
.write = dev_write,
.poll = dev_poll,
.owner = THIS_MODULE,
.llseek = noop_llseek,
};
static struct miscdevice plock_dev_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = DLM_PLOCK_MISC_NAME,
.fops = &dev_fops
};
int dlm_plock_init(void)
{
int rv;
rv = misc_register(&plock_dev_misc);
if (rv)
log_print("dlm_plock_init: misc_register failed %d", rv);
return rv;
}
void dlm_plock_exit(void)
{
misc_deregister(&plock_dev_misc);
WARN_ON(!list_empty(&send_list));
WARN_ON(!list_empty(&recv_list));
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/filelock.h`, `linux/miscdevice.h`, `linux/poll.h`, `linux/dlm.h`, `linux/dlm_plock.h`, `linux/slab.h`, `trace/events/dlm.h`.
- Detected declarations: `struct plock_async_data`, `struct plock_op`, `function set_version`, `function list_for_each_entry`, `function check_version`, `function dlm_release_plock_op`, `function send_op`, `function do_lock_cancel`, `function dlm_posix_lock`, `function dlm_plock_callback`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.