mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-06 01:25:44 +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_t *glue;
|
||||||
} dns_glue_additionaldata_ctx_t;
|
} 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
|
static inline bool
|
||||||
prio_type(dns_typepair_t type) {
|
prio_type(dns_typepair_t type) {
|
||||||
switch (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
|
static bool
|
||||||
ownercase_test_one(const char *str1, const char *str2) {
|
ownercase_test_one(const char *str1, const char *str2) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
db_nodelock_t node_locks[1];
|
isc_rwlock_t node_locks[1];
|
||||||
qpzonedb_t qpdb = {
|
qpzonedb_t qpdb = {
|
||||||
.common.methods = &qpdb_zonemethods,
|
.common.methods = &qpdb_zonemethods,
|
||||||
.common.mctx = mctx,
|
.common.mctx = mctx,
|
||||||
@@ -128,7 +128,7 @@ ownercase_test_one(const char *str1, const char *str2) {
|
|||||||
|
|
||||||
memset(node_locks, 0, sizeof(node_locks));
|
memset(node_locks, 0, sizeof(node_locks));
|
||||||
/* Minimal initialization of the mock objects */
|
/* 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_constinit(&b, str1, strlen(str1));
|
||||||
isc_buffer_add(&b, 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 */
|
/* Retrieve the case to name2 */
|
||||||
dns_rdataset_getownercase(&rdataset, 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);
|
return dns_name_caseequal(name1, name2);
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ ISC_RUN_TEST_IMPL(ownercase) {
|
|||||||
|
|
||||||
ISC_RUN_TEST_IMPL(setownercase) {
|
ISC_RUN_TEST_IMPL(setownercase) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
db_nodelock_t node_locks[1];
|
isc_rwlock_t node_locks[1];
|
||||||
qpzonedb_t qpdb = {
|
qpzonedb_t qpdb = {
|
||||||
.common.methods = &qpdb_zonemethods,
|
.common.methods = &qpdb_zonemethods,
|
||||||
.common.mctx = mctx,
|
.common.mctx = mctx,
|
||||||
@@ -200,7 +200,7 @@ ISC_RUN_TEST_IMPL(setownercase) {
|
|||||||
|
|
||||||
/* Minimal initialization of the mock objects */
|
/* Minimal initialization of the mock objects */
|
||||||
memset(node_locks, 0, sizeof(node_locks));
|
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_constinit(&b, str1, strlen(str1));
|
||||||
isc_buffer_add(&b, strlen(str1));
|
isc_buffer_add(&b, strlen(str1));
|
||||||
@@ -217,7 +217,7 @@ ISC_RUN_TEST_IMPL(setownercase) {
|
|||||||
/* Retrieve the case to name2 */
|
/* Retrieve the case to name2 */
|
||||||
dns_rdataset_getownercase(&rdataset, 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));
|
assert_true(dns_name_caseequal(name1, name2));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user