idr_for_each (9) - Linux Manuals
idr_for_each: iterate through all stored pointers
idr_for_each - iterate through all stored pointers
int idr_for_each(struct idr
* idp, int (*fn) (int id, void *p, void *data), void * data);
- idr handle
- function to be called for each pointer
- data passed back to callback function
Iterate over the pointers registered with the given idr. The callback function will be called for each pointer currently registered, passing the id, the pointer and the data pointer passed to this function. It is not safe to modify the idr tree while in the callback, so functions such as idr_get_new and idr_remove are not allowed.
We check the return of fn each time. If it returns anything other than 0, we break out and return that value.