Change MALLOC()/FREE() to malloc()/free() for cases where the size

argument is a variable.
This commit is contained in:
jdolecek 2001-05-15 22:38:40 +00:00
parent 098ba22210
commit 44cdfc6a17
3 changed files with 20 additions and 23 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: TODO,v 1.17 2001/02/12 21:50:02 jdolecek Exp $
$NetBSD: TODO,v 1.18 2001/05/15 22:38:40 jdolecek Exp $
- convert the code to do caching in buffer cache indexed by
file-vnode/file-offset so that NTFS would take advantage of UBC;
@ -32,9 +32,6 @@ $NetBSD: TODO,v 1.17 2001/02/12 21:50:02 jdolecek Exp $
- really implement sync
- change MALLOC()/FREE() to malloc()/free() where appropriate (if the
specified size if variable)
- write necessary bits to support NTFS in libsa
- basic sysinst support for NTFS

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_subr.c,v 1.27 2001/03/29 10:51:16 joda Exp $ */
/* $NetBSD: ntfs_subr.c,v 1.28 2001/05/15 22:38:40 jdolecek Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.org)
@ -207,7 +207,7 @@ ntfs_ntvattrget(
}
/* Scan $ATTRIBUTE_LIST for requested attribute */
len = lvap->va_datalen;
MALLOC(alpool, caddr_t, len, M_TEMP, M_WAITOK);
alpool = (caddr_t) malloc(len, M_TEMP, M_WAITOK);
error = ntfs_readntvattr_plain(ntmp, ip, lvap, 0, len, alpool, &len,
NULL);
if (error)
@ -263,7 +263,7 @@ ntfs_ntvattrget(
"ino: %d, type: 0x%x, name: %.*s, vcn: %d\n", \
ip->i_number, type, (int) namelen, name, (u_int32_t) vcn));
out:
FREE(alpool, M_TEMP);
free(alpool, M_TEMP);
return (error);
}
@ -285,7 +285,7 @@ ntfs_loadntnode(
dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number));
MALLOC(mfrp, struct filerec *, ntfs_bntob(ntmp->ntm_bpmftrec),
mfrp = (struct filerec *) malloc(ntfs_bntob(ntmp->ntm_bpmftrec),
M_TEMP, M_WAITOK);
if (ip->i_number < NTFS_SYSNODESNUM) {
@ -358,7 +358,7 @@ ntfs_loadntnode(
ip->i_flag |= IN_LOADED;
out:
FREE(mfrp, M_TEMP);
free(mfrp, M_TEMP);
return (error);
}
@ -526,12 +526,12 @@ ntfs_freentvattr(vap)
{
if (vap->va_flag & NTFS_AF_INRUN) {
if (vap->va_vruncn)
FREE(vap->va_vruncn, M_NTFSRUN);
free(vap->va_vruncn, M_NTFSRUN);
if (vap->va_vruncl)
FREE(vap->va_vruncl, M_NTFSRUN);
free(vap->va_vruncl, M_NTFSRUN);
} else {
if (vap->va_datap)
FREE(vap->va_datap, M_NTFSRDATA);
free(vap->va_datap, M_NTFSRDATA);
}
FREE(vap, M_NTFSNTVATTR);
}
@ -590,7 +590,7 @@ ntfs_attrtontvattr(
vap->va_allocated = rap->a_r.a_datalen;
vap->va_vcnstart = 0;
vap->va_vcnend = ntfs_btocn(vap->va_allocated);
MALLOC(vap->va_datap, caddr_t, vap->va_datalen,
vap->va_datap = (caddr_t) malloc(vap->va_datalen,
M_NTFSRDATA, M_WAITOK);
memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff,
rap->a_r.a_datalen);
@ -632,8 +632,8 @@ ntfs_runtovrun(
off += (run[off] & 0xF) + ((run[off] >> 4) & 0xF) + 1;
cnt++;
}
MALLOC(cn, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
MALLOC(cl, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
cn = (cn_t *) malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
cl = (cn_t *) malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
off = 0;
cnt = 0;
@ -849,7 +849,7 @@ ntfs_ntlookupattr(
out:
if (namelen) {
MALLOC((*attrname), char *, namelen, M_TEMP, M_WAITOK);
*attrname = (char *) malloc(namelen, M_TEMP, M_WAITOK);
memcpy((*attrname), name, namelen);
(*attrname)[namelen] = '\0';
*attrtype = NTFS_A_DATA;
@ -1196,7 +1196,7 @@ ntfs_ntreaddir(
if (fp->f_dirblbuf == NULL) {
fp->f_dirblsz = vap->va_a_iroot->ir_size;
MALLOC(fp->f_dirblbuf, caddr_t,
fp->f_dirblbuf = (caddr_t) malloc(
max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, M_WAITOK);
}
@ -1212,7 +1212,7 @@ ntfs_ntreaddir(
error = ENOTDIR;
goto fail;
}
MALLOC(bmp, u_char *, bmvap->va_datalen, M_TEMP, M_WAITOK);
bmp = (u_char *) malloc(bmvap->va_datalen, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", 0,
bmvap->va_datalen, bmp, NULL);
if (error)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_vfsops.c,v 1.34 2001/03/29 10:47:44 joda Exp $ */
/* $NetBSD: ntfs_vfsops.c,v 1.35 2001/05/15 22:38:40 jdolecek Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
@ -559,7 +559,7 @@ ntfs_mountfs(devvp, mp, argsp, p)
}
/* Alloc memory for attribute definitions */
MALLOC(ntmp->ntm_ad, struct ntvattrdef *,
ntmp->ntm_ad = (struct ntvattrdef *) malloc(
num * sizeof(struct ntvattrdef),
M_NTFSMNT, M_WAITOK);
@ -696,7 +696,7 @@ ntfs_unmount(
dprintf(("ntfs_umount: freeing memory...\n"));
mp->mnt_data = (qaddr_t)0;
mp->mnt_flag &= ~MNT_LOCAL;
FREE(ntmp->ntm_ad, M_NTFSMNT);
free(ntmp->ntm_ad, M_NTFSMNT);
FREE(ntmp, M_NTFSMNT);
return (error);
}
@ -748,7 +748,7 @@ ntfs_calccfree(
bmsize = VTOF(vp)->f_size;
MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, M_WAITOK);
tmp = (u_int8_t *) malloc(bmsize, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL,
0, bmsize, tmp, NULL);
@ -761,7 +761,7 @@ ntfs_calccfree(
*cfreep = cfree;
out:
FREE(tmp, M_TEMP);
free(tmp, M_TEMP);
return(error);
}