BUS_GET_RESOURCE(9)

πŸ’– BUS_GET_RESOURCE(9) πŸ’–

okay so bestie, welcome to the Kernel Developer's Manual, section 9 β€” this is where we talk about bus_get_resource πŸŽ€ and honestly? it's giving "small function, big responsibilities". let's get into it πŸ¦‹


✨ NAME ✨

bus_get_resource β€” read a resource range/value with a given resource ID πŸ’…


🌸 SYNOPSIS 🌸

#include <sys/param.h>
#include <sys/bus.h>
#include <sys/rman.h>

int
bus_get_resource(device_t dev, int type, int rid, rman_res_t *startp,
    rman_res_t *countp);

πŸ‘‘ DESCRIPTION πŸ‘‘

so the bus_get_resource() function reads the range or value of the resource type, rid pair, and stores it in the startp and countp arguments. like it literally goes and fetches the tea and puts it in your pointers 🫢

the arguments are as follows, no cap:

  • dev β€” the device to read the resource from. that's your main character here πŸ’œ
  • type β€” the type of resource you want to read. it is one of:
    • SYS_RES_IRQ β€” for IRQs ⚑
    • SYS_RES_DRQ β€” for ISA DMA lines 🌈
    • SYS_RES_MEMORY β€” for I/O memory 🧠
    • SYS_RES_IOPORT β€” for I/O ports πŸ”Œ
  • rid β€” a bus-specific handle that identifies the resource being read. iykyk πŸ”₯
  • startp β€” a pointer to the start address of this resource. πŸ“
  • countp β€” a pointer to the length of the resource. for example, the size of the memory in bytes. it's literally measuring the vibe πŸ“βœ¨

⭐ RETURN VALUES ⭐

zero is returned on success πŸ’š otherwise an error is returned 😭 (ngl we hate to see it, but that's the deal).


πŸ¦‹ SEE ALSO πŸ¦‹


πŸ’… AUTHORS πŸ’…

this manual page was written by Sascha Wildner. iconic behavior, we love to see it πŸ‘‘


Debian Β· September 26, 2015 β€” that's the source, the version and the date bestie, and that's a wrap πŸ’– periodt πŸŽ€

πŸ“¦ where this page comes from