iopt_map_file_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ iopt_map_file_pages β€” the kernel API manual, bestie edition πŸ¦‹

okay so real talk: this is iopt_map_file_pages(9), straight out of the Kernel API Manual, and it's basically iopt_map_user_pages but for a file. Like, same energy, different source. no cap. πŸ’…


✨ NAME ✨

iopt_map_file_pages β€” literally "Like iopt_map_user_pages, but map a file." that's the whole vibe. it maps pages from a file instead of from user memory. iconic behavior honestly πŸŽ€


🌸 SYNOPSIS 🌸

int iopt_map_file_pages (struct iommufd_ctx *ictx , struct io_pagetable
*iopt , unsigned long *iova , int fd , unsigned long start , unsigned
long length , int iommu_prot , unsigned int flags );

she takes eight arguments and returns an int. yes eight. count them. we'll go through every single one, don't worry 🫢


πŸ’– ARGUMENTS πŸ’–

okay bestie, buckle up, here's the full roster β€” nobody gets skipped, this is a no-skipping zone:

  • ictx β€” the iommufd_ctx that the iopt is part of. like, whose family this pagetable belongs to 🏠
  • iopt β€” the io_pagetable we're acting on. the main character of this operation, fr.
  • iova β€” here's the tea β˜•: if IOPT_ALLOC_IOVA is set, this is unused on input and it holds the chosen iova on output (the kernel picks for you, slay). otherwise, it's the iova to map to on input β€” you're choosing, your call, your moment πŸ‘‘
  • fd β€” the fdno of a file to map. yes, an actual file descriptor. we mapping files today πŸ’€
  • start β€” map the file starting at this byte offset. like opening a book at page 47 except it's bytes πŸ“–
  • length β€” number of bytes to map. the size of the vibe. how much we're taking.
  • iommu_prot β€” a combination of IOMMU_READ/WRITE/etc bits for the mapping. this is where you say what's allowed β€” read? write? the etc bits?? whatever combination, it goes here πŸ”₯
  • flags β€” either IOPT_ALLOC_IOVA or zero. two options, that's it, that's the list. pick one bestie ✨

🌈 SEE ALSO 🌈

go look at these, they're all connected, iykyk:


πŸ‘‘ the sign-off πŸ‘‘

this absolute banger of a page lives in ./drivers/iommu/iommufd, and it was dated October 2026. that's the source and the date, both accounted for, we don't leave facts behind in this house πŸ§šπŸ’œ

mwah, go map some file pages, you're gonna do amazing πŸ’–

πŸ“¦ where this page comes from