From 46d40b3dcab2cb80c6e37e9b774075d8acaf34d7 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Mon, 29 Apr 2024 15:29:33 -0700 Subject: [PATCH] fix structure names in qpcache.c and qpzone.c - change dns_qpdata_t to qpcnode_t (QP cache node), and dns_qpdb_t to qpcache_t, as these types are only accessed locally. - also change qpdata_t in qpzone.c to qpznode_t (QP zone node), for consistency. - make the refcount declarations for qpcnode_t and qpznode_t static, using the new ISC_REFCOUNT_STATIC macros. --- lib/dns/include/dns/types.h | 14 +- lib/dns/qpcache.c | 282 ++++++++++++++++++------------------ lib/dns/qpzone.c | 196 ++++++++++++------------- tests/dns/qpzone_test.c | 4 +- 4 files changed, 246 insertions(+), 250 deletions(-) diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index 852ed86566..7784d126f6 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -130,8 +130,6 @@ typedef struct dns_slabheader_proof dns_slabheader_proof_t; typedef struct dns_rbt dns_rbt_t; typedef struct dns_rbtdb dns_rbtdb_t; typedef struct dns_rbtdb_version dns_rbtdb_version_t; -typedef struct dns_qpdb dns_qpdb_t; -typedef struct dns_qpdb_version dns_qpdb_version_t; typedef struct dns_rbtnode dns_rbtnode_t; typedef ISC_LIST(dns_rbtnode_t) dns_rbtnodelist_t; typedef uint16_t dns_rcode_t; @@ -148,13 +146,11 @@ typedef struct dns_request dns_request_t; typedef struct dns_requestmgr dns_requestmgr_t; typedef struct dns_resolver dns_resolver_t; typedef struct dns_rpsdb dns_rpsdb_t; -typedef struct dns_qpdata dns_qpdata_t; -typedef ISC_LIST(dns_qpdata_t) dns_qpdatalist_t; -typedef struct dns_qpnode dns_qpnode_t; -typedef uint8_t dns_secalg_t; -typedef uint8_t dns_secproto_t; -typedef struct dns_signature dns_signature_t; -typedef struct dns_slabheader dns_slabheader_t; +typedef struct dns_qpnode dns_qpnode_t; +typedef uint8_t dns_secalg_t; +typedef uint8_t dns_secproto_t; +typedef struct dns_signature dns_signature_t; +typedef struct dns_slabheader dns_slabheader_t; typedef ISC_LIST(dns_slabheader_t) dns_slabheaderlist_t; typedef struct dns_sortlist_arg dns_sortlist_arg_t; typedef struct dns_ssurule dns_ssurule_t; diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c index 1af1c1e91e..cef98009a2 100644 --- a/lib/dns/qpcache.c +++ b/lib/dns/qpcache.c @@ -136,7 +136,7 @@ #define VALID_QPDB(qpdb) \ ((qpdb) != NULL && (qpdb)->common.impmagic == QPDB_MAGIC) -#define QPDB_HEADERNODE(h) ((dns_qpdata_t *)((h)->node)) +#define QPDB_HEADERNODE(h) ((qpcnode_t *)((h)->node)) /* * Allow clients with a virtual time of up to 5 minutes in the past to see @@ -190,7 +190,9 @@ * This is the structure that is used for each node in the qp trie of trees. * For now it is a copy of the dns_rbtnode structure. */ -struct dns_qpdata { +typedef struct qpcnode qpcnode_t; +typedef ISC_LIST(qpcnode_t) qpcnodelist_t; +struct qpcnode { unsigned int magic; /*@{*/ /*! @@ -224,7 +226,7 @@ struct dns_qpdata { * have no data any longer, but we cannot unlink at that exact moment * because we did not or could not obtain a write lock on the tree. */ - ISC_LINK(dns_qpdata_t) deadlink; + ISC_LINK(qpcnode_t) deadlink; /*@{*/ /*! @@ -255,14 +257,15 @@ struct dns_qpdata { }; typedef struct qpdb_changed { - dns_qpdata_t *node; + qpcnode_t *node; bool dirty; ISC_LINK(struct qpdb_changed) link; } qpdb_changed_t; +typedef struct qpcache qpcache_t; typedef ISC_LIST(qpdb_changed_t) qpdb_changedlist_t; -struct dns_qpdb { +struct qpcache { /* Unlocked. */ dns_db_t common; /* Locks the data in this struct */ @@ -272,8 +275,8 @@ struct dns_qpdb { /* Locks for individual tree nodes */ unsigned int node_lock_count; db_nodelock_t *node_locks; - dns_qpdata_t *origin_node; - dns_qpdata_t *nsec3_origin_node; + qpcnode_t *origin_node; + qpcnode_t *nsec3_origin_node; dns_stats_t *rrsetstats; /* cache DB only */ isc_stats_t *cachestats; /* cache DB only */ isc_stats_t *gluecachestats; /* zone DB only */ @@ -316,7 +319,7 @@ struct dns_qpdb { * Temporary storage for stale cache nodes and dynamically deleted * nodes that await being cleaned up. */ - dns_qpdatalist_t *deadnodes; + qpcnodelist_t *deadnodes; /* * Heaps. These are used for TTL based expiry in a cache, @@ -340,7 +343,7 @@ struct dns_qpdb { * Search Context */ typedef struct { - dns_qpdb_t *qpdb; + qpcache_t *qpdb; uint32_t serial; unsigned int options; dns_qpchain_t chain; @@ -348,7 +351,7 @@ typedef struct { bool copy_name; bool need_cleanup; bool wild; - dns_qpdata_t *zonecut; + qpcnode_t *zonecut; dns_slabheader_t *zonecut_header; dns_slabheader_t *zonecut_sigheader; dns_fixedname_t zonecut_name; @@ -356,16 +359,14 @@ typedef struct { } qpdb_search_t; #ifdef DNS_DB_NODETRACE -#define dns_qpdata_ref(ptr) dns_qpdata__ref(ptr, __func__, __FILE__, __LINE__) -#define dns_qpdata_unref(ptr) \ - dns_qpdata__unref(ptr, __func__, __FILE__, __LINE__) -#define dns_qpdata_attach(ptr, ptrp) \ - dns_qpdata__attach(ptr, ptrp, __func__, __FILE__, __LINE__) -#define dns_qpdata_detach(ptrp) \ - dns_qpdata__detach(ptrp, __func__, __FILE__, __LINE__) -ISC_REFCOUNT_TRACE_DECL(dns_qpdata); +#define qpcnode_ref(ptr) qpcnode__ref(ptr, __func__, __FILE__, __LINE__) +#define qpcnode_unref(ptr) qpcnode__unref(ptr, __func__, __FILE__, __LINE__) +#define qpcnode_attach(ptr, ptrp) \ + qpcnode__attach(ptr, ptrp, __func__, __FILE__, __LINE__) +#define qpcnode_detach(ptrp) qpcnode__detach(ptrp, __func__, __FILE__, __LINE__) +ISC_REFCOUNT_STATIC_TRACE_DECL(qpcnode); #else -ISC_REFCOUNT_DECL(dns_qpdata); +ISC_REFCOUNT_STATIC_DECL(qpcnode); #endif /* QP methods */ @@ -388,21 +389,21 @@ static dns_qpmethods_t qpmethods = { static void qp_attach(void *uctx ISC_ATTR_UNUSED, void *pval, uint32_t ival ISC_ATTR_UNUSED) { - dns_qpdata_t *data = pval; - dns_qpdata_ref(data); + qpcnode_t *data = pval; + qpcnode_ref(data); } static void qp_detach(void *uctx ISC_ATTR_UNUSED, void *pval, uint32_t ival ISC_ATTR_UNUSED) { - dns_qpdata_t *data = pval; - dns_qpdata_detach(&data); + qpcnode_t *data = pval; + qpcnode_detach(&data); } static size_t qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval, uint32_t ival ISC_ATTR_UNUSED) { - dns_qpdata_t *data = pval; + qpcnode_t *data = pval; return (dns_qpkey_fromname(key, &data->name)); } @@ -483,12 +484,12 @@ typedef struct qpdb_dbiterator { dns_qpiter_t iter; dns_qpiter_t nsec3iter; dns_qpiter_t *current; - dns_qpdata_t *node; + qpcnode_t *node; enum { full, nonsec3, nsec3only } nsec3mode; } qpdb_dbiterator_t; static void -free_qpdb(dns_qpdb_t *qpdb, bool log); +free_qpdb(qpcache_t *qpdb, bool log); static dns_dbmethods_t qpdb_cachemethods; @@ -578,7 +579,7 @@ need_headerupdate(dns_slabheader_t *header, isc_stdtime_t now) { * Note that the we do NOT touch the heap here, as the TTL has not changed. */ static void -update_header(dns_qpdb_t *qpdb, dns_slabheader_t *header, isc_stdtime_t now) { +update_header(qpcache_t *qpdb, dns_slabheader_t *header, isc_stdtime_t now) { /* To be checked: can we really assume this? XXXMLG */ INSIST(ISC_LINK_LINKED(header, link)); @@ -623,7 +624,7 @@ clean_stale_headers(dns_slabheader_t *top) { } static void -clean_cache_node(dns_qpdb_t *qpdb, dns_qpdata_t *node) { +clean_cache_node(qpcache_t *qpdb, qpcnode_t *node) { dns_slabheader_t *current = NULL, *top_prev = NULL, *top_next = NULL; /* @@ -657,7 +658,7 @@ clean_cache_node(dns_qpdb_t *qpdb, dns_qpdata_t *node) { * tree_lock(write) must be held. */ static void -delete_node(dns_qpdb_t *qpdb, dns_qpdata_t *node) { +delete_node(qpcache_t *qpdb, qpcnode_t *node) { isc_result_t result = ISC_R_UNEXPECTED; INSIST(!ISC_LINK_LINKED(node, deadlink)); @@ -713,7 +714,7 @@ delete_node(dns_qpdb_t *qpdb, dns_qpdata_t *node) { * then the caller must be holding at least one lock. */ static void -newref(dns_qpdb_t *qpdb, dns_qpdata_t *node, isc_rwlocktype_t nlocktype, +newref(qpcache_t *qpdb, qpcnode_t *node, isc_rwlocktype_t nlocktype, isc_rwlocktype_t tlocktype DNS__DB_FLARG) { uint_fast32_t refs; @@ -723,7 +724,7 @@ newref(dns_qpdb_t *qpdb, dns_qpdata_t *node, isc_rwlocktype_t nlocktype, ISC_LIST_UNLINK(qpdb->deadnodes[node->locknum], node, deadlink); } - dns_qpdata_ref(node); + qpcnode_ref(node); refs = isc_refcount_increment0(&node->erefs); #if DNS_DB_NODETRACE @@ -774,7 +775,7 @@ newref(dns_qpdb_t *qpdb, dns_qpdata_t *node, isc_rwlocktype_t nlocktype, * not mean it will be immediately freed.) */ static bool -decref(dns_qpdb_t *qpdb, dns_qpdata_t *node, uint32_t least_serial, +decref(qpcache_t *qpdb, qpcnode_t *node, uint32_t least_serial, isc_rwlocktype_t *nlocktypep, isc_rwlocktype_t *tlocktypep, bool tryupgrade, bool pruning DNS__DB_FLARG) { isc_result_t result; @@ -822,7 +823,7 @@ decref(dns_qpdb_t *qpdb, dns_qpdata_t *node, uint32_t least_serial, no_reference = false; } - dns_qpdata_unref(node); + qpcnode_unref(node); return (no_reference); } @@ -838,7 +839,7 @@ decref(dns_qpdb_t *qpdb, dns_qpdata_t *node, uint32_t least_serial, #endif if (refs > 1) { - dns_qpdata_unref(node); + qpcnode_unref(node); return (false); } @@ -917,7 +918,7 @@ restore_locks: TREE_UNLOCK(&qpdb->tree_lock, tlocktypep); } - dns_qpdata_unref(node); + qpcnode_unref(node); return (no_reference); } @@ -1030,7 +1031,7 @@ expireheader(dns_slabheader_t *header, isc_rwlocktype_t *nlocktypep, QPDB_HEADERNODE(header)->dirty = 1; if (isc_refcount_current(&QPDB_HEADERNODE(header)->erefs) == 0) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)header->db; + qpcache_t *qpdb = (qpcache_t *)header->db; /* * If no one else is using the node, we can clean it up now. @@ -1062,7 +1063,7 @@ expireheader(dns_slabheader_t *header, isc_rwlocktype_t *nlocktypep, } static void -update_cachestats(dns_qpdb_t *qpdb, isc_result_t result) { +update_cachestats(qpcache_t *qpdb, isc_result_t result) { if (qpdb->cachestats == NULL) { return; } @@ -1088,7 +1089,7 @@ update_cachestats(dns_qpdb_t *qpdb, isc_result_t result) { } static void -bindrdataset(dns_qpdb_t *qpdb, dns_qpdata_t *node, dns_slabheader_t *header, +bindrdataset(qpcache_t *qpdb, qpcnode_t *node, dns_slabheader_t *header, isc_stdtime_t now, isc_rwlocktype_t nlocktype, isc_rwlocktype_t tlocktype, dns_rdataset_t *rdataset DNS__DB_FLARG) { @@ -1199,7 +1200,7 @@ setup_delegation(qpdb_search_t *search, dns_dbnode_t **nodep, isc_rwlocktype_t tlocktype DNS__DB_FLARG) { dns_name_t *zcname = NULL; dns_typepair_t type; - dns_qpdata_t *node = NULL; + qpcnode_t *node = NULL; REQUIRE(search != NULL); REQUIRE(search->zonecut != NULL); @@ -1256,7 +1257,7 @@ setup_delegation(qpdb_search_t *search, dns_dbnode_t **nodep, } static bool -check_stale_header(dns_qpdata_t *node, dns_slabheader_t *header, +check_stale_header(qpcnode_t *node, dns_slabheader_t *header, isc_rwlocktype_t *nlocktypep, isc_rwlock_t *lock, qpdb_search_t *search, dns_slabheader_t **header_prev) { if (!ACTIVE(header, search->now)) { @@ -1362,7 +1363,7 @@ check_stale_header(dns_qpdata_t *node, dns_slabheader_t *header, } static isc_result_t -check_zonecut(dns_qpdata_t *node, void *arg DNS__DB_FLARG) { +check_zonecut(qpcnode_t *node, void *arg DNS__DB_FLARG) { qpdb_search_t *search = arg; dns_slabheader_t *header = NULL; dns_slabheader_t *header_prev = NULL, *header_next = NULL; @@ -1425,12 +1426,12 @@ check_zonecut(dns_qpdata_t *node, void *arg DNS__DB_FLARG) { } static isc_result_t -find_deepest_zonecut(qpdb_search_t *search, dns_qpdata_t *node, +find_deepest_zonecut(qpdb_search_t *search, qpcnode_t *node, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { isc_result_t result = ISC_R_NOTFOUND; - dns_qpdb_t *qpdb = NULL; + qpcache_t *qpdb = NULL; /* * Caller must be holding the tree lock. @@ -1552,7 +1553,7 @@ find_coveringnsec(qpdb_search_t *search, const dns_name_t *name, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { dns_fixedname_t fpredecessor, fixed; dns_name_t *predecessor = NULL, *fname = NULL; - dns_qpdata_t *node = NULL; + qpcnode_t *node = NULL; dns_qpiter_t iter; isc_result_t result; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; @@ -1648,7 +1649,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { - dns_qpdata_t *node = NULL; + qpcnode_t *node = NULL; isc_result_t result; qpdb_search_t search; bool cname_ok = true; @@ -1668,7 +1669,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, UNUSED(version); - REQUIRE(VALID_QPDB((dns_qpdb_t *)db)); + REQUIRE(VALID_QPDB((qpcache_t *)db)); REQUIRE(version == NULL); if (now == 0) { @@ -1676,7 +1677,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, } search = (qpdb_search_t){ - .qpdb = (dns_qpdb_t *)db, + .qpdb = (qpcache_t *)db, .serial = 1, .options = options, .now = now, @@ -1705,7 +1706,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, for (unsigned int i = 0; i < len; i++) { isc_result_t zcresult; - dns_qpdata_t *encloser = NULL; + qpcnode_t *encloser = NULL; dns_qpchain_node(&search.chain, i, NULL, (void **)&encloser, NULL); @@ -2093,7 +2094,7 @@ findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_name_t *dcname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { - dns_qpdata_t *node = NULL; + qpcnode_t *node = NULL; isc_rwlock_t *lock = NULL; isc_result_t result; qpdb_search_t search; @@ -2104,14 +2105,14 @@ findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options, isc_rwlocktype_t nlocktype = isc_rwlocktype_none; bool dcnull = (dcname == NULL); - REQUIRE(VALID_QPDB((dns_qpdb_t *)db)); + REQUIRE(VALID_QPDB((qpcache_t *)db)); if (now == 0) { now = isc_stdtime_now(); } search = (qpdb_search_t){ - .qpdb = (dns_qpdb_t *)db, + .qpdb = (qpcache_t *)db, .serial = 1, .options = options, .now = now, @@ -2267,8 +2268,8 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers, isc_stdtime_t now, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *qpnode = (dns_qpdata_t *)node; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *qpnode = (qpcnode_t *)node; dns_slabheader_t *header = NULL, *header_next = NULL; dns_slabheader_t *found = NULL, *foundsig = NULL; dns_typepair_t matchtype, sigmatchtype, negtype; @@ -2366,7 +2367,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, static isc_result_t setcachestats(dns_db_t *db, isc_stats_t *stats) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; REQUIRE(VALID_QPDB(qpdb)); REQUIRE(stats != NULL); @@ -2377,7 +2378,7 @@ setcachestats(dns_db_t *db, isc_stats_t *stats) { static dns_stats_t * getrrsetstats(dns_db_t *db) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; REQUIRE(VALID_QPDB(qpdb)); @@ -2386,7 +2387,7 @@ getrrsetstats(dns_db_t *db) { static isc_result_t setservestalettl(dns_db_t *db, dns_ttl_t ttl) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; REQUIRE(VALID_QPDB(qpdb)); @@ -2397,7 +2398,7 @@ setservestalettl(dns_db_t *db, dns_ttl_t ttl) { static isc_result_t getservestalettl(dns_db_t *db, dns_ttl_t *ttl) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; REQUIRE(VALID_QPDB(qpdb)); @@ -2407,7 +2408,7 @@ getservestalettl(dns_db_t *db, dns_ttl_t *ttl) { static isc_result_t setservestalerefresh(dns_db_t *db, uint32_t interval) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; REQUIRE(VALID_QPDB(qpdb)); @@ -2418,7 +2419,7 @@ setservestalerefresh(dns_db_t *db, uint32_t interval) { static isc_result_t getservestalerefresh(dns_db_t *db, uint32_t *interval) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; REQUIRE(VALID_QPDB(qpdb)); @@ -2428,8 +2429,8 @@ getservestalerefresh(dns_db_t *db, uint32_t *interval) { static void expiredata(dns_db_t *db, dns_dbnode_t *node, void *data) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *qpnode = (dns_qpdata_t *)node; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *qpnode = (qpcnode_t *)node; dns_slabheader_t *header = data; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; isc_rwlocktype_t tlocktype = isc_rwlocktype_none; @@ -2452,7 +2453,7 @@ rdataset_size(dns_slabheader_t *header) { } static size_t -expire_lru_headers(dns_qpdb_t *qpdb, unsigned int locknum, +expire_lru_headers(qpcache_t *qpdb, unsigned int locknum, isc_rwlocktype_t *nlocktypep, isc_rwlocktype_t *tlocktypep, size_t purgesize DNS__DB_FLARG) { dns_slabheader_t *header = NULL; @@ -2492,12 +2493,12 @@ expire_lru_headers(dns_qpdb_t *qpdb, unsigned int locknum, * A write lock on the tree must be held. */ static void -overmem(dns_qpdb_t *qpdb, dns_slabheader_t *newheader, +overmem(qpcache_t *qpdb, dns_slabheader_t *newheader, isc_rwlocktype_t *tlocktypep DNS__DB_FLARG) { uint32_t locknum_start = qpdb->lru_sweep++ % qpdb->node_lock_count; uint32_t locknum = locknum_start; /* Size of added data, possible node and possible ENT node. */ - size_t purgesize = rdataset_size(newheader) + 2 * sizeof(dns_qpdata_t); + size_t purgesize = rdataset_size(newheader) + 2 * sizeof(qpcnode_t); size_t purged = 0; isc_stdtime_t min_last_used = 0; size_t max_passes = 8; @@ -2586,7 +2587,7 @@ set_index(void *what, unsigned int idx) { } static void -free_qpdb(dns_qpdb_t *qpdb, bool log) { +free_qpdb(qpcache_t *qpdb, bool log) { unsigned int i; char buf[DNS_NAME_FORMATSIZE]; dns_qp_t **treep = NULL; @@ -2596,7 +2597,7 @@ free_qpdb(dns_qpdb_t *qpdb, bool log) { * the overhead of unlinking all nodes here should be negligible. */ for (i = 0; i < qpdb->node_lock_count; i++) { - dns_qpdata_t *node = NULL; + qpcnode_t *node = NULL; node = ISC_LIST_HEAD(qpdb->deadnodes[i]); while (node != NULL) { @@ -2666,7 +2667,7 @@ free_qpdb(dns_qpdb_t *qpdb, bool log) { INSIST(ISC_LIST_EMPTY(qpdb->deadnodes[i])); } isc_mem_cput(qpdb->common.mctx, qpdb->deadnodes, - qpdb->node_lock_count, sizeof(dns_qpdatalist_t)); + qpdb->node_lock_count, sizeof(qpcnodelist_t)); } /* * Clean up heap objects. @@ -2711,16 +2712,16 @@ free_qpdb(dns_qpdb_t *qpdb, bool log) { static void qpdb_destroy(dns_db_t *arg) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)arg; + qpcache_t *qpdb = (qpcache_t *)arg; bool want_free = false; unsigned int i; unsigned int inactive = 0; if (qpdb->origin_node != NULL) { - dns_qpdata_detach(&qpdb->origin_node); + qpcnode_detach(&qpdb->origin_node); } if (qpdb->nsec3_origin_node != NULL) { - dns_qpdata_detach(&qpdb->nsec3_origin_node); + qpcnode_detach(&qpdb->nsec3_origin_node); } /* XXX check for open versions here */ @@ -2786,8 +2787,8 @@ mark_ancient(dns_slabheader_t *header) { * The caller must hold a tree write lock and bucketnum'th node (write) lock. */ static void -cleanup_dead_nodes(dns_qpdb_t *qpdb, int bucketnum DNS__DB_FLARG) { - dns_qpdata_t *node = NULL; +cleanup_dead_nodes(qpcache_t *qpdb, int bucketnum DNS__DB_FLARG) { + qpcnode_t *node = NULL; int count = 10; /* XXXJT: should be adjustable */ node = ISC_LIST_HEAD(qpdb->deadnodes[bucketnum]); @@ -2825,7 +2826,7 @@ cleanup_dead_nodes(dns_qpdb_t *qpdb, int bucketnum DNS__DB_FLARG) { * have been added to the list). */ static void -reactivate_node(dns_qpdb_t *qpdb, dns_qpdata_t *node, +reactivate_node(qpcache_t *qpdb, qpcnode_t *node, isc_rwlocktype_t tlocktype DNS__DB_FLARG) { isc_rwlocktype_t nlocktype = isc_rwlocktype_none; isc_rwlock_t *nodelock = &qpdb->node_locks[node->locknum].lock; @@ -2866,11 +2867,10 @@ reactivate_node(dns_qpdb_t *qpdb, dns_qpdata_t *node, NODE_UNLOCK(nodelock, &nlocktype); } -static dns_qpdata_t * -new_qpdata(dns_qpdb_t *qpdb, const dns_name_t *name) { - dns_qpdata_t *newdata = isc_mem_get(qpdb->common.mctx, - sizeof(*newdata)); - *newdata = (dns_qpdata_t){ +static qpcnode_t * +new_qpcnode(qpcache_t *qpdb, const dns_name_t *name) { + qpcnode_t *newdata = isc_mem_get(qpdb->common.mctx, sizeof(*newdata)); + *newdata = (qpcnode_t){ .name = DNS_NAME_INITEMPTY, .references = ISC_REFCOUNT_INITIALIZER(1), }; @@ -2881,7 +2881,7 @@ new_qpdata(dns_qpdb_t *qpdb, const dns_name_t *name) { ISC_LINK_INIT(newdata, deadlink); #ifdef DNS_DB_NODETRACE - fprintf(stderr, "new_qpdata:%s:%s:%d:%p->references = 1\n", __func__, + fprintf(stderr, "new_qpcnode:%s:%s:%d:%p->references = 1\n", __func__, __FILE__, __LINE__ + 1, name); #endif return (newdata); @@ -2890,8 +2890,8 @@ new_qpdata(dns_qpdb_t *qpdb, const dns_name_t *name) { static isc_result_t findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *node = NULL; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *node = NULL; isc_result_t result; isc_rwlocktype_t tlocktype = isc_rwlocktype_none; @@ -2912,10 +2912,10 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create, result = dns_qp_lookup(qpdb->tree, name, NULL, NULL, NULL, (void **)&node, NULL); if (result != ISC_R_SUCCESS) { - node = new_qpdata(qpdb, name); + node = new_qpcnode(qpdb, name); result = dns_qp_insert(qpdb->tree, node, 0); INSIST(result == ISC_R_SUCCESS); - dns_qpdata_unref(node); + qpcnode_unref(node); } } @@ -2931,11 +2931,11 @@ unlock: static void attachnode(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp DNS__DB_FLARG) { - REQUIRE(VALID_QPDB((dns_qpdb_t *)db)); + REQUIRE(VALID_QPDB((qpcache_t *)db)); REQUIRE(targetp != NULL && *targetp == NULL); - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *node = (dns_qpdata_t *)source; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *node = (qpcnode_t *)source; newref(qpdb, node, isc_rwlocktype_none, isc_rwlocktype_none DNS__DB_FLARG_PASS); @@ -2945,8 +2945,8 @@ attachnode(dns_db_t *db, dns_dbnode_t *source, static void detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *node = NULL; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *node = NULL; bool want_free = false; bool inactive = false; db_nodelock_t *nodelock = NULL; @@ -2956,7 +2956,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG) { REQUIRE(VALID_QPDB(qpdb)); REQUIRE(targetp != NULL && *targetp != NULL); - node = (dns_qpdata_t *)(*targetp); + node = (qpcnode_t *)(*targetp); nodelock = &qpdb->node_locks[node->locknum]; NODE_RDLOCK(&nodelock->lock, &nlocktype); @@ -3002,7 +3002,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG) { static isc_result_t createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; qpdb_dbiterator_t *qpdbiter = NULL; REQUIRE(VALID_QPDB(qpdb)); @@ -3048,8 +3048,8 @@ static isc_result_t allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, unsigned int options, isc_stdtime_t now, dns_rdatasetiter_t **iteratorp DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *qpnode = (dns_qpdata_t *)node; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *qpnode = (qpcnode_t *)node; qpdb_rdatasetiter_t *iterator = NULL; REQUIRE(VALID_QPDB(qpdb)); @@ -3080,7 +3080,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, } static isc_result_t -add(dns_qpdb_t *qpdb, dns_qpdata_t *qpnode, +add(qpcache_t *qpdb, qpcnode_t *qpnode, const dns_name_t *nodename ISC_ATTR_UNUSED, dns_slabheader_t *newheader, unsigned int options, bool loading, dns_rdataset_t *addedrdataset, isc_stdtime_t now, isc_rwlocktype_t nlocktype, @@ -3572,7 +3572,7 @@ cleanup: } static void -expire_ttl_headers(dns_qpdb_t *qpdb, unsigned int locknum, +expire_ttl_headers(qpcache_t *qpdb, unsigned int locknum, isc_rwlocktype_t *nlocktypep, isc_rwlocktype_t *tlocktypep, isc_stdtime_t now, bool cache_is_overmem DNS__DB_FLARG); @@ -3580,8 +3580,8 @@ static isc_result_t addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *addedrdataset DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *qpnode = (dns_qpdata_t *)node; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *qpnode = (qpcnode_t *)node; isc_region_t region; dns_slabheader_t *newheader = NULL; isc_result_t result; @@ -3720,7 +3720,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, result = ISC_R_SUCCESS; if (newnsec) { - dns_qpdata_t *nsecnode = NULL; + qpcnode_t *nsecnode = NULL; result = dns_qp_getname(qpdb->nsec, name, (void **)&nsecnode, NULL); @@ -3728,11 +3728,11 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, result = ISC_R_SUCCESS; } else { INSIST(nsecnode == NULL); - nsecnode = new_qpdata(qpdb, name); + nsecnode = new_qpcnode(qpdb, name); nsecnode->nsec = DNS_DB_NSEC_NSEC; result = dns_qp_insert(qpdb->nsec, nsecnode, 0); INSIST(result == ISC_R_SUCCESS); - dns_qpdata_detach(&nsecnode); + qpcnode_detach(&nsecnode); } qpnode->nsec = DNS_DB_NSEC_HAS_NSEC; } @@ -3759,8 +3759,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, static isc_result_t deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *qpnode = (dns_qpdata_t *)node; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *qpnode = (qpcnode_t *)node; isc_result_t result; dns_slabheader_t *newheader = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; @@ -3791,7 +3791,7 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, static unsigned int nodecount(dns_db_t *db, dns_dbtree_t tree) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; dns_qp_memusage_t mu; isc_rwlocktype_t tlocktype = isc_rwlocktype_none; @@ -3818,7 +3818,7 @@ nodecount(dns_db_t *db, dns_dbtree_t tree) { static void setloop(dns_db_t *db, isc_loop_t *loop) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; + qpcache_t *qpdb = (qpcache_t *)db; REQUIRE(VALID_QPDB(qpdb)); @@ -3834,15 +3834,15 @@ setloop(dns_db_t *db, isc_loop_t *loop) { static isc_result_t getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *onode = NULL; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *onode = NULL; isc_result_t result = ISC_R_SUCCESS; REQUIRE(VALID_QPDB(qpdb)); REQUIRE(nodep != NULL && *nodep == NULL); /* Note that the access to origin_node doesn't require a DB lock */ - onode = (dns_qpdata_t *)qpdb->origin_node; + onode = (qpcnode_t *)qpdb->origin_node; if (onode != NULL) { newref(qpdb, onode, isc_rwlocktype_none, isc_rwlocktype_none DNS__DB_FLARG_PASS); @@ -3856,16 +3856,16 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) { static void locknode(dns_db_t *db, dns_dbnode_t *node, isc_rwlocktype_t type) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *qpnode = (dns_qpdata_t *)node; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *qpnode = (qpcnode_t *)node; RWLOCK(&qpdb->node_locks[qpnode->locknum].lock, type); } static void unlocknode(dns_db_t *db, dns_dbnode_t *node, isc_rwlocktype_t type) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)db; - dns_qpdata_t *qpnode = (dns_qpdata_t *)node; + qpcache_t *qpdb = (qpcache_t *)db; + qpcnode_t *qpnode = (qpcnode_t *)node; RWUNLOCK(&qpdb->node_locks[qpnode->locknum].lock, type); } @@ -3875,7 +3875,7 @@ dns__qpcache_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, dns_rdataclass_t rdclass, unsigned int argc, char *argv[], void *driverarg ISC_ATTR_UNUSED, dns_db_t **dbp) { - dns_qpdb_t *qpdb = NULL; + qpcache_t *qpdb = NULL; isc_mem_t *hmctx = mctx; int i; @@ -3883,7 +3883,7 @@ dns__qpcache_create(isc_mem_t *mctx, const dns_name_t *origin, REQUIRE(type == dns_dbtype_cache); qpdb = isc_mem_get(mctx, sizeof(*qpdb)); - *qpdb = (dns_qpdb_t){ + *qpdb = (qpcache_t){ .common.origin = DNS_NAME_INITEMPTY, .common.rdclass = rdclass, .current_serial = 1, @@ -3946,7 +3946,7 @@ dns__qpcache_create(isc_mem_t *mctx, const dns_name_t *origin, * Create deadnode lists. */ qpdb->deadnodes = isc_mem_cget(mctx, qpdb->node_lock_count, - sizeof(dns_qpdatalist_t)); + sizeof(qpcnodelist_t)); for (i = 0; i < (int)qpdb->node_lock_count; i++) { ISC_LIST_INIT(qpdb->deadnodes[i]); } @@ -4006,7 +4006,7 @@ rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp DNS__DB_FLARG) { } static bool -iterator_active(dns_qpdb_t *qpdb, qpdb_rdatasetiter_t *rbtiterator, +iterator_active(qpcache_t *qpdb, qpdb_rdatasetiter_t *rbtiterator, dns_slabheader_t *header) { dns_ttl_t stale_ttl = header->ttl + STALE_TTL(header, qpdb); @@ -4037,8 +4037,8 @@ iterator_active(dns_qpdb_t *qpdb, qpdb_rdatasetiter_t *rbtiterator, static isc_result_t rdatasetiter_first(dns_rdatasetiter_t *iterator DNS__DB_FLARG) { qpdb_rdatasetiter_t *rbtiterator = (qpdb_rdatasetiter_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)(rbtiterator->common.db); - dns_qpdata_t *qpnode = rbtiterator->common.node; + qpcache_t *qpdb = (qpcache_t *)(rbtiterator->common.db); + qpcnode_t *qpnode = rbtiterator->common.node; dns_slabheader_t *header = NULL, *top_next = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; @@ -4081,8 +4081,8 @@ rdatasetiter_first(dns_rdatasetiter_t *iterator DNS__DB_FLARG) { static isc_result_t rdatasetiter_next(dns_rdatasetiter_t *iterator DNS__DB_FLARG) { qpdb_rdatasetiter_t *rbtiterator = (qpdb_rdatasetiter_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)(rbtiterator->common.db); - dns_qpdata_t *qpnode = rbtiterator->common.node; + qpcache_t *qpdb = (qpcache_t *)(rbtiterator->common.db); + qpcnode_t *qpnode = rbtiterator->common.node; dns_slabheader_t *header = NULL, *top_next = NULL; dns_typepair_t type, negtype; dns_rdatatype_t rdtype, covers; @@ -4171,8 +4171,8 @@ static void rdatasetiter_current(dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset DNS__DB_FLARG) { qpdb_rdatasetiter_t *rbtiterator = (qpdb_rdatasetiter_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)(rbtiterator->common.db); - dns_qpdata_t *qpnode = rbtiterator->common.node; + qpcache_t *qpdb = (qpcache_t *)(rbtiterator->common.db); + qpcnode_t *qpnode = rbtiterator->common.node; dns_slabheader_t *header = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; @@ -4193,8 +4193,8 @@ rdatasetiter_current(dns_rdatasetiter_t *iterator, static void reference_iter_node(qpdb_dbiterator_t *qpdbiter DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)qpdbiter->common.db; - dns_qpdata_t *node = qpdbiter->node; + qpcache_t *qpdb = (qpcache_t *)qpdbiter->common.db; + qpcnode_t *node = qpdbiter->node; if (node == NULL) { return; @@ -4206,8 +4206,8 @@ reference_iter_node(qpdb_dbiterator_t *qpdbiter DNS__DB_FLARG) { static void dereference_iter_node(qpdb_dbiterator_t *qpdbiter DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)qpdbiter->common.db; - dns_qpdata_t *node = qpdbiter->node; + qpcache_t *qpdb = (qpcache_t *)qpdbiter->common.db; + qpcnode_t *node = qpdbiter->node; isc_rwlock_t *lock = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; isc_rwlocktype_t tlocktype = qpdbiter->tree_locked; @@ -4231,7 +4231,7 @@ dereference_iter_node(qpdb_dbiterator_t *qpdbiter DNS__DB_FLARG) { static void resume_iteration(qpdb_dbiterator_t *qpdbiter, bool continuing) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)qpdbiter->common.db; + qpcache_t *qpdb = (qpcache_t *)qpdbiter->common.db; REQUIRE(qpdbiter->paused); REQUIRE(qpdbiter->tree_locked == isc_rwlocktype_none); @@ -4266,7 +4266,7 @@ resume_iteration(qpdb_dbiterator_t *qpdbiter, bool continuing) { static void dbiterator_destroy(dns_dbiterator_t **iteratorp DNS__DB_FLARG) { qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)(*iteratorp); - dns_qpdb_t *qpdb = (dns_qpdb_t *)qpdbiter->common.db; + qpcache_t *qpdb = (qpcache_t *)qpdbiter->common.db; dns_db_t *db = NULL; if (qpdbiter->tree_locked == isc_rwlocktype_read) { @@ -4289,7 +4289,7 @@ static isc_result_t dbiterator_first(dns_dbiterator_t *iterator DNS__DB_FLARG) { isc_result_t result; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)iterator->db; + qpcache_t *qpdb = (qpcache_t *)iterator->db; if (qpdbiter->result != ISC_R_SUCCESS && qpdbiter->result != ISC_R_NOTFOUND && @@ -4364,7 +4364,7 @@ static isc_result_t dbiterator_last(dns_dbiterator_t *iterator DNS__DB_FLARG) { isc_result_t result; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)iterator->db; + qpcache_t *qpdb = (qpcache_t *)iterator->db; if (qpdbiter->result != ISC_R_SUCCESS && qpdbiter->result != ISC_R_NOTFOUND && @@ -4446,7 +4446,7 @@ dbiterator_seek(dns_dbiterator_t *iterator, const dns_name_t *name DNS__DB_FLARG) { isc_result_t result, tresult; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)iterator->db; + qpcache_t *qpdb = (qpcache_t *)iterator->db; if (qpdbiter->result != ISC_R_SUCCESS && qpdbiter->result != ISC_R_NOTFOUND && @@ -4485,7 +4485,7 @@ dbiterator_seek(dns_dbiterator_t *iterator, qpdbiter->current, NULL, (void **)&qpdbiter->node, NULL); if (result == DNS_R_PARTIALMATCH) { - dns_qpdata_t *node = NULL; + qpcnode_t *node = NULL; tresult = dns_qp_lookup(qpdb->nsec3, name, NULL, &qpdbiter->nsec3iter, NULL, (void **)&node, NULL); @@ -4518,7 +4518,7 @@ static isc_result_t dbiterator_prev(dns_dbiterator_t *iterator DNS__DB_FLARG) { isc_result_t result; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)iterator->db; + qpcache_t *qpdb = (qpcache_t *)iterator->db; REQUIRE(qpdbiter->node != NULL); @@ -4574,7 +4574,7 @@ static isc_result_t dbiterator_next(dns_dbiterator_t *iterator DNS__DB_FLARG) { isc_result_t result; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; - dns_qpdb_t *qpdb = (dns_qpdb_t *)iterator->db; + qpcache_t *qpdb = (qpcache_t *)iterator->db; REQUIRE(qpdbiter->node != NULL); @@ -4640,9 +4640,9 @@ dbiterator_next(dns_dbiterator_t *iterator DNS__DB_FLARG) { static isc_result_t dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep, dns_name_t *name DNS__DB_FLARG) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)iterator->db; + qpcache_t *qpdb = (qpcache_t *)iterator->db; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; - dns_qpdata_t *node = qpdbiter->node; + qpcnode_t *node = qpdbiter->node; isc_result_t result = ISC_R_SUCCESS; REQUIRE(qpdbiter->result == ISC_R_SUCCESS); @@ -4672,7 +4672,7 @@ dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep, static isc_result_t dbiterator_pause(dns_dbiterator_t *iterator) { - dns_qpdb_t *qpdb = (dns_qpdb_t *)iterator->db; + qpcache_t *qpdb = (qpcache_t *)iterator->db; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; if (qpdbiter->result != ISC_R_SUCCESS && @@ -4714,7 +4714,7 @@ static void deletedata(dns_db_t *db ISC_ATTR_UNUSED, dns_dbnode_t *node ISC_ATTR_UNUSED, void *data) { dns_slabheader_t *header = data; - dns_qpdb_t *qpdb = (dns_qpdb_t *)header->db; + qpcache_t *qpdb = (qpcache_t *)header->db; if (header->heap != NULL && header->heap_index != 0) { isc_heap_delete(header->heap, header->heap_index); @@ -4740,7 +4740,7 @@ deletedata(dns_db_t *db ISC_ATTR_UNUSED, dns_dbnode_t *node ISC_ATTR_UNUSED, * Caller must be holding the node write lock. */ static void -expire_ttl_headers(dns_qpdb_t *qpdb, unsigned int locknum, +expire_ttl_headers(qpcache_t *qpdb, unsigned int locknum, isc_rwlocktype_t *nlocktypep, isc_rwlocktype_t *tlocktypep, isc_stdtime_t now, bool cache_is_overmem DNS__DB_FLARG) { isc_heap_t *heap = qpdb->heaps[locknum]; @@ -4803,7 +4803,7 @@ static dns_dbmethods_t qpdb_cachemethods = { }; static void -qpdata_destroy(dns_qpdata_t *data) { +qpcnode_destroy(qpcnode_t *data) { dns_slabheader_t *current = NULL, *next = NULL; for (current = data->data; current != NULL; current = next) { @@ -4820,11 +4820,11 @@ qpdata_destroy(dns_qpdata_t *data) { } dns_name_free(&data->name, data->mctx); - isc_mem_putanddetach(&data->mctx, data, sizeof(dns_qpdata_t)); + isc_mem_putanddetach(&data->mctx, data, sizeof(qpcnode_t)); } #ifdef DNS_DB_NODETRACE -ISC_REFCOUNT_TRACE_IMPL(dns_qpdata, qpdata_destroy); +ISC_REFCOUNT_TRACE_IMPL(qpcnode, qpcnode_destroy); #else -ISC_REFCOUNT_IMPL(dns_qpdata, qpdata_destroy); +ISC_REFCOUNT_IMPL(qpcnode, qpcnode_destroy); #endif diff --git a/lib/dns/qpzone.c b/lib/dns/qpzone.c index c8b9a7f9ee..9d6d2b15ff 100644 --- a/lib/dns/qpzone.c +++ b/lib/dns/qpzone.c @@ -86,14 +86,14 @@ ((atomic_load_acquire(&(header)->attributes) & \ DNS_SLABHEADERATTR_STATCOUNT) != 0) -#define HEADERNODE(h) ((qpdata_t *)((h)->node)) +#define HEADERNODE(h) ((qpznode_t *)((h)->node)) #define QPDB_ATTR_LOADED 0x01 #define QPDB_ATTR_LOADING 0x02 #define DEFAULT_NODE_LOCK_COUNT 7 /*%< Should be prime. */ -#define HEADERNODE(h) ((qpdata_t *)((h)->node)) +#define HEADERNODE(h) ((qpznode_t *)((h)->node)) #define QPDBITER_NSEC3_ORIGIN_NODE(qpdb, iterator) \ ((iterator)->current == &(iterator)->nsec3iter && \ @@ -108,10 +108,10 @@ ((qpdb) != NULL && (qpdb)->common.impmagic == QPZONE_DB_MAGIC) typedef struct qpzonedb qpzonedb_t; -typedef struct qpdata qpdata_t; +typedef struct qpznode qpznode_t; typedef struct qpdb_changed { - qpdata_t *node; + qpznode_t *node; bool dirty; ISC_LINK(struct qpdb_changed) link; } qpdb_changed_t; @@ -150,7 +150,7 @@ struct qpdb_version { typedef ISC_LIST(qpdb_version_t) qpdb_versionlist_t; -struct qpdata { +struct qpznode { dns_name_t name; isc_mem_t *mctx; isc_refcount_t references; @@ -173,8 +173,8 @@ struct qpzonedb { /* Locks for tree nodes */ int node_lock_count; db_nodelock_t *node_locks; - qpdata_t *origin; - qpdata_t *nsec3_origin; + qpznode_t *origin; + qpznode_t *nsec3_origin; isc_stats_t *gluecachestats; /* Locked by lock. */ unsigned int active; @@ -209,7 +209,7 @@ typedef struct { bool copy_name; bool need_cleanup; bool wild; - qpdata_t *zonecut; + qpznode_t *zonecut; dns_slabheader_t *zonecut_header; dns_slabheader_t *zonecut_sigheader; dns_fixedname_t zonecut_name; @@ -230,14 +230,14 @@ typedef struct { static dns_dbmethods_t qpdb_zonemethods; #if DNS_DB_NODETRACE -#define qpdata_ref(ptr) qpdata__ref(ptr, __func__, __FILE__, __LINE__) -#define qpdata_unref(ptr) qpdata__unref(ptr, __func__, __FILE__, __LINE__) -#define qpdata_attach(ptr, ptrp) \ - qpdata__attach(ptr, ptrp, __func__, __FILE__, __LINE__) -#define qpdata_detach(ptrp) qpdata__detach(ptrp, __func__, __FILE__, __LINE__) -ISC_REFCOUNT_TRACE_DECL(qpdata); +#define qpznode_ref(ptr) qpznode__ref(ptr, __func__, __FILE__, __LINE__) +#define qpznode_unref(ptr) qpznode__unref(ptr, __func__, __FILE__, __LINE__) +#define qpznode_attach(ptr, ptrp) \ + qpznode__attach(ptr, ptrp, __func__, __FILE__, __LINE__) +#define qpznode_detach(ptrp) qpznode__detach(ptrp, __func__, __FILE__, __LINE__) +ISC_REFCOUNT_STATIC_TRACE_DECL(qpznode); #else -ISC_REFCOUNT_DECL(qpdata); +ISC_REFCOUNT_STATIC_DECL(qpznode); #endif /* QP trie methods */ @@ -321,7 +321,7 @@ typedef struct qpdb_dbiterator { dns_qpiter_t *current; /* current iterator, which is one of: */ dns_qpiter_t mainiter; /* - main tree iterator */ dns_qpiter_t nsec3iter; /* - nsec3 tree iterator */ - qpdata_t *node; + qpznode_t *node; enum { full, nonsec3, nsec3only } nsec3mode; } qpdb_dbiterator_t; @@ -528,10 +528,10 @@ qpdb_destroy(dns_db_t *arg) { unsigned int inactive = 0; if (qpdb->origin != NULL) { - qpdata_detach(&qpdb->origin); + qpznode_detach(&qpdb->origin); } if (qpdb->nsec3_origin != NULL) { - qpdata_detach(&qpdb->nsec3_origin); + qpznode_detach(&qpdb->nsec3_origin); } /* @@ -584,10 +584,10 @@ qpdb_destroy(dns_db_t *arg) { } } -static qpdata_t * -new_qpdata(qpzonedb_t *qpdb, const dns_name_t *name) { - qpdata_t *newdata = isc_mem_get(qpdb->common.mctx, sizeof(*newdata)); - *newdata = (qpdata_t){ +static qpznode_t * +new_qpznode(qpzonedb_t *qpdb, const dns_name_t *name) { + qpznode_t *newdata = isc_mem_get(qpdb->common.mctx, sizeof(*newdata)); + *newdata = (qpznode_t){ .name = DNS_NAME_INITEMPTY, .references = ISC_REFCOUNT_INITIALIZER(1), }; @@ -596,7 +596,7 @@ new_qpdata(qpzonedb_t *qpdb, const dns_name_t *name) { isc_mem_attach(qpdb->common.mctx, &newdata->mctx); #if DNS_DB_NODETRACE - fprintf(stderr, "new_qpdata:%s:%s:%d:%p->references = 1\n", __func__, + fprintf(stderr, "new_qpznode:%s:%s:%d:%p->references = 1\n", __func__, __FILE__, __LINE__ + 1, name); #endif return (newdata); @@ -700,7 +700,7 @@ dns__qpzone_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, */ dns_qpmulti_write(qpdb->tree, &qp); - qpdb->origin = new_qpdata(qpdb, &qpdb->common.origin); + qpdb->origin = new_qpznode(qpdb, &qpdb->common.origin); result = dns_qp_insert(qp, qpdb->origin, 0); qpdb->origin->nsec = DNS_DB_NSEC_NORMAL; dns_qpmulti_commit(qpdb->tree, &qp); @@ -717,7 +717,7 @@ dns__qpzone_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, * record in the tree. */ dns_qpmulti_write(qpdb->nsec3, &qp); - qpdb->nsec3_origin = new_qpdata(qpdb, &qpdb->common.origin); + qpdb->nsec3_origin = new_qpznode(qpdb, &qpdb->common.origin); qpdb->nsec3_origin->nsec = DNS_DB_NSEC_NSEC3; result = dns_qp_insert(qp, qpdb->nsec3_origin, 0); dns_qpmulti_commit(qpdb->nsec3, &qp); @@ -743,10 +743,10 @@ dns__qpzone_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, } static void -newref(qpzonedb_t *qpdb, qpdata_t *node DNS__DB_FLARG) { +newref(qpzonedb_t *qpdb, qpznode_t *node DNS__DB_FLARG) { uint_fast32_t refs; - qpdata_ref(node); + qpznode_ref(node); refs = isc_refcount_increment0(&node->erefs); #if DNS_DB_NODETRACE fprintf(stderr, "incr:node:%s:%s:%u:%p->erefs = %" PRIuFAST32 "\n", @@ -772,7 +772,7 @@ newref(qpzonedb_t *qpdb, qpdata_t *node DNS__DB_FLARG) { } static void -clean_zone_node(qpdata_t *node, uint32_t least_serial) { +clean_zone_node(qpznode_t *node, uint32_t least_serial) { dns_slabheader_t *current = NULL, *dcurrent = NULL; dns_slabheader_t *down_next = NULL, *dparent = NULL; dns_slabheader_t *top_prev = NULL, *top_next = NULL; @@ -904,7 +904,7 @@ clean_zone_node(qpdata_t *node, uint32_t least_serial) { * not mean it will be immediately freed.) */ static void -decref(qpzonedb_t *qpdb, qpdata_t *node, uint32_t least_serial, +decref(qpzonedb_t *qpdb, qpznode_t *node, uint32_t least_serial, isc_rwlocktype_t *nlocktypep DNS__DB_FLARG) { db_nodelock_t *nodelock = NULL; int bucket = node->locknum; @@ -976,11 +976,11 @@ decref(qpzonedb_t *qpdb, qpdata_t *node, uint32_t least_serial, } done: - qpdata_unref(node); + qpznode_unref(node); } static void -bindrdataset(qpzonedb_t *qpdb, qpdata_t *node, dns_slabheader_t *header, +bindrdataset(qpzonedb_t *qpdb, qpznode_t *node, dns_slabheader_t *header, isc_stdtime_t now, dns_rdataset_t *rdataset DNS__DB_FLARG) { if (rdataset == NULL) { return; @@ -1034,7 +1034,7 @@ bindrdataset(qpzonedb_t *qpdb, qpdata_t *node, dns_slabheader_t *header, static void setnsec3parameters(dns_db_t *db, qpdb_version_t *version) { - qpdata_t *node = NULL; + qpznode_t *node = NULL; dns_rdata_nsec3param_t nsec3param; dns_rdata_t rdata = DNS_RDATA_INIT; isc_region_t region; @@ -1300,7 +1300,7 @@ make_least_version(qpzonedb_t *qpdb, qpdb_version_t *version, } static void -rollback_node(qpdata_t *node, uint32_t serial) { +rollback_node(qpznode_t *node, uint32_t serial) { dns_slabheader_t *header = NULL, *dcurrent = NULL; bool make_dirty = false; @@ -1336,7 +1336,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, qpzonedb_t *qpdb = (qpzonedb_t *)db; qpdb_version_t *version = NULL, *cleanup_version = NULL; qpdb_version_t *least_greater = NULL; - qpdata_t *node = NULL; + qpznode_t *node = NULL; bool rollback = false; qpdb_changed_t *changed = NULL, *next_changed = NULL; qpdb_changedlist_t cleanup_list; @@ -1565,7 +1565,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, isc_stdtime_t now ISC_ATTR_UNUSED, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)dbnode; + qpznode_t *node = (qpznode_t *)dbnode; dns_slabheader_t *header = NULL, *header_next = NULL; dns_slabheader_t *found = NULL, *foundsig = NULL; uint32_t serial; @@ -1646,7 +1646,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, } static bool -delegating_type(qpzonedb_t *qpdb, qpdata_t *node, dns_typepair_t type) { +delegating_type(qpzonedb_t *qpdb, qpznode_t *node, dns_typepair_t type) { return (type == dns_rdatatype_dname || (type == dns_rdatatype_ns && (node != qpdb->origin || IS_STUB(qpdb)))); @@ -1655,10 +1655,10 @@ delegating_type(qpzonedb_t *qpdb, qpdata_t *node, dns_typepair_t type) { static void loading_addnode(qpdb_load_t *loadctx, const dns_name_t *name, dns_rdatatype_t type, dns_rdatatype_t covers, - qpdata_t **nodep) { + qpznode_t **nodep) { qpzonedb_t *qpdb = (qpzonedb_t *)loadctx->db; isc_result_t result; - qpdata_t *node = NULL, *nsecnode = NULL; + qpznode_t *node = NULL, *nsecnode = NULL; if (type == dns_rdatatype_nsec3 || covers == dns_rdatatype_nsec3) { result = dns_qp_getname(loadctx->nsec3, name, (void **)&node, @@ -1666,12 +1666,12 @@ loading_addnode(qpdb_load_t *loadctx, const dns_name_t *name, if (result == ISC_R_SUCCESS) { *nodep = node; } else { - node = new_qpdata(qpdb, name); + node = new_qpznode(qpdb, name); result = dns_qp_insert(loadctx->nsec3, node, 0); INSIST(result == ISC_R_SUCCESS); node->nsec = DNS_DB_NSEC_NSEC3; *nodep = node; - qpdata_detach(&node); + qpznode_detach(&node); } return; } @@ -1685,10 +1685,10 @@ loading_addnode(qpdb_load_t *loadctx, const dns_name_t *name, } } else { INSIST(node == NULL); - node = new_qpdata(qpdb, name); + node = new_qpznode(qpdb, name); result = dns_qp_insert(loadctx->tree, node, 0); INSIST(result == ISC_R_SUCCESS); - qpdata_unref(node); + qpznode_unref(node); } if (type != dns_rdatatype_nsec) { goto done; @@ -1699,20 +1699,20 @@ loading_addnode(qpdb_load_t *loadctx, const dns_name_t *name, * too. This tree speeds searches for closest NSECs that would * otherwise need to examine many irrelevant nodes in large TLDs. */ - nsecnode = new_qpdata(qpdb, name); + nsecnode = new_qpznode(qpdb, name); result = dns_qp_insert(loadctx->nsec, nsecnode, 0); node->nsec = DNS_DB_NSEC_HAS_NSEC; if (result == ISC_R_SUCCESS) { nsecnode->nsec = DNS_DB_NSEC_NSEC; } - qpdata_detach(&nsecnode); + qpznode_detach(&nsecnode); done: *nodep = node; } static bool -cname_and_other(qpdata_t *node, uint32_t serial) { +cname_and_other(qpznode_t *node, uint32_t serial) { dns_slabheader_t *header = NULL, *header_next = NULL; bool cname = false, other = false; dns_rdatatype_t rdtype; @@ -1781,7 +1781,7 @@ static qpdb_changed_t * add_changed(dns_slabheader_t *header, qpdb_version_t *version DNS__DB_FLARG) { qpdb_changed_t *changed = NULL; qpzonedb_t *qpdb = (qpzonedb_t *)header->db; - qpdata_t *node = (qpdata_t *)header->node; + qpznode_t *node = (qpznode_t *)header->node; changed = isc_mem_get(qpdb->common.mctx, sizeof(*changed)); @@ -1826,7 +1826,7 @@ maybe_update_recordsandsize(bool add, qpdb_version_t *version, } static isc_result_t -add(qpzonedb_t *qpdb, qpdata_t *node, const dns_name_t *nodename, +add(qpzonedb_t *qpdb, qpznode_t *node, const dns_name_t *nodename, qpdb_version_t *version, dns_slabheader_t *newheader, unsigned int options, bool loading, dns_rdataset_t *addedrdataset, isc_stdtime_t now DNS__DB_FLARG) { @@ -2063,7 +2063,7 @@ wildcardmagic(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name, dns_name_t foundname; dns_offsets_t offsets; unsigned int n; - qpdata_t *node = NULL; + qpznode_t *node = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; dns_name_init(&foundname, offsets); @@ -2076,10 +2076,10 @@ wildcardmagic(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name, result = dns_qp_getname(qp, &foundname, (void **)&node, NULL); if (result != ISC_R_SUCCESS) { INSIST(node == NULL); - node = new_qpdata(qpdb, &foundname); + node = new_qpznode(qpdb, &foundname); result = dns_qp_insert(qp, node, 0); INSIST(result == ISC_R_SUCCESS); - qpdata_unref(node); + qpznode_unref(node); } /* set the bit, locking if necessary */ @@ -2118,7 +2118,7 @@ loading_addrdataset(void *arg, const dns_name_t *name, dns_rdataset_t *rdataset DNS__DB_FLARG) { qpdb_load_t *loadctx = arg; qpzonedb_t *qpdb = (qpzonedb_t *)loadctx->db; - qpdata_t *node = NULL; + qpznode_t *node = NULL; isc_result_t result = ISC_R_SUCCESS; isc_region_t region; dns_slabheader_t *newheader = NULL; @@ -2496,7 +2496,7 @@ static isc_result_t findnodeintree(qpzonedb_t *qpdb, const dns_name_t *name, bool create, bool nsec3, dns_dbnode_t **nodep DNS__DB_FLARG) { isc_result_t result; - qpdata_t *node = NULL; + qpznode_t *node = NULL; dns_qpmulti_t *dbtree = nsec3 ? qpdb->nsec3 : qpdb->tree; dns_qpread_t qpr = { 0 }; dns_qp_t *qp = NULL; @@ -2515,9 +2515,9 @@ findnodeintree(qpzonedb_t *qpdb, const dns_name_t *name, bool create, return (result); } - node = new_qpdata(qpdb, name); + node = new_qpznode(qpdb, name); result = dns_qp_insert(qp, node, 0); - qpdata_unref(node); + qpznode_unref(node); if (result == ISC_R_SUCCESS) { if (nsec3) { @@ -2613,7 +2613,7 @@ setup_delegation(qpdb_search_t *search, dns_dbnode_t **nodep, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { dns_name_t *zcname = NULL; dns_typepair_t type; - qpdata_t *node = NULL; + qpznode_t *node = NULL; REQUIRE(search != NULL); REQUIRE(search->zonecut != NULL); @@ -2681,7 +2681,7 @@ step(qpdb_search_t *search, dns_qpiter_t *it, direction_t direction, dns_fixedname_t fnodename; dns_name_t *nodename = dns_fixedname_initname(&fnodename); qpzonedb_t *qpdb = NULL; - qpdata_t *node = NULL; + qpznode_t *node = NULL; isc_result_t result = ISC_R_SUCCESS; dns_slabheader_t *header = NULL; @@ -2820,7 +2820,7 @@ wildcard_blocked(qpdb_search_t *search, const dns_name_t *qname, } static isc_result_t -find_wildcard(qpdb_search_t *search, qpdata_t **nodep, +find_wildcard(qpdb_search_t *search, qpznode_t **nodep, const dns_name_t *qname) { dns_slabheader_t *header = NULL; isc_result_t result = ISC_R_NOTFOUND; @@ -2836,7 +2836,7 @@ find_wildcard(qpdb_search_t *search, qpdata_t **nodep, * continue the search. */ for (int i = dns_qpchain_length(&search->chain) - 1; i >= 0; i--) { - qpdata_t *node = NULL; + qpznode_t *node = NULL; isc_rwlock_t *lock = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; bool wild, active; @@ -2865,7 +2865,7 @@ find_wildcard(qpdb_search_t *search, qpdata_t **nodep, NODE_UNLOCK(lock, &nlocktype); if (wild) { - qpdata_t *wnode = NULL; + qpznode_t *wnode = NULL; dns_fixedname_t fwname; dns_name_t *wname = dns_fixedname_initname(&fwname); dns_qpiter_t wit; @@ -2947,7 +2947,7 @@ find_wildcard(qpdb_search_t *search, qpdata_t **nodep, */ static isc_result_t previous_closest_nsec(dns_rdatatype_t type, qpdb_search_t *search, - dns_name_t *name, qpdata_t **nodep, dns_qpiter_t *nit, + dns_name_t *name, qpznode_t **nodep, dns_qpiter_t *nit, bool *firstp) { isc_result_t result; dns_qpread_t qpr; @@ -3039,7 +3039,7 @@ find_closest_nsec(qpdb_search_t *search, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, bool nsec3, bool secure DNS__DB_FLARG) { - qpdata_t *node = NULL, *prevnode = NULL; + qpznode_t *node = NULL, *prevnode = NULL; dns_slabheader_t *header = NULL, *header_next = NULL; dns_qpiter_t nseciter; bool empty_node; @@ -3205,7 +3205,7 @@ again: } static isc_result_t -check_zonecut(qpdata_t *node, void *arg DNS__DB_FLARG) { +check_zonecut(qpznode_t *node, void *arg DNS__DB_FLARG) { qpdb_search_t *search = arg; dns_slabheader_t *header = NULL, *header_next = NULL; dns_slabheader_t *dname_header = NULL, *sigdname_header = NULL; @@ -3339,7 +3339,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, dns_rdataset_t *sigrdataset DNS__DB_FLARG) { isc_result_t result; qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = NULL; + qpznode_t *node = NULL; qpdb_search_t search; bool cname_ok = true, close_version = false; bool maybe_zonecut = false, at_zonecut = false; @@ -3399,7 +3399,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, clen--; } for (unsigned int i = 0; i < clen && search.zonecut == NULL; i++) { - qpdata_t *n = NULL; + qpznode_t *n = NULL; isc_result_t tresult; dns_qpchain_node(&search.chain, i, NULL, (void **)&n, NULL); @@ -3850,7 +3850,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, unsigned int options, isc_stdtime_t now ISC_ATTR_UNUSED, dns_rdatasetiter_t **iteratorp DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)dbnode; + qpznode_t *node = (qpznode_t *)dbnode; qpdb_version_t *version = dbversion; qpdb_rdatasetiter_t *iterator = NULL; @@ -3883,7 +3883,7 @@ static void attachnode(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)source; + qpznode_t *node = (qpznode_t *)source; REQUIRE(VALID_QPZONE(qpdb)); REQUIRE(targetp != NULL && *targetp == NULL); @@ -3896,7 +3896,7 @@ attachnode(dns_db_t *db, dns_dbnode_t *source, static void detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = NULL; + qpznode_t *node = NULL; bool want_free = false; bool inactive = false; db_nodelock_t *nodelock = NULL; @@ -3905,7 +3905,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG) { REQUIRE(VALID_QPZONE(qpdb)); REQUIRE(targetp != NULL && *targetp != NULL); - node = (qpdata_t *)(*targetp); + node = (qpznode_t *)(*targetp); nodelock = &qpdb->node_locks[node->locknum]; NODE_RDLOCK(&nodelock->lock, &nlocktype); @@ -3989,13 +3989,13 @@ setloop(dns_db_t *db, isc_loop_t *loop) { static isc_result_t getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *onode = NULL; + qpznode_t *onode = NULL; REQUIRE(VALID_QPZONE(qpdb)); REQUIRE(nodep != NULL && *nodep == NULL); /* Note that the access to the origin node doesn't require a DB lock */ - onode = (qpdata_t *)qpdb->origin; + onode = (qpznode_t *)qpdb->origin; INSIST(onode != NULL); newref(qpdb, onode DNS__DB_FLARG_PASS); *nodep = onode; @@ -4006,7 +4006,7 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) { static void locknode(dns_db_t *db, dns_dbnode_t *dbnode, isc_rwlocktype_t type) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)dbnode; + qpznode_t *node = (qpznode_t *)dbnode; RWLOCK(&qpdb->node_locks[node->locknum].lock, type); } @@ -4014,7 +4014,7 @@ locknode(dns_db_t *db, dns_dbnode_t *dbnode, isc_rwlocktype_t type) { static void unlocknode(dns_db_t *db, dns_dbnode_t *dbnode, isc_rwlocktype_t type) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)dbnode; + qpznode_t *node = (qpznode_t *)dbnode; RWUNLOCK(&qpdb->node_locks[node->locknum].lock, type); } @@ -4062,7 +4062,7 @@ static isc_result_t rdatasetiter_first(dns_rdatasetiter_t *iterator DNS__DB_FLARG) { qpdb_rdatasetiter_t *qrditer = (qpdb_rdatasetiter_t *)iterator; qpzonedb_t *qpdb = (qpzonedb_t *)(qrditer->common.db); - qpdata_t *node = qrditer->common.node; + qpznode_t *node = qrditer->common.node; qpdb_version_t *version = qrditer->common.version; dns_slabheader_t *header = NULL, *top_next = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; @@ -4103,7 +4103,7 @@ static isc_result_t rdatasetiter_next(dns_rdatasetiter_t *iterator DNS__DB_FLARG) { qpdb_rdatasetiter_t *qrditer = (qpdb_rdatasetiter_t *)iterator; qpzonedb_t *qpdb = (qpzonedb_t *)(qrditer->common.db); - qpdata_t *node = qrditer->common.node; + qpznode_t *node = qrditer->common.node; qpdb_version_t *version = qrditer->common.version; dns_slabheader_t *header = NULL, *top_next = NULL; dns_typepair_t type, negtype; @@ -4175,7 +4175,7 @@ rdatasetiter_current(dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset DNS__DB_FLARG) { qpdb_rdatasetiter_t *qrditer = (qpdb_rdatasetiter_t *)iterator; qpzonedb_t *qpdb = (qpzonedb_t *)(qrditer->common.db); - qpdata_t *node = qrditer->common.node; + qpznode_t *node = qrditer->common.node; dns_slabheader_t *header = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; @@ -4196,7 +4196,7 @@ rdatasetiter_current(dns_rdatasetiter_t *iterator, static void reference_iter_node(qpdb_dbiterator_t *iter DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)iter->common.db; - qpdata_t *node = iter->node; + qpznode_t *node = iter->node; if (node == NULL) { return; @@ -4208,7 +4208,7 @@ reference_iter_node(qpdb_dbiterator_t *iter DNS__DB_FLARG) { static void dereference_iter_node(qpdb_dbiterator_t *iter DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)iter->common.db; - qpdata_t *node = iter->node; + qpznode_t *node = iter->node; isc_rwlock_t *lock = NULL; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; @@ -4418,7 +4418,7 @@ dbiterator_seek(dns_dbiterator_t *iterator, qpdbiter->current, NULL, (void **)&qpdbiter->node, NULL); if (result == DNS_R_PARTIALMATCH) { - dns_qpdata_t *node = NULL; + qpznode_t *node = NULL; tresult = dns_qp_lookup(qpdbiter->nsnap, name, NULL, &qpdbiter->nsec3iter, NULL, (void **)&node, NULL); @@ -4555,7 +4555,7 @@ dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep, dns_name_t *name DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)iterator->db; qpdb_dbiterator_t *qpdbiter = (qpdb_dbiterator_t *)iterator; - qpdata_t *node = qpdbiter->node; + qpznode_t *node = qpdbiter->node; REQUIRE(qpdbiter->result == ISC_R_SUCCESS); REQUIRE(qpdbiter->node != NULL); @@ -4633,7 +4633,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, unsigned int options, dns_rdataset_t *addedrdataset DNS__DB_FLARG) { isc_result_t result; qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)dbnode; + qpznode_t *node = (qpznode_t *)dbnode; qpdb_version_t *version = dbversion; isc_region_t region; dns_slabheader_t *newheader = NULL; @@ -4714,7 +4714,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, result = ISC_R_SUCCESS; if (nsec != NULL) { - qpdata_t *nsecnode = new_qpdata(qpdb, name); + qpznode_t *nsecnode = new_qpznode(qpdb, name); result = dns_qp_insert(nsec, nsecnode, 0); if (result == ISC_R_SUCCESS) { nsecnode->nsec = DNS_DB_NSEC_NSEC; @@ -4723,7 +4723,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, node->nsec = DNS_DB_NSEC_HAS_NSEC; result = ISC_R_SUCCESS; } - qpdata_detach(&nsecnode); + qpznode_detach(&nsecnode); } if (result == ISC_R_SUCCESS) { @@ -4755,7 +4755,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *newrdataset DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)dbnode; + qpznode_t *node = (qpznode_t *)dbnode; qpdb_version_t *version = dbversion; dns_fixedname_t fname; dns_name_t *nodename = dns_fixedname_initname(&fname); @@ -4943,7 +4943,7 @@ static isc_result_t deleterdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, dns_rdatatype_t type, dns_rdatatype_t covers DNS__DB_FLARG) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *node = (qpdata_t *)dbnode; + qpznode_t *node = (qpznode_t *)dbnode; qpdb_version_t *version = dbversion; dns_fixedname_t fname; dns_name_t *nodename = dns_fixedname_initname(&fname); @@ -4979,7 +4979,7 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion, static isc_result_t nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name) { qpzonedb_t *qpdb = (qpzonedb_t *)db; - qpdata_t *qpnode = (qpdata_t *)node; + qpznode_t *qpnode = (qpznode_t *)node; isc_rwlocktype_t nlocktype = isc_rwlocktype_none; REQUIRE(VALID_QPZONE(qpdb)); @@ -5012,11 +5012,11 @@ glue_nsdname_cb(void *arg, const dns_name_t *name, dns_rdatatype_t qtype, dns_fixedname_t fixedname_a; dns_name_t *name_a = NULL; dns_rdataset_t rdataset_a, sigrdataset_a; - qpdata_t *node_a = NULL; + qpznode_t *node_a = NULL; dns_fixedname_t fixedname_aaaa; dns_name_t *name_aaaa = NULL; dns_rdataset_t rdataset_aaaa, sigrdataset_aaaa; - qpdata_t *node_aaaa = NULL; + qpznode_t *node_aaaa = NULL; dns_glue_t *glue = NULL; UNUSED(unused); @@ -5211,7 +5211,7 @@ addglue_to_message(dns_glue_t *ge, dns_message_t *msg) { } static dns_glue_t * -newglue(qpzonedb_t *qpdb, qpdb_version_t *version, qpdata_t *node, +newglue(qpzonedb_t *qpdb, qpdb_version_t *version, qpznode_t *node, dns_rdataset_t *rdataset) { dns_fixedname_t nodename; dns_glue_additionaldata_ctx_t ctx = { @@ -5239,7 +5239,7 @@ addglue(dns_db_t *db, dns_dbversion_t *dbversion, dns_rdataset_t *rdataset, dns_message_t *msg) { qpzonedb_t *qpdb = (qpzonedb_t *)db; qpdb_version_t *version = dbversion; - qpdata_t *node = (qpdata_t *)rdataset->slab.node; + qpznode_t *node = (qpznode_t *)rdataset->slab.node; dns_slabheader_t *header = dns_slabheader_fromrdataset(rdataset); REQUIRE(rdataset->type == dns_rdatatype_ns); @@ -5325,7 +5325,7 @@ static dns_dbmethods_t qpdb_zonemethods = { }; static void -destroy_qpdata(qpdata_t *node) { +destroy_qpznode(qpznode_t *node) { dns_slabheader_t *current = NULL, *next = NULL; for (current = node->data; current != NULL; current = next) { @@ -5342,33 +5342,33 @@ destroy_qpdata(qpdata_t *node) { } dns_name_free(&node->name, node->mctx); - isc_mem_putanddetach(&node->mctx, node, sizeof(qpdata_t)); + isc_mem_putanddetach(&node->mctx, node, sizeof(qpznode_t)); } #if DNS_DB_NODETRACE -ISC_REFCOUNT_TRACE_IMPL(qpdata, destroy_qpdata); +ISC_REFCOUNT_TRACE_IMPL(qpznode, destroy_qpznode); #else -ISC_REFCOUNT_IMPL(qpdata, destroy_qpdata); +ISC_REFCOUNT_IMPL(qpznode, destroy_qpznode); #endif static void qp_attach(void *uctx ISC_ATTR_UNUSED, void *pval, uint32_t ival ISC_ATTR_UNUSED) { - qpdata_t *data = pval; - qpdata_ref(data); + qpznode_t *data = pval; + qpznode_ref(data); } static void qp_detach(void *uctx ISC_ATTR_UNUSED, void *pval, uint32_t ival ISC_ATTR_UNUSED) { - qpdata_t *data = pval; - qpdata_detach(&data); + qpznode_t *data = pval; + qpznode_detach(&data); } static size_t qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval, uint32_t ival ISC_ATTR_UNUSED) { - qpdata_t *data = pval; + qpznode_t *data = pval; return (dns_qpkey_fromname(key, &data->name)); } diff --git a/tests/dns/qpzone_test.c b/tests/dns/qpzone_test.c index afd4f4285a..c7df3b63da 100644 --- a/tests/dns/qpzone_test.c +++ b/tests/dns/qpzone_test.c @@ -107,7 +107,7 @@ ownercase_test_one(const char *str1, const char *str2) { .common.mctx = mctx, .node_locks = node_locks, }; - qpdata_t node = { .locknum = 0 }; + qpznode_t node = { .locknum = 0 }; dns_slabheader_t header = { .node = &node, .db = (dns_db_t *)&qpdb, @@ -172,7 +172,7 @@ ISC_RUN_TEST_IMPL(setownercase) { .common.mctx = mctx, .node_locks = node_locks, }; - qpdata_t node = { .locknum = 0 }; + qpznode_t node = { .locknum = 0 }; dns_slabheader_t header = { .node = &node, .db = (dns_db_t *)&qpdb,