struct vldbentry tve;
struct nvldbentry ntve;
struct uvldbentry utve;
- } v;
+ } *v;
struct volume *tvp;
struct cell *tcell;
char *bp, tbuf[CVBS]; /* biggest volume id is 2^32, ~ 4*10^9 */
afs_FinalizeReq(areq);
if ((i = afs_InitReq(&treq, &afs_osi_cred))) return DUNNO;
+ v = afs_osi_Alloc(sizeof(*v));
tcell = afs_GetCell(afid->Cell, READ_LOCK);
bp = afs_cv2string(&tbuf[CVBS], afid->Fid.Volume);
do {
if (tconn->srvr->server->flags & SNO_LHOSTS) {
type = 0;
RX_AFS_GUNLOCK();
- i = VL_GetEntryByNameO(tconn->id, bp, &v.tve);
+ i = VL_GetEntryByNameO(tconn->id, bp, &v->tve);
RX_AFS_GLOCK();
} else if (tconn->srvr->server->flags & SYES_LHOSTS) {
type = 1;
RX_AFS_GUNLOCK();
- i = VL_GetEntryByNameN(tconn->id, bp, &v.ntve);
+ i = VL_GetEntryByNameN(tconn->id, bp, &v->ntve);
RX_AFS_GLOCK();
} else {
type = 2;
RX_AFS_GUNLOCK();
- i = VL_GetEntryByNameU(tconn->id, bp, &v.utve);
+ i = VL_GetEntryByNameU(tconn->id, bp, &v->utve);
RX_AFS_GLOCK();
if (!(tconn->srvr->server->flags & SVLSRV_UUID)) {
if (i == RXGEN_OPCODE) {
type = 1;
RX_AFS_GUNLOCK();
- i = VL_GetEntryByNameN(tconn->id, bp, &v.ntve);
+ i = VL_GetEntryByNameN(tconn->id, bp, &v->ntve);
RX_AFS_GLOCK();
if (i == RXGEN_OPCODE) {
type = 0;
tconn->srvr->server->flags |= SNO_LHOSTS;
RX_AFS_GUNLOCK();
- i = VL_GetEntryByNameO(tconn->id, bp, &v.tve);
+ i = VL_GetEntryByNameO(tconn->id, bp, &v->tve);
RX_AFS_GLOCK();
} else if (!i)
tconn->srvr->server->flags |= SYES_LHOSTS;
ICL_TYPE_INT32, i);
if (i) {
+ afs_osi_Free(v, sizeof(*v));
return DUNNO;
}
/* have info, copy into serverHost array */
}
if (type == 2) {
- InstallUVolumeEntry(tvp, &v.utve, afid->Cell, tcell, &treq);
+ InstallUVolumeEntry(tvp, &v->utve, afid->Cell, tcell, &treq);
}
else if (type == 1) {
- InstallNVolumeEntry(tvp, &v.ntve, afid->Cell);
+ InstallNVolumeEntry(tvp, &v->ntve, afid->Cell);
}
else {
- InstallVolumeEntry(tvp, &v.tve, afid->Cell);
+ InstallVolumeEntry(tvp, &v->tve, afid->Cell);
}
if (i < NMAXNSERVERS && tvp->serverHost[i]) {
tvp = afs_GetVolume(afid, &treq, WRITE_LOCK);
if (tvp) {
afs_PutVolume(tvp, WRITE_LOCK);
+ afs_osi_Free(v, sizeof(*v));
return DIFFERENT;
}
- else return DUNNO;
+ else {
+ afs_osi_Free(v, sizeof(*v));
+ return DUNNO;
+ }
}
+ afs_osi_Free(v, sizeof(*v));
return (changed ? DIFFERENT : SAME);
} /*VLDB_Same */
/* add a cell. Parameter 2 is 8 hosts (in net order), parm 3 is the null-terminated
name. Parameter 4 is the length of the name, including the null. Parm 5 is the
home cell flag (0x1 bit) and the nosuid flag (0x2 bit) */
- struct afsop_cell tcell;
+ struct afsop_cell *tcell = afs_osi_Alloc(sizeof(struct afsop_cell));
- AFS_COPYIN((char *)parm2, (char *)tcell.hosts, sizeof(tcell.hosts), code);
+ AFS_COPYIN((char *)parm2, (char *)tcell->hosts, sizeof(tcell->hosts), code);
if (!code) {
- if (parm4 > sizeof(tcell.cellName))
+ if (parm4 > sizeof(tcell->cellName))
code = EFAULT;
else {
- AFS_COPYIN((char *)parm3, tcell.cellName, parm4, code);
+ AFS_COPYIN((char *)parm3, tcell->cellName, parm4, code);
if (!code)
- afs_NewCell(tcell.cellName, tcell.hosts, parm5,
+ afs_NewCell(tcell->cellName, tcell->hosts, parm5,
NULL, 0, 0, 0);
}
}
+ afs_osi_Free(tcell, sizeof(struct afsop_cell));
} else if (parm == AFSOP_ADDCELL2) {
- struct afsop_cell tcell;
+ struct afsop_cell *tcell = afs_osi_Alloc(sizeof(struct afsop_cell));
char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *lcnamep = 0;
char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
int cflags = parm4;
while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
#endif
- AFS_COPYIN((char *)parm2, (char *)tcell.hosts, sizeof(tcell.hosts), code);
+ AFS_COPYIN((char *)parm2, (char *)tcell->hosts, sizeof(tcell->hosts), code);
if (!code) {
AFS_COPYINSTR((char *)parm3, tbuffer1, AFS_SMALLOCSIZ, &bufferSize, code);
if (!code) {
}
}
if (!code)
- code = afs_NewCell(tbuffer1, tcell.hosts, cflags,
+ code = afs_NewCell(tbuffer1, tcell->hosts, cflags,
lcnamep, 0, 0, 0);
}
}
+ afs_osi_Free(tcell, sizeof(struct afsop_cell));
osi_FreeSmallSpace(tbuffer);
osi_FreeSmallSpace(tbuffer1);
}
else if (parm == AFSOP_ADVISEADDR) {
/* pass in the host address to the rx package */
afs_int32 count = parm2;
- afs_int32 buffer[AFS_MAX_INTERFACE_ADDR];
- afs_int32 maskbuffer[AFS_MAX_INTERFACE_ADDR];
- afs_int32 mtubuffer[AFS_MAX_INTERFACE_ADDR];
+ afs_int32 *buffer = afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
+ afs_int32 *maskbuffer = afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
+ afs_int32 *mtubuffer = afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
int i;
int code;
}
afs_uuid_create(&afs_cb_interface.uuid);
rxi_setaddr(buffer[0]);
+ afs_osi_Free(buffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
+ afs_osi_Free(maskbuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
+ afs_osi_Free(mtubuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
}
#ifdef AFS_SGI53_ENV
DECL_PIOCTL(PGetVolumeStatus)
{
char volName[32];
- char offLineMsg[256];
- char motd[256];
+ char *offLineMsg = afs_osi_Alloc(256);
+ char *motd = afs_osi_Alloc(256);
register struct conn *tc;
- register afs_int32 code;
+ register afs_int32 code = 0;
struct VolumeStatus volstat;
register char *cp;
char *Name, *OfflineMsg, *MOTD;
XSTATS_DECLS;
AFS_STATCNT(PGetVolumeStatus);
- if (!avc) return EINVAL;
+ if (!avc) {
+ code = EINVAL;
+ goto out;
+ }
Name = volName;
OfflineMsg = offLineMsg;
MOTD = motd;
AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS,
SHARED_LOCK, NULL));
- if (code) return code;
+ if (code) goto out;
/* Copy all this junk into msg->im_data, keeping track of the lengths. */
cp = aout;
memcpy(cp, (char *)&volstat, sizeof(VolumeStatus));
strcpy(cp, motd);
cp += strlen(motd)+1;
*aoutSize = (cp - aout);
- return 0;
+out:
+ afs_osi_Free(offLineMsg, 256);
+ afs_osi_Free(motd, 256);
+ return code;
}
DECL_PIOCTL(PSetVolumeStatus)
{
char volName[32];
- char offLineMsg[256];
- char motd[256];
+ char *offLineMsg = afs_osi_Alloc(256);
+ char *motd = afs_osi_Alloc(256);
register struct conn *tc;
- register afs_int32 code;
+ register afs_int32 code = 0;
struct AFSFetchVolumeStatus volstat;
struct AFSStoreVolumeStatus storeStat;
register struct volume *tvp;
AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS,
SHARED_LOCK, NULL));
- if (code) return code;
+ if (code) goto out;
/* we are sending parms back to make compat. with prev system. should
change interface later to not ask for current status, just set new status */
cp = aout;
strcpy(cp, motd);
cp += strlen(motd)+1;
*aoutSize = cp - aout;
- return 0;
+out:
+ afs_osi_Free(offLineMsg, 256);
+ afs_osi_Free(motd, 256);
+ return code;
}
DECL_PIOCTL(PFlush)
*/
afs_int32 afs_FlushVCBs (afs_int32 lockit)
{
- struct AFSFid tfids[AFS_MAXCBRSCALL];
+ struct AFSFid *tfids;
struct AFSCallBack callBacks[1];
struct AFSCBFids fidArray;
struct AFSCBs cbArray;
if ((code = afs_InitReq(&treq, &afs_osi_cred))) return code;
treq.flags |= O_NONBLOCK;
+ tfids = afs_osi_Alloc(sizeof(struct AFSFid) * AFS_MAXCBRSCALL);
if (lockit) MObtainWriteLock(&afs_xvcb,273);
ObtainReadLock(&afs_xserver);
ReleaseReadLock(&afs_xserver);
if (lockit) MReleaseWriteLock(&afs_xvcb);
+ afs_osi_Free(tfids, sizeof(struct AFSFid) * AFS_MAXCBRSCALL);
return 0;
}
{
struct cell *tcell;
struct volume *tv;
- struct vldbentry tve;
+ struct vldbentry *tve;
char *bp, tbuf[CVBS];
tcell = afs_GetCell(fid->Cell, READ_LOCK);
if (!tcell)
return NULL;
+ tve = afs_osi_Alloc(sizeof(*tve));
if (!(tcell->states & CHasVolRef))
tcell->states |= CHasVolRef;
bp = afs_cv2string(&tbuf[CVBS], fid->Fid.Volume);
- memset(&tve, 0, sizeof(tve));
- strcpy(tve.name, "local-dynroot");
- tve.volumeId[ROVOL] = fid->Fid.Volume;
- tve.flags = VLF_ROEXISTS;
+ memset(tve, 0, sizeof(*tve));
+ strcpy(tve->name, "local-dynroot");
+ tve->volumeId[ROVOL] = fid->Fid.Volume;
+ tve->flags = VLF_ROEXISTS;
- tv = afs_SetupVolume(0, bp, (char *) &tve, tcell, 0, 0, 0);
+ tv = afs_SetupVolume(0, bp, tve, tcell, 0, 0, 0);
afs_PutCell(tcell, READ_LOCK);
+ afs_osi_Free(tve, sizeof(*tve));
return tv;
}