mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
chg: dev: Refactor decref() in both QPDB
Clean up the pattern in the newref() and decref() functions in QP databases. Replace the `db_nodelock_t` structure with plain reference counting for every active database node in QPDB. Related to #5134 Merge branch '5134-refactor-decref-functions-in-qpdb' into 'main' See merge request isc-projects/bind9!10006
This commit is contained in:
@@ -143,14 +143,6 @@ typedef struct dns_glue_additionaldata_ctx {
|
||||
dns_glue_t *glue;
|
||||
} dns_glue_additionaldata_ctx_t;
|
||||
|
||||
typedef struct {
|
||||
isc_rwlock_t lock;
|
||||
/* Protected in the refcount routines. */
|
||||
isc_refcount_t references;
|
||||
/* Locked by lock. */
|
||||
bool exiting;
|
||||
} db_nodelock_t;
|
||||
|
||||
static inline bool
|
||||
prio_type(dns_typepair_t type) {
|
||||
switch (type) {
|
||||
|
File diff suppressed because it is too large
Load Diff
551
lib/dns/qpzone.c
551
lib/dns/qpzone.c
File diff suppressed because it is too large
Load Diff
@@ -101,7 +101,7 @@ const char *ownercase_vectors[12][2] = {
|
||||
static bool
|
||||
ownercase_test_one(const char *str1, const char *str2) {
|
||||
isc_result_t result;
|
||||
db_nodelock_t node_locks[1];
|
||||
isc_rwlock_t node_locks[1];
|
||||
qpzonedb_t qpdb = {
|
||||
.common.methods = &qpdb_zonemethods,
|
||||
.common.mctx = mctx,
|
||||
@@ -128,7 +128,7 @@ ownercase_test_one(const char *str1, const char *str2) {
|
||||
|
||||
memset(node_locks, 0, sizeof(node_locks));
|
||||
/* Minimal initialization of the mock objects */
|
||||
NODE_INITLOCK(&qpdb.node_locks[0].lock);
|
||||
NODE_INITLOCK(&qpdb.node_locks[0]);
|
||||
|
||||
isc_buffer_constinit(&b, str1, strlen(str1));
|
||||
isc_buffer_add(&b, strlen(str1));
|
||||
@@ -148,7 +148,7 @@ ownercase_test_one(const char *str1, const char *str2) {
|
||||
/* Retrieve the case to name2 */
|
||||
dns_rdataset_getownercase(&rdataset, name2);
|
||||
|
||||
NODE_DESTROYLOCK(&qpdb.node_locks[0].lock);
|
||||
NODE_DESTROYLOCK(&qpdb.node_locks[0]);
|
||||
|
||||
return dns_name_caseequal(name1, name2);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ ISC_RUN_TEST_IMPL(ownercase) {
|
||||
|
||||
ISC_RUN_TEST_IMPL(setownercase) {
|
||||
isc_result_t result;
|
||||
db_nodelock_t node_locks[1];
|
||||
isc_rwlock_t node_locks[1];
|
||||
qpzonedb_t qpdb = {
|
||||
.common.methods = &qpdb_zonemethods,
|
||||
.common.mctx = mctx,
|
||||
@@ -200,7 +200,7 @@ ISC_RUN_TEST_IMPL(setownercase) {
|
||||
|
||||
/* Minimal initialization of the mock objects */
|
||||
memset(node_locks, 0, sizeof(node_locks));
|
||||
NODE_INITLOCK(&qpdb.node_locks[0].lock);
|
||||
NODE_INITLOCK(&qpdb.node_locks[0]);
|
||||
|
||||
isc_buffer_constinit(&b, str1, strlen(str1));
|
||||
isc_buffer_add(&b, strlen(str1));
|
||||
@@ -217,7 +217,7 @@ ISC_RUN_TEST_IMPL(setownercase) {
|
||||
/* Retrieve the case to name2 */
|
||||
dns_rdataset_getownercase(&rdataset, name2);
|
||||
|
||||
NODE_DESTROYLOCK(&qpdb.node_locks[0].lock);
|
||||
NODE_DESTROYLOCK(&qpdb.node_locks[0]);
|
||||
|
||||
assert_true(dns_name_caseequal(name1, name2));
|
||||
}
|
||||
|
Reference in New Issue
Block a user