mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
idr: idr_for_each_entry() macro
Inspired by the list_for_each_entry() macro
This commit is contained in:
parent
6618bf1638
commit
9749f30f1a
1 changed files with 11 additions and 0 deletions
|
@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id);
|
||||||
|
|
||||||
void __init idr_init_cache(void);
|
void __init idr_init_cache(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* idr_for_each_entry - iterate over an idr's elements of a given type
|
||||||
|
* @idp: idr handle
|
||||||
|
* @entry: the type * to use as cursor
|
||||||
|
* @id: id entry's key
|
||||||
|
*/
|
||||||
|
#define idr_for_each_entry(idp, entry, id) \
|
||||||
|
for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \
|
||||||
|
entry != NULL; \
|
||||||
|
++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
|
||||||
|
|
||||||
#endif /* __IDR_H__ */
|
#endif /* __IDR_H__ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue