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;
(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);
}
}
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);
}
}
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;
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);
{
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 */
} else {
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH,
("freeing ccb %p\n", ccb));
- FREE(ccb, M_TARG);
+ kfree(ccb, M_TARG);
}
break;
}
{
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);
}
case BUF_CMD_FREEBLKS:
if (secpp) {
if (secp)
- FREE(secp, M_MDSECT);
+ kfree(secp, M_MDSECT);
*secpp = 0;
}
break;
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;
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,
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);
}
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)
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;
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) {
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);
}
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;
*/
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];
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);
}
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++) {
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);
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);
* 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 $
*/
/*
* 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);
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 |
if (msg->header.typecookie != NGM_GENERIC_COOKIE) {
if (resp != NULL)
*resp = NULL;
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
return (EINVAL);
}
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);
}
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);
}
sch->tx_pending);
}
(*resp)->header.arglen = pos + 1;
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
return (0);
}
* 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 $
*/
/*
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;
/*
* 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));
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;
* 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.
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.
}
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
} else {
get_mplock();
error = kern_accept(uap->s, 0, NULL, 0, &uap->sysmsg_iresult);
error = copyout(&sa_len, uap->alen, sizeof(*uap->alen));
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
if (error == 0)
error = copyout(&sa_len, uap->alen, sizeof(*uap->alen));
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
iovec_free(&iov, aiov);
cleanup2:
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
copyout(&fromlen, uap->fromlenaddr, sizeof(fromlen));
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
cleanup:
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
iovec_free(&iov, aiov);
if (control)
m_freem(control);
* @(#)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 <sys/param.h>
* 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;
}
*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);
}
* 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 <sys/param.h>
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;
}
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.
return (error);
error = kern_bind(linux_args.s, sa);
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
return (error);
error = kern_connect(linux_args.s, 0, sa);
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
if (error != EISCONN)
return (error);
}
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
} else {
error = kern_accept(linux_args.s, 0, NULL, 0, res);
}
error = copyout(&sa_len, linux_args.namelen,
sizeof(*linux_args.namelen));
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return(error);
}
error = copyout(&sa_len, linux_args.namelen,
sizeof(*linux_args.namelen));
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return(error);
}
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;
cleanup:
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
if (msg)
- FREE(msg, M_LINUX);
+ kfree(msg, M_LINUX);
return(error);
}
sizeof(fromlen));
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return(error);
}
iovec_free(&iov, aiov);
cleanup2:
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
cleanup:
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
iovec_free(&iov, aiov);
if (control)
m_freem(control);
}
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));
blocksreleased += blkcount;
}
}
- FREE(copy, M_TEMP);
+ kfree(copy, M_TEMP);
*countp = blocksreleased;
return (allerror);
}
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) {
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,
*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);
* 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) {
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));
* 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 <sys/param.h>
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);
calloutp = (struct callout *)kn->kn_hook;
callout_terminate(calloutp);
- FREE(calloutp, M_KQUEUE);
+ kfree(calloutp, M_KQUEUE);
kq_ncallouts--;
}
*
* @(#)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"
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;
*/
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];
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;
}
kth->ktr_len = sizeof(struct ktr_sysret);
ktrwrite(lp, kth, NULL);
- FREE(kth, M_KTRACE);
+ kfree(kth, M_KTRACE);
lp->lwp_traceflag &= ~KTRFAC_ACTIVE;
}
kth->ktr_buf = path;
ktrwrite(lp, kth, NULL);
- FREE(kth, M_KTRACE);
+ kfree(kth, M_KTRACE);
lp->lwp_traceflag &= ~KTRFAC_ACTIVE;
}
uio->uio_rw = UIO_WRITE;
ktrwrite(lp, kth, uio);
- FREE(kth, M_KTRACE);
+ kfree(kth, M_KTRACE);
lp->lwp_traceflag &= ~KTRFAC_ACTIVE;
}
kth->ktr_len = sizeof (struct ktr_psig);
ktrwrite(lp, kth, NULL);
- FREE(kth, M_KTRACE);
+ kfree(kth, M_KTRACE);
lp->lwp_traceflag &= ~KTRFAC_ACTIVE;
}
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
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;
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);
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);
}
}
}
*
* @(#)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 <sys/param.h>
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;
*
* @(#)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 $
*/
/*
prison_free(cr->cr_prison);
cr->cr_prison = NULL; /* safety */
- FREE((caddr_t)cr, M_CRED);
+ kfree((caddr_t)cr, M_CRED);
}
}
*
* @(#)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"
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);
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);
}
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;
}
*
* @(#)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"
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;
if (!nl)
msglogchar('\n', pri);
msgbuftrigger = 1;
- FREE(miov, M_TEMP);
- FREE(consbuffer, M_TEMP);
+ kfree(miov, M_TEMP);
+ kfree(consbuffer, M_TEMP);
return;
}
*
* @(#)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"
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;
}
ktrgenio(td->td_lwp, fd, UIO_READ, &ktruio, error);
rel_mplock();
}
- FREE(ktriov, M_TEMP);
+ kfree(ktriov, M_TEMP);
}
#endif
if (error == 0)
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;
}
ktrgenio(lp, fd, UIO_WRITE, &ktruio, error);
rel_mplock();
}
- FREE(ktriov, M_TEMP);
+ kfree(ktriov, M_TEMP);
}
#endif
if (error == 0)
* 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
return (EEXIST);
} else {
p->accf_callback = filt->accf_callback;
- FREE(filt, M_ACCF);
+ kfree(filt, M_ACCF);
return (0);
}
}
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);
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;
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';
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;
so->so_options |= SO_ACCEPTFILTER;
out:
if (afap != NULL)
- FREE(afap, M_TEMP);
+ kfree(afap, M_TEMP);
return (error);
}
#endif /* INET */
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 */
if (error)
return (error);
error = kern_bind(uap->s, sa);
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
*name = sa;
} else {
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
}
}
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);
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);
if (error)
return (error);
error = kern_connect(uap->s, 0, sa);
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
if (error)
return (error);
error = kern_connect(uap->s, fflags, sa);
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
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;
}
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)
&uap->sysmsg_szresult);
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
iovec_free(&iov, aiov);
cleanup2:
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
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;
}
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)
}
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
cleanup:
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
iovec_free(&iov, aiov);
if (control)
m_freem(control);
if (error == 0)
error = copyout(&sa_len, uap->alen, sizeof(*uap->alen));
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
if (error == 0)
error = copyout(&sa_len, uap->alen, sizeof(*uap->alen));
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
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
/*
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;
}
}
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) {
}
}
if (error) {
- FREE(nfs_pub.np_index, M_TEMP);
+ kfree(nfs_pub.np_index, M_TEMP);
return (error);
}
}
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;
* 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 <sys/param.h>
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;
* -------------------------------------------------
*
* $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]
*
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);
}
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;
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;
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;
}
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;
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;
*/
/* $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 */
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
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);
/* $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
{
void *ptr;
- MALLOC(ptr, void *, items * size, M_DEVBUF, M_WAITOK);
+ ptr = kmalloc(items * size, M_DEVBUF, M_WAITOK);
return ptr;
}
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;
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;
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;
* Author: Julian Elischer <julian@freebsd.org>
*
* $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 $
*/
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;
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);
}
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);
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
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;
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;
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);
}
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);
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
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;
/* 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);
}
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);
}
/* 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);
/* 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) {
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);
/* 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);
}
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
/*
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;
/* 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;
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]));
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);
}
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);
/* 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--;
#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);
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;
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;
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);
/* 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();
/* 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)
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;
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);
}
ng_unname(node);
node->private = NULL;
ng_unref(sc->node);
- FREE(sc, M_NETGRAPH);
+ kfree(sc, M_NETGRAPH);
return (0);
}
* Author: Julian Elisher <julian@freebsd.org>
*
* $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 $
*/
msg->header.flags |= NGF_RESP;
*rptr = msg;
} else {
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
}
return (0);
}
*
* $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 <sys/param.h>
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);
/* Call generic node constructor */
if ((error = ng_make_node_common(&typestruct, nodep))) {
- FREE(priv, M_NETGRAPH);
+ kfree(priv, M_NETGRAPH);
return (error);
}
node = *nodep;
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);
}
* Author: Julian Elischer <julian@freebsd.org>
*
* $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 <sys/param.h>
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++) {
/* 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 */
* 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);
}
* 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);
}
NG_NODE_SET_PRIVATE(node, NULL);
NG_NODE_UNREF(privdata->node);
- FREE(privdata, M_NETGRAPH_ETF);
+ kfree(privdata, M_NETGRAPH_ETF);
return (0);
}
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);
* Julian Elischer <julian@freebsd.org>
*
* $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 $
*/
/*
}
/* 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);
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 */
}
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);
}
* 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.
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,
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;
}
*/
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;
}
}
/* 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);
/* Delete port */
TAILQ_REMOVE(&b->ng_fec_ports, p, fec_list);
- FREE(p, M_NETGRAPH);
+ kfree(p, M_NETGRAPH);
b->fec_ifcnt--;
return(0);
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);
/* 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;
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);
}
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);
* Author: Julian Elisher <julian@freebsd.org>
*
* $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 $
*/
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 */
ng_cutlinks(node);
ng_unname(node);
node->private = NULL;
- FREE(sc, M_NETGRAPH);
+ kfree(sc, M_NETGRAPH);
ng_unref(node);
return (0);
}
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,
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;
}
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);
}
/* 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;
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);
}
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);
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;
}
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;
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;
bail:
/* Cleanup */
if (sa != NULL)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
break;
}
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;
}
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);
}
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);
/* See if we got anything */
if (sio.sb_mb == NULL) {
if (sa != NULL)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
break;
}
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];
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);
/* 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;
}
out:
if (sa != NULL)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
}
/*
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
/*
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);
/* 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);
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);
/* 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;
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);
}
/* 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);
}
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);
}
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);
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);
* Author: Julian Elischer <julian@freebsd.org>
*
* $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 $
*/
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;
* 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
error = EINVAL;
break;
}
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
return (error);
}
ng_unname(node);
node->private = NULL;
ng_unref(sc->node);
- FREE(sc, M_NETGRAPH);
+ kfree(sc, M_NETGRAPH);
return (0);
}
*
* $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 $
*/
/*
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;
/* 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);
#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)
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);
}
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);
/* 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);
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);
}
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)
/* 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);
}
/* 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);
log(LOG_ERR, "%s: rec'd unexpectedly %s packet",
__func__, "compressed");
failed:
- FREE(buf, M_NETGRAPH);
+ kfree(buf, M_NETGRAPH);
return (EINVAL);
}
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;
|| (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;
}
/* 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);
}
if (retaddr) { \
error = ng_queue_msg(here, resp, retaddr); \
} else { \
- FREE(resp, M_NETGRAPH); \
+ kfree(resp, M_NETGRAPH); \
} \
} \
} while (0)
#define NG_FREE_MSG(msg) \
do { \
if ((msg)) { \
- FREE((msg), M_NETGRAPH); \
+ kfree((msg), M_NETGRAPH); \
(msg) = NULL; \
} \
} while (0)
#define NG_FREE_META(a) \
do { \
if ((a)) { \
- FREE((a), M_NETGRAPH); \
+ kfree((a), M_NETGRAPH); \
(a) = NULL; \
} \
} while (0)
* Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
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);
}
/* 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);
node->type->refs--;
LIST_REMOVE(node, nodes);
LIST_REMOVE(node, idnodes);
- FREE(node, M_NETGRAPH);
+ kfree(node, M_NETGRAPH);
}
crit_exit();
}
}
/* 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);
ng_unname(node_p node)
{
if (node->name) {
- FREE(node->name, M_NETGRAPH);
+ kfree(node->name, M_NETGRAPH);
node->name = NULL;
ng_unref(node);
}
{
crit_enter();
if (--hook->refs == 0)
- FREE(hook, M_NETGRAPH);
+ kfree(hook, M_NETGRAPH);
crit_exit();
}
}
/* 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);
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);
}
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);
}
/* 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);
(msg), (retaddr), (resp)); \
} else { \
TRAP_ERROR; \
- FREE((msg), M_NETGRAPH); \
+ kfree((msg), M_NETGRAPH); \
(error) = EINVAL; \
} \
} \
/* Find the target node */
error = ng_path2node(here, address, &dest, &retaddr);
if (error) {
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
return error;
}
* have taken a copy if they needed to make a delayed response.
*/
if (retaddr)
- FREE(retaddr, M_NETGRAPH);
+ kfree(retaddr, M_NETGRAPH);
return (error);
}
if (msg->header.typecookie != NGM_GENERIC_COOKIE) {
TRAP_ERROR;
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
return (EINVAL);
}
switch (msg->header.cmd) {
break;
}
if (c->name == NULL) {
- FREE(rp, M_NETGRAPH);
+ kfree(rp, M_NETGRAPH);
error = ENOSYS;
break;
}
if ((error = ng_unparse(argstype,
(u_char *)binary->data,
ascii->data, bufSize)) != 0) {
- FREE(rp, M_NETGRAPH);
+ kfree(rp, M_NETGRAPH);
break;
}
}
break;
}
if (c->name == NULL) {
- FREE(rp, M_NETGRAPH);
+ kfree(rp, M_NETGRAPH);
error = ENOSYS;
break;
}
else {
if ((error = ng_parse(argstype, ascii->data,
&off, (u_char *)binary->data, &bufSize)) != 0) {
- FREE(rp, M_NETGRAPH);
+ kfree(rp, M_NETGRAPH);
break;
}
}
TRAP_ERROR;
error = EINVAL;
}
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
return (error);
}
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;
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;
ngqfreesize++; \
crit_exit(); \
} else { \
- FREE((q), M_NETGRAPH); \
+ kfree((q), M_NETGRAPH); \
} \
} while (0)
/* 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);
}
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);
*off += len;
len = strlen(sval) + 1;
bcopy(sval, buf, len);
- FREE(sval, M_NETGRAPH);
+ kfree(sval, M_NETGRAPH);
*buflen = len;
return (0);
}
return (ENOMEM);
NG_PARSE_APPEND("%s", s);
*off += strlen(raw) + 1;
- FREE(s, M_NETGRAPH);
+ kfree(s, M_NETGRAPH);
return (0);
}
*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);
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);
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;
*buflen = blen;
done:
if (foff != NULL)
- FREE(foff, M_NETGRAPH);
+ kfree(foff, M_NETGRAPH);
return (error);
}
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);
/* 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",
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])
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);
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++] = '"';
* 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 $
*
*/
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);
}
* Author: Julian Elischer <julian@freebsd.org>
*
* $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 $
*/
*/
#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; \
*/
#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; \
* Author: Julian Elischer <julian@freebsd.org>
*
* $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 $
*/
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++) {
/* 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);
}
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);
}
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;
* Author: Archie Cobbs <archie@FreeBSD.org>
*
* $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 $
*/
/*
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;
/* 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;
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);
}
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);
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
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;
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);
}
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);
}
/* 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);
} 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);
}
}
tail = tail->m_next;
if (qent->last)
qnext = NULL;
- FREE(qent, M_NETGRAPH);
+ kfree(qent, M_NETGRAPH);
priv->qlen--;
}
*mp = m;
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;
}
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 */
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--;
}
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;
* Author: Julian Elischer <julian@freebsd.org>
*
* $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
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);
}
* 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);
/*
* 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");
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;
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;
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);
}
= 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;
*/
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);
ng_unname(node);
node->private = NULL;
ng_unref(privdata->node);
- FREE(privdata, M_NETGRAPH);
+ kfree(privdata, M_NETGRAPH);
return (0);
}
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 */
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
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;
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);
}
/* If no timers remain, free private info as well */
if (priv->timers == 0) {
- FREE(priv, M_NETGRAPH);
+ kfree(priv, M_NETGRAPH);
node->private = NULL;
}
#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 */
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);
}
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);
/* 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 */
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);
}
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);
* Author: Julian Elischer <julian@freebsd.org>
*
* $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 $
*/
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;
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);
}
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);
}
/* 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';
/* 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. */
release:
if (path != NULL)
- FREE(path, M_NETGRAPH);
+ kfree(path, M_NETGRAPH);
if (control != NULL)
m_freem(control);
if (m != NULL)
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);
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);
}
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 */
sofree(so); /* remove pcb ref */
LIST_REMOVE(pcbp, socks);
- FREE(pcbp, M_PCB);
+ kfree(pcbp, M_PCB);
}
#ifdef NOTYET
/* 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;
error = EINVAL; /* unknown command */
}
/* Free the message and return */
- FREE(msg, M_NETGRAPH);
+ kfree(msg, M_NETGRAPH);
return(error);
}
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);
/* Send it up */
error = ship_msg(pcbp, msg, addr);
- FREE(addr, M_NETGRAPH);
+ kfree(addr, M_NETGRAPH);
return (error);
}
}
node->private = NULL;
ng_unref(node);
- FREE(sockdata, M_NETGRAPH);
+ kfree(sockdata, M_NETGRAPH);
return (0);
}
* Author: Julian Elischer <julian@freebsd.org>
*
* $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 $
*/
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;
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);
}
/* 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);
ng_unname(node);
node->private = NULL;
ng_unref(privdata->node);
- FREE(privdata, M_NETGRAPH);
+ kfree(privdata, M_NETGRAPH);
return (0);
}
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
}
/* 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;
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++);
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);
}
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);
}
* Author: Archie Cobbs <archie@freebsd.org>
*
* $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 $
*/
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;
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);
}
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);
*
* @(#)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 $
*/
/*
}
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;
*
* @(#)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"
/*
* 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;
/*
* 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;
/* $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.
/* 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) {
} /* 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
/* 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");
/* 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");
} /* 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
/* remove the param and free it */
TAILQ_REMOVE(&stcb->asoc.asconf_queue, aparam, next);
- FREE(aparam, M_PCB);
+ kfree(aparam, M_PCB);
}
/*
*/
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) {
/* 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
* 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);
/* now free everything */
m_freem(ca->m);
- FREE(ca, M_PCB);
+ kfree(ca, M_PCB);
}
{
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);
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 {
#ifdef SCTP_DEBUG
kprintf("Failed to initate iterator to takeover associations\n");
#endif
- FREE(ca, M_PCB);
+ kfree(ca, M_PCB);
return (EFAULT);
}
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,
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,
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) {
}
/* 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);
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--;
}
/* 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;
}
}
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);
}
}
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;
}
}
}
- FREE(asoc->strmin, M_PCB);
+ kfree(asoc->strmin, M_PCB);
asoc->strmin = NULL;
}
asoc->streamincnt = 0;
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);
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;
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:
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));
} 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
* 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));
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;
}
}
if (!fnd) {
#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
- FREE(sin, M_SONAME);
+ kfree(sin, M_SONAME);
#endif
SCTP_INP_RUNLOCK(inp);
return ENOENT;
#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));
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;
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;
if (!fnd) {
/* No IPv4 address */
#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
- FREE(sin, M_SONAME);
+ kfree(sin, M_SONAME);
#endif
error = ENOENT;
} else {
/* $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.
*/
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);
/* 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);
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 */
}
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);
*
* @(#)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 */
}
/* 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);
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*/
(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 {
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++) {
/* $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 $ */
/*
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;
}
/* $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 $ */
/*
/*
* 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);
/*
* 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);
* 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 $
*/
/*
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;
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);
* 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
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;
}
}
if (!fnd) {
#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
- FREE(sin6, M_SONAME);
+ kfree(sin6, M_SONAME);
#endif
return ENOENT;
}
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
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;
}
if (!fnd) {
/* No IPv4 address */
#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
- FREE(sin6, M_SONAME);
+ kfree(sin6, M_SONAME);
#endif
return ENOENT;
}
/* $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),
/* Free, if we allocated. */
if (alloc)
- FREE(ptr, M_XDATA);
+ kfree(ptr, M_XDATA);
return EINVAL;
}
/* Free, if we allocated. */
if (alloc)
- FREE(ptr, M_XDATA);
+ kfree(ptr, M_XDATA);
return EINVAL;
}
}
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;
}
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;
* @(#)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 <sys/param.h>
{
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;
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
* @(#)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 <sys/param.h>
}
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;
}
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);
/* $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 $ */
/*
*
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;
}
/* $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 $ */
/*
{
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");
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! */
}
}
* 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
*/
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++;
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);
}
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;
}
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;
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;
* 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
*/
*alen=len;
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return (error);
}
#endif
break;
}
if (sa)
- FREE(sa, M_SONAME);
+ kfree(sa, M_SONAME);
return;
}
#endif /* IPX */
* 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 <sys/param.h>
#include <sys/systm.h>
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) {
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) {
* 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 <sys/param.h>
#include <sys/systm.h>
{
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;
{
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;
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);
}
}
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;
}
*
* @(#)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_
iovec_free(struct iovec **kiov, struct iovec *siov)
{
if (*kiov != siov) {
- FREE(*kiov, M_IOV);
+ kfree(*kiov, M_IOV);
*kiov = NULL;
}
}
* @(#)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 $
*/
/*
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;
* @(#)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 $
*/
/*
* 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;
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);
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) {
}
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;
* 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 <sys/param.h>
}
}
- 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"));
}
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);
}
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);
}
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;
struct hpfsmount *hpmp)
{
dprintf(("hpmp_cpdeinit: "));
- FREE(hpmp->hpm_cpdblk,M_HPFSMNT);
+ kfree(hpmp->hpm_cpdblk, M_HPFSMNT);
return (0);
}
* 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 $
*/
hpfs_bmdeinit(hpmp);
mp->mnt_data = (qaddr_t)0;
mp->mnt_flag &= ~MNT_LOCAL;
- FREE(hpmp, M_HPFSMNT);
+ kfree(hpmp, M_HPFSMNT);
return (0);
}
* 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);
}
* 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 <sys/param.h>
vp->v_data = NULL;
- FREE(hp, M_HPFSNO);
+ kfree(hp, M_HPFSNO);
return (0);
}
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;
*
* @(#)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 <sys/param.h>
*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;
*
* @(#)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 <sys/param.h>
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;
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;
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
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;
}
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;
uio->uio_offset = idp->uio_off;
*ap->a_eofflag = idp->eofflag;
- FREE(idp, M_TEMP);
+ kfree(idp, M_TEMP);
done:
vn_unlock(vdp);
*
* @(#)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 $
*/
* 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;
destroy_dev(mfsp->mfs_dev);
mfsp->mfs_dev = NULL;
}
- FREE(mfsp, M_MFSNODE);
+ kfree(mfsp, M_MFSNODE);
}
success:
destroy_dev(mfsp->mfs_dev);
mfsp->mfs_dev = NULL;
}
- FREE(mfsp, M_MFSNODE);
+ kfree(mfsp, M_MFSNODE);
return (0);
}