osi_NewVnode(void) {
struct vcache *tvc;
- tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
+ tvc = afs_osi_Alloc(sizeof(struct vcache));
+ osi_Assert(tvc != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)tvc, sizeof(struct vcache)); /* XXX */
osi_NewVnode(void) {
struct vcache *tvc;
- tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
+ tvc = afs_osi_Alloc(sizeof(struct vcache));
+ osi_Assert(tvc != NULL);
tvc->v = NULL; /* important to clean this, or use memset 0 */
return tvc;
}
afs_new_authtab[i] = afs_osi_Alloc(sizeof(struct auth_ops));
+ osi_Assert(afs_new_authtab[i] != NULL);
*(afs_new_authtab[i]) = *(afs_orig_authtab[i]);
afs_new_authtab[i]->owner = THIS_MODULE;
afs_new_authtab[i]->accept = svcauth_afs_accept;
tvc = VTOAFS(ip);
#else
tvc = afs_osi_Alloc(sizeof(struct vcache));
+ osi_Assert(tvc != NULL);
ip->u.generic_ip = tvc;
tvc->v = ip;
#endif
struct vcache *
osi_NewVnode(void) {
- return (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
+ struct vcache *avc;
+
+ avc = afs_osi_Alloc(sizeof(struct vcache));
+ osi_Assert(avc != NULL);
+ return avc;
}
void
}
if (!tvc->linkData) {
- tvc->linkData = (char *)afs_osi_Alloc(alen);
+ tvc->linkData = afs_osi_Alloc(alen);
+ osi_Assert(tvc->linkData != NULL);
strncpy(tvc->linkData, atargetName, alen - 1);
tvc->linkData[alen - 1] = 0;
}
rbuf[alen - 1] = 0;
alen = strlen(rbuf) + 1;
tp = afs_osi_Alloc(alen); /* make room for terminating null */
+ osi_Assert(tp != NULL);
memcpy(tp, rbuf, alen);
osi_FreeLargeSpace(rbuf);
if (code != len) {
rbuf[alen - 1] = '\0';
alen = strlen(rbuf) + 1;
tp = afs_osi_Alloc(alen); /* make room for terminating null */
+ osi_Assert(tp != NULL);
memcpy(tp, rbuf, alen);
osi_FreeLargeSpace(rbuf);
if (code != tlen) {
if ((i = afs_InitReq(&treq, afs_osi_credp)))
return DUNNO;
v = afs_osi_Alloc(sizeof(*v));
+ osi_Assert(v != NULL);
tcell = afs_GetCell(afid->Cell, READ_LOCK);
bp = afs_cv2string(&tbuf[CVBS], afid->Fid.Volume);
do {
return i;
} else {
h = afs_osi_Alloc(sizeof(struct xfreelist));
+ osi_Assert(h != NULL);
afs_xaxscnt++;
xsp = xfreemallocs;
xfreemallocs = h;
abuffers = ((abuffers - 1) | (NPB - 1)) + 1;
afs_max_buffers = abuffers << 2; /* possibly grow up to 4 times as big */
LOCK_INIT(&afs_bufferLock, "afs_bufferLock");
- Buffers =
- (struct buffer *)afs_osi_Alloc(afs_max_buffers * sizeof(struct buffer));
+ Buffers = afs_osi_Alloc(afs_max_buffers * sizeof(struct buffer));
+ osi_Assert(Buffers != NULL);
timecounter = 1;
afs_stats_cmperf.bufAlloced = nbuffers = abuffers;
for (i = 0; i < PHSIZE; i++)
for (i = 0; i < abuffers; i++) {
if ((i & (NPB - 1)) == 0) {
/* time to allocate a fresh buffer */
- BufferData = (char *) afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB);
+ BufferData = afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB);
+ osi_Assert(BufferData != NULL);
}
/* Fill in each buffer with an empty indication. */
tb = &Buffers[i];
return 0;
}
- BufferData = (char *) afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB);
+ BufferData = afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB);
+ osi_Assert(BufferData != NULL);
for (i = 0; i< NPB; i++) {
/* Fill in each buffer with an empty indication. */
tp = &Buffers[i + nbuffers];
sizeof(struct afs_uspc_param), code);
namebufsz = mvParam->bufSz;
param1 = afs_osi_Alloc(namebufsz);
+ osi_Assert(param1 != NULL);
param2 = afs_osi_Alloc(namebufsz);
+ osi_Assert(param2 != NULL);
while (afs_initState < AFSOP_START_BKG)
afs_osi_Sleep(&afs_initState);
* home cell flag (0x1 bit) and the nosuid flag (0x2 bit) */
struct afsop_cell *tcell = afs_osi_Alloc(sizeof(struct afsop_cell));
+ osi_Assert(tcell != NULL);
code = afs_InitDynroot();
if (!code) {
AFS_COPYIN(AFSKPTR(parm2), (caddr_t)tcell->hosts, sizeof(tcell->hosts),
char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
int cflags = parm4;
+ osi_Assert(tcell != NULL);
+ osi_Assert(tbuffer != NULL);
+ osi_Assert(tbuffer1 != NULL);
code = afs_InitDynroot();
if (!code) {
#if 0
afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
int i;
+ osi_Assert(buffer != NULL);
+ osi_Assert(maskbuffer != NULL);
+ osi_Assert(mtubuffer != NULL);
/* This is a refresh */
if (count & 0x40000000) {
count &= ~0x40000000;
afs_int32 *kmsg = afs_osi_Alloc(kmsgLen);
char *cellname = afs_osi_Alloc(cellLen);
+ osi_Assert(kmsg != NULL);
+ osi_Assert(cellname != NULL);
#ifndef UKERNEL
afs_osi_MaskUserLoop();
#endif
*/
dataBytes = sizeof(struct afs_CMStats);
dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+ osi_Assert(dataBuffP != NULL);
memcpy((char *)dataBuffP, (char *)&afs_cmstats, dataBytes);
a_dataP->AFSCB_CollData_len = dataBytes >> 2;
a_dataP->AFSCB_CollData_val = dataBuffP;
afs_CountServers();
dataBytes = sizeof(afs_stats_cmperf);
dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+ osi_Assert(dataBuffP != NULL);
memcpy((char *)dataBuffP, (char *)&afs_stats_cmperf, dataBytes);
a_dataP->AFSCB_CollData_len = dataBytes >> 2;
a_dataP->AFSCB_CollData_val = dataBuffP;
dataBytes = sizeof(afs_stats_cmfullperf);
dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+ osi_Assert(dataBuffP != NULL);
memcpy((char *)dataBuffP, (char *)(&afs_stats_cmfullperf), dataBytes);
a_dataP->AFSCB_CollData_len = dataBytes >> 2;
a_dataP->AFSCB_CollData_val = dataBuffP;
p_name = tcell->cellName;
for (j = 0; j < AFSMAXCELLHOSTS && tcell->cellHosts[j]; j++);
i = strlen(p_name);
- a_hosts->serverList_val =
- (afs_int32 *) afs_osi_Alloc(j * sizeof(afs_int32));
+ a_hosts->serverList_val = afs_osi_Alloc(j * sizeof(afs_int32));
+ osi_Assert(a_hosts->serverList_val != NULL);
a_hosts->serverList_len = j;
for (j = 0; j < AFSMAXCELLHOSTS && tcell->cellHosts[j]; j++)
a_hosts->serverList_val[j] =
afs_PutCell(tcell, READ_LOCK);
}
- t_name = (char *)afs_osi_Alloc(i + 1);
+ t_name = afs_osi_Alloc(i + 1);
if (t_name == NULL) {
afs_osi_Free(a_hosts->serverList_val, (j * sizeof(afs_int32)));
RX_AFS_GUNLOCK();
plen = strlen(p_name);
else
plen = 0;
- t_name = (char *)afs_osi_Alloc(plen + 1);
+ t_name = afs_osi_Alloc(plen + 1);
if (t_name == NULL) {
if (tcell)
afs_PutCell(tcell, READ_LOCK);
* Currently only support version 1
*/
allocsize = sizeof(cm_initparams_v1);
- t_config = (afs_uint32 *) afs_osi_Alloc(allocsize);
+ t_config = afs_osi_Alloc(allocsize);
if (t_config == NULL) {
RX_AFS_GUNLOCK();
return ENOMEM;
for (sn = 0; sn < AFSMAXCELLHOSTS && tcell->cellHosts[sn]; sn++);
a_hosts->serverList_len = sn;
- a_hosts->serverList_val =
- (afs_int32 *) afs_osi_Alloc(sn * sizeof(afs_int32));
+ a_hosts->serverList_val = afs_osi_Alloc(sn * sizeof(afs_int32));
+ osi_Assert(a_hosts->serverList_val != NULL);
for (i = 0; i < sn; i++)
a_hosts->serverList_val[i] = ntohl(tcell->cellHosts[i]->addr->sa_ip);
RX_AFS_GUNLOCK();
dataBytes = 1 * sizeof(afs_uint32);
- dataBuffP = (afs_uint32 *) afs_osi_Alloc(dataBytes);
+ dataBuffP = afs_osi_Alloc(dataBytes);
+ osi_Assert(dataBuffP != NULL);
dataBuffP[0] = CLIENT_CAPABILITY_ERRORTRANS;
capabilities->Capabilities_len = dataBytes / sizeof(afs_uint32);
capabilities->Capabilities_val = dataBuffP;
if (cellnum == 0)
cellnum = afs_cellnum_next;
- cn = (struct cell_name *)afs_osi_Alloc(sizeof(*cn));
+ cn = afs_osi_Alloc(sizeof(*cn));
+ osi_Assert(cn != NULL);
cn->next = afs_cellname_head;
cn->cellnum = cellnum;
cn->cellname = afs_strdup(name);
}
UpgradeSToWLock(&afs_xcell, 682);
- tc = (struct cell_alias *)afs_osi_Alloc(sizeof(struct cell_alias));
+ tc = afs_osi_Alloc(sizeof(struct cell_alias));
+ osi_Assert(tc != NULL);
tc->alias = afs_strdup(alias);
tc->cell = afs_strdup(cell);
tc->next = afs_cellalias_head;
if (tc) {
aflags &= ~CNoSUID;
} else {
- tc = (struct cell *)afs_osi_Alloc(sizeof(struct cell));
+ tc = afs_osi_Alloc(sizeof(struct cell));
+ osi_Assert(tc != NULL);
memset(tc, 0, sizeof(*tc));
tc->cellName = afs_strdup(acellName);
tc->fsport = AFS_FSPORT;
* gets set, marking the time of its ``birth''.
*/
UpgradeSToWLock(&afs_xconn, 37);
- tc = (struct afs_conn *)afs_osi_Alloc(sizeof(struct afs_conn));
+ tc = afs_osi_Alloc(sizeof(struct afs_conn));
+ osi_Assert(tc != NULL);
memset(tc, 0, sizeof(struct afs_conn));
tc->user = tu;
if (!afs_freeDSList) {
/* none free, making one is better than a panic */
afs_stats_cmperf.dcacheXAllocs++; /* count in case we have a leak */
- tdc = (struct dcache *)afs_osi_Alloc(sizeof(struct dcache));
+ tdc = afs_osi_Alloc(sizeof(struct dcache));
+ osi_Assert(tdc != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)tdc, sizeof(struct dcache)); /* XXX */
#endif
if (!afs_freeDSList) {
/* none free, making one is better than a panic */
afs_stats_cmperf.dcacheXAllocs++; /* count in case we have a leak */
- tdc = (struct dcache *)afs_osi_Alloc(sizeof(struct dcache));
+ tdc = afs_osi_Alloc(sizeof(struct dcache));
+ osi_Assert(tdc != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)tdc, sizeof(struct dcache)); /* XXX */
#endif
if (aDentries > 512)
afs_dhashsize = 2048;
/* initialize hash tables */
- afs_dvhashTbl =
- (afs_int32 *) afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32));
- afs_dchashTbl =
- (afs_int32 *) afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32));
+ afs_dvhashTbl = afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32));
+ osi_Assert(afs_dvhashTbl != NULL);
+ afs_dchashTbl = afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32));
+ osi_Assert(afs_dchashTbl != NULL);
for (i = 0; i < afs_dhashsize; i++) {
afs_dvhashTbl[i] = NULLIDX;
afs_dchashTbl[i] = NULLIDX;
}
- afs_dvnextTbl = (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_int32));
- afs_dcnextTbl = (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_int32));
+ afs_dvnextTbl = afs_osi_Alloc(afiles * sizeof(afs_int32));
+ osi_Assert(afs_dvnextTbl != NULL);
+ afs_dcnextTbl = afs_osi_Alloc(afiles * sizeof(afs_int32));
+ osi_Assert(afs_dcnextTbl != NULL);
for (i = 0; i < afiles; i++) {
afs_dvnextTbl[i] = NULLIDX;
afs_dcnextTbl[i] = NULLIDX;
}
/* Allocate and zero the pointer array to the dcache entries */
- afs_indexTable = (struct dcache **)
- afs_osi_Alloc(sizeof(struct dcache *) * afiles);
+ afs_indexTable = afs_osi_Alloc(sizeof(struct dcache *) * afiles);
+ osi_Assert(afs_indexTable != NULL);
memset(afs_indexTable, 0, sizeof(struct dcache *) * afiles);
- afs_indexTimes =
- (afs_hyper_t *) afs_osi_Alloc(afiles * sizeof(afs_hyper_t));
+ afs_indexTimes = afs_osi_Alloc(afiles * sizeof(afs_hyper_t));
+ osi_Assert(afs_indexTimes != NULL);
memset(afs_indexTimes, 0, afiles * sizeof(afs_hyper_t));
- afs_indexUnique =
- (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_uint32));
+ afs_indexUnique = afs_osi_Alloc(afiles * sizeof(afs_uint32));
+ osi_Assert(afs_indexUnique != NULL);
memset(afs_indexUnique, 0, afiles * sizeof(afs_uint32));
- afs_indexFlags = (u_char *) afs_osi_Alloc(afiles * sizeof(u_char));
+ afs_indexFlags = afs_osi_Alloc(afiles * sizeof(u_char));
+ osi_Assert(afs_indexFlags != NULL);
memset(afs_indexFlags, 0, afiles * sizeof(char));
/* Allocate and thread the struct dcache entries themselves */
tdp = afs_Initial_freeDSList =
- (struct dcache *)afs_osi_Alloc(aDentries * sizeof(struct dcache));
+ afs_osi_Alloc(aDentries * sizeof(struct dcache));
+ osi_Assert(tdp != NULL);
memset(tdp, 0, aDentries * sizeof(struct dcache));
#ifdef KERNEL_HAVE_PIN
pin((char *)afs_indexTable, sizeof(struct dcache *) * afiles); /* XXX */
ReleaseWriteLock(&afs_xdcache);
/* Alloc a 4k block. */
- data = (char *) afs_osi_Alloc(4096);
+ data = afs_osi_Alloc(4096);
if (!data) {
afs_warn("afs_MakeShadowDir: could not alloc data\n");
ret_code = ENOMEM;
old_pdir_fid.Fid.Unique = avc->f.oldParent.unique;
/* Get old name. */
- old_name = (char *) afs_osi_Alloc(AFSNAMEMAX);
+ old_name = afs_osi_Alloc(AFSNAMEMAX);
if (!old_name) {
/* printf("afs_ProcessOpRename: Couldn't alloc space for old name.\n"); */
return ENOMEM;
}
/* Alloc data first. */
- new_name = (char *) afs_osi_Alloc(AFSNAMEMAX);
+ new_name = afs_osi_Alloc(AFSNAMEMAX);
if (!new_name) {
/* printf("afs_ProcessOpRename: Couldn't alloc space for new name.\n"); */
code = ENOMEM;
}
dotLen = strlen(c->cellName) + 2;
dotCell = afs_osi_Alloc(dotLen);
+ osi_Assert(dotCell != NULL);
strcpy(dotCell, ".");
afs_strcat(dotCell, c->cellName);
dotLen = strlen(ca->alias) + 2;
dotCell = afs_osi_Alloc(dotLen);
+ osi_Assert(dotCell != NULL);
strcpy(dotCell, ".");
afs_strcat(dotCell, ca->alias);
dirSize = (curPage + 1) * AFS_PAGESIZE;
newDir = afs_osi_Alloc(dirSize);
+ osi_Assert(newDir != NULL);
/*
* Now actually construct the directory.
dotLen = strlen(c->cellName) + 2;
dotCell = afs_osi_Alloc(dotLen);
+ osi_Assert(dotCell != NULL);
strcpy(dotCell, ".");
afs_strcat(dotCell, c->cellName);
afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, c->cellName,
dotLen = strlen(ca->alias) + 2;
dotCell = afs_osi_Alloc(dotLen);
+ osi_Assert(dotCell != NULL);
strcpy(dotCell, ".");
afs_strcat(dotCell, ca->alias);
afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ca->alias,
struct DirHeader *dirHeader;
newDir = afs_osi_Alloc(AFS_PAGESIZE);
+ osi_Assert(newDir != NULL);
/*
* Now actually construct the directory.
if (ts) {
linklen = strlen(ts->target);
avc->linkData = afs_osi_Alloc(linklen + 1);
+ osi_Assert(avc->linkData != NULL);
strcpy(avc->linkData, ts->target);
status->Length = linklen;
int namelen = strlen(realName);
linklen = rw + namelen;
avc->linkData = afs_osi_Alloc(linklen + 1);
+ osi_Assert(avc->linkData != NULL);
strcpy(avc->linkData, rw ? "." : "");
afs_strcat(avc->linkData, realName);
}
bp = afs_cv2string(&tbuf[CVBS], avc->f.fid.Fid.Unique);
linklen = 2 + namelen + strlen(bp);
avc->linkData = afs_osi_Alloc(linklen + 1);
+ osi_Assert(avc->linkData != NULL);
strcpy(avc->linkData, "%");
afs_strcat(avc->linkData, c->cellName);
afs_strcat(avc->linkData, ":");
namelen = strlen(c->cellName);
linklen = 1 + namelen + 10;
avc->linkData = afs_osi_Alloc(linklen + 1);
+ osi_Assert(avc->linkData != NULL);
strcpy(avc->linkData, rw ? "%" : "#");
afs_strcat(avc->linkData, c->cellName);
afs_strcat(avc->linkData, ":root.cell");
/* Doesn't already exist -- go ahead and create it */
tps = afs_osi_Alloc(sizeof(*tps));
+ osi_Assert(tps != NULL);
tps->index = afs_dynSymlinkIndex++;
tps->next = afs_dynSymlinkBase;
tps->name = afs_osi_Alloc(strlen(aname) + 1);
+ osi_Assert(tps->name != NULL);
strcpy(tps->name, aname);
tps->target = afs_osi_Alloc(strlen(atargetName) + 1);
+ osi_Assert(tps->target != NULL);
strcpy(tps->target, atargetName);
afs_dynSymlinkBase = tps;
ReleaseWriteLock(&afs_dynSymlinkLock);
LOCK_INIT(&afs_xexp, "afs_xexp");
}
length = (size ? size : sizeof(struct afs_exporter));
- ex = (struct afs_exporter *)afs_osi_Alloc(length);
+ ex = afs_osi_Alloc(length);
+ osi_Assert(ex != NULL);
memset(ex, 0, length);
ObtainWriteLock(&afs_xexp, 308);
for (op = root_exported; op; op = op->exp_next) {
/* we weren't passed in a hint and it wasn't set */
logp->logSize = ICL_DEFAULT_LOGSIZE;
}
- logp->datap =
- (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logp->logSize);
+ logp->datap = afs_osi_Alloc(sizeof(afs_int32) * logp->logSize);
+ osi_Assert(logp->datap != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)logp->datap, sizeof(afs_int32) * logp->logSize);
#endif
#ifdef KERNEL_HAVE_PIN
unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize);
#endif
- logp->datap =
- (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logSize);
+ logp->datap = afs_osi_Alloc(sizeof(afs_int32) * logSize);
+ osi_Assert(logp->datap != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)logp->datap, sizeof(afs_int32) * logSize);
#endif
strcpy(setp->name, name);
setp->nevents = ICL_DEFAULTEVENTS;
setp->eventFlags = afs_osi_Alloc(ICL_DEFAULTEVENTS);
+ osi_Assert(setp->eventFlags != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)setp->eventFlags, ICL_DEFAULTEVENTS);
#endif
else if (aVolumes > 32767)
aVolumes = 32767;
- tv = (struct volume *)afs_osi_Alloc(aVolumes * sizeof(struct volume));
+ tv = afs_osi_Alloc(aVolumes * sizeof(struct volume));
+ osi_Assert(tv != NULL);
for (i = 0; i < aVolumes - 1; i++)
tv[i].next = &tv[i + 1];
tv[aVolumes - 1].next = NULL;
afs_resourceinit_flag = 1;
for (i = 0; i < NFENTRIES; i++)
fvTable[i] = 0;
- for (i = 0; i < MAXNUMSYSNAMES; i++)
+ for (i = 0; i < MAXNUMSYSNAMES; i++) {
afs_sysnamelist[i] = afs_osi_Alloc(MAXSYSNAME);
+ osi_Assert(afs_sysnamelist[i] != NULL);
+ }
afs_sysname = afs_sysnamelist[0];
strcpy(afs_sysname, SYS_NAME);
afs_sysnamecount = 1;
memCacheBlkSize = blkSize;
memMaxBlkNumber = blkCount;
- memCache = (struct memCacheEntry *)
+ memCache =
afs_osi_Alloc(memMaxBlkNumber * sizeof(struct memCacheEntry));
+ osi_Assert(memCache != NULL);
for (index = 0; index < memMaxBlkNumber; index++) {
char *blk;
return np;
}
}
- np = (struct nfsclientpag *)afs_osi_Alloc(sizeof(struct nfsclientpag));
+ np = afs_osi_Alloc(sizeof(struct nfsclientpag));
+ osi_Assert(np != NULL);
memset(np, 0, sizeof(struct nfsclientpag));
/* Copy the necessary afs_exporter fields */
memcpy((char *)np, (char *)afs_nfsexporter, sizeof(struct afs_exporter));
}
for(count=0; count < *num;++count) {
np->sysname[count]= afs_osi_Alloc(MAXSYSNAME);
+ osi_Assert(np->sysname[count] != NULL);
}
cp = inname;
for(count=0; count < *num;++count) {
char *p;
afs_stats_cmperf.LargeBlocksAlloced++;
- p = (char *)afs_osi_Alloc(AFS_LRALLOCSIZ);
+ p = afs_osi_Alloc(AFS_LRALLOCSIZ);
#ifdef KERNEL_HAVE_PIN
/*
* Need to pin this memory since under heavy conditions this memory
afs_resourceinit_flag = 1;
afs_nfs_server_addr = nfs_server_addr;
- for (i = 0; i < MAXNUMSYSNAMES; i++)
+ for (i = 0; i < MAXNUMSYSNAMES; i++) {
afs_sysnamelist[i] = afs_osi_Alloc(MAXSYSNAME);
+ osi_Assert(afs_sysnamelist[i] != NULL);
+ }
afs_sysname = afs_sysnamelist[0];
strcpy(afs_sysname, SYS_NAME);
afs_sysnamecount = 1;
}
if (!tcell) {
- tcell = (struct afspag_cell *)afs_osi_Alloc(sizeof(struct afspag_cell));
+ tcell = afs_osi_Alloc(sizeof(struct afspag_cell));
if (!tcell)
goto out;
- tcell->cellname = (char *)afs_osi_Alloc(strlen(acell) + 1);
+ tcell->cellname = afs_osi_Alloc(strlen(acell) + 1);
if (!tcell->cellname) {
afs_osi_Free(tcell, sizeof(struct afspag_cell));
tcell = 0;
return UAESRCH;
}
- a_creds->CredInfos_val =
- (CredInfo *)afs_osi_Alloc(count * sizeof(CredInfo));
+ a_creds->CredInfos_val = afs_osi_Alloc(count * sizeof(CredInfo));
if (!a_creds->CredInfos_val)
goto out;
a_creds->CredInfos_len = count;
char *Name;
XSTATS_DECLS;
+ osi_Assert(offLineMsg != NULL);
+ osi_Assert(motd != NULL);
AFS_STATCNT(PGetVolumeStatus);
if (!avc) {
code = EINVAL;
if (vlonly) {
afs_int32 *p;
- p = (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * (s + 1));
+ p = afs_osi_Alloc(sizeof(afs_int32) * (s + 1));
+ osi_Assert(p != NULL);
p[0] = s;
memcpy(p + 1, l, s * sizeof(afs_int32));
afs_TraverseCells(&ReSortCells_cb, p);
}
addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs));
+ osi_Assert(addrs != NULL);
j = 0;
for (i = 0; i < NSERVERS; i++) {
for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) {
struct dcache *tdc;
void *zeros;
- zeros = (void *) afs_osi_Alloc(AFS_PAGESIZE);
+ zeros = afs_osi_Alloc(AFS_PAGESIZE);
if (zeros == NULL)
return ENOMEM;
memset(zeros, 0, AFS_PAGESIZE);
}
addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs));
+ osi_Assert(addrs != NULL);
j = 0;
for (i = 0; i < NSERVERS; i++) {
for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) {
}
addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs));
+ osi_Assert(addrs != NULL);
j = 0;
for (i = 0; i < NSERVERS; i++) {
for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) {
ReleaseReadLock(&afs_xsrvAddr);
ReleaseReadLock(&afs_xserver);
- conns = (struct afs_conn **)afs_osi_Alloc(j * sizeof(struct afs_conn *));
- rxconns = (struct rx_connection **)afs_osi_Alloc(j * sizeof(struct rx_connection *));
- conntimer = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32));
- deltas = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32));
- results = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32));
-
- caps = (Capabilities *)afs_osi_Alloc(j * sizeof (Capabilities));
+ conns = afs_osi_Alloc(j * sizeof(struct afs_conn *));
+ osi_Assert(conns != NULL);
+ rxconns = afs_osi_Alloc(j * sizeof(struct rx_connection *));
+ osi_Assert(rxconns != NULL);
+ conntimer = afs_osi_Alloc(j * sizeof (afs_int32));
+ osi_Assert(conntimer != NULL);
+ deltas = afs_osi_Alloc(j * sizeof (afs_int32));
+ osi_Assert(deltas != NULL);
+ results = afs_osi_Alloc(j * sizeof (afs_int32));
+ osi_Assert(results != NULL);
+
+ caps = afs_osi_Alloc(j * sizeof (Capabilities));
+ osi_Assert(caps != NULL);
memset(caps, 0, j * sizeof(Capabilities));
for (i = 0; i < j; i++) {
if (oldts) {
newts = oldts;
} else {
- newts = (struct server *)afs_osi_Alloc(sizeof(struct server));
+ newts = afs_osi_Alloc(sizeof(struct server));
if (!newts)
panic("malloc of server struct");
afs_totalServers++;
if (oldsa) {
newsa = oldsa;
} else {
- newsa = (struct srvAddr *)afs_osi_Alloc(sizeof(struct srvAddr));
+ newsa = afs_osi_Alloc(sizeof(struct srvAddr));
if (!newsa)
panic("malloc of srvAddr struct");
afs_totalSrvAddrs++;
/* Have a srvAddr struct. Now get a server struct (if not already) */
if (!orphts) {
- orphts =
- (struct server *)afs_osi_Alloc(sizeof(struct server));
+ orphts = afs_osi_Alloc(sizeof(struct server));
if (!orphts)
panic("malloc of lo server struct");
memset(orphts, 0, sizeof(struct server));
struct tokenJar *newToken;
newToken = afs_osi_Alloc(sizeof(struct tokenJar));
+ osi_Assert(newToken != NULL);
memset(newToken, 0, sizeof(*newToken));
newToken->type = type;
rxkad = &tokenU->rxkad;
rxkad->ticket = afs_osi_Alloc(ticketLen);
+ osi_Assert(rxkad->ticket != NULL);
rxkad->ticketLen = ticketLen;
memcpy(rxkad->ticket, ticket, ticketLen);
rxkad->clearToken = *clearToken;
}
}
}
- tu = (struct unixuser *)afs_osi_Alloc(sizeof(struct unixuser));
+ tu = afs_osi_Alloc(sizeof(struct unixuser));
+ osi_Assert(tu != NULL);
#ifndef AFS_NOSTATS
afs_stats_cmfullperf.authent.PAGCreations++;
#endif /* AFS_NOSTATS */
int cc;
cc = strlen(s) + 1;
- n = (char *)afs_osi_Alloc(cc);
+ n = afs_osi_Alloc(cc);
if (n)
memcpy(n, s, cc);
afs_stats_cmperf.CallBackFlushes++;
} else {
/* try allocating */
- tsp =
- (struct afs_cbr *)afs_osi_Alloc(AFS_NCBRS *
- sizeof(struct afs_cbr));
+ tsp = afs_osi_Alloc(AFS_NCBRS * sizeof(struct afs_cbr));
+ osi_Assert(tsp != NULL);
for (i = 0; i < AFS_NCBRS - 1; i++) {
tsp[i].next = &tsp[i + 1];
tsp[i].dynalloc = 0;
return code;
treq.flags |= O_NONBLOCK;
tfids = afs_osi_Alloc(sizeof(struct AFSFid) * AFS_MAXCBRSCALL);
+ osi_Assert(tfids != NULL);
if (lockit)
ObtainWriteLock(&afs_xvcb, 273);
#if !defined(AFS_LINUX22_ENV)
/* Allocate and thread the struct vcache entries */
- tvp = (struct vcache *)afs_osi_Alloc(astatSize * sizeof(struct vcache));
+ tvp = afs_osi_Alloc(astatSize * sizeof(struct vcache));
+ osi_Assert(tvp != NULL);
memset(tvp, 0, sizeof(struct vcache) * astatSize);
Initial_freeVCList = tvp;
if (!afs_freeVolList) {
struct volume *newVp;
- newVp = (struct volume *)afs_osi_Alloc(sizeof(struct volume));
+ newVp = afs_osi_Alloc(sizeof(struct volume));
+ osi_Assert(newVp != NULL);
newVp->next = NULL;
afs_freeVolList = newVp;
for (tv = afs_volumes[i]; tv; tv = tv->next)
++vsize;
- volumeID = (afs_int32 *) afs_osi_Alloc(2 * vsize * sizeof(*volumeID));
+ volumeID = afs_osi_Alloc(2 * vsize * sizeof(*volumeID));
cellID = (volumeID) ? volumeID + vsize : 0;
}
if (agood) {
if (!tv->name) {
tv->name = afs_osi_Alloc(strlen(aname) + 1);
+ osi_Assert(tv->name != NULL);
strcpy(tv->name, aname);
}
}
if (!tcell)
return NULL;
tve = afs_osi_Alloc(sizeof(*tve));
+ osi_Assert(tve != NULL);
if (!(tcell->states & CHasVolRef))
tcell->states |= CHasVolRef;