2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Rename the qpzone and qpcache methods that implement DB api

All the database implementations share the same names for the methods
implementing the database.  That has some advantages like knowing what
to expect, but it turns out that any time such method shows up in any
kind of tracing - be it perf record, backtrace or anything else that
uses symbol names, it is very hard to distinguish whether the find()
belongs to qpcache, qpzone, builtin or sdlz implementation.

Make at least the names for qpzone and qpcache unique.
This commit is contained in:
Ondřej Surý 2024-11-14 11:18:00 +01:00 committed by Andoni Duarte
parent 3a94afa03a
commit 8356179953
2 changed files with 99 additions and 88 deletions

View File

@ -1530,9 +1530,10 @@ find_coveringnsec(qpc_search_t *search, const dns_name_t *name,
}
static isc_result_t
find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
qpcache_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_dbnode_t **nodep, dns_name_t *foundname,
dns_rdataset_t *rdataset,
dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
qpcnode_t *node = NULL;
isc_result_t result;
@ -1975,9 +1976,10 @@ tree_exit:
}
static isc_result_t
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,
qpcache_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) {
qpcnode_t *node = NULL;
isc_rwlock_t *lock = NULL;
@ -2150,9 +2152,9 @@ tree_exit:
}
static isc_result_t
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,
qpcache_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) {
qpcache_t *qpdb = (qpcache_t *)db;
qpcnode_t *qpnode = (qpcnode_t *)node;
@ -2552,7 +2554,7 @@ free_qpdb(qpcache_t *qpdb, bool log) {
}
static void
qpdb_destroy(dns_db_t *arg) {
qpcache_destroy(dns_db_t *arg) {
qpcache_t *qpdb = (qpcache_t *)arg;
bool want_free = false;
unsigned int i;
@ -2680,7 +2682,7 @@ new_qpcnode(qpcache_t *qpdb, const dns_name_t *name) {
}
static isc_result_t
findnode(dns_db_t *db, const dns_name_t *name, bool create,
qpcache_findnode(dns_db_t *db, const dns_name_t *name, bool create,
dns_dbnode_t **nodep DNS__DB_FLARG) {
qpcache_t *qpdb = (qpcache_t *)db;
qpcnode_t *node = NULL;
@ -2716,7 +2718,7 @@ unlock:
}
static void
attachnode(dns_db_t *db, dns_dbnode_t *source,
qpcache_attachnode(dns_db_t *db, dns_dbnode_t *source,
dns_dbnode_t **targetp DNS__DB_FLARG) {
REQUIRE(VALID_QPDB((qpcache_t *)db));
REQUIRE(targetp != NULL && *targetp == NULL);
@ -2731,7 +2733,7 @@ attachnode(dns_db_t *db, dns_dbnode_t *source,
}
static void
detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG) {
qpcache_detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG) {
qpcache_t *qpdb = (qpcache_t *)db;
qpcnode_t *node = NULL;
bool want_free = false;
@ -2786,7 +2788,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 ISC_ATTR_UNUSED,
qpcache_createiterator(dns_db_t *db, unsigned int options ISC_ATTR_UNUSED,
dns_dbiterator_t **iteratorp) {
qpcache_t *qpdb = (qpcache_t *)db;
qpc_dbit_t *qpdbiter = NULL;
@ -2809,7 +2811,7 @@ createiterator(dns_db_t *db, unsigned int options ISC_ATTR_UNUSED,
}
static isc_result_t
allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
qpcache_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) {
qpcache_t *qpdb = (qpcache_t *)db;
@ -3386,8 +3388,9 @@ expire_ttl_headers(qpcache_t *qpdb, unsigned int locknum,
isc_stdtime_t now, bool cache_is_overmem DNS__DB_FLARG);
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,
qpcache_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) {
qpcache_t *qpdb = (qpcache_t *)db;
qpcnode_t *qpnode = (qpcnode_t *)node;
@ -3569,8 +3572,9 @@ 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) {
qpcache_deleterdataset(dns_db_t *db, dns_dbnode_t *node,
dns_dbversion_t *version, dns_rdatatype_t type,
dns_rdatatype_t covers DNS__DB_FLARG) {
qpcache_t *qpdb = (qpcache_t *)db;
qpcnode_t *qpnode = (qpcnode_t *)node;
isc_result_t result;
@ -4378,17 +4382,17 @@ setmaxtypepername(dns_db_t *db, uint32_t value) {
}
static dns_dbmethods_t qpdb_cachemethods = {
.destroy = qpdb_destroy,
.findnode = findnode,
.find = find,
.findzonecut = findzonecut,
.attachnode = attachnode,
.detachnode = detachnode,
.createiterator = createiterator,
.findrdataset = findrdataset,
.allrdatasets = allrdatasets,
.addrdataset = addrdataset,
.deleterdataset = deleterdataset,
.destroy = qpcache_destroy,
.findnode = qpcache_findnode,
.find = qpcache_find,
.findzonecut = qpcache_findzonecut,
.attachnode = qpcache_attachnode,
.detachnode = qpcache_detachnode,
.createiterator = qpcache_createiterator,
.findrdataset = qpcache_findrdataset,
.allrdatasets = qpcache_allrdatasets,
.addrdataset = qpcache_addrdataset,
.deleterdataset = qpcache_deleterdataset,
.nodecount = nodecount,
.getoriginnode = getoriginnode,
.getrrsetstats = getrrsetstats,

View File

@ -1545,9 +1545,10 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
}
static isc_result_t
findrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion,
dns_rdatatype_t type, dns_rdatatype_t covers,
isc_stdtime_t now ISC_ATTR_UNUSED, dns_rdataset_t *rdataset,
qpzone_findrdataset(dns_db_t *db, dns_dbnode_t *dbnode,
dns_dbversion_t *dbversion, dns_rdatatype_t type,
dns_rdatatype_t covers, isc_stdtime_t now ISC_ATTR_UNUSED,
dns_rdataset_t *rdataset,
dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
qpzonedb_t *qpdb = (qpzonedb_t *)db;
qpznode_t *node = (qpznode_t *)dbnode;
@ -2546,7 +2547,7 @@ findnodeintree(qpzonedb_t *qpdb, const dns_name_t *name, bool create,
}
static isc_result_t
findnode(dns_db_t *db, const dns_name_t *name, bool create,
qpzone_findnode(dns_db_t *db, const dns_name_t *name, bool create,
dns_dbnode_t **nodep DNS__DB_FLARG) {
qpzonedb_t *qpdb = (qpzonedb_t *)db;
@ -2557,7 +2558,7 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
}
static isc_result_t
findnsec3node(dns_db_t *db, const dns_name_t *name, bool create,
qpzone_findnsec3node(dns_db_t *db, const dns_name_t *name, bool create,
dns_dbnode_t **nodep DNS__DB_FLARG) {
qpzonedb_t *qpdb = (qpzonedb_t *)db;
@ -2606,7 +2607,7 @@ matchparams(dns_slabheader_t *header, qpz_search_t *search) {
}
static isc_result_t
setup_delegation(qpz_search_t *search, dns_dbnode_t **nodep,
qpzone_setup_delegation(qpz_search_t *search, dns_dbnode_t **nodep,
dns_name_t *foundname, dns_rdataset_t *rdataset,
dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
dns_name_t *zcname = NULL;
@ -3202,7 +3203,7 @@ again:
}
static isc_result_t
check_zonecut(qpznode_t *node, void *arg DNS__DB_FLARG) {
qpzone_check_zonecut(qpznode_t *node, void *arg DNS__DB_FLARG) {
qpz_search_t *search = arg;
dns_slabheader_t *header = NULL, *header_next = NULL;
dns_slabheader_t *dname_header = NULL, *sigdname_header = NULL;
@ -3329,7 +3330,7 @@ check_zonecut(qpznode_t *node, void *arg DNS__DB_FLARG) {
}
static isc_result_t
find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
qpzone_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 ISC_ATTR_UNUSED, dns_dbnode_t **nodep,
dns_name_t *foundname, dns_rdataset_t *rdataset,
@ -3403,7 +3404,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
isc_result_t tresult;
dns_qpchain_node(&search.chain, i, NULL, (void **)&n, NULL);
tresult = check_zonecut(n, &search DNS__DB_FLARG_PASS);
tresult = qpzone_check_zonecut(n, &search DNS__DB_FLARG_PASS);
if (tresult != DNS_R_CONTINUE) {
result = tresult;
search.chain.len = i - 1;
@ -3415,7 +3416,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
if (result == DNS_R_PARTIALMATCH) {
partial_match:
if (search.zonecut != NULL) {
result = setup_delegation(
result = qpzone_setup_delegation(
&search, nodep, foundname, rdataset,
sigrdataset DNS__DB_FLARG_PASS);
goto tree_exit;
@ -3705,7 +3706,7 @@ found:
* Return the delegation.
*/
NODE_UNLOCK(lock, &nlocktype);
result = setup_delegation(
result = qpzone_setup_delegation(
&search, nodep, foundname, rdataset,
sigrdataset DNS__DB_FLARG_PASS);
goto tree_exit;
@ -3853,8 +3854,9 @@ tree_exit:
}
static isc_result_t
allrdatasets(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion,
unsigned int options, isc_stdtime_t now ISC_ATTR_UNUSED,
qpzone_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;
qpznode_t *node = (qpznode_t *)dbnode;
@ -4589,7 +4591,7 @@ dbiterator_origin(dns_dbiterator_t *iterator, dns_name_t *name) {
}
static isc_result_t
createiterator(dns_db_t *db, unsigned int options,
qpzone_createiterator(dns_db_t *db, unsigned int options,
dns_dbiterator_t **iteratorp) {
qpzonedb_t *qpdb = (qpzonedb_t *)db;
qpdb_dbiterator_t *iter = NULL;
@ -4628,9 +4630,11 @@ createiterator(dns_db_t *db, unsigned int options,
}
static isc_result_t
addrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion,
qpzone_addrdataset(dns_db_t *db, dns_dbnode_t *dbnode,
dns_dbversion_t *dbversion,
isc_stdtime_t now ISC_ATTR_UNUSED, dns_rdataset_t *rdataset,
unsigned int options, dns_rdataset_t *addedrdataset DNS__DB_FLARG) {
unsigned int options,
dns_rdataset_t *addedrdataset DNS__DB_FLARG) {
isc_result_t result;
qpzonedb_t *qpdb = (qpzonedb_t *)db;
qpznode_t *node = (qpznode_t *)dbnode;
@ -4757,8 +4761,9 @@ addrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion,
}
static isc_result_t
subtractrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion,
dns_rdataset_t *rdataset, unsigned int options,
qpzone_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;
qpznode_t *node = (qpznode_t *)dbnode;
@ -4948,8 +4953,9 @@ unlock:
}
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) {
qpzone_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;
qpznode_t *node = (qpznode_t *)dbnode;
qpz_version_t *version = (qpz_version_t *)dbversion;
@ -5061,9 +5067,10 @@ glue_nsdname_cb(void *arg, const dns_name_t *name, dns_rdatatype_t qtype,
dns_rdataset_init(&rdataset_aaaa);
dns_rdataset_init(&sigrdataset_aaaa);
result = find(ctx->db, name, ctx->version, dns_rdatatype_a,
DNS_DBFIND_GLUEOK, 0, (dns_dbnode_t **)&node_a, name_a,
&rdataset_a, &sigrdataset_a DNS__DB_FLARG_PASS);
result = qpzone_find(ctx->db, name, ctx->version, dns_rdatatype_a,
DNS_DBFIND_GLUEOK, 0, (dns_dbnode_t **)&node_a,
name_a, &rdataset_a,
&sigrdataset_a DNS__DB_FLARG_PASS);
if (result == DNS_R_GLUE) {
glue = new_glue(ctx->db->mctx, name_a);
@ -5079,7 +5086,7 @@ glue_nsdname_cb(void *arg, const dns_name_t *name, dns_rdatatype_t qtype,
}
}
result = find(ctx->db, name, ctx->version, dns_rdatatype_aaaa,
result = qpzone_find(ctx->db, name, ctx->version, dns_rdatatype_aaaa,
DNS_DBFIND_GLUEOK, 0, (dns_dbnode_t **)&node_aaaa,
name_aaaa, &rdataset_aaaa,
&sigrdataset_aaaa DNS__DB_FLARG_PASS);
@ -5348,22 +5355,22 @@ static dns_dbmethods_t qpdb_zonemethods = {
.newversion = newversion,
.attachversion = attachversion,
.closeversion = closeversion,
.findnode = findnode,
.find = find,
.findnode = qpzone_findnode,
.find = qpzone_find,
.attachnode = attachnode,
.detachnode = detachnode,
.createiterator = createiterator,
.findrdataset = findrdataset,
.allrdatasets = allrdatasets,
.addrdataset = addrdataset,
.subtractrdataset = subtractrdataset,
.deleterdataset = deleterdataset,
.createiterator = qpzone_createiterator,
.findrdataset = qpzone_findrdataset,
.allrdatasets = qpzone_allrdatasets,
.addrdataset = qpzone_addrdataset,
.subtractrdataset = qpzone_subtractrdataset,
.deleterdataset = qpzone_deleterdataset,
.issecure = issecure,
.nodecount = nodecount,
.setloop = setloop,
.getoriginnode = getoriginnode,
.getnsec3parameters = getnsec3parameters,
.findnsec3node = findnsec3node,
.findnsec3node = qpzone_findnsec3node,
.setsigningtime = setsigningtime,
.getsigningtime = getsigningtime,
.getsize = getsize,