From: Sascha Wildner Date: Tue, 6 Dec 2011 17:58:34 +0000 (+0100) Subject: kernel: Replace all usage of MALLOC()/FREE() with kmalloc()/kfree(). X-Git-Tag: v3.0.0~466 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/884717e1debcf4b08bda1d29d01b0c8a34b86a59 kernel: Replace all usage of MALLOC()/FREE() with kmalloc()/kfree(). --- diff --git a/sys/bus/cam/scsi/scsi_target.c b/sys/bus/cam/scsi/scsi_target.c index bfba721912..eb6c301d45 100644 --- a/sys/bus/cam/scsi/scsi_target.c +++ b/sys/bus/cam/scsi/scsi_target.c @@ -182,8 +182,7 @@ targopen(struct dev_open_args *ap) make_dev(&targ_ops, minor(dev), UID_ROOT, GID_WHEEL, 0600, "targ%d", lminor(dev)); #endif - MALLOC(softc, struct targ_softc *, sizeof(*softc), M_TARG, - M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_TARG, M_INTWAIT | M_ZERO); dev->si_drv1 = softc; softc->state = TARG_STATE_OPENED; softc->periph = NULL; @@ -211,7 +210,7 @@ targclose(struct dev_close_args *ap) (softc->state & TARG_STATE_LUN_ENABLED) == 0) { devfs_clone_bitmap_put(&DEVFS_CLONE_BITMAP(targ), dev->si_uminor); destroy_dev(dev); - FREE(softc, M_TARG); + kfree(softc, M_TARG); return (0); } @@ -231,7 +230,7 @@ targclose(struct dev_close_args *ap) } destroy_dev(dev); /* eats the open ref */ devfs_clone_bitmap_put(&DEVFS_CLONE_BITMAP(targ), dev->si_uminor); - FREE(softc, M_TARG); + kfree(softc, M_TARG); } else { release_dev(dev); } @@ -531,7 +530,7 @@ targdtor(struct cam_periph *periph) } while ((descr = TAILQ_FIRST(&softc->abort_queue)) != NULL) { TAILQ_REMOVE(&softc->abort_queue, descr, tqe); - FREE(descr, M_TARG); + kfree(descr, M_TARG); } softc->periph = NULL; @@ -979,7 +978,7 @@ targgetccb(struct targ_softc *softc, xpt_opcode type, int priority) int ccb_len; ccb_len = targccblen(type); - MALLOC(ccb, union ccb *, ccb_len, M_TARG, M_INTWAIT); + ccb = kmalloc(ccb_len, M_TARG, M_INTWAIT); CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb)); xpt_setup_ccb(&ccb->ccb_h, softc->path, priority); @@ -994,13 +993,13 @@ targfreeccb(struct targ_softc *softc, union ccb *ccb) { CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("targfreeccb descr %p and\n", ccb->ccb_h.targ_descr)); - FREE(ccb->ccb_h.targ_descr, M_TARG); + kfree(ccb->ccb_h.targ_descr, M_TARG); switch (ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: case XPT_IMMED_NOTIFY: CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb)); - FREE(ccb, M_TARG); + kfree(ccb, M_TARG); break; default: /* Send back CCB if we got it from the periph */ @@ -1011,7 +1010,7 @@ targfreeccb(struct targ_softc *softc, union ccb *ccb) } else { CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb)); - FREE(ccb, M_TARG); + kfree(ccb, M_TARG); } break; } @@ -1022,8 +1021,7 @@ targgetdescr(struct targ_softc *softc) { struct targ_cmd_descr *descr; - MALLOC(descr, struct targ_cmd_descr *, sizeof(*descr), - M_TARG, M_INTWAIT); + descr = kmalloc(sizeof(*descr), M_TARG, M_INTWAIT); descr->mapinfo.num_bufs_used = 0; return (descr); } diff --git a/sys/dev/disk/md/md.c b/sys/dev/disk/md/md.c index df90e308c0..72e3b3e304 100644 --- a/sys/dev/disk/md/md.c +++ b/sys/dev/disk/md/md.c @@ -264,7 +264,7 @@ mdstrategy_malloc(struct dev_strategy_args *ap) case BUF_CMD_FREEBLKS: if (secpp) { if (secp) - FREE(secp, M_MDSECT); + kfree(secp, M_MDSECT); *secpp = 0; } break; @@ -285,25 +285,29 @@ mdstrategy_malloc(struct dev_strategy_args *ap) break; if (i == DEV_BSIZE && !uc) { if (secp) - FREE(secp, M_MDSECT); + kfree(secp, M_MDSECT); if (secpp) *secpp = (u_char *)(uintptr_t)uc; } else { if (!secpp) { - MALLOC(secpp, u_char **, (secno + nsec + 1) * sizeof(u_char *), M_MD, M_WAITOK | M_ZERO); + secpp = kmalloc((secno + nsec + 1) * sizeof(u_char *), + M_MD, + M_WAITOK | M_ZERO); bcopy(sc->secp, secpp, sc->nsecp * sizeof(u_char *)); - FREE(sc->secp, M_MD); + kfree(sc->secp, M_MD); sc->secp = secpp; sc->nsecp = secno + nsec + 1; secpp = &sc->secp[secno]; } if (i == DEV_BSIZE) { if (secp) - FREE(secp, M_MDSECT); + kfree(secp, M_MDSECT); *secpp = (u_char *)(uintptr_t)uc; } else { if (!secp) - MALLOC(secp, u_char *, DEV_BSIZE, M_MDSECT, M_WAITOK); + secp = kmalloc(DEV_BSIZE, + M_MDSECT, + M_WAITOK); bcopy(dst, secp, DEV_BSIZE); *secpp = secp; @@ -393,7 +397,7 @@ mdcreate(unsigned length) struct md_s *sc; struct disk_info info; - MALLOC(sc, struct md_s *,sizeof(*sc), M_MD, M_WAITOK | M_ZERO); + sc = kmalloc(sizeof(*sc), M_MD, M_WAITOK | M_ZERO); sc->unit = mdunits++; bioq_init(&sc->bio_queue); devstat_add_entry(&sc->stats, "md", sc->unit, DEV_BSIZE, @@ -444,7 +448,7 @@ mdcreate_malloc(void) sc->type = MD_MALLOC; sc->nsect = MD_NSECT; /* for now */ - MALLOC(sc->secp, u_char **, sizeof(u_char *), M_MD, M_WAITOK | M_ZERO); + sc->secp = kmalloc(sizeof(u_char *), M_MD, M_WAITOK | M_ZERO); sc->nsecp = 1; kprintf("md%d: Malloc disk\n", sc->unit); } @@ -467,7 +471,7 @@ md_drvcleanup(void) TAILQ_FOREACH_MUTABLE(sc, &mdlist, link, sc_temp) { for (secno = 0; secno < sc->nsecp; secno++) { if ((u_int)(uintptr_t)sc->secp[secno] > 255) - FREE(sc->secp[secno], M_MDSECT); + kfree(sc->secp[secno], M_MDSECT); } if (sc->dev != NULL) @@ -476,8 +480,8 @@ md_drvcleanup(void) devstat_remove_entry(&sc->stats); TAILQ_REMOVE(&mdlist, sc, link); - FREE(sc->secp, M_MD); - FREE(sc, M_MD); + kfree(sc->secp, M_MD); + kfree(sc, M_MD); } return 0; diff --git a/sys/dev/misc/musycc/musycc.c b/sys/dev/misc/musycc/musycc.c index edee1afbcc..edff3adfda 100644 --- a/sys/dev/misc/musycc/musycc.c +++ b/sys/dev/misc/musycc/musycc.c @@ -993,14 +993,14 @@ musycc_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_m NG_MKRESPONSE(*resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, M_NOWAIT); if (*resp == NULL) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (ENOMEM); } s = (char *)(*resp)->data; status_8370(sc, s); status_chans(sc,s); (*resp)->header.arglen = strlen(s) + 1; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (0); } else if (msg->header.cmd == NGM_TEXT_CONFIG) { if (msg->header.arglen) { @@ -1012,21 +1012,21 @@ musycc_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_m NG_MKRESPONSE(*resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, M_NOWAIT); if (*resp == NULL) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (ENOMEM); } r = (char *)(*resp)->data; *r = '\0'; musycc_config(node, s, r); (*resp)->header.arglen = strlen(r) + 1; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (0); } out: if (resp) *resp = NULL; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (EINVAL); } @@ -1063,7 +1063,7 @@ musycc_newhook(node_p node, hook_p hook, const char *name) return (EINVAL); if (sc->chan[chan] == NULL) { - MALLOC(sch, struct schan *, sizeof(*sch), M_MUSYCC, M_WAITOK | M_ZERO); + sch = kmalloc(sizeof(*sch), M_MUSYCC, M_WAITOK | M_ZERO); sch->sc = sc; sch->state = DOWN; sch->chan = chan; @@ -1260,10 +1260,8 @@ musycc_connect(hook_p hook) */ sch->nmd = nmd = 200 + nts * 4; sch->rx_last_md = 0; - MALLOC(sc->mdt[ch], struct mdesc *, - sizeof(struct mdesc) * nmd, M_MUSYCC, M_WAITOK); - MALLOC(sc->mdr[ch], struct mdesc *, - sizeof(struct mdesc) * nmd, M_MUSYCC, M_WAITOK); + sc->mdt[ch] = kmalloc(sizeof(struct mdesc) * nmd, M_MUSYCC, M_WAITOK); + sc->mdr[ch] = kmalloc(sizeof(struct mdesc) * nmd, M_MUSYCC, M_WAITOK); for (i = 0; i < nmd; i++) { if (i == nmd - 1) { sc->mdt[ch][i].snext = &sc->mdt[ch][0]; @@ -1318,8 +1316,8 @@ errfree: i--; m_free(sc->mdr[ch][i].m); } - FREE(sc->mdt[ch], M_MUSYCC); - FREE(sc->mdr[ch], M_MUSYCC); + kfree(sc->mdt[ch], M_MUSYCC); + kfree(sc->mdr[ch], M_MUSYCC); return (ENOBUFS); } @@ -1359,9 +1357,9 @@ musycc_disconnect(hook_p hook) if (sc->mdr[ch][i].m != NULL) m_freem(sc->mdr[ch][i].m); } - FREE(sc->mdt[ch], M_MUSYCC); + kfree(sc->mdt[ch], M_MUSYCC); sc->mdt[ch] = NULL; - FREE(sc->mdr[ch], M_MUSYCC); + kfree(sc->mdr[ch], M_MUSYCC); sc->mdr[ch] = NULL; for (i = 0; i < 32; i++) { @@ -1447,7 +1445,7 @@ musycc_attach(device_t self) f = pci_get_function(self); /* For function zero allocate a csoftc */ if (f == 0) { - MALLOC(csc, struct csoftc *, sizeof(*csc), M_MUSYCC, M_WAITOK | M_ZERO); + csc = kmalloc(sizeof(*csc), M_MUSYCC, M_WAITOK | M_ZERO); csc->bus = pci_get_bus(self); csc->slot = pci_get_slot(self); LIST_INSERT_HEAD(&sc_list, csc, list); @@ -1521,8 +1519,8 @@ musycc_attach(device_t self) sc->ds847x = csc->virbase[0] + i * 0x800; sc->reg = (struct globalr *) (csc->virbase[0] + i * 0x800); - MALLOC(sc->mycg, struct mycg *, - sizeof(struct mycg), M_MUSYCC, M_WAITOK | M_ZERO); + sc->mycg = kmalloc(sizeof(struct mycg), M_MUSYCC, + M_WAITOK | M_ZERO); sc->ram = &sc->mycg->cg; error = ng_make_node_common(&ngtypestruct, &sc->node); diff --git a/sys/dev/netif/ar/if_ar.c b/sys/dev/netif/ar/if_ar.c index 6c6d685803..9117f12ce5 100644 --- a/sys/dev/netif/ar/if_ar.c +++ b/sys/dev/netif/ar/if_ar.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ar/if_ar.c,v 1.66 2005/01/06 01:42:28 imp Exp $ - * $DragonFly: src/sys/dev/netif/ar/if_ar.c,v 1.23 2008/01/06 16:55:50 swildner Exp $ */ /* @@ -374,7 +373,7 @@ ar_detach(device_t device) * deallocate any system resources we may have * allocated on behalf of this driver. */ - FREE(hc->sc, M_DEVBUF); + kfree(hc->sc, M_DEVBUF); hc->sc = NULL; hc->mem_start = NULL; error = ar_deallocate_resources(device); @@ -1086,8 +1085,8 @@ arc_init(struct ar_hardc *hc) u_char isr, mar; u_long memst; - MALLOC(sc, struct ar_softc *, hc->numports * sizeof(struct ar_softc), - M_DEVBUF, M_WAITOK | M_ZERO); + sc = kmalloc(hc->numports * sizeof(struct ar_softc), M_DEVBUF, + M_WAITOK | M_ZERO); hc->sc = sc; hc->txc_dtr[0] = AR_TXC_DTR_NOTRESET | diff --git a/sys/dev/netif/mn/if_mn.c b/sys/dev/netif/mn/if_mn.c index 169ccc00bf..6d8b0f955b 100644 --- a/sys/dev/netif/mn/if_mn.c +++ b/sys/dev/netif/mn/if_mn.c @@ -337,7 +337,7 @@ ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mes if (msg->header.typecookie != NGM_GENERIC_COOKIE) { if (resp != NULL) *resp = NULL; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (EINVAL); } @@ -345,14 +345,14 @@ ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mes msg->header.cmd != NGM_TEXT_STATUS) { if (resp != NULL) *resp = NULL; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (EINVAL); } NG_MKRESPONSE(*resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, M_INTWAIT); if (*resp == NULL) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (ENOMEM); } @@ -366,7 +366,7 @@ ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mes if (msg->header.cmd == NGM_TEXT_CONFIG) { ngmn_config(node, s, r); (*resp)->header.arglen = strlen(r) + 1; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (0); } @@ -438,7 +438,7 @@ ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mes sch->tx_pending); } (*resp)->header.arglen = pos + 1; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (0); } diff --git a/sys/dev/netif/sr/if_sr.c b/sys/dev/netif/sr/if_sr.c index 75417fbfb3..73f82dce59 100644 --- a/sys/dev/netif/sr/if_sr.c +++ b/sys/dev/netif/sr/if_sr.c @@ -28,7 +28,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sr/if_sr.c,v 1.48.2.1 2002/06/17 15:10:58 jhay Exp $ - * $DragonFly: src/sys/dev/netif/sr/if_sr.c,v 1.24 2008/03/07 11:34:19 sephe Exp $ */ /* @@ -311,9 +310,8 @@ sr_attach(device_t device) int unit; /* index: channel w/in card */ hc = (struct sr_hardc *)device_get_softc(device); - MALLOC(sc, struct sr_softc *, - hc->numports * sizeof(struct sr_softc), - M_DEVBUF, M_WAITOK | M_ZERO); + sc = kmalloc(hc->numports * sizeof(struct sr_softc), M_DEVBUF, + M_WAITOK | M_ZERO); hc->sc = sc; /* @@ -479,7 +477,7 @@ sr_detach(device_t device) * deallocate any system resources we may have * allocated on behalf of this driver. */ - FREE(hc->sc, M_DEVBUF); + kfree(hc->sc, M_DEVBUF); hc->sc = NULL; hc->mem_start = NULL; return (sr_deallocate_resources(device)); @@ -2712,8 +2710,8 @@ ngsr_rcvmsg(node_p node, char *arg; int pos = 0; int resplen = sizeof(struct ng_mesg) + 512; - MALLOC(*resp, struct ng_mesg *, resplen, - M_NETGRAPH, M_INTWAIT | M_ZERO); + *resp = kmalloc(resplen, M_NETGRAPH, + M_INTWAIT | M_ZERO); if (*resp == NULL) { error = ENOMEM; break; diff --git a/sys/emulation/43bsd/43bsd_socket.c b/sys/emulation/43bsd/43bsd_socket.c index 2554761cbb..d50b05ed7b 100644 --- a/sys/emulation/43bsd/43bsd_socket.c +++ b/sys/emulation/43bsd/43bsd_socket.c @@ -32,9 +32,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/emulation/43bsd/43bsd_socket.c,v 1.10 2007/01/28 06:31:00 y0netan1 Exp $ - * from: DragonFly kern/uipc_syscalls.c,v 1.13 - * * The original versions of these syscalls used to live in * kern/uipc_syscalls.c. These are heavily modified to use the * new split syscalls. @@ -73,10 +70,10 @@ compat_43_getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len) return ENAMETOOLONG; if (len < offsetof(struct sockaddr, sa_data[0])) return EDOM; - MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK); + sa = kmalloc(len, M_SONAME, M_WAITOK); error = copyin(uaddr, sa, len); if (error) { - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } else { /* * Convert to the 4.4BSD sockaddr structure. @@ -134,7 +131,7 @@ sys_oaccept(struct accept_args *uap) } } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } else { get_mplock(); error = kern_accept(uap->s, 0, NULL, 0, &uap->sysmsg_iresult); @@ -166,7 +163,7 @@ sys_ogetsockname(struct getsockname_args *uap) error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -193,7 +190,7 @@ sys_ogetpeername(struct ogetpeername_args *uap) if (error == 0) error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -317,7 +314,7 @@ cleanup: iovec_free(&iov, aiov); cleanup2: if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -401,7 +398,7 @@ sys_orecvfrom(struct recvfrom_args *uap) copyout(&fromlen, uap->fromlenaddr, sizeof(fromlen)); } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -536,7 +533,7 @@ sys_orecvmsg(struct orecvmsg_args *uap) cleanup: if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); iovec_free(&iov, aiov); if (control) m_freem(control); diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c b/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c index f878a660ef..4a246daa6c 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c @@ -39,7 +39,6 @@ * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_subr.c,v 1.3.2.4 2001/06/25 19:46:47 pirzyk Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c,v 1.23 2007/08/25 23:27:02 corecode Exp $ */ #include @@ -125,11 +124,11 @@ loop: * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(pfs, struct pfsnode *, sizeof(struct pfsnode), M_TEMP, M_WAITOK); + pfs = kmalloc(sizeof(struct pfsnode), M_TEMP, M_WAITOK); error = getnewvnode(VT_PROCFS, mp, vpp, 0, 0); if (error) { - FREE(pfs, M_TEMP); + kfree(pfs, M_TEMP); goto out; } vp = *vpp; @@ -249,7 +248,7 @@ linprocfs_freevp(struct vnode *vp) } *pfspp = pfs->pfs_next; lwkt_reltoken(&pfs_token); - FREE(vp->v_data, M_TEMP); + kfree(vp->v_data, M_TEMP); vp->v_data = NULL; return (0); } diff --git a/sys/emulation/linux/linux_mib.c b/sys/emulation/linux/linux_mib.c index 4ba7a16501..ce2cb94876 100644 --- a/sys/emulation/linux/linux_mib.c +++ b/sys/emulation/linux/linux_mib.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.7.2.2 2001/11/05 19:08:22 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_mib.c,v 1.7 2003/08/15 06:32:51 dillon Exp $ */ #include @@ -124,8 +123,7 @@ get_prison(struct thread *td) return (NULL); if (pr->pr_linux == NULL) { - MALLOC(lpr, struct linux_prison *, sizeof *lpr, - M_PRISON, M_WAITOK|M_ZERO); + lpr = kmalloc(sizeof *lpr, M_PRISON, M_WAITOK | M_ZERO); pr->pr_linux = lpr; } diff --git a/sys/emulation/linux/linux_socket.c b/sys/emulation/linux/linux_socket.c index 668c01a3bc..b60870affb 100644 --- a/sys/emulation/linux/linux_socket.c +++ b/sys/emulation/linux/linux_socket.c @@ -104,10 +104,10 @@ linux_getsockaddr(struct sockaddr **namp, struct sockaddr *uaddr, size_t len) break; } - MALLOC(sa, struct sockaddr *, sa_len, M_SONAME, M_WAITOK); + sa = kmalloc(sa_len, M_SONAME, M_WAITOK); error = copyin(uaddr, sa, sa_len); if (error) { - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } else { /* * Convert to the 4.4BSD sockaddr structure. @@ -332,7 +332,7 @@ linux_bind(struct linux_bind_args *args, int *res) return (error); error = kern_bind(linux_args.s, sa); - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -364,7 +364,7 @@ linux_connect(struct linux_connect_args *args, int *res) return (error); error = kern_connect(linux_args.s, 0, sa); - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); if (error != EISCONN) return (error); @@ -451,7 +451,7 @@ linux_accept(struct linux_accept_args *args, int *res) } } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } else { error = kern_accept(linux_args.s, 0, NULL, 0, res); } @@ -497,7 +497,7 @@ linux_getsockname(struct linux_getsockname_args *args, int *res) error = copyout(&sa_len, linux_args.namelen, sizeof(*linux_args.namelen)); if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return(error); } @@ -529,7 +529,7 @@ linux_getpeername(struct linux_getpeername_args *args, int *res) error = copyout(&sa_len, linux_args.namelen, sizeof(*linux_args.namelen)); if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return(error); } @@ -705,7 +705,7 @@ linux_sendto(struct linux_sendto_args *args, size_t *res) if (linux_args.len < offsetof(struct ip, ip_off)) return (EINVAL); - MALLOC(msg, caddr_t, linux_args.len, M_LINUX, M_WAITOK); + msg = kmalloc(linux_args.len, M_LINUX, M_WAITOK); error = copyin(linux_args.msg, msg, linux_args.len); if (error) goto cleanup; @@ -730,9 +730,9 @@ linux_sendto(struct linux_sendto_args *args, size_t *res) cleanup: if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); if (msg) - FREE(msg, M_LINUX); + kfree(msg, M_LINUX); return(error); } @@ -795,7 +795,7 @@ linux_recvfrom(struct linux_recvfrom_args *args, size_t *res) sizeof(fromlen)); } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return(error); } @@ -902,7 +902,7 @@ cleanup: iovec_free(&iov, aiov); cleanup2: if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -1030,7 +1030,7 @@ linux_recvmsg(struct linux_recvmsg_args *args, size_t *res) cleanup: if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); iovec_free(&iov, aiov); if (control) m_freem(control); diff --git a/sys/gnu/vfs/ext2fs/ext2_inode.c b/sys/gnu/vfs/ext2fs/ext2_inode.c index 1316c1f231..5f305cc309 100644 --- a/sys/gnu/vfs/ext2fs/ext2_inode.c +++ b/sys/gnu/vfs/ext2fs/ext2_inode.c @@ -421,7 +421,7 @@ ext2_indirtrunc(struct inode *ip, daddr_t lbn, off_t doffset, daddr_t lastbn, } bap = (daddr_t *)bp->b_data; - MALLOC(copy, daddr_t *, fs->s_blocksize, M_TEMP, M_WAITOK); + copy = kmalloc(fs->s_blocksize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize); bzero((caddr_t)&bap[last + 1], (u_int)(NINDIR(fs) - (last + 1)) * sizeof (daddr_t)); @@ -464,7 +464,7 @@ ext2_indirtrunc(struct inode *ip, daddr_t lbn, off_t doffset, daddr_t lastbn, blocksreleased += blkcount; } } - FREE(copy, M_TEMP); + kfree(copy, M_TEMP); *countp = blocksreleased; return (allerror); } diff --git a/sys/gnu/vfs/ext2fs/ext2_lookup.c b/sys/gnu/vfs/ext2fs/ext2_lookup.c index 92cd4b8740..0f69e3ed85 100644 --- a/sys/gnu/vfs/ext2fs/ext2_lookup.c +++ b/sys/gnu/vfs/ext2fs/ext2_lookup.c @@ -174,7 +174,7 @@ ext2_readdir(struct vop_readdir_args *ap) auio.uio_resid = count; auio.uio_segflg = UIO_SYSSPACE; aiov.iov_len = count; - MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK); + dirbuf = kmalloc(count, M_TEMP, M_WAITOK); aiov.iov_base = dirbuf; error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred); if (error == 0) { @@ -223,12 +223,11 @@ ext2_readdir(struct vop_readdir_args *ap) if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) panic("ext2fs_readdir: unexpected uio from NFS server"); if (ncookies) { - MALLOC(cookies, off_t *, - ncookies * sizeof(off_t), - M_TEMP, M_WAITOK); + cookies = kmalloc(ncookies * sizeof(off_t), + M_TEMP, M_WAITOK); } else { - MALLOC(cookies, off_t *, - sizeof(off_t), M_TEMP, M_WAITOK); + cookies = kmalloc(sizeof(off_t), M_TEMP, + M_WAITOK); } off = startoffset; for (dp = (struct ext2_dir_entry_2 *)dirbuf, @@ -242,7 +241,7 @@ ext2_readdir(struct vop_readdir_args *ap) *ap->a_cookies = cookies; } } - FREE(dirbuf, M_TEMP); + kfree(dirbuf, M_TEMP); if (ap->a_eofflag) *ap->a_eofflag = VTOI(ap->a_vp)->i_size <= uio->uio_offset; vn_unlock(ap->a_vp); diff --git a/sys/gnu/vfs/ext2fs/ext2_vfsops.c b/sys/gnu/vfs/ext2fs/ext2_vfsops.c index 574ac35e16..54a67f3885 100644 --- a/sys/gnu/vfs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/vfs/ext2fs/ext2_vfsops.c @@ -1134,7 +1134,7 @@ restart: * which will cause a panic because ext2_sync() blindly * dereferences vp->v_data (as well it should). */ - MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); + ip = kmalloc(sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ if ((error = getnewvnode(VT_EXT2FS, mp, &vp, 0, LK_CANRECURSE)) != 0) { @@ -1142,7 +1142,7 @@ restart: wakeup(&ext2fs_inode_hash_lock); ext2fs_inode_hash_lock = 0; *vpp = NULL; - FREE(ip, M_EXT2NODE); + kfree(ip, M_EXT2NODE); return (error); } bzero((caddr_t)ip, sizeof(struct inode)); diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 63aa5d19a0..5583d1b464 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_event.c,v 1.2.2.10 2004/04/04 07:03:14 cperciva Exp $ - * $DragonFly: src/sys/kern/kern_event.c,v 1.33 2007/02/03 17:05:57 corecode Exp $ */ #include @@ -384,8 +383,7 @@ filt_timerattach(struct knote *kn) tticks = tvtohz_high(&tv); kn->kn_flags |= EV_CLEAR; /* automatically set */ - MALLOC(calloutp, struct callout *, sizeof(*calloutp), - M_KQUEUE, M_WAITOK); + calloutp = kmalloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK); callout_init(calloutp); kn->kn_hook = (caddr_t)calloutp; callout_reset(calloutp, tticks, filt_timerexpire, kn); @@ -406,7 +404,7 @@ filt_timerdetach(struct knote *kn) calloutp = (struct callout *)kn->kn_hook; callout_terminate(calloutp); - FREE(calloutp, M_KQUEUE); + kfree(calloutp, M_KQUEUE); kq_ncallouts--; } diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 615c79f5b3..0ed4c1d08f 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -32,7 +32,6 @@ * * @(#)kern_ktrace.c 8.2 (Berkeley) 9/23/93 * $FreeBSD: src/sys/kern/kern_ktrace.c,v 1.35.2.6 2002/07/05 22:36:38 darrenr Exp $ - * $DragonFly: src/sys/kern/kern_ktrace.c,v 1.30 2008/04/14 12:01:50 dillon Exp $ */ #include "opt_ktrace.h" @@ -74,8 +73,7 @@ ktrgetheader(int type) struct proc *p = curproc; /* XXX */ struct lwp *lp = curthread->td_lwp; - MALLOC(kth, struct ktr_header *, sizeof (struct ktr_header), - M_KTRACE, M_WAITOK); + kth = kmalloc(sizeof(struct ktr_header), M_KTRACE, M_WAITOK); kth->ktr_type = type; /* XXX threaded flag is a hack at the moment */ kth->ktr_flags = (p->p_nthreads > 1) ? KTRH_THREADED : 0; @@ -104,7 +102,7 @@ ktrsyscall(struct lwp *lp, int code, int narg, register_t args[]) */ lp->lwp_traceflag |= KTRFAC_ACTIVE; kth = ktrgetheader(KTR_SYSCALL); - MALLOC(ktp, struct ktr_syscall *, len, M_KTRACE, M_WAITOK); + ktp = kmalloc(len, M_KTRACE, M_WAITOK); ktp->ktr_code = code; ktp->ktr_narg = narg; argp = &ktp->ktr_args[0]; @@ -113,8 +111,8 @@ ktrsyscall(struct lwp *lp, int code, int narg, register_t args[]) kth->ktr_buf = (caddr_t)ktp; kth->ktr_len = len; ktrwrite(lp, kth, NULL); - FREE(ktp, M_KTRACE); - FREE(kth, M_KTRACE); + kfree(ktp, M_KTRACE); + kfree(kth, M_KTRACE); lp->lwp_traceflag &= ~KTRFAC_ACTIVE; } @@ -137,7 +135,7 @@ ktrsysret(struct lwp *lp, int code, int error, register_t retval) kth->ktr_len = sizeof(struct ktr_sysret); ktrwrite(lp, kth, NULL); - FREE(kth, M_KTRACE); + kfree(kth, M_KTRACE); lp->lwp_traceflag &= ~KTRFAC_ACTIVE; } @@ -152,7 +150,7 @@ ktrnamei(struct lwp *lp, char *path) kth->ktr_buf = path; ktrwrite(lp, kth, NULL); - FREE(kth, M_KTRACE); + kfree(kth, M_KTRACE); lp->lwp_traceflag &= ~KTRFAC_ACTIVE; } @@ -174,7 +172,7 @@ ktrgenio(struct lwp *lp, int fd, enum uio_rw rw, struct uio *uio, int error) uio->uio_rw = UIO_WRITE; ktrwrite(lp, kth, uio); - FREE(kth, M_KTRACE); + kfree(kth, M_KTRACE); lp->lwp_traceflag &= ~KTRFAC_ACTIVE; } @@ -194,7 +192,7 @@ ktrpsig(struct lwp *lp, int sig, sig_t action, sigset_t *mask, int code) kth->ktr_len = sizeof (struct ktr_psig); ktrwrite(lp, kth, NULL); - FREE(kth, M_KTRACE); + kfree(kth, M_KTRACE); lp->lwp_traceflag &= ~KTRFAC_ACTIVE; } @@ -212,7 +210,7 @@ ktrcsw(struct lwp *lp, int out, int user) kth->ktr_len = sizeof (struct ktr_csw); ktrwrite(lp, kth, NULL); - FREE(kth, M_KTRACE); + kfree(kth, M_KTRACE); lp->lwp_traceflag &= ~KTRFAC_ACTIVE; } #endif @@ -270,8 +268,8 @@ sys_ktrace(struct ktrace_args *uap) nlookup_done(&nd); goto done; } - MALLOC(tracenode, ktrace_node_t, sizeof (struct ktrace_node), - M_KTRACE, M_WAITOK | M_ZERO); + tracenode = kmalloc(sizeof(struct ktrace_node), M_KTRACE, + M_WAITOK | M_ZERO); tracenode->kn_vp = nd.nl_open_vp; tracenode->kn_refs = 1; nd.nl_open_vp = NULL; @@ -400,14 +398,14 @@ sys_utrace(struct utrace_args *uap) return (EINVAL); td->td_lwp->lwp_traceflag |= KTRFAC_ACTIVE; kth = ktrgetheader(KTR_USER); - MALLOC(cp, caddr_t, uap->len, M_KTRACE, M_WAITOK); + cp = kmalloc(uap->len, M_KTRACE, M_WAITOK); if (!copyin(uap->addr, cp, uap->len)) { kth->ktr_buf = cp; kth->ktr_len = uap->len; ktrwrite(td->td_lwp, kth, NULL); } - FREE(kth, M_KTRACE); - FREE(cp, M_KTRACE); + kfree(kth, M_KTRACE); + kfree(cp, M_KTRACE); td->td_lwp->lwp_traceflag &= ~KTRFAC_ACTIVE; return (0); @@ -427,7 +425,7 @@ ktrdestroy(struct ktrace_node **tracenodep) if (atomic_fetchadd_int(&tracenode->kn_refs, -1) == 1) { vn_close(tracenode->kn_vp, FREAD|FWRITE); tracenode->kn_vp = NULL; - FREE(tracenode, M_KTRACE); + kfree(tracenode, M_KTRACE); } } } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 4ab6a1643d..7808a9c6d9 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -34,7 +34,6 @@ * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 * $FreeBSD: src/sys/kern/kern_proc.c,v 1.63.2.9 2003/05/08 07:47:16 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_proc.c,v 1.45 2008/06/12 23:25:02 dillon Exp $ */ #include @@ -359,16 +358,15 @@ enterpgrp(struct proc *p, pid_t pgid, int mksess) error = ESRCH; goto fatal; } - MALLOC(pgrp, struct pgrp *, sizeof(struct pgrp), - M_PGRP, M_WAITOK); + pgrp = kmalloc(sizeof(struct pgrp), M_PGRP, M_WAITOK); if (mksess) { struct session *sess; /* * new session */ - MALLOC(sess, struct session *, sizeof(struct session), - M_SESSION, M_WAITOK); + sess = kmalloc(sizeof(struct session), M_SESSION, + M_WAITOK); sess->s_leader = p; sess->s_sid = p->p_pid; sess->s_count = 1; diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 5916f1c541..b125aa0a58 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -37,7 +37,6 @@ * * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_prot.c,v 1.53.2.9 2002/03/09 05:20:26 dd Exp $ - * $DragonFly: src/sys/kern/kern_prot.c,v 1.29 2008/02/16 15:53:39 matthias Exp $ */ /* @@ -1060,7 +1059,7 @@ crfree(struct ucred *cr) prison_free(cr->cr_prison); cr->cr_prison = NULL; /* safety */ - FREE((caddr_t)cr, M_CRED); + kfree((caddr_t)cr, M_CRED); } } diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 2cbd2177ca..8d598a5152 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -37,7 +37,6 @@ * * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_resource.c,v 1.55.2.5 2001/11/03 01:41:08 ps Exp $ - * $DragonFly: src/sys/kern/kern_resource.c,v 1.35 2008/05/27 05:25:34 dillon Exp $ */ #include "opt_compat.h" @@ -951,7 +950,7 @@ uicreate(uid_t uid) spin_uninit(&uip->ui_lock); varsymset_clean(&uip->ui_varsymset); - FREE(uip, M_UIDINFO); + kfree(uip, M_UIDINFO); uip = tmp; } else { LIST_INSERT_HEAD(UIHASH(uid), uip, ui_hash); @@ -1021,7 +1020,7 @@ uifree(struct uidinfo *uip) varsymset_clean(&uip->ui_varsymset); lockuninit(&uip->ui_varsymset.vx_lock); spin_uninit(&uip->ui_lock); - FREE(uip, M_UIDINFO); + kfree(uip, M_UIDINFO); return(0); } diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 11be675c52..71e09a422e 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -367,8 +367,8 @@ iovec_copyin(struct iovec *uiov, struct iovec **kiov, struct iovec *siov, if (iov_cnt > UIO_MAXIOV) return EMSGSIZE; if (iov_cnt > UIO_SMALLIOV) { - MALLOC(*kiov, struct iovec *, sizeof(struct iovec) * iov_cnt, - M_IOV, M_WAITOK); + *kiov = kmalloc(sizeof(struct iovec) * iov_cnt, M_IOV, + M_WAITOK); } else { *kiov = siov; } diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 1c4d17a9a5..aff13ce943 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -37,7 +37,6 @@ * * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/subr_prf.c,v 1.61.2.5 2002/08/31 18:22:08 dwmalone Exp $ - * $DragonFly: src/sys/kern/subr_prf.c,v 1.21 2008/07/17 23:56:23 dillon Exp $ */ #include "opt_ddb.h" @@ -260,8 +259,8 @@ log_console(struct uio *uio) pri = LOG_INFO | LOG_CONSOLE; muio = *uio; iovlen = uio->uio_iovcnt * sizeof (struct iovec); - MALLOC(miov, struct iovec *, iovlen, M_TEMP, M_WAITOK); - MALLOC(consbuffer, char *, CONSCHUNK, M_TEMP, M_WAITOK); + miov = kmalloc(iovlen, M_TEMP, M_WAITOK); + consbuffer = kmalloc(CONSCHUNK, M_TEMP, M_WAITOK); bcopy((caddr_t)muio.uio_iov, (caddr_t)miov, iovlen); muio.uio_iov = miov; uio = &muio; @@ -283,8 +282,8 @@ log_console(struct uio *uio) if (!nl) msglogchar('\n', pri); msgbuftrigger = 1; - FREE(miov, M_TEMP); - FREE(consbuffer, M_TEMP); + kfree(miov, M_TEMP); + kfree(consbuffer, M_TEMP); return; } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 0555036225..8bc9dc1653 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -37,7 +37,6 @@ * * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/sys_generic.c,v 1.55.2.10 2001/03/17 10:39:32 peter Exp $ - * $DragonFly: src/sys/kern/sys_generic.c,v 1.49 2008/05/05 22:09:44 dillon Exp $ */ #include "opt_ktrace.h" @@ -297,7 +296,7 @@ dofileread(int fd, struct file *fp, struct uio *auio, int flags, size_t *res) if (KTRPOINT(td, KTR_GENIO)) { int iovlen = auio->uio_iovcnt * sizeof(struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); + ktriov = kmalloc(iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio->uio_iov, (caddr_t)ktriov, iovlen); ktruio = *auio; } @@ -318,7 +317,7 @@ dofileread(int fd, struct file *fp, struct uio *auio, int flags, size_t *res) ktrgenio(td->td_lwp, fd, UIO_READ, &ktruio, error); rel_mplock(); } - FREE(ktriov, M_TEMP); + kfree(ktriov, M_TEMP); } #endif if (error == 0) @@ -507,7 +506,7 @@ dofilewrite(int fd, struct file *fp, struct uio *auio, int flags, size_t *res) if (KTRPOINT(td, KTR_GENIO)) { int iovlen = auio->uio_iovcnt * sizeof(struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); + ktriov = kmalloc(iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio->uio_iov, (caddr_t)ktriov, iovlen); ktruio = *auio; } @@ -531,7 +530,7 @@ dofilewrite(int fd, struct file *fp, struct uio *auio, int flags, size_t *res) ktrgenio(lp, fd, UIO_WRITE, &ktruio, error); rel_mplock(); } - FREE(ktriov, M_TEMP); + kfree(ktriov, M_TEMP); } #endif if (error == 0) diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c index ccf5bd92c3..f89962f152 100644 --- a/sys/kern/uipc_accf.c +++ b/sys/kern/uipc_accf.c @@ -25,7 +25,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/uipc_accf.c,v 1.2.2.2 2000/09/20 21:19:21 ps Exp $ - * $DragonFly: src/sys/kern/uipc_accf.c,v 1.3 2005/06/06 15:02:28 dillon Exp $ */ #define ACCEPT_FILTER_MOD @@ -74,7 +73,7 @@ accept_filt_add(struct accept_filter *filt) return (EEXIST); } else { p->accf_callback = filt->accf_callback; - FREE(filt, M_ACCF); + kfree(filt, M_ACCF); return (0); } } @@ -118,7 +117,7 @@ accept_filt_generic_mod_event(module_t mod, int event, void *data) switch (event) { case MOD_LOAD: - MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, M_WAITOK); + p = kmalloc(sizeof(*p), M_ACCF, M_WAITOK); bcopy(accfp, p, sizeof(*p)); crit_enter(); error = accept_filt_add(p); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 83e43e928b..f427b60cf8 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1570,9 +1570,9 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt) af->so_accept_filter->accf_destroy(so); } if (af->so_accept_filter_str != NULL) { - FREE(af->so_accept_filter_str, M_ACCF); + kfree(af->so_accept_filter_str, M_ACCF); } - FREE(af, M_ACCF); + kfree(af, M_ACCF); so->so_accf = NULL; } so->so_options &= ~SO_ACCEPTFILTER; @@ -1585,7 +1585,7 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt) goto out; } /* don't put large objects on the kernel stack */ - MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, M_WAITOK); + afap = kmalloc(sizeof(*afap), M_TEMP, M_WAITOK); error = sooptcopyin(sopt, afap, sizeof *afap, sizeof *afap); afap->af_name[sizeof(afap->af_name)-1] = '\0'; afap->af_arg[sizeof(afap->af_arg)-1] = '\0'; @@ -1596,18 +1596,19 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt) error = ENOENT; goto out; } - MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_WAITOK | M_ZERO); + af = kmalloc(sizeof(*af), M_ACCF, M_WAITOK | M_ZERO); if (afp->accf_create != NULL) { if (afap->af_name[0] != '\0') { int len = strlen(afap->af_name) + 1; - MALLOC(af->so_accept_filter_str, char *, len, M_ACCF, M_WAITOK); + af->so_accept_filter_str = kmalloc(len, M_ACCF, + M_WAITOK); strcpy(af->so_accept_filter_str, afap->af_name); } af->so_accept_filter_arg = afp->accf_create(so, afap->af_arg); if (af->so_accept_filter_arg == NULL) { - FREE(af->so_accept_filter_str, M_ACCF); - FREE(af, M_ACCF); + kfree(af->so_accept_filter_str, M_ACCF); + kfree(af, M_ACCF); so->so_accf = NULL; error = EINVAL; goto out; @@ -1618,7 +1619,7 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt) so->so_options |= SO_ACCEPTFILTER; out: if (afap != NULL) - FREE(afap, M_TEMP); + kfree(afap, M_TEMP); return (error); } #endif /* INET */ @@ -1876,15 +1877,15 @@ sogetopt(struct socket *so, struct sockopt *sopt) case SO_ACCEPTFILTER: if ((so->so_options & SO_ACCEPTCONN) == 0) return (EINVAL); - MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), - M_TEMP, M_WAITOK | M_ZERO); + afap = kmalloc(sizeof(*afap), M_TEMP, + M_WAITOK | M_ZERO); if ((so->so_options & SO_ACCEPTFILTER) != 0) { strcpy(afap->af_name, so->so_accf->so_accept_filter->accf_name); if (so->so_accf->so_accept_filter_str != NULL) strcpy(afap->af_arg, so->so_accf->so_accept_filter_str); } error = sooptcopyout(sopt, afap, sizeof(*afap)); - FREE(afap, M_TEMP); + kfree(afap, M_TEMP); break; #endif /* INET */ diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 461a671eef..bcbedfa04a 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -170,7 +170,7 @@ sys_bind(struct bind_args *uap) if (error) return (error); error = kern_bind(uap->s, sa); - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -378,7 +378,7 @@ accepted: *name = sa; } else { if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } } @@ -428,7 +428,7 @@ sys_accept(struct accept_args *uap) sizeof(*uap->anamelen)); } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } else { error = kern_accept(uap->s, 0, NULL, 0, &uap->sysmsg_iresult); @@ -464,7 +464,7 @@ sys_extaccept(struct extaccept_args *uap) sizeof(*uap->anamelen)); } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } else { error = kern_accept(uap->s, fflags, NULL, 0, &uap->sysmsg_iresult); @@ -565,7 +565,7 @@ sys_connect(struct connect_args *uap) if (error) return (error); error = kern_connect(uap->s, 0, sa); - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -586,7 +586,7 @@ sys_extconnect(struct extconnect_args *uap) if (error) return (error); error = kern_connect(uap->s, fflags, sa); - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -694,7 +694,7 @@ kern_sendmsg(int s, struct sockaddr *sa, struct uio *auio, if (KTRPOINT(td, KTR_GENIO)) { int iovlen = auio->uio_iovcnt * sizeof (struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); + ktriov = kmalloc(iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio->uio_iov, (caddr_t)ktriov, iovlen); ktruio = *auio; } @@ -720,7 +720,7 @@ kern_sendmsg(int s, struct sockaddr *sa, struct uio *auio, ktruio.uio_resid = len - auio->uio_resid; ktrgenio(lp, s, UIO_WRITE, &ktruio, error); } - FREE(ktriov, M_TEMP); + kfree(ktriov, M_TEMP); } #endif if (error == 0) @@ -762,7 +762,7 @@ sys_sendto(struct sendto_args *uap) &uap->sysmsg_szresult); if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -839,7 +839,7 @@ cleanup: iovec_free(&iov, aiov); cleanup2: if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -871,7 +871,7 @@ kern_recvmsg(int s, struct sockaddr **sa, struct uio *auio, if (KTRPOINT(td, KTR_GENIO)) { int iovlen = auio->uio_iovcnt * sizeof (struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); + ktriov = kmalloc(iovlen, M_TEMP, M_WAITOK); bcopy(auio->uio_iov, ktriov, iovlen); ktruio = *auio; } @@ -903,7 +903,7 @@ kern_recvmsg(int s, struct sockaddr **sa, struct uio *auio, ktruio.uio_resid = len - auio->uio_resid; ktrgenio(td->td_lwp, s, UIO_READ, &ktruio, error); } - FREE(ktriov, M_TEMP); + kfree(ktriov, M_TEMP); } #endif if (error == 0) @@ -963,7 +963,7 @@ sys_recvfrom(struct recvfrom_args *uap) } } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -1078,7 +1078,7 @@ sys_recvmsg(struct recvmsg_args *uap) cleanup: if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); iovec_free(&iov, aiov); if (control) m_freem(control); @@ -1289,7 +1289,7 @@ sys_getsockname(struct getsockname_args *uap) if (error == 0) error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -1359,7 +1359,7 @@ sys_getpeername(struct getpeername_args *uap) if (error == 0) error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } @@ -1374,10 +1374,10 @@ getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len) return ENAMETOOLONG; if (len < offsetof(struct sockaddr, sa_data[0])) return EDOM; - MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK); + sa = kmalloc(len, M_SONAME, M_WAITOK); error = copyin(uaddr, sa, len); if (error) { - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } else { #if BYTE_ORDER != BIG_ENDIAN /* diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7b5cfcd9c8..2ea0f3827c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2056,7 +2056,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep, if (nfs_pub.np_valid) { nfs_pub.np_valid = 0; if (nfs_pub.np_index != NULL) { - FREE(nfs_pub.np_index, M_TEMP); + kfree(nfs_pub.np_index, M_TEMP); nfs_pub.np_index = NULL; } } @@ -2092,8 +2092,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep, error = vn_get_namelen(rvp, &namelen); if (error) return (error); - MALLOC(nfs_pub.np_index, char *, namelen, M_TEMP, - M_WAITOK); + nfs_pub.np_index = kmalloc(namelen, M_TEMP, M_WAITOK); error = copyinstr(argp->ex_indexfile, nfs_pub.np_index, namelen, NULL); if (!error) { @@ -2108,7 +2107,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep, } } if (error) { - FREE(nfs_pub.np_index, M_TEMP); + kfree(nfs_pub.np_index, M_TEMP); return (error); } } diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 2ff5de64eb..4e60169c19 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -338,7 +338,7 @@ bpfopen(struct dev_open_args *ap) if (d != NULL) return(EBUSY); - MALLOC(d, struct bpf_d *, sizeof *d, M_BPF, M_WAITOK | M_ZERO); + d = kmalloc(sizeof *d, M_BPF, M_WAITOK | M_ZERO); dev->si_drv1 = d; d->bd_bufsize = bpf_bufsize; d->bd_sig = SIGIO; diff --git a/sys/net/bsd_comp.c b/sys/net/bsd_comp.c index 9764ff2027..da25793641 100644 --- a/sys/net/bsd_comp.c +++ b/sys/net/bsd_comp.c @@ -41,7 +41,6 @@ * This version is for use with mbufs on BSD-derived systems. * * $FreeBSD: src/sys/net/bsd_comp.c,v 1.11.2.1 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/bsd_comp.c,v 1.11 2006/12/22 23:44:54 swildner Exp $ */ #include @@ -340,14 +339,14 @@ bsd_alloc(u_char *options, int opt_len, int decomp) maxmaxcode = MAXCODE(bits); newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0])); - MALLOC(db, struct bsd_db *, newlen, M_DEVBUF, M_WAITOK); + db = kmalloc(newlen, M_DEVBUF, M_WAITOK); bzero(db, sizeof(*db) - sizeof(db->dict)); if (!decomp) { db->lens = NULL; } else { - MALLOC(db->lens, u_int16_t *, (maxmaxcode+1) * sizeof(db->lens[0]), - M_DEVBUF, M_WAITOK); + db->lens = kmalloc((maxmaxcode + 1) * sizeof(db->lens[0]), M_DEVBUF, + M_WAITOK); } db->totlen = newlen; diff --git a/sys/net/i4b/driver/i4b_ing.c b/sys/net/i4b/driver/i4b_ing.c index 53b363aea5..3245f8bbfb 100644 --- a/sys/net/i4b/driver/i4b_ing.c +++ b/sys/net/i4b/driver/i4b_ing.c @@ -28,7 +28,6 @@ * ------------------------------------------------- * * $FreeBSD: src/sys/i4b/driver/i4b_ing.c,v 1.10.2.4 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/net/i4b/driver/i4b_ing.c,v 1.11 2007/06/04 00:40:31 swildner Exp $ * * last edit-date: [Tue Jan 1 10:43:58 2002] * @@ -737,11 +736,11 @@ ng_ing_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); /* Free the message and return */ - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return(error); } diff --git a/sys/net/if.c b/sys/net/if.c index bb1bcf5685..967a2afcad 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2097,8 +2097,8 @@ if_addmulti( llsa = 0; } - MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, M_WAITOK); - MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, M_WAITOK); + ifma = kmalloc(sizeof *ifma, M_IFMADDR, M_WAITOK); + dupsa = kmalloc(sa->sa_len, M_IFMADDR, M_WAITOK); bcopy(sa, dupsa, sa->sa_len); ifma->ifma_addr = dupsa; @@ -2126,10 +2126,8 @@ if_addmulti( if (ifma) { ifma->ifma_refcount++; } else { - MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, - M_IFMADDR, M_WAITOK); - MALLOC(dupsa, struct sockaddr *, llsa->sa_len, - M_IFMADDR, M_WAITOK); + ifma = kmalloc(sizeof *ifma, M_IFMADDR, M_WAITOK); + dupsa = kmalloc(llsa->sa_len, M_IFMADDR, M_WAITOK); bcopy(llsa, dupsa, llsa->sa_len); ifma->ifma_addr = dupsa; ifma->ifma_ifp = ifp; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index d619ec7cf1..e430a5bc42 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -707,8 +707,7 @@ ether_resolvemulti( sin = (struct sockaddr_in *)sa; if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return EADDRNOTAVAIL; - MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK | M_ZERO); + sdl = kmalloc(sizeof *sdl, M_IFMADDR, M_WAITOK | M_ZERO); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; @@ -734,8 +733,7 @@ ether_resolvemulti( } if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return EADDRNOTAVAIL; - MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK | M_ZERO); + sdl = kmalloc(sizeof *sdl, M_IFMADDR, M_WAITOK | M_ZERO); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; diff --git a/sys/net/pf/if_pfsync.c b/sys/net/pf/if_pfsync.c index 255a534d8e..7af299cd56 100644 --- a/sys/net/pf/if_pfsync.c +++ b/sys/net/pf/if_pfsync.c @@ -126,8 +126,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit, caddr_t param __unused) lwkt_gettoken(&pf_token); - MALLOC(sc, struct pfsync_softc *, sizeof(*sc), M_PFSYNC, - M_WAITOK|M_ZERO); + sc = kmalloc(sizeof(*sc), M_PFSYNC, M_WAITOK | M_ZERO); pfsync_sync_ok = 1; sc->sc_mbuf = NULL; sc->sc_mbuf_net = NULL; diff --git a/sys/net/ppp/if_ppp.c b/sys/net/ppp/if_ppp.c index 9590a247d8..c8795f0179 100644 --- a/sys/net/ppp/if_ppp.c +++ b/sys/net/ppp/if_ppp.c @@ -70,7 +70,6 @@ */ /* $FreeBSD: src/sys/net/if_ppp.c,v 1.67.2.4 2002/04/14 21:41:48 luigi Exp $ */ -/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.41 2008/09/24 14:26:38 sephe Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ @@ -294,8 +293,7 @@ pppalloc(struct thread *td) sc->sc_relinq = NULL; bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats)); #ifdef VJC - MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress), - M_DEVBUF, M_WAITOK); + sc->sc_comp = kmalloc(sizeof(struct slcompress), M_DEVBUF, M_WAITOK); sl_compress_init(sc->sc_comp, -1); #endif #ifdef PPP_COMPRESS @@ -549,7 +547,7 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, return EINVAL; newcodelen = nbp->bf_len * sizeof(struct bpf_insn); if (newcodelen != 0) { - MALLOC(newcode, struct bpf_insn *, newcodelen, M_DEVBUF, M_WAITOK); + newcode = kmalloc(newcodelen, M_DEVBUF, M_WAITOK); if ((error = copyin((caddr_t)nbp->bf_insns, (caddr_t)newcode, newcodelen)) != 0) { kfree(newcode, M_DEVBUF); diff --git a/sys/net/ppp_layer/ppp_deflate.c b/sys/net/ppp_layer/ppp_deflate.c index 65364398e3..bf5f3b6d3f 100644 --- a/sys/net/ppp_layer/ppp_deflate.c +++ b/sys/net/ppp_layer/ppp_deflate.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/net/ppp_deflate.c,v 1.12.2.1 2002/04/14 21:41:48 luigi Exp $ */ -/* $DragonFly: src/sys/net/ppp_layer/ppp_deflate.c,v 1.9 2006/12/22 23:44:57 swildner Exp $ */ /* * ppp_deflate.c - interface the zlib procedures for Deflate compression @@ -124,7 +123,7 @@ z_alloc(void *notused, u_int items, u_int size) { void *ptr; - MALLOC(ptr, void *, items * size, M_DEVBUF, M_WAITOK); + ptr = kmalloc(items * size, M_DEVBUF, M_WAITOK); return ptr; } @@ -153,8 +152,7 @@ z_comp_alloc(u_char *options, int opt_len) if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) return NULL; - MALLOC(state, struct deflate_state *, sizeof(struct deflate_state), - M_DEVBUF, M_WAITOK); + state = kmalloc(sizeof(struct deflate_state), M_DEVBUF, M_WAITOK); state->strm.next_in = NULL; state->strm.zalloc = z_alloc; @@ -375,8 +373,7 @@ z_decomp_alloc(u_char *options, int opt_len) if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) return NULL; - MALLOC(state, struct deflate_state *, sizeof(struct deflate_state), - M_DEVBUF, M_WAITOK); + state = kmalloc(sizeof(struct deflate_state), M_DEVBUF, M_WAITOK); state->strm.next_out = NULL; state->strm.zalloc = z_alloc; diff --git a/sys/net/tun/if_tun.c b/sys/net/tun/if_tun.c index 83595db6e2..a88c12f5a8 100644 --- a/sys/net/tun/if_tun.c +++ b/sys/net/tun/if_tun.c @@ -142,7 +142,7 @@ tuncreate(cdev_t dev) UID_UUCP, GID_DIALER, 0600, "tun%d", lminor(dev)); #endif - MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); + sc = kmalloc(sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); sc->tun_flags = TUN_INITED; ifp = &sc->tun_if; diff --git a/sys/netgraph/UI/ng_UI.c b/sys/netgraph/UI/ng_UI.c index ee7946b334..0255827c4c 100644 --- a/sys/netgraph/UI/ng_UI.c +++ b/sys/netgraph/UI/ng_UI.c @@ -37,7 +37,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_UI.c,v 1.6.2.2 2000/10/24 18:36:44 julian Exp $ - * $DragonFly: src/sys/netgraph/UI/ng_UI.c,v 1.6 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_UI.c,v 1.14 1999/11/01 09:24:51 julian Exp $ */ @@ -109,13 +108,13 @@ ng_UI_constructor(node_p *nodep) int error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); /* Call generic node constructor */ if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -152,7 +151,7 @@ static int ng_UI_rcvmsg(node_p node, struct ng_mesg *msg, const char *raddr, struct ng_mesg **rp) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (EINVAL); } @@ -210,7 +209,7 @@ ng_UI_rmnode(node_p node) ng_cutlinks(node); ng_unname(node); bzero(priv, sizeof(*priv)); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); return (0); diff --git a/sys/netgraph/async/ng_async.c b/sys/netgraph/async/ng_async.c index 0dcce04d62..fc07f95902 100644 --- a/sys/netgraph/async/ng_async.c +++ b/sys/netgraph/async/ng_async.c @@ -37,7 +37,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_async.c,v 1.6.2.5 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/async/ng_async.c,v 1.7 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_async.c,v 1.17 1999/11/01 09:24:51 julian Exp $ */ @@ -183,23 +182,21 @@ nga_constructor(node_p *nodep) if ((error = ng_make_node_common(&typestruct, nodep))) return (error); - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); if (sc == NULL) return (ENOMEM); sc->amode = MODE_HUNT; sc->cfg.accm = ~0; sc->cfg.amru = NG_ASYNC_DEFAULT_MRU; sc->cfg.smru = NG_ASYNC_DEFAULT_MRU; - MALLOC(sc->abuf, u_char *, - ASYNC_BUF_SIZE(sc->cfg.smru), M_NETGRAPH, M_NOWAIT); + sc->abuf = kmalloc(ASYNC_BUF_SIZE(sc->cfg.smru), M_NETGRAPH, M_NOWAIT); if (sc->abuf == NULL) goto fail; - MALLOC(sc->sbuf, u_char *, - SYNC_BUF_SIZE(sc->cfg.amru), M_NETGRAPH, M_NOWAIT); + sc->sbuf = kmalloc(SYNC_BUF_SIZE(sc->cfg.amru), M_NETGRAPH, M_NOWAIT); if (sc->sbuf == NULL) { - FREE(sc->abuf, M_NETGRAPH); + kfree(sc->abuf, M_NETGRAPH); fail: - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); return (ENOMEM); } (*nodep)->private = sc; @@ -281,19 +278,19 @@ nga_rcvmsg(node_p node, struct ng_mesg *msg, ERROUT(EINVAL); cfg->enabled = !!cfg->enabled; /* normalize */ if (cfg->smru > sc->cfg.smru) { /* reallocate buffer */ - MALLOC(buf, u_char *, ASYNC_BUF_SIZE(cfg->smru), - M_NETGRAPH, M_NOWAIT); + buf = kmalloc(ASYNC_BUF_SIZE(cfg->smru), + M_NETGRAPH, M_NOWAIT); if (!buf) ERROUT(ENOMEM); - FREE(sc->abuf, M_NETGRAPH); + kfree(sc->abuf, M_NETGRAPH); sc->abuf = buf; } if (cfg->amru > sc->cfg.amru) { /* reallocate buffer */ - MALLOC(buf, u_char *, SYNC_BUF_SIZE(cfg->amru), - M_NETGRAPH, M_NOWAIT); + buf = kmalloc(SYNC_BUF_SIZE(cfg->amru), + M_NETGRAPH, M_NOWAIT); if (!buf) ERROUT(ENOMEM); - FREE(sc->sbuf, M_NETGRAPH); + kfree(sc->sbuf, M_NETGRAPH); sc->sbuf = buf; sc->amode = MODE_HUNT; sc->slen = 0; @@ -321,10 +318,10 @@ nga_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -338,10 +335,10 @@ nga_shutdown(node_p node) ng_cutlinks(node); ng_unname(node); - FREE(sc->abuf, M_NETGRAPH); - FREE(sc->sbuf, M_NETGRAPH); + kfree(sc->abuf, M_NETGRAPH); + kfree(sc->sbuf, M_NETGRAPH); bzero(sc, sizeof(*sc)); - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); node->private = NULL; ng_unref(node); return (0); diff --git a/sys/netgraph/bpf/ng_bpf.c b/sys/netgraph/bpf/ng_bpf.c index 336bf917da..c35b21caaf 100644 --- a/sys/netgraph/bpf/ng_bpf.c +++ b/sys/netgraph/bpf/ng_bpf.c @@ -37,7 +37,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_bpf.c,v 1.2.4.4 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/bpf/ng_bpf.c,v 1.5 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_bpf.c,v 1.3 1999/12/03 20:30:23 archie Exp $ */ @@ -236,7 +235,7 @@ ng_bpf_newhook(node_p node, hook_p hook, const char *name) int error; /* Create hook private structure */ - MALLOC(hip, hinfo_p, sizeof(*hip), M_NETGRAPH, M_NOWAIT | M_ZERO); + hip = kmalloc(sizeof(*hip), M_NETGRAPH, M_NOWAIT | M_ZERO); if (hip == NULL) return (ENOMEM); hip->hook = hook; @@ -245,7 +244,7 @@ ng_bpf_newhook(node_p node, hook_p hook, const char *name) /* Attach the default BPF program */ if ((error = ng_bpf_setprog(hook, &ng_bpf_default_prog)) != 0) { - FREE(hip, M_NETGRAPH); + kfree(hip, M_NETGRAPH); hook->private = NULL; return (error); } @@ -360,10 +359,10 @@ ng_bpf_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -390,7 +389,7 @@ ng_bpf_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) /* Need to put packet in contiguous memory for bpf */ if (m->m_next != NULL) { if (totlen > sizeof(buf)) { - MALLOC(data, u_char *, totlen, M_NETGRAPH, M_NOWAIT); + data = kmalloc(totlen, M_NETGRAPH, M_NOWAIT); if (data == NULL) { NG_FREE_DATA(m, meta); return (ENOMEM); @@ -405,7 +404,7 @@ ng_bpf_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) /* Run packet through filter */ len = bpf_filter(hip->prog->bpf_prog, data, totlen, totlen); if (needfree) - FREE(data, M_NETGRAPH); + kfree(data, M_NETGRAPH); /* See if we got a match and find destination hook */ if (len > 0) { @@ -457,9 +456,9 @@ ng_bpf_disconnect(hook_p hook) const hinfo_p hip = hook->private; KASSERT(hip != NULL, ("%s: null info", __func__)); - FREE(hip->prog, M_NETGRAPH); + kfree(hip->prog, M_NETGRAPH); bzero(hip, sizeof(*hip)); - FREE(hip, M_NETGRAPH); + kfree(hip, M_NETGRAPH); hook->private = NULL; /* for good measure */ if (hook->node->numhooks == 0) ng_rmnode(hook->node); @@ -486,14 +485,14 @@ ng_bpf_setprog(hook_p hook, const struct ng_bpf_hookprog *hp0) /* Make a copy of the program */ size = NG_BPF_HOOKPROG_SIZE(hp0->bpf_prog_len); - MALLOC(hp, struct ng_bpf_hookprog *, size, M_NETGRAPH, M_NOWAIT); + hp = kmalloc(size, M_NETGRAPH, M_NOWAIT); if (hp == NULL) return (ENOMEM); bcopy(hp0, hp, size); /* Free previous program, if any, and assign new one */ if (hip->prog != NULL) - FREE(hip->prog, M_NETGRAPH); + kfree(hip->prog, M_NETGRAPH); hip->prog = hp; return (0); } diff --git a/sys/netgraph/bridge/ng_bridge.c b/sys/netgraph/bridge/ng_bridge.c index 1b6dca06dd..289748ae51 100644 --- a/sys/netgraph/bridge/ng_bridge.c +++ b/sys/netgraph/bridge/ng_bridge.c @@ -37,7 +37,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_bridge.c,v 1.1.2.5 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/bridge/ng_bridge.c,v 1.11 2008/01/05 14:02:39 swildner Exp $ */ /* @@ -301,16 +300,16 @@ ng_bridge_constructor(node_p *nodep) int error; /* Allocate and initialize private info */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); callout_init(&priv->timer); /* Allocate and initialize hash table, etc. */ - MALLOC(priv->tab, struct ng_bridge_bucket *, - MIN_BUCKETS * sizeof(*priv->tab), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv->tab = kmalloc(MIN_BUCKETS * sizeof(*priv->tab), M_NETGRAPH, + M_NOWAIT | M_ZERO); if (priv->tab == NULL) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (ENOMEM); } priv->numBuckets = MIN_BUCKETS; @@ -322,7 +321,7 @@ ng_bridge_constructor(node_p *nodep) /* Call superclass constructor */ if ((error = ng_make_node_common(&ng_bridge_typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -358,8 +357,8 @@ ng_bridge_newhook(node_p node, hook_p hook, const char *name) return (EINVAL); if (priv->links[linkNum] != NULL) return (EISCONN); - MALLOC(priv->links[linkNum], struct ng_bridge_link *, - sizeof(*priv->links[linkNum]), M_NETGRAPH, M_NOWAIT); + priv->links[linkNum] = kmalloc(sizeof(*priv->links[linkNum]), + M_NETGRAPH, M_NOWAIT); if (priv->links[linkNum] == NULL) return (ENOMEM); bzero(priv->links[linkNum], sizeof(*priv->links[linkNum])); @@ -505,8 +504,8 @@ ng_bridge_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp != NULL) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -727,7 +726,7 @@ ng_bridge_rmnode(node_p node) KASSERT(priv->numLinks == 0 && priv->numHosts == 0, ("%s: numLinks=%d numHosts=%d", __func__, priv->numLinks, priv->numHosts)); - FREE(priv->tab, M_NETGRAPH); + kfree(priv->tab, M_NETGRAPH); /* NG_INVALID flag is now set so node will be freed at next timeout */ return (0); @@ -752,7 +751,7 @@ ng_bridge_disconnect(hook_p hook) /* Free associated link information */ KASSERT(priv->links[linkNum] != NULL, ("%s: no link", __func__)); - FREE(priv->links[linkNum], M_NETGRAPH); + kfree(priv->links[linkNum], M_NETGRAPH); priv->links[linkNum] = NULL; priv->numLinks--; @@ -811,8 +810,7 @@ ng_bridge_put(priv_p priv, const u_char *addr, int linkNum) #endif /* Allocate and initialize new hashtable entry */ - MALLOC(hent, struct ng_bridge_hent *, - sizeof(*hent), M_NETGRAPH, M_NOWAIT); + hent = kmalloc(sizeof(*hent), M_NETGRAPH, M_NOWAIT); if (hent == NULL) return (0); bcopy(addr, hent->host.addr, ETHER_ADDR_LEN); @@ -856,8 +854,8 @@ ng_bridge_rehash(priv_p priv) newMask = newNumBuckets - 1; /* Allocate and initialize new table */ - MALLOC(newTab, struct ng_bridge_bucket *, - newNumBuckets * sizeof(*newTab), M_NETGRAPH, M_NOWAIT | M_ZERO); + newTab = kmalloc(newNumBuckets * sizeof(*newTab), M_NETGRAPH, + M_NOWAIT | M_ZERO); if (newTab == NULL) return; @@ -881,7 +879,7 @@ ng_bridge_rehash(priv_p priv) ng_bridge_nodename(priv->node), priv->numBuckets, newNumBuckets); } - FREE(priv->tab, M_NETGRAPH); + kfree(priv->tab, M_NETGRAPH); priv->numBuckets = newNumBuckets; priv->hashMask = newMask; priv->tab = newTab; @@ -909,7 +907,7 @@ ng_bridge_remove_hosts(priv_p priv, int linkNum) if (linkNum == -1 || hent->host.linkNum == linkNum) { *hptr = SLIST_NEXT(hent, next); - FREE(hent, M_NETGRAPH); + kfree(hent, M_NETGRAPH); priv->numHosts--; } else hptr = &SLIST_NEXT(hent, next); @@ -937,7 +935,7 @@ ng_bridge_timeout(void *arg) /* If node was shut down, this is the final lingering timeout */ crit_enter(); if ((node->flags & NG_INVALID) != 0) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); crit_exit(); @@ -963,7 +961,7 @@ ng_bridge_timeout(void *arg) /* Remove hosts we haven't heard from in a while */ if (++hent->host.staleness >= priv->conf.maxStaleness) { *hptr = SLIST_NEXT(hent, next); - FREE(hent, M_NETGRAPH); + kfree(hent, M_NETGRAPH); priv->numHosts--; } else { if (hent->host.age < 0xffff) diff --git a/sys/netgraph/cisco/ng_cisco.c b/sys/netgraph/cisco/ng_cisco.c index e6f9dfb27e..ebb5521e6a 100644 --- a/sys/netgraph/cisco/ng_cisco.c +++ b/sys/netgraph/cisco/ng_cisco.c @@ -196,13 +196,13 @@ cisco_constructor(node_p *nodep) sc_p sc; int error = 0; - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); if (sc == NULL) return (ENOMEM); callout_init(&sc->timeout); if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); return (error); } (*nodep)->private = sc; @@ -338,8 +338,8 @@ cisco_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -409,7 +409,7 @@ cisco_rmnode(node_p node) ng_unname(node); node->private = NULL; ng_unref(sc->node); - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); return (0); } diff --git a/sys/netgraph/echo/ng_echo.c b/sys/netgraph/echo/ng_echo.c index 88a62ed5d3..5aeaa1fc66 100644 --- a/sys/netgraph/echo/ng_echo.c +++ b/sys/netgraph/echo/ng_echo.c @@ -37,7 +37,6 @@ * Author: Julian Elisher * * $FreeBSD: src/sys/netgraph/ng_echo.c,v 1.4.2.1 2000/10/24 18:36:44 julian Exp $ - * $DragonFly: src/sys/netgraph/echo/ng_echo.c,v 1.3 2003/08/07 21:17:31 dillon Exp $ * $Whistle: ng_echo.c,v 1.13 1999/11/01 09:24:51 julian Exp $ */ @@ -89,7 +88,7 @@ nge_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, msg->header.flags |= NGF_RESP; *rptr = msg; } else { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); } return (0); } diff --git a/sys/netgraph/eiface/ng_eiface.c b/sys/netgraph/eiface/ng_eiface.c index 2c810fa30b..8628d4a149 100644 --- a/sys/netgraph/eiface/ng_eiface.c +++ b/sys/netgraph/eiface/ng_eiface.c @@ -28,7 +28,6 @@ * * $Id: ng_eiface.c,v 1.14 2000/03/15 12:28:44 vitaly Exp $ * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.4.2.5 2002/12/17 21:47:48 julian Exp $ - * $DragonFly: src/sys/netgraph/eiface/ng_eiface.c,v 1.18 2008/06/21 03:39:20 sephe Exp $ */ #include @@ -316,7 +315,7 @@ ng_eiface_constructor(node_p *nodep) int error = 0; /* Allocate node and interface private structures */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_WAITOK | M_ZERO); ifp = &(priv->arpcom.ac_if); @@ -326,7 +325,7 @@ ng_eiface_constructor(node_p *nodep) /* Call generic node constructor */ if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } node = *nodep; @@ -478,8 +477,8 @@ ng_eiface_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } diff --git a/sys/netgraph/etf/ng_etf.c b/sys/netgraph/etf/ng_etf.c index 9565da02ff..d3409ae3c1 100644 --- a/sys/netgraph/etf/ng_etf.c +++ b/sys/netgraph/etf/ng_etf.c @@ -29,7 +29,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_etf.c,v 1.1.2.2 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/etf/ng_etf.c,v 1.3 2003/08/07 21:17:31 dillon Exp $ */ #include @@ -184,8 +183,8 @@ ng_etf_constructor(node_p *nodep) int error, i; /* Initialize private descriptor */ - MALLOC(privdata, etf_p, sizeof(*privdata), M_NETGRAPH_ETF, - M_NOWAIT | M_ZERO); + privdata = kmalloc(sizeof(*privdata), M_NETGRAPH_ETF, + M_NOWAIT | M_ZERO); if (privdata == NULL) return (ENOMEM); for (i = 0; i < HASHSIZE; i++) { @@ -194,7 +193,7 @@ ng_etf_constructor(node_p *nodep) /* Call the 'generic' (ie, superclass) node constructor */ if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); return (error); } /* Link structs together; this counts as our one reference to node */ @@ -226,8 +225,8 @@ ng_etf_newhook(node_p node, hook_p hook, const char *name) * Any other hook name is valid and can * later be associated with a filter rule. */ - MALLOC(hpriv, struct ETF_hookinfo *, sizeof(*hpriv), - M_NETGRAPH_ETF, M_NOWAIT | M_ZERO); + hpriv = kmalloc(sizeof(*hpriv), M_NETGRAPH_ETF, + M_NOWAIT | M_ZERO); if (hpriv == NULL) { return (ENOMEM); } @@ -325,8 +324,8 @@ ng_etf_rcvmsg(node_p node, struct ng_mesg *msg, * Ok, make the filter and put it in the * hashtable ready for matching. */ - MALLOC(fil, struct filter *, sizeof(*fil), - M_NETGRAPH_ETF, M_NOWAIT | M_ZERO); + fil = kmalloc(sizeof(*fil), M_NETGRAPH_ETF, + M_NOWAIT | M_ZERO); if (fil == NULL) { return (ENOMEM); } @@ -444,7 +443,7 @@ ng_etf_shutdown(node_p node) NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(privdata->node); - FREE(privdata, M_NETGRAPH_ETF); + kfree(privdata, M_NETGRAPH_ETF); return (0); } @@ -486,7 +485,7 @@ ng_etf_disconnect(hook_p hook) etfp->nomatch_hook.hook = NULL; } else { if (NG_HOOK_PRIVATE(hook)) /* Paranoia */ - FREE(NG_HOOK_PRIVATE(hook), M_NETGRAPH_ETF); + kfree(NG_HOOK_PRIVATE(hook), M_NETGRAPH_ETF); } NG_HOOK_SET_PRIVATE(hook, NULL); diff --git a/sys/netgraph/ether/ng_ether.c b/sys/netgraph/ether/ng_ether.c index e00a5b866c..88d3f9778e 100644 --- a/sys/netgraph/ether/ng_ether.c +++ b/sys/netgraph/ether/ng_ether.c @@ -38,7 +38,6 @@ * Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_ether.c,v 1.2.2.13 2002/07/02 20:10:25 archie Exp $ - * $DragonFly: src/sys/netgraph/ether/ng_ether.c,v 1.17 2008/07/27 10:06:57 sephe Exp $ */ /* @@ -304,7 +303,7 @@ ng_ether_attach(struct ifnet *ifp) } /* Allocate private data */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) { log(LOG_ERR, "%s: can't %s for %s\n", __func__, "allocate memory", name); @@ -342,7 +341,7 @@ ng_ether_detach(struct ifnet *ifp) IFP2NG(ifp) = NULL; /* detach node from interface */ priv = node->private; /* free node private info */ bzero(priv, sizeof(*priv)); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); /* free node itself */ } @@ -540,8 +539,8 @@ ng_ether_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp != NULL) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } diff --git a/sys/netgraph/fec/ng_fec.c b/sys/netgraph/fec/ng_fec.c index 0c551e81d8..16dbcb92c0 100644 --- a/sys/netgraph/fec/ng_fec.c +++ b/sys/netgraph/fec/ng_fec.c @@ -33,7 +33,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_fec.c,v 1.1.2.1 2002/11/01 21:39:31 julian Exp $ - * $DragonFly: src/sys/netgraph/fec/ng_fec.c,v 1.26 2008/05/28 12:11:13 sephe Exp $ */ /* * Copyright (c) 1996-1999 Whistle Communications, Inc. @@ -270,8 +269,8 @@ ng_fec_get_unit(int *unit) int i, *newarray, newlen; newlen = (2 * ng_fec_units_len) + 4; - MALLOC(newarray, int *, newlen * sizeof(*ng_fec_units), - M_NETGRAPH, M_NOWAIT); + newarray = kmalloc(newlen * sizeof(*ng_fec_units), + M_NETGRAPH, M_NOWAIT); if (newarray == NULL) return (ENOMEM); bcopy(ng_fec_units, newarray, @@ -279,7 +278,7 @@ ng_fec_get_unit(int *unit) for (i = ng_fec_units_len; i < newlen; i++) newarray[i] = ~0; if (ng_fec_units != NULL) - FREE(ng_fec_units, M_NETGRAPH); + kfree(ng_fec_units, M_NETGRAPH); ng_fec_units = newarray; ng_fec_units_len = newlen; } @@ -315,7 +314,7 @@ ng_fec_free_unit(int unit) */ ng_units_in_use++; if (ng_units_in_use == 0) { /* XXX make SMP safe */ - FREE(ng_fec_units, M_NETGRAPH); + kfree(ng_fec_units, M_NETGRAPH); ng_fec_units_len = 0; ng_fec_units = NULL; } @@ -365,8 +364,7 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface) } /* Allocate new list entry. */ - MALLOC(new, struct ng_fec_portlist *, - sizeof(struct ng_fec_portlist), M_NETGRAPH, M_NOWAIT); + new = kmalloc(sizeof(struct ng_fec_portlist), M_NETGRAPH, M_NOWAIT); if (new == NULL) return(ENOMEM); @@ -452,7 +450,7 @@ ng_fec_delport(struct ng_fec_private *priv, char *iface) /* Delete port */ TAILQ_REMOVE(&b->ng_fec_ports, p, fec_list); - FREE(p, M_NETGRAPH); + kfree(p, M_NETGRAPH); b->fec_ifcnt--; return(0); @@ -1059,7 +1057,7 @@ ng_fec_constructor(node_p *nodep) int error = 0; /* Allocate node and interface private structures */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -1071,16 +1069,16 @@ ng_fec_constructor(node_p *nodep) /* Get an interface unit number */ if ((error = ng_fec_get_unit(&priv->unit)) != 0) { - FREE(ifp, M_NETGRAPH); - FREE(priv, M_NETGRAPH); + kfree(ifp, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } /* Call generic node constructor */ if ((error = ng_make_node_common(&typestruct, nodep)) != 0) { ng_fec_free_unit(priv->unit); - FREE(ifp, M_NETGRAPH); - FREE(priv, M_NETGRAPH); + kfree(ifp, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } node = *nodep; @@ -1183,8 +1181,8 @@ ng_fec_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -1216,7 +1214,7 @@ ng_fec_rmnode(node_p node) ether_ifdetach(&priv->arpcom.ac_if); ifmedia_removeall(&priv->ifmedia); ng_fec_free_unit(priv->unit); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); return (0); diff --git a/sys/netgraph/frame_relay/ng_frame_relay.c b/sys/netgraph/frame_relay/ng_frame_relay.c index 6e1ff86ef2..4202373dd5 100644 --- a/sys/netgraph/frame_relay/ng_frame_relay.c +++ b/sys/netgraph/frame_relay/ng_frame_relay.c @@ -37,7 +37,6 @@ * Author: Julian Elisher * * $FreeBSD: src/sys/netgraph/ng_frame_relay.c,v 1.9.2.2 2000/10/24 18:36:45 julian Exp $ - * $DragonFly: src/sys/netgraph/frame_relay/ng_frame_relay.c,v 1.6 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_frame_relay.c,v 1.20 1999/11/01 09:24:51 julian Exp $ */ @@ -220,11 +219,11 @@ ngfrm_constructor(node_p *nodep) sc_p sc; int error = 0; - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); if (!sc) return (ENOMEM); if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); return (error); } sc->addrlen = 2; /* default */ @@ -490,7 +489,7 @@ ngfrm_rmnode(node_p node) ng_cutlinks(node); ng_unname(node); node->private = NULL; - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); ng_unref(node); return (0); } diff --git a/sys/netgraph/iface/ng_iface.c b/sys/netgraph/iface/ng_iface.c index b9f5cc2a8f..1eafd753f6 100644 --- a/sys/netgraph/iface/ng_iface.c +++ b/sys/netgraph/iface/ng_iface.c @@ -286,8 +286,8 @@ ng_iface_get_unit(int *unit) int i, *newarray, newlen; newlen = (2 * ng_iface_units_len) + 4; - MALLOC(newarray, int *, newlen * sizeof(*ng_iface_units), - M_NETGRAPH, M_NOWAIT); + newarray = kmalloc(newlen * sizeof(*ng_iface_units), + M_NETGRAPH, M_NOWAIT); if (newarray == NULL) return (ENOMEM); bcopy(ng_iface_units, newarray, @@ -295,7 +295,7 @@ ng_iface_get_unit(int *unit) for (i = ng_iface_units_len; i < newlen; i++) newarray[i] = ~0; if (ng_iface_units != NULL) - FREE(ng_iface_units, M_NETGRAPH); + kfree(ng_iface_units, M_NETGRAPH); ng_iface_units = newarray; ng_iface_units_len = newlen; } @@ -544,12 +544,12 @@ ng_iface_constructor(node_p *nodep) int error = 0; /* Allocate node and interface private structures */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); - MALLOC(ifp, struct ifnet *, sizeof(*ifp), M_NETGRAPH, M_NOWAIT | M_ZERO); + ifp = kmalloc(sizeof(*ifp), M_NETGRAPH, M_NOWAIT | M_ZERO); if (ifp == NULL) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (ENOMEM); } @@ -559,16 +559,16 @@ ng_iface_constructor(node_p *nodep) /* Get an interface unit number */ if ((error = ng_iface_get_unit(&priv->unit)) != 0) { - FREE(ifp, M_NETGRAPH); - FREE(priv, M_NETGRAPH); + kfree(ifp, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } /* Call generic node constructor */ if ((error = ng_make_node_common(&typestruct, nodep)) != 0) { ng_iface_free_unit(priv->unit); - FREE(ifp, M_NETGRAPH); - FREE(priv, M_NETGRAPH); + kfree(ifp, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } node = *nodep; @@ -724,8 +724,8 @@ ng_iface_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -800,10 +800,10 @@ ng_iface_rmnode(node_p node) ng_unname(node); bpfdetach(priv->ifp); if_detach(priv->ifp); - FREE(priv->ifp, M_NETGRAPH); + kfree(priv->ifp, M_NETGRAPH); priv->ifp = NULL; ng_iface_free_unit(priv->unit); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); return (0); diff --git a/sys/netgraph/ksocket/ng_ksocket.c b/sys/netgraph/ksocket/ng_ksocket.c index a22bd08d11..dd9f317681 100644 --- a/sys/netgraph/ksocket/ng_ksocket.c +++ b/sys/netgraph/ksocket/ng_ksocket.c @@ -248,17 +248,17 @@ ng_ksocket_sockaddr_parse(const struct ng_parse_type *type, return (EINVAL); pathlen = strlen(path); if (pathlen > SOCK_MAXADDRLEN) { - FREE(path, M_NETGRAPH); + kfree(path, M_NETGRAPH); return (E2BIG); } if (*buflen < pathoff + pathlen) { - FREE(path, M_NETGRAPH); + kfree(path, M_NETGRAPH); return (ERANGE); } *off += toklen; bcopy(path, sun->sun_path, pathlen); sun->sun_len = pathoff + pathlen; - FREE(path, M_NETGRAPH); + kfree(path, M_NETGRAPH); break; } @@ -333,7 +333,7 @@ ng_ksocket_sockaddr_unparse(const struct ng_parse_type *type, if ((pathtoken = ng_encode_string(pathbuf)) == NULL) return (ENOMEM); slen += ksnprintf(cbuf, cbuflen, "local/%s", pathtoken); - FREE(pathtoken, M_NETGRAPH); + kfree(pathtoken, M_NETGRAPH); if (slen >= cbuflen) return (ERANGE); *off += sun->sun_len; @@ -531,13 +531,13 @@ ng_ksocket_constructor(node_p *nodep) int error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); /* Call generic node constructor */ if ((error = ng_make_node_common(&ng_ksocket_typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -777,7 +777,7 @@ ng_ksocket_rcvmsg(node_p node, struct ng_mesg *msg, bail: /* Cleanup */ if (sa != NULL) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); break; } @@ -808,7 +808,7 @@ ng_ksocket_rcvmsg(node_p node, struct ng_mesg *msg, ksopt = (struct ng_ksocket_sockopt *)resp->data; sopt.sopt_val = ksopt->value; if ((error = sogetopt(so, &sopt)) != 0) { - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); break; } @@ -866,10 +866,10 @@ ng_ksocket_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -954,7 +954,7 @@ ng_ksocket_rmnode(node_p node) ng_cutlinks(node); ng_unname(node); bzero(priv, sizeof(*priv)); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); /* let the node escape */ return (0); @@ -1063,7 +1063,7 @@ ng_ksocket_incoming(struct socket *so, void *arg, int waitflag) /* See if we got anything */ if (sio.sb_mb == NULL) { if (sa != NULL) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); break; } @@ -1079,9 +1079,9 @@ ng_ksocket_incoming(struct socket *so, void *arg, int waitflag) u_int len; len = sizeof(*meta) + sizeof(*mhead) + sa->sa_len; - MALLOC(meta, meta_p, len, M_NETGRAPH, M_NOWAIT); + meta = kmalloc(len, M_NETGRAPH, M_NOWAIT); if (meta == NULL) { - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); goto sendit; } mhead = &meta->options[0]; @@ -1093,7 +1093,7 @@ ng_ksocket_incoming(struct socket *so, void *arg, int waitflag) mhead->type = NG_KSOCKET_META_SOCKADDR; mhead->len = sizeof(*mhead) + sa->sa_len; bcopy(sa, mhead->data, sa->sa_len); - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } sendit: /* Forward data with optional peer sockaddr as meta info */ NG_SEND_DATA(error, priv->hook, sio.sb_mb, meta); @@ -1192,7 +1192,7 @@ ng_ksocket_finish_accept(priv_p priv, struct ng_mesg **rptr) /* Clone a ksocket node to wrap the new socket */ if (ng_ksocket_constructor(&node2) != 0) { - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); soclose(so, FNONBLOCK); goto out; } @@ -1225,7 +1225,7 @@ ng_ksocket_finish_accept(priv_p priv, struct ng_mesg **rptr) out: if (sa != NULL) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); } /* diff --git a/sys/netgraph/l2tp/ng_l2tp.c b/sys/netgraph/l2tp/ng_l2tp.c index 5a9a28f780..34a55e73e3 100644 --- a/sys/netgraph/l2tp/ng_l2tp.c +++ b/sys/netgraph/l2tp/ng_l2tp.c @@ -38,7 +38,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_l2tp.c,v 1.1.2.1 2002/08/20 23:48:15 archie Exp $ - * $DragonFly: src/sys/netgraph/l2tp/ng_l2tp.c,v 1.8 2006/01/14 11:10:47 swildner Exp $ */ /* @@ -317,7 +316,7 @@ ng_l2tp_constructor(node_p *nodep) int error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_L2TP, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH_L2TP, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -331,7 +330,7 @@ ng_l2tp_constructor(node_p *nodep) /* Call generic node constructor */ if ((error = ng_make_node_common(&ng_l2tp_typestruct, nodep))) { - FREE(priv, M_NETGRAPH_L2TP); + kfree(priv, M_NETGRAPH_L2TP); return (error); } NG_NODE_SET_PRIVATE(*nodep, priv); @@ -381,8 +380,8 @@ ng_l2tp_newhook(node_p node, hook_p hook, const char *name) return (EINVAL); /* Create hook private structure */ - MALLOC(hpriv, hookpriv_p, - sizeof(*hpriv), M_NETGRAPH_L2TP, M_NOWAIT | M_ZERO); + hpriv = kmalloc(sizeof(*hpriv), M_NETGRAPH_L2TP, + M_NOWAIT | M_ZERO); if (hpriv == NULL) return (ENOMEM); hpriv->conf.session_id = htons(session_id); @@ -434,9 +433,9 @@ ng_l2tp_rcvmsg(node_p node, struct ng_mesg *msg, /* Save calling node as failure target */ if (priv->ftarget != NULL) - FREE(priv->ftarget, M_NETGRAPH_L2TP); - MALLOC(priv->ftarget, char *, - strlen(raddr) + 1, M_NETGRAPH_L2TP, M_NOWAIT); + kfree(priv->ftarget, M_NETGRAPH_L2TP); + priv->ftarget = kmalloc(strlen(raddr) + 1, + M_NETGRAPH_L2TP, M_NOWAIT); if (priv->ftarget == NULL) { error = ENOMEM; break; @@ -572,8 +571,8 @@ ng_l2tp_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -638,8 +637,8 @@ ng_l2tp_shutdown(node_p node) /* Free private data if neither timer is running */ if (!seq->rack_timer_running && !seq->xack_timer_running) { if (priv->ftarget != NULL) - FREE(priv->ftarget, M_NETGRAPH_L2TP); - FREE(priv, M_NETGRAPH_L2TP); + kfree(priv->ftarget, M_NETGRAPH_L2TP); + kfree(priv, M_NETGRAPH_L2TP); NG_NODE_SET_PRIVATE(node, NULL); } @@ -663,7 +662,7 @@ ng_l2tp_disconnect(hook_p hook) else if (hook == priv->lower) priv->lower = NULL; else { - FREE(NG_HOOK_PRIVATE(hook), M_NETGRAPH_L2TP); + kfree(NG_HOOK_PRIVATE(hook), M_NETGRAPH_L2TP); NG_HOOK_SET_PRIVATE(hook, NULL); } @@ -1270,8 +1269,8 @@ ng_l2tp_seq_xack_timeout(void *arg) seq->xack_timer_running = 0; if (!seq->rack_timer_running) { if (priv->ftarget != NULL) - FREE(priv->ftarget, M_NETGRAPH_L2TP); - FREE(priv, M_NETGRAPH_L2TP); + kfree(priv->ftarget, M_NETGRAPH_L2TP); + kfree(priv, M_NETGRAPH_L2TP); NG_NODE_SET_PRIVATE(node, NULL); } NG_NODE_UNREF(node); @@ -1312,8 +1311,8 @@ ng_l2tp_seq_rack_timeout(void *arg) seq->rack_timer_running = 0; if (!seq->xack_timer_running) { if (priv->ftarget != NULL) - FREE(priv->ftarget, M_NETGRAPH_L2TP); - FREE(priv, M_NETGRAPH_L2TP); + kfree(priv->ftarget, M_NETGRAPH_L2TP); + kfree(priv, M_NETGRAPH_L2TP); NG_NODE_SET_PRIVATE(node, NULL); } NG_NODE_UNREF(node); diff --git a/sys/netgraph/lmi/ng_lmi.c b/sys/netgraph/lmi/ng_lmi.c index 732a3e7f1c..51cb5f201b 100644 --- a/sys/netgraph/lmi/ng_lmi.c +++ b/sys/netgraph/lmi/ng_lmi.c @@ -37,7 +37,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_lmi.c,v 1.5.2.3 2002/07/02 22:17:18 archie Exp $ - * $DragonFly: src/sys/netgraph/lmi/ng_lmi.c,v 1.8 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_lmi.c,v 1.38 1999/11/01 09:24:52 julian Exp $ */ @@ -192,13 +191,13 @@ nglmi_constructor(node_p *nodep) sc_p sc; int error = 0; - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); if (sc == NULL) return (ENOMEM); callout_init(&sc->timeout); if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); return (error); } (*nodep)->private = sc; @@ -341,7 +340,7 @@ nglmi_inquire(sc_p sc, int full) * added by other modules). */ /* MALLOC(meta, meta_p, sizeof( struct ng_meta) + META_PAD, * M_NETGRAPH, M_NOWAIT); */ - MALLOC(meta, meta_p, sizeof(*meta) + META_PAD, M_NETGRAPH, M_NOWAIT); + meta = kmalloc(sizeof(*meta) + META_PAD, M_NETGRAPH, M_NOWAIT); if (meta != NULL) { /* if it failed, well, it was optional anyhow */ meta->used_len = (u_short) sizeof(struct ng_meta); meta->allocated_len @@ -546,7 +545,7 @@ nglmi_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, error = EINVAL; break; } - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -1066,7 +1065,7 @@ nglmi_rmnode(node_p node) ng_unname(node); node->private = NULL; ng_unref(sc->node); - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); return (0); } diff --git a/sys/netgraph/mppc/ng_mppc.c b/sys/netgraph/mppc/ng_mppc.c index f03e0ada25..83296d8b0f 100644 --- a/sys/netgraph/mppc/ng_mppc.c +++ b/sys/netgraph/mppc/ng_mppc.c @@ -38,7 +38,6 @@ * * $Whistle: ng_mppc.c,v 1.4 1999/11/25 00:10:12 archie Exp $ * $FreeBSD: src/sys/netgraph/ng_mppc.c,v 1.1.2.7 2002/12/16 17:58:42 archie Exp $ - * $DragonFly: src/sys/netgraph/mppc/ng_mppc.c,v 1.6 2008/01/05 14:02:39 swildner Exp $ */ /* @@ -186,13 +185,13 @@ ng_mppc_constructor(node_p *nodep) int error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); /* Call generic node constructor */ if ((error = ng_make_node_common(&ng_mppc_typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -270,12 +269,12 @@ ng_mppc_rcvmsg(node_p node, struct ng_mesg *msg, /* Save return address so we can send reset-req's */ if (!isComp && priv->ctrlpath != NULL) { - FREE(priv->ctrlpath, M_NETGRAPH); + kfree(priv->ctrlpath, M_NETGRAPH); priv->ctrlpath = NULL; } if (!isComp && raddr != NULL) { - MALLOC(priv->ctrlpath, char *, - strlen(raddr) + 1, M_NETGRAPH, M_NOWAIT); + priv->ctrlpath = kmalloc(strlen(raddr) + 1, + M_NETGRAPH, M_NOWAIT); if (priv->ctrlpath == NULL) ERROUT(ENOMEM); strcpy(priv->ctrlpath, raddr); @@ -287,14 +286,12 @@ ng_mppc_rcvmsg(node_p node, struct ng_mesg *msg, #ifdef NETGRAPH_MPPC_COMPRESSION /* Initialize state buffers for compression */ if (d->history != NULL) { - FREE(d->history, M_NETGRAPH); + kfree(d->history, M_NETGRAPH); d->history = NULL; } if ((cfg->bits & MPPC_BIT) != 0) { - MALLOC(d->history, u_char *, - isComp ? MPPC_SizeOfCompressionHistory() : - MPPC_SizeOfDecompressionHistory(), - M_NETGRAPH, M_NOWAIT); + d->history = kmalloc(isComp ? MPPC_SizeOfCompressionHistory() : MPPC_SizeOfDecompressionHistory(), + M_NETGRAPH, M_NOWAIT); if (d->history == NULL) ERROUT(ENOMEM); if (isComp) @@ -343,10 +340,10 @@ ng_mppc_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -418,15 +415,15 @@ ng_mppc_rmnode(node_p node) ng_cutlinks(node); ng_unname(node); if (priv->ctrlpath != NULL) - FREE(priv->ctrlpath, M_NETGRAPH); + kfree(priv->ctrlpath, M_NETGRAPH); #ifdef NETGRAPH_MPPC_COMPRESSION if (priv->xmit.history != NULL) - FREE(priv->xmit.history, M_NETGRAPH); + kfree(priv->xmit.history, M_NETGRAPH); if (priv->recv.history != NULL) - FREE(priv->recv.history, M_NETGRAPH); + kfree(priv->recv.history, M_NETGRAPH); #endif bzero(priv, sizeof(*priv)); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); /* let the node escape */ return (0); @@ -480,7 +477,7 @@ ng_mppc_compress(node_p node, struct mbuf *m, struct mbuf **resultp) /* Work with contiguous regions of memory */ inlen = m->m_pkthdr.len; - MALLOC(inbuf, u_char *, inlen, M_NETGRAPH, M_NOWAIT); + inbuf = kmalloc(inlen, M_NETGRAPH, M_NOWAIT); if (inbuf == NULL) return (ENOMEM); m_copydata(m, 0, inlen, (caddr_t)inbuf); @@ -488,9 +485,9 @@ ng_mppc_compress(node_p node, struct mbuf *m, struct mbuf **resultp) outlen = MPPC_MAX_BLOWUP(inlen); else outlen = MPPC_HDRLEN + inlen; - MALLOC(outbuf, u_char *, outlen, M_NETGRAPH, M_NOWAIT); + outbuf = kmalloc(outlen, M_NETGRAPH, M_NOWAIT); if (outbuf == NULL) { - FREE(inbuf, M_NETGRAPH); + kfree(inbuf, M_NETGRAPH); return (ENOMEM); } @@ -533,7 +530,7 @@ ng_mppc_compress(node_p node, struct mbuf *m, struct mbuf **resultp) bcopy(inbuf, outbuf + MPPC_HDRLEN, inlen); outlen = MPPC_HDRLEN + inlen; } - FREE(inbuf, M_NETGRAPH); + kfree(inbuf, M_NETGRAPH); /* Always set the flushed bit in stateless mode */ if ((d->cfg.bits & MPPE_STATELESS) != 0) @@ -569,7 +566,7 @@ ng_mppc_compress(node_p node, struct mbuf *m, struct mbuf **resultp) /* Return packet in an mbuf */ *resultp = m_devget((caddr_t)outbuf, outlen, 0, NULL, NULL); - FREE(outbuf, M_NETGRAPH); + kfree(outbuf, M_NETGRAPH); return (*resultp == NULL ? ENOBUFS : 0); } @@ -596,7 +593,7 @@ ng_mppc_decompress(node_p node, struct mbuf *m, struct mbuf **resultp) /* Copy payload into a contiguous region of memory */ len = m->m_pkthdr.len - MPPC_HDRLEN; - MALLOC(buf, u_char *, len, M_NETGRAPH, M_NOWAIT); + buf = kmalloc(len, M_NETGRAPH, M_NOWAIT); if (buf == NULL) return (ENOMEM); m_copydata(m, MPPC_HDRLEN, len, (caddr_t)buf); @@ -689,7 +686,7 @@ ng_mppc_decompress(node_p node, struct mbuf *m, struct mbuf **resultp) log(LOG_ERR, "%s: rec'd unexpectedly %s packet", __func__, "compressed"); failed: - FREE(buf, M_NETGRAPH); + kfree(buf, M_NETGRAPH); return (EINVAL); } @@ -702,10 +699,10 @@ failed: int decomplen, rtn; /* Allocate a buffer for decompressed data */ - MALLOC(decompbuf, u_char *, MPPC_DECOMP_BUFSIZE - + MPPC_DECOMP_SAFETY, M_NETGRAPH, M_NOWAIT); + decompbuf = kmalloc(MPPC_DECOMP_BUFSIZE + MPPC_DECOMP_SAFETY, + M_NETGRAPH, M_NOWAIT); if (decompbuf == NULL) { - FREE(buf, M_NETGRAPH); + kfree(buf, M_NETGRAPH); return (ENOMEM); } decomplen = MPPC_DECOMP_BUFSIZE; @@ -728,12 +725,12 @@ failed: || (rtn & MPPC_DECOMP_OK) != MPPC_DECOMP_OK) { log(LOG_ERR, "%s: decomp returned 0x%x", __func__, rtn); - FREE(decompbuf, M_NETGRAPH); + kfree(decompbuf, M_NETGRAPH); goto failed; } /* Replace compressed data with decompressed data */ - FREE(buf, M_NETGRAPH); + kfree(buf, M_NETGRAPH); buf = decompbuf; len = decomplen - destCnt; } @@ -741,7 +738,7 @@ failed: /* Return result in an mbuf */ *resultp = m_devget((caddr_t)buf, len, 0, NULL, NULL); - FREE(buf, M_NETGRAPH); + kfree(buf, M_NETGRAPH); return (*resultp == NULL ? ENOBUFS : 0); } diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 0becc66480..10aec622e4 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -255,7 +255,7 @@ struct ng_type { if (retaddr) { \ error = ng_queue_msg(here, resp, retaddr); \ } else { \ - FREE(resp, M_NETGRAPH); \ + kfree(resp, M_NETGRAPH); \ } \ } \ } while (0) @@ -263,7 +263,7 @@ struct ng_type { #define NG_FREE_MSG(msg) \ do { \ if ((msg)) { \ - FREE((msg), M_NETGRAPH); \ + kfree((msg), M_NETGRAPH); \ (msg) = NULL; \ } \ } while (0) @@ -271,7 +271,7 @@ struct ng_type { #define NG_FREE_META(a) \ do { \ if ((a)) { \ - FREE((a), M_NETGRAPH); \ + kfree((a), M_NETGRAPH); \ (a) = NULL; \ } \ } while (0) diff --git a/sys/netgraph/netgraph/ng_base.c b/sys/netgraph/netgraph/ng_base.c index 7ec19b29bd..64ed15b02c 100644 --- a/sys/netgraph/netgraph/ng_base.c +++ b/sys/netgraph/netgraph/ng_base.c @@ -38,7 +38,6 @@ * Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.11.2.17 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/netgraph/ng_base.c,v 1.28 2008/09/24 14:26:39 sephe Exp $ * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ */ @@ -340,7 +339,7 @@ ng_load_module(const char *name) if ((path = linker_search_path(filename)) == NULL) return (ENXIO); error = linker_load_file(path, &lf); - FREE(path, M_LINKER); + kfree(path, M_LINKER); if (error == 0) lf->userrefs++; /* pretend kldload'ed */ return (error); @@ -409,7 +408,7 @@ ng_make_node_common(struct ng_type *type, node_p *nodepp) } /* Make a node and try attach it to the type */ - MALLOC(node, node_p, sizeof(*node), M_NETGRAPH, M_NOWAIT | M_ZERO); + node = kmalloc(sizeof(*node), M_NETGRAPH, M_NOWAIT | M_ZERO); if (node == NULL) { TRAP_ERROR; return (ENOMEM); @@ -498,7 +497,7 @@ ng_unref(node_p node) node->type->refs--; LIST_REMOVE(node, nodes); LIST_REMOVE(node, idnodes); - FREE(node, M_NETGRAPH); + kfree(node, M_NETGRAPH); } crit_exit(); } @@ -612,7 +611,7 @@ ng_name_node(node_p node, const char *name) } /* Allocate space and copy it */ - MALLOC(node->name, char *, strlen(name) + 1, M_NETGRAPH, M_NOWAIT); + node->name = kmalloc(strlen(name) + 1, M_NETGRAPH, M_NOWAIT); if (node->name == NULL) { TRAP_ERROR; return (ENOMEM); @@ -687,7 +686,7 @@ void ng_unname(node_p node) { if (node->name) { - FREE(node->name, M_NETGRAPH); + kfree(node->name, M_NETGRAPH); node->name = NULL; ng_unref(node); } @@ -709,7 +708,7 @@ ng_unref_hook(hook_p hook) { crit_enter(); if (--hook->refs == 0) - FREE(hook, M_NETGRAPH); + kfree(hook, M_NETGRAPH); crit_exit(); } @@ -733,7 +732,7 @@ ng_add_hook(node_p node, const char *name, hook_p *hookp) } /* Allocate the hook and link it up */ - MALLOC(hook, hook_p, sizeof(*hook), M_NETGRAPH, M_NOWAIT | M_ZERO); + hook = kmalloc(sizeof(*hook), M_NETGRAPH, M_NOWAIT | M_ZERO); if (hook == NULL) { TRAP_ERROR; return (ENOMEM); @@ -756,7 +755,7 @@ ng_add_hook(node_p node, const char *name, hook_p *hookp) node->numhooks++; /* Set hook name */ - MALLOC(hook->name, char *, strlen(name) + 1, M_NETGRAPH, M_NOWAIT); + hook->name = kmalloc(strlen(name) + 1, M_NETGRAPH, M_NOWAIT); if (hook->name == NULL) { error = ENOMEM; LIST_REMOVE(hook, hooks); @@ -873,7 +872,7 @@ ng_disconnect_hook(hook_p hook) } ng_unref(node); /* might be the last reference */ if (hook->name) - FREE(hook->name, M_NETGRAPH); + kfree(hook->name, M_NETGRAPH); hook->node = NULL; /* may still be referenced elsewhere */ ng_unref_hook(hook); } @@ -1177,7 +1176,7 @@ ng_path2node(node_p here, const char *address, node_p *destp, char **rtnp) /* Now compute return address, i.e., the path to the sender */ if (rtnp != NULL) { - MALLOC(*rtnp, char *, NG_NODESIZ + 1, M_NETGRAPH, M_NOWAIT); + *rtnp = kmalloc(NG_NODESIZ + 1, M_NETGRAPH, M_NOWAIT); if (*rtnp == NULL) { TRAP_ERROR; return (ENOMEM); @@ -1214,7 +1213,7 @@ do { \ (msg), (retaddr), (resp)); \ } else { \ TRAP_ERROR; \ - FREE((msg), M_NETGRAPH); \ + kfree((msg), M_NETGRAPH); \ (error) = EINVAL; \ } \ } \ @@ -1235,7 +1234,7 @@ ng_send_msg(node_p here, struct ng_mesg *msg, const char *address, /* Find the target node */ error = ng_path2node(here, address, &dest, &retaddr); if (error) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return error; } @@ -1254,7 +1253,7 @@ ng_send_msg(node_p here, struct ng_mesg *msg, const char *address, * have taken a copy if they needed to make a delayed response. */ if (retaddr) - FREE(retaddr, M_NETGRAPH); + kfree(retaddr, M_NETGRAPH); return (error); } @@ -1269,7 +1268,7 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr, if (msg->header.typecookie != NGM_GENERIC_COOKIE) { TRAP_ERROR; - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (EINVAL); } switch (msg->header.cmd) { @@ -1563,7 +1562,7 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr, break; } if (c->name == NULL) { - FREE(rp, M_NETGRAPH); + kfree(rp, M_NETGRAPH); error = ENOSYS; break; } @@ -1582,7 +1581,7 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr, if ((error = ng_unparse(argstype, (u_char *)binary->data, ascii->data, bufSize)) != 0) { - FREE(rp, M_NETGRAPH); + kfree(rp, M_NETGRAPH); break; } } @@ -1637,7 +1636,7 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr, break; } if (c->name == NULL) { - FREE(rp, M_NETGRAPH); + kfree(rp, M_NETGRAPH); error = ENOSYS; break; } @@ -1655,7 +1654,7 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr, else { if ((error = ng_parse(argstype, ascii->data, &off, (u_char *)binary->data, &bufSize)) != 0) { - FREE(rp, M_NETGRAPH); + kfree(rp, M_NETGRAPH); break; } } @@ -1686,7 +1685,7 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr, TRAP_ERROR; error = EINVAL; } - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -1755,7 +1754,7 @@ ng_copy_meta(meta_p meta) if (meta == NULL) return (NULL); - MALLOC(meta2, meta_p, meta->used_len, M_NETGRAPH, M_NOWAIT); + meta2 = kmalloc(meta->used_len, M_NETGRAPH, M_NOWAIT); if (meta2 == NULL) return (NULL); meta2->allocated_len = meta->used_len; @@ -1919,8 +1918,7 @@ ng_getqblk(void) if ((q = ngqfree) == NULL) { crit_exit(); if (ngqsize < ngqroom) { /* don't worry about races */ - MALLOC(q, struct ng_queue_entry *, - sizeof(*q), M_NETGRAPH, M_NOWAIT); + q = kmalloc(sizeof(*q), M_NETGRAPH, M_NOWAIT); } } else { ngqfree = q->next; @@ -1942,7 +1940,7 @@ do { \ ngqfreesize++; \ crit_exit(); \ } else { \ - FREE((q), M_NETGRAPH); \ + kfree((q), M_NETGRAPH); \ } \ } while (0) @@ -2003,13 +2001,13 @@ ng_queue_msg(node_p here, struct ng_mesg *msg, const char *address) /* Find the target node. */ error = ng_path2node(here, address, &dest, &retaddr); if (error) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } if ((q = ng_getqblk()) == NULL) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); if (retaddr) - FREE(retaddr, M_NETGRAPH); + kfree(retaddr, M_NETGRAPH); return (ENOBUFS); } @@ -2085,14 +2083,14 @@ ngintr(netmsg_t pmsg) retaddr = ngq->body.msg.msg_retaddr; RETURN_QBLK(ngq); if (node->flags & NG_INVALID) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); } else { CALL_MSG_HANDLER(error, node, msg, retaddr, NULL); } ng_unref(node); if (retaddr) - FREE(retaddr, M_NETGRAPH); + kfree(retaddr, M_NETGRAPH); break; default: RETURN_QBLK(ngq); diff --git a/sys/netgraph/netgraph/ng_parse.c b/sys/netgraph/netgraph/ng_parse.c index fa1840052b..dd28d86d23 100644 --- a/sys/netgraph/netgraph/ng_parse.c +++ b/sys/netgraph/netgraph/ng_parse.c @@ -714,7 +714,7 @@ ng_string_parse(const struct ng_parse_type *type, *off += len; len = strlen(sval) + 1; bcopy(sval, buf, len); - FREE(sval, M_NETGRAPH); + kfree(sval, M_NETGRAPH); *buflen = len; return (0); } @@ -730,7 +730,7 @@ ng_string_unparse(const struct ng_parse_type *type, return (ENOMEM); NG_PARSE_APPEND("%s", s); *off += strlen(raw) + 1; - FREE(s, M_NETGRAPH); + kfree(s, M_NETGRAPH); return (0); } @@ -776,7 +776,7 @@ ng_fixedstring_parse(const struct ng_parse_type *type, *off += len; len = strlen(sval) + 1; bcopy(sval, buf, len); - FREE(sval, M_NETGRAPH); + kfree(sval, M_NETGRAPH); bzero(buf + len, fi->bufSize - len); *buflen = fi->bufSize; return (0); @@ -957,17 +957,17 @@ ng_bytearray_parse(const struct ng_parse_type *type, arraylen = (*getLength)(type, start, buf); if (arraylen > *buflen) { - FREE(str, M_NETGRAPH); + kfree(str, M_NETGRAPH); return (ERANGE); } slen = strlen(str) + 1; if (slen > arraylen) { - FREE(str, M_NETGRAPH); + kfree(str, M_NETGRAPH); return (E2BIG); } bcopy(str, buf, slen); bzero(buf + slen, arraylen - slen); - FREE(str, M_NETGRAPH); + kfree(str, M_NETGRAPH); *off += toklen; *buflen = arraylen; return (0); @@ -1060,7 +1060,7 @@ ng_parse_composite(const struct ng_parse_type *type, const char *s, int align, len, blen, error = 0; /* Initialize */ - MALLOC(foff, int *, num * sizeof(*foff), M_NETGRAPH, M_NOWAIT | M_ZERO); + foff = kmalloc(num * sizeof(*foff), M_NETGRAPH, M_NOWAIT | M_ZERO); if (foff == NULL) { error = ENOMEM; goto done; @@ -1217,7 +1217,7 @@ gotIndex: *buflen = blen; done: if (foff != NULL) - FREE(foff, M_NETGRAPH); + kfree(foff, M_NETGRAPH); return (error); } @@ -1237,7 +1237,7 @@ ng_unparse_composite(const struct ng_parse_type *type, const u_char *data, u_char *workBuf; /* Get workspace for checking default values */ - MALLOC(workBuf, u_char *, workSize, M_NETGRAPH, M_NOWAIT); + workBuf = kmalloc(workSize, M_NETGRAPH, M_NOWAIT); if (workBuf == NULL) return (ENOMEM); @@ -1288,14 +1288,14 @@ ng_unparse_composite(const struct ng_parse_type *type, const u_char *data, /* Print value */ if ((error = INVOKE(etype, unparse) (etype, data, off, cbuf, cbuflen)) != 0) { - FREE(workBuf, M_NETGRAPH); + kfree(workBuf, M_NETGRAPH); return (error); } cbuflen -= strlen(cbuf); cbuf += strlen(cbuf); didOne = 1; } - FREE(workBuf, M_NETGRAPH); + kfree(workBuf, M_NETGRAPH); /* Closing brace/bracket */ NG_PARSE_APPEND("%s%c", @@ -1529,7 +1529,7 @@ ng_parse_get_token(const char *s, int *startp, int *lenp) case '"': if ((t = ng_get_string_token(s, startp, lenp)) == NULL) return T_ERROR; - FREE(t, M_NETGRAPH); + kfree(t, M_NETGRAPH); return T_STRING; default: for (i = *startp + 1; s[i] != '\0' && !isspace(s[i]) @@ -1556,7 +1556,7 @@ ng_get_string_token(const char *s, int *startp, int *lenp) start = *startp; if (s[*startp] != '"') return (NULL); - MALLOC(cbuf, char *, strlen(s + start), M_NETGRAPH, M_NOWAIT); + cbuf = kmalloc(strlen(s + start), M_NETGRAPH, M_NOWAIT); if (cbuf == NULL) return (NULL); strcpy(cbuf, s + start + 1); @@ -1634,7 +1634,7 @@ ng_encode_string(const char *raw) char *cbuf; int off = 0; - MALLOC(cbuf, char *, strlen(raw) * 4 + 3, M_NETGRAPH, M_NOWAIT); + cbuf = kmalloc(strlen(raw) * 4 + 3, M_NETGRAPH, M_NOWAIT); if (cbuf == NULL) return (NULL); cbuf[off++] = '"'; diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index 120776e903..7bf1bcfcf3 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -29,7 +29,6 @@ * netgraph node. * * $FreeBSD: src/sys/netgraph/ng_device.c,v 1.1.2.1 2002/08/23 07:15:44 julian Exp $ - * $DragonFly: src/sys/netgraph/ng_device.c,v 1.11 2007/06/03 20:51:10 dillon Exp $ * */ @@ -218,7 +217,7 @@ static int ng_device_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mesg **rptr) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return(ENOTTY); } diff --git a/sys/netgraph/ng_message.h b/sys/netgraph/ng_message.h index 1eb940716e..27c56c0852 100644 --- a/sys/netgraph/ng_message.h +++ b/sys/netgraph/ng_message.h @@ -37,7 +37,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_message.h,v 1.4.2.5 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/ng_message.h,v 1.6 2008/01/05 14:02:38 swildner Exp $ * $Whistle: ng_message.h,v 1.12 1999/01/25 01:17:44 archie Exp $ */ @@ -275,8 +274,8 @@ struct typelist { */ #define NG_MKMESSAGE(msg, cookie, cmdid, len, how) \ do { \ - MALLOC((msg), struct ng_mesg *, sizeof(struct ng_mesg) \ - + (len), M_NETGRAPH, (how) | M_ZERO); \ + (msg) = kmalloc(sizeof(struct ng_mesg) + (len), M_NETGRAPH, \ + (how) | M_ZERO); \ if ((msg) == NULL) \ break; \ (msg)->header.version = NG_VERSION; \ @@ -293,8 +292,8 @@ struct typelist { */ #define NG_MKRESPONSE(rsp, msg, len, how) \ do { \ - MALLOC((rsp), struct ng_mesg *, sizeof(struct ng_mesg) \ - + (len), M_NETGRAPH, (how) | M_ZERO); \ + (rsp) = kmalloc(sizeof(struct ng_mesg) + (len), M_NETGRAPH, \ + (how) | M_ZERO); \ if ((rsp) == NULL) \ break; \ (rsp)->header.version = NG_VERSION; \ diff --git a/sys/netgraph/ng_sample.c b/sys/netgraph/ng_sample.c index 7db99cfa49..b2a5241f42 100644 --- a/sys/netgraph/ng_sample.c +++ b/sys/netgraph/ng_sample.c @@ -37,7 +37,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_sample.c,v 1.7.2.3 2002/07/02 23:44:03 archie Exp $ - * $DragonFly: src/sys/netgraph/ng_sample.c,v 1.4 2008/01/05 14:02:38 swildner Exp $ * $Whistle: ng_sample.c,v 1.13 1999/11/01 09:24:52 julian Exp $ */ @@ -153,7 +152,7 @@ ng_xxx_constructor(node_p *nodep) int i, error; /* Initialize private descriptor */ - MALLOC(privdata, xxx_p, sizeof(*privdata), M_NETGRAPH, M_NOWAIT | M_ZERO); + privdata = kmalloc(sizeof(*privdata), M_NETGRAPH, M_NOWAIT | M_ZERO); if (privdata == NULL) return (ENOMEM); for (i = 0; i < XXX_NUM_DLCIS; i++) { @@ -163,7 +162,7 @@ ng_xxx_constructor(node_p *nodep) /* Call the 'generic' (ie, superclass) node constructor */ if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); return (error); } @@ -303,10 +302,10 @@ ng_xxx_rcvmsg(node_p node, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); /* Free the message and return */ - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return(error); } @@ -432,7 +431,7 @@ ng_xxx_rmnode(node_p node) ng_unname(node); node->private = NULL; ng_unref(privdata->node); - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); #else privdata->packets_in = 0; /* reset stats */ privdata->packets_out = 0; diff --git a/sys/netgraph/one2many/ng_one2many.c b/sys/netgraph/one2many/ng_one2many.c index 561bce5e57..99d56fe2bc 100644 --- a/sys/netgraph/one2many/ng_one2many.c +++ b/sys/netgraph/one2many/ng_one2many.c @@ -37,7 +37,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_one2many.c,v 1.1.2.2 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/one2many/ng_one2many.c,v 1.4 2005/02/17 13:59:59 joerg Exp $ */ /* @@ -193,7 +192,7 @@ ng_one2many_constructor(node_p *nodep) int error; /* Allocate and initialize private info */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); priv->conf.xmitAlg = NG_ONE2MANY_XMIT_ROUNDROBIN; @@ -201,7 +200,7 @@ ng_one2many_constructor(node_p *nodep) /* Call superclass constructor */ if ((error = ng_make_node_common(&ng_one2many_typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -374,8 +373,8 @@ ng_one2many_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp != NULL) - FREE(resp, M_NETGRAPH); - FREE(msg, M_NETGRAPH); + kfree(resp, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -439,7 +438,7 @@ ng_one2many_rmnode(node_p node) ng_cutlinks(node); KASSERT(priv->numActiveMany == 0, ("%s: numActiveMany=%d", __func__, priv->numActiveMany)); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); return (0); diff --git a/sys/netgraph/ppp/ng_ppp.c b/sys/netgraph/ppp/ng_ppp.c index 7b09d6b4fe..cb5bca2978 100644 --- a/sys/netgraph/ppp/ng_ppp.c +++ b/sys/netgraph/ppp/ng_ppp.c @@ -37,7 +37,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_ppp.c,v 1.15.2.10 2003/03/10 17:55:48 archie Exp $ - * $DragonFly: src/sys/netgraph/ppp/ng_ppp.c,v 1.13 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_ppp.c,v 1.24 1999/11/01 09:24:52 julian Exp $ */ @@ -385,13 +384,13 @@ ng_ppp_constructor(node_p *nodep) int i, error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); /* Call generic node constructor */ if ((error = ng_make_node_common(&ng_ppp_typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -575,10 +574,10 @@ ng_ppp_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -803,7 +802,7 @@ ng_ppp_rmnode(node_p node) ng_unname(node); ng_ppp_frag_reset(node); bzero(priv, sizeof(*priv)); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); /* let the node escape */ return (0); @@ -1132,7 +1131,7 @@ ng_ppp_mp_input(node_p node, int linkNum, struct mbuf *m, meta_p meta) } /* Allocate a new frag struct for the queue */ - MALLOC(frag, struct ng_ppp_frag *, sizeof(*frag), M_NETGRAPH, M_NOWAIT); + frag = kmalloc(sizeof(*frag), M_NETGRAPH, M_NOWAIT); if (frag == NULL) { NG_FREE_DATA(m, meta); ng_ppp_frag_process(node); @@ -1151,7 +1150,7 @@ ng_ppp_mp_input(node_p node, int linkNum, struct mbuf *m, meta_p meta) } else if (diff == 0) { /* should never happen! */ link->stats.dupFragments++; NG_FREE_DATA(frag->data, frag->meta); - FREE(frag, M_NETGRAPH); + kfree(frag, M_NETGRAPH); return (EINVAL); } } @@ -1228,7 +1227,7 @@ ng_ppp_get_packet(node_p node, struct mbuf **mp, meta_p *metap) tail = tail->m_next; if (qent->last) qnext = NULL; - FREE(qent, M_NETGRAPH); + kfree(qent, M_NETGRAPH); priv->qlen--; } *mp = m; @@ -1277,7 +1276,7 @@ ng_ppp_frag_trim(node_p node) priv->bundleStats.dropFragments++; TAILQ_REMOVE(&priv->frags, qent, f_qent); NG_FREE_DATA(qent->data, qent->meta); - FREE(qent, M_NETGRAPH); + kfree(qent, M_NETGRAPH); priv->qlen--; removed = 1; } @@ -1339,7 +1338,7 @@ ng_ppp_frag_process(node_p node) priv->bundleStats.dropFragments++; TAILQ_REMOVE(&priv->frags, qent, f_qent); NG_FREE_DATA(qent->data, qent->meta); - FREE(qent, M_NETGRAPH); + kfree(qent, M_NETGRAPH); priv->qlen--; /* Process queue again */ @@ -1416,7 +1415,7 @@ ng_ppp_frag_checkstale(node_p node) priv->bundleStats.dropFragments++; TAILQ_REMOVE(&priv->frags, qent, f_qent); NG_FREE_DATA(qent->data, qent->meta); - FREE(qent, M_NETGRAPH); + kfree(qent, M_NETGRAPH); priv->qlen--; } @@ -2006,7 +2005,7 @@ ng_ppp_frag_reset(node_p node) for (qent = TAILQ_FIRST(&priv->frags); qent; qent = qnext) { qnext = TAILQ_NEXT(qent, f_qent); NG_FREE_DATA(qent->data, qent->meta); - FREE(qent, M_NETGRAPH); + kfree(qent, M_NETGRAPH); } TAILQ_INIT(&priv->frags); priv->qlen = 0; diff --git a/sys/netgraph/pppoe/ng_pppoe.c b/sys/netgraph/pppoe/ng_pppoe.c index 278e172e0c..fd2d664f91 100644 --- a/sys/netgraph/pppoe/ng_pppoe.c +++ b/sys/netgraph/pppoe/ng_pppoe.c @@ -37,7 +37,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_pppoe.c,v 1.23.2.17 2002/07/02 22:17:18 archie Exp $ - * $DragonFly: src/sys/netgraph/pppoe/ng_pppoe.c,v 1.11 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_pppoe.c,v 1.10 1999/11/01 09:24:52 julian Exp $ */ #if 0 @@ -514,13 +513,13 @@ ng_pppoe_constructor(node_p *nodep) AAA /* Initialize private descriptor */ - MALLOC(privdata, priv_p, sizeof(*privdata), M_NETGRAPH, M_NOWAIT | M_ZERO); + privdata = kmalloc(sizeof(*privdata), M_NETGRAPH, M_NOWAIT | M_ZERO); if (privdata == NULL) return (ENOMEM); /* Call the 'generic' (ie, superclass) node constructor */ if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); return (error); } @@ -558,7 +557,7 @@ AAA * The infrastructure has already checked that it's unique, * so just allocate it and hook it in. */ - MALLOC(sp, sessp, sizeof(*sp), M_NETGRAPH, M_NOWAIT | M_ZERO); + sp = kmalloc(sizeof(*sp), M_NETGRAPH, M_NOWAIT | M_ZERO); if (sp == NULL) return (ENOMEM); @@ -651,8 +650,8 @@ AAA /* * set up prototype header */ - MALLOC(neg, negp, sizeof(*neg), M_NETGRAPH, - M_NOWAIT | M_ZERO); + neg = kmalloc(sizeof(*neg), M_NETGRAPH, + M_NOWAIT | M_ZERO); if (neg == NULL) { kprintf("pppoe: Session out of memory\n"); @@ -661,7 +660,7 @@ AAA MGETHDR(neg->m, MB_DONTWAIT, MT_DATA); if(neg->m == NULL) { kprintf("pppoe: Session out of mbufs\n"); - FREE(neg, M_NETGRAPH); + kfree(neg, M_NETGRAPH); LEAVE(ENOBUFS); } neg->m->m_pkthdr.rcvif = NULL; @@ -669,7 +668,7 @@ AAA if ((neg->m->m_flags & M_EXT) == 0) { kprintf("pppoe: Session out of mcls\n"); m_freem(neg->m); - FREE(neg, M_NETGRAPH); + kfree(neg, M_NETGRAPH); LEAVE(ENOBUFS); } sp->neg = neg; @@ -794,11 +793,11 @@ AAA if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); /* Free the message and return */ quit: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return(error); } @@ -1180,7 +1179,7 @@ AAA = ETHERTYPE_PPPOE_SESS; sp->pkt_hdr.ph.code = 0; m_freem(neg->m); - FREE(sp->neg, M_NETGRAPH); + kfree(sp->neg, M_NETGRAPH); sp->neg = NULL; pppoe_send_event(sp, NGM_PPPOE_SUCCESS); break; @@ -1239,7 +1238,7 @@ AAA */ m_freem(sp->neg->m); callout_stop(&sp->neg->timeout_ch); - FREE(sp->neg, M_NETGRAPH); + kfree(sp->neg, M_NETGRAPH); sp->neg = NULL; } else { LEAVE (ENETUNREACH); @@ -1395,7 +1394,7 @@ AAA ng_unname(node); node->private = NULL; ng_unref(privdata->node); - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); return (0); } @@ -1492,9 +1491,9 @@ AAA callout_stop(&sp->neg->timeout_ch); if (sp->neg->m) m_freem(sp->neg->m); - FREE(sp->neg, M_NETGRAPH); + kfree(sp->neg, M_NETGRAPH); } - FREE(sp, M_NETGRAPH); + kfree(sp, M_NETGRAPH); hook->private = NULL; /* work out how many session hooks there are */ /* Node goes away on last session hook removal */ diff --git a/sys/netgraph/pptpgre/ng_pptpgre.c b/sys/netgraph/pptpgre/ng_pptpgre.c index 0fff74a05f..48c3c38766 100644 --- a/sys/netgraph/pptpgre/ng_pptpgre.c +++ b/sys/netgraph/pptpgre/ng_pptpgre.c @@ -37,7 +37,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_pptpgre.c,v 1.2.2.13 2002/10/10 18:27:54 archie Exp $ - * $DragonFly: src/sys/netgraph/pptpgre/ng_pptpgre.c,v 1.8 2008/01/05 14:02:39 swildner Exp $ * $Whistle: ng_pptpgre.c,v 1.7 1999/12/08 00:10:06 archie Exp $ */ @@ -283,13 +282,13 @@ ng_pptpgre_constructor(node_p *nodep) int error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); /* Call generic node constructor */ if ((error = ng_make_node_common(&ng_pptpgre_typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -388,10 +387,10 @@ ng_pptpgre_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -436,7 +435,7 @@ ng_pptpgre_rmnode(node_p node) /* If no timers remain, free private info as well */ if (priv->timers == 0) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; } @@ -760,7 +759,7 @@ ng_pptpgre_start_recv_ack_timer(node_p node) #endif /* Start new timer */ - MALLOC(a->rackTimerPtr, node_p *, sizeof(node_p), M_NETGRAPH, M_NOWAIT); + a->rackTimerPtr = kmalloc(sizeof(node_p), M_NETGRAPH, M_NOWAIT); if (a->rackTimerPtr == NULL) { priv->stats.memoryFailures++; return; /* XXX potential hang here */ @@ -785,7 +784,7 @@ ng_pptpgre_stop_recv_ack_timer(node_p node) struct ng_pptpgre_ackp *const a = &priv->ackp; if (callout_stop(&a->rackTimer)) { - FREE(a->rackTimerPtr, M_NETGRAPH); + kfree(a->rackTimerPtr, M_NETGRAPH); priv->timers--; ng_unref(node); } @@ -806,13 +805,13 @@ ng_pptpgre_recv_ack_timeout(void *arg) crit_enter(); /* This complicated stuff is needed to avoid race conditions */ - FREE(arg, M_NETGRAPH); + kfree(arg, M_NETGRAPH); KASSERT(node->refs > 0, ("%s: no refs", __func__)); KASSERT(priv != NULL, ("%s: priv=NULL", __func__)); priv->timers--; if ((node->flags & NG_INVALID) != 0) { /* shutdown race condition */ if (priv->timers == 0) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; } ng_unref(node); @@ -863,7 +862,7 @@ ng_pptpgre_start_send_ack_timer(node_p node, int ackTimeout) /* Start new timer */ KASSERT(a->sackTimerPtr == NULL, ("%s: sackTimer", __func__)); - MALLOC(a->sackTimerPtr, node_p *, sizeof(node_p), M_NETGRAPH, M_NOWAIT); + a->sackTimerPtr = kmalloc(sizeof(node_p), M_NETGRAPH, M_NOWAIT); if (a->sackTimerPtr == NULL) { priv->stats.memoryFailures++; return; /* XXX potential hang here */ @@ -888,7 +887,7 @@ ng_pptpgre_stop_send_ack_timer(node_p node) struct ng_pptpgre_ackp *const a = &priv->ackp; if (callout_stop(&a->sackTimer)) { - FREE(a->sackTimerPtr, M_NETGRAPH); + kfree(a->sackTimerPtr, M_NETGRAPH); priv->timers--; ng_unref(node); } @@ -910,13 +909,13 @@ ng_pptpgre_send_ack_timeout(void *arg) crit_enter(); /* This complicated stuff is needed to avoid race conditions */ - FREE(arg, M_NETGRAPH); + kfree(arg, M_NETGRAPH); KASSERT(node->refs > 0, ("%s: no refs", __func__)); KASSERT(priv != NULL, ("%s: priv=NULL", __func__)); priv->timers--; if ((node->flags & NG_INVALID) != 0) { /* shutdown race condition */ if (priv->timers == 0) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; } ng_unref(node); diff --git a/sys/netgraph/rfc1490/ng_rfc1490.c b/sys/netgraph/rfc1490/ng_rfc1490.c index 64ca2eb4cc..20e58b34da 100644 --- a/sys/netgraph/rfc1490/ng_rfc1490.c +++ b/sys/netgraph/rfc1490/ng_rfc1490.c @@ -37,7 +37,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_rfc1490.c,v 1.6.2.4 2002/07/02 22:17:18 archie Exp $ - * $DragonFly: src/sys/netgraph/rfc1490/ng_rfc1490.c,v 1.6 2008/01/05 14:02:40 swildner Exp $ * $Whistle: ng_rfc1490.c,v 1.22 1999/11/01 09:24:52 julian Exp $ */ @@ -127,13 +126,13 @@ ng_rfc1490_constructor(node_p *nodep) int error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); /* Call generic node constructor */ if ((error = ng_make_node_common(&typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -174,7 +173,7 @@ static int ng_rfc1490_rcvmsg(node_p node, struct ng_mesg *msg, const char *raddr, struct ng_mesg **rp) { - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (EINVAL); } @@ -320,7 +319,7 @@ ng_rfc1490_rmnode(node_p node) ng_unname(node); bzero(priv, sizeof(*priv)); node->private = NULL; - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); ng_unref(node); /* let the node escape */ return (0); } diff --git a/sys/netgraph/socket/ng_socket.c b/sys/netgraph/socket/ng_socket.c index 5eaeb0101b..98aea445d0 100644 --- a/sys/netgraph/socket/ng_socket.c +++ b/sys/netgraph/socket/ng_socket.c @@ -236,7 +236,7 @@ ngc_send(netmsg_t msg) /* Allocate an expendable buffer for the path, chop off * the sockaddr header, and make sure it's NUL terminated */ len = sap->sg_len - 2; - MALLOC(path, char *, len + 1, M_NETGRAPH, M_WAITOK); + path = kmalloc(len + 1, M_NETGRAPH, M_WAITOK); bcopy(sap->sg_data, path, len); path[len] = '\0'; @@ -247,7 +247,7 @@ ngc_send(netmsg_t msg) /* Move the data into a linear buffer as well. Messages are not * delivered in mbufs. */ - MALLOC(xmsg, char *, len + 1, M_NETGRAPH, M_WAITOK); + xmsg = kmalloc(len + 1, M_NETGRAPH, M_WAITOK); m_copydata(m, 0, len, xmsg); /* The callee will free the xmsg when done. The addr is our business. */ @@ -261,7 +261,7 @@ ngc_send(netmsg_t msg) release: if (path != NULL) - FREE(path, M_NETGRAPH); + kfree(path, M_NETGRAPH); if (control != NULL) m_freem(control); if (m != NULL) @@ -449,7 +449,7 @@ ng_setsockaddr(netmsg_t msg) if (pcbp->sockdata->node->name != NULL) sg_len += namelen = strlen(pcbp->sockdata->node->name); - MALLOC(sg, struct sockaddr_ng *, sg_len, M_SONAME, M_WAITOK | M_ZERO); + sg = kmalloc(sg_len, M_SONAME, M_WAITOK | M_ZERO); if (pcbp->sockdata->node->name != NULL) bcopy(pcbp->sockdata->node->name, sg->sg_data, namelen); @@ -482,12 +482,11 @@ ng_attach_cntl(struct socket *so) pcbp = sotongpcb(so); /* Allocate node private info */ - MALLOC(privdata, struct ngsock *, - sizeof(*privdata), M_NETGRAPH, M_WAITOK | M_ZERO); + privdata = kmalloc(sizeof(*privdata), M_NETGRAPH, M_WAITOK | M_ZERO); /* Make the generic node components */ if ((error = ng_make_node_common(&typestruct, &privdata->node)) != 0) { - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); ng_detach_common(pcbp, NG_CONTROL); return (error); } @@ -522,7 +521,7 @@ ng_attach_common(struct socket *so, int type) return (error); /* Allocate the pcb */ - MALLOC(pcbp, struct ngpcb *, sizeof(*pcbp), M_PCB, M_WAITOK | M_ZERO); + pcbp = kmalloc(sizeof(*pcbp), M_PCB, M_WAITOK | M_ZERO); pcbp->type = type; /* Link the pcb and the socket */ @@ -569,7 +568,7 @@ ng_detach_common(struct ngpcb *pcbp, int which) sofree(so); /* remove pcb ref */ LIST_REMOVE(pcbp, socks); - FREE(pcbp, M_PCB); + kfree(pcbp, M_PCB); } #ifdef NOTYET @@ -737,7 +736,7 @@ ship_msg(struct ngpcb *pcbp, struct ng_mesg *msg, struct sockaddr_ng *addr) /* Here we free the message, as we are the end of the line. * We need to do that regardless of whether we got mbufs. */ - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); if (mdata == NULL) { TRAP_ERROR; @@ -811,7 +810,7 @@ ngs_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, error = EINVAL; /* unknown command */ } /* Free the message and return */ - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return(error); } @@ -819,7 +818,7 @@ ngs_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, if ((retaddr == NULL) || (*retaddr == '\0')) retaddr = ""; addrlen = strlen(retaddr); - MALLOC(addr, struct sockaddr_ng *, addrlen + 4, M_NETGRAPH, M_NOWAIT); + addr = kmalloc(addrlen + 4, M_NETGRAPH, M_NOWAIT); if (addr == NULL) { TRAP_ERROR; return (ENOMEM); @@ -831,7 +830,7 @@ ngs_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, /* Send it up */ error = ship_msg(pcbp, msg, addr); - FREE(addr, M_NETGRAPH); + kfree(addr, M_NETGRAPH); return (error); } @@ -926,7 +925,7 @@ ngs_rmnode(node_p node) } node->private = NULL; ng_unref(node); - FREE(sockdata, M_NETGRAPH); + kfree(sockdata, M_NETGRAPH); return (0); } diff --git a/sys/netgraph/tee/ng_tee.c b/sys/netgraph/tee/ng_tee.c index e56de402a2..a050733fd7 100644 --- a/sys/netgraph/tee/ng_tee.c +++ b/sys/netgraph/tee/ng_tee.c @@ -37,7 +37,6 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_tee.c,v 1.7.2.5 2002/07/02 23:44:03 archie Exp $ - * $DragonFly: src/sys/netgraph/tee/ng_tee.c,v 1.6 2008/01/05 14:02:40 swildner Exp $ * $Whistle: ng_tee.c,v 1.18 1999/11/01 09:24:52 julian Exp $ */ @@ -154,12 +153,12 @@ ngt_constructor(node_p *nodep) sc_p privdata; int error = 0; - MALLOC(privdata, sc_p, sizeof(*privdata), M_NETGRAPH, M_NOWAIT | M_ZERO); + privdata = kmalloc(sizeof(*privdata), M_NETGRAPH, M_NOWAIT | M_ZERO); if (privdata == NULL) return (ENOMEM); if ((error = ng_make_node_common(&ng_tee_typestruct, nodep))) { - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); return (error); } (*nodep)->private = privdata; @@ -257,10 +256,10 @@ ngt_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -317,8 +316,7 @@ ngt_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) /* Copy meta info */ if (meta != NULL) { - MALLOC(meta2, meta_p, - meta->used_len, M_NETGRAPH, M_NOWAIT); + meta2 = kmalloc(meta->used_len, M_NETGRAPH, M_NOWAIT); if (meta2 == NULL) { m_freem(m2); NG_FREE_DATA(m, meta); @@ -365,7 +363,7 @@ ngt_rmnode(node_p node) ng_unname(node); node->private = NULL; ng_unref(privdata->node); - FREE(privdata, M_NETGRAPH); + kfree(privdata, M_NETGRAPH); return (0); } diff --git a/sys/netgraph/tty/ng_tty.c b/sys/netgraph/tty/ng_tty.c index 4c75c22d55..c34e130193 100644 --- a/sys/netgraph/tty/ng_tty.c +++ b/sys/netgraph/tty/ng_tty.c @@ -38,7 +38,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_tty.c,v 1.7.2.3 2002/02/13 00:43:12 dillon Exp $ - * $DragonFly: src/sys/netgraph/tty/ng_tty.c,v 1.19 2008/01/06 16:55:52 swildner Exp $ * $Whistle: ng_tty.c,v 1.21 1999/11/01 09:24:52 julian Exp $ */ @@ -207,7 +206,7 @@ ngt_open(cdev_t dev, struct tty *tp) } /* Initialize private struct */ - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_WAITOK | M_ZERO); + sc = kmalloc(sizeof(*sc), M_NETGRAPH, M_WAITOK | M_ZERO); sc->tp = tp; sc->hotchar = NG_TTY_DFL_HOTCHAR; sc->qtail = &sc->qhead; @@ -219,7 +218,7 @@ ngt_open(cdev_t dev, struct tty *tp) error = ng_make_node_common(&typestruct, &sc->node); ngt_nodeop_ok = 0; if (error) { - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); goto done; } ksnprintf(name, sizeof(name), "%s%d", typestruct.name, ngt_unit++); @@ -564,7 +563,7 @@ ngt_shutdown(node_p node) m_freem(sc->qhead); m_freem(sc->m); bzero(sc, sizeof(*sc)); - FREE(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); lwkt_reltoken(&tty_token); return (0); } @@ -646,10 +645,10 @@ ngt_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); lwkt_reltoken(&tty_token); return (error); } diff --git a/sys/netgraph/vjc/ng_vjc.c b/sys/netgraph/vjc/ng_vjc.c index c492cce928..7f2c35595e 100644 --- a/sys/netgraph/vjc/ng_vjc.c +++ b/sys/netgraph/vjc/ng_vjc.c @@ -37,7 +37,6 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_vjc.c,v 1.9.2.5 2002/07/02 23:44:03 archie Exp $ - * $DragonFly: src/sys/netgraph/vjc/ng_vjc.c,v 1.8 2008/01/05 14:02:40 swildner Exp $ * $Whistle: ng_vjc.c,v 1.17 1999/11/01 09:24:52 julian Exp $ */ @@ -247,13 +246,13 @@ ng_vjc_constructor(node_p *nodep) int error; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) return (ENOMEM); /* Call generic node constructor */ if ((error = ng_make_node_common(&ng_vjc_typestruct, nodep))) { - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (error); } (*nodep)->private = priv; @@ -395,10 +394,10 @@ ng_vjc_rcvmsg(node_p node, struct ng_mesg *msg, if (rptr) *rptr = resp; else if (resp) - FREE(resp, M_NETGRAPH); + kfree(resp, M_NETGRAPH); done: - FREE(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } @@ -552,7 +551,7 @@ ng_vjc_rmnode(node_p node) ng_cutlinks(node); ng_unname(node); bzero(priv, sizeof(*priv)); - FREE(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); node->private = NULL; ng_unref(node); return (0); diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 0710098cab..9dffe2e650 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -36,7 +36,6 @@ * * @(#)igmp.c 8.1 (Berkeley) 7/19/93 * $FreeBSD: src/sys/netinet/igmp.c,v 1.29.2.2 2003/01/23 21:06:44 sam Exp $ - * $DragonFly: src/sys/netinet/igmp.c,v 1.14 2008/06/08 08:38:05 sephe Exp $ */ /* @@ -137,7 +136,7 @@ find_rti(struct ifnet *ifp) } rti = rti->rti_next; } - MALLOC(rti, struct router_info *, sizeof *rti, M_IGMP, M_INTWAIT); + rti = kmalloc(sizeof *rti, M_IGMP, M_INTWAIT); rti->rti_ifp = ifp; rti->rti_type = IGMP_V2_ROUTER; rti->rti_time = 0; diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 12aa3a8a4f..bd88faa182 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -65,7 +65,6 @@ * * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.59.2.27 2004/01/02 04:06:42 ambrisko Exp $ - * $DragonFly: src/sys/netinet/in_pcb.c,v 1.48 2008/11/08 03:38:23 sephe Exp $ */ #include "opt_ipsec.h" @@ -983,8 +982,7 @@ in_setsockaddr(struct socket *so, struct sockaddr **nam) /* * Do the malloc first in case it blocks. */ - MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, - M_WAITOK | M_ZERO); + sin = kmalloc(sizeof *sin, M_SONAME, M_WAITOK | M_ZERO); sin->sin_family = AF_INET; sin->sin_len = sizeof *sin; @@ -1021,8 +1019,7 @@ in_setpeeraddr(struct socket *so, struct sockaddr **nam) /* * Do the malloc first in case it blocks. */ - MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, - M_WAITOK | M_ZERO); + sin = kmalloc(sizeof *sin, M_SONAME, M_WAITOK | M_ZERO); sin->sin_family = AF_INET; sin->sin_len = sizeof *sin; diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index 249ca353db..bd50d2a2ab 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -1,5 +1,4 @@ /* $KAME: sctp_asconf.c,v 1.23 2004/08/17 06:28:01 t-momose Exp $ */ -/* $DragonFly: src/sys/netinet/sctp_asconf.c,v 1.7 2008/03/07 11:34:20 sephe Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -955,7 +954,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct ifaddr *ifa, uint16_t type) /* take the entry off the appropriate list */ sctp_asconf_addr_mgmt_ack(stcb, aa->ifa, type, 1); /* free the entry */ - FREE(aa, M_PCB); + kfree(aa, M_PCB); #ifdef SCTP_DEBUG if (sctp_debug_on & SCTP_DEBUG_ASCONF1) { @@ -967,7 +966,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct ifaddr *ifa, uint16_t type) } /* for each aa */ /* adding new request to the queue */ - MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), M_PCB, M_NOWAIT); + aa = kmalloc(sizeof(*aa), M_PCB, M_NOWAIT); if (aa == NULL) { /* didn't get memory */ #ifdef SCTP_DEBUG @@ -1098,7 +1097,7 @@ sctp_asconf_queue_add_sa(struct sctp_tcb *stcb, struct sockaddr *sa, /* delete the existing entry in the queue */ TAILQ_REMOVE(&stcb->asoc.asconf_queue, aa, next); /* free the entry */ - FREE(aa, M_PCB); + kfree(aa, M_PCB); #ifdef SCTP_DEBUG if (sctp_debug_on & SCTP_DEBUG_ASCONF1) { kprintf("asconf_queue_add_sa: removing queued delete request\n"); @@ -1114,7 +1113,7 @@ sctp_asconf_queue_add_sa(struct sctp_tcb *stcb, struct sockaddr *sa, /* take the entry off the appropriate list */ sctp_asconf_addr_mgmt_ack(stcb, aa->ifa, type, 1); /* free the entry */ - FREE(aa, M_PCB); + kfree(aa, M_PCB); #ifdef SCTP_DEBUG if (sctp_debug_on & SCTP_DEBUG_ASCONF1) { kprintf("asconf_queue_add_sa: removing queued add request\n"); @@ -1125,7 +1124,7 @@ sctp_asconf_queue_add_sa(struct sctp_tcb *stcb, struct sockaddr *sa, } /* for each aa */ /* adding new request to the queue */ - MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), M_PCB, M_NOWAIT); + aa = kmalloc(sizeof(*aa), M_PCB, M_NOWAIT); if (aa == NULL) { /* didn't get memory */ #ifdef SCTP_DEBUG @@ -1320,7 +1319,7 @@ sctp_asconf_process_param_ack(struct sctp_tcb *stcb, /* remove the param and free it */ TAILQ_REMOVE(&stcb->asoc.asconf_queue, aparam, next); - FREE(aparam, M_PCB); + kfree(aparam, M_PCB); } /* diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 077413bc8c..8be314bc11 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -2388,7 +2388,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int ok_to_sack, int was_a_gap, int *abort */ struct sctp_tmit_chunk *chk; sctp_handle_stream_reset_response(stcb, asoc->pending_reply); - FREE(asoc->pending_reply, M_PCB); + kfree(asoc->pending_reply, M_PCB); asoc->pending_reply = NULL; chk = TAILQ_FIRST(&asoc->pending_reply_queue); while (chk) { diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 5bb2aec3d9..a68fff1a98 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -268,10 +268,10 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb, /* open the requested streams */ if (asoc->strmin != NULL) { /* Free the old ones */ - FREE(asoc->strmin, M_PCB); + kfree(asoc->strmin, M_PCB); } - MALLOC(asoc->strmin, struct sctp_stream_in *, asoc->streamincnt * - sizeof(struct sctp_stream_in), M_PCB, M_NOWAIT); + asoc->strmin = kmalloc(asoc->streamincnt * sizeof(struct sctp_stream_in), + M_PCB, M_NOWAIT); if (asoc->strmin == NULL) { /* we didn't get memory for the streams! */ #ifdef SCTP_DEBUG @@ -2745,11 +2745,11 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb, * for each reset that the cum-ack * goes by. This is a short cut. */ - FREE(stcb->asoc.pending_reply, M_PCB); + kfree(stcb->asoc.pending_reply, M_PCB); stcb->asoc.pending_reply = NULL; } - MALLOC(stcb->asoc.pending_reply, struct sctp_stream_reset_response *, param_length, - M_PCB, M_NOWAIT); + stcb->asoc.pending_reply = kmalloc(param_length, M_PCB, + M_NOWAIT); if (stcb->asoc.pending_reply == NULL) return; /* XXX */ memcpy(stcb->asoc.pending_reply, resp, param_length); diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 5cd67956d0..a89130d9de 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -4843,7 +4843,7 @@ sctp_sendall_completes(void *ptr, u_int32_t val) /* now free everything */ m_freem(ca->m); - FREE(ca, M_PCB); + kfree(ca, M_PCB); } @@ -4916,8 +4916,7 @@ sctp_sendall (struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, struct sc { int ret; struct sctp_copy_all *ca; - MALLOC(ca, struct sctp_copy_all *, - sizeof(struct sctp_copy_all), M_PCB, MB_WAIT); + ca = kmalloc(sizeof(struct sctp_copy_all), M_PCB, MB_WAIT); if (ca == NULL) { m_freem(m); return (ENOMEM); @@ -4936,7 +4935,7 @@ sctp_sendall (struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, struct sc ca->sndlen = uio->uio_resid; ca->m = sctp_copy_out_all(uio, ca->sndlen); if (ca->m == NULL) { - FREE(ca, M_PCB); + kfree(ca, M_PCB); return (ENOMEM); } } else { @@ -4960,7 +4959,7 @@ sctp_sendall (struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, struct sc #ifdef SCTP_DEBUG kprintf("Failed to initate iterator to takeover associations\n"); #endif - FREE(ca, M_PCB); + kfree(ca, M_PCB); return (EFAULT); } @@ -7502,13 +7501,11 @@ sctp_output(struct sctp_inpcb *inp, struct mbuf *m, struct sockaddr *addr, asoc->streamoutcnt, asoc->pre_open_streams); } #endif - FREE(asoc->strmout, M_PCB); + kfree(asoc->strmout, M_PCB); asoc->strmout = NULL; asoc->streamoutcnt = asoc->pre_open_streams; - MALLOC(asoc->strmout, struct sctp_stream_out *, - asoc->streamoutcnt * - sizeof(struct sctp_stream_out), M_PCB, - MB_WAIT); + asoc->strmout = kmalloc(asoc->streamoutcnt * sizeof(struct sctp_stream_out), + M_PCB, MB_WAIT); for (i = 0; i < asoc->streamoutcnt; i++) { /* * inbound side must be set to 0xffff, @@ -10282,16 +10279,15 @@ sctp_sosend(struct socket *so, asoc->streamoutcnt, asoc->pre_open_streams); } #endif - FREE(asoc->strmout, M_PCB); + kfree(asoc->strmout, M_PCB); asoc->strmout = NULL; asoc->streamoutcnt = asoc->pre_open_streams; /* What happesn if this fails? .. we panic ...*/ - MALLOC(asoc->strmout, - struct sctp_stream_out *, - asoc->streamoutcnt * - sizeof(struct sctp_stream_out), - M_PCB, MB_WAIT); + asoc->strmout = + kmalloc(asoc->streamoutcnt * + sizeof(struct sctp_stream_out), + M_PCB, MB_WAIT); for (i = 0; i < asoc->streamoutcnt; i++) { /* * inbound side must be set to 0xffff, diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index b8377874fc..8af7cca0d1 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -1713,7 +1713,7 @@ sctp_move_pcb_and_assoc(struct sctp_inpcb *old_inp, struct sctp_inpcb *new_inp, stcb->sctp_socket = new_inp->sctp_socket; stcb->sctp_ep = new_inp; if (new_inp->sctp_tcbhash != NULL) { - FREE(new_inp->sctp_tcbhash, M_PCB); + kfree(new_inp->sctp_tcbhash, M_PCB); new_inp->sctp_tcbhash = NULL; } if ((new_inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) { @@ -2493,7 +2493,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate) } /* Now lets see about freeing the EP hash table. */ if (inp->sctp_tcbhash != NULL) { - FREE(inp->sctp_tcbhash, M_PCB); + kfree(inp->sctp_tcbhash, M_PCB); inp->sctp_tcbhash = 0; } SCTP_INP_WUNLOCK(inp); @@ -3066,9 +3066,9 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, if ((err = sctp_add_remote_addr(stcb, firstaddr, 1, 1))) { /* failure.. memory error? */ if (asoc->strmout) - FREE(asoc->strmout, M_PCB); + kfree(asoc->strmout, M_PCB); if (asoc->mapping_array) - FREE(asoc->mapping_array, M_PCB); + kfree(asoc->mapping_array, M_PCB); SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb); sctppcbinfo.ipi_count_asoc--; @@ -3239,8 +3239,8 @@ sctp_add_vtag_to_timewait(struct sctp_inpcb *inp, u_int32_t tag) } /* Need to add a new block to chain */ if (!set) { - MALLOC(twait_block, struct sctp_tagblock *, - sizeof(struct sctp_tagblock), M_PCB, M_NOWAIT); + twait_block = kmalloc(sizeof(struct sctp_tagblock), M_PCB, + M_NOWAIT); if (twait_block == NULL) { return; } @@ -3413,7 +3413,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb) } if (asoc->pending_reply) { - FREE(asoc->pending_reply, M_PCB); + kfree(asoc->pending_reply, M_PCB); asoc->pending_reply = NULL; } chk = TAILQ_FIRST(&asoc->pending_reply_queue); @@ -3523,13 +3523,13 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb) } } if (asoc->mapping_array) { - FREE(asoc->mapping_array, M_PCB); + kfree(asoc->mapping_array, M_PCB); asoc->mapping_array = NULL; } /* the stream outs */ if (asoc->strmout) { - FREE(asoc->strmout, M_PCB); + kfree(asoc->strmout, M_PCB); asoc->strmout = NULL; } asoc->streamoutcnt = 0; @@ -3557,7 +3557,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb) } } } - FREE(asoc->strmin, M_PCB); + kfree(asoc->strmin, M_PCB); asoc->strmin = NULL; } asoc->streamincnt = 0; @@ -3572,7 +3572,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb) while (!TAILQ_EMPTY(&asoc->asconf_queue)) { aparam = TAILQ_FIRST(&asoc->asconf_queue); TAILQ_REMOVE(&asoc->asconf_queue, aparam, next); - FREE(aparam, M_PCB); + kfree(aparam, M_PCB); } if (asoc->last_asconf_ack_sent != NULL) { sctp_m_freem(asoc->last_asconf_ack_sent); @@ -5017,8 +5017,7 @@ sctp_initiate_iterator(asoc_func af, uint32_t pcb_state, uint32_t asoc_state, if (af == NULL) { return (-1); } - MALLOC(it, struct sctp_iterator *, sizeof(struct sctp_iterator), M_PCB, - M_WAITOK); + it = kmalloc(sizeof(struct sctp_iterator), M_PCB, M_WAITOK); memset(it, 0, sizeof(*it)); it->function_toapply = af; it->function_atend = ef; diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index f7fc2fd321..a9f7b0ef79 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -1484,7 +1484,7 @@ sctp_iterator_timer(struct sctp_iterator *it) if (it->function_atend != NULL) { (*it->function_atend)(it->pointer, it->val); } - FREE(it, M_PCB); + kfree(it, M_PCB); return; } select_a_new_ep: diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index ecd3a44b8c..d0580d567d 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -3956,8 +3956,7 @@ sctp_accept(netmsg_t msg) if (prim->sa_family == AF_INET) { struct sockaddr_in *sin; #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, - M_WAITOK | M_ZERO); + sin = kmalloc(sizeof *sin, M_SONAME, M_WAITOK | M_ZERO); #else sin = (struct sockaddr_in *)addr; bzero((caddr_t)sin, sizeof (*sin)); @@ -3974,8 +3973,7 @@ sctp_accept(netmsg_t msg) } else { struct sockaddr_in6 *sin6; #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, M_SONAME, - M_WAITOK | M_ZERO); + sin6 = kmalloc(sizeof *sin6, M_SONAME, M_WAITOK | M_ZERO); #else sin6 = (struct sockaddr_in6 *)addr; #endif @@ -4044,8 +4042,7 @@ sctp_ingetaddr_oncpu(struct socket *so, struct sockaddr **addr) * Do the malloc first in case it blocks. */ #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK | - M_ZERO); + sin = kmalloc(sizeof *sin, M_SONAME, M_WAITOK | M_ZERO); #else nam->m_len = sizeof(*sin); memset(sin, 0, sizeof(*sin)); @@ -4055,7 +4052,7 @@ sctp_ingetaddr_oncpu(struct socket *so, struct sockaddr **addr) inp = (struct sctp_inpcb *)so->so_pcb; if (!inp) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin, M_SONAME); + kfree(sin, M_SONAME); #endif return ECONNRESET; } @@ -4111,7 +4108,7 @@ sctp_ingetaddr_oncpu(struct socket *so, struct sockaddr **addr) } if (!fnd) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin, M_SONAME); + kfree(sin, M_SONAME); #endif SCTP_INP_RUNLOCK(inp); return ENOENT; @@ -4156,8 +4153,7 @@ sctp_peeraddr_oncpu(struct socket *so, struct sockaddr **addr) #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) /* XXX huh? why assign it above and then allocate it here? */ - MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK | - M_ZERO); + sin = kmalloc(sizeof *sin, M_SONAME, M_WAITOK | M_ZERO); #else nam->m_len = sizeof(*sin); memset(sin, 0, sizeof(*sin)); @@ -4169,7 +4165,7 @@ sctp_peeraddr_oncpu(struct socket *so, struct sockaddr **addr) inp = (struct sctp_inpcb *)so->so_pcb; if (!inp) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin, M_SONAME); + kfree(sin, M_SONAME); #endif error = ECONNRESET; goto out; @@ -4181,7 +4177,7 @@ sctp_peeraddr_oncpu(struct socket *so, struct sockaddr **addr) SCTP_INP_RUNLOCK(inp); if (stcb == NULL) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin, M_SONAME); + kfree(sin, M_SONAME); #endif error = ECONNRESET; goto out; @@ -4200,7 +4196,7 @@ sctp_peeraddr_oncpu(struct socket *so, struct sockaddr **addr) if (!fnd) { /* No IPv4 address */ #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin, M_SONAME); + kfree(sin, M_SONAME); #endif error = ENOENT; } else { diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index e522129600..363c56d07c 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1,5 +1,4 @@ /* $KAME: sctputil.c,v 1.36 2005/03/06 16:04:19 itojun Exp $ */ -/* $DragonFly: src/sys/netinet/sctputil.c,v 1.9 2008/03/07 11:34:20 sephe Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -831,8 +830,8 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc, */ asoc->streamoutcnt = asoc->pre_open_streams = m->sctp_ep.pre_open_stream_count; - MALLOC(asoc->strmout, struct sctp_stream_out *, asoc->streamoutcnt * - sizeof(struct sctp_stream_out), M_PCB, M_NOWAIT); + asoc->strmout = kmalloc(asoc->streamoutcnt * sizeof(struct sctp_stream_out), + M_PCB, M_NOWAIT); if (asoc->strmout == NULL) { /* big trouble no memory */ return (ENOMEM); @@ -855,14 +854,14 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_association *asoc, /* Now the mapping array */ asoc->mapping_array_size = SCTP_INITIAL_MAPPING_ARRAY; #ifdef __NetBSD__ - MALLOC(asoc->mapping_array, u_int8_t *, SCTP_INITIAL_MAPPING_ARRAY, - M_PCB, M_NOWAIT); + asoc->mapping_array = kmalloc(SCTP_INITIAL_MAPPING_ARRAY, M_PCB, + M_NOWAIT); #else - MALLOC(asoc->mapping_array, u_int8_t *, asoc->mapping_array_size, - M_PCB, M_NOWAIT); + asoc->mapping_array = kmalloc(asoc->mapping_array_size, M_PCB, + M_NOWAIT); #endif if (asoc->mapping_array == NULL) { - FREE(asoc->strmout, M_PCB); + kfree(asoc->strmout, M_PCB); return (ENOMEM); } memset(asoc->mapping_array, 0, asoc->mapping_array_size); @@ -888,10 +887,10 @@ sctp_expand_mapping_array(struct sctp_association *asoc) new_size = asoc->mapping_array_size + SCTP_MAPPING_ARRAY_INCR; #ifdef __NetBSD__ - MALLOC(new_array, u_int8_t *, asoc->mapping_array_size - + SCTP_MAPPING_ARRAY_INCR, M_PCB, M_NOWAIT); + new_array = kmalloc(asoc->mapping_array_size + SCTP_MAPPING_ARRAY_INCR, + M_PCB, M_NOWAIT); #else - MALLOC(new_array, u_int8_t *, new_size, M_PCB, M_NOWAIT); + new_array = kmalloc(new_size, M_PCB, M_NOWAIT); #endif if (new_array == NULL) { /* can't get more, forget it */ @@ -901,7 +900,7 @@ sctp_expand_mapping_array(struct sctp_association *asoc) } memset(new_array, 0, new_size); memcpy(new_array, asoc->mapping_array, asoc->mapping_array_size); - FREE(asoc->mapping_array, M_PCB); + kfree(asoc->mapping_array, M_PCB); asoc->mapping_array = new_array; asoc->mapping_array_size = new_size; return (0); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 44a04f8227..c6f4e32d88 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -65,7 +65,6 @@ * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.107.2.38 2003/05/21 04:46:41 cjc Exp $ - * $DragonFly: src/sys/netinet/tcp_input.c,v 1.68 2008/08/22 09:14:17 sephe Exp $ */ #include "opt_ipfw.h" /* for ipfw_fwd */ @@ -309,8 +308,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) } /* Allocate a new queue entry. */ - MALLOC(te, struct tseg_qent *, sizeof(struct tseg_qent), M_TSEGQ, - M_INTWAIT | M_NULLOK); + te = kmalloc(sizeof(struct tseg_qent), M_TSEGQ, M_INTWAIT | M_NULLOK); if (te == NULL) { tcpstat.tcps_rcvmemdrop++; m_freem(m); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index f846fffd8c..54d06798db 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -957,7 +957,7 @@ no_valid_rt: while((q = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - FREE(q, M_TSEGQ); + kfree(q, M_TSEGQ); atomic_add_int(&tcp_reass_qsize, -1); } /* throw away SACK blocks in scoreboard*/ @@ -1009,7 +1009,7 @@ tcp_drain_oncpu(struct inpcbhead *head) (te = LIST_FIRST(&tcpb->t_segq)) != NULL) { LIST_REMOVE(te, tqe_q); m_freem(te->tqe_m); - FREE(te, M_TSEGQ); + kfree(te, M_TSEGQ); atomic_add_int(&tcp_reass_qsize, -1); /* retry */ } else { diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 073d2f3610..25f9d74f5d 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -312,9 +312,8 @@ syncache_init(void) syncache_percpu = &tcp_syncache_percpu[cpu]; /* Allocate the hash table. */ - MALLOC(syncache_percpu->hashbase, struct syncache_head *, - tcp_syncache.hashsize * sizeof(struct syncache_head), - M_SYNCACHE, M_WAITOK); + syncache_percpu->hashbase = kmalloc(tcp_syncache.hashsize * sizeof(struct syncache_head), + M_SYNCACHE, M_WAITOK); /* Initialize the hash buckets. */ for (i = 0; i < tcp_syncache.hashsize; i++) { diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index c1e703f378..d72dc60a28 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netinet6/in6.c,v 1.7.2.9 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/in6.c,v 1.30 2008/10/03 07:59:20 hasso Exp $ */ /* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi Exp $ */ /* @@ -2532,10 +2531,9 @@ in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam) struct sockaddr_in *sin_p; struct sockaddr_in6 *sin6_p; - MALLOC(sin6_p, struct sockaddr_in6 *, sizeof *sin6_p, M_SONAME, - M_WAITOK); + sin6_p = kmalloc(sizeof *sin6_p, M_SONAME, M_WAITOK); sin_p = (struct sockaddr_in *)*nam; in6_sin_2_v4mapsin6(sin_p, sin6_p); - FREE(*nam, M_SONAME); + kfree(*nam, M_SONAME); *nam = (struct sockaddr *)sin6_p; } diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 83ae96681e..a5f62637b3 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netinet6/in6_pcb.c,v 1.10.2.9 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_pcb.c,v 1.35 2008/09/04 09:08:22 hasso Exp $ */ /* $KAME: in6_pcb.c,v 1.31 2001/05/21 05:45:10 jinmei Exp $ */ /* @@ -733,8 +732,7 @@ in6_setsockaddr(struct socket *so, struct sockaddr **nam) /* * Do the malloc first in case it blocks. */ - MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, M_SONAME, - M_WAITOK | M_ZERO); + sin6 = kmalloc(sizeof *sin6, M_SONAME, M_WAITOK | M_ZERO); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(*sin6); @@ -777,8 +775,7 @@ in6_setpeeraddr(struct socket *so, struct sockaddr **nam) /* * Do the malloc first in case it blocks. */ - MALLOC(sin6, struct sockaddr_in6 *, sizeof(*sin6), M_SONAME, - M_WAITOK | M_ZERO); + sin6 = kmalloc(sizeof(*sin6), M_SONAME, M_WAITOK | M_ZERO); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(struct sockaddr_in6); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index ff3e6f32ab..4e542c4b3d 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -27,7 +27,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet6/raw_ip6.c,v 1.7.2.7 2003/01/24 05:11:35 sam Exp $ - * $DragonFly: src/sys/netinet6/raw_ip6.c,v 1.27 2008/09/04 09:08:22 hasso Exp $ */ /* @@ -608,8 +607,8 @@ rip6_attach(netmsg_t msg) inp->in6p_ip6_nxt = (long)proto; inp->in6p_hops = -1; /* use kernel default */ inp->in6p_cksum = -1; - MALLOC(inp->in6p_icmp6filt, struct icmp6_filter *, - sizeof(struct icmp6_filter), M_PCB, M_NOWAIT); + inp->in6p_icmp6filt = kmalloc(sizeof(struct icmp6_filter), M_PCB, + M_NOWAIT); if (inp->in6p_icmp6filt != NULL) ICMP6_FILTER_SETPASSALL(inp->in6p_icmp6filt); error = 0; @@ -630,7 +629,7 @@ rip6_detach(netmsg_t msg) if (so == ip6_mrouter) ip6_mrouter_done(); if (inp->in6p_icmp6filt) { - FREE(inp->in6p_icmp6filt, M_PCB); + kfree(inp->in6p_icmp6filt, M_PCB); inp->in6p_icmp6filt = NULL; } in6_pcbdetach(inp); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 9481a2f02b..ac281f13fa 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -1367,8 +1367,7 @@ sctp6_getaddr(struct socket *so, struct mbuf *nam) * Do the malloc first in case it blocks. */ #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, M_SONAME, - M_WAITOK | M_ZERO); + sin6 = kmalloc(sizeof *sin6, M_SONAME, M_WAITOK | M_ZERO); #else nam->m_len = sizeof(*sin6); #endif @@ -1379,7 +1378,7 @@ sctp6_getaddr(struct socket *so, struct mbuf *nam) inp = (struct sctp_inpcb *)so->so_pcb; if (!inp) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin6, M_SONAME); + kfree(sin6, M_SONAME); #endif return ECONNRESET; } @@ -1433,7 +1432,7 @@ sctp6_getaddr(struct socket *so, struct mbuf *nam) } if (!fnd) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin6, M_SONAME); + kfree(sin6, M_SONAME); #endif return ENOENT; } @@ -1474,8 +1473,7 @@ sctp6_peeraddr(struct socket *so, struct mbuf *nam) return (ENOTCONN); } #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, M_SONAME, - M_WAITOK | M_ZERO); + sin6 = kmalloc(sizeof *sin6, M_SONAME, M_WAITOK | M_ZERO); #else nam->m_len = sizeof(*sin6); #endif @@ -1487,14 +1485,14 @@ sctp6_peeraddr(struct socket *so, struct mbuf *nam) inp = (struct sctp_inpcb *)so->so_pcb; if (!inp) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin6, M_SONAME); + kfree(sin6, M_SONAME); #endif return ECONNRESET; } stcb = LIST_FIRST(&inp->sctp_asoc_list); if (stcb == NULL) { #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin6, M_SONAME); + kfree(sin6, M_SONAME); #endif return ECONNRESET; } @@ -1511,7 +1509,7 @@ sctp6_peeraddr(struct socket *so, struct mbuf *nam) if (!fnd) { /* No IPv4 address */ #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) - FREE(sin6, M_SONAME); + kfree(sin6, M_SONAME); #endif return ENOENT; } diff --git a/sys/netproto/ipsec/xform_ah.c b/sys/netproto/ipsec/xform_ah.c index 70c939511c..36bbbc4e52 100644 --- a/sys/netproto/ipsec/xform_ah.c +++ b/sys/netproto/ipsec/xform_ah.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.2 2003/02/26 00:14:05 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/xform_ah.c,v 1.10 2006/10/12 01:32:51 hsu Exp $ */ /* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -483,7 +482,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) /* Free, if we allocated. */ if (alloc) - FREE(ptr, M_XDATA); + kfree(ptr, M_XDATA); return EINVAL; } @@ -503,7 +502,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) /* Free, if we allocated. */ if (alloc) - FREE(ptr, M_XDATA); + kfree(ptr, M_XDATA); return EINVAL; } } @@ -527,7 +526,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) DPRINTF(("ah_massage_headers: unexpected " "IPv6 header type %d", off)); if (alloc) - FREE(ptr, M_XDATA); + kfree(ptr, M_XDATA); m_freem(m); return EINVAL; } diff --git a/sys/netproto/ipx/ipx_ip.c b/sys/netproto/ipx/ipx_ip.c index da9d55c664..5eda2ad23f 100644 --- a/sys/netproto/ipx/ipx_ip.c +++ b/sys/netproto/ipx/ipx_ip.c @@ -105,7 +105,7 @@ ipxipattach(void) ifp->if_flags = IFF_POINTOPOINT; } - MALLOC((m), struct ifnet_en *, sizeof(*m), M_PCB, M_WAITOK | M_ZERO); + (m) = kmalloc(sizeof(*m), M_PCB, M_WAITOK | M_ZERO); m->ifen_next = ipxip_list; ipxip_list = m; ifp = &m->ifen_ifnet; diff --git a/sys/netproto/ipx/ipx_pcb.c b/sys/netproto/ipx/ipx_pcb.c index d7fcfd8b5e..a51e26224b 100644 --- a/sys/netproto/ipx/ipx_pcb.c +++ b/sys/netproto/ipx/ipx_pcb.c @@ -34,7 +34,6 @@ * @(#)ipx_pcb.c * * $FreeBSD: src/sys/netipx/ipx_pcb.c,v 1.18.2.1 2001/02/22 09:44:18 bp Exp $ - * $DragonFly: src/sys/netproto/ipx/ipx_pcb.c,v 1.13 2006/12/05 23:31:57 dillon Exp $ */ #include @@ -62,8 +61,7 @@ ipx_pcballoc(struct socket *so, struct ipxpcbhead *head) { struct ipxpcb *ipxp; - MALLOC(ipxp, struct ipxpcb *, sizeof *ipxp, M_PCB, - M_WAITOK | M_ZERO | M_NULLOK); + ipxp = kmalloc(sizeof *ipxp, M_PCB, M_WAITOK | M_ZERO | M_NULLOK); if (ipxp == NULL) return (ENOBUFS); ipxp->ipxp_socket = so; @@ -268,7 +266,7 @@ ipx_pcbdetach(struct ipxpcb *ipxp) if (ipxp->ipxp_route.ro_rt != NULL) rtfree(ipxp->ipxp_route.ro_rt); LIST_REMOVE(ipxp, ipxp_list); - FREE(ipxp, M_PCB); + kfree(ipxp, M_PCB); } void diff --git a/sys/netproto/ipx/spx_usrreq.c b/sys/netproto/ipx/spx_usrreq.c index 89c2eb559e..d4c1da8ec5 100644 --- a/sys/netproto/ipx/spx_usrreq.c +++ b/sys/netproto/ipx/spx_usrreq.c @@ -34,7 +34,6 @@ * @(#)spx_usrreq.h * * $FreeBSD: src/sys/netipx/spx_usrreq.c,v 1.27.2.1 2001/02/22 09:44:18 bp Exp $ - * $DragonFly: src/sys/netproto/ipx/spx_usrreq.c,v 1.20 2007/04/22 01:13:15 dillon Exp $ */ #include @@ -1320,12 +1319,12 @@ spx_attach_oncpu(struct socket *so, int proto, struct pru_attach_info *ai) } ipxp = sotoipxpcb(so); - MALLOC(cb, struct spxpcb *, sizeof *cb, M_PCB, M_INTWAIT | M_ZERO); + cb = kmalloc(sizeof *cb, M_PCB, M_INTWAIT | M_ZERO); ssb = &so->so_snd; mm = m_getclr(MB_DONTWAIT, MT_HEADER); if (mm == NULL) { - FREE(cb, M_PCB); + kfree(cb, M_PCB); error = ENOBUFS; goto spx_attach_end; } @@ -1668,7 +1667,7 @@ spx_close(struct spxpcb *cb) kfree(q, M_SPX_Q); } m_free(cb->s_ipx_m); - FREE(cb, M_PCB); + kfree(cb, M_PCB); ipxp->ipxp_pcb = 0; soisdisconnected(so); ipx_pcbdetach(ipxp); diff --git a/sys/netproto/natm/natm.c b/sys/netproto/natm/natm.c index fc1d3e8722..d450fdc562 100644 --- a/sys/netproto/natm/natm.c +++ b/sys/netproto/natm/natm.c @@ -1,6 +1,5 @@ /* $NetBSD: natm.c,v 1.5 1996/11/09 03:26:26 chuck Exp $ */ /* $FreeBSD: src/sys/netnatm/natm.c,v 1.12 2000/02/13 03:32:03 peter Exp $ */ -/* $DragonFly: src/sys/netproto/natm/natm.c,v 1.31 2008/09/24 14:26:39 sephe Exp $ */ /* * @@ -788,7 +787,7 @@ natmintr(netmsg_t msg) if (npcb->npcb_flags & NPCB_DRAIN) { m_freem(m); if (npcb->npcb_inq == 0) - FREE(npcb, M_PCB); /* done! */ + kfree(npcb, M_PCB); /* done! */ goto out; } diff --git a/sys/netproto/natm/natm_pcb.c b/sys/netproto/natm/natm_pcb.c index b16f38af29..304addb4a3 100644 --- a/sys/netproto/natm/natm_pcb.c +++ b/sys/netproto/natm/natm_pcb.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netnatm/natm_pcb.c,v 1.6.6.1 2000/08/03 18:56:28 peter Exp $ */ -/* $DragonFly: src/sys/netproto/natm/natm_pcb.c,v 1.9 2008/01/05 14:02:40 swildner Exp $ */ /* $NetBSD: natm_pcb.c,v 1.4 1996/11/09 03:26:27 chuck Exp $ */ /* @@ -63,7 +62,7 @@ npcb_alloc(int wait) { struct natmpcb *npcb; - MALLOC(npcb, struct natmpcb *, sizeof(*npcb), M_PCB, wait | M_ZERO); + npcb = kmalloc(sizeof(*npcb), M_PCB, wait | M_ZERO); #ifdef DIAGNOSTIC if (wait == M_WAITOK && npcb == NULL) panic("npcb_alloc: MALLOC didn't wait"); @@ -92,7 +91,7 @@ npcb_free(struct natmpcb *npcb, int op) if (npcb->npcb_inq) { npcb->npcb_flags = NPCB_DRAIN; /* flag for distruction */ } else { - FREE(npcb, M_PCB); /* kill it! */ + kfree(npcb, M_PCB); /* kill it! */ } } diff --git a/sys/netproto/ncp/ncp_conn.c b/sys/netproto/ncp/ncp_conn.c index d96473e4fc..49874e517f 100644 --- a/sys/netproto/ncp/ncp_conn.c +++ b/sys/netproto/ncp/ncp_conn.c @@ -29,7 +29,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * $FreeBSD: src/sys/netncp/ncp_conn.c,v 1.3.2.5 2001/02/22 08:54:11 bp Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_conn.c,v 1.15 2007/05/13 18:33:58 swildner Exp $ * * Connection tables */ @@ -201,8 +200,7 @@ ncp_conn_alloc(struct thread *td, struct ucred *cred, struct ncp_conn **conn) int error; struct ncp_conn *ncp; - MALLOC(ncp, struct ncp_conn *, sizeof(struct ncp_conn), - M_NCPDATA, M_WAITOK | M_ZERO); + ncp = kmalloc(sizeof(struct ncp_conn), M_NCPDATA, M_WAITOK | M_ZERO); error = 0; lockinit(&ncp->nc_lock, "ncplck", 0, 0); ncp_conn_cnt++; @@ -266,7 +264,7 @@ ncp_conn_free(struct ncp_conn *ncp) if (ncp->li.user) kfree(ncp->li.user, M_NCPDATA); if (ncp->li.password) kfree(ncp->li.password, M_NCPDATA); crfree(ncp->nc_owner); - FREE(ncp, M_NCPDATA); + kfree(ncp, M_NCPDATA); return (0); } @@ -420,8 +418,8 @@ ncp_conn_gethandle(struct ncp_conn *conn, struct thread *td, struct ncp_handle * lockmgr(&lhlock, LK_RELEASE); return 0; } - MALLOC(refp,struct ncp_handle *,sizeof(struct ncp_handle),M_NCPDATA, - M_WAITOK | M_ZERO); + refp = kmalloc(sizeof(struct ncp_handle), M_NCPDATA, + M_WAITOK | M_ZERO); SLIST_INSERT_HEAD(&lhlist,refp,nh_next); refp->nh_ref++; refp->nh_td = td; @@ -448,7 +446,7 @@ ncp_conn_puthandle(struct ncp_handle *handle, struct thread *td, int force) { } if (refp->nh_ref == 0) { SLIST_REMOVE(&lhlist, refp, ncp_handle, nh_next); - FREE(refp, M_NCPDATA); + kfree(refp, M_NCPDATA); } lockmgr(&lhlock, LK_RELEASE); return 0; @@ -485,7 +483,7 @@ ncp_conn_putprochandles(struct thread *td) { haveone = 1; hp->nh_conn->ref_cnt -= hp->nh_ref; SLIST_REMOVE(&lhlist, hp, ncp_handle, nh_next); - FREE(hp, M_NCPDATA); + kfree(hp, M_NCPDATA); } lockmgr(&lhlock, LK_RELEASE); return haveone; diff --git a/sys/netproto/ncp/ncp_sock.c b/sys/netproto/ncp/ncp_sock.c index bb917d1dc8..602507e5ec 100644 --- a/sys/netproto/ncp/ncp_sock.c +++ b/sys/netproto/ncp/ncp_sock.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netncp/ncp_sock.c,v 1.2 1999/10/12 10:36:59 bp Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_sock.c,v 1.20 2007/05/18 17:05:12 dillon Exp $ * * Low level socket routines */ @@ -135,7 +134,7 @@ ncp_getsockname(struct socket *so, caddr_t asa, int *alen) { *alen=len; } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return (error); } #endif @@ -365,7 +364,7 @@ ncp_watchdog(struct ncp_conn *conn) { break; } if (sa) - FREE(sa, M_SONAME); + kfree(sa, M_SONAME); return; } #endif /* IPX */ diff --git a/sys/netproto/smb/smb_rq.c b/sys/netproto/smb/smb_rq.c index c64a0c9869..2b15329f3b 100644 --- a/sys/netproto/smb/smb_rq.c +++ b/sys/netproto/smb/smb_rq.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_rq.c,v 1.1.2.2 2002/04/23 03:45:01 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_rq.c,v 1.11 2008/01/06 16:55:53 swildner Exp $ */ #include #include @@ -67,7 +66,7 @@ smb_rq_alloc(struct smb_connobj *layer, u_char cmd, struct smb_cred *scred, struct smb_rq *rqp; int error; - MALLOC(rqp, struct smb_rq *, sizeof(*rqp), M_SMBRQ, M_WAITOK); + rqp = kmalloc(sizeof(*rqp), M_SMBRQ, M_WAITOK); error = smb_rq_init(rqp, layer, cmd, scred); rqp->sr_flags |= SMBR_ALLOCED; if (error) { @@ -363,7 +362,7 @@ smb_t2_alloc(struct smb_connobj *layer, u_short setup, struct smb_cred *scred, struct smb_t2rq *t2p; int error; - MALLOC(t2p, struct smb_t2rq *, sizeof(*t2p), M_SMBRQ, M_WAITOK); + t2p = kmalloc(sizeof(*t2p), M_SMBRQ, M_WAITOK); error = smb_t2_init(t2p, layer, setup, scred); t2p->t2_flags |= SMBT2_ALLOCED; if (error) { diff --git a/sys/netproto/smb/smb_trantcp.c b/sys/netproto/smb/smb_trantcp.c index 3b2bb62de0..96478b49c0 100644 --- a/sys/netproto/smb/smb_trantcp.c +++ b/sys/netproto/smb/smb_trantcp.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_trantcp.c,v 1.3.2.1 2001/05/22 08:32:34 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_trantcp.c,v 1.21 2008/01/05 14:02:40 swildner Exp $ */ #include #include @@ -384,7 +383,7 @@ smb_nbst_create(struct smb_vc *vcp, struct thread *td) { struct nbpcb *nbp; - MALLOC(nbp, struct nbpcb *, sizeof *nbp, M_NBDATA, M_WAITOK | M_ZERO); + nbp = kmalloc(sizeof *nbp, M_NBDATA, M_WAITOK | M_ZERO); nbp->nbp_timo.tv_sec = 15; /* XXX: sysctl ? */ nbp->nbp_state = NBST_CLOSED; nbp->nbp_vc = vcp; diff --git a/sys/platform/pc32/i386/sys_machdep.c b/sys/platform/pc32/i386/sys_machdep.c index b5b3d6bf7c..b7d86f6801 100644 --- a/sys/platform/pc32/i386/sys_machdep.c +++ b/sys/platform/pc32/i386/sys_machdep.c @@ -303,14 +303,13 @@ user_ldt_alloc(struct pcb *pcb, int len) { struct pcb_ldt *pcb_ldt, *new_ldt; - MALLOC(new_ldt, struct pcb_ldt *, sizeof(struct pcb_ldt), - M_SUBPROC, M_WAITOK); + new_ldt = kmalloc(sizeof(struct pcb_ldt), M_SUBPROC, M_WAITOK); new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_base = (caddr_t)kmem_alloc(&kernel_map, len * sizeof(union descriptor)); if (new_ldt->ldt_base == NULL) { - FREE(new_ldt, M_SUBPROC); + kfree(new_ldt, M_SUBPROC); return NULL; } new_ldt->ldt_refcnt = 1; @@ -350,7 +349,7 @@ user_ldt_free(struct pcb *pcb) if (--pcb_ldt->ldt_refcnt == 0) { kmem_free(&kernel_map, (vm_offset_t)pcb_ldt->ldt_base, pcb_ldt->ldt_len * sizeof(union descriptor)); - FREE(pcb_ldt, M_SUBPROC); + kfree(pcb_ldt, M_SUBPROC); } } @@ -440,7 +439,7 @@ ki386_set_ldt(struct lwp *lp, char *args, int *res) pcb_ldt->ldt_len * sizeof(union descriptor)); pcb_ldt->ldt_base = new_ldt->ldt_base; pcb_ldt->ldt_len = new_ldt->ldt_len; - FREE(new_ldt, M_SUBPROC); + kfree(new_ldt, M_SUBPROC); } else { pcb->pcb_ldt = pcb_ldt = new_ldt; } diff --git a/sys/sys/uio.h b/sys/sys/uio.h index c14dfebbe8..a732ee325f 100644 --- a/sys/sys/uio.h +++ b/sys/sys/uio.h @@ -32,7 +32,6 @@ * * @(#)uio.h 8.5 (Berkeley) 2/22/94 * $FreeBSD: src/sys/sys/uio.h,v 1.11.2.1 2001/09/28 16:58:35 dillon Exp $ - * $DragonFly: src/sys/sys/uio.h,v 1.14 2006/05/27 20:17:17 dillon Exp $ */ #ifndef _SYS_UIO_H_ @@ -109,7 +108,7 @@ static __inline void iovec_free(struct iovec **kiov, struct iovec *siov) { if (*kiov != siov) { - FREE(*kiov, M_IOV); + kfree(*kiov, M_IOV); *kiov = NULL; } } diff --git a/sys/vfs/fdesc/fdesc_vfsops.c b/sys/vfs/fdesc/fdesc_vfsops.c index 830f16e3b8..c9d48b7aaf 100644 --- a/sys/vfs/fdesc/fdesc_vfsops.c +++ b/sys/vfs/fdesc/fdesc_vfsops.c @@ -36,7 +36,6 @@ * @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vfsops.c,v 1.22.2.3 2002/08/23 17:42:39 njl Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vfsops.c,v 1.22 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -92,8 +91,7 @@ fdesc_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) if (error) return (error); - MALLOC(fmp, struct fdescmount *, sizeof(struct fdescmount), - M_FDESCMNT, M_WAITOK); /* XXX */ + fmp = kmalloc(sizeof(struct fdescmount), M_FDESCMNT, M_WAITOK); /* XXX */ rvp->v_type = VDIR; vsetflags(rvp, VROOT); fmp->f_root = rvp; diff --git a/sys/vfs/fdesc/fdesc_vnops.c b/sys/vfs/fdesc/fdesc_vnops.c index 45f1214f94..df52cf8c0b 100644 --- a/sys/vfs/fdesc/fdesc_vnops.c +++ b/sys/vfs/fdesc/fdesc_vnops.c @@ -36,7 +36,6 @@ * @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vnops.c,v 1.47.2.1 2001/10/22 22:49:26 chris Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.39 2007/11/20 21:03:50 dillon Exp $ */ /* @@ -135,11 +134,11 @@ loop: * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK); + fd = kmalloc(sizeof(struct fdescnode), M_TEMP, M_WAITOK); error = getnewvnode(VT_FDESC, mp, vpp, 0, 0); if (error) { - FREE(fd, M_TEMP); + kfree(fd, M_TEMP); goto out; } (*vpp)->v_data = fd; @@ -509,7 +508,7 @@ fdesc_reclaim(struct vop_reclaim_args *ap) struct fdescnode *fd = VTOFDESC(vp); LIST_REMOVE(fd, fd_hash); - FREE(vp->v_data, M_TEMP); + kfree(vp->v_data, M_TEMP); vp->v_data = 0; return (0); diff --git a/sys/vfs/fifofs/fifo_vnops.c b/sys/vfs/fifofs/fifo_vnops.c index a2d63411cd..9f60e7e9a7 100644 --- a/sys/vfs/fifofs/fifo_vnops.c +++ b/sys/vfs/fifofs/fifo_vnops.c @@ -167,7 +167,7 @@ fifo_open(struct vop_open_args *ap) lwkt_gettoken(&vp->v_token); if ((fip = vp->v_fifoinfo) == NULL) { - MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_FIFOINFO, M_WAITOK); + fip = kmalloc(sizeof(*fip), M_FIFOINFO, M_WAITOK); vp->v_fifoinfo = fip; error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, td); if (error) { @@ -523,7 +523,7 @@ fifo_close(struct vop_close_args *ap) } error1 = soclose(fip->fi_readsock, FNONBLOCK); error2 = soclose(fip->fi_writesock, FNONBLOCK); - FREE(fip, M_FIFOINFO); + kfree(fip, M_FIFOINFO); vp->v_fifoinfo = NULL; if (error1) { error2 = error1; diff --git a/sys/vfs/hpfs/hpfs_subr.c b/sys/vfs/hpfs/hpfs_subr.c index 184974f8e2..6fa7c9037e 100644 --- a/sys/vfs/hpfs/hpfs_subr.c +++ b/sys/vfs/hpfs/hpfs_subr.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_subr.c,v 1.1 1999/12/09 19:09:59 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_subr.c,v 1.8 2006/12/23 00:41:29 swildner Exp $ */ #include @@ -88,8 +87,8 @@ hpfs_bmdeinit( } } - FREE(hpmp->hpm_bitmap,M_HPFSMNT); - FREE(hpmp->hpm_bmind,M_HPFSMNT); + kfree(hpmp->hpm_bitmap, M_HPFSMNT); + kfree(hpmp->hpm_bmind, M_HPFSMNT); dprintf(("\n")); } @@ -112,18 +111,18 @@ hpfs_bminit( dprintf(("0x%lx data bands, ", hpmp->hpm_dbnum)); - MALLOC(hpmp->hpm_bmind, lsn_t *, hpmp->hpm_dbnum * sizeof(lsn_t), - M_HPFSMNT, M_WAITOK); + hpmp->hpm_bmind = kmalloc(hpmp->hpm_dbnum * sizeof(lsn_t), M_HPFSMNT, + M_WAITOK); - MALLOC(hpmp->hpm_bitmap, u_int8_t *, hpmp->hpm_dbnum * BMSIZE, - M_HPFSMNT, M_WAITOK); + hpmp->hpm_bitmap = kmalloc(hpmp->hpm_dbnum * BMSIZE, M_HPFSMNT, + M_WAITOK); error = bread(hpmp->hpm_devvp, dbtodoff(hpmp->hpm_su.su_bitmap.lsn1), ((hpmp->hpm_dbnum + 0x7F) & ~(0x7F)) << 2, &bp); if (error) { brelse(bp); - FREE(hpmp->hpm_bitmap, M_HPFSMNT); - FREE(hpmp->hpm_bmind, M_HPFSMNT); + kfree(hpmp->hpm_bitmap, M_HPFSMNT); + kfree(hpmp->hpm_bmind, M_HPFSMNT); dprintf((" error %d\n", error)); return (error); } @@ -141,8 +140,8 @@ hpfs_bminit( BMSIZE, &bp); if (error) { brelse(bp); - FREE(hpmp->hpm_bitmap, M_HPFSMNT); - FREE(hpmp->hpm_bmind, M_HPFSMNT); + kfree(hpmp->hpm_bitmap, M_HPFSMNT); + kfree(hpmp->hpm_bmind, M_HPFSMNT); dprintf((" error %d\n", error)); return (error); } @@ -275,8 +274,8 @@ hpfs_cpinit ( cpicnt = hpmp->hpm_sp.sp_cpinum; - MALLOC(hpmp->hpm_cpdblk, struct cpdblk *, - cpicnt * sizeof(struct cpdblk), M_HPFSMNT, M_WAITOK); + hpmp->hpm_cpdblk = kmalloc(cpicnt * sizeof(struct cpdblk), M_HPFSMNT, + M_WAITOK); cpdbp = hpmp->hpm_cpdblk; lsn = hpmp->hpm_sp.sp_cpi; @@ -314,7 +313,7 @@ hpfs_cpdeinit ( struct hpfsmount *hpmp) { dprintf(("hpmp_cpdeinit: ")); - FREE(hpmp->hpm_cpdblk,M_HPFSMNT); + kfree(hpmp->hpm_cpdblk, M_HPFSMNT); return (0); } diff --git a/sys/vfs/hpfs/hpfs_vfsops.c b/sys/vfs/hpfs/hpfs_vfsops.c index 5bcefb9b47..27df4b0473 100644 --- a/sys/vfs/hpfs/hpfs_vfsops.c +++ b/sys/vfs/hpfs/hpfs_vfsops.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vfsops.c,v 1.3.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vfsops.c,v 1.43 2008/09/17 21:44:22 dillon Exp $ */ @@ -372,7 +371,7 @@ hpfs_unmount(struct mount *mp, int mntflags) hpfs_bmdeinit(hpmp); mp->mnt_data = (qaddr_t)0; mp->mnt_flag &= ~MNT_LOCAL; - FREE(hpmp, M_HPFSMNT); + kfree(hpmp, M_HPFSMNT); return (0); } @@ -484,13 +483,12 @@ hpfs_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) * at that time is little, and anyway - we'll * check for it). */ - MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode), - M_HPFSNO, M_WAITOK); + hp = kmalloc(sizeof(struct hpfsnode), M_HPFSNO, M_WAITOK); error = getnewvnode(VT_HPFS, hpmp->hpm_mp, &vp, VLKTIMEOUT, 0); if (error) { kprintf("hpfs_vget: can't get new vnode\n"); - FREE(hp, M_HPFSNO); + kfree(hp, M_HPFSNO); return (error); } diff --git a/sys/vfs/hpfs/hpfs_vnops.c b/sys/vfs/hpfs/hpfs_vnops.c index 8a6227ed35..10be9042e8 100644 --- a/sys/vfs/hpfs/hpfs_vnops.c +++ b/sys/vfs/hpfs/hpfs_vnops.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vnops.c,v 1.2.2.2 2002/01/15 18:35:09 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.47 2008/06/19 23:27:39 dillon Exp $ */ #include @@ -647,7 +646,7 @@ hpfs_reclaim(struct vop_reclaim_args *ap) vp->v_data = NULL; - FREE(hp, M_HPFSNO); + kfree(hp, M_HPFSNO); return (0); } @@ -941,8 +940,7 @@ readdone: dprintf(("%d cookies, ",ncookies)); if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) panic("hpfs_readdir: unexpected uio from NFS server"); - MALLOC(cookies, off_t *, ncookies * sizeof(off_t), - M_TEMP, M_WAITOK); + cookies = kmalloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK); for (cookiep = cookies, i=0; i < ncookies; i++) *cookiep++ = ++num; diff --git a/sys/vfs/isofs/cd9660/cd9660_vfsops.c b/sys/vfs/isofs/cd9660/cd9660_vfsops.c index 3aef16f1ea..1cfed1cbae 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vfsops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vfsops.c @@ -37,7 +37,6 @@ * * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vfsops.c,v 1.74.2.7 2002/04/08 09:39:29 bde Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vfsops.c,v 1.46 2008/09/17 21:44:23 dillon Exp $ */ #include @@ -734,8 +733,7 @@ again: *vpp = NULLVP; return (error); } - MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, - M_WAITOK | M_ZERO); + ip = kmalloc(sizeof(struct iso_node), M_ISOFSNODE, M_WAITOK | M_ZERO); ip->i_vnode = vp; ip->i_dev = dev; ip->i_number = ino; diff --git a/sys/vfs/isofs/cd9660/cd9660_vnops.c b/sys/vfs/isofs/cd9660/cd9660_vnops.c index 0531260229..fcd85bfa44 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vnops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vnops.c @@ -37,7 +37,6 @@ * * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vnops.c,v 1.62 1999/12/15 23:01:51 eivind Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vnops.c,v 1.40 2008/06/19 23:27:39 dillon Exp $ */ #include @@ -168,7 +167,7 @@ cd9660_getattr(struct vop_getattr_args *ap) struct uio auio; char *cp; - MALLOC(cp, char *, MAXPATHLEN, M_TEMP, M_WAITOK); + cp = kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); aiov.iov_base = cp; aiov.iov_len = MAXPATHLEN; auio.uio_iov = &aiov; @@ -183,7 +182,7 @@ cd9660_getattr(struct vop_getattr_args *ap) rdlnk.a_cred = proc0.p_ucred; /* use root cred */ if (cd9660_readlink(&rdlnk) == 0) vap->va_size = MAXPATHLEN - auio.uio_resid; - FREE(cp, M_TEMP); + kfree(cp, M_TEMP); } vap->va_flags = 0; vap->va_gen = 1; @@ -432,7 +431,7 @@ cd9660_readdir(struct vop_readdir_args *ap) if ((error = vn_lock(vdp, LK_EXCLUSIVE|LK_RETRY)) != 0) return (error); - MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK); + idp = kmalloc(sizeof(*idp), M_TEMP, M_WAITOK); idp->saveent.de.d_namlen = idp->assocent.de.d_namlen = 0; /* * XXX @@ -453,8 +452,7 @@ cd9660_readdir(struct vop_readdir_args *ap) ncookies = uio->uio_resid / 16 + 1; if (ncookies > 1024) ncookies = 1024; - MALLOC(cookies, off_t *, ncookies * sizeof(off_t), - M_TEMP, M_WAITOK); + cookies = kmalloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK); idp->cookies = cookies; idp->ncookies = ncookies; } @@ -463,7 +461,7 @@ cd9660_readdir(struct vop_readdir_args *ap) if ((entryoffsetinblock = idp->curroff & bmask) && (error = cd9660_devblkatoff(vdp, (off_t)idp->curroff, NULL, &bp))) { - FREE(idp, M_TEMP); + kfree(idp, M_TEMP); goto done; } endsearch = dp->i_size; @@ -590,7 +588,7 @@ cd9660_readdir(struct vop_readdir_args *ap) uio->uio_offset = idp->uio_off; *ap->a_eofflag = idp->eofflag; - FREE(idp, M_TEMP); + kfree(idp, M_TEMP); done: vn_unlock(vdp); diff --git a/sys/vfs/mfs/mfs_vfsops.c b/sys/vfs/mfs/mfs_vfsops.c index 07ea2dc45d..4c95554922 100644 --- a/sys/vfs/mfs/mfs_vfsops.c +++ b/sys/vfs/mfs/mfs_vfsops.c @@ -32,7 +32,6 @@ * * @(#)mfs_vfsops.c 8.11 (Berkeley) 6/19/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vfsops.c,v 1.81.2.3 2001/07/04 17:35:21 tegge Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vfsops.c,v 1.41 2008/07/26 22:31:54 mneumann Exp $ */ @@ -328,8 +327,7 @@ mfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(mfsp, struct mfsnode *, sizeof *mfsp, M_MFSNODE, - M_WAITOK|M_ZERO); + mfsp = kmalloc(sizeof *mfsp, M_MFSNODE, M_WAITOK | M_ZERO); minnum = (int)curproc->p_pid; @@ -409,7 +407,7 @@ error_1: /* no state to back out*/ destroy_dev(mfsp->mfs_dev); mfsp->mfs_dev = NULL; } - FREE(mfsp, M_MFSNODE); + kfree(mfsp, M_MFSNODE); } success: @@ -492,7 +490,7 @@ mfs_start(struct mount *mp, int flags) destroy_dev(mfsp->mfs_dev); mfsp->mfs_dev = NULL; } - FREE(mfsp, M_MFSNODE); + kfree(mfsp, M_MFSNODE); return (0); } diff --git a/sys/vfs/msdosfs/msdosfs_denode.c b/sys/vfs/msdosfs/msdosfs_denode.c index b8e02376ab..213a4fef15 100644 --- a/sys/vfs/msdosfs/msdosfs_denode.c +++ b/sys/vfs/msdosfs/msdosfs_denode.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_denode.c,v 1.47.2.3 2002/08/22 16:20:15 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_denode.c,v 1.35 2008/06/08 07:56:06 nth Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ /*- @@ -303,8 +302,8 @@ again: * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(ldep, struct denode *, sizeof(struct denode), M_MSDOSFSNODE, - M_WAITOK | M_ZERO); + ldep = kmalloc(sizeof(struct denode), M_MSDOSFSNODE, + M_WAITOK | M_ZERO); /* * Directory entry was not in cache, have to create a vnode and @@ -315,7 +314,7 @@ again: error = getnewvnode(VT_MSDOSFS, mntp, &nvp, VLKTIMEOUT, 0); if (error) { *depp = NULL; - FREE(ldep, M_MSDOSFSNODE); + kfree(ldep, M_MSDOSFSNODE); return error; } diff --git a/sys/vfs/msdosfs/msdosfs_vnops.c b/sys/vfs/msdosfs/msdosfs_vnops.c index 0b67134b2f..01dd6376f9 100644 --- a/sys/vfs/msdosfs/msdosfs_vnops.c +++ b/sys/vfs/msdosfs/msdosfs_vnops.c @@ -1554,8 +1554,7 @@ msdosfs_readdir(struct vop_readdir_args *ap) ncookies = uio->uio_resid / 16 + 1; if (ncookies > 1024) ncookies = 1024; - MALLOC(cookies, off_t *, ncookies * sizeof(off_t), M_TEMP, - M_WAITOK); + cookies = kmalloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK); *ap->a_cookies = cookies; *ap->a_ncookies = ncookies; } diff --git a/sys/vfs/nfs/krpc_subr.c b/sys/vfs/nfs/krpc_subr.c index 0df0063162..a09609a976 100644 --- a/sys/vfs/nfs/krpc_subr.c +++ b/sys/vfs/nfs/krpc_subr.c @@ -1,6 +1,5 @@ /* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */ /* $FreeBSD: src/sys/nfs/krpc_subr.c,v 1.13.2.1 2000/11/20 21:17:14 tegge Exp $ */ -/* $DragonFly: src/sys/vfs/nfs/krpc_subr.c,v 1.12 2007/04/22 01:13:17 dillon Exp $ */ /* * Copyright (c) 1995 Gordon Ross, Adam Glass @@ -349,7 +348,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, secs = timo; while (secs > 0) { if (from) { - FREE(from, M_SONAME); + kfree(from, M_SONAME); from = NULL; } if (m) { diff --git a/sys/vfs/nfs/nfs_node.c b/sys/vfs/nfs/nfs_node.c index 5cf5f65b6c..edfb01667f 100644 --- a/sys/vfs/nfs/nfs_node.c +++ b/sys/vfs/nfs/nfs_node.c @@ -35,7 +35,6 @@ * * @(#)nfs_node.c 8.6 (Berkeley) 5/22/95 * $FreeBSD: src/sys/nfs/nfs_node.c,v 1.36.2.3 2002/01/05 22:25:04 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_node.c,v 1.27 2007/08/08 00:12:51 swildner Exp $ */ @@ -166,7 +165,7 @@ loop: */ bzero(np, sizeof (*np)); if (fhsize > NFS_SMALLFH) { - MALLOC(np->n_fhp, nfsfh_t *, fhsize, M_NFSBIGFH, M_WAITOK); + np->n_fhp = kmalloc(fhsize, M_NFSBIGFH, M_WAITOK); } else { np->n_fhp = &np->n_fh; } @@ -187,7 +186,7 @@ loop: lockmgr(&nfsnhash_lock, LK_RELEASE); if (np->n_fhsize > NFS_SMALLFH) - FREE((caddr_t)np->n_fhp, M_NFSBIGFH); + kfree((caddr_t)np->n_fhp, M_NFSBIGFH); np->n_fhp = NULL; objcache_put(nfsnode_objcache, np); goto retry; @@ -300,7 +299,7 @@ loop: */ bzero(np, sizeof (*np)); if (fhsize > NFS_SMALLFH) { - MALLOC(np->n_fhp, nfsfh_t *, fhsize, M_NFSBIGFH, M_WAITOK); + np->n_fhp = kmalloc(fhsize, M_NFSBIGFH, M_WAITOK); } else { np->n_fhp = &np->n_fh; } @@ -321,7 +320,7 @@ loop: lockmgr(&nfsnhash_lock, LK_RELEASE); if (np->n_fhsize > NFS_SMALLFH) - FREE((caddr_t)np->n_fhp, M_NFSBIGFH); + kfree((caddr_t)np->n_fhp, M_NFSBIGFH); np->n_fhp = NULL; objcache_put(nfsnode_objcache, np); @@ -393,7 +392,7 @@ nfs_inactive(struct vop_inactive_args *ap) nfs_removeit(sp); crfree(sp->s_cred); vrele(sp->s_dvp); - FREE((caddr_t)sp, M_NFSREQ); + kfree((caddr_t)sp, M_NFSREQ); } np->n_flag &= ~(NWRITEERR | NACC | NUPD | NCHG | NLOCKED | NWANTED); @@ -449,11 +448,11 @@ nfs_reclaim(struct vop_reclaim_args *ap) while (dp) { dp2 = dp; dp = dp->ndm_list.le_next; - FREE((caddr_t)dp2, M_NFSDIROFF); + kfree((caddr_t)dp2, M_NFSDIROFF); } } if (np->n_fhsize > NFS_SMALLFH) { - FREE((caddr_t)np->n_fhp, M_NFSBIGFH); + kfree((caddr_t)np->n_fhp, M_NFSBIGFH); } if (np->n_rucred) { crfree(np->n_rucred); diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index 8b1f7bc107..e7e6ebccf0 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,6 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.48 2008/09/17 21:44:24 dillon Exp $ */ /* @@ -915,8 +914,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, m2 = m; } } - MALLOC(iv, struct iovec *, i * sizeof (struct iovec), - M_TEMP, M_WAITOK); + iv = kmalloc(i * sizeof(struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv2 = iv; m = info.mb; left = len; @@ -943,7 +941,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); off = uiop->uio_offset; nh->nh_nextr = off; - FREE((caddr_t)iv2, M_TEMP); + kfree((caddr_t)iv2, M_TEMP); if (error || (getret = VOP_GETATTR(vp, vap))) { if (!error) error = getret; @@ -1113,8 +1111,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, } if (len > 0) { - MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, - M_WAITOK); + ivp = kmalloc(cnt * sizeof(struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv = ivp; uiop->uio_iovcnt = cnt; mp1 = info.mrep; @@ -1147,7 +1144,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, uiop->uio_offset = off; error = VOP_WRITE(vp, uiop, ioflags, cred); nfsstats.srvvop_writes++; - FREE((caddr_t)iv, M_TEMP); + kfree((caddr_t)iv, M_TEMP); } aftat_ret = VOP_GETATTR(vp, vap); vput(vp); @@ -1415,8 +1412,7 @@ loop1: mp1 = mp1->m_next; } uiop->uio_iovcnt = i; - MALLOC(iov, struct iovec *, i * sizeof (struct iovec), - M_TEMP, M_WAITOK); + iov = kmalloc(i * sizeof(struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = ivp = iov; mp1 = info.mrep; while (mp1) { @@ -1431,7 +1427,7 @@ loop1: error = VOP_WRITE(vp, uiop, ioflags, cred); nfsstats.srvvop_writes++; } - FREE((caddr_t)iov, M_TEMP); + kfree((caddr_t)iov, M_TEMP); } m_freem(info.mrep); info.mrep = NULL; @@ -2516,7 +2512,7 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, ERROROUT(nfsm_srvsattr(&info, vap)); } NEGATIVEOUT(len2 = nfsm_strsiz(&info, NFS_MAXPATHLEN)); - MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, M_WAITOK); + pathcp = kmalloc(len2 + 1, M_TEMP, M_WAITOK); iv.iov_base = pathcp; iv.iov_len = len2; io.uio_resid = len2; @@ -2563,7 +2559,7 @@ out: vp = NULL; } if (pathcp) { - FREE(pathcp, M_TEMP); + kfree(pathcp, M_TEMP); pathcp = NULL; } if (dirp) { @@ -2594,7 +2590,7 @@ nfsmout: if (dirp) vrele(dirp); if (pathcp) - FREE(pathcp, M_TEMP); + kfree(pathcp, M_TEMP); return (error); } @@ -2964,7 +2960,7 @@ nfsrv_readdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, /* * end section. Allocate rbuf and continue */ - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); + rbuf = kmalloc(siz, M_TEMP, M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; @@ -3025,8 +3021,8 @@ again: tl = nfsm_build(&info, 2 * NFSX_UNSIGNED); *tl++ = nfs_false; *tl = nfs_true; - FREE((caddr_t)rbuf, M_TEMP); - FREE((caddr_t)cookies, M_TEMP); + kfree((caddr_t)rbuf, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); error = 0; goto nfsmout; } @@ -3156,8 +3152,8 @@ again: mp1->m_len = bp - mtod(mp1, caddr_t); } else mp1->m_len += bp - info.bpos; - FREE((caddr_t)rbuf, M_TEMP); - FREE((caddr_t)cookies, M_TEMP); + kfree((caddr_t)rbuf, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); nfsmout: *mrq = info.mreq; @@ -3251,7 +3247,7 @@ nfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, goto nfsmout; } vn_unlock(vp); - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); + rbuf = kmalloc(siz, M_TEMP, M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; @@ -3307,8 +3303,8 @@ again: tl += 2; *tl++ = nfs_false; *tl = nfs_true; - FREE((caddr_t)cookies, M_TEMP); - FREE((caddr_t)rbuf, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); + kfree((caddr_t)rbuf, M_TEMP); error = 0; goto nfsmout; } @@ -3497,8 +3493,8 @@ invalid: mp1->m_len = bp - mtod(mp1, caddr_t); } else mp1->m_len += bp - info.bpos; - FREE((caddr_t)cookies, M_TEMP); - FREE((caddr_t)rbuf, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); + kfree((caddr_t)rbuf, M_TEMP); nfsmout: *mrq = info.mreq; if (vp) diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index 0a6ed9d6e9..b68bd89969 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -35,7 +35,6 @@ * * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_socket.c,v 1.60.2.6 2003/03/26 01:44:46 alfred Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.45 2007/05/18 17:05:13 dillon Exp $ */ /* @@ -845,7 +844,7 @@ nfs_reply(struct nfsmount *nmp, struct nfsreq *myrep) return (error); } if (nam) - FREE(nam, M_SONAME); + kfree(nam, M_SONAME); /* * Get the xid and check that it is an rpc reply @@ -1550,7 +1549,7 @@ nfs_request_processreply(nfsm_info_t info, int error) KKASSERT(*req->r_dposp == info->dpos); m_freem(req->r_mreq); req->r_mreq = NULL; - FREE(req, M_NFSREQ); + kfree(req, M_NFSREQ); return (0); } m_freem(info->mrep); @@ -2633,7 +2632,7 @@ nfsrv_rcv(struct socket *so, void *arg, int waitflag) M_NFSRVDESC, mf); if (!rec) { if (nam) - FREE(nam, M_SONAME); + kfree(nam, M_SONAME); m_freem(sio.sb_mb); continue; } @@ -2858,15 +2857,14 @@ nfsrv_dorec(struct nfssvc_sock *slp, struct nfsd *nfsd, nam = rec->nr_address; m = rec->nr_packet; kfree(rec, M_NFSRVDESC); - MALLOC(nd, struct nfsrv_descript *, sizeof (struct nfsrv_descript), - M_NFSRVDESC, M_WAITOK); + nd = kmalloc(sizeof(struct nfsrv_descript), M_NFSRVDESC, M_WAITOK); nd->nd_md = nd->nd_mrep = m; nd->nd_nam2 = nam; nd->nd_dpos = mtod(m, caddr_t); error = nfs_getreq(nd, nfsd, TRUE); if (error) { if (nam) { - FREE(nam, M_SONAME); + kfree(nam, M_SONAME); } kfree((caddr_t)nd, M_NFSRVDESC); return (error); diff --git a/sys/vfs/nfs/nfs_srvcache.c b/sys/vfs/nfs/nfs_srvcache.c index 6c2a96fadd..0a850d6784 100644 --- a/sys/vfs/nfs/nfs_srvcache.c +++ b/sys/vfs/nfs/nfs_srvcache.c @@ -35,7 +35,6 @@ * * @(#)nfs_srvcache.c 8.3 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_srvcache.c,v 1.21 2000/02/13 03:32:06 peter Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_srvcache.c,v 1.13 2008/01/05 14:02:41 swildner Exp $ */ /* @@ -240,7 +239,7 @@ loop: rp->rc_flag &= ~RC_REPMBUF; } if (rp->rc_flag & RC_NAM) { - FREE(rp->rc_nam, M_SONAME); + kfree(rp->rc_nam, M_SONAME); rp->rc_nam = NULL; rp->rc_flag &= ~RC_NAM; } diff --git a/sys/vfs/nfs/nfs_subs.c b/sys/vfs/nfs/nfs_subs.c index 97f902d2c3..3e98d5fd7d 100644 --- a/sys/vfs/nfs/nfs_subs.c +++ b/sys/vfs/nfs/nfs_subs.c @@ -35,7 +35,6 @@ * * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95 * $FreeBSD: /repoman/r/ncvs/src/sys/nfsclient/nfs_subs.c,v 1.128 2004/04/14 23:23:55 peadar Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_subs.c,v 1.48 2008/09/17 21:44:24 dillon Exp $ */ /* @@ -1336,8 +1335,8 @@ nfs_getcookie(struct nfsnode *np, off_t off, int add) dp = np->n_cookies.lh_first; if (!dp) { if (add) { - MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), - M_NFSDIROFF, M_WAITOK); + dp = kmalloc(sizeof(struct nfsdmap), M_NFSDIROFF, + M_WAITOK); dp->ndm_eocookie = 0; LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); } else @@ -1351,8 +1350,8 @@ nfs_getcookie(struct nfsnode *np, off_t off, int add) return (NULL); dp = dp->ndm_list.le_next; } else if (add) { - MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), - M_NFSDIROFF, M_WAITOK); + dp2 = kmalloc(sizeof(struct nfsdmap), M_NFSDIROFF, + M_WAITOK); dp2->ndm_eocookie = 0; LIST_INSERT_AFTER(dp, dp2, ndm_list); dp = dp2; diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c index c58b8e9851..9fb0973be7 100644 --- a/sys/vfs/nfs/nfs_syscalls.c +++ b/sys/vfs/nfs/nfs_syscalls.c @@ -259,7 +259,7 @@ sys_nfssvc(struct nfssvc_args *uap) TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru); if (nuidp->nu_flag & NU_NAM) - FREE(nuidp->nu_nam, M_SONAME); + kfree(nuidp->nu_nam, M_SONAME); } nuidp->nu_flag = 0; nuidp->nu_cr = nsd->nsd_cr; @@ -336,7 +336,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td) tslp = nfs_udpsock; if (tslp->ns_flag & SLP_VALID) { if (mynam != NULL) - FREE(mynam, M_SONAME); + kfree(mynam, M_SONAME); return (EPERM); } } @@ -359,7 +359,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td) error = soreserve(so, siz, siz, NULL); if (error) { if (mynam != NULL) - FREE(mynam, M_SONAME); + kfree(mynam, M_SONAME); return (error); } @@ -667,7 +667,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) nfsstats.srv_errs++; nfsrv_updatecache(nd, FALSE, mreq); if (nd->nd_nam2) - FREE(nd->nd_nam2, M_SONAME); + kfree(nd->nd_nam2, M_SONAME); break; } nfsstats.srvrpccnt[nd->nd_procnum]++; @@ -712,7 +712,7 @@ skip: if (nfsrtton) nfsd_rt(sotype, nd, cacherep); if (nd->nd_nam2) - FREE(nd->nd_nam2, M_SONAME); + kfree(nd->nd_nam2, M_SONAME); if (nd->nd_mrep) m_freem(nd->nd_mrep); if (error == EPIPE || error == ENOBUFS) @@ -733,11 +733,11 @@ skip: nfsd_rt(sotype, nd, cacherep); m_freem(nd->nd_mrep); if (nd->nd_nam2) - FREE(nd->nd_nam2, M_SONAME); + kfree(nd->nd_nam2, M_SONAME); break; }; if (nd) { - FREE((caddr_t)nd, M_NFSRVDESC); + kfree((caddr_t)nd, M_NFSRVDESC); nd = NULL; } @@ -812,13 +812,13 @@ nfsrv_zapsock(struct nfssvc_sock *slp) soshutdown(so, SHUT_RDWR); closef(fp, NULL); if (slp->ns_nam) - FREE(slp->ns_nam, M_SONAME); + kfree(slp->ns_nam, M_SONAME); m_freem(slp->ns_raw); while ((rec = STAILQ_FIRST(&slp->ns_rec)) != NULL) { --slp->ns_numrec; STAILQ_REMOVE_HEAD(&slp->ns_rec, nr_link); if (rec->nr_address) - FREE(rec->nr_address, M_SONAME); + kfree(rec->nr_address, M_SONAME); m_freem(rec->nr_packet); kfree(rec, M_NFSRVDESC); } @@ -829,7 +829,7 @@ nfsrv_zapsock(struct nfssvc_sock *slp) LIST_REMOVE(nuidp, nu_hash); TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru); if (nuidp->nu_flag & NU_NAM) - FREE(nuidp->nu_nam, M_SONAME); + kfree(nuidp->nu_nam, M_SONAME); kfree((caddr_t)nuidp, M_NFSUID); } crit_enter(); diff --git a/sys/vfs/nfs/nfs_vfsops.c b/sys/vfs/nfs/nfs_vfsops.c index b7807e0854..31e0070213 100644 --- a/sys/vfs/nfs/nfs_vfsops.c +++ b/sys/vfs/nfs/nfs_vfsops.c @@ -780,7 +780,7 @@ haderror: vfs_unbusy(mp); if (didalloc) kfree(mp, M_MOUNT); - FREE(nam, M_SONAME); + kfree(nam, M_SONAME); return (error); } *mpp = mp; @@ -1034,7 +1034,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, if (mp->mnt_flag & MNT_UPDATE) { nmp = VFSTONFS(mp); /* update paths, file handles, etc, here XXX */ - FREE(nam, M_SONAME); + kfree(nam, M_SONAME); return (0); } else { nmp = objcache_get(nfsmount_objcache, M_WAITOK); @@ -1264,7 +1264,7 @@ nfs_free_mount(struct nfsmount *nmp) nmp->nm_cred = NULL; } if (nmp->nm_nam) { - FREE(nmp->nm_nam, M_SONAME); + kfree(nmp->nm_nam, M_SONAME); nmp->nm_nam = NULL; } objcache_put(nfsmount_objcache, nmp); diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index 1a9c21bb52..49762eefe2 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,6 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.80 2008/10/18 01:13:54 dillon Exp $ */ @@ -2905,8 +2904,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) if (vp->v_type == VDIR) panic("nfs: sillyrename dir"); #endif - MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename), - M_NFSREQ, M_WAITOK); + sp = kmalloc(sizeof(struct sillyrename), M_NFSREQ, M_WAITOK); sp->s_cred = crdup(cnp->cn_cred); sp->s_dvp = dvp; vref(dvp); diff --git a/sys/vfs/ntfs/ntfs_subr.c b/sys/vfs/ntfs/ntfs_subr.c index a421d06909..8b8fca45cd 100644 --- a/sys/vfs/ntfs/ntfs_subr.c +++ b/sys/vfs/ntfs/ntfs_subr.c @@ -190,7 +190,7 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type, } /* Scan $ATTRIBUTE_LIST for requested attribute */ len = lvap->va_datalen; - MALLOC(alpool, caddr_t, len, M_TEMP, M_WAITOK); + alpool = kmalloc(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(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type, "ino: %"PRId64", type: 0x%x, name: %.*s, vcn: %d\n", \ ip->i_number, type, (int) namelen, name, (u_int32_t) vcn)); out: - FREE(alpool, M_TEMP); + kfree(alpool, M_TEMP); return (error); } @@ -266,8 +266,7 @@ ntfs_loadntnode(struct ntfsmount *ntmp, struct ntnode *ip) dprintf(("ntfs_loadntnode: loading ino: %"PRId64"\n",ip->i_number)); - MALLOC(mfrp, struct filerec *, ntfs_bntob(ntmp->ntm_bpmftrec), - M_TEMP, M_WAITOK); + mfrp = kmalloc(ntfs_bntob(ntmp->ntm_bpmftrec), M_TEMP, M_WAITOK); if (ip->i_number < NTFS_SYSNODESNUM) { struct buf *bp; @@ -338,7 +337,7 @@ ntfs_loadntnode(struct ntfsmount *ntmp, struct ntnode *ip) ip->i_flag |= IN_LOADED; out: - FREE(mfrp, M_TEMP); + kfree(mfrp, M_TEMP); return (error); } @@ -382,8 +381,7 @@ ntfs_ntlookup(struct ntfsmount *ntmp, ino_t ino, struct ntnode **ipp) } } while (LOCKMGR(&ntfs_hashlock, LK_EXCLUSIVE | LK_SLEEPFAIL)); - MALLOC(ip, struct ntnode *, sizeof(struct ntnode), - M_NTFSNTNODE, M_WAITOK | M_ZERO); + ip = kmalloc(sizeof(struct ntnode), M_NTFSNTNODE, M_WAITOK | M_ZERO); ddprintf(("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip)); /* Generic initialization */ @@ -462,7 +460,7 @@ ntfs_ntput(struct ntnode *ip) } spin_unlock(&ip->i_interlock); vrele(ip->i_devvp); - FREE(ip, M_NTFSNTNODE); + kfree(ip, M_NTFSNTNODE); } /* @@ -506,14 +504,14 @@ ntfs_freentvattr(struct ntvattr *vap) { if (vap->va_flag & NTFS_AF_INRUN) { if (vap->va_vruncn) - FREE(vap->va_vruncn, M_NTFSRUN); + kfree(vap->va_vruncn, M_NTFSRUN); if (vap->va_vruncl) - FREE(vap->va_vruncl, M_NTFSRUN); + kfree(vap->va_vruncl, M_NTFSRUN); } else { if (vap->va_datap) - FREE(vap->va_datap, M_NTFSRDATA); + kfree(vap->va_datap, M_NTFSRDATA); } - FREE(vap, M_NTFSNTVATTR); + kfree(vap, M_NTFSNTVATTR); } /* @@ -530,8 +528,8 @@ ntfs_attrtontvattr(struct ntfsmount *ntmp, struct ntvattr **rvapp, error = 0; *rvapp = NULL; - MALLOC(vap, struct ntvattr *, sizeof(struct ntvattr), - M_NTFSNTVATTR, M_WAITOK | M_ZERO); + vap = kmalloc(sizeof(struct ntvattr), M_NTFSNTVATTR, + M_WAITOK | M_ZERO); vap->va_ip = NULL; vap->va_flag = rap->a_hdr.a_flag; vap->va_type = rap->a_hdr.a_type; @@ -567,15 +565,15 @@ ntfs_attrtontvattr(struct ntfsmount *ntmp, struct ntvattr **rvapp, 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, - M_NTFSRDATA, M_WAITOK); + vap->va_datap = kmalloc(vap->va_datalen, M_NTFSRDATA, + M_WAITOK); memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff, rap->a_r.a_datalen); } ddprintf((", len: %d", vap->va_datalen)); if (error) - FREE(vap, M_NTFSNTVATTR); + kfree(vap, M_NTFSNTVATTR); else *rvapp = vap; @@ -605,8 +603,8 @@ ntfs_runtovrun(cn_t **rcnp, cn_t **rclp, u_long *rcntp, u_int8_t *run) 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 = kmalloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); + cl = kmalloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); off = 0; cnt = 0; @@ -744,14 +742,14 @@ ntfs_fget(struct ntfsmount *ntmp, struct ntnode *ip, int attrtype, if (*fpp) return (0); - MALLOC(fp, struct fnode *, sizeof(struct fnode), M_NTFSFNODE, - M_WAITOK | M_ZERO); + fp = kmalloc(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 = kmalloc(strlen(attrname) + 1, M_TEMP, + M_WAITOK); strcpy(fp->f_attrname, attrname); } else fp->f_attrname = NULL; @@ -781,10 +779,10 @@ ntfs_frele(struct fnode *fp) dprintf(("ntfs_frele: deallocating fnode\n")); LIST_REMOVE(fp,f_fnlist); if (fp->f_flag & FN_AATTRNAME) - FREE(fp->f_attrname, M_TEMP); + kfree(fp->f_attrname, M_TEMP); if (fp->f_dirblbuf) - FREE(fp->f_dirblbuf, M_NTFSDIR); - FREE(fp, M_NTFSFNODE); + kfree(fp->f_dirblbuf, M_NTFSDIR); + kfree(fp, M_NTFSFNODE); ntfs_ntrele(ip); } @@ -831,7 +829,7 @@ ntfs_ntlookupattr(struct ntfsmount *ntmp, const char *name, int namelen, out: if (namelen) { - MALLOC((*attrname), char *, namelen, M_TEMP, M_WAITOK); + (*attrname) = kmalloc(namelen, M_TEMP, M_WAITOK); memcpy((*attrname), name, namelen); (*attrname)[namelen] = '\0'; } @@ -893,7 +891,7 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, dprintf(("ntfs_ntlookupfile: blksz: %d, rdsz: %d\n", blsize, rdsize)); - MALLOC(rdbuf, caddr_t, blsize, M_TEMP, M_WAITOK); + rdbuf = kmalloc(blsize, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30", 0, rdsize, rdbuf, NULL); @@ -958,7 +956,7 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, /* free the buffer returned by ntfs_ntlookupattr() */ if (attrname) { - FREE(attrname, M_TEMP); + kfree(attrname, M_TEMP); attrname = NULL; } @@ -1041,10 +1039,10 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, dprintf(("finish\n")); fail: - if (attrname) FREE(attrname, M_TEMP); + if (attrname) kfree(attrname, M_TEMP); ntfs_ntvattrrele(vap); ntfs_ntput(ip); - FREE(rdbuf, M_TEMP); + kfree(rdbuf, M_TEMP); return (error); } @@ -1110,8 +1108,8 @@ ntfs_ntreaddir(struct ntfsmount *ntmp, struct fnode *fp, 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 = kmalloc(max(vap->va_datalen, fp->f_dirblsz), + M_NTFSDIR, M_WAITOK); } blsize = fp->f_dirblsz; @@ -1126,7 +1124,7 @@ ntfs_ntreaddir(struct ntfsmount *ntmp, struct fnode *fp, error = ENOTDIR; goto fail; } - MALLOC(bmp, u_char *, bmvap->va_datalen, M_TEMP, M_WAITOK); + bmp = kmalloc(bmvap->va_datalen, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", 0, bmvap->va_datalen, bmp, NULL); if (error) @@ -1232,7 +1230,7 @@ fail: if (iavap) ntfs_ntvattrrele(iavap); if (bmp) - FREE(bmp, M_TEMP); + kfree(bmp, M_TEMP); ntfs_ntput(ip); return (error); } @@ -1683,10 +1681,10 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum, ddprintf(("ntfs_ntreadattr: compression: %d\n", vap->va_compressalg)); - MALLOC(cup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), - M_NTFSDECOMP, M_WAITOK); - MALLOC(uup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), - M_NTFSDECOMP, M_WAITOK); + cup = kmalloc(ntfs_cntob(NTFS_COMPUNIT_CL), M_NTFSDECOMP, + M_WAITOK); + uup = kmalloc(ntfs_cntob(NTFS_COMPUNIT_CL), M_NTFSDECOMP, + M_WAITOK); cn = (ntfs_btocn(roff)) & (~(NTFS_COMPUNIT_CL - 1)); off = roff - ntfs_cntob(cn); @@ -1730,8 +1728,8 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum, cn += NTFS_COMPUNIT_CL; } - FREE(uup, M_NTFSDECOMP); - FREE(cup, M_NTFSDECOMP); + kfree(uup, M_NTFSDECOMP); + kfree(cup, M_NTFSDECOMP); } else error = ntfs_readattr_plain(ntmp, ip, attrnum, attrname, roff, rsize, rdata, &init, uio); @@ -1897,8 +1895,8 @@ ntfs_toupper_use(struct mount *mp, struct ntfsmount *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), - M_NTFSRDATA, M_WAITOK); + ntfs_toupper_tab = kmalloc(65536 * sizeof(wchar), M_NTFSRDATA, + M_WAITOK); if ((error = VFS_VGET(mp, NULL, NTFS_UPCASEINO, &vp))) goto out; @@ -1924,7 +1922,7 @@ ntfs_toupper_unuse(void) ntfs_toupper_usecount--; if (ntfs_toupper_usecount == 0) { - FREE(ntfs_toupper_tab, M_NTFSRDATA); + kfree(ntfs_toupper_tab, M_NTFSRDATA); ntfs_toupper_tab = NULL; } #ifdef DIAGNOSTIC @@ -1950,14 +1948,14 @@ ntfs_u28_init(struct ntfsmount *ntmp, wchar *u2w, char *cs_local, return (0); } - MALLOC(u28, char **, 256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO); + u28 = kmalloc(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] = kmalloc(256 * sizeof(char), M_TEMP, M_WAITOK); for (j=0; j<256; j++) u28[h][j] = '_'; } @@ -1990,9 +1988,9 @@ ntfs_u28_uninit(struct ntfsmount *ntmp) for (i=0; i<256; i++) if (u28[i] != NULL) - FREE(u28[i], M_TEMP); + kfree(u28[i], M_TEMP); - FREE(u28, M_TEMP); + kfree(u28, M_TEMP); return (0); } @@ -2009,7 +2007,7 @@ ntfs_82u_init(struct ntfsmount *ntmp, char *cs_local, char *cs_ntfs) return (0); } - MALLOC(_82u, wchar *, 256 * sizeof(wchar), M_TEMP, M_WAITOK); + _82u = kmalloc(256 * sizeof(wchar), M_TEMP, M_WAITOK); for (i=0; i<256; i++) _82u[i] = i; @@ -2029,7 +2027,7 @@ ntfs_82u_uninit(struct ntfsmount *ntmp) return (0); } - FREE(ntmp->ntm_82u, M_TEMP); + kfree(ntmp->ntm_82u, M_TEMP); return (0); } diff --git a/sys/vfs/ntfs/ntfs_vfsops.c b/sys/vfs/ntfs/ntfs_vfsops.c index a6213aae9e..b0d57ce52f 100644 --- a/sys/vfs/ntfs/ntfs_vfsops.c +++ b/sys/vfs/ntfs/ntfs_vfsops.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vfsops.c,v 1.20.2.5 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vfsops.c,v 1.48 2008/09/17 21:44:25 dillon Exp $ */ @@ -548,9 +547,8 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, } /* Alloc memory for attribute definitions */ - MALLOC(ntmp->ntm_ad, struct ntvattrdef *, - num * sizeof(struct ntvattrdef), - M_NTFSMNT, M_WAITOK); + ntmp->ntm_ad = kmalloc(num * sizeof(struct ntvattrdef), + M_NTFSMNT, M_WAITOK); ntmp->ntm_adnum = num; @@ -674,8 +672,8 @@ ntfs_unmount(struct mount *mp, int mntflags) ntfs_82u_uninit(ntmp); mp->mnt_data = (qaddr_t)0; mp->mnt_flag &= ~MNT_LOCAL; - FREE(ntmp->ntm_ad, M_NTFSMNT); - FREE(ntmp, M_NTFSMNT); + kfree(ntmp->ntm_ad, M_NTFSMNT); + kfree(ntmp, M_NTFSMNT); return (error); } @@ -720,7 +718,7 @@ ntfs_calccfree(struct ntfsmount *ntmp, cn_t *cfreep) bmsize = VTOF(vp)->f_size; - MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, M_WAITOK); + tmp = kmalloc(bmsize, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL, 0, bmsize, tmp, NULL); @@ -733,7 +731,7 @@ ntfs_calccfree(struct ntfsmount *ntmp, cn_t *cfreep) *cfreep = cfree; out: - FREE(tmp, M_TEMP); + kfree(tmp, M_TEMP); return(error); } diff --git a/sys/vfs/ntfs/ntfs_vnops.c b/sys/vfs/ntfs/ntfs_vnops.c index 307e0cca1f..26dcdd4f96 100644 --- a/sys/vfs/ntfs/ntfs_vnops.c +++ b/sys/vfs/ntfs/ntfs_vnops.c @@ -36,7 +36,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vnops.c,v 1.9.2.4 2002/08/06 19:35:18 semenu Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.44 2007/11/20 21:03:50 dillon Exp $ * */ @@ -665,8 +664,7 @@ readdone: ddprintf(("ntfs_readdir: %d cookies\n",ncookies)); if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) panic("ntfs_readdir: unexpected uio from NFS server"); - MALLOC(cookies, off_t *, ncookies * sizeof(off_t), - M_TEMP, M_WAITOK); + cookies = kmalloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK); cookiep = cookies; while (off < num) *cookiep++ = ++off; diff --git a/sys/vfs/nwfs/nwfs_node.c b/sys/vfs/nwfs/nwfs_node.c index f29ff34219..3f1eac4f98 100644 --- a/sys/vfs/nwfs/nwfs_node.c +++ b/sys/vfs/nwfs/nwfs_node.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_node.c,v 1.3.2.8 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_node.c,v 1.27 2007/08/08 00:12:52 swildner Exp $ */ #include #include @@ -165,11 +164,11 @@ rescan: * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO); + np = kmalloc(sizeof *np, M_NWNODE, M_WAITOK | M_ZERO); error = getnewvnode(VT_NWFS, mp, &vp, 0, 0); if (error) { *vpp = NULL; - FREE(np, M_NWNODE); + kfree(np, M_NWNODE); return (error); } np->n_vnode = vp; diff --git a/sys/vfs/nwfs/nwfs_vfsops.c b/sys/vfs/nwfs/nwfs_vfsops.c index aa8249652b..639999cc31 100644 --- a/sys/vfs/nwfs/nwfs_vfsops.c +++ b/sys/vfs/nwfs/nwfs_vfsops.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_vfsops.c,v 1.6.2.6 2001/10/25 19:18:54 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_vfsops.c,v 1.30 2008/01/06 16:55:53 swildner Exp $ */ #include "opt_ncp.h" #ifndef NCP @@ -115,7 +114,7 @@ nwfs_initnls(struct nwmount *nmp) { nmp->m.nls.u2n = ncp_defnls.u2n; return 0; } - MALLOC(pe, char *, 256 * 4, M_NWFSDATA, M_WAITOK); + pe = kmalloc(256 * 4, M_NWFSDATA, M_WAITOK); pc = pe; do { COPY_TABLE(nmp->m.nls.to_lower, ncp_defnls.to_lower); @@ -172,7 +171,8 @@ nwfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) ncp_conn_unlock(conn,curthread); /* we keep the ref */ mp->mnt_stat.f_iosize = conn->buffer_size; /* We must malloc our own mount info */ - MALLOC(nmp,struct nwmount *,sizeof(struct nwmount),M_NWFSDATA, M_WAITOK|M_USE_RESERVE|M_ZERO); + nmp = kmalloc(sizeof(struct nwmount), M_NWFSDATA, + M_WAITOK | M_USE_RESERVE | M_ZERO); mp->mnt_data = (qaddr_t)nmp; nmp->connh = handle; nmp->n_root = NULL; diff --git a/sys/vfs/portal/portal_vfsops.c b/sys/vfs/portal/portal_vfsops.c index 76d61e6923..3af7e13618 100644 --- a/sys/vfs/portal/portal_vfsops.c +++ b/sys/vfs/portal/portal_vfsops.c @@ -36,7 +36,6 @@ * @(#)portal_vfsops.c 8.11 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vfsops.c,v 1.26.2.2 2001/07/26 20:37:16 iedowse Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vfsops.c,v 1.24 2007/05/18 17:05:13 dillon Exp $ */ /* @@ -104,19 +103,17 @@ portal_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) return (ESOCKTNOSUPPORT); } - MALLOC(pn, struct portalnode *, sizeof(struct portalnode), - M_TEMP, M_WAITOK); + pn = kmalloc(sizeof(struct portalnode), M_TEMP, M_WAITOK); - MALLOC(fmp, struct portalmount *, sizeof(struct portalmount), - M_PORTALFSMNT, M_WAITOK); /* XXX */ + fmp = kmalloc(sizeof(struct portalmount), M_PORTALFSMNT, M_WAITOK); /* XXX */ vfs_add_vnodeops(mp, &portal_vnode_vops, &mp->mnt_vn_norm_ops); error = getnewvnode(VT_PORTAL, mp, &rvp, 0, 0); if (error) { - FREE(fmp, M_PORTALFSMNT); - FREE(pn, M_TEMP); + kfree(fmp, M_PORTALFSMNT); + kfree(pn, M_TEMP); fdrop(fp); return (error); } diff --git a/sys/vfs/portal/portal_vnops.c b/sys/vfs/portal/portal_vnops.c index 3951b602a4..fc0c000c9b 100644 --- a/sys/vfs/portal/portal_vnops.c +++ b/sys/vfs/portal/portal_vnops.c @@ -36,7 +36,6 @@ * @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vnops.c,v 1.38 1999/12/21 06:29:00 chris Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.39 2007/11/20 21:03:50 dillon Exp $ */ /* @@ -133,12 +132,11 @@ portal_lookup(struct vop_old_lookup_args *ap) * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(pt, struct portalnode *, sizeof(struct portalnode), - M_TEMP, M_WAITOK); + pt = kmalloc(sizeof(struct portalnode), M_TEMP, M_WAITOK); error = getnewvnode(VT_PORTAL, dvp->v_mount, &fvp, 0, 0); if (error) { - FREE(pt, M_TEMP); + kfree(pt, M_TEMP); goto bad; } fvp->v_type = VREG; @@ -537,7 +535,7 @@ portal_reclaim(struct vop_reclaim_args *ap) kfree((caddr_t) pt->pt_arg, M_TEMP); pt->pt_arg = 0; } - FREE(ap->a_vp->v_data, M_TEMP); + kfree(ap->a_vp->v_data, M_TEMP); ap->a_vp->v_data = 0; return (0); diff --git a/sys/vfs/procfs/procfs_status.c b/sys/vfs/procfs/procfs_status.c index 4a422262c5..0b351d7e24 100644 --- a/sys/vfs/procfs/procfs_status.c +++ b/sys/vfs/procfs/procfs_status.c @@ -38,7 +38,6 @@ * * From: * $FreeBSD: src/sys/miscfs/procfs/procfs_status.c,v 1.20.2.4 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_status.c,v 1.15 2007/02/19 01:14:24 corecode Exp $ */ #include @@ -221,31 +220,30 @@ procfs_docmdline(struct proc *curp, struct lwp *lp, struct pfsnode *pfs, buf = 0; } else { buflen = 256; - MALLOC(buf, char *, buflen + 1, M_TEMP, M_WAITOK); + buf = kmalloc(buflen + 1, M_TEMP, M_WAITOK); bp = buf; ps = buf; error = copyin((void*)PS_STRINGS, &pstr, sizeof(pstr)); if (error) { - FREE(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } if (pstr.ps_nargvstr < 0) { - FREE(buf, M_TEMP); + kfree(buf, M_TEMP); return (EINVAL); } if (pstr.ps_nargvstr > ARG_MAX) { - FREE(buf, M_TEMP); + kfree(buf, M_TEMP); return (E2BIG); } - MALLOC(ps_argvstr, char **, - pstr.ps_nargvstr * sizeof(char *), - M_TEMP, M_WAITOK); + ps_argvstr = kmalloc(pstr.ps_nargvstr * sizeof(char *), + M_TEMP, M_WAITOK); error = copyin((void *)pstr.ps_argvstr, ps_argvstr, pstr.ps_nargvstr * sizeof(char *)); if (error) { - FREE(ps_argvstr, M_TEMP); - FREE(buf, M_TEMP); + kfree(ps_argvstr, M_TEMP); + kfree(buf, M_TEMP); return (error); } bytes_left = buflen; @@ -261,11 +259,11 @@ procfs_docmdline(struct proc *curp, struct lwp *lp, struct pfsnode *pfs, bytes_left -= done; } buflen = ps - buf; - FREE(ps_argvstr, M_TEMP); + kfree(ps_argvstr, M_TEMP); } error = uiomove_frombuf(bp, buflen, uio); if (buf) - FREE(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } diff --git a/sys/vfs/procfs/procfs_subr.c b/sys/vfs/procfs/procfs_subr.c index 75c0ed85f3..6ff2ae94cf 100644 --- a/sys/vfs/procfs/procfs_subr.c +++ b/sys/vfs/procfs/procfs_subr.c @@ -37,7 +37,6 @@ * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_subr.c,v 1.26.2.3 2002/02/18 21:28:04 des Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_subr.c,v 1.18 2007/08/25 23:27:02 corecode Exp $ */ #include @@ -144,7 +143,7 @@ loop: * XXX this may not matter anymore since getnewvnode now returns * a VX locked vnode. */ - MALLOC(pfs, struct pfsnode *, sizeof(struct pfsnode), M_TEMP, M_WAITOK); + pfs = kmalloc(sizeof(struct pfsnode), M_TEMP, M_WAITOK); error = getnewvnode(VT_PROCFS, mp, vpp, 0, 0); if (error) { diff --git a/sys/vfs/smbfs/smbfs_node.c b/sys/vfs/smbfs/smbfs_node.c index bce0500312..404eaa2c56 100644 --- a/sys/vfs/smbfs/smbfs_node.c +++ b/sys/vfs/smbfs/smbfs_node.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_node.c,v 1.2.2.3 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_node.c,v 1.25 2007/08/08 00:12:52 swildner Exp $ */ #include #include @@ -227,10 +226,10 @@ loop: if (fap == NULL) return ENOENT; - MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); + np = kmalloc(sizeof *np, M_SMBNODE, M_WAITOK); error = getnewvnode(VT_SMBFS, mp, &vp, VLKTIMEOUT, LK_CANRECURSE); if (error) { - FREE(np, M_SMBNODE); + kfree(np, M_SMBNODE); return error; } vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; @@ -319,7 +318,7 @@ smbfs_reclaim(struct vop_reclaim_args *ap) smbfs_hash_unlock(smp, td); if (np->n_name) smbfs_name_free(np->n_name); - FREE(np, M_SMBNODE); + kfree(np, M_SMBNODE); if (dvp) { /* * Indicate that we released something; see comment diff --git a/sys/vfs/smbfs/smbfs_vfsops.c b/sys/vfs/smbfs/smbfs_vfsops.c index be9bbf4184..d6a1015bf1 100644 --- a/sys/vfs/smbfs/smbfs_vfsops.c +++ b/sys/vfs/smbfs/smbfs_vfsops.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_vfsops.c,v 1.2.2.5 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_vfsops.c,v 1.33 2007/05/06 19:23:35 dillon Exp $ */ #include "opt_netsmb.h" #ifndef NETSMB @@ -158,7 +157,7 @@ smbfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) #ifdef SMBFS_USEZONE smp = zalloc(smbfsmount_zone); #else - MALLOC(smp, struct smbmount*, sizeof(*smp), M_SMBFSDATA, M_WAITOK|M_USE_RESERVE); + smp = kmalloc(sizeof(*smp), M_SMBFSDATA, M_WAITOK | M_USE_RESERVE); #endif if (smp == NULL) { kprintf("could not alloc smbmount\n"); diff --git a/sys/vfs/ufs/ffs_inode.c b/sys/vfs/ufs/ffs_inode.c index b0112d65a5..81497cc9df 100644 --- a/sys/vfs/ufs/ffs_inode.c +++ b/sys/vfs/ufs/ffs_inode.c @@ -32,7 +32,6 @@ * * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95 * $FreeBSD: src/sys/ufs/ffs/ffs_inode.c,v 1.56.2.5 2002/02/05 18:35:03 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_inode.c,v 1.24 2007/06/14 02:55:25 dillon Exp $ */ #include "opt_quota.h" @@ -525,7 +524,7 @@ ffs_indirtrunc(struct inode *ip, ufs_daddr_t lbn, ufs_daddr_t dbn, bap = (ufs_daddr_t *)bp->b_data; if (lastbn != -1) { - MALLOC(copy, ufs_daddr_t *, fs->fs_bsize, M_TEMP, M_WAITOK); + copy = kmalloc(fs->fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (uint)fs->fs_bsize); bzero((caddr_t)&bap[last + 1], (uint)(NINDIR(fs) - (last + 1)) * sizeof (ufs_daddr_t)); @@ -572,7 +571,7 @@ ffs_indirtrunc(struct inode *ip, ufs_daddr_t lbn, ufs_daddr_t dbn, } } if (copy != NULL) { - FREE(copy, M_TEMP); + kfree(copy, M_TEMP); } else { bp->b_flags |= B_INVAL | B_NOCACHE; brelse(bp); diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c index eeaad4b442..ad33f3572b 100644 --- a/sys/vfs/ufs/ffs_softdep.c +++ b/sys/vfs/ufs/ffs_softdep.c @@ -37,7 +37,6 @@ * * from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00 * $FreeBSD: src/sys/ufs/ffs/ffs_softdep.c,v 1.57.2.11 2002/02/05 18:46:53 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.57 2008/06/28 17:59:51 dillon Exp $ */ /* @@ -434,7 +433,7 @@ sema_release(struct sema *semap) LIST_REMOVE(item, wk_list); \ } while (0) -#define WORKITEM_FREE(item, type) FREE(item, DtoM(type)) +#define WORKITEM_FREE(item, type) kfree(item, DtoM(type)) #else /* DEBUG */ static void worklist_insert(struct workhead *, struct worklist *); @@ -492,7 +491,7 @@ workitem_free(struct worklist *item, int type) FREE_LOCK(&lk); panic("workitem_free: type mismatch"); } - FREE(item, DtoM(type)); + kfree(item, DtoM(type)); } #endif /* DEBUG */ @@ -948,8 +947,8 @@ top: ACQUIRE_LOCK(&lk); goto top; } - MALLOC(pagedep, struct pagedep *, sizeof(struct pagedep), M_PAGEDEP, - M_SOFTDEP_FLAGS | M_ZERO); + pagedep = kmalloc(sizeof(struct pagedep), M_PAGEDEP, + M_SOFTDEP_FLAGS | M_ZERO); if (pagedep_find(pagedephd, ip->i_number, lbn, mp)) { kprintf("pagedep_lookup: blocking race avoided\n"); @@ -1039,8 +1038,8 @@ top: ACQUIRE_LOCK(&lk); goto top; } - MALLOC(inodedep, struct inodedep *, sizeof(struct inodedep), - M_INODEDEP, M_SOFTDEP_FLAGS | M_ZERO); + inodedep = kmalloc(sizeof(struct inodedep), M_INODEDEP, + M_SOFTDEP_FLAGS | M_ZERO); if (inodedep_find(inodedephd, fs, inum)) { kprintf("inodedep_lookup: blocking race avoided\n"); ACQUIRE_LOCK(&lk); @@ -1116,8 +1115,8 @@ top: return (0); if (sema_get(&newblk_in_progress, 0) == 0) goto top; - MALLOC(newblk, struct newblk *, sizeof(struct newblk), - M_NEWBLK, M_SOFTDEP_FLAGS | M_ZERO); + newblk = kmalloc(sizeof(struct newblk), M_NEWBLK, + M_SOFTDEP_FLAGS | M_ZERO); if (newblk_find(newblkhd, fs, newblkno)) { kprintf("newblk_lookup: blocking race avoided\n"); @@ -1316,8 +1315,8 @@ bmsafemap_lookup(struct buf *bp) return (WK_BMSAFEMAP(wk)); } FREE_LOCK(&lk); - MALLOC(bmsafemap, struct bmsafemap *, sizeof(struct bmsafemap), - M_BMSAFEMAP, M_SOFTDEP_FLAGS); + bmsafemap = kmalloc(sizeof(struct bmsafemap), M_BMSAFEMAP, + M_SOFTDEP_FLAGS); bmsafemap->sm_list.wk_type = D_BMSAFEMAP; bmsafemap->sm_list.wk_state = 0; bmsafemap->sm_buf = bp; @@ -1380,8 +1379,8 @@ softdep_setup_allocdirect(struct inode *ip, ufs_lbn_t lbn, ufs_daddr_t newblkno, struct pagedep *pagedep; struct newblk *newblk; - MALLOC(adp, struct allocdirect *, sizeof(struct allocdirect), - M_ALLOCDIRECT, M_SOFTDEP_FLAGS | M_ZERO); + adp = kmalloc(sizeof(struct allocdirect), M_ALLOCDIRECT, + M_SOFTDEP_FLAGS | M_ZERO); adp->ad_list.wk_type = D_ALLOCDIRECT; adp->ad_lbn = lbn; adp->ad_newblkno = newblkno; @@ -1411,7 +1410,7 @@ softdep_setup_allocdirect(struct inode *ip, ufs_lbn_t lbn, ufs_daddr_t newblkno, LIST_INSERT_HEAD(&bmsafemap->sm_allocdirecthd, adp, ad_deps); } LIST_REMOVE(newblk, nb_hash); - FREE(newblk, M_NEWBLK); + kfree(newblk, M_NEWBLK); WORKLIST_INSERT_BP(bp, &adp->ad_list); if (lbn >= NDADDR) { @@ -1538,8 +1537,8 @@ newfreefrag(struct inode *ip, ufs_daddr_t blkno, long size) fs = ip->i_fs; if (fragnum(fs, blkno) + numfrags(fs, size) > fs->fs_frag) panic("newfreefrag: frag size"); - MALLOC(freefrag, struct freefrag *, sizeof(struct freefrag), - M_FREEFRAG, M_SOFTDEP_FLAGS); + freefrag = kmalloc(sizeof(struct freefrag), M_FREEFRAG, + M_SOFTDEP_FLAGS); freefrag->ff_list.wk_type = D_FREEFRAG; freefrag->ff_state = ip->i_uid & ~ONWORKLIST; /* XXX - used below */ freefrag->ff_inum = ip->i_number; @@ -1565,7 +1564,7 @@ handle_workitem_freefrag(struct freefrag *freefrag) tip.i_number = freefrag->ff_inum; tip.i_uid = freefrag->ff_state & ~ONWORKLIST; /* XXX - set above */ ffs_blkfree(&tip, freefrag->ff_blkno, freefrag->ff_fragsize); - FREE(freefrag, M_FREEFRAG); + kfree(freefrag, M_FREEFRAG); } /* @@ -1608,8 +1607,8 @@ newallocindir(struct inode *ip, int ptrno, ufs_daddr_t newblkno, { struct allocindir *aip; - MALLOC(aip, struct allocindir *, sizeof(struct allocindir), - M_ALLOCINDIR, M_SOFTDEP_FLAGS | M_ZERO); + aip = kmalloc(sizeof(struct allocindir), M_ALLOCINDIR, + M_SOFTDEP_FLAGS | M_ZERO); aip->ai_list.wk_type = D_ALLOCINDIR; aip->ai_state = ATTACHED; aip->ai_offset = ptrno; @@ -1732,7 +1731,7 @@ setup_allocindir_phase2(struct buf *bp, struct inode *ip, aip, ai_deps); } LIST_REMOVE(newblk, nb_hash); - FREE(newblk, M_NEWBLK); + kfree(newblk, M_NEWBLK); aip->ai_indirdep = indirdep; /* * Check to see if there is an existing dependency @@ -1773,8 +1772,8 @@ setup_allocindir_phase2(struct buf *bp, struct inode *ip, } if (indirdep) break; - MALLOC(newindirdep, struct indirdep *, sizeof(struct indirdep), - M_INDIRDEP, M_SOFTDEP_FLAGS); + newindirdep = kmalloc(sizeof(struct indirdep), M_INDIRDEP, + M_SOFTDEP_FLAGS); newindirdep->ir_list.wk_type = D_INDIRDEP; newindirdep->ir_state = ATTACHED; LIST_INIT(&newindirdep->ir_deplisthd); @@ -1850,8 +1849,8 @@ softdep_setup_freeblocks(struct inode *ip, off_t length) fs = ip->i_fs; if (length != 0) panic("softde_setup_freeblocks: non-zero length"); - MALLOC(freeblks, struct freeblks *, sizeof(struct freeblks), - M_FREEBLKS, M_SOFTDEP_FLAGS | M_ZERO); + freeblks = kmalloc(sizeof(struct freeblks), M_FREEBLKS, + M_SOFTDEP_FLAGS | M_ZERO); freeblks->fb_list.wk_type = D_FREEBLKS; freeblks->fb_state = ATTACHED; freeblks->fb_uid = ip->i_uid; @@ -2136,8 +2135,8 @@ softdep_freefile(struct vnode *pvp, ino_t ino, int mode) /* * This sets up the inode de-allocation dependency. */ - MALLOC(freefile, struct freefile *, sizeof(struct freefile), - M_FREEFILE, M_SOFTDEP_FLAGS); + freefile = kmalloc(sizeof(struct freefile), M_FREEFILE, + M_SOFTDEP_FLAGS); freefile->fx_list.wk_type = D_FREEFILE; freefile->fx_list.wk_state = 0; freefile->fx_mode = mode; @@ -2204,7 +2203,7 @@ check_inode_unwritten(struct inodedep *inodedep) if (inodedep->id_state & ONWORKLIST) WORKLIST_REMOVE(&inodedep->id_list); if (inodedep->id_savedino != NULL) { - FREE(inodedep->id_savedino, M_INODEDEP); + kfree(inodedep->id_savedino, M_INODEDEP); inodedep->id_savedino = NULL; } if (free_inodedep(inodedep) == 0) { @@ -2465,8 +2464,8 @@ softdep_setup_directory_add(struct buf *bp, struct inode *dp, off_t diroffset, fs = dp->i_fs; lbn = lblkno(fs, diroffset); offset = blkoff(fs, diroffset); - MALLOC(dap, struct diradd *, sizeof(struct diradd), M_DIRADD, - M_SOFTDEP_FLAGS | M_ZERO); + dap = kmalloc(sizeof(struct diradd), M_DIRADD, + M_SOFTDEP_FLAGS | M_ZERO); dap->da_list.wk_type = D_DIRADD; dap->da_offset = offset; dap->da_newinum = newinum; @@ -2476,13 +2475,13 @@ softdep_setup_directory_add(struct buf *bp, struct inode *dp, off_t diroffset, ACQUIRE_LOCK(&lk); } else { dap->da_state |= MKDIR_BODY | MKDIR_PARENT; - MALLOC(mkdir1, struct mkdir *, sizeof(struct mkdir), M_MKDIR, - M_SOFTDEP_FLAGS); + mkdir1 = kmalloc(sizeof(struct mkdir), M_MKDIR, + M_SOFTDEP_FLAGS); mkdir1->md_list.wk_type = D_MKDIR; mkdir1->md_state = MKDIR_BODY; mkdir1->md_diradd = dap; - MALLOC(mkdir2, struct mkdir *, sizeof(struct mkdir), M_MKDIR, - M_SOFTDEP_FLAGS); + mkdir2 = kmalloc(sizeof(struct mkdir), M_MKDIR, + M_SOFTDEP_FLAGS); mkdir2->md_list.wk_type = D_MKDIR; mkdir2->md_state = MKDIR_PARENT; mkdir2->md_diradd = dap; @@ -2729,8 +2728,8 @@ newdirrem(struct buf *bp, struct inode *dp, struct inode *ip, if (num_dirrem > max_softdeps / 2 && speedup_syncer() == 0) (void) request_cleanup(FLUSH_REMOVE, 0); num_dirrem += 1; - MALLOC(dirrem, struct dirrem *, sizeof(struct dirrem), - M_DIRREM, M_SOFTDEP_FLAGS | M_ZERO); + dirrem = kmalloc(sizeof(struct dirrem), M_DIRREM, + M_SOFTDEP_FLAGS | M_ZERO); dirrem->dm_list.wk_type = D_DIRREM; dirrem->dm_state = isrmdir ? RMDIR : 0; dirrem->dm_mnt = ITOV(ip)->v_mount; @@ -2833,8 +2832,8 @@ softdep_setup_directory_change(struct buf *bp, struct inode *dp, * Whiteouts do not need diradd dependencies. */ if (newinum != WINO) { - MALLOC(dap, struct diradd *, sizeof(struct diradd), - M_DIRADD, M_SOFTDEP_FLAGS | M_ZERO); + dap = kmalloc(sizeof(struct diradd), M_DIRADD, + M_SOFTDEP_FLAGS | M_ZERO); dap->da_list.wk_type = D_DIRADD; dap->da_state = DIRCHG | ATTACHED | DEPCOMPLETE; dap->da_offset = offset; @@ -3191,8 +3190,9 @@ softdep_disk_io_initiation(struct buf *bp) /* * Replace up-to-date version with safe version. */ - MALLOC(indirdep->ir_saveddata, caddr_t, bp->b_bcount, - M_INDIRDEP, M_SOFTDEP_FLAGS); + indirdep->ir_saveddata = kmalloc(bp->b_bcount, + M_INDIRDEP, + M_SOFTDEP_FLAGS); ACQUIRE_LOCK(&lk); indirdep->ir_state &= ~ATTACHED; indirdep->ir_state |= UNDONE; @@ -3294,8 +3294,8 @@ initiate_write_inodeblock(struct inodedep *inodedep, struct buf *bp) if ((inodedep->id_state & DEPCOMPLETE) == 0) { if (inodedep->id_savedino != NULL) panic("initiate_write_inodeblock: already doing I/O"); - MALLOC(sip, struct ufs1_dinode *, - sizeof(struct ufs1_dinode), M_INODEDEP, M_SOFTDEP_FLAGS); + sip = kmalloc(sizeof(struct ufs1_dinode), M_INODEDEP, + M_SOFTDEP_FLAGS); inodedep->id_savedino = sip; *inodedep->id_savedino = *dp; bzero((caddr_t)dp, sizeof(struct ufs1_dinode)); @@ -3509,7 +3509,7 @@ softdep_disk_write_complete(struct buf *bp) panic("disk_write_complete: indirdep gone"); } bcopy(indirdep->ir_saveddata, bp->b_data, bp->b_bcount); - FREE(indirdep->ir_saveddata, M_INDIRDEP); + kfree(indirdep->ir_saveddata, M_INDIRDEP); indirdep->ir_saveddata = 0; indirdep->ir_state &= ~UNDONE; indirdep->ir_state |= ATTACHED; @@ -3688,7 +3688,7 @@ handle_written_inodeblock(struct inodedep *inodedep, struct buf *bp) */ if (inodedep->id_savedino != NULL) { *dp = *inodedep->id_savedino; - FREE(inodedep->id_savedino, M_INODEDEP); + kfree(inodedep->id_savedino, M_INODEDEP); inodedep->id_savedino = NULL; if ((bp->b_flags & B_DELWRI) == 0) stat_inode_bitmap++; diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c index 83ba1a600c..ec39119314 100644 --- a/sys/vfs/ufs/ffs_vfsops.c +++ b/sys/vfs/ufs/ffs_vfsops.c @@ -32,7 +32,6 @@ * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vfsops.c,v 1.117.2.10 2002/06/23 22:34:52 iedowse Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.59 2008/09/17 21:44:25 dillon Exp $ */ #include "opt_quota.h" @@ -1105,8 +1104,7 @@ restart: * XXX this may no longer be true since getnewvnode returns a * VX locked vnode now. */ - MALLOC(ip, struct inode *, sizeof(struct inode), - ump->um_malloctype, M_WAITOK); + ip = kmalloc(sizeof(struct inode), ump->um_malloctype, M_WAITOK); /* Allocate a new vnode/inode. */ error = getnewvnode(VT_UFS, mp, &vp, VLKTIMEOUT, LK_CANRECURSE); diff --git a/sys/vfs/ufs/ufs_dirhash.c b/sys/vfs/ufs/ufs_dirhash.c index eb5a0df08b..8194c6f2d5 100644 --- a/sys/vfs/ufs/ufs_dirhash.c +++ b/sys/vfs/ufs/ufs_dirhash.c @@ -23,7 +23,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ufs/ufs/ufs_dirhash.c,v 1.3.2.6 2002/04/10 21:41:14 dwmalone Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_dirhash.c,v 1.6 2006/05/26 17:07:48 dillon Exp $ */ /* * This implements a hash-based lookup scheme for UFS directories. @@ -155,13 +154,13 @@ ufsdirhash_build(struct inode *ip) * Use non-blocking mallocs so that we will revert to a linear * lookup on failure rather than potentially blocking forever. */ - MALLOC(dh, struct dirhash *, sizeof *dh, M_DIRHASH, M_NOWAIT | M_ZERO); + dh = kmalloc(sizeof *dh, M_DIRHASH, M_NOWAIT | M_ZERO); if (dh == NULL) return (-1); - MALLOC(dh->dh_hash, doff_t **, narrays * sizeof(dh->dh_hash[0]), - M_DIRHASH, M_NOWAIT | M_ZERO); - MALLOC(dh->dh_blkfree, uint8_t *, nblocks * sizeof(dh->dh_blkfree[0]), - M_DIRHASH, M_NOWAIT); + dh->dh_hash = kmalloc(narrays * sizeof(dh->dh_hash[0]), M_DIRHASH, + M_NOWAIT | M_ZERO); + dh->dh_blkfree = kmalloc(nblocks * sizeof(dh->dh_blkfree[0]), + M_DIRHASH, M_NOWAIT); if (dh->dh_hash == NULL || dh->dh_blkfree == NULL) goto fail; for (i = 0; i < narrays; i++) { @@ -228,11 +227,11 @@ fail: for (i = 0; i < narrays; i++) if (dh->dh_hash[i] != NULL) objcache_put(ufsdirhash_oc, dh->dh_hash[i]); - FREE(dh->dh_hash, M_DIRHASH); + kfree(dh->dh_hash, M_DIRHASH); } if (dh->dh_blkfree != NULL) - FREE(dh->dh_blkfree, M_DIRHASH); - FREE(dh, M_DIRHASH); + kfree(dh->dh_blkfree, M_DIRHASH); + kfree(dh, M_DIRHASH); ip->i_dirhash = NULL; ufs_dirhashmem -= memreqd; return (-1); @@ -258,13 +257,13 @@ ufsdirhash_free(struct inode *ip) if (dh->dh_hash != NULL) { for (i = 0; i < dh->dh_narrays; i++) objcache_put(ufsdirhash_oc, dh->dh_hash[i]); - FREE(dh->dh_hash, M_DIRHASH); - FREE(dh->dh_blkfree, M_DIRHASH); + kfree(dh->dh_hash, M_DIRHASH); + kfree(dh->dh_blkfree, M_DIRHASH); mem += dh->dh_narrays * sizeof(*dh->dh_hash) + dh->dh_narrays * DH_NBLKOFF * sizeof(**dh->dh_hash) + dh->dh_nblk * sizeof(*dh->dh_blkfree); } - FREE(dh, M_DIRHASH); + kfree(dh, M_DIRHASH); ip->i_dirhash = NULL; ufs_dirhashmem -= mem; @@ -960,8 +959,8 @@ ufsdirhash_recycle(int wanted) /* Free the detached memory. */ for (i = 0; i < narrays; i++) objcache_put(ufsdirhash_oc, hash[i]); - FREE(hash, M_DIRHASH); - FREE(blkfree, M_DIRHASH); + kfree(hash, M_DIRHASH); + kfree(blkfree, M_DIRHASH); /* Account for the returned memory, and repeat if necessary. */ ufs_dirhashmem -= mem; diff --git a/sys/vfs/union/union_subr.c b/sys/vfs/union/union_subr.c index bfda6f6caa..cb692c0683 100644 --- a/sys/vfs/union/union_subr.c +++ b/sys/vfs/union/union_subr.c @@ -36,7 +36,6 @@ * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 * $FreeBSD: src/sys/miscfs/union/union_subr.c,v 1.43.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/union/union_subr.c,v 1.28 2007/05/06 19:23:35 dillon Exp $ */ #include @@ -541,8 +540,7 @@ loop: goto out; } - MALLOC((*vpp)->v_data, void *, sizeof(struct union_node), - M_TEMP, M_WAITOK); + (*vpp)->v_data = kmalloc(sizeof(struct union_node), M_TEMP, M_WAITOK); vsetflags(*vpp, vflag); if (uppervp)