Remove db_nodelock_t in favor of reference counted qpdb

This removes the db_nodelock_t structure and changes the node_locks
array to be composed only of isc_rwlock_t pointers.  The .reference
member has been moved to qpdb->references in addition to
common.references that's external to dns_db API users.  The .exiting
members has been completely removed as it has no use when the reference
counting is used correctly.
This commit is contained in:
Ondřej Surý
2025-01-27 21:07:11 +01:00
parent 36a26bfa1a
commit 431513d8b3
4 changed files with 296 additions and 413 deletions

View File

@@ -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));
}