Lines Matching refs:entry

49 #define DNS_ACACHEENTRY_VALID(entry)	ISC_MAGIC_VALID(entry, ACACHEENTRY_MAGIC)
91 #define acache_storetime(entry, t) \
92 (isc_atomic_store((isc_int32_t *)&(entry)->lastused, (t)))
99 #define acache_storetime(entry, t) ((entry)->lastused = (t))
148 dns_acacheentry_t *current_entry; /* The bookmark entry to
221 holding this entry */
224 dns_zone_t *zone; /* zone this entry
226 dns_db_t *db; /* DB this entry belongs to */
228 dns_dbnode_t *node; /* node this entry
237 /* Timestamp of the last time this entry is referred to */
253 static inline void clear_entry(dns_acache_t *acache, dns_acacheentry_t *entry);
299 dns_acacheentry_t *entry, *entry_next;
307 for (entry = ISC_LIST_HEAD(acache->entries);
308 entry != NULL;
309 entry = entry_next) {
310 entry_next = ISC_LIST_NEXT(entry, link);
312 ACACHE_LOCK(&acache->entrylocks[entry->locknum],
316 * If the cleaner holds this entry, it will be unlinked and
319 if (acache->cleaner.current_entry != entry)
320 ISC_LIST_UNLINK(acache->entries, entry, link);
321 unlink_dbentries(acache, entry);
322 if (entry->callback != NULL) {
323 (entry->callback)(entry, &entry->cbarg);
324 entry->callback = NULL;
327 ACACHE_UNLOCK(&acache->entrylocks[entry->locknum],
330 if (acache->cleaner.current_entry != entry)
331 dns_acache_detachentry(&entry);
384 /* The acache and the entry must be locked before calling. */
408 /* There must not be a reference to this entry. */
410 destroy_entry(dns_acacheentry_t *entry) {
413 REQUIRE(DNS_ACACHEENTRY_VALID(entry));
415 acache = entry->acache;
419 * Since there is no reference to this entry, it is safe to call
422 clear_entry(acache, entry);
424 isc_mem_put(acache->mctx, entry, sizeof(*entry));
494 clear_entry(dns_acache_t *acache, dns_acacheentry_t *entry) {
496 REQUIRE(DNS_ACACHEENTRY_VALID(entry));
499 * The caller must be holing the entry lock.
502 if (entry->foundname) {
505 for (rdataset = ISC_LIST_HEAD(entry->foundname->list);
509 ISC_LIST_UNLINK(entry->foundname->list,
514 if (dns_name_dynamic(entry->foundname))
515 dns_name_free(entry->foundname, acache->mctx);
516 isc_mem_put(acache->mctx, entry->foundname,
517 sizeof(*entry->foundname));
518 entry->foundname = NULL;
521 if (entry->node != NULL) {
522 INSIST(entry->db != NULL);
523 dns_db_detachnode(entry->db, &entry->node);
525 if (entry->version != NULL) {
526 INSIST(entry->db != NULL);
527 dns_db_closeversion(entry->db, &entry->version, ISC_FALSE);
529 if (entry->db != NULL)
530 dns_db_detach(&entry->db);
531 if (entry->zone != NULL)
532 dns_zone_detach(&entry->zone);
534 if (entry->origdb != NULL)
535 dns_db_detach(&entry->origdb);
675 * Even if the cleaner has the last reference to the entry, which means
676 * the entry has been unused, it may still be linked if unlinking the
677 * entry has been delayed due to the reference.
756 /* The caller must hold entry lock. */
758 entry_stale(acache_cleaner_t *cleaner, dns_acacheentry_t *entry,
763 * entry.
765 if (entry->callback == NULL)
771 if (entry->lastused + interval < now32)
776 * the entry should be purged, based on the time passed from its last
783 if (isc_serial_ge(now32, entry->lastused))
784 passed = now32 - entry->lastused; /* <= interval */
806 dns_acacheentry_t *entry, *next = NULL;
831 entry = cleaner->current_entry;
841 INSIST(entry != NULL);
843 next = ISC_LIST_NEXT(entry, link);
845 ACACHE_LOCK(&acache->entrylocks[entry->locknum],
848 is_stale = entry_stale(cleaner, entry, now32, interval);
850 ISC_LIST_UNLINK(acache->entries, entry, link);
851 unlink_dbentries(acache, entry);
852 if (entry->callback != NULL)
853 (entry->callback)(entry, &entry->cbarg);
854 entry->callback = NULL;
859 ACACHE_UNLOCK(&acache->entrylocks[entry->locknum],
863 dns_acache_detachentry(&entry);
867 entry = ISC_LIST_HEAD(acache->entries);
868 if (entry != NULL) {
873 * this, reset next to the head entry
884 next = entry;
894 entry = next;
899 * not gone through the entire cache. Remember the entry that will
1285 dns_acacheentry_t *entry;
1298 * The entry may have not been created due to memory shortage.
1305 * Release corresponding cache entries: for each entry, release all
1306 * links the entry has, and then callback to the entry holder (if any).
1310 while ((entry = ISC_LIST_HEAD(dbentry->originlist)) != NULL) {
1311 ACACHE_LOCK(&acache->entrylocks[entry->locknum],
1318 ISC_LIST_UNLINK(dbentry->originlist, entry, olink);
1319 if (acache->cleaner.current_entry != entry)
1320 ISC_LIST_UNLINK(acache->entries, entry, link);
1321 unlink_dbentries(acache, entry);
1323 if (entry->callback != NULL)
1324 (entry->callback)(entry, &entry->cbarg);
1325 entry->callback = NULL;
1327 ACACHE_UNLOCK(&acache->entrylocks[entry->locknum],
1330 if (acache->cleaner.current_entry != entry)
1331 dns_acache_detachentry(&entry);
1333 while ((entry = ISC_LIST_HEAD(dbentry->referlist)) != NULL) {
1334 ACACHE_LOCK(&acache->entrylocks[entry->locknum],
1337 ISC_LIST_UNLINK(dbentry->referlist, entry, rlink);
1338 if (acache->cleaner.current_entry != entry)
1339 ISC_LIST_UNLINK(acache->entries, entry, link);
1340 unlink_dbentries(acache, entry);
1342 if (entry->callback != NULL)
1343 (entry->callback)(entry, &entry->cbarg);
1344 entry->callback = NULL;
1346 ACACHE_UNLOCK(&acache->entrylocks[entry->locknum],
1349 if (acache->cleaner.current_entry != entry)
1350 dns_acache_detachentry(&entry);
1445 dns_acache_getentry(dns_acacheentry_t *entry, dns_zone_t **zonep,
1456 REQUIRE(DNS_ACACHEENTRY_VALID(entry));
1463 acache = entry->acache;
1466 locknum = entry->locknum;
1470 acache_storetime(entry, now32);
1472 if (entry->zone != NULL && zonep != NULL)
1473 dns_zone_attach(entry->zone, zonep);
1475 if (entry->db == NULL) {
1479 dns_db_attach(entry->db, dbp);
1480 dns_db_attachversion(entry->db, entry->version, versionp);
1482 if (entry->node == NULL)
1485 dns_db_attachnode(entry->db, entry->node, nodep);
1487 INSIST(entry->foundname != NULL);
1488 dns_name_copy(entry->foundname, fname, NULL);
1489 for (erdataset = ISC_LIST_HEAD(entry->foundname->list);
1514 entry->acache->stats.hits++; /* XXXMLG danger: unlocked! */
1515 entry->acache->stats.queries++;
1540 dns_acache_setentry(dns_acache_t *acache, dns_acacheentry_t *entry,
1551 REQUIRE(DNS_ACACHEENTRY_VALID(entry));
1554 ACACHE_LOCK(&acache->entrylocks[entry->locknum], isc_rwlocktype_write);
1558 dns_zone_attach(zone, &entry->zone);
1561 dns_db_attach(db, &entry->db);
1574 dns_db_attachversion(db, version, &entry->version);
1581 dns_db_attachnode(db, node, &entry->node);
1589 * entire entry when a memory shortage happen during the process.
1594 entry->foundname = isc_mem_get(acache->mctx,
1595 sizeof(*entry->foundname));
1597 if (entry->foundname == NULL) {
1601 dns_name_init(entry->foundname, NULL);
1603 entry->foundname);
1619 ISC_LIST_APPEND(entry->foundname->list, crdataset,
1625 result = finddbent(acache, entry->origdb, &odbent);
1635 ISC_LIST_APPEND(acache->entries, entry, link);
1636 ISC_LIST_APPEND(odbent->originlist, entry, olink);
1638 ISC_LIST_APPEND(rdbent->referlist, entry, rlink);
1644 dns_acache_attachentry(entry, &dummy_entry);
1646 ACACHE_UNLOCK(&acache->entrylocks[entry->locknum],
1655 clear_entry(acache, entry);
1657 ACACHE_UNLOCK(&acache->entrylocks[entry->locknum],
1665 dns_acache_cancelentry(dns_acacheentry_t *entry) {
1669 REQUIRE(DNS_ACACHEENTRY_VALID(entry));
1671 acache = entry->acache;
1673 INSIST(DNS_ACACHE_VALID(entry->acache));
1676 ACACHE_LOCK(&acache->entrylocks[entry->locknum], isc_rwlocktype_write);
1678 callback_active = ISC_TF(entry->cbarg != NULL);
1681 * Release dependencies stored in this entry as much as possible.
1683 * a reference to this entry; the empty entry will be released in
1686 unlink_dbentries(acache, entry);
1687 clear_entry(entry->acache, entry);
1689 entry->callback = NULL;
1690 entry->cbarg = NULL;
1692 ACACHE_UNLOCK(&acache->entrylocks[entry->locknum],
1713 dns_acacheentry_t *entry;
1717 entry = *entryp;
1719 isc_refcount_decrement(&entry->references, &refs);
1722 * If there are no references to the entry, the entry must have been
1726 INSIST(!ISC_LINK_LINKED(entry, link));
1728 destroy_entry(entry);