include/linux/iosys-map.h
Source file repositories/reference/linux-study-clean/include/linux/iosys-map.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/iosys-map.h- Extension
.h- Size
- 17127 bytes
- Lines
- 512
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler_types.hlinux/io.hlinux/string.h
Detected Declarations
struct iosys_mapfunction iosys_map_set_vaddrfunction iosys_map_set_vaddr_iomemfunction iosys_map_is_equalfunction iosys_map_is_nullfunction iosys_map_is_setfunction iosys_map_clearfunction iosys_map_memcpy_tofunction iosys_map_memcpy_fromfunction iosys_map_incrfunction iosys_map_memset
Annotated Snippet
struct iosys_map {
union {
void __iomem *vaddr_iomem;
void *vaddr;
};
bool is_iomem;
};
/**
* IOSYS_MAP_INIT_VADDR - Initializes struct iosys_map to an address in system memory
* @vaddr_: A system-memory address
*/
#define IOSYS_MAP_INIT_VADDR(vaddr_) \
{ \
.vaddr = (vaddr_), \
.is_iomem = false, \
}
/**
* IOSYS_MAP_INIT_VADDR_IOMEM - Initializes struct iosys_map to an address in I/O memory
* @vaddr_iomem_: An I/O-memory address
*/
#define IOSYS_MAP_INIT_VADDR_IOMEM(vaddr_iomem_) \
{ \
.vaddr_iomem = (vaddr_iomem_), \
.is_iomem = true, \
}
/**
* IOSYS_MAP_INIT_OFFSET - Initializes struct iosys_map from another iosys_map
* @map_: The dma-buf mapping structure to copy from
* @offset_: Offset to add to the other mapping
*
* Initializes a new iosys_map struct based on another passed as argument. It
* does a shallow copy of the struct so it's possible to update the back storage
* without changing where the original map points to. It is the equivalent of
* doing:
*
* .. code-block:: c
*
* iosys_map map = other_map;
* iosys_map_incr(&map, &offset);
*
* Example usage:
*
* .. code-block:: c
*
* void foo(struct device *dev, struct iosys_map *base_map)
* {
* ...
* struct iosys_map map = IOSYS_MAP_INIT_OFFSET(base_map, FIELD_OFFSET);
* ...
* }
*
* The advantage of using the initializer over just increasing the offset with
* iosys_map_incr() like above is that the new map will always point to the
* right place of the buffer during its scope. It reduces the risk of updating
* the wrong part of the buffer and having no compiler warning about that. If
* the assignment to IOSYS_MAP_INIT_OFFSET() is forgotten, the compiler can warn
* about the use of uninitialized variable.
*/
#define IOSYS_MAP_INIT_OFFSET(map_, offset_) ({ \
struct iosys_map copy_ = *map_; \
iosys_map_incr(©_, offset_); \
copy_; \
})
/**
* iosys_map_set_vaddr - Sets a iosys mapping structure to an address in system memory
* @map: The iosys_map structure
* @vaddr: A system-memory address
*
* Sets the address and clears the I/O-memory flag.
*/
static inline void iosys_map_set_vaddr(struct iosys_map *map, void *vaddr)
{
map->vaddr = vaddr;
map->is_iomem = false;
}
/**
* iosys_map_set_vaddr_iomem - Sets a iosys mapping structure to an address in I/O memory
* @map: The iosys_map structure
* @vaddr_iomem: An I/O-memory address
*
* Sets the address and the I/O-memory flag.
*/
static inline void iosys_map_set_vaddr_iomem(struct iosys_map *map,
void __iomem *vaddr_iomem)
{
Annotation
- Immediate include surface: `linux/compiler_types.h`, `linux/io.h`, `linux/string.h`.
- Detected declarations: `struct iosys_map`, `function iosys_map_set_vaddr`, `function iosys_map_set_vaddr_iomem`, `function iosys_map_is_equal`, `function iosys_map_is_null`, `function iosys_map_is_set`, `function iosys_map_clear`, `function iosys_map_memcpy_to`, `function iosys_map_memcpy_from`, `function iosys_map_incr`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.