diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2008-10-23 15:53:51 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2008-10-23 15:53:51 +0000 |
commit | 1ede983cc905643549d8cae56a9d0e28fc68375f (patch) | |
tree | 21e792ce590e1bcf9b343890605a1b4c6a9016b3 /sys/fs/ntfs | |
parent | 994f9863852fe65833509090659d9f5aef7194d3 (diff) | |
download | src-1ede983cc905643549d8cae56a9d0e28fc68375f.tar.gz src-1ede983cc905643549d8cae56a9d0e28fc68375f.zip |
Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after: 3 months
Notes
Notes:
svn path=/head/; revision=184205
Diffstat (limited to 'sys/fs/ntfs')
-rw-r--r-- | sys/fs/ntfs/ntfs_subr.c | 81 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vfsops.c | 11 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vnops.c | 2 |
3 files changed, 46 insertions, 48 deletions
diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index f06ddeb64f1e..e50cdf2da8f5 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -190,7 +190,7 @@ ntfs_ntvattrget( } /* Scan $ATTRIBUTE_LIST for requested attribute */ len = lvap->va_datalen; - MALLOC(alpool, caddr_t, len, M_TEMP, M_WAITOK); + alpool = malloc(len, M_TEMP, M_WAITOK); error = ntfs_readntvattr_plain(ntmp, ip, lvap, 0, len, alpool, &len, NULL); if (error) @@ -246,7 +246,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); } @@ -268,7 +268,7 @@ ntfs_loadntnode( dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number)); - MALLOC(mfrp, struct filerec *, ntfs_bntob(ntmp->ntm_bpmftrec), + mfrp = malloc(ntfs_bntob(ntmp->ntm_bpmftrec), M_TEMP, M_WAITOK); if (ip->i_number < NTFS_SYSNODESNUM) { @@ -341,7 +341,7 @@ ntfs_loadntnode( ip->i_flag |= IN_LOADED; out: - FREE(mfrp, M_TEMP); + free(mfrp, M_TEMP); return (error); } @@ -391,7 +391,7 @@ ntfs_ntlookup( } } while (lockmgr(&ntfs_hashlock, LK_EXCLUSIVE | LK_SLEEPFAIL, NULL)); - MALLOC(ip, struct ntnode *, sizeof(struct ntnode), M_NTFSNTNODE, + ip = malloc(sizeof(struct ntnode), M_NTFSNTNODE, M_WAITOK | M_ZERO); ddprintf(("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip)); @@ -466,7 +466,7 @@ ntfs_ntput(ip) mtx_destroy(&ip->i_interlock); lockdestroy(&ip->i_lock); vrele(ip->i_devvp); - FREE(ip, M_NTFSNTNODE); + free(ip, M_NTFSNTNODE); } /* @@ -513,14 +513,14 @@ 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); + free(vap, M_NTFSNTVATTR); } /* @@ -539,7 +539,7 @@ ntfs_attrtontvattr( error = 0; *rvapp = NULL; - MALLOC(vap, struct ntvattr *, sizeof(struct ntvattr), + vap = malloc(sizeof(struct ntvattr), M_NTFSNTVATTR, M_WAITOK | M_ZERO); vap->va_ip = NULL; vap->va_flag = rap->a_hdr.a_flag; @@ -576,7 +576,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 = 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); @@ -584,7 +584,7 @@ ntfs_attrtontvattr( ddprintf((", len: %d", vap->va_datalen)); if (error) - FREE(vap, M_NTFSNTVATTR); + free(vap, M_NTFSNTVATTR); else *rvapp = vap; @@ -618,8 +618,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 = malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); + cl = malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); off = 0; cnt = 0; @@ -769,14 +769,14 @@ ntfs_fget( if (*fpp) return (0); - MALLOC(fp, struct fnode *, sizeof(struct fnode), M_NTFSFNODE, + fp = malloc(sizeof(struct fnode), M_NTFSFNODE, M_WAITOK | M_ZERO); dprintf(("ntfs_fget: allocating fnode: %p\n",fp)); fp->f_ip = ip; if (attrname) { fp->f_flag |= FN_AATTRNAME; - MALLOC(fp->f_attrname, char *, strlen(attrname)+1, M_TEMP, M_WAITOK); + fp->f_attrname = malloc(strlen(attrname)+1, M_TEMP, M_WAITOK); strcpy(fp->f_attrname, attrname); } else fp->f_attrname = NULL; @@ -807,10 +807,10 @@ ntfs_frele( dprintf(("ntfs_frele: deallocating fnode\n")); LIST_REMOVE(fp,f_fnlist); if (fp->f_flag & FN_AATTRNAME) - FREE(fp->f_attrname, M_TEMP); + free(fp->f_attrname, M_TEMP); if (fp->f_dirblbuf) - FREE(fp->f_dirblbuf, M_NTFSDIR); - FREE(fp, M_NTFSFNODE); + free(fp->f_dirblbuf, M_NTFSDIR); + free(fp, M_NTFSFNODE); ntfs_ntrele(ip); } @@ -861,7 +861,7 @@ ntfs_ntlookupattr( out: if (namelen) { - MALLOC((*attrname), char *, namelen, M_TEMP, M_WAITOK); + (*attrname) = malloc(namelen, M_TEMP, M_WAITOK); memcpy((*attrname), name, namelen); (*attrname)[namelen] = '\0'; } @@ -926,7 +926,7 @@ ntfs_ntlookupfile( dprintf(("ntfs_ntlookupfile: blksz: %d, rdsz: %jd\n", blsize, rdsize)); - MALLOC(rdbuf, caddr_t, blsize, M_TEMP, M_WAITOK); + rdbuf = malloc(blsize, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30", 0, rdsize, rdbuf, NULL); @@ -991,7 +991,7 @@ ntfs_ntlookupfile( /* free the buffer returned by ntfs_ntlookupattr() */ if (attrname) { - FREE(attrname, M_TEMP); + free(attrname, M_TEMP); attrname = NULL; } @@ -1069,10 +1069,10 @@ ntfs_ntlookupfile( dprintf(("finish\n")); fail: - if (attrname) FREE(attrname, M_TEMP); + if (attrname) free(attrname, M_TEMP); ntfs_ntvattrrele(vap); ntfs_ntput(ip); - FREE(rdbuf, M_TEMP); + free(rdbuf, M_TEMP); return (error); } @@ -1143,8 +1143,7 @@ ntfs_ntreaddir( if (fp->f_dirblbuf == NULL) { fp->f_dirblsz = vap->va_a_iroot->ir_size; - MALLOC(fp->f_dirblbuf, caddr_t, - max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, M_WAITOK); + fp->f_dirblbuf = malloc( max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, M_WAITOK); } blsize = fp->f_dirblsz; @@ -1159,7 +1158,7 @@ ntfs_ntreaddir( error = ENOTDIR; goto fail; } - MALLOC(bmp, u_int8_t *, bmvap->va_datalen, M_TEMP, M_WAITOK); + bmp = 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) @@ -1265,7 +1264,7 @@ fail: if (iavap) ntfs_ntvattrrele(iavap); if (bmp) - FREE(bmp, M_TEMP); + free(bmp, M_TEMP); ntfs_ntput(ip); return (error); } @@ -1756,9 +1755,9 @@ ntfs_readattr( ddprintf(("ntfs_ntreadattr: compression: %d\n", vap->va_compressalg)); - MALLOC(cup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), + cup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL), M_NTFSDECOMP, M_WAITOK); - MALLOC(uup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), + uup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL), M_NTFSDECOMP, M_WAITOK); cn = (ntfs_btocn(roff)) & (~(NTFS_COMPUNIT_CL - 1)); @@ -1803,8 +1802,8 @@ ntfs_readattr( cn += NTFS_COMPUNIT_CL; } - FREE(uup, M_NTFSDECOMP); - FREE(cup, M_NTFSDECOMP); + free(uup, M_NTFSDECOMP); + free(cup, M_NTFSDECOMP); } else error = ntfs_readattr_plain(ntmp, ip, attrnum, attrname, roff, rsize, rdata, &init, uio); @@ -1991,7 +1990,7 @@ ntfs_toupper_use(mp, ntmp) * XXX for now, just the first 256 entries are used anyway, * so don't bother reading more */ - MALLOC(ntfs_toupper_tab, wchar *, 65536 * sizeof(wchar), + ntfs_toupper_tab = malloc(65536 * sizeof(wchar), M_NTFSRDATA, M_WAITOK); if ((error = VFS_VGET(mp, NTFS_UPCASEINO, LK_EXCLUSIVE, &vp))) @@ -2018,7 +2017,7 @@ ntfs_toupper_unuse() ntfs_toupper_usecount--; if (ntfs_toupper_usecount == 0) { - FREE(ntfs_toupper_tab, M_NTFSRDATA); + free(ntfs_toupper_tab, M_NTFSRDATA); ntfs_toupper_tab = NULL; } #ifdef DIAGNOSTIC @@ -2047,14 +2046,14 @@ ntfs_u28_init( return (0); } - MALLOC(u28, char **, 256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO); + u28 = malloc(256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO); for (i=0; i<256; i++) { h = (u2w[i] >> 8) & 0xFF; l = (u2w[i]) &0xFF; if (u28[h] == NULL) { - MALLOC(u28[h], char *, 256 * sizeof(char), M_TEMP, M_WAITOK); + u28[h] = malloc(256 * sizeof(char), M_TEMP, M_WAITOK); for (j=0; j<256; j++) u28[h][j] = '_'; } @@ -2084,9 +2083,9 @@ ntfs_u28_uninit(struct ntfsmount *ntmp) for (i=0; i<256; i++) if (u28[i] != NULL) - FREE(u28[i], M_TEMP); + free(u28[i], M_TEMP); - FREE(u28, M_TEMP); + free(u28, M_TEMP); return (0); } @@ -2105,7 +2104,7 @@ ntfs_82u_init( return (0); } - MALLOC(_82u, wchar *, 256 * sizeof(wchar), M_TEMP, M_WAITOK); + _82u = malloc(256 * sizeof(wchar), M_TEMP, M_WAITOK); for (i=0; i<256; i++) _82u[i] = i; @@ -2126,7 +2125,7 @@ ntfs_82u_uninit(struct ntfsmount *ntmp) return (0); } - FREE(ntmp->ntm_82u, M_TEMP); + free(ntmp->ntm_82u, M_TEMP); return (0); } diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 86ff17ad1209..6baaca1b5926 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -416,8 +416,7 @@ ntfs_mountfs(devvp, mp, td) } /* Alloc memory for attribute definitions */ - MALLOC(ntmp->ntm_ad, struct ntvattrdef *, - num * sizeof(struct ntvattrdef), + ntmp->ntm_ad = malloc( num * sizeof(struct ntvattrdef), M_NTFSMNT, M_WAITOK); ntmp->ntm_adnum = num; @@ -526,8 +525,8 @@ ntfs_unmount( MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_LOCAL; MNT_IUNLOCK(mp); - FREE(ntmp->ntm_ad, M_NTFSMNT); - FREE(ntmp, M_NTFSMNT); + free(ntmp->ntm_ad, M_NTFSMNT); + free(ntmp, M_NTFSMNT); return (error); } @@ -568,7 +567,7 @@ ntfs_calccfree( bmsize = VTOF(vp)->f_size; - MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, M_WAITOK); + tmp = malloc(bmsize, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL, 0, bmsize, tmp, NULL); @@ -581,7 +580,7 @@ ntfs_calccfree( *cfreep = cfree; out: - FREE(tmp, M_TEMP); + free(tmp, M_TEMP); return(error); } diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index 7bf8b28e7e65..991504ccb9d7 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -595,7 +595,7 @@ ntfs_readdir(ap) dpStart = (struct dirent *) ((caddr_t)uio->uio_iov->iov_base - (uio->uio_offset - off)); - MALLOC(cookies, u_long *, ncookies * sizeof(u_long), + cookies = malloc(ncookies * sizeof(u_long), M_TEMP, M_WAITOK); for (dp = dpStart, cookiep = cookies, i=0; i < ncookies; |