include/linux/device-mapper.h
Source file repositories/reference/linux-study-clean/include/linux/device-mapper.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/device-mapper.h- Extension
.h- Size
- 22316 bytes
- Lines
- 766
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/bio.hlinux/blkdev.hlinux/dm-ioctl.hlinux/math64.hlinux/ratelimit.h
Detected Declarations
struct dm_devstruct dm_targetstruct dm_tablestruct dm_report_zones_argsstruct mapped_devicestruct bio_vecstruct dm_devstruct target_typestruct dm_targetstruct dm_arg_setstruct dm_argstruct dm_report_zones_argsenum dax_access_modeenum dm_queue_modefunction ceilingfunction to_bytesfunction dm_stack_bs_limits
Annotated Snippet
* module_init() and module_exit().
*
* @name: DM target's name
*/
#define module_dm(name) \
static int __init dm_##name##_init(void) \
{ \
return dm_register_target(&(name##_target)); \
} \
module_init(dm_##name##_init) \
static void __exit dm_##name##_exit(void) \
{ \
dm_unregister_target(&(name##_target)); \
} \
module_exit(dm_##name##_exit)
/*
* Definitions of return values from target end_io function.
*/
#define DM_ENDIO_DONE 0
#define DM_ENDIO_INCOMPLETE 1
#define DM_ENDIO_REQUEUE 2
#define DM_ENDIO_DELAY_REQUEUE 3
/*
* Definitions of return values from target map function.
*/
#define DM_MAPIO_SUBMITTED 0
#define DM_MAPIO_REMAPPED 1
#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
#define DM_MAPIO_DELAY_REQUEUE DM_ENDIO_DELAY_REQUEUE
#define DM_MAPIO_KILL 4
#define dm_sector_div64(x, y)( \
{ \
u64 _res; \
(x) = div64_u64_rem(x, y, &_res); \
_res; \
} \
)
/*
* Ceiling(n / sz)
*/
#define dm_div_up(n, sz) (((n) + (sz) - 1) / (sz))
#define dm_sector_div_up(n, sz) ( \
{ \
sector_t _r = ((n) + (sz) - 1); \
sector_div(_r, (sz)); \
_r; \
} \
)
/*
* ceiling(n / size) * size
*/
#define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz))
/*
* Sector offset taken relative to the start of the target instead of
* relative to the start of the device.
*/
#define dm_target_offset(ti, sector) ((sector) - (ti)->begin)
static inline sector_t to_sector(unsigned long long n)
{
return (n >> SECTOR_SHIFT);
}
static inline unsigned long to_bytes(sector_t n)
{
return (n << SECTOR_SHIFT);
}
static inline void dm_stack_bs_limits(struct queue_limits *limits, unsigned int bs)
{
limits->logical_block_size = max(limits->logical_block_size, bs);
limits->physical_block_size = max(limits->physical_block_size, bs);
limits->io_min = max(limits->io_min, bs);
}
#endif /* _LINUX_DEVICE_MAPPER_H */
Annotation
- Immediate include surface: `linux/bio.h`, `linux/blkdev.h`, `linux/dm-ioctl.h`, `linux/math64.h`, `linux/ratelimit.h`.
- Detected declarations: `struct dm_dev`, `struct dm_target`, `struct dm_table`, `struct dm_report_zones_args`, `struct mapped_device`, `struct bio_vec`, `struct dm_dev`, `struct target_type`, `struct dm_target`, `struct dm_arg_set`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: integration 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.