]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Drop unused dbtable code
authorMichal Nowak <mnowak@isc.org>
Mon, 12 Oct 2020 16:20:58 +0000 (18:20 +0200)
committerMichal Nowak <mnowak@isc.org>
Thu, 22 Oct 2020 11:11:16 +0000 (13:11 +0200)
lib/dns/Makefile.am
lib/dns/dbtable.c [deleted file]
lib/dns/include/dns/dbtable.h [deleted file]
lib/dns/include/dns/types.h
lib/dns/win32/libdns.def.in
lib/dns/win32/libdns.vcxproj.filters.in
lib/dns/win32/libdns.vcxproj.in
util/copyrights

index 73e6bc2f7385fd82ab5da1389a06d04eca52129f..f53debaccf92d836431e5630b546b83b4c35d2b1 100644 (file)
@@ -64,7 +64,6 @@ libdns_la_HEADERS =                   \
        include/dns/compress.h          \
        include/dns/db.h                \
        include/dns/dbiterator.h        \
-       include/dns/dbtable.h           \
        include/dns/diff.h              \
        include/dns/dispatch.h          \
        include/dns/dlz.h               \
@@ -168,7 +167,6 @@ libdns_la_SOURCES =                 \
        compress.c                      \
        db.c                            \
        dbiterator.c                    \
-       dbtable.c                       \
        diff.c                          \
        dispatch.c                      \
        dlz.c                           \
diff --git a/lib/dns/dbtable.c b/lib/dns/dbtable.c
deleted file mode 100644 (file)
index e237fd6..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, you can obtain one at https://mozilla.org/MPL/2.0/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-#include <stdbool.h>
-
-#include <isc/mem.h>
-#include <isc/rwlock.h>
-#include <isc/util.h>
-
-#include <dns/db.h>
-#include <dns/dbtable.h>
-#include <dns/rbt.h>
-#include <dns/result.h>
-
-struct dns_dbtable {
-       /* Unlocked. */
-       unsigned int magic;
-       isc_mem_t *mctx;
-       dns_rdataclass_t rdclass;
-       isc_rwlock_t tree_lock;
-       /* Protected by atomics */
-       isc_refcount_t references;
-       /* Locked by tree_lock. */
-       dns_rbt_t *rbt;
-       dns_db_t *default_db;
-};
-
-#define DBTABLE_MAGIC         ISC_MAGIC('D', 'B', '-', '-')
-#define VALID_DBTABLE(dbtable) ISC_MAGIC_VALID(dbtable, DBTABLE_MAGIC)
-
-static void
-dbdetach(void *data, void *arg) {
-       dns_db_t *db = data;
-
-       UNUSED(arg);
-
-       dns_db_detach(&db);
-}
-
-isc_result_t
-dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
-                  dns_dbtable_t **dbtablep) {
-       dns_dbtable_t *dbtable;
-       isc_result_t result;
-
-       REQUIRE(mctx != NULL);
-       REQUIRE(dbtablep != NULL && *dbtablep == NULL);
-
-       dbtable = isc_mem_get(mctx, sizeof(*dbtable));
-
-       dbtable->rbt = NULL;
-       result = dns_rbt_create(mctx, dbdetach, NULL, &dbtable->rbt);
-       if (result != ISC_R_SUCCESS) {
-               goto clean1;
-       }
-
-       result = isc_rwlock_init(&dbtable->tree_lock, 0, 0);
-       if (result != ISC_R_SUCCESS) {
-               goto clean3;
-       }
-
-       dbtable->default_db = NULL;
-       dbtable->mctx = NULL;
-       isc_mem_attach(mctx, &dbtable->mctx);
-       dbtable->rdclass = rdclass;
-       dbtable->magic = DBTABLE_MAGIC;
-       isc_refcount_init(&dbtable->references, 1);
-
-       *dbtablep = dbtable;
-
-       return (ISC_R_SUCCESS);
-
-clean3:
-       dns_rbt_destroy(&dbtable->rbt);
-
-clean1:
-       isc_mem_putanddetach(&mctx, dbtable, sizeof(*dbtable));
-
-       return (result);
-}
-
-static inline void
-dbtable_free(dns_dbtable_t *dbtable) {
-       /*
-        * Caller must ensure that it is safe to call.
-        */
-
-       RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-
-       if (dbtable->default_db != NULL) {
-               dns_db_detach(&dbtable->default_db);
-       }
-
-       dns_rbt_destroy(&dbtable->rbt);
-
-       RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-
-       isc_rwlock_destroy(&dbtable->tree_lock);
-
-       dbtable->magic = 0;
-
-       isc_mem_putanddetach(&dbtable->mctx, dbtable, sizeof(*dbtable));
-}
-
-void
-dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp) {
-       REQUIRE(VALID_DBTABLE(source));
-       REQUIRE(targetp != NULL && *targetp == NULL);
-
-       isc_refcount_increment(&source->references);
-
-       *targetp = source;
-}
-
-void
-dns_dbtable_detach(dns_dbtable_t **dbtablep) {
-       dns_dbtable_t *dbtable;
-
-       REQUIRE(dbtablep != NULL);
-       dbtable = *dbtablep;
-       *dbtablep = NULL;
-       REQUIRE(VALID_DBTABLE(dbtable));
-
-       if (isc_refcount_decrement(&dbtable->references) == 1) {
-               dbtable_free(dbtable);
-       }
-}
-
-isc_result_t
-dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db) {
-       isc_result_t result;
-       dns_db_t *dbclone;
-
-       REQUIRE(VALID_DBTABLE(dbtable));
-       REQUIRE(dns_db_class(db) == dbtable->rdclass);
-
-       dbclone = NULL;
-       dns_db_attach(db, &dbclone);
-
-       RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-       result = dns_rbt_addname(dbtable->rbt, dns_db_origin(dbclone), dbclone);
-       RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-
-       return (result);
-}
-
-void
-dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db) {
-       dns_db_t *stored_data = NULL;
-       isc_result_t result;
-       dns_name_t *name;
-
-       REQUIRE(VALID_DBTABLE(dbtable));
-
-       name = dns_db_origin(db);
-
-       /*
-        * There is a requirement that the association of name with db
-        * be verified.  With the current rbt.c this is expensive to do,
-        * because effectively two find operations are being done, but
-        * deletion is relatively infrequent.
-        * XXXDCL ... this could be cheaper now with dns_rbt_deletenode.
-        */
-
-       RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-
-       result = dns_rbt_findname(dbtable->rbt, name, 0, NULL,
-                                 (void **)(void *)&stored_data);
-
-       if (result == ISC_R_SUCCESS) {
-               INSIST(stored_data == db);
-
-               (void)dns_rbt_deletename(dbtable->rbt, name, false);
-       }
-
-       RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-}
-
-void
-dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db) {
-       REQUIRE(VALID_DBTABLE(dbtable));
-       REQUIRE(dbtable->default_db == NULL);
-       REQUIRE(dns_name_compare(dns_db_origin(db), dns_rootname) == 0);
-
-       RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-
-       dbtable->default_db = NULL;
-       dns_db_attach(db, &dbtable->default_db);
-
-       RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-}
-
-void
-dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **dbp) {
-       REQUIRE(VALID_DBTABLE(dbtable));
-       REQUIRE(dbp != NULL && *dbp == NULL);
-
-       RWLOCK(&dbtable->tree_lock, isc_rwlocktype_read);
-
-       dns_db_attach(dbtable->default_db, dbp);
-
-       RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_read);
-}
-
-void
-dns_dbtable_removedefault(dns_dbtable_t *dbtable) {
-       REQUIRE(VALID_DBTABLE(dbtable));
-
-       RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-
-       dns_db_detach(&dbtable->default_db);
-
-       RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
-}
-
-isc_result_t
-dns_dbtable_find(dns_dbtable_t *dbtable, const dns_name_t *name,
-                unsigned int options, dns_db_t **dbp) {
-       dns_db_t *stored_data = NULL;
-       isc_result_t result;
-       unsigned int rbtoptions = 0;
-
-       REQUIRE(dbp != NULL && *dbp == NULL);
-
-       if ((options & DNS_DBTABLEFIND_NOEXACT) != 0) {
-               rbtoptions |= DNS_RBTFIND_NOEXACT;
-       }
-
-       RWLOCK(&dbtable->tree_lock, isc_rwlocktype_read);
-
-       result = dns_rbt_findname(dbtable->rbt, name, rbtoptions, NULL,
-                                 (void **)(void *)&stored_data);
-
-       if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
-               dns_db_attach(stored_data, dbp);
-       } else if (dbtable->default_db != NULL) {
-               dns_db_attach(dbtable->default_db, dbp);
-               result = DNS_R_PARTIALMATCH;
-       } else {
-               result = ISC_R_NOTFOUND;
-       }
-
-       RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_read);
-
-       return (result);
-}
diff --git a/lib/dns/include/dns/dbtable.h b/lib/dns/include/dns/dbtable.h
deleted file mode 100644 (file)
index 3b78c41..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, you can obtain one at https://mozilla.org/MPL/2.0/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-#ifndef DNS_DBTABLE_H
-#define DNS_DBTABLE_H 1
-
-/*****
-***** Module Info
-*****/
-
-/*! \file dns/dbtable.h
- * \brief
- * DNS DB Tables
- *
- * XXX TBS XXX
- *
- * MP:
- *\li  The module ensures appropriate synchronization of data structures it
- *     creates and manipulates.
- *
- * Reliability:
- *\li  No anticipated impact.
- *
- * Resources:
- *\li  None.
- *
- * Security:
- *\li  No anticipated impact.
- *
- * Standards:
- *\li  None.
- */
-
-#include <isc/lang.h>
-
-#include <dns/types.h>
-
-#define DNS_DBTABLEFIND_NOEXACT 0x01
-
-ISC_LANG_BEGINDECLS
-
-isc_result_t
-dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
-                  dns_dbtable_t **dbtablep);
-/*%<
- * Make a new dbtable of class 'rdclass'
- *
- * Requires:
- *\li  mctx != NULL
- * \li dbtablep != NULL && *dptablep == NULL
- *\li  'rdclass' is a valid class
- *
- * Returns:
- *\li  #ISC_R_SUCCESS
- *\li  #ISC_R_NOMEMORY
- *\li  #ISC_R_UNEXPECTED
- */
-
-void
-dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp);
-/*%<
- * Attach '*targetp' to 'source'.
- *
- * Requires:
- *
- *\li  'source' is a valid dbtable.
- *
- *\li  'targetp' points to a NULL dns_dbtable_t *.
- *
- * Ensures:
- *
- *\li  *targetp is attached to source.
- */
-
-void
-dns_dbtable_detach(dns_dbtable_t **dbtablep);
-/*%<
- * Detach *dbtablep from its dbtable.
- *
- * Requires:
- *
- *\li  '*dbtablep' points to a valid dbtable.
- *
- * Ensures:
- *
- *\li  *dbtablep is NULL.
- *
- *\li  If '*dbtablep' is the last reference to the dbtable,
- *             all resources used by the dbtable will be freed
- */
-
-isc_result_t
-dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db);
-/*%<
- * Add 'db' to 'dbtable'.
- *
- * Requires:
- *\li  'dbtable' is a valid dbtable.
- *
- *\li  'db' is a valid database with the same class as 'dbtable'
- */
-
-void
-dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db);
-/*%<
- * Remove 'db' from 'dbtable'.
- *
- * Requires:
- *\li  'db' was previously added to 'dbtable'.
- */
-
-void
-dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db);
-/*%<
- * Use 'db' as the result of a dns_dbtable_find() if no better match is
- * available.
- */
-
-void
-dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **db);
-/*%<
- * Get the 'db' used as the result of a dns_dbtable_find()
- * if no better match is available.
- */
-
-void
-dns_dbtable_removedefault(dns_dbtable_t *dbtable);
-/*%<
- * Remove the default db from 'dbtable'.
- */
-
-isc_result_t
-dns_dbtable_find(dns_dbtable_t *dbtable, const dns_name_t *name,
-                unsigned int options, dns_db_t **dbp);
-/*%<
- * Find the deepest match to 'name' in the dbtable, and return it
- *
- * Notes:
- *\li  If the DNS_DBTABLEFIND_NOEXACT option is set, the best partial
- *     match (if any) to 'name' will be returned.
- *
- * Returns:
- * \li #ISC_R_SUCCESS          on success
- *\li       something else:            no default and match
- */
-
-ISC_LANG_ENDDECLS
-
-#endif /* DNS_DBTABLE_H */
index d918cf39cc2781bc48461312dca98f387f97dfa1..2a08c31b5f4690cd7d984a4a4f303b869ca26cbb 100644 (file)
@@ -57,7 +57,6 @@ typedef struct dns_dbiterator        dns_dbiterator_t;
 typedef void                          dns_dbload_t;
 typedef void                          dns_dbnode_t;
 typedef struct dns_dbonupdatelistener  dns_dbonupdatelistener_t;
-typedef struct dns_dbtable            dns_dbtable_t;
 typedef void                          dns_dbversion_t;
 typedef struct dns_dlzimplementation   dns_dlzimplementation_t;
 typedef struct dns_dlzdb              dns_dlzdb_t;
index e446d4dc2303bbb2eb5dbff86fd82b1aacc3f889..56061f76c0c85f8b6c37d1ab06e7bf81f0358c58 100644 (file)
@@ -240,15 +240,6 @@ dns_dbiterator_pause
 dns_dbiterator_prev
 dns_dbiterator_seek
 dns_dbiterator_setcleanmode
-dns_dbtable_add
-dns_dbtable_adddefault
-dns_dbtable_attach
-dns_dbtable_create
-dns_dbtable_detach
-dns_dbtable_find
-dns_dbtable_getdefault
-dns_dbtable_remove
-dns_dbtable_removedefault
 dns_decompress_edns
 dns_decompress_getmethods
 dns_decompress_init
index 5ba61623f035410c36492b9c7bcbc1559216b094..7469f7bced09521dee53c44b104f33cf4314db5f 100644 (file)
@@ -63,9 +63,6 @@
     <ClCompile Include="..\dbiterator.c">
       <Filter>Library Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\dbtable.c">
-      <Filter>Library Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\diff.c">
       <Filter>Library Source Files</Filter>
     </ClCompile>
     <ClInclude Include="..\include\dns\dbiterator.h">
       <Filter>Library Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\include\dns\dbtable.h">
-      <Filter>Library Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\include\dns\diff.h">
       <Filter>Library Header Files</Filter>
     </ClInclude>
index 9af373e06c0cc9b89c57870e64513c3f0ab3be83..644e809c3ca63a6c748be30218280f4d105f73b0 100644 (file)
     <ClCompile Include="..\compress.c" />
     <ClCompile Include="..\db.c" />
     <ClCompile Include="..\dbiterator.c" />
-    <ClCompile Include="..\dbtable.c" />
     <ClCompile Include="..\diff.c" />
     <ClCompile Include="..\dispatch.c" />
     <ClCompile Include="..\dlz.c" />
     <ClInclude Include="..\include\dns\compress.h" />
     <ClInclude Include="..\include\dns\db.h" />
     <ClInclude Include="..\include\dns\dbiterator.h" />
-    <ClInclude Include="..\include\dns\dbtable.h" />
     <ClInclude Include="..\include\dns\diff.h" />
     <ClInclude Include="..\include\dns\dispatch.h" />
     <ClInclude Include="..\include\dns\dlz.h" />
index 772ad87b8603df8e7b86436590e97864fc2eca22..16a47dfcb24d13969de771e3747ffa404b72c031 100644 (file)
 ./lib/dns/compress.c                           C       1999,2000,2001,2004,2005,2006,2007,2015,2016,2017,2018,2019,2020
 ./lib/dns/db.c                                 C       1999,2000,2001,2003,2004,2005,2007,2008,2009,2011,2012,2013,2015,2016,2017,2018,2019
 ./lib/dns/dbiterator.c                         C       1999,2000,2001,2004,2005,2007,2016,2018,2019,2020
-./lib/dns/dbtable.c                            C       1999,2000,2001,2004,2005,2007,2013,2016,2018,2019,2020
 ./lib/dns/diff.c                               C       2000,2001,2002,2003,2004,2005,2007,2008,2009,2011,2013,2014,2015,2016,2017,2018,2019,2020
 ./lib/dns/dispatch.c                           C       1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020
 ./lib/dns/dlz.c                                        C.PORTION       1999,2000,2001,2005,2007,2009,2010,2011,2012,2013,2015,2016,2018,2019,2020
 ./lib/dns/include/dns/compress.h               C       1999,2000,2001,2002,2004,2005,2006,2007,2009,2015,2016,2017,2018,2019,2020
 ./lib/dns/include/dns/db.h                     C       1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019
 ./lib/dns/include/dns/dbiterator.h             C       1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020
-./lib/dns/include/dns/dbtable.h                        C       1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020
 ./lib/dns/include/dns/diff.h                   C       2000,2001,2004,2005,2006,2007,2008,2009,2010,2013,2016,2018,2019,2020
 ./lib/dns/include/dns/dispatch.h               C       1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020
 ./lib/dns/include/dns/dlz.h                    C.PORTION       1999,2000,2001,2005,2006,2007,2009,2010,2011,2012,2013,2016,2018,2019,2020