Lines Matching refs:cache
114 kidmap_purge_sid2pid_cache(idmap_sid2pid_cache_t *cache, size_t limit);
117 kidmap_purge_pid2sid_cache(idmap_pid2sid_cache_t *cache, size_t limit);
180 kidmap_cache_create(idmap_cache_t *cache) in kidmap_cache_create() argument
182 avl_create(&cache->sid2pid.tree, (avl_comp_fn)kidmap_compare_sid, in kidmap_cache_create()
184 mutex_init(&cache->sid2pid.mutex, NULL, MUTEX_DEFAULT, NULL); in kidmap_cache_create()
185 cache->sid2pid.purge_time = 0; in kidmap_cache_create()
186 cache->sid2pid.head.flink = &cache->sid2pid.head; in kidmap_cache_create()
187 cache->sid2pid.head.blink = &cache->sid2pid.head; in kidmap_cache_create()
188 cache->sid2pid.uid_num = 0; in kidmap_cache_create()
189 cache->sid2pid.gid_num = 0; in kidmap_cache_create()
190 cache->sid2pid.pid_num = 0; in kidmap_cache_create()
192 avl_create(&cache->uid2sid.tree, (avl_comp_fn)kidmap_compare_pid, in kidmap_cache_create()
194 mutex_init(&cache->uid2sid.mutex, NULL, MUTEX_DEFAULT, NULL); in kidmap_cache_create()
195 cache->uid2sid.purge_time = 0; in kidmap_cache_create()
196 cache->uid2sid.head.flink = &cache->uid2sid.head; in kidmap_cache_create()
197 cache->uid2sid.head.blink = &cache->uid2sid.head; in kidmap_cache_create()
199 avl_create(&cache->gid2sid.tree, (avl_comp_fn)kidmap_compare_pid, in kidmap_cache_create()
201 mutex_init(&cache->gid2sid.mutex, NULL, MUTEX_DEFAULT, NULL); in kidmap_cache_create()
202 cache->gid2sid.purge_time = 0; in kidmap_cache_create()
203 cache->gid2sid.head.flink = &cache->gid2sid.head; in kidmap_cache_create()
204 cache->gid2sid.head.blink = &cache->gid2sid.head; in kidmap_cache_create()
209 kidmap_cache_delete(idmap_cache_t *cache) in kidmap_cache_delete() argument
216 while ((sid2pid = avl_destroy_nodes(&cache->sid2pid.tree, &cookie)) in kidmap_cache_delete()
220 avl_destroy(&cache->sid2pid.tree); in kidmap_cache_delete()
221 mutex_destroy(&cache->sid2pid.mutex); in kidmap_cache_delete()
225 while ((pid2sid = avl_destroy_nodes(&cache->uid2sid.tree, &cookie)) in kidmap_cache_delete()
229 avl_destroy(&cache->uid2sid.tree); in kidmap_cache_delete()
230 mutex_destroy(&cache->uid2sid.mutex); in kidmap_cache_delete()
234 while ((pid2sid = avl_destroy_nodes(&cache->gid2sid.tree, &cookie)) in kidmap_cache_delete()
238 avl_destroy(&cache->gid2sid.tree); in kidmap_cache_delete()
239 mutex_destroy(&cache->gid2sid.mutex); in kidmap_cache_delete()
244 kidmap_cache_get_data(idmap_cache_t *cache, size_t *uidbysid, size_t *gidbysid, in kidmap_cache_get_data() argument
247 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_get_data()
248 *uidbysid = cache->sid2pid.uid_num; in kidmap_cache_get_data()
249 *gidbysid = cache->sid2pid.gid_num; in kidmap_cache_get_data()
250 *pidbysid = cache->sid2pid.pid_num; in kidmap_cache_get_data()
251 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_get_data()
253 mutex_enter(&cache->uid2sid.mutex); in kidmap_cache_get_data()
254 *sidbyuid = avl_numnodes(&cache->uid2sid.tree); in kidmap_cache_get_data()
255 mutex_exit(&cache->uid2sid.mutex); in kidmap_cache_get_data()
257 mutex_enter(&cache->gid2sid.mutex); in kidmap_cache_get_data()
258 *sidbygid = avl_numnodes(&cache->gid2sid.tree); in kidmap_cache_get_data()
259 mutex_exit(&cache->gid2sid.mutex); in kidmap_cache_get_data()
264 kidmap_cache_purge(idmap_cache_t *cache) in kidmap_cache_purge() argument
270 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_purge()
272 while ((sid2pid = avl_destroy_nodes(&cache->sid2pid.tree, &cookie)) in kidmap_cache_purge()
276 avl_destroy(&cache->sid2pid.tree); in kidmap_cache_purge()
277 avl_create(&cache->sid2pid.tree, (avl_comp_fn)kidmap_compare_sid, in kidmap_cache_purge()
279 cache->sid2pid.purge_time = 0; in kidmap_cache_purge()
280 cache->sid2pid.head.flink = &cache->sid2pid.head; in kidmap_cache_purge()
281 cache->sid2pid.head.blink = &cache->sid2pid.head; in kidmap_cache_purge()
282 cache->sid2pid.uid_num = 0; in kidmap_cache_purge()
283 cache->sid2pid.gid_num = 0; in kidmap_cache_purge()
284 cache->sid2pid.pid_num = 0; in kidmap_cache_purge()
285 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_purge()
288 mutex_enter(&cache->uid2sid.mutex); in kidmap_cache_purge()
290 while ((pid2sid = avl_destroy_nodes(&cache->uid2sid.tree, &cookie)) in kidmap_cache_purge()
294 avl_destroy(&cache->uid2sid.tree); in kidmap_cache_purge()
295 avl_create(&cache->uid2sid.tree, (avl_comp_fn)kidmap_compare_pid, in kidmap_cache_purge()
297 cache->uid2sid.purge_time = 0; in kidmap_cache_purge()
298 cache->uid2sid.head.flink = &cache->uid2sid.head; in kidmap_cache_purge()
299 cache->uid2sid.head.blink = &cache->uid2sid.head; in kidmap_cache_purge()
300 mutex_exit(&cache->uid2sid.mutex); in kidmap_cache_purge()
303 mutex_enter(&cache->gid2sid.mutex); in kidmap_cache_purge()
305 while ((pid2sid = avl_destroy_nodes(&cache->gid2sid.tree, &cookie)) in kidmap_cache_purge()
309 avl_destroy(&cache->gid2sid.tree); in kidmap_cache_purge()
310 avl_create(&cache->gid2sid.tree, (avl_comp_fn)kidmap_compare_pid, in kidmap_cache_purge()
312 cache->gid2sid.purge_time = 0; in kidmap_cache_purge()
313 cache->gid2sid.head.flink = &cache->gid2sid.head; in kidmap_cache_purge()
314 cache->gid2sid.head.blink = &cache->gid2sid.head; in kidmap_cache_purge()
315 mutex_exit(&cache->gid2sid.mutex); in kidmap_cache_purge()
320 kidmap_cache_lookup_uidbysid(idmap_cache_t *cache, const char *sid_prefix, in kidmap_cache_lookup_uidbysid() argument
332 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_lookup_uidbysid()
334 result = avl_find(&cache->sid2pid.tree, &entry, &where); in kidmap_cache_lookup_uidbysid()
336 list_move(&cache->sid2pid.head, result); in kidmap_cache_lookup_uidbysid()
343 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_lookup_uidbysid()
350 kidmap_cache_lookup_gidbysid(idmap_cache_t *cache, const char *sid_prefix, in kidmap_cache_lookup_gidbysid() argument
362 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_lookup_gidbysid()
364 result = avl_find(&cache->sid2pid.tree, &entry, &where); in kidmap_cache_lookup_gidbysid()
366 list_move(&cache->sid2pid.head, result); in kidmap_cache_lookup_gidbysid()
373 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_lookup_gidbysid()
380 kidmap_cache_lookup_pidbysid(idmap_cache_t *cache, const char *sid_prefix, in kidmap_cache_lookup_pidbysid() argument
392 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_lookup_pidbysid()
394 result = avl_find(&cache->sid2pid.tree, &entry, &where); in kidmap_cache_lookup_pidbysid()
396 list_move(&cache->sid2pid.head, result); in kidmap_cache_lookup_pidbysid()
410 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_lookup_pidbysid()
418 kidmap_cache_lookup_sidbyuid(idmap_cache_t *cache, const char **sid_prefix, in kidmap_cache_lookup_sidbyuid() argument
429 mutex_enter(&cache->uid2sid.mutex); in kidmap_cache_lookup_sidbyuid()
431 result = avl_find(&cache->uid2sid.tree, &entry, &where); in kidmap_cache_lookup_sidbyuid()
433 list_move(&cache->uid2sid.head, result); in kidmap_cache_lookup_sidbyuid()
441 mutex_exit(&cache->uid2sid.mutex); in kidmap_cache_lookup_sidbyuid()
448 kidmap_cache_lookup_sidbygid(idmap_cache_t *cache, const char **sid_prefix, in kidmap_cache_lookup_sidbygid() argument
459 mutex_enter(&cache->gid2sid.mutex); in kidmap_cache_lookup_sidbygid()
461 result = avl_find(&cache->gid2sid.tree, &entry, &where); in kidmap_cache_lookup_sidbygid()
463 list_move(&cache->gid2sid.head, result); in kidmap_cache_lookup_sidbygid()
471 mutex_exit(&cache->gid2sid.mutex); in kidmap_cache_lookup_sidbygid()
478 kidmap_cache_add_sid2uid(idmap_cache_t *cache, const char *sid_prefix, in kidmap_cache_add_sid2uid() argument
495 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_add_sid2uid()
497 result = avl_find(&cache->sid2pid.tree, &find, &where); in kidmap_cache_add_sid2uid()
500 cache->sid2pid.uid_num++; in kidmap_cache_add_sid2uid()
512 cache->sid2pid.uid_num++; in kidmap_cache_add_sid2uid()
514 list_insert(&cache->sid2pid.head, new); in kidmap_cache_add_sid2uid()
515 avl_insert(&cache->sid2pid.tree, new, where); in kidmap_cache_add_sid2uid()
518 if ((avl_numnodes(&cache->sid2pid.tree) > in kidmap_cache_add_sid2uid()
520 (cache->sid2pid.purge_time + CACHE_PURGE_INTERVAL < in kidmap_cache_add_sid2uid()
522 kidmap_purge_sid2pid_cache(&cache->sid2pid, in kidmap_cache_add_sid2uid()
525 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_add_sid2uid()
536 mutex_enter(&cache->uid2sid.mutex); in kidmap_cache_add_sid2uid()
538 result = avl_find(&cache->uid2sid.tree, &find, &where); in kidmap_cache_add_sid2uid()
550 list_insert(&cache->uid2sid.head, new); in kidmap_cache_add_sid2uid()
551 avl_insert(&cache->uid2sid.tree, new, where); in kidmap_cache_add_sid2uid()
554 if ((avl_numnodes(&cache->uid2sid.tree) > in kidmap_cache_add_sid2uid()
556 (cache->uid2sid.purge_time + CACHE_PURGE_INTERVAL < in kidmap_cache_add_sid2uid()
558 kidmap_purge_pid2sid_cache(&cache->uid2sid, in kidmap_cache_add_sid2uid()
561 mutex_exit(&cache->uid2sid.mutex); in kidmap_cache_add_sid2uid()
568 kidmap_cache_add_sid2gid(idmap_cache_t *cache, const char *sid_prefix, in kidmap_cache_add_sid2gid() argument
584 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_add_sid2gid()
586 result = avl_find(&cache->sid2pid.tree, &find, &where); in kidmap_cache_add_sid2gid()
589 cache->sid2pid.gid_num++; in kidmap_cache_add_sid2gid()
601 cache->sid2pid.gid_num++; in kidmap_cache_add_sid2gid()
603 list_insert(&cache->sid2pid.head, new); in kidmap_cache_add_sid2gid()
604 avl_insert(&cache->sid2pid.tree, new, where); in kidmap_cache_add_sid2gid()
607 if ((avl_numnodes(&cache->sid2pid.tree) > in kidmap_cache_add_sid2gid()
609 (cache->sid2pid.purge_time + CACHE_PURGE_INTERVAL < in kidmap_cache_add_sid2gid()
611 kidmap_purge_sid2pid_cache(&cache->sid2pid, in kidmap_cache_add_sid2gid()
614 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_add_sid2gid()
625 mutex_enter(&cache->gid2sid.mutex); in kidmap_cache_add_sid2gid()
627 result = avl_find(&cache->gid2sid.tree, &find, &where); in kidmap_cache_add_sid2gid()
639 list_insert(&cache->gid2sid.head, new); in kidmap_cache_add_sid2gid()
640 avl_insert(&cache->gid2sid.tree, new, where); in kidmap_cache_add_sid2gid()
643 if ((avl_numnodes(&cache->gid2sid.tree) > in kidmap_cache_add_sid2gid()
645 (cache->gid2sid.purge_time + CACHE_PURGE_INTERVAL < in kidmap_cache_add_sid2gid()
647 kidmap_purge_pid2sid_cache(&cache->gid2sid, in kidmap_cache_add_sid2gid()
650 mutex_exit(&cache->gid2sid.mutex); in kidmap_cache_add_sid2gid()
656 kidmap_cache_add_sid2pid(idmap_cache_t *cache, const char *sid_prefix, in kidmap_cache_add_sid2pid() argument
672 mutex_enter(&cache->sid2pid.mutex); in kidmap_cache_add_sid2pid()
674 result = avl_find(&cache->sid2pid.tree, &find, &where); in kidmap_cache_add_sid2pid()
677 cache->sid2pid.pid_num++; in kidmap_cache_add_sid2pid()
681 cache->sid2pid.uid_num++; in kidmap_cache_add_sid2pid()
686 cache->sid2pid.gid_num++; in kidmap_cache_add_sid2pid()
700 cache->sid2pid.uid_num++; in kidmap_cache_add_sid2pid()
706 cache->sid2pid.gid_num++; in kidmap_cache_add_sid2pid()
708 cache->sid2pid.pid_num++; in kidmap_cache_add_sid2pid()
710 list_insert(&cache->sid2pid.head, new); in kidmap_cache_add_sid2pid()
711 avl_insert(&cache->sid2pid.tree, new, where); in kidmap_cache_add_sid2pid()
714 if ((avl_numnodes(&cache->sid2pid.tree) > in kidmap_cache_add_sid2pid()
716 (cache->sid2pid.purge_time + CACHE_PURGE_INTERVAL < in kidmap_cache_add_sid2pid()
718 kidmap_purge_sid2pid_cache(&cache->sid2pid, in kidmap_cache_add_sid2pid()
721 mutex_exit(&cache->sid2pid.mutex); in kidmap_cache_add_sid2pid()
732 mutex_enter(&cache->uid2sid.mutex); in kidmap_cache_add_sid2pid()
734 result = avl_find(&cache->uid2sid.tree, &find, &where); in kidmap_cache_add_sid2pid()
746 list_insert(&cache->uid2sid.head, new); in kidmap_cache_add_sid2pid()
747 avl_insert(&cache->uid2sid.tree, new, where); in kidmap_cache_add_sid2pid()
750 if ((avl_numnodes(&cache->uid2sid.tree) > in kidmap_cache_add_sid2pid()
752 (cache->uid2sid.purge_time + in kidmap_cache_add_sid2pid()
755 kidmap_purge_pid2sid_cache(&cache->uid2sid, in kidmap_cache_add_sid2pid()
758 mutex_exit(&cache->uid2sid.mutex); in kidmap_cache_add_sid2pid()
760 mutex_enter(&cache->gid2sid.mutex); in kidmap_cache_add_sid2pid()
762 result = avl_find(&cache->gid2sid.tree, &find, &where); in kidmap_cache_add_sid2pid()
774 list_insert(&cache->gid2sid.head, new); in kidmap_cache_add_sid2pid()
775 avl_insert(&cache->gid2sid.tree, new, where); in kidmap_cache_add_sid2pid()
778 if ((avl_numnodes(&cache->gid2sid.tree) > in kidmap_cache_add_sid2pid()
780 (cache->gid2sid.purge_time + in kidmap_cache_add_sid2pid()
782 kidmap_purge_pid2sid_cache(&cache->gid2sid, in kidmap_cache_add_sid2pid()
785 mutex_exit(&cache->gid2sid.mutex); in kidmap_cache_add_sid2pid()
795 kidmap_purge_sid2pid_cache(idmap_sid2pid_cache_t *cache, size_t limit) in kidmap_purge_sid2pid_cache() argument
800 while (avl_numnodes(&cache->tree) > limit) { in kidmap_purge_sid2pid_cache()
802 item = cache->head.blink; in kidmap_purge_sid2pid_cache()
804 avl_remove(&cache->tree, item); in kidmap_purge_sid2pid_cache()
806 cache->uid_num--; in kidmap_purge_sid2pid_cache()
808 cache->gid_num--; in kidmap_purge_sid2pid_cache()
810 cache->pid_num--; in kidmap_purge_sid2pid_cache()
813 cache->purge_time = now; in kidmap_purge_sid2pid_cache()
818 kidmap_purge_pid2sid_cache(idmap_pid2sid_cache_t *cache, size_t limit) in kidmap_purge_pid2sid_cache() argument
823 while (avl_numnodes(&cache->tree) > limit) { in kidmap_purge_pid2sid_cache()
825 item = cache->head.blink; in kidmap_purge_pid2sid_cache()
827 avl_remove(&cache->tree, item); in kidmap_purge_pid2sid_cache()
830 cache->purge_time = now; in kidmap_purge_pid2sid_cache()