]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Move dns_zone_next/dns_zone_first to zonemgr
authorMatthijs Mekking <matthijs@isc.org>
Tue, 7 Apr 2026 09:22:56 +0000 (11:22 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Wed, 8 Apr 2026 12:27:06 +0000 (14:27 +0200)
Walking the list of managed zones is a function that operates
on the zone manager object.

bin/named/statschannel.c
lib/dns/include/dns/zone.h
lib/dns/include/dns/zonemgr.h
lib/dns/zone.c
lib/dns/zonemgr.c

index 14cde7fe47f052cfd6885cc3eac3b5863c8eb3bb..7b84a03812c2d412b52cfc08338f61b30f2f29fa 100644 (file)
@@ -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) {
index ecb1bee66820b4938d8272d92aa1093fcdbbe4dc..36a837b16b2440ad16e1d6da5045e326d9cf40b0 100644 (file)
@@ -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);
index 0e60410ce0c73c5483aeb75b8bb3e2d95cc910c5..e1478826aabdbf630f70ec944a3d80385cea71f4 100644 (file)
@@ -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).
+ */
index ce04932ebc3f07a624baf2cbddc550520650e414..8fecf876516352a73093a9feac5b00dcd436187b 100644 (file)
@@ -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);
index ede9d28503a43f4db32980036d01a6ca4946e323..e5b6c8f4376f5ff620266fe6867521f3c95d0d18 100644 (file)
@@ -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;
+       }
+}