Lines Matching refs:cache

1290     Cache*                      cache;  member
1314 _cache_flush_pending_requests_locked( struct resolv_cache* cache ) in _cache_flush_pending_requests_locked() argument
1317 if (cache) { in _cache_flush_pending_requests_locked()
1318 ri = cache->pending_requests.next; in _cache_flush_pending_requests_locked()
1329 cache->pending_requests.next = NULL; in _cache_flush_pending_requests_locked()
1337 _cache_check_pending_request_locked( struct resolv_cache** cache, Entry* key, unsigned netid ) in _cache_check_pending_request_locked() argument
1342 if (*cache && key) { in _cache_check_pending_request_locked()
1343 ri = (*cache)->pending_requests.next; in _cache_check_pending_request_locked()
1344 prev = &(*cache)->pending_requests; in _cache_check_pending_request_locked()
1367 *cache = _find_named_cache_locked(netid); in _cache_check_pending_request_locked()
1377 _cache_notify_waiting_tid_locked( struct resolv_cache* cache, Entry* key ) in _cache_notify_waiting_tid_locked() argument
1381 if (cache && key) { in _cache_notify_waiting_tid_locked()
1382 ri = cache->pending_requests.next; in _cache_notify_waiting_tid_locked()
1383 prev = &cache->pending_requests; in _cache_notify_waiting_tid_locked()
1409 Cache* cache; in _resolv_cache_query_failed() local
1416 cache = _find_named_cache_locked(netid); in _resolv_cache_query_failed()
1418 if (cache) { in _resolv_cache_query_failed()
1419 _cache_notify_waiting_tid_locked(cache, key); in _resolv_cache_query_failed()
1428 _cache_flush_locked( Cache* cache ) in _cache_flush_locked() argument
1432 for (nn = 0; nn < cache->max_entries; nn++) in _cache_flush_locked()
1434 Entry** pnode = (Entry**) &cache->entries[nn]; in _cache_flush_locked()
1444 _cache_flush_pending_requests_locked(cache); in _cache_flush_locked()
1446 cache->mru_list.mru_next = cache->mru_list.mru_prev = &cache->mru_list; in _cache_flush_locked()
1447 cache->num_entries = 0; in _cache_flush_locked()
1448 cache->last_id = 0; in _cache_flush_locked()
1473 struct resolv_cache* cache; in _resolv_cache_create() local
1475 cache = calloc(sizeof(*cache), 1); in _resolv_cache_create()
1476 if (cache) { in _resolv_cache_create()
1477 cache->max_entries = _res_cache_get_max_entries(); in _resolv_cache_create()
1478 cache->entries = calloc(sizeof(*cache->entries), cache->max_entries); in _resolv_cache_create()
1479 if (cache->entries) { in _resolv_cache_create()
1480 cache->mru_list.mru_prev = cache->mru_list.mru_next = &cache->mru_list; in _resolv_cache_create()
1483 free(cache); in _resolv_cache_create()
1484 cache = NULL; in _resolv_cache_create()
1487 return cache; in _resolv_cache_create()
1504 _cache_dump_mru( Cache* cache ) in _cache_dump_mru() argument
1509 p = _bprint(temp, end, "MRU LIST (%2d): ", cache->num_entries); in _cache_dump_mru()
1510 for (e = cache->mru_list.mru_next; e != &cache->mru_list; e = e->mru_next) in _cache_dump_mru()
1574 _cache_lookup_p( Cache* cache, in _cache_lookup_p() argument
1577 int index = key->hash % cache->max_entries; in _cache_lookup_p()
1578 Entry** pnode = (Entry**) &cache->entries[ index ]; in _cache_lookup_p()
1600 _cache_add_p( Cache* cache, in _cache_add_p() argument
1605 e->id = ++cache->last_id; in _cache_add_p()
1606 entry_mru_add(e, &cache->mru_list); in _cache_add_p()
1607 cache->num_entries += 1; in _cache_add_p()
1610 e->id, cache->num_entries); in _cache_add_p()
1618 _cache_remove_p( Cache* cache, in _cache_remove_p() argument
1624 e->id, cache->num_entries-1); in _cache_remove_p()
1629 cache->num_entries -= 1; in _cache_remove_p()
1635 _cache_remove_oldest( Cache* cache ) in _cache_remove_oldest() argument
1637 Entry* oldest = cache->mru_list.mru_prev; in _cache_remove_oldest()
1638 Entry** lookup = _cache_lookup_p(cache, oldest); in _cache_remove_oldest()
1648 _cache_remove_p(cache, lookup); in _cache_remove_oldest()
1653 static void _cache_remove_expired(Cache* cache) { in _cache_remove_expired() argument
1657 for (e = cache->mru_list.mru_next; e != &cache->mru_list;) { in _cache_remove_expired()
1660 Entry** lookup = _cache_lookup_p(cache, e); in _cache_remove_expired()
1666 _cache_remove_p(cache, lookup); in _cache_remove_expired()
1685 Cache* cache; in _resolv_cache_lookup() local
1701 cache = _find_named_cache_locked(netid); in _resolv_cache_lookup()
1702 if (cache == NULL) { in _resolv_cache_lookup()
1710 lookup = _cache_lookup_p(cache, key); in _resolv_cache_lookup()
1717 if (!_cache_check_pending_request_locked(&cache, key, netid) || cache == NULL) { in _resolv_cache_lookup()
1720 lookup = _cache_lookup_p(cache, key); in _resolv_cache_lookup()
1734 _cache_remove_p(cache, lookup); in _resolv_cache_lookup()
1749 if (e != cache->mru_list.mru_next) { in _resolv_cache_lookup()
1751 entry_mru_add( e, &cache->mru_list ); in _resolv_cache_lookup()
1774 Cache* cache = NULL; in _resolv_cache_add() local
1785 cache = _find_named_cache_locked(netid); in _resolv_cache_add()
1786 if (cache == NULL) { in _resolv_cache_add()
1798 lookup = _cache_lookup_p(cache, key); in _resolv_cache_add()
1807 if (cache->num_entries >= cache->max_entries) { in _resolv_cache_add()
1808 _cache_remove_expired(cache); in _resolv_cache_add()
1809 if (cache->num_entries >= cache->max_entries) { in _resolv_cache_add()
1810 _cache_remove_oldest(cache); in _resolv_cache_add()
1813 lookup = _cache_lookup_p(cache, key); in _resolv_cache_add()
1827 _cache_add_p(cache, lookup, e); in _resolv_cache_add()
1831 _cache_dump_mru(cache); in _resolv_cache_add()
1834 if (cache != NULL) { in _resolv_cache_add()
1835 _cache_notify_waiting_tid_locked(cache, key); in _resolv_cache_add()
1880 struct resolv_cache* cache = _find_named_cache_locked(netid); in _get_res_cache_for_net_locked() local
1881 if (!cache) { in _get_res_cache_for_net_locked()
1884 cache = _resolv_cache_create(); in _get_res_cache_for_net_locked()
1885 if (cache) { in _get_res_cache_for_net_locked()
1886 cache_info->cache = cache; in _get_res_cache_for_net_locked()
1894 return cache; in _get_res_cache_for_net_locked()
1911 struct resolv_cache* cache = _find_named_cache_locked(netid); in _flush_cache_for_net_locked() local
1912 if (cache) { in _flush_cache_for_net_locked()
1913 _cache_flush_locked(cache); in _flush_cache_for_net_locked()
1933 _cache_flush_locked(cache_info->cache); in _resolv_delete_cache_for_net()
1934 free(cache_info->cache->entries); in _resolv_delete_cache_for_net()
1935 free(cache_info->cache); in _resolv_delete_cache_for_net()
1972 if (info != NULL) return info->cache; in _find_named_cache_locked()