The zone table no longer depends on the loop manager

This reverts some of the changes in commit b171cacf4f
because now it isn't necessary to pass the loopmgr around.
This commit is contained in:
Tony Finch 2023-04-27 12:47:03 +01:00
parent 6217e434b5
commit 9882a6ef90
No known key found for this signature in database
13 changed files with 18 additions and 29 deletions

View file

@ -2147,8 +2147,7 @@ run_server(void *arg) {
CHECK(ns_interfacemgr_create(mctx, sctx, loopmgr, netmgr, dispatchmgr,
NULL, false, &interfacemgr));
CHECK(dns_view_create(mctx, loopmgr, dns_rdataclass_in, "_default",
&view));
CHECK(dns_view_create(mctx, dns_rdataclass_in, "_default", &view));
CHECK(dns_cache_create(loopmgr, dns_rdataclass_in, "", &cache));
dns_view_setcache(view, cache, false);
dns_cache_detach(&cache);

View file

@ -6437,8 +6437,7 @@ create_view(const cfg_obj_t *vconfig, dns_viewlist_t *viewlist,
}
INSIST(view == NULL);
result = dns_view_create(named_g_mctx, named_g_loopmgr, viewclass,
viewname, &view);
result = dns_view_create(named_g_mctx, viewclass, viewname, &view);
if (result != ISC_R_SUCCESS) {
return (result);
}

View file

@ -256,7 +256,7 @@ main(int argc, char *argv[]) {
RUNCHECK(dns_requestmgr_create(mctx, dispatchmgr, dispatchv4, NULL,
&requestmgr));
RUNCHECK(dns_view_create(mctx, loopmgr, 0, "_test", &view));
RUNCHECK(dns_view_create(mctx, 0, "_test", &view));
isc_loopmgr_setup(loopmgr, sendqueries, NULL);
isc_loopmgr_run(loopmgr);

View file

@ -2141,7 +2141,7 @@ main(int argc, char *argv[]) {
mctx, dispatchmgr, have_ipv4 ? dispatchvx : NULL,
have_ipv6 ? dispatchvx : NULL, &requestmgr));
RUNCHECK(dns_view_create(mctx, loopmgr, 0, "_mdig", &view));
RUNCHECK(dns_view_create(mctx, 0, "_mdig", &view));
query = ISC_LIST_HEAD(queries);
isc_loopmgr_setup(loopmgr, sendqueries, query);

View file

@ -236,8 +236,7 @@ LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
isc_loopmgr_create(mctx, 1, &loopmgr);
result = dns_view_create(mctx, loopmgr, dns_rdataclass_in, "view",
&view);
result = dns_view_create(mctx, dns_rdataclass_in, "view", &view);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "dns_view_create failed: %s\n",
isc_result_totext(result));

View file

@ -206,8 +206,7 @@ createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_loopmgr_t *loopmgr,
isc_result_t result;
dns_view_t *view = NULL;
result = dns_view_create(mctx, loopmgr, rdclass, DNS_CLIENTVIEW_NAME,
&view);
result = dns_view_create(mctx, rdclass, DNS_CLIENTVIEW_NAME, &view);
if (result != ISC_R_SUCCESS) {
return (result);
}

View file

@ -259,8 +259,8 @@ struct dns_view {
#endif /* HAVE_LMDB */
isc_result_t
dns_view_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
dns_rdataclass_t rdclass, const char *name, dns_view_t **viewp);
dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, const char *name,
dns_view_t **viewp);
/*%<
* Create a view.
*

View file

@ -34,8 +34,7 @@ typedef isc_result_t
dns_zt_callback_t(void *arg);
void
dns_zt_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, dns_view_t *view,
dns_zt_t **ztp);
dns_zt_create(isc_mem_t *mctx, dns_view_t *view, dns_zt_t **ztp);
/*%<
* Creates a new zone table for a view.
*

View file

@ -79,8 +79,7 @@
#define DEFAULT_EDNS_BUFSIZE 1232
isc_result_t
dns_view_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
dns_rdataclass_t rdclass, const char *name,
dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, const char *name,
dns_view_t **viewp) {
dns_view_t *view = NULL;
isc_result_t result;
@ -135,7 +134,7 @@ dns_view_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
isc_rwlock_init(&view->sfd_lock);
view->zonetable = NULL;
dns_zt_create(mctx, loopmgr, view, &view->zonetable);
dns_zt_create(mctx, view, &view->zonetable);
result = dns_fwdtable_create(mctx, &view->fwdtable);
if (result != ISC_R_SUCCESS) {

View file

@ -94,15 +94,14 @@ static dns_qpmethods_t ztqpmethods = {
};
void
dns_zt_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, dns_view_t *view,
dns_zt_t **ztp) {
dns_zt_create(isc_mem_t *mctx, dns_view_t *view, dns_zt_t **ztp) {
dns_qpmulti_t *multi = NULL;
dns_zt_t *zt = NULL;
REQUIRE(ztp != NULL && *ztp == NULL);
REQUIRE(view != NULL);
dns_qpmulti_create(mctx, loopmgr, &ztqpmethods, view, &multi);
dns_qpmulti_create(mctx, &ztqpmethods, view, &multi);
zt = isc_mem_get(mctx, sizeof(*zt));
*zt = (dns_zt_t){
@ -177,11 +176,8 @@ dns_zt_find(dns_zt_t *zt, const dns_name_t *name, dns_ztfind_t options,
REQUIRE(VALID_ZT(zt));
REQUIRE(exactopts != exactmask);
if (isc_tid() == ISC_TID_UNKNOWN) {
dns_qpmulti_lockedread(zt->multi, &qpr);
} else {
dns_qpmulti_query(zt->multi, &qpr);
}
dns_qpmulti_query(zt->multi, &qpr);
if (exactopts == DNS_ZTFIND_EXACT) {
result = dns_qp_getname(&qpr, name, &pval, &ival);
} else if (exactopts == DNS_ZTFIND_NOEXACT) {

View file

@ -380,8 +380,7 @@ load_multi(struct bench_state *bctx) {
size_t count = 0;
uint64_t start;
dns_qpmulti_create(bctx->mctx, bctx->loopmgr, &item_methods, NULL,
&bctx->multi);
dns_qpmulti_create(bctx->mctx, &item_methods, NULL, &bctx->multi);
/* initial contents of the trie */
start = isc_time_monotonic();

View file

@ -367,7 +367,7 @@ many_transactions(void *arg) {
UNUSED(arg);
dns_qpmulti_t *qpm = NULL;
dns_qpmulti_create(mctx, loopmgr, &test_methods, NULL, &qpm);
dns_qpmulti_create(mctx, &test_methods, NULL, &qpm);
qpm->writer.write_protect = true;
for (size_t n = 0; n < TRANSACTION_COUNT; n++) {

View file

@ -64,7 +64,7 @@ dns_test_makeview(const char *name, bool with_cache, dns_view_t **viewp) {
dns_view_t *view = NULL;
dns_cache_t *cache = NULL;
result = dns_view_create(mctx, loopmgr, dns_rdataclass_in, name, &view);
result = dns_view_create(mctx, dns_rdataclass_in, name, &view);
if (result != ISC_R_SUCCESS) {
return (result);
}