return FALSE;
}
if (!abbs->SeqBody)
- abbs->SeqBody = (char *)NVALLOC(len);
+ abbs->SeqBody = NVALLOC(len);
abbs->SeqLen = len;
xdr_opaque(x, abbs->SeqBody, len);
return TRUE;
return FALSE;
}
if (!abbs->SeqBody)
- abbs->SeqBody = (char *)NVALLOC(maxLen);
+ abbs->SeqBody = NVALLOC(maxLen);
abbs->MaxSeqLen = maxLen;
abbs->SeqLen = len;
xdr_opaque(x, abbs->SeqBody, len);
return FALSE;
}
if (!abbs->SeqBody)
- abbs->SeqBody = (char *)NVALLOC(maxLen);
+ abbs->SeqBody = NVALLOC(maxLen);
abbs->MaxSeqLen = maxLen;
abbs->SeqLen = len;
xdr_opaque(x, abbs->SeqBody, len);
t = sizeof(struct acl_accessList) + (nEntries -
1) * sizeof(struct acl_accessEntry);
if (GetFromList(&freeList, &e, t) < 0) {
- e = (struct freeListEntry *)malloc(t + sizeof(int) +
- sizeof(struct freeListEntry *));
+ e = malloc(t + sizeof(int) + sizeof(struct freeListEntry *));
if (e == NULL) {
perror("acl_NewACL: malloc() failed");
abort();
* name plus decimal 2**32 (for largest rights mask) plus some formatting */
if (GetFromList(&freeList, &e, t)) {
- e = (struct freeListEntry *)malloc(t + sizeof(int) +
- sizeof(struct freeListEntry *));
+ e = malloc(t + sizeof(int) + sizeof(struct freeListEntry *));
if (e == NULL) {
perror("acl_NewExternalACL(): malloc() failed");
abort();
return 0;
}
lnames.namelist_len = (*acl)->total;
- lnames.namelist_val =
- (prname *) malloc(lnames.namelist_len * PR_MAXNAMELEN);
+ lnames.namelist_val = malloc(lnames.namelist_len * PR_MAXNAMELEN);
if (lnames.namelist_val == 0) {
return -1;
}
if (externalstore[which] != NULL) {
/* we're adding to access list */
size = strlen(externalstore[which]);
- ptr = (char *)malloc(size);
+ ptr = malloc(size);
sscanf(externalstore[which], "%d\n%d\n", &p, &n);
strncpy(ptr, externalstore[which], size);
p++;
continue;
}
names.namelist_len = 1;
- names.namelist_val = (prname *) malloc(strlen(name) + 1);
+ names.namelist_val = malloc(strlen(name) + 1);
strncpy(names.namelist_val, name, PR_MAXNAMELEN);
code = pr_NameToId(&names, &ids);
if (code) {
if (strncmp(dk->name, name, len) == 0 && dk->name[len] == 0)
return (dk);
}
- if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL)
+ if ((*dkp = malloc(sizeof(struct disk))) == NULL)
errexit("out of memory");
dk = *dkp;
if ((dk->name = strdup(name)) == NULL)
printf("%s in fstab more than once!\n", name);
return;
}
- if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL)
+ if ((*ppt = malloc(sizeof(struct part))) == NULL)
errexit("out of memory");
pt = *ppt;
if ((pt->name = strdup(name)) == NULL)
n_files++;
lncntp[inumber] = dp->di_nlink;
if (dp->di_nlink <= 0) {
- zlnp = (struct zlncnt *)malloc(sizeof *zlnp);
+ zlnp = malloc(sizeof *zlnp);
if (zlnp == NULL) {
pfatal("LINK COUNT TABLE OVERFLOW");
if (reply("CONTINUE") == 0)
#endif
return (STOP);
}
- new = (struct dups *)malloc(sizeof(struct dups));
+ new = malloc(sizeof(struct dups));
if (new == NULL) {
pfatal("DUP TABLE OVERFLOW.");
if (reply("CONTINUE") == 0)
valueresid = 0;
}
if (valueresid == 0) {
- entry = (struct prop_entry_desc *)
- malloc(sizeof(struct prop_entry_desc));
+ entry = malloc(sizeof(struct prop_entry_desc));
if (entry == NULL)
return (SKIP);
entry->next = NULL;
if (bufcnt < MINBUFS)
bufcnt = MINBUFS;
for (i = 0; i < bufcnt; i++) {
- bp = (struct bufarea *)malloc(sizeof(struct bufarea));
+ bp = malloc(sizeof(struct bufarea));
bufp = malloc((unsigned int)sblock.fs_bsize);
if (bp == NULL || bufp == NULL) {
if (i >= MINBUFS)
if (size > len)
size = len;
- buff = (char *)malloc(COPYBUFFSIZE);
+ buff = malloc(COPYBUFFSIZE);
if (buff == NULL) {
return EIO;
}
}
/* allocate space for return output parameters */
- OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
- malloc(nfiles * sizeof(struct AFSFetchStatus));
+ OutStats->AFSBulkStats_val = malloc(nfiles * sizeof(struct AFSFetchStatus));
if (!OutStats->AFSBulkStats_val) {
ViceLogThenPanic(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
}
OutStats->AFSBulkStats_len = nfiles;
- CallBacks->AFSCBs_val = (struct AFSCallBack *)
- malloc(nfiles * sizeof(struct AFSCallBack));
+ CallBacks->AFSCBs_val = malloc(nfiles * sizeof(struct AFSCallBack));
if (!CallBacks->AFSCBs_val) {
ViceLogThenPanic(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
}
* for the File Server.
*/
dataBytes = sizeof(struct afs_Stats);
- dataBuffP = (afs_int32 *) malloc(dataBytes);
+ dataBuffP = malloc(dataBytes);
memcpy(dataBuffP, &afs_cmstats, dataBytes);
a_dataP->AFS_CollData_len = dataBytes >> 2;
a_dataP->AFS_CollData_val = dataBuffP;
*/
dataBytes = sizeof(struct afs_PerfStats);
- dataBuffP = (afs_int32 *) malloc(dataBytes);
+ dataBuffP = malloc(dataBytes);
memcpy(dataBuffP, &afs_perfstats, dataBytes);
a_dataP->AFS_CollData_len = dataBytes >> 2;
a_dataP->AFS_CollData_val = dataBuffP;
*/
dataBytes = sizeof(struct fs_stats_FullPerfStats);
- dataBuffP = (afs_int32 *) malloc(dataBytes);
+ dataBuffP = malloc(dataBytes);
memcpy(dataBuffP, &afs_FullPerfStats, dataBytes);
a_dataP->AFS_CollData_len = dataBytes >> 2;
a_dataP->AFS_CollData_val = dataBuffP;
afs_perfstats.numPerfCalls++;
dataBytes = sizeof(struct cbcounters);
- dataBuffP = (afs_int32 *) malloc(dataBytes);
+ dataBuffP = malloc(dataBytes);
{
extern struct cbcounters cbstuff;
dataBuffP[0]=cbstuff.DeleteFiles;
goto Bad_GetCaps;
dataBytes = 1 * sizeof(afs_int32);
- dataBuffP = (afs_uint32 *) malloc(dataBytes);
+ dataBuffP = malloc(dataBytes);
dataBuffP[0] = VICED_CAPABILITY_ERRORTRANS | VICED_CAPABILITY_WRITELOCKACL;
dataBuffP[0] |= VICED_CAPABILITY_64BITFILES;
if (saneacls)
ViceLog(2, ("SAFS_GetVolumeStatus returns %d\n", errorCode));
/* next is to guarantee out strings exist for stub */
if (*Name == 0) {
- *Name = (char *)malloc(1);
+ *Name = malloc(1);
**Name = 0;
}
if (*Motd == 0) {
- *Motd = (char *)malloc(1);
+ *Motd = malloc(1);
**Motd = 0;
}
if (*OfflineMsg == 0) {
- *OfflineMsg = (char *)malloc(1);
+ *OfflineMsg = malloc(1);
**OfflineMsg = 0;
}
errorCode = CallPostamble(tcon, errorCode, thost);
static afs_int32
FetchProc(struct rx_call *acall)
{
- extern char *malloc();
char *tbuffer;
afs_int32 tlen, length, code;
static afs_int32
FetchDir(struct rx_call *acall)
{
- extern char *malloc();
char *tbuffer;
afs_int32 tlen, length, code;
struct dirent *dp;
struct CEBlock *block;
int i;
- block = (struct CEBlock *)malloc(sizeof(struct CEBlock));
+ block = malloc(sizeof(struct CEBlock));
if (!block) {
ViceLog(0, ("Failed malloc in GetCEBlock\n"));
ShutDownAndCore(PANIC);
return;
}
- block = (struct HTBlock *)malloc(sizeof(struct HTBlock));
+ block = malloc(sizeof(struct HTBlock));
if (!block) {
ViceLog(0, ("Failed malloc in GetHTBlock\n"));
ShutDownAndCore(PANIC);
H_UNLOCK;
return;
}
- list = (struct host **)malloc(hostCount * sizeof(struct host *));
+ list = malloc(hostCount * sizeof(struct host *));
if (!list) {
ViceLogThenPanic(0, ("Failed malloc in h_Enumerate (list)\n"));
}
}
/* insert into beginning of list for this bucket */
- chain = (struct h_UuidHashChain *)malloc(sizeof(struct h_UuidHashChain));
+ chain = malloc(sizeof(struct h_UuidHashChain));
if (!chain) {
ViceLogThenPanic(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
}
char hoststr[16];
/* insert into beginning of list for this bucket */
- chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
+ chain = malloc(sizeof(struct h_AddrHashChain));
if (!chain) {
ViceLogThenPanic(0, ("Failed malloc in h_AddHostToAddrHashTable_r\n"));
}
ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2),
ntohs(port)));
- interface = (struct Interface *)
- malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
+ interface = malloc(sizeof(struct Interface)
+ + (sizeof(struct AddrPort) * number));
if (!interface) {
ViceLogThenPanic(0, ("Failed malloc in addInterfaceAddr_r\n"));
}
H_LOCK;
if ((code == RXGEN_OPCODE) ||
((code == 0) && (afs_uuid_equal(&interf.uuid, &nulluuid)))) {
- identP = (struct Identity *)malloc(sizeof(struct Identity));
+ identP = malloc(sizeof(struct Identity));
if (!identP) {
ViceLogThenPanic(0, ("Failed malloc in h_GetHost_r\n"));
}
}
} else if (code == 0) {
interfValid = 1;
- identP = (struct Identity *)malloc(sizeof(struct Identity));
+ identP = malloc(sizeof(struct Identity));
if (!identP) {
ViceLogThenPanic(0, ("Failed malloc in h_GetHost_r\n"));
}
if ((code == RXGEN_OPCODE) ||
((code == 0) && (afs_uuid_equal(&interf.uuid, &nulluuid)))) {
if (!identP)
- identP =
- (struct Identity *)malloc(sizeof(struct Identity));
+ identP = malloc(sizeof(struct Identity));
else
pident = 1;
code = 0;
} else if (code == 0) {
if (!identP)
- identP =
- (struct Identity *)malloc(sizeof(struct Identity));
+ identP = malloc(sizeof(struct Identity));
else
pident = 1;
idlist lids;
lids.idlist_len = 1;
- lids.idlist_val = (afs_int32 *) malloc(1 * sizeof(afs_int32));
+ lids.idlist_val = malloc(1 * sizeof(afs_int32));
if (!lids.idlist_val) {
ViceLogThenPanic(0, ("Failed malloc in h_UserName\n"));
}
if (host->interface) {
if_len = sizeof(struct Interface) +
((host->interface->numberOfInterfaces-1) * sizeof(struct AddrPort));
- ifp = (struct Interface *) malloc(if_len);
+ ifp = malloc(if_len);
osi_Assert(ifp != NULL);
memcpy(ifp, host->interface, if_len);
hdr.interfaces = host->interface->numberOfInterfaces;
if (host->hcps.prlist_val) {
hdr.hcps = host->hcps.prlist_len;
hcps_len = hdr.hcps * sizeof(afs_int32);
- hcps = (afs_int32 *) malloc(hcps_len);
+ hcps = malloc(hcps_len);
osi_Assert(hcps != NULL);
memcpy(hcps, host->hcps.prlist_val, hcps_len);
iov[iovcnt].iov_base = (char *) hcps;
if (hdr.interfaces) {
ifp_len = sizeof(struct Interface) +
((hdr.interfaces-1) * sizeof(struct AddrPort));
- ifp = (struct Interface *) malloc(ifp_len);
+ ifp = malloc(ifp_len);
osi_Assert(ifp != NULL);
iov[iovcnt].iov_base = (char *) ifp;
iov[iovcnt].iov_len = ifp_len;
}
if (hdr.hcps) {
hcps_len = hdr.hcps * sizeof(afs_int32);
- hcps = (afs_int32 *) malloc(hcps_len);
+ hcps = malloc(hcps_len);
osi_Assert(hcps != NULL);
iov[iovcnt].iov_base = (char *) hcps;
iov[iovcnt].iov_len = hcps_len;
if (!hdr.hcps && hdsk.hcps_valid) {
/* valid, zero-length host cps ; does this ever happen? */
- hcps = (afs_int32 *) malloc(sizeof(afs_int32));
+ hcps = malloc(sizeof(afs_int32));
osi_Assert(hcps != NULL);
}
* Allocate and initialize an interface structure for this host.
*/
if (found) {
- interface = (struct Interface *)
- malloc(sizeof(struct Interface) +
- (sizeof(struct AddrPort) * (count - 1)));
+ interface = malloc(sizeof(struct Interface) +
+ (sizeof(struct AddrPort) * (count - 1)));
if (!interface) {
ViceLogThenPanic(0, ("Failed malloc in initInterfaceAddr_r 1\n"));
}
interface->numberOfInterfaces = count;
} else {
- interface = (struct Interface *)
- malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * count));
+ interface = malloc(sizeof(struct Interface) +
+ (sizeof(struct AddrPort) * count));
if (!interface) {
ViceLogThenPanic(0, ("Failed malloc in initInterfaceAddr_r 2\n"));
}
if (profBuf != NULL)
return;
profBufSize = (int)&etext - PROFSTART;
- profBuf = (char *)malloc(profBufSize);
+ profBuf = malloc(profBufSize);
if (profBuf == NULL) {
fprintf(stderr, "Couldn't get profiling buffer.\n");
return;
memset(state, 0, sizeof(struct fs_dump_state));
state->fd = -1;
state->fn = (char *)AFSDIR_SERVER_FSSTATE_FILEPATH;
- state->hdr = (struct fs_state_header *)malloc(sizeof(struct fs_state_header));
- state->h_hdr = (struct host_state_header *)malloc(sizeof(struct host_state_header));
- state->cb_hdr = (struct callback_state_header *)malloc(sizeof(struct callback_state_header));
- state->cb_timeout_hdr = (struct callback_state_timeout_header *)
- malloc(sizeof(struct callback_state_timeout_header));
- state->cb_fehash_hdr = (struct callback_state_fehash_header *)
- malloc(sizeof(struct callback_state_fehash_header));
+ state->hdr = malloc(sizeof(struct fs_state_header));
+ state->h_hdr = malloc(sizeof(struct host_state_header));
+ state->cb_hdr = malloc(sizeof(struct callback_state_header));
+ state->cb_timeout_hdr =
+ malloc(sizeof(struct callback_state_timeout_header));
+ state->cb_fehash_hdr =
+ malloc(sizeof(struct callback_state_fehash_header));
if ((state->hdr == NULL) || (state->h_hdr == NULL) || (state->cb_hdr == NULL) ||
(state->cb_timeout_hdr == NULL) || (state->cb_fehash_hdr == NULL))
ret = 1;
return;
len = sizeof(struct Interface) + ((he_cursor.hdr.interfaces-1)*sizeof(struct AddrPort));
- ifp = (struct Interface *) malloc(len);
+ ifp = malloc(len);
assert(ifp != NULL);
memcpy(ifp, he_cursor.ifp, len);
return;
len = (he_cursor.hdr.hcps)*sizeof(afs_uint32);
- hcps = (afs_int32 *) malloc(len);
+ hcps = malloc(len);
assert(hcps != NULL);
memcpy(hcps, he_cursor.hcps, len);
/* if no last elt (first call) or last item full, get a new one */
if ((!ah->last) || ah->last->nitems >= CLONE_MAXITEMS) {
- ti = (struct clone_items *)malloc(sizeof(struct clone_items));
+ ti = malloc(sizeof(struct clone_items));
if (!ti) {
Log("ci_AddItem: malloc failed\n");
osi_Panic("ci_AddItem: malloc failed\n");
IHandle_t *ihP;
osi_Assert(ihAvailHead == NULL);
- ihP = (IHandle_t *) malloc(I_HANDLE_MALLOCSIZE * sizeof(IHandle_t));
+ ihP = malloc(I_HANDLE_MALLOCSIZE * sizeof(IHandle_t));
osi_Assert(ihP != NULL);
for (i = 0; i < I_HANDLE_MALLOCSIZE; i++) {
ihP[i].ih_refcnt = 0;
FdHandle_t *fdP;
osi_Assert(fdAvailHead == NULL);
- fdP = (FdHandle_t *) malloc(FD_HANDLE_MALLOCSIZE * sizeof(FdHandle_t));
+ fdP = malloc(FD_HANDLE_MALLOCSIZE * sizeof(FdHandle_t));
osi_Assert(fdP != NULL);
for (i = 0; i < FD_HANDLE_MALLOCSIZE; i++) {
fdP[i].fd_status = FD_HANDLE_AVAIL;
if (n_renames >= n_avail) {
n_avail += N_RENAME_STEP;
if (n_avail == N_RENAME_STEP)
- renames = (xfs_Rename_t *)
- malloc(n_avail * sizeof(xfs_Rename_t));
+ renames = malloc(n_avail * sizeof(xfs_Rename_t));
else
renames = realloc(renames,
n_avail * sizeof(xfs_Rename_t));
#else
bufsize = super.fs.fs_ipg * sizeof(struct dinode);
#endif /* AFS_HPUX_ENV */
- inodes = (struct dinode *)malloc(bufsize);
+ inodes = malloc(bufsize);
einodes = (struct dinode *)(((char *)inodes) + bufsize);
if (inodes == NULL) {
Log("Unable to allocate enough memory to scan inodes; help!\n");
if (zlcCur && zlcCur->zlc_next)
zlcCur = zlcCur->zlc_next;
else {
- zlcList_t *tmp = (zlcList_t *) malloc(sizeof(zlcList_t));
+ zlcList_t *tmp = malloc(sizeof(zlcList_t));
if (!tmp)
return;
if (!zlcAnchor) {
{
struct DiskPartition64 *dp, *op;
- dp = (struct DiskPartition64 *)malloc(sizeof(struct DiskPartition64));
+ dp = malloc(sizeof(struct DiskPartition64));
/* Add it to the end, to preserve order when we print statistics */
for (op = DiskPartitionList; op; op = op->next) {
if (!op->next)
dp->index = volutil_GetPartitionID(path);
#if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
/* Create a lockfile for the partition, of the form /vicepa/Lock/vicepa */
- dp->devName = (char *)malloc(2 * strlen(path) + 6);
+ dp->devName = malloc(2 * strlen(path) + 6);
strcpy(dp->devName, path);
strcat(dp->devName, OS_DIRSEP);
strcat(dp->devName, "Lock");
/* try the operation until ok or a fatal error */
while (1) {
- if ((vm = (struct vmount *)malloc(size)) == NULL) {
+ if ((vm = malloc(size)) == NULL) {
/* failed getting memory for mount status buf */
perror("FATAL ERROR: get_stat malloc failed\n");
exit(-1);
MUTEX_EXIT(&worker_lock);
- cleanup = (struct log_cleanup_node *) malloc(sizeof(struct log_cleanup_node));
+ cleanup = malloc(sizeof(struct log_cleanup_node));
while (Reap_Child("salvageserver", &pid, &status) < 0) {
/* try to prevent livelock if something goes wrong */
continue;
}
- cleanup =
- (struct log_cleanup_node *) malloc(sizeof(struct log_cleanup_node));
+ cleanup = malloc(sizeof(struct log_cleanup_node));
cleanup->pid = pid;
queue_Append(&log_watch_queue, cleanup);
vnode->inodeNumber, vnode->parent);
#endif
- assert(dirEntry = (DirEnt *) malloc(sizeof(DirEnt)));
+ assert(dirEntry = malloc(sizeof(DirEnt)));
dirEntry->inode = vnode->inodeNumber;
dirEntry->numEntries = 0;
dirEntry->vnodeName = NULL;
errno);
exit(12);
}
- assert(symLink = (char *)malloc(statLink.st_size + 1));
+ assert(symLink = malloc(statLink.st_size + 1));
if (read(fdLink, symLink, statLink.st_size) < 0) {
printf("Error in reading symbolic link : %d\n", errno);
exit(11);
}
} else {
/* growing file - grow in a reasonable increment */
- char *buf = (char *)malloc(16 * 1024);
+ char *buf = malloc(16 * 1024);
if (!buf) {
Log("VAllocVnode: can't grow vnode index: out of memory\n");
*ec = ENOMEM;
deleted = 1;
goto error;
}
- ip = (struct ViceInodeInfo *)malloc(nInodes*sizeof(struct ViceInodeInfo));
+ ip = malloc(nInodes*sizeof(struct ViceInodeInfo));
if (ip == NULL) {
OS_CLOSE(summaryFile);
Abort
osi_Assert(st_size >= 0);
if (st_size != 0) {
int ret;
- salvinfo->inodeSummary = (struct InodeSummary *)malloc(st_size);
+ salvinfo->inodeSummary = malloc(st_size);
osi_Assert(salvinfo->inodeSummary != NULL);
/* For GNU we need to do lseek to get the file pointer moved. */
osi_Assert(OS_SEEK(summaryFile, 0, SEEK_SET) == 0);
for (i = 0, totalInodes = 0; i < nVols; i++)
totalInodes += isp[i].nInodes;
size = totalInodes * sizeof(struct ViceInodeInfo);
- inodes = (struct ViceInodeInfo *)malloc(size);
+ inodes = malloc(size);
allInodes = inodes - isp->index; /* this would the base of all the inodes
* for the partition, if all the inodes
* had been read into memory */
st_size = OS_SIZE(salvinfo->inodeFd);
osi_Assert(st_size >= 0);
- buf = (struct ViceInodeInfo *)malloc(st_size);
+ buf = malloc(st_size);
osi_Assert(buf != NULL);
nInodes = st_size / sizeof(struct ViceInodeInfo);
osi_Assert(OS_READ(salvinfo->inodeFd, buf, st_size) == st_size);
/* create partition work queue */
for (parts=0, diskP = DiskPartitionList; diskP; diskP = diskP->next, parts++) {
- dpq = (diskpartition_queue_t *) malloc(sizeof(struct diskpartition_queue_t));
+ dpq = malloc(sizeof(struct diskpartition_queue_t));
osi_Assert(dpq != NULL);
dpq->diskP = diskP;
queue_Append(¶ms,dpq);
MUTEX_INIT(&(pq.mutex), "partq", MUTEX_DEFAULT, 0);
for (parts = 0, diskP = DiskPartitionList; diskP; diskP = diskP->next, parts++) {
struct diskpartition_queue_t *dp;
- dp = (struct diskpartition_queue_t*)malloc(sizeof(struct diskpartition_queue_t));
+ dp = malloc(sizeof(struct diskpartition_queue_t));
osi_Assert(dp != NULL);
dp->diskP = diskP;
queue_Append(&pq, dp);
struct vinitvolumepackage_thread_param *params;
AFS_SIGSET_DECL;
- params = (struct vinitvolumepackage_thread_param *)malloc(sizeof(struct vinitvolumepackage_thread_param));
+ params = malloc(sizeof(struct vinitvolumepackage_thread_param));
osi_Assert(params);
params->pq = &pq;
params->vq = &vq;
osi_Assert(pq);
osi_Assert(vq);
- vb = (struct volume_init_batch*)malloc(sizeof(struct volume_init_batch));
+ vb = malloc(sizeof(struct volume_init_batch));
osi_Assert(vb);
vb->thread = params->thread;
vb->last = 0;
CV_BROADCAST(&vq->cv);
MUTEX_EXIT(&vq->mutex);
- vb = (struct volume_init_batch*)malloc(sizeof(struct volume_init_batch));
+ vb = malloc(sizeof(struct volume_init_batch));
osi_Assert(vb);
vb->thread = params->thread;
vb->size = 0;
/* build up the pass 0 shutdown work queue */
- dpq = (struct diskpartition_queue_t *) malloc(sizeof(struct diskpartition_queue_t));
+ dpq = malloc(sizeof(struct diskpartition_queue_t));
osi_Assert(dpq != NULL);
dpq->diskP = diskP;
queue_Prepend(¶ms, dpq);
FSSYNC_VolOp_info * info;
/* attach a vol op info node to the volume struct */
- info = (FSSYNC_VolOp_info *) malloc(sizeof(FSSYNC_VolOp_info));
+ info = malloc(sizeof(FSSYNC_VolOp_info));
osi_Assert(info != NULL);
memcpy(info, vopinfo, sizeof(FSSYNC_VolOp_info));
vp->pending_vol_op = info;
osi_Assert(fdP != NULL);
file = FDH_FDOPEN(fdP, "r");
osi_Assert(file != NULL);
- vnode = (VnodeDiskObject *) malloc(vcp->diskSize);
+ vnode = malloc(vcp->diskSize);
osi_Assert(vnode != NULL);
size = OS_SIZE(fdP->fd_fd);
osi_Assert(size != -1);
return;
if (UpdateList == NULL) {
updateSize = UPDATE_LIST_SIZE;
- UpdateList = (VolumeId *) malloc(sizeof(VolumeId) * updateSize);
+ UpdateList = malloc(sizeof(VolumeId) * updateSize);
} else {
if (nUpdatedVolumes == updateSize) {
updateSize <<= 1;
/* no big deal if this allocation fails */
if (volume_LRU.q[idx].len) {
- salv_flag_vec = (Volume **) malloc(volume_LRU.q[idx].len * sizeof(Volume *));
+ salv_flag_vec = malloc(volume_LRU.q[idx].len * sizeof(Volume *));
}
now = FT_ApproxTime();
if (nAvail <= nParts) {
nAvail += ALLOC_STEP;
if (nAvail == ALLOC_STEP)
- partList =
- (partInfo *) malloc(nAvail * sizeof(partInfo));
+ partList = malloc(nAvail * sizeof(partInfo));
else
partList = realloc(partList,
nAvail * sizeof(partInfo));
}
FillInt64(filesize, filesize_high, filesize_low);
}
- p = (unsigned char *)malloc(size);
+ p = malloc(size);
if (p == NULL) {
*status = 2;
return (0);
buffer = NULL;
- buffer = (char *)malloc(vn.dataSize);
+ buffer = malloc(vn.dataSize);
readdata(buffer, vn.dataSize);
page0 = (struct Page0 *)buffer;
return VOLSERDUMPERROR;
}
- p = (unsigned char *)malloc(howMany);
+ p = malloc(howMany);
if (!p) {
fprintf(stderr, "out of memory!\n");
return VOLSERDUMPERROR;
*partition)
{
afs_int32 code;
- struct diskPartition64 *dp = (struct diskPartition64 *)
- malloc(sizeof(struct diskPartition64));
+ struct diskPartition64 *dp = malloc(sizeof(struct diskPartition64));
code = VolPartitionInfo(acid, pname, dp);
if (!code) {
if (results) {
memset(results, 0, sizeof(manyResults));
i = results->manyResults_len = destinations->manyDests_len;
- results->manyResults_val = codes =
- (afs_int32 *) malloc(i * sizeof(afs_int32));
+ results->manyResults_val = codes = malloc(i * sizeof(afs_int32));
}
if (!results || !results->manyResults_val)
return ENOMEM;
/* (fromDate == 0) ==> full dump */
is_incremental = (fromDate ? 1 : 0);
- tcons =
- (struct rx_connection **)malloc(i * sizeof(struct rx_connection *));
+ tcons = malloc(i * sizeof(struct rx_connection *));
if (!tcons) {
return ENOMEM;
}
- tcalls = (struct rx_call **)malloc(i * sizeof(struct rx_call *));
+ tcalls = malloc(i * sizeof(struct rx_call *));
if (!tcalls) {
free(tcons);
return ENOMEM;
int len;
/* We need to at least fill it in */
- *aname = (char *)malloc(1);
+ *aname = malloc(1);
if (!*aname)
return ENOMEM;
tt = FindTrans(atrans);
partList.partId[j++] = i;
}
if (j > 0) {
- pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int));
+ pEntries->partEntries_val = malloc(j * sizeof(int));
if (!pEntries->partEntries_val)
return ENOMEM;
memcpy((char *)pEntries->partEntries_val, (char *)&partList,
struct volser_trans *tt, *nt, *allTrans;
transInfo->transDebugEntries_val =
- (transDebugInfo *) malloc(allocSize * sizeof(transDebugInfo));
+ malloc(allocSize * sizeof(transDebugInfo));
if (!transInfo->transDebugEntries_val)
return ENOMEM;
pntr = transInfo->transDebugEntries_val;
{
struct tqElem *elem;
- elem = (struct tqElem *)malloc(sizeof(struct tqElem));
+ elem = malloc(sizeof(struct tqElem));
elem->next = ahead->next;
elem->volid = volid;
ahead->next = elem;
int done = 0;
afs_uint32 nbytes;
- buffer = (char *)malloc(blksize);
+ buffer = malloc(blksize);
if (!buffer) {
fprintf(STDERR, "malloc failed\n");
return -1;
afs_uint32 bytesleft, w;
afs_int32 error = 0;
- buffer = (char *)malloc(blksize);
+ buffer = malloc(blksize);
if (!buffer) {
fprintf(STDERR, "memory allocation failed\n");
ERROR_EXIT(-1);
aconn = UV_Bind(server, AFSCONF_VOLUMEPORT);
code = AFSVolPartitionInfo64(aconn, pname, partition);
if (code == RXGEN_OPCODE) {
- struct diskPartition *dpp =
- (struct diskPartition *)malloc(sizeof(struct diskPartition));
+ struct diskPartition *dpp = malloc(sizeof(struct diskPartition));
code = AFSVolPartitionInfo(aconn, pname, dpp);
if (!code) {
strncpy(partition->name, dpp->name, 32);