iosys_map_rd_field(9)
๐ iosys_map_rd_field(9) โ like, the whole Kernel API Manual, but make it make sense
okay so bestie, welcome to iosys_map_rd_field โ it's a macro from the Kernel API Manual and honestly it's giving "tiny but powerful" ๐. Its whole thing? Read a member from a struct in an iosys_map. That's it. That's the vibe check. โจ
๐ธ NAME ๐ธ
iosys_map_rd_field โ reads a member out of a struct that lives inside the iosys_map. no cap, that's the job ๐ซถ
๐ฆ SYNOPSIS ๐ฆ
iosys_map_rd_field (map__ , struct_offset__ , struct_type__ , field__ );
๐ ARGUMENTS ๐
map__โ theiosys_mapstructure itself. the main character, literally ๐struct_offset__โ offset from the beginning of the map, i.e. where the struct is hanging out. like a little address coordinate ๐บ๏ธstruct_type__โ the struct that describes how the mapping is laid out. it's the blueprint, the floor plan, the whole aesthetic ๐field__โ the member of the struct you actually wanna read. the one you came for ๐
โจ DESCRIPTION โจ
So what it does is โ it reads a value from iosys_map, and it figures out the layout because a C struct is describing it, starting at struct_offset__. It calculates the field offset and the size, then reads the value. Math but make it fashion. ๐งฎโจ
โ ๏ธ okay important, don't skip this: if the field access would incur in unaligned access, then either iosys_map_memcpy_from needs to be used, or the architecture must support it. no vibes-based guessing here, bestie. it's fr fr a real caveat ๐ญ
For example: suppose there's a struct foo defined like below, and you need to read the value foo.field2.inner2 from the iosys_map:
struct foo {
int field1;
struct {
int inner1;
int inner2;
} field2;
int field3;
} __packed;
This is the expected memory layout of a buffer using iosys_map_rd_field:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Address Content โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ buffer + 0000 start of mmapped buffer โ
โ pointed by iosys_map โ
โ buffer + struct_offset__ start of struct foo โ
โ buffer + wwww foo.field2.inner2 โ
โ buffer + yyyy end of struct foo`` โ
โ buffer + zzzz end of mmaped buffer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The values that this macro calculates automatically โ or the ones that just aren't needed โ are denoted by wwww, yyyy and zzzz. cute little placeholders, they ate ๐
And this is the code to read that value:
x = iosys_map_rd_field(map, offset, struct foo, field2.inner2);
๐ฅ RETURN ๐ฅ
The value read from the mapping. that's it, that's the whole return, and it understood the assignment ๐
๐ SEE ALSO ๐
- Kernel file
./include/linux/iosys-map.hoverview(9) - struct
iosys_map(9) IOSYS_MAP_INIT_VADDR(9)IOSYS_MAP_INIT_VADDR_IOMEM(9)IOSYS_MAP_INIT_OFFSET(9)iosys_map_set_vaddr(9)iosys_map_set_vaddr_iomem(9)iosys_map_is_equal(9)iosys_map_is_null(9)iosys_map_is_set(9)iosys_map_clear(9)iosys_map_memcpy_to(9)iosys_map_memcpy_from(9)iosys_map_incr(9)iosys_map_memset(9)iosys_map_rd(9)iosys_map_wr(9)iosys_map_wr_field(9)
like, the whole iosys_map friend group showed up to the party ๐ซถ๐
okay that's the page!! sourced straight from ./include/linux, dated October 2026, and yeah โ iosys_map_rd_field(9), that's her ๐
โจ
๐ฆ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms