From 519b4a1a27c8b767a57a981dda69a3c6394bd49d Mon Sep 17 00:00:00 2001 From: Michael Graff Date: Sat, 25 Sep 1999 01:44:41 +0000 Subject: [PATCH] clean up public vs. private items --- lib/dns/adb.c | 21 ++++++++++++++++++--- lib/dns/include/dns/adb.h | 6 +++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 378f7b821b..ce5886ecf8 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -240,23 +240,38 @@ static dns_adbhandle_t * new_adbhandle(dns_adb_t *adb) { dns_adbhandle_t *h; + isc_result_t result; h = isc_mempool_get(adb->ahmp); if (h == NULL) return (NULL); - h->magic = DNS_ADBHANDLE_MAGIC; + /* + * public members + */ + h->magic = 0; h->adb = adb; + ISC_LIST_INIT(h->list); + + /* + * private members + */ + result = isc_mutex_init(&h->lock); + if (result != ISC_R_SUCCESS) { + UNEXPECTED_ERROR(__FILE__, __LINE__, + "isc_mutex_init failed in new_adbhandle()"); + isc_mempool_put(adb->ahmp, h); + return (NULL); + } h->task = NULL; h->taskaction = NULL; h->arg = NULL; - dns_name_init(&h->zone, NULL); - ISC_LIST_INIT(h->list); ISC_LINK_INIT(h, link); ISC_EVENT_INIT(&h->event, sizeof (isc_event_t), 0, 0, 0, NULL, NULL, NULL, NULL, h); + h->magic = DNS_ADBHANDLE_MAGIC; return (h); } diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index 75fe7dacf1..063590fd54 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -115,12 +115,16 @@ typedef struct dns_adbhandle dns_adbhandle_t; * The handle into our internal state of what is going on, where, when... * This is returned to the user as a handle, so requests can be canceled, * etc. + * + * On return, the client can safely use "list", and can reorder the list. + * Items may not be _deleted_ from this list, however, or added to it + * other than by using the dns_adb_*() API. */ struct dns_adbhandle { /* Public */ unsigned int magic; /* RO: magic */ - ISC_LIST(dns_adbaddrinfo_t) list; /* RO: list of addrs */ dns_adb_t *adb; /* RO: parent adb */ + ISC_LIST(dns_adbaddrinfo_t) list; /* RO: list of addrs */ /* Private */ isc_mutex_t lock; /* locks all below */