From: Evan Hunt Date: Thu, 14 Aug 2025 23:28:11 +0000 (-0700) Subject: remove dns_db_{un,}locknode X-Git-Tag: v9.21.14~44^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4122143c4d1ba5d242603daea619a2fcccc57a8f;p=thirdparty%2Fbind9.git remove dns_db_{un,}locknode remove the dns_db_locknode() and _unlocknode() calls, so that callers no longer have the ability to directly manipulate the internal locking of cache and zone databases. --- diff --git a/lib/dns/db.c b/lib/dns/db.c index 08805b05359..92003520240 100644 --- a/lib/dns/db.c +++ b/lib/dns/db.c @@ -1043,22 +1043,6 @@ dns_db_addglue(dns_db_t *db, dns_dbversion_t *version, dns_rdataset_t *rdataset, return ISC_R_NOTIMPLEMENTED; } -void -dns_db_locknode(dns_dbnode_t *node, isc_rwlocktype_t type) { - REQUIRE(node != NULL && node->methods != NULL); - if (node->methods->locknode != NULL) { - (node->methods->locknode)(node, type); - } -} - -void -dns_db_unlocknode(dns_dbnode_t *node, isc_rwlocktype_t type) { - REQUIRE(node != NULL && node->methods != NULL); - if (node->methods->unlocknode != NULL) { - (node->methods->unlocknode)(node, type); - } -} - void dns_db_expiredata(dns_dbnode_t *node, void *data) { REQUIRE(node != NULL && node->methods != NULL); diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h index 23f14030a7e..7ebeeb2253d 100644 --- a/lib/dns/include/dns/db.h +++ b/lib/dns/include/dns/db.h @@ -80,9 +80,6 @@ typedef struct dns_dbnode_methods { dns_dbnode_t **targetp DNS__DB_FLARG); void (*detachnode)(dns_dbnode_t **targetp DNS__DB_FLARG); - void (*locknode)(dns_dbnode_t *node, isc_rwlocktype_t t); - void (*unlocknode)(dns_dbnode_t *node, isc_rwlocktype_t t); - void (*deletedata)(dns_dbnode_t *node, void *data); void (*expiredata)(dns_dbnode_t *node, void *data); } dns_dbnode_methods_t; @@ -1718,15 +1715,6 @@ dns_db_setgluecachestats(dns_db_t *db, isc_stats_t *stats); * dns_rdatasetstats_create(); otherwise NULL. */ -void -dns_db_locknode(dns_dbnode_t *node, isc_rwlocktype_t type); -void -dns_db_unlocknode(dns_dbnode_t *node, isc_rwlocktype_t type); -/*%< - * Lock/unlock a single node within a database so that data stored - * there can be manipulated directly. - */ - isc_result_t dns_db_addglue(dns_db_t *db, dns_dbversion_t *version, dns_rdataset_t *rdataset, dns_message_t *msg); diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c index b6224c77ac3..0d0e9b1bd2b 100644 --- a/lib/dns/qpcache.c +++ b/lib/dns/qpcache.c @@ -305,10 +305,6 @@ qpcnode_attachnode(dns_dbnode_t *source, dns_dbnode_t **targetp DNS__DB_FLARG); static void qpcnode_detachnode(dns_dbnode_t **nodep DNS__DB_FLARG); static void -qpcnode_locknode(dns_dbnode_t *node, isc_rwlocktype_t type); -static void -qpcnode_unlocknode(dns_dbnode_t *node, isc_rwlocktype_t type); -static void qpcnode_deletedata(dns_dbnode_t *node, void *data); static void qpcnode_expiredata(dns_dbnode_t *node, void *data); @@ -316,8 +312,6 @@ qpcnode_expiredata(dns_dbnode_t *node, void *data); static dns_dbnode_methods_t qpcnode_methods = (dns_dbnode_methods_t){ .attachnode = qpcnode_attachnode, .detachnode = qpcnode_detachnode, - .locknode = qpcnode_locknode, - .unlocknode = qpcnode_unlocknode, .deletedata = qpcnode_deletedata, .expiredata = qpcnode_expiredata, }; @@ -3264,22 +3258,6 @@ nodecount(dns_db_t *db, dns_dbtree_t tree) { return mu.leaves; } -static void -qpcnode_locknode(dns_dbnode_t *node, isc_rwlocktype_t type) { - qpcnode_t *qpnode = (qpcnode_t *)node; - qpcache_t *qpdb = qpnode->qpdb; - - RWLOCK(&qpdb->buckets[qpnode->locknum].lock, type); -} - -static void -qpcnode_unlocknode(dns_dbnode_t *node, isc_rwlocktype_t type) { - qpcnode_t *qpnode = (qpcnode_t *)node; - qpcache_t *qpdb = qpnode->qpdb; - - RWUNLOCK(&qpdb->buckets[qpnode->locknum].lock, type); -} - isc_result_t dns__qpcache_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, dns_rdataclass_t rdclass, diff --git a/lib/dns/qpzone.c b/lib/dns/qpzone.c index 460f8308515..e081f15c261 100644 --- a/lib/dns/qpzone.c +++ b/lib/dns/qpzone.c @@ -3886,20 +3886,6 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) { return ISC_R_SUCCESS; } -static void -locknode(dns_dbnode_t *dbnode, isc_rwlocktype_t type) { - qpznode_t *node = (qpznode_t *)dbnode; - - RWLOCK(qpzone_get_lock(node), type); -} - -static void -unlocknode(dns_dbnode_t *dbnode, isc_rwlocktype_t type) { - qpznode_t *node = (qpznode_t *)dbnode; - - RWUNLOCK(qpzone_get_lock(node), type); -} - static void deletedata(dns_dbnode_t *node ISC_ATTR_UNUSED, void *data) { dns_slabheader_t *header = data; @@ -5292,8 +5278,6 @@ static dns_dbmethods_t qpdb_zonemethods = { static dns_dbnode_methods_t qpznode_methods = (dns_dbnode_methods_t){ .attachnode = qpzone_attachnode, .detachnode = qpzone_detachnode, - .locknode = locknode, - .unlocknode = unlocknode, .deletedata = deletedata, };