drivers/mtd/ubi/cdev.c
Source file repositories/reference/linux-study-clean/drivers/mtd/ubi/cdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/ubi/cdev.c- Extension
.c- Size
- 26048 bytes
- Lines
- 1178
- Domain
- Driver Families
- Bucket
- drivers/mtd
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/module.hlinux/stat.hlinux/slab.hlinux/ioctl.hlinux/capability.hlinux/uaccess.hlinux/compat.hlinux/math64.hmtd/ubi-user.hubi.h
Detected Declarations
function Copyrightfunction revoke_exclusivefunction vol_cdev_openfunction vol_cdev_releasefunction vol_cdev_llseekfunction vol_cdev_fsyncfunction vol_cdev_readfunction vol_cdev_direct_writefunction vol_cdev_writefunction vol_cdev_ioctlfunction verify_mkvol_reqfunction verify_rsvol_reqfunction rename_volumesfunction list_for_each_entryfunction ubi_get_ec_infofunction ubi_cdev_ioctlfunction ctrl_cdev_ioctl
Annotated Snippet
const struct file_operations ubi_vol_cdev_operations = {
.owner = THIS_MODULE,
.open = vol_cdev_open,
.release = vol_cdev_release,
.llseek = vol_cdev_llseek,
.read = vol_cdev_read,
.write = vol_cdev_write,
.fsync = vol_cdev_fsync,
.unlocked_ioctl = vol_cdev_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
/* UBI character device operations */
const struct file_operations ubi_cdev_operations = {
.owner = THIS_MODULE,
.unlocked_ioctl = ubi_cdev_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
/* UBI control character device operations */
const struct file_operations ubi_ctrl_cdev_operations = {
.owner = THIS_MODULE,
.unlocked_ioctl = ctrl_cdev_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
Annotation
- Immediate include surface: `linux/module.h`, `linux/stat.h`, `linux/slab.h`, `linux/ioctl.h`, `linux/capability.h`, `linux/uaccess.h`, `linux/compat.h`, `linux/math64.h`.
- Detected declarations: `function Copyright`, `function revoke_exclusive`, `function vol_cdev_open`, `function vol_cdev_release`, `function vol_cdev_llseek`, `function vol_cdev_fsync`, `function vol_cdev_read`, `function vol_cdev_direct_write`, `function vol_cdev_write`, `function vol_cdev_ioctl`.
- Atlas domain: Driver Families / drivers/mtd.
- 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.