mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 10:12:09 -04:00
Remove dns_dbtree_t and its usage
As we removed the ability to count nodes in the auxiliary trees (because there are no auxiliary trees), we can also cleanup the API and associated enum type (dns_dbtree_t).
This commit is contained in:
parent
a3e96f2d49
commit
9e2d5d94bd
10 changed files with 16 additions and 30 deletions
|
|
@ -3826,8 +3826,7 @@ main(int argc, char *argv[]) {
|
|||
bool answer;
|
||||
|
||||
hash_length = dns_nsec3_hashlength(dns_hash_sha1);
|
||||
hashlist_init(&hashlist,
|
||||
dns_db_nodecount(gdb, dns_dbtree_main) * 2,
|
||||
hashlist_init(&hashlist, dns_db_nodecount(gdb) * 2,
|
||||
hash_length);
|
||||
result = dns_nsec_nseconly(gdb, gversion, NULL, &answer);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
|
|
|
|||
|
|
@ -14824,7 +14824,7 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
|
|||
}
|
||||
|
||||
/* Database node count */
|
||||
nodes = dns_db_nodecount(hasraw ? rawdb : db, dns_dbtree_main);
|
||||
nodes = dns_db_nodecount(hasraw ? rawdb : db);
|
||||
snprintf(nodebuf, sizeof(nodebuf), "%u", nodes);
|
||||
|
||||
/* Security */
|
||||
|
|
|
|||
|
|
@ -249,12 +249,12 @@ issecure(dns_db_t *db) {
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
nodecount(dns_db_t *db, dns_dbtree_t tree) {
|
||||
nodecount(dns_db_t *db) {
|
||||
sampledb_t *sampledb = (sampledb_t *)db;
|
||||
|
||||
REQUIRE(VALID_SAMPLEDB(sampledb));
|
||||
|
||||
return dns_db_nodecount(sampledb->db, tree);
|
||||
return dns_db_nodecount(sampledb->db);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
|
|
|
|||
|
|
@ -618,10 +618,8 @@ dns_cache_dumpstats(dns_cache_t *cache, FILE *fp) {
|
|||
fprintf(fp, "%20" PRIu64 " %s\n",
|
||||
values[dns_cachestatscounter_coveringnsec],
|
||||
"covering nsec returned");
|
||||
fprintf(fp, "%20u %s\n", dns_db_nodecount(cache->db, dns_dbtree_main),
|
||||
fprintf(fp, "%20u %s\n", dns_db_nodecount(cache->db),
|
||||
"cache database nodes");
|
||||
fprintf(fp, "%20u %s\n", dns_db_nodecount(cache->db, dns_dbtree_nsec),
|
||||
"cache NSEC auxiliary database nodes");
|
||||
|
||||
fprintf(fp, "%20" PRIu64 " %s\n", (uint64_t)isc_mem_inuse(cache->tmctx),
|
||||
"cache tree memory in use");
|
||||
|
|
@ -677,8 +675,7 @@ dns_cache_renderxml(dns_cache_t *cache, void *writer0) {
|
|||
TRY0(renderstat("CoveringNSEC",
|
||||
values[dns_cachestatscounter_coveringnsec], writer));
|
||||
|
||||
TRY0(renderstat("CacheNodes",
|
||||
dns_db_nodecount(cache->db, dns_dbtree_main), writer));
|
||||
TRY0(renderstat("CacheNodes", dns_db_nodecount(cache->db), writer));
|
||||
|
||||
TRY0(renderstat("TreeMemInUse", isc_mem_inuse(cache->tmctx), writer));
|
||||
|
||||
|
|
@ -738,8 +735,7 @@ dns_cache_renderjson(dns_cache_t *cache, void *cstats0) {
|
|||
CHECKMEM(obj);
|
||||
json_object_object_add(cstats, "CoveringNSEC", obj);
|
||||
|
||||
obj = json_object_new_int64(
|
||||
dns_db_nodecount(cache->db, dns_dbtree_main));
|
||||
obj = json_object_new_int64(dns_db_nodecount(cache->db));
|
||||
CHECKMEM(obj);
|
||||
json_object_object_add(cstats, "CacheNodes", obj);
|
||||
|
||||
|
|
|
|||
|
|
@ -734,11 +734,11 @@ freenode:
|
|||
}
|
||||
|
||||
unsigned int
|
||||
dns_db_nodecount(dns_db_t *db, dns_dbtree_t tree) {
|
||||
dns_db_nodecount(dns_db_t *db) {
|
||||
REQUIRE(DNS_DB_VALID(db));
|
||||
|
||||
if (db->methods->nodecount != NULL) {
|
||||
return (db->methods->nodecount)(db, tree);
|
||||
return (db->methods->nodecount)(db);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ typedef struct dns_db_methods {
|
|||
dns_rdatatype_t type,
|
||||
dns_rdatatype_t covers DNS__DB_FLARG);
|
||||
bool (*issecure)(dns_db_t *db);
|
||||
unsigned int (*nodecount)(dns_db_t *db, dns_dbtree_t);
|
||||
unsigned int (*nodecount)(dns_db_t *db);
|
||||
isc_result_t (*getoriginnode)(dns_db_t *db,
|
||||
dns_dbnode_t **nodep DNS__DB_FLARG);
|
||||
isc_result_t (*getnsec3parameters)(dns_db_t *db,
|
||||
|
|
@ -1366,9 +1366,9 @@ dns_db_getsoaserial(dns_db_t *db, dns_dbversion_t *ver, uint32_t *serialp);
|
|||
*/
|
||||
|
||||
unsigned int
|
||||
dns_db_nodecount(dns_db_t *db, dns_dbtree_t tree);
|
||||
dns_db_nodecount(dns_db_t *db);
|
||||
/*%<
|
||||
* Count the number of nodes in 'db' or its auxiliary trees.
|
||||
* Count the number of nodes in 'db'.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -202,12 +202,6 @@ typedef enum {
|
|||
dns_dbtype_stub = 3
|
||||
} dns_dbtype_t;
|
||||
|
||||
typedef enum {
|
||||
dns_dbtree_main = 0,
|
||||
dns_dbtree_nsec = 1,
|
||||
dns_dbtree_nsec3 = 2
|
||||
} dns_dbtree_t;
|
||||
|
||||
typedef enum {
|
||||
dns_checkdstype_no = 0,
|
||||
dns_checkdstype_yes = 1,
|
||||
|
|
|
|||
|
|
@ -3218,7 +3218,7 @@ qpcache_deleterdataset(dns_db_t *db, dns_dbnode_t *node,
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
nodecount(dns_db_t *db, dns_dbtree_t tree ISC_ATTR_UNUSED) {
|
||||
nodecount(dns_db_t *db) {
|
||||
qpcache_t *qpdb = (qpcache_t *)db;
|
||||
dns_qp_memusage_t mu;
|
||||
isc_rwlocktype_t tlocktype = isc_rwlocktype_none;
|
||||
|
|
|
|||
|
|
@ -3867,12 +3867,10 @@ qpzone_detachnode(dns_dbnode_t **nodep DNS__DB_FLARG) {
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
nodecount(dns_db_t *db, dns_dbtree_t tree ISC_ATTR_UNUSED) {
|
||||
qpzonedb_t *qpdb = NULL;
|
||||
nodecount(dns_db_t *db) {
|
||||
qpzonedb_t *qpdb = qpdb = (qpzonedb_t *)db;
|
||||
dns_qp_memusage_t mu;
|
||||
|
||||
qpdb = (qpzonedb_t *)db;
|
||||
|
||||
REQUIRE(VALID_QPZONE(qpdb));
|
||||
|
||||
mu = dns_qpmulti_memusage(qpdb->tree);
|
||||
|
|
|
|||
|
|
@ -5413,8 +5413,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
|
|||
}
|
||||
|
||||
dns_zone_logc(zone, DNS_LOGCATEGORY_ZONELOAD, ISC_LOG_DEBUG(2),
|
||||
"number of nodes in database: %u",
|
||||
dns_db_nodecount(db, dns_dbtree_main));
|
||||
"number of nodes in database: %u", dns_db_nodecount(db));
|
||||
|
||||
if (result == DNS_R_SEENINCLUDE) {
|
||||
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HASINCLUDE);
|
||||
|
|
|
|||
Loading…
Reference in a new issue