Lines Matching defs:entry

421  * Find entry in the hash table
423 * return entry only if the keys match
425 * return entry in the hash location without checking the keys
429 hash_find(nsc_db_t *nscdb, nsc_entry_t *entry, uint_t *hash,
435 *hash = nscdb->gethash(&entry->key, nscdb->htsize);
443 if (nscdb->compar(entry, hashentry) == 0)
450 #define HASH_REMOVE(nscdb, entry, hash, cmp) \
452 if (entry == hash_find(nscdb, entry, &hash, cmp)) \
457 #define HASH_INSERT(nscdb, entry, hash, cmp) \
459 (void) hash_find(nscdb, entry, &hash, cmp); \
460 nscdb->htable[hash] = entry; \
466 print_entry(nsc_db_t *nscdb, time_t now, nsc_entry_t *entry) {
470 switch (entry->stats.status) {
472 (void) fprintf(stdout, gettext("\t status: new entry\n"));
481 (void) fprintf(stdout, gettext("\t status: discarded entry\n"));
484 if (entry->stats.timestamp < now)
487 now - entry->stats.timestamp);
491 entry->stats.timestamp - now);
494 (void) fprintf(stdout, gettext("\t hits: %u\n"), entry->stats.hits);
495 args.key = entry->key;
558 nsc_entry_t *entry;
563 if ((entry = nscdb->htable[i]) != NULL) {
565 print_entry(nscdb, now, entry);
575 nsc_entry_t *entry;
579 for (entry = avl_first(&nscdb->tree), i = 0; entry != NULL;
580 entry = avl_walk(&nscdb->tree, entry, AVL_AFTER)) {
582 print_entry(nscdb, now, entry);
591 nsc_entry_t *entry;
601 for (entry = nscdb->qtail, i = 0; entry; entry = entry->qnext) {
602 (void) fprintf(stdout, "entry[%d]:\n", i++);
603 print_entry(nscdb, now, entry);
609 queue_remove(nsc_db_t *nscdb, nsc_entry_t *entry) {
611 if (nscdb->qtail == entry)
612 nscdb->qtail = entry->qnext;
614 entry->qprev->qnext = entry->qnext;
616 if (nscdb->qhead == entry)
617 nscdb->qhead = entry->qprev;
619 entry->qnext->qprev = entry->qprev;
621 if (nscdb->reap_node == entry)
622 nscdb->reap_node = entry->qnext;
623 entry->qnext = entry->qprev = NULL;
628 queue_adjust(nsc_db_t *nscdb, nsc_entry_t *entry) {
631 assert(nscdb->qtail || entry->qnext == NULL &&
632 entry->qprev == NULL);
637 assert(entry->qprev || entry->qnext == NULL ||
638 nscdb->qtail == entry);
642 if (nscdb->qtail == entry)
647 nscdb->qhead = nscdb->qtail = entry;
651 /* new entry (prev == NULL AND tail != entry) */
652 if (entry->qprev == NULL) {
653 nscdb->qtail->qprev = entry;
654 entry->qnext = nscdb->qtail;
655 nscdb->qtail = entry;
659 /* existing entry */
660 if (nscdb->reap_node == entry)
661 nscdb->reap_node = entry->qnext;
662 if (nscdb->qhead == entry)
663 nscdb->qhead = entry->qprev;
665 entry->qnext->qprev = entry->qprev;
666 entry->qprev->qnext = entry->qnext;
667 entry->qprev = NULL;
668 entry->qnext = nscdb->qtail;
669 nscdb->qtail->qprev = entry;
670 nscdb->qtail = entry;
1437 /* Either no entry and avoid name service */
1446 /* get the stats from the entry */
1478 /* otherwise reuse the entry */
1488 (me, "%s: cached entry needs to be updated\n",
1546 /* block any threads accessing this entry */
1618 "%s: cache updated with positive entry\n");
1633 "with negative entry\n");
1677 "%s: cache updated with negative entry\n");
1702 * found entry in cache
1728 "%s: positive entry in cache\n");
1744 "%s: negative entry in cache\n");
1849 nsc_entry_t *entry, *ptr;
1868 entry = nscdb->qtail;
1869 while (entry != NULL) {
1871 if (!(entry->stats.status & ST_PENDING)) {
1873 (void) insertn(table, entry->stats.hits, entry);
1875 entry = entry->qnext;
1888 * process a possible large entry in the /etc files)
1912 /* launch update thread for each keep hot entry */
2020 nsc_entry_t *entry;
2030 entry = ctx->nsc_db[i]->qtail;
2031 while (entry != NULL) {
2033 if (!(entry->stats.status & ST_PENDING))
2034 entry->stats.status = ST_DISCARD;
2035 entry = entry->qnext;
2053 delete_entry(nsc_db_t *nscdb, nsc_ctx_t *ctx, nsc_entry_t *entry) {
2056 avl_remove(&nscdb->tree, entry);
2057 HASH_REMOVE(nscdb, entry, hash, nscd_false);
2058 queue_remove(nscdb, entry);
2059 if (entry->buffer != NULL) {
2060 free(entry->buffer);
2061 entry->buffer = NULL;
2063 umem_cache_free(nsc_entry_cache, entry);
2072 nss_XbyY_args_t *argp, char *whoami, nsc_entry_t **entry)
2090 *entry = hash_find(nscdb, &find_entry, &hash, nscd_true);
2091 if (*entry != NULL) {
2092 (void) queue_adjust(nscdb, *entry);
2098 *entry = (nsc_entry_t *)avl_find(&nscdb->tree, &find_entry, &pos);
2099 if (*entry != NULL) {
2100 (void) queue_adjust(nscdb, *entry);
2104 (*entry)->stats.hits >=
2106 nscdb->htable[hash] = *entry;
2112 /* entry not found in the cache */
2122 /* allocate memory for new entry (stub) */
2123 *entry = (nsc_entry_t *)umem_cache_alloc(nsc_entry_cache,
2125 if (*entry == NULL) {
2130 (void) memset(*entry, 0, sizeof (**entry));
2138 * then (*entry)->key will have dangling pointers.
2142 (*entry)->key = find_entry.key;
2145 * Add the entry to the cache.
2147 avl_insert(&nscdb->tree, *entry, pos); /* O(log n) */
2148 (void) queue_adjust(nscdb, *entry); /* constant */
2150 nscdb->htable[hash] = *entry;
2151 (*entry)->stats.status = ST_NEW_ENTRY;
2161 "deleting least recently used entry\n",
2165 while (node != NULL && node != *entry) {
2288 * Delete entry if its discard flag is
2391 /* Start from LRU entry i.e queue head */