find_next_res(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… find_next_res(9)

okay so bestie, this one lives in the Kernel API Manual and it's literally the resource-tree scavenger hunt function. let's get into it 🫢


✨ NAME ✨

find_next_res β€” finds the lowest resource that covers part of [@start..@end]. yes, the lowest, it's giving "first one in line gets it" energy πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

int find_next_res (struct resource *parent , resource_size_t start ,
resource_size_t end , unsigned long flags , unsigned long desc , struct
resource *res );

🌸 ARGUMENTS 🌸

  • parent β€” the root of the resource tree you're snooping around in 🌳
  • start β€” start address of the resource you're searching for
  • end β€” end address of that exact same resource
  • flags β€” the flags the resource must have (non-negotiable, sorry 😌)
  • desc β€” the descriptor the resource must have
  • res β€” return ptr, if a resource gets found πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie πŸ“ β€” if a resource is found, it returns 0 and *res gets overwritten with the part of the resource that's within [start..end]. if none is found? returns -ENODEV. and if your parameters are invalid? -EINVAL, no cap.

the caller must specify start, end, flags, and desc β€” and yes, desc may be IORES_DESC_NONE, so don't stress about that one πŸ’–


🌈 SEE ALSO 🌈

kernel file ./kernel/resource.c β€” and like, the whole resource.c friend group:


ngl bestie, read the whole squad before you go poking at parent β€” the resource tree does not play 😭

and that's the whole page, mwah πŸ’‹ this one's from ./kernel, October 2026 β€” catch you in the next manpage, bestie 🧚✨

πŸ“¦ where this page comes from