Lines Matching refs:idr
19 struct idr { struct
56 #define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
66 static inline unsigned int idr_get_cursor(const struct idr *idr) in idr_get_cursor() argument
68 return READ_ONCE(idr->idr_next); in idr_get_cursor()
79 static inline void idr_set_cursor(struct idr *idr, unsigned int val) in idr_set_cursor() argument
81 WRITE_ONCE(idr->idr_next, val); in idr_set_cursor()
101 #define idr_lock(idr) xa_lock(&(idr)->idr_rt) argument
102 #define idr_unlock(idr) xa_unlock(&(idr)->idr_rt) argument
103 #define idr_lock_bh(idr) xa_lock_bh(&(idr)->idr_rt) argument
104 #define idr_unlock_bh(idr) xa_unlock_bh(&(idr)->idr_rt) argument
105 #define idr_lock_irq(idr) xa_lock_irq(&(idr)->idr_rt) argument
106 #define idr_unlock_irq(idr) xa_unlock_irq(&(idr)->idr_rt) argument
107 #define idr_lock_irqsave(idr, flags) \ argument
108 xa_lock_irqsave(&(idr)->idr_rt, flags)
109 #define idr_unlock_irqrestore(idr, flags) \ argument
110 xa_unlock_irqrestore(&(idr)->idr_rt, flags)
114 int idr_alloc(struct idr *, void *ptr, int start, int end, gfp_t);
115 int __must_check idr_alloc_u32(struct idr *, void *ptr, u32 *id,
117 int idr_alloc_cyclic(struct idr *, void *ptr, int start, int end, gfp_t);
118 void *idr_remove(struct idr *, unsigned long id);
119 void *idr_find(const struct idr *, unsigned long id);
120 int idr_for_each(const struct idr *,
122 void *idr_get_next(struct idr *, int *nextid);
123 void *idr_get_next_ul(struct idr *, unsigned long *nextid);
124 void *idr_replace(struct idr *, void *, unsigned long id);
125 void idr_destroy(struct idr *);
135 static inline void idr_init_base(struct idr *idr, int base) in idr_init_base() argument
137 INIT_RADIX_TREE(&idr->idr_rt, IDR_RT_MARKER); in idr_init_base()
138 idr->idr_base = base; in idr_init_base()
139 idr->idr_next = 0; in idr_init_base()
149 static inline void idr_init(struct idr *idr) in idr_init() argument
151 idr_init_base(idr, 0); in idr_init()
160 static inline bool idr_is_empty(const struct idr *idr) in idr_is_empty() argument
162 return radix_tree_empty(&idr->idr_rt) && in idr_is_empty()
163 radix_tree_tagged(&idr->idr_rt, IDR_FREE); in idr_is_empty()
187 #define idr_for_each_entry(idr, entry, id) \ argument
188 for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; id += 1U)
201 #define idr_for_each_entry_ul(idr, entry, tmp, id) \ argument
203 tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \
214 #define idr_for_each_entry_continue(idr, entry, id) \ argument
215 for ((entry) = idr_get_next((idr), &(id)); \
217 ++id, (entry) = idr_get_next((idr), &(id)))
228 #define idr_for_each_entry_continue_ul(idr, entry, tmp, id) \ argument
230 tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \