From c060d198e33c0a7d63588e70d353ab146aab3f81 Mon Sep 17 00:00:00 2001 From: cem Date: Thu, 25 Jan 2018 22:25:13 +0000 Subject: [PATCH] style: Remove remaining deprecated MALLOC/FREE macros Mechanically replace uses of MALLOC/FREE with appropriate invocations of malloc(9) / free(9) (a series of sed expressions). Something like: * MALLOC(a, b, ... -> a = malloc(... * FREE( -> free( * free((caddr_t) -> free( No functional change. For now, punt on modifying contrib ipfilter code, leaving a definition of the macro in its KMALLOC(). Reported by: jhb Reviewed by: cy, imp, markj, rmacklem Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14035 --- sys/contrib/ipfilter/netinet/ip_compat.h | 8 +- sys/fs/nfs/nfs_commonkrpc.c | 8 +- sys/fs/nfs/nfs_commonsubs.c | 10 +-- sys/fs/nfs/nfsport.h | 4 +- sys/fs/nfsclient/nfs_clcomsubs.c | 4 +- sys/fs/nfsclient/nfs_clnode.c | 14 ++-- sys/fs/nfsclient/nfs_clport.c | 22 +++--- sys/fs/nfsclient/nfs_clrpcops.c | 22 +++--- sys/fs/nfsclient/nfs_clstate.c | 94 ++++++++++++------------ sys/fs/nfsclient/nfs_clsubs.c | 4 +- sys/fs/nfsclient/nfs_clvfsops.c | 12 +-- sys/fs/nfsclient/nfs_clvnops.c | 22 +++--- sys/fs/nfsclient/nfsnode.h | 2 +- sys/fs/nfsserver/nfs_nfsdcache.c | 8 +- sys/fs/nfsserver/nfs_nfsdport.c | 48 ++++++------ sys/fs/nfsserver/nfs_nfsdserv.c | 48 ++++++------ sys/fs/nfsserver/nfs_nfsdstate.c | 82 ++++++++++----------- sys/netinet/ip_mroute.c | 4 +- sys/nfsclient/nfsnode.h | 2 +- sys/sys/malloc.h | 7 -- 20 files changed, 209 insertions(+), 216 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_compat.h b/sys/contrib/ipfilter/netinet/ip_compat.h index 1d68851b3d09..58dbb9839615 100644 --- a/sys/contrib/ipfilter/netinet/ip_compat.h +++ b/sys/contrib/ipfilter/netinet/ip_compat.h @@ -530,16 +530,16 @@ MALLOC_DECLARE(M_IPFILTER); # endif /* M_PFIL */ # endif /* IPFILTER_M_IPFILTER */ # if !defined(KMALLOC) -# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT) +# define KMALLOC(a, b) (a) = (b)malloc(sizeof(*(a)), _M_IPF, M_NOWAIT) # endif # if !defined(KMALLOCS) -# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT) +# define KMALLOCS(a, b, c) (a) = (b)malloc((c), _M_IPF, M_NOWAIT) # endif # if !defined(KFREE) -# define KFREE(x) FREE((x), _M_IPF) +# define KFREE(x) free((x), _M_IPF) # endif # if !defined(KFREES) -# define KFREES(x,s) FREE((x), _M_IPF) +# define KFREES(x,s) free((x), _M_IPF) # endif # define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,d) # define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index f5aee810173a..9dfd9b6f8911 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -676,7 +676,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, * outstanding RPCs for nfsv4 client requests. */ if ((nd->nd_flag & ND_NFSV4) && procnum == NFSV4PROC_COMPOUND) - MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), + rep = malloc(sizeof(struct nfsreq), M_NFSDREQ, M_WAITOK); #ifdef KDTRACE_HOOKS if (dtrace_nfscl_nfs234_start_probe != NULL) { @@ -798,7 +798,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, if (usegssname == 0) AUTH_DESTROY(auth); if (rep != NULL) - FREE((caddr_t)rep, M_NFSDREQ); + free(rep, M_NFSDREQ); if (set_sigset) newnfs_restore_sigmask(td, &oldset); return (error); @@ -1098,7 +1098,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, if (usegssname == 0) AUTH_DESTROY(auth); if (rep != NULL) - FREE((caddr_t)rep, M_NFSDREQ); + free(rep, M_NFSDREQ); if (set_sigset) newnfs_restore_sigmask(td, &oldset); return (0); @@ -1108,7 +1108,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, if (usegssname == 0) AUTH_DESTROY(auth); if (rep != NULL) - FREE((caddr_t)rep, M_NFSDREQ); + free(rep, M_NFSDREQ); if (set_sigset) newnfs_restore_sigmask(td, &oldset); return (error); diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 7d47a70ef89f..c03129904fb9 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -677,11 +677,11 @@ nfsm_getfh(struct nfsrv_descript *nd, struct nfsfh **nfhpp) } } else len = NFSX_V2FH; - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + len, + nfhp = malloc(sizeof (struct nfsfh) + len, M_NFSFH, M_WAITOK); error = nfsrv_mtostr(nd, nfhp->nfh_fh, len); if (error) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); goto nfsmout; } nfhp->nfh_len = len; @@ -1200,11 +1200,11 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, !NFSRV_CMPFH(tnfhp->nfh_fh, tfhsize, fhp, fhsize)) *retcmpp = NFSERR_NOTSAME; - FREE((caddr_t)tnfhp, M_NFSFH); + free(tnfhp, M_NFSFH); } else if (nfhpp != NULL) { *nfhpp = tnfhp; } else { - FREE((caddr_t)tnfhp, M_NFSFH); + free(tnfhp, M_NFSFH); } attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(tfhsize)); break; @@ -3832,7 +3832,7 @@ nfsrv_getrefstr(struct nfsrv_descript *nd, u_char **fsrootp, u_char **srvp, cp3 += stringlen; *cp3 = '\0'; siz += (lsp->len + stringlen + 2); - free((caddr_t)lsp, M_TEMP); + free(lsp, M_TEMP); } } *fsrootp = cp; diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 5b7c090dfa75..5e2b09221856 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -630,7 +630,7 @@ void nfsrvd_rcv(struct socket *, void *, int); #define NFSSOCKADDR(a, t) ((t)(a)) #define NFSSOCKADDRALLOC(a) \ do { \ - MALLOC((a), struct sockaddr *, sizeof (struct sockaddr), \ + (a) = malloc(sizeof (struct sockaddr), \ M_SONAME, M_WAITOK); \ NFSBZERO((a), sizeof (struct sockaddr)); \ } while (0) @@ -638,7 +638,7 @@ void nfsrvd_rcv(struct socket *, void *, int); #define NFSSOCKADDRFREE(a) \ do { \ if (a) \ - FREE((caddr_t)(a), M_SONAME); \ + free((a), M_SONAME); \ } while (0) /* diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 6194343378bd..bb00655b16a2 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -499,7 +499,7 @@ nfscl_getcookie(struct nfsnode *np, off_t off, int add) dp = LIST_FIRST(&np->n_cookies); if (!dp) { if (add) { - MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), + dp = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp->ndm_eocookie = 0; LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); @@ -514,7 +514,7 @@ nfscl_getcookie(struct nfsnode *np, off_t off, int add) return (NULL); dp = LIST_NEXT(dp, ndm_list); } else if (add) { - MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), + dp2 = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp2->ndm_eocookie = 0; LIST_INSERT_AFTER(dp, dp2, ndm_list); diff --git a/sys/fs/nfsclient/nfs_clnode.c b/sys/fs/nfsclient/nfs_clnode.c index 38c499d2bff8..9e54f6e9f238 100644 --- a/sys/fs/nfsclient/nfs_clnode.c +++ b/sys/fs/nfsclient/nfs_clnode.c @@ -111,13 +111,13 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp, hash = fnv_32_buf(fhp, fhsize, FNV1_32_INIT); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, + nfhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); bcopy(fhp, &nfhp->nfh_fh[0], fhsize); nfhp->nfh_len = fhsize; error = vfs_hash_get(mntp, hash, lkflags, td, &nvp, newnfs_vncmpf, nfhp); - FREE(nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (error) return (error); if (nvp != NULL) { @@ -163,14 +163,14 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp, vp->v_vflag |= VV_ROOT; } - MALLOC(np->n_fhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, + np->n_fhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); bcopy(fhp, np->n_fhp->nfh_fh, fhsize); np->n_fhp->nfh_len = fhsize; error = insmntque(vp, mntp); if (error != 0) { *npp = NULL; - FREE((caddr_t)np->n_fhp, M_NFSFH); + free(np->n_fhp, M_NFSFH); mtx_destroy(&np->n_mtx); lockdestroy(&np->n_excl); uma_zfree(newnfsnode_zone, np); @@ -329,14 +329,14 @@ ncl_reclaim(struct vop_reclaim_args *ap) while (dp) { dp2 = dp; dp = LIST_NEXT(dp, ndm_list); - FREE((caddr_t)dp2, M_NFSDIROFF); + free(dp2, M_NFSDIROFF); } } if (np->n_writecred != NULL) crfree(np->n_writecred); - FREE((caddr_t)np->n_fhp, M_NFSFH); + free(np->n_fhp, M_NFSFH); if (np->n_v4 != NULL) - FREE((caddr_t)np->n_v4, M_NFSV4NODE); + free(np->n_v4, M_NFSV4NODE); mtx_destroy(&np->n_mtx); lockdestroy(&np->n_excl); uma_zfree(newnfsnode_zone, vp->v_data); diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 0f48acd5ed42..1170b0e61682 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -163,7 +163,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp, } } if (error) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (error); } if (nvp != NULL) { @@ -181,7 +181,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp, dnp->n_fhp->nfh_len != np->n_v4->n4_fhlen || NFSBCMP(dnp->n_fhp->nfh_fh, np->n_v4->n4_data, dnp->n_fhp->nfh_len))) { - MALLOC(newd, struct nfsv4node *, + newd = malloc( sizeof (struct nfsv4node) + dnp->n_fhp->nfh_len + + cnp->cn_namelen - 1, M_NFSV4NODE, M_WAITOK); NFSLOCKNODE(np); @@ -205,11 +205,11 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp, NFSUNLOCKNODE(np); } if (newd != NULL) - FREE((caddr_t)newd, M_NFSV4NODE); + free(newd, M_NFSV4NODE); if (oldd != NULL) - FREE((caddr_t)oldd, M_NFSV4NODE); + free(oldd, M_NFSV4NODE); *npp = np; - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (0); } np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO); @@ -217,7 +217,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp, error = getnewvnode(nfs_vnode_tag, mntp, &newnfs_vnodeops, &nvp); if (error) { uma_zfree(newnfsnode_zone, np); - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (error); } vp = nvp; @@ -252,7 +252,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp, * file name, so that Open Ops can be done later. */ if (nmp->nm_flag & NFSMNT_NFSV4) { - MALLOC(np->n_v4, struct nfsv4node *, sizeof (struct nfsv4node) + np->n_v4 = malloc(sizeof (struct nfsv4node) + dnp->n_fhp->nfh_len + cnp->cn_namelen - 1, M_NFSV4NODE, M_WAITOK); np->n_v4->n4_fhlen = dnp->n_fhp->nfh_len; @@ -276,9 +276,9 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp, *npp = NULL; mtx_destroy(&np->n_mtx); lockdestroy(&np->n_excl); - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (np->n_v4 != NULL) - FREE((caddr_t)np->n_v4, M_NFSV4NODE); + free(np->n_v4, M_NFSV4NODE); uma_zfree(newnfsnode_zone, np); return (error); } @@ -320,7 +320,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, int fhsize, /* For forced dismounts, just return error. */ if (NFSCL_FORCEDISM(mntp)) return (EINTR); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, + nfhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); bcopy(fhp, &nfhp->nfh_fh[0], fhsize); nfhp->nfh_len = fhsize; @@ -355,7 +355,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, int fhsize, } } } - FREE(nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (error) return (error); if (nvp != NULL) { diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index db6c4a707885..b9ce0984613b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -538,7 +538,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen, NFSCLFLAGS_FIRSTDELEG)) op->nfso_own->nfsow_clp->nfsc_flags |= (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG); - MALLOC(ndp, struct nfscldeleg *, + ndp = malloc( sizeof (struct nfscldeleg) + newfhlen, M_NFSCLDELEG, M_WAITOK); LIST_INIT(&ndp->nfsdl_owner); @@ -634,7 +634,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen, } while (ret == NFSERR_DELAY); if (ret) { if (ndp != NULL) { - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); ndp = NULL; } if (ret == NFSERR_STALECLIENTID || @@ -652,7 +652,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen, if (!error) *dpp = ndp; else if (ndp != NULL) - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); mbuf_freem(nd->nd_mrep); return (error); } @@ -1324,7 +1324,7 @@ nfsrpc_lookup(vnode_t dvp, char *name, int len, struct ucred *cred, * Just return the current dir's fh. */ np = VTONFS(dvp); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + + nfhp = malloc(sizeof (struct nfsfh) + np->n_fhp->nfh_len, M_NFSFH, M_WAITOK); nfhp->nfh_len = np->n_fhp->nfh_len; NFSBCOPY(np->n_fhp->nfh_fh, nfhp->nfh_fh, nfhp->nfh_len); @@ -1356,7 +1356,7 @@ nfsrpc_lookup(vnode_t dvp, char *name, int len, struct ucred *cred, */ if (nd->nd_repstat == NFSERR_NOENT && lookupp) { np = VTONFS(dvp); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + + nfhp = malloc(sizeof (struct nfsfh) + np->n_fhp->nfh_len, M_NFSFH, M_WAITOK); nfhp->nfh_len = np->n_fhp->nfh_len; NFSBCOPY(np->n_fhp->nfh_fh, nfhp->nfh_fh, nfhp->nfh_len); @@ -2182,7 +2182,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, struct vattr *vap, NFSCLFLAGS_FIRSTDELEG)) owp->nfsow_clp->nfsc_flags |= (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG); - MALLOC(dp, struct nfscldeleg *, + dp = malloc( sizeof (struct nfscldeleg) + NFSX_V4FHMAX, M_NFSCLDELEG, M_WAITOK); LIST_INIT(&dp->nfsdl_owner); @@ -2296,7 +2296,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, struct vattr *vap, } while (ret == NFSERR_DELAY); if (ret) { if (dp != NULL) { - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); dp = NULL; } if (ret == NFSERR_STALECLIENTID || @@ -2316,7 +2316,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, struct vattr *vap, if (!error) *dpp = dp; else if (dp != NULL) - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); mbuf_freem(nd->nd_mrep); return (error); } @@ -3568,7 +3568,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, goto nfsmout; } if (!attrflag && nfhp != NULL) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); nfhp = NULL; } } else { @@ -3616,7 +3616,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, VREF(vp); newvp = vp; unlocknewvp = 0; - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); np = dnp; } else if (isdotdot != 0) { /* @@ -3674,7 +3674,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, } } } else if (nfhp != NULL) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); } NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); more_dirs = fxdr_unsigned(int, *tl); diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index ff04cde0ac9f..08de1afbd365 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -234,16 +234,16 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, * Might need one or both of these, so MALLOC them now, to * avoid a tsleep() in MALLOC later. */ - MALLOC(nowp, struct nfsclowner *, sizeof (struct nfsclowner), + nowp = malloc(sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK); if (nfhp != NULL) - MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + + nop = malloc(sizeof (struct nfsclopen) + fhlen - 1, M_NFSCLOPEN, M_WAITOK); ret = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); if (ret != 0) { - FREE((caddr_t)nowp, M_NFSCLOWNER); + free(nowp, M_NFSCLOWNER); if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); return (ret); } @@ -331,9 +331,9 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, } NFSUNLOCKCLSTATE(); if (nowp != NULL) - FREE((caddr_t)nowp, M_NFSCLOWNER); + free(nowp, M_NFSCLOWNER); if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); if (owpp != NULL) *owpp = owp; if (opp != NULL) @@ -440,7 +440,7 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, if (mp != NULL && dp != NULL && !NFSMNT_RDONLY(mp) && (dp->nfsdl_flags & NFSCLDL_READ)) { (void) nfscl_trydelegreturn(dp, cred, VFSTONFS(mp), p); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); *dpp = NULL; return (0); } @@ -466,7 +466,7 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, */ if (dp != NULL) { printf("Deleg already exists!\n"); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); *dpp = NULL; } else { *dpp = tdp; @@ -795,7 +795,7 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, idlen += sizeof (u_int64_t); else idlen += sizeof (u_int64_t) + 16; /* 16 random bytes */ - MALLOC(newclp, struct nfsclclient *, + newclp = malloc( sizeof (struct nfsclclient) + idlen - 1, M_NFSCLCLIENT, M_WAITOK | M_ZERO); } @@ -1012,11 +1012,11 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, * Might need these, so MALLOC them now, to * avoid a tsleep() in MALLOC later. */ - MALLOC(nlp, struct nfscllockowner *, + nlp = malloc( sizeof (struct nfscllockowner), M_NFSCLLOCKOWNER, M_WAITOK); - MALLOC(otherlop, struct nfscllock *, + otherlop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); - MALLOC(nlop, struct nfscllock *, + nlop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); nlop->nfslo_type = type; nlop->nfslo_first = off; @@ -1035,9 +1035,9 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, error = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); } if (error) { - FREE((caddr_t)nlp, M_NFSCLLOCKOWNER); - FREE((caddr_t)otherlop, M_NFSCLLOCK); - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlp, M_NFSCLLOCKOWNER); + free(otherlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); return (error); } @@ -1106,9 +1106,9 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, nfscl_clrelease(clp); NFSUNLOCKCLSTATE(); } - FREE((caddr_t)nlp, M_NFSCLLOCKOWNER); - FREE((caddr_t)otherlop, M_NFSCLLOCK); - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlp, M_NFSCLLOCKOWNER); + free(otherlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); return (error); } @@ -1168,11 +1168,11 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, NFSUNLOCKCLSTATE(); if (nlp) - FREE((caddr_t)nlp, M_NFSCLLOCKOWNER); + free(nlp, M_NFSCLLOCKOWNER); if (nlop) - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); if (otherlop) - FREE((caddr_t)otherlop, M_NFSCLLOCK); + free(otherlop, M_NFSCLLOCK); *lpp = lp; return (0); @@ -1204,7 +1204,7 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t len, * Might need these, so MALLOC them now, to * avoid a tsleep() in MALLOC later. */ - MALLOC(nlop, struct nfscllock *, + nlop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); nlop->nfslo_type = F_UNLCK; nlop->nfslo_first = off; @@ -1213,12 +1213,12 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t len, } else { nlop->nfslo_end = off + len; if (nlop->nfslo_end <= nlop->nfslo_first) { - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); return (NFSERR_INVAL); } } if (callcnt == 0) { - MALLOC(other_lop, struct nfscllock *, + other_lop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); *other_lop = *nlop; } @@ -1284,9 +1284,9 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t len, } NFSUNLOCKCLSTATE(); if (nlop) - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); if (other_lop) - FREE((caddr_t)other_lop, M_NFSCLLOCK); + free(other_lop, M_NFSCLLOCK); return (0); } @@ -1464,7 +1464,7 @@ nfscl_freeopen(struct nfsclopen *op, int local) LIST_REMOVE(op, nfso_list); nfscl_freealllocks(&op->nfso_lock, local); - FREE((caddr_t)op, M_NFSCLOPEN); + free(op, M_NFSCLOPEN); if (local) nfsstatsv1.cllocalopens--; else @@ -1520,7 +1520,7 @@ nfscl_expireopen(struct nfsclclient *clp, struct nfsclopen *op, if (error) { mustdelete = 1; if (dp != NULL) { - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); dp = NULL; } } @@ -1545,7 +1545,7 @@ nfscl_freeopenowner(struct nfsclowner *owp, int local) { LIST_REMOVE(owp, nfsow_list); - FREE((caddr_t)owp, M_NFSCLOWNER); + free(owp, M_NFSCLOWNER); if (local) nfsstatsv1.cllocalopenowners--; else @@ -1564,7 +1564,7 @@ nfscl_freelockowner(struct nfscllockowner *lp, int local) LIST_FOREACH_SAFE(lop, &lp->nfsl_lock, nfslo_list, nlop) { nfscl_freelock(lop, local); } - FREE((caddr_t)lp, M_NFSCLLOCKOWNER); + free(lp, M_NFSCLLOCKOWNER); if (local) nfsstatsv1.cllocallockowners--; else @@ -1579,7 +1579,7 @@ nfscl_freelock(struct nfscllock *lop, int local) { LIST_REMOVE(lop, nfslo_list); - FREE((caddr_t)lop, M_NFSCLLOCK); + free(lop, M_NFSCLLOCK); if (local) nfsstatsv1.cllocallocks--; else @@ -1616,7 +1616,7 @@ nfscl_freedeleg(struct nfscldeleghead *hdp, struct nfscldeleg *dp) TAILQ_REMOVE(hdp, dp, nfsdl_list); LIST_REMOVE(dp, nfsdl_hash); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); nfsstatsv1.cldelegates--; nfscl_delegcnt--; } @@ -2104,7 +2104,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) dp->nfsdl_flags &= ~NFSCLDL_NEEDRECLAIM; if ((ndp->nfsdl_flags & NFSCLDL_RECALL)) dp->nfsdl_flags |= NFSCLDL_RECALL; - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); ndp = NULL; break; } @@ -2160,7 +2160,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) ndp = TAILQ_NEXT(dp, nfsdl_list); if ((dp->nfsdl_flags & NFSCLDL_NEEDRECLAIM)) { if (nowp == NULL) { - MALLOC(nowp, struct nfsclowner *, + nowp = malloc( sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK); /* * Name must be as long an largest possible @@ -2176,7 +2176,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) } nop = NULL; if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) { - MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + + nop = malloc(sizeof (struct nfsclopen) + dp->nfsdl_fhlen - 1, M_NFSCLOPEN, M_WAITOK); nop->nfso_own = nowp; if ((dp->nfsdl_flags & NFSCLDL_WRITE)) { @@ -2218,7 +2218,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) dp->nfsdl_flags &= ~NFSCLDL_NEEDRECLAIM; if ((tdp->nfsdl_flags & NFSCLDL_RECALL)) dp->nfsdl_flags |= NFSCLDL_RECALL; - FREE((caddr_t)tdp, M_NFSCLDELEG); + free(tdp, M_NFSCLDELEG); } else { TAILQ_INSERT_HEAD(&extra_deleg, tdp, nfsdl_list); } @@ -2226,7 +2226,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) } if (error) { if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); /* * Couldn't reclaim it, so throw the state * away. Ouch!! @@ -2251,10 +2251,10 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) (void) nfs_catnap(PZERO, error, "nfsexcls"); } while (error == NFSERR_GRACE); LIST_REMOVE(op, nfso_list); - FREE((caddr_t)op, M_NFSCLOPEN); + free(op, M_NFSCLOPEN); } if (nowp != NULL) - FREE((caddr_t)nowp, M_NFSCLOWNER); + free(nowp, M_NFSCLOWNER); TAILQ_FOREACH_SAFE(dp, &extra_deleg, nfsdl_list, ndp) { do { @@ -2264,7 +2264,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) (void) nfs_catnap(PZERO, error, "nfsexdlg"); } while (error == NFSERR_GRACE); TAILQ_REMOVE(&extra_deleg, dp, nfsdl_list); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); } /* For NFSv4.1 or later, do a RECLAIM_COMPLETE. */ @@ -2795,7 +2795,7 @@ nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p) newnfs_copycred(&dp->nfsdl_cred, cred); (void) nfscl_trydelegreturn(dp, cred, clp->nfsc_nmp, p); TAILQ_REMOVE(&dh, dp, nfsdl_list); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); } SLIST_INIT(&lfh); @@ -3369,7 +3369,7 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) if (mp != NULL) vfs_unbusy(mp); if (nfhp != NULL) - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (!error) (void) nfsv4_fillattr(nd, NULL, NULL, NULL, &va, NULL, 0, &rattrbits, NULL, p, 0, 0, 0, 0, @@ -3409,7 +3409,7 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) NFSUNLOCKCLSTATE(); } if (nfhp != NULL) - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); break; case NFSV4OP_CBLAYOUTRECALL: NFSCL_DEBUG(4, "cblayrec\n"); @@ -3977,7 +3977,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, * for it. */ if (owp == NULL) { - MALLOC(nowp, struct nfsclowner *, + nowp = malloc( sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK); nfscl_newopen(clp, NULL, &owp, &nowp, &op, @@ -4060,7 +4060,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, /* No appropriate open, so we have to do one against the server. */ np = VTONFS(vp); - MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + + nop = malloc(sizeof (struct nfsclopen) + lop->nfso_fhlen - 1, M_NFSCLOPEN, M_WAITOK); newone = 0; nfscl_newopen(clp, NULL, &owp, NULL, &op, &nop, owp->nfsow_owner, @@ -4078,7 +4078,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, nfscl_freeopen(lop, 1); } if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); if (ndp != NULL) { /* * What should I do with the returned delegation, since the @@ -4086,7 +4086,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, * through it away. */ printf("Moveopen returned deleg\n"); - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); } return (error); } diff --git a/sys/fs/nfsclient/nfs_clsubs.c b/sys/fs/nfsclient/nfs_clsubs.c index 97cbfbaee822..c569652ab6f8 100644 --- a/sys/fs/nfsclient/nfs_clsubs.c +++ b/sys/fs/nfsclient/nfs_clsubs.c @@ -278,7 +278,7 @@ ncl_getcookie(struct nfsnode *np, off_t off, int add) dp = LIST_FIRST(&np->n_cookies); if (!dp) { if (add) { - MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), + dp = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp->ndm_eocookie = 0; LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); @@ -293,7 +293,7 @@ ncl_getcookie(struct nfsnode *np, off_t off, int add) goto out; dp = LIST_NEXT(dp, ndm_list); } else if (add) { - MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), + dp2 = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp2->ndm_eocookie = 0; LIST_INSERT_AFTER(dp, dp2, ndm_list); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 7e1792da15f6..7845149dd307 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1392,10 +1392,10 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, if (mp->mnt_flag & MNT_UPDATE) { nmp = VFSTONFS(mp); printf("%s: MNT_UPDATE is no longer handled here\n", __func__); - FREE(nam, M_SONAME); + free(nam, M_SONAME); return (0); } else { - MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount) + + nmp = malloc(sizeof (struct nfsmount) + krbnamelen + dirlen + srvkrbnamelen + 2, M_NEWNFSMNT, M_WAITOK | M_ZERO); TAILQ_INIT(&nmp->nm_bufq); @@ -1651,8 +1651,8 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, newnfs_disconnect(dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } - FREE(nmp, M_NEWNFSMNT); - FREE(nam, M_SONAME); + free(nmp, M_NEWNFSMNT); + free(nam, M_SONAME); return (error); } @@ -1728,7 +1728,7 @@ nfs_unmount(struct mount *mp, int mntflags) newnfs_disconnect(&nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); - FREE(nmp->nm_nam, M_SONAME); + free(nmp->nm_nam, M_SONAME); if (nmp->nm_sockreq.nr_auth != NULL) AUTH_DESTROY(nmp->nm_sockreq.nr_auth); mtx_destroy(&nmp->nm_sockreq.nr_mtx); @@ -1739,7 +1739,7 @@ nfs_unmount(struct mount *mp, int mntflags) newnfs_disconnect(dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } - FREE(nmp, M_NEWNFSMNT); + free(nmp, M_NEWNFSMNT); out: return (error); } diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 48b9758adda8..e2c2dc1f442b 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1193,7 +1193,7 @@ nfs_lookup(struct vop_lookup_args *ap) */ if (cnp->cn_nameiop == RENAME && (flags & ISLASTCN)) { if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (EISDIR); } error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL, @@ -1248,7 +1248,7 @@ nfs_lookup(struct vop_lookup_args *ap) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); } else if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); VREF(dvp); newvp = dvp; if (attrflag) @@ -1817,7 +1817,7 @@ nfs_rename(struct vop_rename_args *ap) * For NFSv4, check to see if it is the same name and * replace the name, if it is different. */ - MALLOC(newv4, struct nfsv4node *, + newv4 = malloc( sizeof (struct nfsv4node) + tdnp->n_fhp->nfh_len + tcnp->cn_namelen - 1, M_NFSV4NODE, M_WAITOK); @@ -1838,7 +1838,7 @@ nnn[nnnl] = '\0'; printf("ren replace=%s\n",nnn); } #endif - FREE((caddr_t)fnp->n_v4, M_NFSV4NODE); + free(fnp->n_v4, M_NFSV4NODE); fnp->n_v4 = newv4; newv4 = NULL; fnp->n_v4->n4_fhlen = tdnp->n_fhp->nfh_len; @@ -1851,7 +1851,7 @@ printf("ren replace=%s\n",nnn); mtx_unlock(&tdnp->n_mtx); mtx_unlock(&fnp->n_mtx); if (newv4 != NULL) - FREE((caddr_t)newv4, M_NFSV4NODE); + free(newv4, M_NFSV4NODE); } if (fvp->v_type == VDIR) { @@ -2389,7 +2389,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) cache_purge(dvp); np = VTONFS(vp); KASSERT(vp->v_type != VDIR, ("nfs: sillyrename dir")); - MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename), + sp = malloc(sizeof (struct sillyrename), M_NEWNFSREQ, M_WAITOK); sp->s_cred = crhold(cnp->cn_cred); sp->s_dvp = dvp; @@ -2423,7 +2423,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) bad: vrele(sp->s_dvp); crfree(sp->s_cred); - free((caddr_t)sp, M_NEWNFSREQ); + free(sp, M_NEWNFSREQ); return (error); } @@ -2473,8 +2473,8 @@ nnn[nnnl] = '\0'; printf("replace=%s\n",nnn); } #endif - FREE((caddr_t)np->n_v4, M_NFSV4NODE); - MALLOC(np->n_v4, struct nfsv4node *, + free(np->n_v4, M_NFSV4NODE); + np->n_v4 = malloc( sizeof (struct nfsv4node) + dnp->n_fhp->nfh_len + len - 1, M_NFSV4NODE, M_WAITOK); @@ -2493,10 +2493,10 @@ printf("replace=%s\n",nnn); vfs_hash_rehash(vp, hash); np->n_fhp = nfhp; if (onfhp != NULL) - FREE((caddr_t)onfhp, M_NFSFH); + free(onfhp, M_NFSFH); newvp = NFSTOV(np); } else if (NFS_CMPFH(dnp, nfhp->nfh_fh, nfhp->nfh_len)) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); VREF(dvp); newvp = dvp; } else { diff --git a/sys/fs/nfsclient/nfsnode.h b/sys/fs/nfsclient/nfsnode.h index 079ef6034c99..1dc5de7b8a85 100644 --- a/sys/fs/nfsclient/nfsnode.h +++ b/sys/fs/nfsclient/nfsnode.h @@ -87,7 +87,7 @@ struct nfs_accesscache { * 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 nfsproto.h of NFS_SMALLFH.) * NB: Hopefully the current order of the fields is such that everything will * be well aligned and, therefore, tightly packed. diff --git a/sys/fs/nfsserver/nfs_nfsdcache.c b/sys/fs/nfsserver/nfs_nfsdcache.c index 3ac064d81cef..6180e8f2e7f4 100644 --- a/sys/fs/nfsserver/nfs_nfsdcache.c +++ b/sys/fs/nfsserver/nfs_nfsdcache.c @@ -336,7 +336,7 @@ nfsrvd_getcache(struct nfsrv_descript *nd) if (nd->nd_procnum == NFSPROC_NULL) panic("nfsd cache null"); - MALLOC(newrp, struct nfsrvcache *, sizeof (struct nfsrvcache), + newrp = malloc(sizeof (struct nfsrvcache), M_NFSRVCACHE, M_WAITOK); NFSBZERO((caddr_t)newrp, sizeof (struct nfsrvcache)); if (nd->nd_flag & ND_NFSV4) @@ -423,7 +423,7 @@ nfsrc_getudp(struct nfsrv_descript *nd, struct nfsrvcache *newrp) panic("nfs udp cache1"); } nfsrc_unlock(rp); - free((caddr_t)newrp, M_NFSRVCACHE); + free(newrp, M_NFSRVCACHE); goto out; } } @@ -710,7 +710,7 @@ nfsrc_gettcp(struct nfsrv_descript *nd, struct nfsrvcache *newrp) panic("nfs tcp cache1"); } nfsrc_unlock(rp); - free((caddr_t)newrp, M_NFSRVCACHE); + free(newrp, M_NFSRVCACHE); goto out; } nfsstatsv1.srvcache_misses++; @@ -802,7 +802,7 @@ nfsrc_freecache(struct nfsrvcache *rp) if (!(rp->rc_flag & RC_UDP)) atomic_add_int(&nfsrc_tcpsavedreplies, -1); } - FREE((caddr_t)rp, M_NFSRVCACHE); + free(rp, M_NFSRVCACHE); atomic_add_int(&nfsstatsv1.srvcache_size, -1); } diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 604ca1970c6d..a38276e677cb 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -659,7 +659,7 @@ nfsvno_read(struct vnode *vp, off_t off, int cnt, struct ucred *cred, m3 = m; m2 = m; } - MALLOC(iv, struct iovec *, i * sizeof (struct iovec), + iv = malloc(i * sizeof (struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv2 = iv; m = m3; @@ -690,7 +690,7 @@ nfsvno_read(struct vnode *vp, off_t off, int cnt, struct ucred *cred, /* XXX KDM make this more systematic? */ nfsstatsv1.srvbytes[NFSV4OP_READ] += uiop->uio_resid; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); - FREE((caddr_t)iv2, M_TEMP); + free(iv2, M_TEMP); if (error) { m_freem(m3); *mpp = NULL; @@ -727,7 +727,7 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, int cnt, int stable, struct uio io, *uiop = &io; struct nfsheur *nh; - MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, + ivp = malloc(cnt * sizeof (struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv = ivp; uiop->uio_iovcnt = cnt; @@ -766,7 +766,7 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, int cnt, int stable, error = VOP_WRITE(vp, uiop, ioflags, cred); if (error == 0) nh->nh_nextoff = uiop->uio_offset; - FREE((caddr_t)iv, M_TEMP); + free(iv, M_TEMP); NFSEXITCODE(error); return (error); @@ -1004,7 +1004,7 @@ nfsvno_symlink(struct nameidata *ndp, struct nfsvattr *nvap, char *pathcp, /* * Parse symbolic link arguments. - * This function has an ugly side effect. It will MALLOC() an area for + * This function has an ugly side effect. It will malloc() an area for * the symlink and set iov_base to point to it, only if it succeeds. * So, if it returns with uiop->uio_iov->iov_base != NULL, that must * be FREE'd later. @@ -1029,7 +1029,7 @@ nfsvno_getsymlink(struct nfsrv_descript *nd, struct nfsvattr *nvap, error = EBADRPC; goto nfsmout; } - MALLOC(pathcp, caddr_t, len + 1, M_TEMP, M_WAITOK); + pathcp = malloc(len + 1, M_TEMP, M_WAITOK); error = nfsrv_mtostr(nd, pathcp, len); if (error) goto nfsmout; @@ -1634,11 +1634,11 @@ nfsrvd_readdir(struct nfsrv_descript *nd, int isdgram, goto out; } is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); + rbuf = malloc(siz, M_TEMP, M_WAITOK); again: eofflag = 0; if (cookies) { - free((caddr_t)cookies, M_TEMP); + free(cookies, M_TEMP); cookies = NULL; } @@ -1670,9 +1670,9 @@ nfsrvd_readdir(struct nfsrv_descript *nd, int isdgram, */ if (nd->nd_repstat) { vput(vp); - free((caddr_t)rbuf, M_TEMP); + free(rbuf, M_TEMP); if (cookies) - free((caddr_t)cookies, M_TEMP); + free(cookies, M_TEMP); if (nd->nd_flag & ND_NFSV3) nfsrv_postopattr(nd, getret, &at); goto out; @@ -1693,8 +1693,8 @@ nfsrvd_readdir(struct nfsrv_descript *nd, int isdgram, } *tl++ = newnfs_false; *tl = newnfs_true; - FREE((caddr_t)rbuf, M_TEMP); - FREE((caddr_t)cookies, M_TEMP); + free(rbuf, M_TEMP); + free(cookies, M_TEMP); goto out; } @@ -1792,8 +1792,8 @@ nfsrvd_readdir(struct nfsrv_descript *nd, int isdgram, *tl = newnfs_true; else *tl = newnfs_false; - FREE((caddr_t)rbuf, M_TEMP); - FREE((caddr_t)cookies, M_TEMP); + free(rbuf, M_TEMP); + free(cookies, M_TEMP); out: NFSEXITCODE2(0, nd); @@ -1912,11 +1912,11 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram, is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; is_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") == 0; - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); + rbuf = malloc(siz, M_TEMP, M_WAITOK); again: eofflag = 0; if (cookies) { - free((caddr_t)cookies, M_TEMP); + free(cookies, M_TEMP); cookies = NULL; } @@ -1944,8 +1944,8 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram, if (nd->nd_repstat) { vput(vp); if (cookies) - free((caddr_t)cookies, M_TEMP); - free((caddr_t)rbuf, M_TEMP); + free(cookies, M_TEMP); + free(rbuf, M_TEMP); if (nd->nd_flag & ND_NFSV3) nfsrv_postopattr(nd, getret, &at); goto out; @@ -1963,8 +1963,8 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram, tl += 2; *tl++ = newnfs_false; *tl = newnfs_true; - free((caddr_t)cookies, M_TEMP); - free((caddr_t)rbuf, M_TEMP); + free(cookies, M_TEMP); + free(rbuf, M_TEMP); goto out; } @@ -2304,8 +2304,8 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram, else *tl = newnfs_false; } - FREE((caddr_t)cookies, M_TEMP); - FREE((caddr_t)rbuf, M_TEMP); + free(cookies, M_TEMP); + free(rbuf, M_TEMP); out: NFSEXITCODE2(0, nd); @@ -3189,7 +3189,7 @@ nfssvc_srvcall(struct thread *p, struct nfssvc_args *uap, struct ucred *cred) nfsrv_dumpclients(dumpclients, dumplist.ndl_size); error = copyout(dumpclients, CAST_USER_ADDR_T(dumplist.ndl_list), len); - free((caddr_t)dumpclients, M_TEMP); + free(dumpclients, M_TEMP); } } else if (uap->flag & NFSSVC_DUMPLOCKS) { error = copyin(uap->argp, (caddr_t)&dumplocklist, @@ -3210,7 +3210,7 @@ nfssvc_srvcall(struct thread *p, struct nfssvc_args *uap, struct ucred *cred) vput(nd.ni_vp); error = copyout(dumplocks, CAST_USER_ADDR_T(dumplocklist.ndllck_list), len); - free((caddr_t)dumplocks, M_TEMP); + free(dumplocks, M_TEMP); } } else if (uap->flag & NFSSVC_BACKUPSTABLE) { procp = p->td_proc; diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 61f561b1d49a..087db14b6d5c 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -1245,7 +1245,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram, #endif nfsvno_relpathbuf(&named); if (pathcp) - FREE(pathcp, M_TEMP); + free(pathcp, M_TEMP); if (nd->nd_flag & ND_NFSV3) nfsrv_wcc(nd, dirfor_ret, &dirfor, diraft_ret, &diraft); @@ -1300,7 +1300,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram, #ifdef NFS4_ACL_EXTATTR_NAME acl_free(aclp); #endif - FREE(pathcp, M_TEMP); + free(pathcp, M_TEMP); goto out; } } @@ -1352,7 +1352,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram, if (bufp) nfsvno_relpathbuf(&named); if (pathcp) - FREE(pathcp, M_TEMP); + free(pathcp, M_TEMP); NFSEXITCODE2(error, nd); return (error); @@ -1775,7 +1775,7 @@ nfsrvd_symlink(struct nfsrv_descript *nd, __unused int isdgram, vrele(dirp); } if (pathcp) - FREE(pathcp, M_TEMP); + free(pathcp, M_TEMP); if (nd->nd_flag & ND_NFSV3) { if (!nd->nd_repstat) { @@ -2225,7 +2225,7 @@ nfsrvd_lock(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = NFSERR_BADXDR; goto nfsmout; } - MALLOC(stp, struct nfsstate *, sizeof (struct nfsstate) + i, + stp = malloc(sizeof (struct nfsstate) + i, M_NFSDSTATE, M_WAITOK); stp->ls_ownerlen = i; stp->ls_op = nd->nd_rp; @@ -2253,7 +2253,7 @@ nfsrvd_lock(struct nfsrv_descript *nd, __unused int isdgram, goto nfsmout; } else { NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + NFSX_UNSIGNED); - MALLOC(stp, struct nfsstate *, sizeof (struct nfsstate), + stp = malloc(sizeof (struct nfsstate), M_NFSDSTATE, M_WAITOK); stp->ls_ownerlen = 0; stp->ls_op = nd->nd_rp; @@ -2276,7 +2276,7 @@ nfsrvd_lock(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_clientid.qval = clientid.qval; } } - MALLOC(lop, struct nfslock *, sizeof (struct nfslock), + lop = malloc(sizeof (struct nfslock), M_NFSDLOCK, M_WAITOK); lop->lo_first = offset; if (len == NFS64BITSSET) { @@ -2323,9 +2323,9 @@ nfsrvd_lock(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, &cf, clientid, &stateid, exp, nd, p); if (lop) - FREE((caddr_t)lop, M_NFSDLOCK); + free(lop, M_NFSDLOCK); if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); if (!nd->nd_repstat) { NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID); *tl++ = txdr_unsigned(stateid.seqid); @@ -2354,7 +2354,7 @@ nfsrvd_lock(struct nfsrv_descript *nd, __unused int isdgram, nfsmout: vput(vp); if (stp) - free((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); NFSEXITCODE2(error, nd); return (error); } @@ -2382,7 +2382,7 @@ nfsrvd_lockt(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = NFSERR_BADXDR; goto nfsmout; } - MALLOC(stp, struct nfsstate *, sizeof (struct nfsstate) + i, + stp = malloc(sizeof (struct nfsstate) + i, M_NFSDSTATE, M_WAITOK); stp->ls_ownerlen = i; stp->ls_op = NULL; @@ -2462,13 +2462,13 @@ nfsrvd_lockt(struct nfsrv_descript *nd, __unused int isdgram, } vput(vp); if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); NFSEXITCODE2(0, nd); return (0); nfsmout: vput(vp); if (stp) - free((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); NFSEXITCODE2(error, nd); return (error); } @@ -2490,9 +2490,9 @@ nfsrvd_locku(struct nfsrv_descript *nd, __unused int isdgram, u_int64_t len; NFSM_DISSECT(tl, u_int32_t *, 6 * NFSX_UNSIGNED + NFSX_STATEID); - MALLOC(stp, struct nfsstate *, sizeof (struct nfsstate), + stp = malloc(sizeof (struct nfsstate), M_NFSDSTATE, M_WAITOK); - MALLOC(lop, struct nfslock *, sizeof (struct nfslock), + lop = malloc(sizeof (struct nfslock), M_NFSDLOCK, M_WAITOK); stp->ls_flags = NFSLCK_UNLOCK; lop->lo_flags = NFSLCK_UNLOCK; @@ -2557,9 +2557,9 @@ nfsrvd_locku(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, NULL, clientid, &stateid, exp, nd, p); if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); if (lop) - free((caddr_t)lop, M_NFSDLOCK); + free(lop, M_NFSDLOCK); if (!nd->nd_repstat) { NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID); *tl++ = txdr_unsigned(stateid.seqid); @@ -2609,7 +2609,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = NFSERR_BADXDR; goto nfsmout; } - MALLOC(stp, struct nfsstate *, sizeof (struct nfsstate) + i, + stp = malloc(sizeof (struct nfsstate) + i, M_NFSDSTATE, M_WAITOK); stp->ls_ownerlen = i; stp->ls_op = nd->nd_rp; @@ -2797,7 +2797,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, #ifdef NFS4_ACL_EXTATTR_NAME acl_free(aclp); #endif - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); nfsvno_relpathbuf(&named); NFSEXITCODE2(error, nd); return (error); @@ -2922,7 +2922,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, if (vp) NFSVOPUNLOCK(vp, 0); if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); if (!nd->nd_repstat && dirp) nd->nd_repstat = nfsvno_getattr(dirp, &diraft, nd->nd_cred, p, 0); @@ -3012,7 +3012,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, acl_free(aclp); #endif if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); NFSEXITCODE2(error, nd); return (error); } @@ -3682,7 +3682,7 @@ nfsrvd_releaselckown(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = NFSERR_BADXDR; goto nfsmout; } - MALLOC(stp, struct nfsstate *, sizeof (struct nfsstate) + len, + stp = malloc(sizeof (struct nfsstate) + len, M_NFSDSTATE, M_WAITOK); stp->ls_ownerlen = len; stp->ls_op = NULL; @@ -3705,13 +3705,13 @@ nfsrvd_releaselckown(struct nfsrv_descript *nd, __unused int isdgram, if (error) goto nfsmout; nd->nd_repstat = nfsrv_releaselckown(stp, clientid, p); - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); NFSEXITCODE2(0, nd); return (0); nfsmout: if (stp) - free((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); NFSEXITCODE2(error, nd); return (error); } diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 203bdc8e060b..5726460721aa 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -1273,7 +1273,7 @@ nfsrv_freedeleg(struct nfsstate *stp) lfp->lf_usecount == 0 && nfsv4_testlock(&lfp->lf_locallock_lck) == 0) nfsrv_freenfslockfile(lfp); - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); nfsstatsv1.srvdelegates--; nfsrv_openpluslock--; nfsrv_delegatecnt--; @@ -1299,7 +1299,7 @@ nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, NFSPROC_T *p) } if (stp->ls_op) nfsrvd_derefcache(stp->ls_op); - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); nfsstatsv1.srvopenowners--; nfsrv_openpluslock--; } @@ -1349,7 +1349,7 @@ nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep, NFSPROC_T *p) ret = 0; if (cansleep != 0) NFSUNLOCKSTATE(); - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); nfsstatsv1.srvopens--; nfsrv_openpluslock--; return (ret); @@ -1368,7 +1368,7 @@ nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep, nfsrv_freeallnfslocks(stp, vp, cansleep, p); if (stp->ls_op) nfsrvd_derefcache(stp->ls_op); - FREE((caddr_t)stp, M_NFSDSTATE); + free(stp, M_NFSDSTATE); nfsstatsv1.srvlockowners--; nfsrv_openpluslock--; } @@ -1448,7 +1448,7 @@ nfsrv_freenfslock(struct nfslock *lop) nfsrv_openpluslock--; } LIST_REMOVE(lop, lo_lckowner); - FREE((caddr_t)lop, M_NFSDLOCK); + free(lop, M_NFSDLOCK); } /* @@ -1459,7 +1459,7 @@ nfsrv_freenfslockfile(struct nfslockfile *lfp) { LIST_REMOVE(lfp, lf_hash); - FREE((caddr_t)lfp, M_NFSDLOCKFILE); + free(lfp, M_NFSDLOCKFILE); } /* @@ -1590,7 +1590,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp, */ tryagain: if (new_stp->ls_flags & NFSLCK_LOCK) - MALLOC(other_lop, struct nfslock *, sizeof (struct nfslock), + other_lop = malloc(sizeof (struct nfslock), M_NFSDLOCK, M_WAITOK); filestruct_locked = 0; reterr = 0; @@ -2026,7 +2026,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp, * returns non-zero, which it always does. */ if (other_lop) { - FREE((caddr_t)other_lop, M_NFSDLOCK); + free(other_lop, M_NFSDLOCK); other_lop = NULL; } if (ret == -1) { @@ -2090,7 +2090,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp, NFSBCMP(lckstp->ls_owner, lop->lo_stp->ls_owner, lckstp->ls_ownerlen))) { if (other_lop) { - FREE((caddr_t)other_lop, M_NFSDLOCK); + free(other_lop, M_NFSDLOCK); other_lop = NULL; } if (vnode_unlocked != 0) @@ -2238,7 +2238,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp, error = NFSERR_SERVERFAULT; } if (other_lop) - FREE((caddr_t)other_lop, M_NFSDLOCK); + free(other_lop, M_NFSDLOCK); NFSEXITCODE2(error, nd); return (error); } @@ -2282,7 +2282,7 @@ nfsrv_opencheck(nfsquad_t clientid, nfsv4stateid_t *stateidp, } tryagain: - MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile), + new_lfp = malloc(sizeof (struct nfslockfile), M_NFSDLOCKFILE, M_WAITOK); if (vp) getfhret = nfsrv_getlockfh(vp, new_stp->ls_flags, new_lfp, @@ -2336,7 +2336,7 @@ nfsrv_opencheck(nfsquad_t clientid, nfsv4stateid_t *stateidp, nfsv4_unlock(&nfsv4rootfs_lock, 1); NFSUNLOCKV4ROOTMUTEX(); } - free((caddr_t)new_lfp, M_NFSDLOCKFILE); + free(new_lfp, M_NFSDLOCKFILE); goto out; } @@ -2346,7 +2346,7 @@ nfsrv_opencheck(nfsquad_t clientid, nfsv4stateid_t *stateidp, */ if (vp == NULL) { NFSUNLOCKSTATE(); - FREE((caddr_t)new_lfp, M_NFSDLOCKFILE); + free(new_lfp, M_NFSDLOCKFILE); goto out; } @@ -2359,7 +2359,7 @@ nfsrv_opencheck(nfsquad_t clientid, nfsv4stateid_t *stateidp, error = nfsrv_getlockfile(new_stp->ls_flags, &new_lfp, &lfp, NULL, 0); if (new_lfp) - FREE((caddr_t)new_lfp, M_NFSDLOCKFILE); + free(new_lfp, M_NFSDLOCKFILE); if (error) { NFSUNLOCKSTATE(); if (haslock) { @@ -2534,11 +2534,11 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK); tryagain: - MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile), + new_lfp = malloc(sizeof (struct nfslockfile), M_NFSDLOCKFILE, M_WAITOK); - MALLOC(new_open, struct nfsstate *, sizeof (struct nfsstate), + new_open = malloc(sizeof (struct nfsstate), M_NFSDSTATE, M_WAITOK); - MALLOC(new_deleg, struct nfsstate *, sizeof (struct nfsstate), + new_deleg = malloc(sizeof (struct nfsstate), M_NFSDSTATE, M_WAITOK); getfhret = nfsrv_getlockfh(vp, new_stp->ls_flags, new_lfp, NULL, p); @@ -2593,9 +2593,9 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, NFSUNLOCKSTATE(); printf("Nfsd: openctrl unexpected state err=%d\n", error); - free((caddr_t)new_lfp, M_NFSDLOCKFILE); - free((caddr_t)new_open, M_NFSDSTATE); - free((caddr_t)new_deleg, M_NFSDSTATE); + free(new_lfp, M_NFSDLOCKFILE); + free(new_open, M_NFSDSTATE); + free(new_deleg, M_NFSDSTATE); if (haslock) { NFSLOCKV4ROOTMUTEX(); nfsv4_unlock(&nfsv4rootfs_lock, 1); @@ -2617,13 +2617,13 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, error = nfsrv_getlockfile(new_stp->ls_flags, &new_lfp, &lfp, NULL, 0); if (new_lfp) - FREE((caddr_t)new_lfp, M_NFSDLOCKFILE); + free(new_lfp, M_NFSDLOCKFILE); if (error) { NFSUNLOCKSTATE(); printf("Nfsd openctrl unexpected getlockfile err=%d\n", error); - free((caddr_t)new_open, M_NFSDSTATE); - free((caddr_t)new_deleg, M_NFSDSTATE); + free(new_open, M_NFSDSTATE); + free(new_deleg, M_NFSDSTATE); if (haslock) { NFSLOCKV4ROOTMUTEX(); nfsv4_unlock(&nfsv4rootfs_lock, 1); @@ -2658,8 +2658,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, (stp->ls_flags & NFSLCK_DELEGREAD))) { NFSUNLOCKSTATE(); printf("Nfsd openctrl unexpected expiry\n"); - free((caddr_t)new_open, M_NFSDSTATE); - free((caddr_t)new_deleg, M_NFSDSTATE); + free(new_open, M_NFSDSTATE); + free(new_deleg, M_NFSDSTATE); if (haslock) { NFSLOCKV4ROOTMUTEX(); nfsv4_unlock(&nfsv4rootfs_lock, 1); @@ -2710,8 +2710,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, * nfsrv_clientconflict() unlocks state * when it returns non-zero. */ - free((caddr_t)new_open, M_NFSDSTATE); - free((caddr_t)new_deleg, M_NFSDSTATE); + free(new_open, M_NFSDSTATE); + free(new_deleg, M_NFSDSTATE); openstp = NULL; goto tryagain; } @@ -2728,8 +2728,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, nfsv4_unlock(&nfsv4rootfs_lock, 1); NFSUNLOCKV4ROOTMUTEX(); } - free((caddr_t)new_open, M_NFSDSTATE); - free((caddr_t)new_deleg, M_NFSDSTATE); + free(new_open, M_NFSDSTATE); + free(new_deleg, M_NFSDSTATE); printf("nfsd openctrl unexpected client cnfl\n"); goto out; } @@ -2776,8 +2776,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, * when it returns non-zero. */ printf("Nfsd openctrl unexpected deleg cnfl\n"); - free((caddr_t)new_open, M_NFSDSTATE); - free((caddr_t)new_deleg, M_NFSDSTATE); + free(new_open, M_NFSDSTATE); + free(new_deleg, M_NFSDSTATE); if (ret == -1) { openstp = NULL; goto tryagain; @@ -3241,9 +3241,9 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, NFSUNLOCKV4ROOTMUTEX(); } if (new_open) - FREE((caddr_t)new_open, M_NFSDSTATE); + free(new_open, M_NFSDSTATE); if (new_deleg) - FREE((caddr_t)new_deleg, M_NFSDSTATE); + free(new_deleg, M_NFSDSTATE); /* * If the NFSv4.1 client just acquired its first open, write a timestamp @@ -4509,7 +4509,7 @@ nfsrv_setupstable(NFSPROC_T *p) (caddr_t)sf->nsf_bootvals, sf->nsf_numboots * sizeof (time_t), off, UIO_SYSSPACE, 0, NFSFPCRED(sf->nsf_fp), &aresid, p); if (error || aresid) { - free((caddr_t)sf->nsf_bootvals, M_TEMP); + free(sf->nsf_bootvals, M_TEMP); sf->nsf_bootvals = NULL; return; } @@ -4555,11 +4555,11 @@ nfsrv_setupstable(NFSPROC_T *p) */ LIST_FOREACH_SAFE(sp, &sf->nsf_head, nst_list, nsp) { LIST_REMOVE(sp, nst_list); - free((caddr_t)sp, M_TEMP); + free(sp, M_TEMP); } - free((caddr_t)tsp, M_TEMP); + free(tsp, M_TEMP); sf->nsf_flags &= ~NFSNSF_OK; - free((caddr_t)sf->nsf_bootvals, M_TEMP); + free(sf->nsf_bootvals, M_TEMP); sf->nsf_bootvals = NULL; return; } @@ -4593,7 +4593,7 @@ nfsrv_setupstable(NFSPROC_T *p) } } } while (len > 0); - free((caddr_t)tsp, M_TEMP); + free(tsp, M_TEMP); sf->nsf_flags = NFSNSF_OK; sf->nsf_eograce = NFSD_MONOSEC + sf->nsf_lease + NFSRV_LEASEDELTA; @@ -4657,7 +4657,7 @@ nfsrv_updatestable(NFSPROC_T *p) sf->nsf_numboots * sizeof (time_t), (off_t)(sizeof (struct nfsf_rec)), UIO_SYSSPACE, IO_SYNC, NFSFPCRED(sf->nsf_fp), NULL, p); - free((caddr_t)sf->nsf_bootvals, M_TEMP); + free(sf->nsf_bootvals, M_TEMP); sf->nsf_bootvals = NULL; if (error) { sf->nsf_flags &= ~NFSNSF_OK; @@ -4677,7 +4677,7 @@ nfsrv_updatestable(NFSPROC_T *p) sp->nst_clp->lc_flags |= LCL_STAMPEDSTABLE; } LIST_REMOVE(sp, nst_list); - free((caddr_t)sp, M_TEMP); + free(sp, M_TEMP); } nfsrv_backupstable(); } @@ -4702,7 +4702,7 @@ nfsrv_writestable(u_char *client, int len, int flag, NFSPROC_T *p) error = NFSD_RDWR(UIO_WRITE, NFSFPVNODE(sf->nsf_fp), (caddr_t)sp, sizeof (struct nfst_rec) + len - 1, (off_t)0, UIO_SYSSPACE, (IO_SYNC | IO_APPEND), NFSFPCRED(sf->nsf_fp), NULL, p); - free((caddr_t)sp, M_TEMP); + free(sp, M_TEMP); if (error) { sf->nsf_flags &= ~NFSNSF_OK; printf("EEK! Can't write NfsV4 stable storage file\n"); diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index f495a85a36fb..10f6b680449c 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -2818,7 +2818,7 @@ static void vnet_mroute_init(const void *unused __unused) { - MALLOC(V_nexpire, u_char *, mfchashsize, M_MRTABLE, M_WAITOK|M_ZERO); + V_nexpire = malloc(mfchashsize, M_MRTABLE, M_WAITOK|M_ZERO); bzero(V_bw_meter_timers, sizeof(V_bw_meter_timers)); callout_init(&V_expire_upcalls_ch, 1); callout_init(&V_bw_upcalls_ch, 1); @@ -2832,7 +2832,7 @@ static void vnet_mroute_uninit(const void *unused __unused) { - FREE(V_nexpire, M_MRTABLE); + free(V_nexpire, M_MRTABLE); V_nexpire = NULL; } diff --git a/sys/nfsclient/nfsnode.h b/sys/nfsclient/nfsnode.h index 4839f6e50d0e..3c6856dc7e94 100644 --- a/sys/nfsclient/nfsnode.h +++ b/sys/nfsclient/nfsnode.h @@ -92,7 +92,7 @@ struct nfs_accesscache { * 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 nfsproto.h of NFS_SMALLFH.) * NB: Hopefully the current order of the fields is such that everything will * be well aligned and, therefore, tightly packed. diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 35f09a7cf7a3..d3e17bf28849 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -149,13 +149,6 @@ MALLOC_DECLARE(M_CACHE); MALLOC_DECLARE(M_DEVBUF); MALLOC_DECLARE(M_TEMP); -/* - * Deprecated macro versions of not-quite-malloc() and free(). - */ -#define MALLOC(space, cast, size, type, flags) \ - ((space) = (cast)malloc((u_long)(size), (type), (flags))) -#define FREE(addr, type) free((addr), (type)) - /* * XXX this should be declared in , but that tends to fail * because is included in a header before the source file