idr_for_each — iterate through all stored pointers


int idr_for_each (const struct idr * idr,
 int (*fn) (int id, void *p, void *data),
 void * data);


const struct idr * idr

idr handle

int (*)(int id, void *p, void *data) fn

function to be called for each pointer

void * data

data passed to callback function


The callback function will be called for each entry in idr, passing the id, the pointer and the data pointer passed to this function.

If fn returns anything other than 0, the iteration stops and that value is returned from this function.

idr_for_each can be called concurrently with idr_alloc and idr_remove if protected by RCU. Newly added entries may not be seen and deleted entries may be seen, but adding and removing entries will not cause other entries to be skipped, nor spurious ones to be seen.