2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

added dns_zonemgr_attach(); also changed comments for other

attach() functions to consistently say that the new reference attaches to
the object, not vice versa
This commit is contained in:
Andreas Gustafsson 2000-06-15 16:11:50 +00:00
parent 0bfcec250f
commit 21eaa04858
2 changed files with 31 additions and 7 deletions

View File

@ -51,7 +51,7 @@ ISC_LANG_BEGINDECLS
isc_result_t
dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx);
/*
* Creates a new empty zone and attach to it.
* Creates a new empty zone and attach '*zonep' to it.
*
* Requires:
* 'zonep' to point to a NULL pointer.
@ -178,7 +178,7 @@ dns_zone_load(dns_zone_t *zone);
void
dns_zone_attach(dns_zone_t *source, dns_zone_t **target);
/*
* Attach 'zone' to 'target' incrementing its external
* Attach '*target' to 'source' incrementing its external
* reference count.
*
* Require:
@ -200,7 +200,7 @@ dns_zone_detach(dns_zone_t **zonep);
void
dns_zone_iattach(dns_zone_t *source, dns_zone_t **target);
/*
* Attach 'zone' to 'target' incrementing its internal
* Attach '*target' to 'source' incrementing its internal
* reference count. This is intended for use by operations
* such as zone transfers that need to prevent the zone
* object from being freed but not from shutting down.
@ -260,7 +260,7 @@ dns_zone_cleardbargs(dns_zone_t *zone);
isc_result_t
dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp);
/*
* Attach the database to '*dbp' if it exists otherwise
* Attach '*dbp' to the database to if it exists otherwise
* return DNS_R_NOTLOADED.
*
* Require:
@ -715,7 +715,7 @@ dns_zone_settask(dns_zone_t *zone, isc_task_t *task);
void
dns_zone_gettask(dns_zone_t *zone, isc_task_t **target);
/*
* Attach the zone's task to '*target'.
* Attach '*target' to the zone's task.
*
* Requires:
* 'zone' to be valid initialised zone.
@ -918,6 +918,17 @@ dns_zonemgr_shutdown(dns_zonemgr_t *zmgr);
* 'zmgr' to be a valid zone manager.
*/
void
dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target);
/*
* Attach '*target' to 'source' incrementing its external
* reference count.
*
* Require:
* 'zone' to be a valid zone.
* 'target' to be non NULL and '*target' to be NULL.
*/
void
dns_zonemgr_detach(dns_zonemgr_t **zmgrp);
/*

View File

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zone.c,v 1.146 2000/06/15 02:45:47 marka Exp $ */
/* $Id: zone.c,v 1.147 2000/06/15 16:11:49 gson Exp $ */
#include <config.h>
@ -184,7 +184,7 @@ struct dns_zone {
struct dns_zonemgr {
unsigned int magic;
isc_mem_t * mctx;
int refs;
int refs; /* Locked by rwlock */
isc_taskmgr_t * taskmgr;
isc_timermgr_t * timermgr;
isc_socketmgr_t * socketmgr;
@ -4097,6 +4097,19 @@ dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
ENSURE(zone->zmgr == NULL);
}
void
dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target) {
REQUIRE(DNS_ZONEMGR_VALID(source));
REQUIRE(target != NULL && *target == NULL);
RWLOCK(&source->rwlock, isc_rwlocktype_write);
REQUIRE(source->refs > 0);
source->refs++;
INSIST(source->refs > 0);
RWUNLOCK(&source->rwlock, isc_rwlocktype_write);
*target = source;
}
void
dns_zonemgr_detach(dns_zonemgr_t **zmgrp) {
dns_zonemgr_t *zmgr;