Lines Matching defs:idrp
165 idr_init(struct idr *idrp)
167 avl_create(&idrp->used_ids, idr_compare, sizeof(struct idr_used_id),
170 idrp->free_id_ranges = fr_new(0);
171 mutex_init(&idrp->lock, NULL, MUTEX_DRIVER, NULL);
175 idr_get_new_above(struct idr *idrp, void *obj, int start, int *newid)
183 mutex_enter(&idrp->lock);
184 range = fr_get(idrp->free_id_ranges, start);
186 range = fr_insert(idrp->free_id_ranges, start);
194 mutex_exit(&idrp->lock);
200 mutex_exit(&idrp->lock);
206 avl_add(&idrp->used_ids, used);
209 mutex_exit(&idrp->lock);
214 idr_find_used_id(struct idr *idrp, uint32_t id)
221 ret = avl_find(&idrp->used_ids, &match, NULL);
230 idr_find(struct idr *idrp, uint32_t id)
234 mutex_enter(&idrp->lock);
235 ret = idr_find_used_id(idrp, id);
237 mutex_exit(&idrp->lock);
241 mutex_exit(&idrp->lock);
246 idr_remove(struct idr *idrp, uint32_t id)
252 mutex_enter(&idrp->lock);
253 ide = idr_find_used_id(idrp, id);
255 mutex_exit(&idrp->lock);
261 mutex_exit(&idrp->lock);
267 range = idrp->free_id_ranges;
272 avl_remove(&idrp->used_ids, ide);
274 mutex_exit(&idrp->lock);
280 idr_remove_all(struct idr *idrp)
282 idr_destroy(idrp);
283 idr_init(idrp);
287 idr_replace(struct idr *idrp, void *obj, uint32_t id)
291 mutex_enter(&idrp->lock);
292 ide = idr_find_used_id(idrp, id);
294 mutex_exit(&idrp->lock);
300 mutex_exit(&idrp->lock);
305 idr_for_each(struct idr *idrp, int (*fn)(int id, void *p, void *data), void *data)
310 ide = avl_first(&idrp->used_ids);
317 ide = AVL_NEXT(&idrp->used_ids, ide);
325 idr_pre_get(struct idr *idrp, int flag) {
330 idr_destroy(struct idr *idrp)
336 while (ide = avl_destroy_nodes(&idrp->used_ids, &cookie))
338 avl_destroy(&idrp->used_ids);
340 range = idrp->free_id_ranges;
343 idrp->free_id_ranges = NULL;
345 mutex_destroy(&idrp->lock);