#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
#include <stdio.h>
#include <errno.h>
#include <afs/stds.h>
#include <rx/xdr.h>
-#include <afs/assert.h>
+#include <afs/afs_assert.h>
#include <lwp.h>
#include <lock.h>
#include <afs/afsint.h>
}
#ifdef AFS_PTHREAD_ENV
for (i = 0; i < (h_HTSPERBLOCK); i++)
- assert(pthread_cond_init(&block->entry[i].cond, NULL) == 0);
+ CV_INIT(&block->entry[i].cond, "block entry", CV_DEFAULT, 0);
#endif /* AFS_PTHREAD_ENV */
for (i = 0; i < (h_HTSPERBLOCK); i++)
Lock_Init(&block->entry[i].lock);
if (HTFree == NULL)
GetHTBlock();
- assert(HTFree != NULL);
+ osi_Assert(HTFree != NULL);
entry = HTFree;
HTFree = entry->next;
HTs++;
/* Most callers use secLevel==1, however, the fileserver uses secLevel==2
* to force use of the KeyFile. secLevel == 0 implies -noauth was
* specified. */
- if ((afsconf_GetLatestKey(tdir, 0, 0) == 0)) {
- code = afsconf_ClientAuthSecure(tdir, &sc, &scIndex);
- if (code)
- ViceLog(0, ("hpr_Initialize: clientauthsecure returns %d %s (so trying noauth)", code, afs_error_message(code)));
- if (code)
- scIndex = RX_SECIDX_NULL;
- }
- if ((scIndex == RX_SECIDX_NULL) && (sc == NULL))
- sc = rxnull_NewClientSecurityObject();
+ code = afsconf_ClientAuthSecure(tdir, &sc, &scIndex);
+ if (code) {
+ ViceLog(0, ("hpr_Initialize: clientauthsecure returns %d %s "
+ "(so trying noauth)", code, afs_error_message(code)));
+ scIndex = RX_SECIDX_NULL;
+ sc = rxnull_NewClientSecurityObject();
+ }
+
if (scIndex == RX_SECIDX_NULL)
- ViceLog(0, ("hpr_Initialize: Could not get afs tokens, running unauthenticated. [%d]", code));
+ ViceLog(0, ("hpr_Initialize: Could not get afs tokens, "
+ "running unauthenticated. [%d]", code));
memset(serverconns, 0, sizeof(serverconns)); /* terminate list!!! */
for (i = 0; i < info.numServers; i++) {
if (!uclient) {
code = hpr_Initialize(&uclient);
if (!code)
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
else
return code;
}
if (!uclient) {
code = hpr_Initialize(&uclient);
if (!code)
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
else
return code;
}
if (!uclient) {
code = hpr_Initialize(&uclient);
if (!code)
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
else
return code;
}
if (!uclient) {
code = hpr_Initialize(&uclient);
if (!code)
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
else
return code;
}
slept = 1; /* I did sleep */
host->hostFlags |= HCPS_WAITING; /* I am sleeping now */
#ifdef AFS_PTHREAD_ENV
- pthread_cond_wait(&host->cond, &host_glock_mutex);
+ CV_WAIT(&host->cond, &host_glock_mutex);
#else /* AFS_PTHREAD_ENV */
if ((code = LWP_WaitProcess(&(host->hostFlags))) != LWP_SUCCESS)
ViceLog(0, ("LWP_WaitProcess returned %d\n", code));
if (host->hostFlags & HCPS_WAITING) { /* somebody is waiting */
host->hostFlags &= ~HCPS_WAITING;
#ifdef AFS_PTHREAD_ENV
- assert(pthread_cond_broadcast(&host->cond) == 0);
+ CV_BROADCAST(&host->cond);
#else /* AFS_PTHREAD_ENV */
if ((code = LWP_NoYieldSignal(&(host->hostFlags))) != LWP_SUCCESS)
ViceLog(0, ("LWP_NoYieldSignal returns %d\n", code));
restart:
for (chain = hostAddrHashTable[index]; chain; chain = chain->next) {
host = chain->hostPtr;
- assert(host);
+ osi_Assert(host);
if (!(host->hostFlags & HOSTDELETED) && chain->addr == haddr
&& chain->port == hport) {
if ((host->hostFlags & HWHO_INPROGRESS) &&
for (chain = hostUuidHashTable[index]; chain; chain = chain->next) {
host = chain->hostPtr;
- assert(host);
+ osi_Assert(host);
if (!(host->hostFlags & HOSTDELETED) && host->interface
&& afs_uuid_equal(&host->interface->uuid, uuidp)) {
return host;
list = (struct host **)malloc(hostCount * sizeof(struct host *));
if (!list) {
ViceLog(0, ("Failed malloc in h_Enumerate (list)\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_Enumerate (list)\n");
}
flags = (int *)malloc(hostCount * sizeof(int));
if (!flags) {
ViceLog(0, ("Failed malloc in h_Enumerate (flags)\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_Enumerate (flags)\n");
}
for (totalCount = count = 0, host = hostList;
host && totalCount < hostCount;
H_UNLOCK;
for (i = 0; i < count; i++) {
flags[i] = (*proc) (list[i], flags[i], param);
+ H_LOCK;
h_Release_r(list[i]);
+ H_UNLOCK;
/* bail out of the enumeration early */
if (H_ENUMERATE_ISSET_BAIL(flags[i]))
break;
chain = (struct h_UuidHashChain *)malloc(sizeof(struct h_UuidHashChain));
if (!chain) {
ViceLog(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_AddHostToUuidHashTable_r\n");
}
chain->hostPtr = host;
chain->next = hostUuidHashTable[index];
if (LogLevel >= 125)
afsUUID_to_string(&host->interface->uuid, uuid1, 127);
for (uhp = &hostUuidHashTable[index]; (uth = *uhp); uhp = &uth->next) {
- assert(uth->hostPtr);
+ osi_Assert(uth->hostPtr);
if (uth->hostPtr == host) {
ViceLog(125,
("h_DeleteHostFromUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s %s:%d)\n",
struct Interface *interface;
char hoststr[16], hoststr2[16];
- assert(host);
- assert(host->interface);
+ osi_Assert(host);
+ osi_Assert(host->interface);
ViceLog(125, ("invalidateInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n",
host, afs_inet_ntoa_r(host->host, hoststr),
chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
if (!chain) {
ViceLog(0, ("Failed malloc in h_AddHostToAddrHashTable_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_AddHostToAddrHashTable_r\n");
}
chain->hostPtr = host;
chain->next = hostAddrHashTable[index];
AFS_PTR_FMT, afs_inet_ntoa_r(addr, hoststr), ntohs(port),
newHost, oldHost));
- assert(oldHost != newHost);
+ osi_Assert(oldHost != newHost);
caps.Capabilities_val = NULL;
if (!sc) {
struct Interface *interface;
char hoststr[16], hoststr2[16];
- assert(host);
- assert(host->interface);
+ osi_Assert(host);
+ osi_Assert(host->interface);
/*
* Make sure this address is on the list of known addresses
malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
if (!interface) {
ViceLog(0, ("Failed malloc in addInterfaceAddr_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in addInterfaceAddr_r\n");
}
interface->numberOfInterfaces = number + 1;
interface->uuid = host->interface->uuid;
struct Interface *interface;
char hoststr[16], hoststr2[16];
- assert(host);
- assert(host->interface);
+ osi_Assert(host);
+ osi_Assert(host->interface);
ViceLog(125, ("removeInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n",
host, afs_inet_ntoa_r(host->host, hoststr),
identP = (struct Identity *)malloc(sizeof(struct Identity));
if (!identP) {
ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_GetHost_r\n");
}
identP->valid = 0;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
identP = (struct Identity *)malloc(sizeof(struct Identity));
if (!identP) {
ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_GetHost_r\n");
}
identP->valid = 1;
identP->uuid = interf.uuid;
if (!identP) {
ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_GetHost_r\n");
}
identP->valid = 0;
if (!pident)
if (!identP) {
ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_GetHost_r\n");
}
identP->valid = 1;
interfValid = 1;
("InitCallBackState3 success on host %" AFS_PTR_FMT " (%s:%d)\n",
host, afs_inet_ntoa_r(host->host, hoststr),
ntohs(host->port)));
- assert(interfValid == 1);
+ osi_Assert(interfValid == 1);
initInterfaceAddr_r(host, &interf);
}
}
}
rxcon_ident_key = rx_KeyCreate((rx_destructor_t) free);
rxcon_client_key = rx_KeyCreate((rx_destructor_t) 0);
-#ifdef AFS_PTHREAD_ENV
- assert(pthread_mutex_init(&host_glock_mutex, NULL) == 0);
-#endif /* AFS_PTHREAD_ENV */
+ MUTEX_INIT(&host_glock_mutex, "host glock", MUTEX_DEFAULT, 0);
}
static int
tname = (char *)malloc(PR_MAXNAMELEN);
if (!tname) {
ViceLog(0, ("Failed malloc in MapName_r\n"));
- assert(0);
+ osi_Panic("Failed malloc in MapName_r\n");
}
strcpy(tname, aname);
tname[anamelen] = '@';
* possible failure modes that we will disable it again */
/* Turn off System:Administrator for safety
* if (AL_IsAMember(SystemId, client->CPS) == 0)
- * assert(AL_DisableGroup(SystemId, client->CPS) == 0); */
+ * osi_Assert(AL_DisableGroup(SystemId, client->CPS) == 0); */
}
/* Now, tcon may already be set to a rock, since we blocked with no host
int
h_ReleaseClient_r(struct client *client)
{
- assert(client->refCount > 0);
+ osi_Assert(client->refCount > 0);
client->refCount--;
return 0;
}
lids.idlist_val = (afs_int32 *) malloc(1 * sizeof(afs_int32));
if (!lids.idlist_val) {
ViceLog(0, ("Failed malloc in h_UserName\n"));
- assert(0);
+ osi_Panic("Failed malloc in h_UserName\n");
}
lnames.namelist_len = 0;
lnames.namelist_val = (prname *) 0;
if_len = sizeof(struct Interface) +
((host->interface->numberOfInterfaces-1) * sizeof(struct AddrPort));
ifp = (struct Interface *) malloc(if_len);
- assert(ifp != NULL);
+ osi_Assert(ifp != NULL);
memcpy(ifp, host->interface, if_len);
hdr.interfaces = host->interface->numberOfInterfaces;
iov[iovcnt].iov_base = (char *) ifp;
hdr.hcps = host->hcps.prlist_len;
hcps_len = hdr.hcps * sizeof(afs_int32);
hcps = (afs_int32 *) malloc(hcps_len);
- assert(hcps != NULL);
+ osi_Assert(hcps != NULL);
memcpy(hcps, host->hcps.prlist_val, hcps_len);
iov[iovcnt].iov_base = (char *) hcps;
iov[iovcnt].iov_len = hcps_len;
ifp_len = sizeof(struct Interface) +
((hdr.interfaces-1) * sizeof(struct AddrPort));
ifp = (struct Interface *) malloc(ifp_len);
- assert(ifp != NULL);
+ osi_Assert(ifp != NULL);
iov[iovcnt].iov_base = (char *) ifp;
iov[iovcnt].iov_len = ifp_len;
iovcnt++;
if (hdr.hcps) {
hcps_len = hdr.hcps * sizeof(afs_int32);
hcps = (afs_int32 *) malloc(hcps_len);
- assert(hcps != NULL);
+ osi_Assert(hcps != NULL);
iov[iovcnt].iov_base = (char *) hcps;
iov[iovcnt].iov_len = hcps_len;
iovcnt++;
if (!hdr.hcps && hdsk.hcps_valid) {
/* valid, zero-length host cps ; does this ever happen? */
hcps = (afs_int32 *) malloc(sizeof(afs_int32));
- assert(hcps != NULL);
+ osi_Assert(hcps != NULL);
}
host = GetHT();
- assert(host != NULL);
+ osi_Assert(host != NULL);
if (ifp) {
host->interface = ifp;
if (host->LastCall < checktime) {
h_Lock_r(host);
if (!(host->hostFlags & HOSTDELETED)) {
+ host->hostFlags |= HWHO_INPROGRESS;
cb_conn = host->callback_rxcon;
rx_GetConnection(cb_conn);
if (host->LastCall < clientdeletetime) {
rx_PutConnection(cb_conn);
cb_conn=NULL;
H_LOCK;
+ host->hostFlags &= ~HWHO_INPROGRESS;
}
h_Unlock_r(host);
}
char uuidstr[128];
afs_uint16 port7001 = htons(7001);
- assert(host);
- assert(interf);
+ osi_Assert(host);
+ osi_Assert(interf);
number = interf->numberOfInterfaces;
myAddr = host->host; /* current interface address */
(sizeof(struct AddrPort) * (count - 1)));
if (!interface) {
ViceLog(0, ("Failed malloc in initInterfaceAddr_r 1\n"));
- assert(0);
+ osi_Panic("Failed malloc in initInterfaceAddr_r 1\n");
}
interface->numberOfInterfaces = count;
} else {
malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * count));
if (!interface) {
ViceLog(0, ("Failed malloc in initInterfaceAddr_r 2\n"));
- assert(0);
+ osi_Panic("Failed malloc in initInterfaceAddr_r 2\n");
}
interface->numberOfInterfaces = count + 1;
interface->interface[count].addr = myAddr;
interface->uuid = interf->uuid;
- assert(!host->interface);
+ osi_Assert(!host->interface);
host->interface = interface;
if (LogLevel >= 125) {
for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp);
hp = &th->next) {
- assert(th->hostPtr);
+ osi_Assert(th->hostPtr);
if (th->hostPtr == host && th->addr == addr && th->port == port) {
ViceLog(125, ("h_DeleteHostFromAddrHashTable_r: host %" AFS_PTR_FMT " (%s:%d)\n",
host, afs_inet_ntoa_r(host->host, hoststr),