IOSYS_MAP_INIT_OFFSET(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– IOSYS_MAP_INIT_OFFSET πŸ’–

bestie this one's straight out of the Kernel API Manual and it is so useful β€” it's the macro that gives your iosys_map a whole new vibe without losing its roots ✨

πŸŽ€ NAME πŸŽ€

IOSYS_MAP_INIT_OFFSET β€” Initializes struct iosys_map from another iosys_map. that's it, that's the tweet πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

IOSYS_MAP_INIT_OFFSET (map_ , offset_ );

🌸 ARGUMENTS 🌸

  • map_ β€” The dma-buf mapping structure to copy from. this is the source map, the one you're building off of, the blueprint πŸ’–
  • offset_ β€” Offset to add to the other mapping. the little nudge forward, yk? the "scoot over" of it all 🫢

🌈 DESCRIPTION 🌈

okay so here's the tea: this macro initializes a new iosys_map struct based on another passed as argument. it does a shallow copy of the struct, which is iconic because it means it's possible to update the back storage without changing where the original map points to. periodt πŸ’…

it's literally the equivalent of doing:

iosys_map map = other_map;
iosys_map_incr(map, offset);

Example usage, bestie:

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's giving safety, it's giving main character energy 🫢 It reduces the risk of updating the wrong part of the buffer and having no compiler warning about that. and like, if the assignment to IOSYS_MAP_INIT_OFFSET is forgotten, the compiler can warn about the use of uninitialized variable. chefs kiss πŸ‘‘

πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie! brought to you by ./include/linux, dated October 2026, IOSYS_MAP_INIT_OFFSET(9) in the Kernel API Manual πŸ’–βœ¨ now go slay those buffer offsets πŸŽ€πŸ‘‘

πŸ“¦ where this page comes from