From: Matthijs Mekking Date: Tue, 7 Apr 2026 09:22:56 +0000 (+0200) Subject: Move dns_zone_next/dns_zone_first to zonemgr X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c420582be08a188ea0912379fa0e26b82182f8a;p=thirdparty%2Fbind9.git Move dns_zone_next/dns_zone_first to zonemgr Walking the list of managed zones is a function that operates on the zone manager object. --- diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 14cde7fe47f..7b84a03812c 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -4295,9 +4295,9 @@ named_stats_dump(named_server_t *server, FILE *fp) { fprintf(fp, "++ Per Zone Query Statistics ++\n"); zone = NULL; - for (result = dns_zone_first(server->zonemgr, &zone); - result == ISC_R_SUCCESS; - next = NULL, result = dns_zone_next(zone, &next), zone = next) + for (result = dns_zonemgr_first_zone(server->zonemgr, &zone); + result == ISC_R_SUCCESS; next = NULL, + result = dns_zonemgr_next_zone(zone, &next), zone = next) { isc_stats_t *zonestats = dns_zone_getrequeststats(zone); if (zonestats != NULL) { @@ -4324,9 +4324,9 @@ named_stats_dump(named_server_t *server, FILE *fp) { fprintf(fp, "++ Per Zone Glue Cache Statistics ++\n"); zone = NULL; - for (result = dns_zone_first(server->zonemgr, &zone); - result == ISC_R_SUCCESS; - next = NULL, result = dns_zone_next(zone, &next), zone = next) + for (result = dns_zonemgr_first_zone(server->zonemgr, &zone); + result == ISC_R_SUCCESS; next = NULL, + result = dns_zonemgr_next_zone(zone, &next), zone = next) { isc_stats_t *gluecachestats = dns_zone_getgluecachestats(zone); if (gluecachestats != NULL) { diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index ecb1bee6682..36a837b16b2 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -523,38 +523,6 @@ dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg, *\li Others */ -isc_result_t -dns_zone_next(dns_zone_t *zone, dns_zone_t **next); -/*%< - * Find the next zone in the list of managed zones. - * - * Requires: - *\li 'zone' to be valid - *\li The zone manager for the indicated zone MUST be locked - * by the caller. This is not checked. - *\li 'next' be non-NULL, and '*next' be NULL. - * - * Ensures: - *\li 'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL - * (result ISC_R_NOMORE). - */ - -isc_result_t -dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first); -/*%< - * Find the first zone in the list of managed zones. - * - * Requires: - *\li 'zonemgr' to be valid - *\li The zone manager for the indicated zone MUST be locked - * by the caller. This is not checked. - *\li 'first' be non-NULL, and '*first' be NULL - * - * Ensures: - *\li 'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL - * (result ISC_R_NOMORE). - */ - isc_result_t dns_zone_getdnsseckeys(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, isc_stdtime_t now, dns_dnsseckeylist_t *keys); diff --git a/lib/dns/include/dns/zonemgr.h b/lib/dns/include/dns/zonemgr.h index 0e60410ce0c..e1478826aab 100644 --- a/lib/dns/include/dns/zonemgr.h +++ b/lib/dns/include/dns/zonemgr.h @@ -223,3 +223,35 @@ dns_zonemgr_set_tlsctx_cache(dns_zonemgr_t *zmgr, *\li 'zmgr' is a valid zone manager. *\li 'tlsctx_cache' is a valid TLS context cache. */ + +isc_result_t +dns_zonemgr_next_zone(dns_zone_t *zone, dns_zone_t **next); +/*%< + * Find the next zone in the list of managed zones. + * + * Requires: + *\li 'zone' to be valid + *\li The zone manager for the indicated zone MUST be locked + * by the caller. This is not checked. + *\li 'next' be non-NULL, and '*next' be NULL. + * + * Ensures: + *\li 'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL + * (result ISC_R_NOMORE). + */ + +isc_result_t +dns_zonemgr_first_zone(dns_zonemgr_t *zmgr, dns_zone_t **first); +/*%< + * Find the first zone in the list of managed zones. + * + * Requires: + *\li 'zonemgr' to be valid + *\li The zone manager for the indicated zone MUST be locked + * by the caller. This is not checked. + *\li 'first' be non-NULL, and '*first' be NULL + * + * Ensures: + *\li 'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL + * (result ISC_R_NOMORE). + */ diff --git a/lib/dns/zone.c b/lib/dns/zone.c index ce04932ebc3..8fecf876516 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15972,32 +15972,6 @@ cleanup: return result; } -isc_result_t -dns_zone_next(dns_zone_t *zone, dns_zone_t **next) { - REQUIRE(DNS_ZONE_VALID(zone)); - REQUIRE(next != NULL && *next == NULL); - - *next = ISC_LIST_NEXT(zone, link); - if (*next == NULL) { - return ISC_R_NOMORE; - } else { - return ISC_R_SUCCESS; - } -} - -isc_result_t -dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first) { - REQUIRE(DNS_ZONEMGR_VALID(zmgr)); - REQUIRE(first != NULL && *first == NULL); - - *first = ISC_LIST_HEAD(zmgr->zones); - if (*first == NULL) { - return ISC_R_NOMORE; - } else { - return ISC_R_SUCCESS; - } -} - static isc_mutex_t * zone_keymgmt_getlock(dns_zone_t *zone) { uint32_t hash = dns_name_hash(&zone->origin); diff --git a/lib/dns/zonemgr.c b/lib/dns/zonemgr.c index ede9d28503a..e5b6c8f4376 100644 --- a/lib/dns/zonemgr.c +++ b/lib/dns/zonemgr.c @@ -810,3 +810,29 @@ dns_zonemgr_getcount(dns_zonemgr_t *zmgr, dns_zonestate_t state) { return count; } + +isc_result_t +dns_zonemgr_next_zone(dns_zone_t *zone, dns_zone_t **next) { + REQUIRE(DNS_ZONE_VALID(zone)); + REQUIRE(next != NULL && *next == NULL); + + *next = ISC_LIST_NEXT(zone, link); + if (*next == NULL) { + return ISC_R_NOMORE; + } else { + return ISC_R_SUCCESS; + } +} + +isc_result_t +dns_zonemgr_first_zone(dns_zonemgr_t *zmgr, dns_zone_t **first) { + REQUIRE(DNS_ZONEMGR_VALID(zmgr)); + REQUIRE(first != NULL && *first == NULL); + + *first = ISC_LIST_HEAD(zmgr->zones); + if (*first == NULL) { + return ISC_R_NOMORE; + } else { + return ISC_R_SUCCESS; + } +}