diff options
-rw-r--r-- | sys/nfs/nfs_kq.c | 7 | ||||
-rw-r--r-- | sys/nfs/nfs_node.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfs_serv.c | 43 | ||||
-rw-r--r-- | sys/nfs/nfs_socket.c | 7 | ||||
-rw-r--r-- | sys/nfs/nfs_srvcache.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfs_subs.c | 3 | ||||
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 21 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 7 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 21 | ||||
-rw-r--r-- | sys/nfs/nfsnode.h | 4 |
10 files changed, 55 insertions, 70 deletions
diff --git a/sys/nfs/nfs_kq.c b/sys/nfs/nfs_kq.c index df806d9314b..c2ecfb35d22 100644 --- a/sys/nfs/nfs_kq.c +++ b/sys/nfs/nfs_kq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_kq.c,v 1.9 2007/06/01 23:47:57 deraadt Exp $ */ +/* $OpenBSD: nfs_kq.c,v 1.10 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_kq.c,v 1.7 2003/10/30 01:43:10 simonb Exp $ */ /*- @@ -209,7 +209,7 @@ filt_nfsdetach(struct knote *kn) } else { /* last user, g/c */ SLIST_REMOVE(&kevlist, ke, kevq, kev_link); - FREE(ke, M_KEVENT); + free(ke, M_KEVENT); } break; } @@ -319,8 +319,7 @@ nfs_kqfilter(void *v) ke->usecount++; } else { /* need a new one */ - MALLOC(ke, struct kevq *, - sizeof(struct kevq), M_KEVENT, M_WAITOK); + ke = malloc(sizeof(struct kevq), M_KEVENT, M_WAITOK); ke->vp = vp; ke->usecount = 1; ke->flags = 0; diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index 40ba88ea161..1a661f75a7b 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_node.c,v 1.35 2007/06/01 23:47:57 deraadt Exp $ */ +/* $OpenBSD: nfs_node.c,v 1.36 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */ /* @@ -184,7 +184,7 @@ nfs_inactive(v) nfs_removeit(sp); crfree(sp->s_cred); vrele(sp->s_dvp); - FREE((caddr_t)sp, M_NFSREQ); + free(sp, M_NFSREQ); } np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT); @@ -222,7 +222,7 @@ nfs_reclaim(v) while (dp) { dp2 = dp; dp = LIST_NEXT(dp, ndm_list); - FREE((caddr_t)dp2, M_NFSDIROFF); + free(dp2, M_NFSDIROFF); } } if (np->n_fhsize > NFS_SMALLFH) { diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index b4c231631a5..3f33a88afc6 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.41 2007/09/11 13:41:52 blambert Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.42 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */ /* @@ -618,8 +618,7 @@ nfsrv_read(nfsd, slp, procp, mrq) m2 = m; } } - MALLOC(iv, struct iovec *, i * sizeof (struct iovec), - M_TEMP, M_WAITOK); + iv = malloc(i * sizeof(struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv2 = iv; m = mb; left = len; @@ -645,7 +644,7 @@ nfsrv_read(nfsd, slp, procp, mrq) uiop->uio_segflg = UIO_SYSSPACE; error = VOP_READ(vp, uiop, IO_NODELOCKED, cred); off = uiop->uio_offset; - FREE((caddr_t)iv2, M_TEMP); + free(iv2, M_TEMP); if (error || (getret = VOP_GETATTR(vp, &va, cred, procp)) != 0){ if (!error) error = getret; @@ -793,8 +792,7 @@ nfsrv_write(nfsd, slp, procp, mrq) } if (len > 0) { - MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, - M_WAITOK); + ivp = malloc(cnt * sizeof(struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv = ivp; uiop->uio_iovcnt = cnt; mp = mrep; @@ -827,7 +825,7 @@ nfsrv_write(nfsd, slp, procp, mrq) uiop->uio_offset = off; error = VOP_WRITE(vp, uiop, ioflags, cred); nfsstats.srvvop_writes++; - FREE((caddr_t)iv, M_TEMP); + free(iv, M_TEMP); } aftat_ret = VOP_GETATTR(vp, &va, cred, procp); vput(vp); @@ -1074,8 +1072,7 @@ loop1: mp = mp->m_next; } uiop->uio_iovcnt = i; - MALLOC(iov, struct iovec *, i * sizeof (struct iovec), - M_TEMP, M_WAITOK); + iov = malloc(i * sizeof(struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = ivp = iov; mp = mrep; while (mp) { @@ -1090,7 +1087,7 @@ loop1: error = VOP_WRITE(vp, uiop, ioflags, cred); nfsstats.srvvop_writes++; } - FREE((caddr_t)iov, M_TEMP); + free(iov, M_TEMP); } m_freem(mrep); if (vp) { @@ -2031,7 +2028,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq) if (v3) nfsm_srvsattr(&va); nfsm_strsiz(len2, NFS_MAXPATHLEN); - MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, M_WAITOK); + pathcp = malloc(len2 + 1, M_TEMP, M_WAITOK); iv.iov_base = pathcp; iv.iov_len = len2; io.uio_resid = len2; @@ -2085,7 +2082,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq) } out: if (pathcp) - FREE(pathcp, M_TEMP); + free(pathcp, M_TEMP); if (dirp) { diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); vrele(dirp); @@ -2114,7 +2111,7 @@ nfsmout: if (nd.ni_vp) vrele(nd.ni_vp); if (pathcp) - FREE(pathcp, M_TEMP); + free(pathcp, M_TEMP); return (error); } @@ -2442,7 +2439,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq) return (0); } VOP_UNLOCK(vp, 0, procp); - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); + rbuf = malloc(siz, M_TEMP, M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; @@ -2502,8 +2499,8 @@ again: nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = nfs_false; *tl = nfs_true; - FREE((caddr_t)rbuf, M_TEMP); - FREE((caddr_t)cookies, M_TEMP); + free(rbuf, M_TEMP); + free(cookies, M_TEMP); return (0); } } @@ -2620,8 +2617,8 @@ again: mp->m_len = bp - mtod(mp, caddr_t); } else mp->m_len += bp - bpos; - FREE((caddr_t)rbuf, M_TEMP); - FREE((caddr_t)cookies, M_TEMP); + free(rbuf, M_TEMP); + free(cookies, M_TEMP); nfsmout: return(error); } @@ -2702,7 +2699,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq) } VOP_UNLOCK(vp, 0, procp); - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); + rbuf = malloc(siz, M_TEMP, M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; @@ -2758,8 +2755,8 @@ again: tl += 2; *tl++ = nfs_false; *tl = nfs_true; - FREE((caddr_t)cookies, M_TEMP); - FREE((caddr_t)rbuf, M_TEMP); + free(cookies, M_TEMP); + free(rbuf, M_TEMP); return (0); } } @@ -2939,8 +2936,8 @@ invalid: mp->m_len = bp - mtod(mp, caddr_t); } else mp->m_len += bp - bpos; - FREE((caddr_t)cookies, M_TEMP); - FREE((caddr_t)rbuf, M_TEMP); + free(cookies, M_TEMP); + free(rbuf, M_TEMP); nfsmout: return(error); } diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index e3ed1525640..38fe77d854f 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.49 2007/06/25 20:40:00 thib Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.50 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -2070,8 +2070,7 @@ nfsrv_dorec(slp, nfsd, ndp) nam->m_next = NULL; } else nam = NULL; - MALLOC(nd, struct nfsrv_descript *, sizeof (struct nfsrv_descript), - M_NFSRVDESC, M_WAITOK); + nd = malloc(sizeof(struct nfsrv_descript), M_NFSRVDESC, M_WAITOK); nfs_realign(&m, 10 * NFSX_UNSIGNED); nd->nd_md = nd->nd_mrep = m; nd->nd_nam2 = nam; @@ -2079,7 +2078,7 @@ nfsrv_dorec(slp, nfsd, ndp) error = nfs_getreq(nd, nfsd, TRUE); if (error) { m_freem(nam); - free((caddr_t)nd, M_NFSRVDESC); + free(nd, M_NFSRVDESC); return (error); } *ndp = nd; diff --git a/sys/nfs/nfs_srvcache.c b/sys/nfs/nfs_srvcache.c index 1685554c399..06cf1001b5d 100644 --- a/sys/nfs/nfs_srvcache.c +++ b/sys/nfs/nfs_srvcache.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_srvcache.c,v 1.12 2004/12/26 21:22:14 miod Exp $ */ +/* $OpenBSD: nfs_srvcache.c,v 1.13 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_srvcache.c,v 1.12 1996/02/18 11:53:49 fvdl Exp $ */ /* @@ -217,9 +217,7 @@ loop: } nfsstats.srvcache_misses++; if (numnfsrvcache < desirednfsrvcache) { - rp = (struct nfsrvcache *)malloc((u_long)sizeof *rp, - M_NFSD, M_WAITOK); - bzero((char *)rp, sizeof *rp); + rp = malloc(sizeof(*rp), M_NFSD, M_WAITOK|M_ZERO); numnfsrvcache++; rp->rc_flag = RC_LOCKED; } else { diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index ae497c69a62..24620c0820f 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.61 2007/04/19 14:46:44 thib Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.62 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -52,7 +52,6 @@ #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/stat.h> -#include <sys/malloc.h> #include <sys/pool.h> #include <sys/time.h> diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index ec6349d2bd3..9d0fa67f685 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.55 2007/06/25 20:40:00 thib Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.56 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -253,9 +253,8 @@ nfssvc_addsock(fp, mynam) if (tslp) slp = tslp; else { - slp = (struct nfssvc_sock *) - malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); - bzero((caddr_t)slp, sizeof (struct nfssvc_sock)); + slp = malloc(sizeof(struct nfssvc_sock), M_NFSSVC, + M_WAITOK|M_ZERO); TAILQ_INIT(&slp->ns_uidlruhead); TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain); } @@ -299,10 +298,9 @@ nfssvc_nfsd(nsd, argp, p) writes_todo = 0; #endif s = splsoftnet(); - if (nfsd == (struct nfsd *)0) { - nsd->nsd_nfsd = nfsd = (struct nfsd *) - malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK); - bzero((caddr_t)nfsd, sizeof (struct nfsd)); + if (nfsd == NULL) { + nsd->nsd_nfsd = nfsd = malloc(sizeof(struct nfsd), M_NFSD, + M_WAITOK|M_ZERO); nfsd->nfsd_procp = p; TAILQ_INSERT_TAIL(&nfsd_head, nfsd, nfsd_chain); nfs_numnfsd++; @@ -504,7 +502,7 @@ nfssvc_nfsd(nsd, argp, p) break; }; if (nd) { - FREE((caddr_t)nd, M_NFSRVDESC); + free(nd, M_NFSRVDESC); nd = NULL; } @@ -642,9 +640,8 @@ nfsrv_init(terminating) TAILQ_INIT(&nfsd_head); nfsd_head_flag &= ~NFSD_CHECKSLP; - nfs_udpsock = (struct nfssvc_sock *) - malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); - bzero((caddr_t)nfs_udpsock, sizeof (struct nfssvc_sock)); + nfs_udpsock = malloc(sizeof(struct nfssvc_sock), M_NFSSVC, + M_WAITOK|M_ZERO); TAILQ_INIT(&nfs_udpsock->ns_uidlruhead); TAILQ_INSERT_HEAD(&nfssvc_sockhead, nfs_udpsock, ns_chain); } diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 3f1d9670b33..cbf9d8cb902 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.67 2007/09/11 13:41:52 blambert Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.68 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -673,9 +673,8 @@ mountnfs(argp, mp, nam, pth, hst) m_freem(nam); return (0); } else { - MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount), - M_NFSMNT, M_WAITOK); - bzero((caddr_t)nmp, sizeof (struct nfsmount)); + nmp = malloc(sizeof(struct nfsmount), M_NFSMNT, + M_WAITOK|M_ZERO); mp->mnt_data = (qaddr_t)nmp; TAILQ_INIT(&nmp->nm_uidlruhead); } diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 3be7f373bf2..5f22c61ecf4 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.76 2007/09/11 13:41:52 blambert Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.77 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -1889,8 +1889,8 @@ nfs_readdir(v) if (ap->a_cookies) { ncookies = uio->uio_resid / 20; - MALLOC(cookies, u_long *, sizeof(*cookies) * ncookies, - M_TEMP, M_WAITOK); + cookies = malloc(sizeof(*cookies) * ncookies, M_TEMP, + M_WAITOK); *ap->a_ncookies = ncookies; *ap->a_cookies = cookies; } @@ -1900,9 +1900,7 @@ nfs_readdir(v) cnt = 5; - MALLOC(data, void *, NFS_DIRBLKSIZ, M_TEMP, - M_WAITOK); - + data = malloc(NFS_DIRBLKSIZ, M_TEMP, M_WAITOK); do { struct nfs_dirent *ndp = data; @@ -1957,13 +1955,13 @@ nfs_readdir(v) ndp = (struct nfs_dirent *)((u_int8_t *)ndp + reclen); } } while (!error && !done && !eof && cnt--); - - FREE(data, M_TEMP); + + free(data, M_TEMP); data = NULL; if (ap->a_cookies) { if (error) { - FREE(*ap->a_cookies, M_TEMP); + free(*ap->a_cookies, M_TEMP); *ap->a_cookies = NULL; *ap->a_ncookies = 0; } else { @@ -2415,8 +2413,7 @@ nfs_sillyrename(dvp, vp, cnp) cache_purge(dvp); np = VTONFS(vp); - MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename), - M_NFSREQ, M_WAITOK); + sp = malloc(sizeof(struct sillyrename), M_NFSREQ, M_WAITOK); sp->s_cred = crdup(cnp->cn_cred); sp->s_dvp = dvp; VREF(dvp); @@ -2454,7 +2451,7 @@ nfs_sillyrename(dvp, vp, cnp) bad: vrele(sp->s_dvp); crfree(sp->s_cred); - FREE((caddr_t)sp, M_NFSREQ); + free(sp, M_NFSREQ); return (error); } diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h index 44ab07dbc35..1fc70bb288f 100644 --- a/sys/nfs/nfsnode.h +++ b/sys/nfs/nfsnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsnode.h,v 1.26 2007/06/21 22:59:49 thib Exp $ */ +/* $OpenBSD: nfsnode.h,v 1.27 2007/09/20 12:54:31 thib Exp $ */ /* $NetBSD: nfsnode.h,v 1.16 1996/02/18 11:54:04 fvdl Exp $ */ /* @@ -80,7 +80,7 @@ struct nfsdmap { * An nfsnode is 'named' by its file handle. (nget/nfs_node.c) * If this structure exceeds 256 bytes (it is currently 256 using 4.4BSD-Lite * type definitions), file handles of > 32 bytes should probably be split out - * into a separate MALLOC()'d data structure. (Reduce the size of nfsfh_t by + * into a separate malloc()'d data structure. (Reduce the size of nfsfh_t by * changing the definition in sys/mount.h of NFS_SMALLFH.) * NB: Hopefully the current order of the fields is such that everything will * be well aligned and, therefore, tightly packed. |