Retire the MALLOC and FREE macros. They are an abomination unto style(9).

MFC after:	3 months
This commit is contained in:
Dag-Erling Smørgrav 2008-10-23 15:53:51 +00:00
parent 994f986385
commit 1ede983cc9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184205
217 changed files with 1001 additions and 1073 deletions

View File

@ -758,11 +758,14 @@ buildkernel:
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
.endif .endif
.if !defined(NO_KERNELOBJ)
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> stage 2.2: rebuilding the object tree" @echo ">>> stage 2.2: rebuilding the object tree"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
.endif
.if !defined(NO_KERNELTOOLS)
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> stage 2.3: build tools" @echo ">>> stage 2.3: build tools"
@ -779,6 +782,7 @@ buildkernel:
${MAKE} -DWITHOUT_SSP -DNO_CPU_CFLAGS -DNO_CTF ${target} ${MAKE} -DWITHOUT_SSP -DNO_CPU_CFLAGS -DNO_CTF ${target}
.endfor .endfor
.endif .endif
.endif
.if !defined(NO_KERNELDEPEND) .if !defined(NO_KERNELDEPEND)
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"

View File

@ -741,9 +741,7 @@ MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9
MLINKS+=make_dev.9 destroy_dev.9 \ MLINKS+=make_dev.9 destroy_dev.9 \
make_dev.9 dev_depends.9 \ make_dev.9 dev_depends.9 \
make_dev.9 make_dev_alias.9 make_dev.9 make_dev_alias.9
MLINKS+=malloc.9 FREE.9 \ MLINKS+=malloc.9 free.9 \
malloc.9 free.9 \
malloc.9 MALLOC.9 \
malloc.9 MALLOC_DECLARE.9 \ malloc.9 MALLOC_DECLARE.9 \
malloc.9 MALLOC_DEFINE.9 \ malloc.9 MALLOC_DEFINE.9 \
malloc.9 realloc.9 \ malloc.9 realloc.9 \

View File

@ -36,14 +36,12 @@
.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd June 12, 2003 .Dd October 23, 2008
.Dt MALLOC 9 .Dt MALLOC 9
.Os .Os
.Sh NAME .Sh NAME
.Nm malloc , .Nm malloc ,
.Nm MALLOC ,
.Nm free , .Nm free ,
.Nm FREE ,
.Nm realloc , .Nm realloc ,
.Nm reallocf , .Nm reallocf ,
.Nm MALLOC_DEFINE , .Nm MALLOC_DEFINE ,
@ -54,10 +52,8 @@
.In sys/malloc.h .In sys/malloc.h
.Ft void * .Ft void *
.Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" .Fn malloc "unsigned long size" "struct malloc_type *type" "int flags"
.Fn MALLOC space cast "unsigned long size" "struct malloc_type *type" "int flags"
.Ft void .Ft void
.Fn free "void *addr" "struct malloc_type *type" .Fn free "void *addr" "struct malloc_type *type"
.Fn FREE "void *addr" "struct malloc_type *type"
.Ft void * .Ft void *
.Fn realloc "void *addr" "unsigned long size" "struct malloc_type *type" "int flags" .Fn realloc "void *addr" "unsigned long size" "struct malloc_type *type" "int flags"
.Ft void * .Ft void *
@ -123,20 +119,6 @@ function is identical to
except that it except that it
will free the passed pointer when the requested memory cannot be allocated. will free the passed pointer when the requested memory cannot be allocated.
.Pp .Pp
The
.Fn MALLOC
macro variant is functionally equivalent to
.Bd -literal -offset indent
(space) = (cast)malloc((u_long)(size), type, flags)
.Ed
.Pp
and the
.Fn FREE
macro variant is equivalent to
.Bd -literal -offset indent
free((addr), type)
.Ed
.Pp
Unlike its standard C library counterpart Unlike its standard C library counterpart
.Pq Xr malloc 3 , .Pq Xr malloc 3 ,
the kernel version takes two more arguments. the kernel version takes two more arguments.
@ -219,7 +201,7 @@ MALLOC_DEFINE(M_FOOBUF, "foobuffers", "Buffers to foo data into the ether");
/* sys/something/foo_subr.c */ /* sys/something/foo_subr.c */
\&... \&...
MALLOC(buf, struct foo_buf *, sizeof *buf, M_FOOBUF, M_NOWAIT); buf = malloc(sizeof *buf, M_FOOBUF, M_NOWAIT);
.Ed .Ed
.Pp .Pp

View File

@ -106,7 +106,7 @@ install_coproc_handler(int coproc, undef_handler_t handler)
KASSERT(handler != NULL, ("handler is NULL")); /* Used to be legal. */ KASSERT(handler != NULL, ("handler is NULL")); /* Used to be legal. */
/* XXX: M_TEMP??? */ /* XXX: M_TEMP??? */
MALLOC(uh, struct undefined_handler *, sizeof(*uh), M_TEMP, M_WAITOK); uh = malloc(sizeof(*uh), M_TEMP, M_WAITOK);
uh->uh_handler = handler; uh->uh_handler = handler;
install_coproc_handler_static(coproc, uh); install_coproc_handler_static(coproc, uh);
return uh; return uh;
@ -125,7 +125,7 @@ remove_coproc_handler(void *cookie)
struct undefined_handler *uh = cookie; struct undefined_handler *uh = cookie;
LIST_REMOVE(uh, uh_link); LIST_REMOVE(uh, uh_link);
FREE(uh, M_TEMP); free(uh, M_TEMP);
} }

View File

@ -183,7 +183,7 @@ targopen(struct cdev *dev, int flags, int fmt, struct thread *td)
make_dev(&targ_cdevsw, dev2unit(dev), UID_ROOT, GID_WHEEL, 0600, make_dev(&targ_cdevsw, dev2unit(dev), UID_ROOT, GID_WHEEL, 0600,
"targ%d", dev2unit(dev)); "targ%d", dev2unit(dev));
} }
MALLOC(softc, struct targ_softc *, sizeof(*softc), M_TARG, softc = malloc(sizeof(*softc), M_TARG,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
dev->si_drv1 = softc; dev->si_drv1 = softc;
softc->state = TARG_STATE_OPENED; softc->state = TARG_STATE_OPENED;
@ -211,7 +211,7 @@ targclose(struct cdev *dev, int flag, int fmt, struct thread *td)
if ((softc->periph == NULL) || if ((softc->periph == NULL) ||
(softc->state & TARG_STATE_LUN_ENABLED) == 0) { (softc->state & TARG_STATE_LUN_ENABLED) == 0) {
destroy_dev(dev); destroy_dev(dev);
FREE(softc, M_TARG); free(softc, M_TARG);
return (0); return (0);
} }
@ -230,7 +230,7 @@ targclose(struct cdev *dev, int flag, int fmt, struct thread *td)
softc->periph = NULL; softc->periph = NULL;
} }
destroy_dev(dev); destroy_dev(dev);
FREE(softc, M_TARG); free(softc, M_TARG);
} }
cam_periph_unlock(periph); cam_periph_unlock(periph);
cam_periph_release(periph); cam_periph_release(periph);
@ -531,7 +531,7 @@ targdtor(struct cam_periph *periph)
} }
while ((descr = TAILQ_FIRST(&softc->abort_queue)) != NULL) { while ((descr = TAILQ_FIRST(&softc->abort_queue)) != NULL) {
TAILQ_REMOVE(&softc->abort_queue, descr, tqe); TAILQ_REMOVE(&softc->abort_queue, descr, tqe);
FREE(descr, M_TARG); free(descr, M_TARG);
} }
softc->periph = NULL; softc->periph = NULL;
@ -966,7 +966,7 @@ targgetccb(struct targ_softc *softc, xpt_opcode type, int priority)
int ccb_len; int ccb_len;
ccb_len = targccblen(type); ccb_len = targccblen(type);
MALLOC(ccb, union ccb *, ccb_len, M_TARG, M_WAITOK); ccb = malloc(ccb_len, M_TARG, M_WAITOK);
CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb)); CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb));
xpt_setup_ccb(&ccb->ccb_h, softc->path, priority); xpt_setup_ccb(&ccb->ccb_h, softc->path, priority);
@ -981,13 +981,13 @@ targfreeccb(struct targ_softc *softc, union ccb *ccb)
{ {
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("targfreeccb descr %p and\n", CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("targfreeccb descr %p and\n",
ccb->ccb_h.targ_descr)); ccb->ccb_h.targ_descr));
FREE(ccb->ccb_h.targ_descr, M_TARG); free(ccb->ccb_h.targ_descr, M_TARG);
switch (ccb->ccb_h.func_code) { switch (ccb->ccb_h.func_code) {
case XPT_ACCEPT_TARGET_IO: case XPT_ACCEPT_TARGET_IO:
case XPT_IMMED_NOTIFY: case XPT_IMMED_NOTIFY:
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb)); CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb));
FREE(ccb, M_TARG); free(ccb, M_TARG);
break; break;
default: default:
/* Send back CCB if we got it from the periph */ /* Send back CCB if we got it from the periph */
@ -998,7 +998,7 @@ targfreeccb(struct targ_softc *softc, union ccb *ccb)
} else { } else {
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH,
("freeing ccb %p\n", ccb)); ("freeing ccb %p\n", ccb));
FREE(ccb, M_TARG); free(ccb, M_TARG);
} }
break; break;
} }
@ -1009,7 +1009,7 @@ targgetdescr(struct targ_softc *softc)
{ {
struct targ_cmd_descr *descr; struct targ_cmd_descr *descr;
MALLOC(descr, struct targ_cmd_descr *, sizeof(*descr), M_TARG, descr = malloc(sizeof(*descr), M_TARG,
M_WAITOK); M_WAITOK);
descr->mapinfo.num_bufs_used = 0; descr->mapinfo.num_bufs_used = 0;
return (descr); return (descr);

View File

@ -2673,7 +2673,7 @@ linux_ioctl_register_handler(struct linux_ioctl_handler *h)
break; break;
} }
if (he == NULL) { if (he == NULL) {
MALLOC(he, struct handler_element *, sizeof(*he), he = malloc(sizeof(*he),
M_LINUX, M_WAITOK); M_LINUX, M_WAITOK);
he->func = h->func; he->func = h->func;
} else } else
@ -2711,7 +2711,7 @@ linux_ioctl_unregister_handler(struct linux_ioctl_handler *h)
if (he->func == h->func) { if (he->func == h->func) {
TAILQ_REMOVE(&handlers, he, list); TAILQ_REMOVE(&handlers, he, list);
sx_xunlock(&linux_ioctl_sx); sx_xunlock(&linux_ioctl_sx);
FREE(he, M_LINUX); free(he, M_LINUX);
return (0); return (0);
} }
} }

View File

@ -120,7 +120,7 @@ do_sa_get(struct sockaddr **sap, const struct osockaddr *osa, int *osalen,
} }
#endif #endif
MALLOC(kosa, struct osockaddr *, alloclen, mtype, M_WAITOK); kosa = malloc(alloclen, mtype, M_WAITOK);
if ((error = copyin(osa, kosa, *osalen))) if ((error = copyin(osa, kosa, *osalen)))
goto out; goto out;
@ -168,7 +168,7 @@ do_sa_get(struct sockaddr **sap, const struct osockaddr *osa, int *osalen,
return (0); return (0);
out: out:
FREE(kosa, mtype); free(kosa, mtype);
return (error); return (error);
} }
@ -458,7 +458,7 @@ linux_sendit(struct thread *td, int s, struct msghdr *mp, int flags,
bad: bad:
if (to) if (to)
FREE(to, M_SONAME); free(to, M_SONAME);
return (error); return (error);
} }

View File

@ -165,7 +165,7 @@ linux_get_char_devices()
char formated[256]; char formated[256];
int current_size = 0, string_size = 1024; int current_size = 0, string_size = 1024;
MALLOC(string, char *, string_size, M_LINUX, M_WAITOK); string = malloc(string_size, M_LINUX, M_WAITOK);
string[0] = '\000'; string[0] = '\000';
last = ""; last = "";
TAILQ_FOREACH(de, &devices, list) { TAILQ_FOREACH(de, &devices, list) {
@ -181,10 +181,10 @@ linux_get_char_devices()
if (strlen(formated) + current_size if (strlen(formated) + current_size
>= string_size) { >= string_size) {
string_size *= 2; string_size *= 2;
MALLOC(string, char *, string_size, string = malloc(string_size,
M_LINUX, M_WAITOK); M_LINUX, M_WAITOK);
bcopy(temp, string, current_size); bcopy(temp, string, current_size);
FREE(temp, M_LINUX); free(temp, M_LINUX);
} }
strcat(string, formated); strcat(string, formated);
current_size = strlen(string); current_size = strlen(string);
@ -197,7 +197,7 @@ linux_get_char_devices()
void void
linux_free_get_char_devices(char *string) linux_free_get_char_devices(char *string)
{ {
FREE(string, M_LINUX); free(string, M_LINUX);
} }
static int linux_major_starting = 200; static int linux_major_starting = 200;
@ -210,7 +210,7 @@ linux_device_register_handler(struct linux_device_handler *d)
if (d == NULL) if (d == NULL)
return (EINVAL); return (EINVAL);
MALLOC(de, struct device_element *, sizeof(*de), de = malloc(sizeof(*de),
M_LINUX, M_WAITOK); M_LINUX, M_WAITOK);
if (d->linux_major < 0) { if (d->linux_major < 0) {
d->linux_major = linux_major_starting++; d->linux_major = linux_major_starting++;
@ -234,7 +234,7 @@ linux_device_unregister_handler(struct linux_device_handler *d)
TAILQ_FOREACH(de, &devices, list) { TAILQ_FOREACH(de, &devices, list) {
if (bcmp(d, &de->entry, sizeof(*d)) == 0) { if (bcmp(d, &de->entry, sizeof(*d)) == 0) {
TAILQ_REMOVE(&devices, de, list); TAILQ_REMOVE(&devices, de, list);
FREE(de, M_LINUX); free(de, M_LINUX);
return (0); return (0);
} }
} }

View File

@ -273,7 +273,7 @@ cbq_add_altq(struct pf_altq *a)
return (ENODEV); return (ENODEV);
/* allocate and initialize cbq_state_t */ /* allocate and initialize cbq_state_t */
MALLOC(cbqp, cbq_state_t *, sizeof(cbq_state_t), M_DEVBUF, M_WAITOK); cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK);
if (cbqp == NULL) if (cbqp == NULL)
return (ENOMEM); return (ENOMEM);
bzero(cbqp, sizeof(cbq_state_t)); bzero(cbqp, sizeof(cbq_state_t));
@ -304,7 +304,7 @@ cbq_remove_altq(struct pf_altq *a)
cbq_class_destroy(cbqp, cbqp->ifnp.root_); cbq_class_destroy(cbqp, cbqp->ifnp.root_);
/* deallocate cbq_state_t */ /* deallocate cbq_state_t */
FREE(cbqp, M_DEVBUF); free(cbqp, M_DEVBUF);
return (0); return (0);
} }
@ -927,7 +927,7 @@ cbq_ifattach(ifacep)
return (ENXIO); return (ENXIO);
/* allocate and initialize cbq_state_t */ /* allocate and initialize cbq_state_t */
MALLOC(new_cbqp, cbq_state_t *, sizeof(cbq_state_t), M_DEVBUF, M_WAITOK); new_cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK);
if (new_cbqp == NULL) if (new_cbqp == NULL)
return (ENOMEM); return (ENOMEM);
bzero(new_cbqp, sizeof(cbq_state_t)); bzero(new_cbqp, sizeof(cbq_state_t));
@ -943,7 +943,7 @@ cbq_ifattach(ifacep)
cbq_enqueue, cbq_dequeue, cbq_request, cbq_enqueue, cbq_dequeue, cbq_request,
&new_cbqp->cbq_classifier, acc_classify); &new_cbqp->cbq_classifier, acc_classify);
if (error) { if (error) {
FREE(new_cbqp, M_DEVBUF); free(new_cbqp, M_DEVBUF);
return (error); return (error);
} }
@ -987,7 +987,7 @@ cbq_ifdetach(ifacep)
} }
/* deallocate cbq_state_t */ /* deallocate cbq_state_t */
FREE(cbqp, M_DEVBUF); free(cbqp, M_DEVBUF);
return (0); return (0);
} }

View File

@ -274,7 +274,7 @@ cdnr_cballoc(top, type, input_func)
return (NULL); return (NULL);
} }
MALLOC(cb, struct cdnr_block *, size, M_DEVBUF, M_WAITOK); cb = malloc(size, M_DEVBUF, M_WAITOK);
if (cb == NULL) if (cb == NULL)
return (NULL); return (NULL);
bzero(cb, size); bzero(cb, size);
@ -319,7 +319,7 @@ cdnr_cbdestroy(cblock)
if (cb->cb_top != cblock) if (cb->cb_top != cblock)
LIST_REMOVE(cb, cb_next); LIST_REMOVE(cb, cb_next);
FREE(cb, M_DEVBUF); free(cb, M_DEVBUF);
} }
/* /*

View File

@ -202,7 +202,7 @@ hfsc_add_altq(struct pf_altq *a)
if (!ALTQ_IS_READY(&ifp->if_snd)) if (!ALTQ_IS_READY(&ifp->if_snd))
return (ENODEV); return (ENODEV);
MALLOC(hif, struct hfsc_if *, sizeof(struct hfsc_if), hif = malloc(sizeof(struct hfsc_if),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (hif == NULL) if (hif == NULL)
return (ENOMEM); return (ENOMEM);
@ -210,7 +210,7 @@ hfsc_add_altq(struct pf_altq *a)
hif->hif_eligible = ellist_alloc(); hif->hif_eligible = ellist_alloc();
if (hif->hif_eligible == NULL) { if (hif->hif_eligible == NULL) {
FREE(hif, M_DEVBUF); free(hif, M_DEVBUF);
return (ENOMEM); return (ENOMEM);
} }
@ -236,7 +236,7 @@ hfsc_remove_altq(struct pf_altq *a)
ellist_destroy(hif->hif_eligible); ellist_destroy(hif->hif_eligible);
FREE(hif, M_DEVBUF); free(hif, M_DEVBUF);
return (0); return (0);
} }
@ -404,13 +404,13 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
} }
#endif #endif
MALLOC(cl, struct hfsc_class *, sizeof(struct hfsc_class), cl = malloc(sizeof(struct hfsc_class),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (cl == NULL) if (cl == NULL)
return (NULL); return (NULL);
bzero(cl, sizeof(struct hfsc_class)); bzero(cl, sizeof(struct hfsc_class));
MALLOC(cl->cl_q, class_queue_t *, sizeof(class_queue_t), cl->cl_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (cl->cl_q == NULL) if (cl->cl_q == NULL)
goto err_ret; goto err_ret;
@ -471,8 +471,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
#endif /* ALTQ_RED */ #endif /* ALTQ_RED */
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0)) { if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0)) {
MALLOC(cl->cl_rsc, struct internal_sc *, cl->cl_rsc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
if (cl->cl_rsc == NULL) if (cl->cl_rsc == NULL)
goto err_ret; goto err_ret;
sc2isc(rsc, cl->cl_rsc); sc2isc(rsc, cl->cl_rsc);
@ -480,16 +479,14 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
rtsc_init(&cl->cl_eligible, cl->cl_rsc, 0, 0); rtsc_init(&cl->cl_eligible, cl->cl_rsc, 0, 0);
} }
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0)) { if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0)) {
MALLOC(cl->cl_fsc, struct internal_sc *, cl->cl_fsc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
if (cl->cl_fsc == NULL) if (cl->cl_fsc == NULL)
goto err_ret; goto err_ret;
sc2isc(fsc, cl->cl_fsc); sc2isc(fsc, cl->cl_fsc);
rtsc_init(&cl->cl_virtual, cl->cl_fsc, 0, 0); rtsc_init(&cl->cl_virtual, cl->cl_fsc, 0, 0);
} }
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0)) { if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0)) {
MALLOC(cl->cl_usc, struct internal_sc *, cl->cl_usc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
if (cl->cl_usc == NULL) if (cl->cl_usc == NULL)
goto err_ret; goto err_ret;
sc2isc(usc, cl->cl_usc); sc2isc(usc, cl->cl_usc);
@ -565,14 +562,14 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
#endif #endif
} }
if (cl->cl_fsc != NULL) if (cl->cl_fsc != NULL)
FREE(cl->cl_fsc, M_DEVBUF); free(cl->cl_fsc, M_DEVBUF);
if (cl->cl_rsc != NULL) if (cl->cl_rsc != NULL)
FREE(cl->cl_rsc, M_DEVBUF); free(cl->cl_rsc, M_DEVBUF);
if (cl->cl_usc != NULL) if (cl->cl_usc != NULL)
FREE(cl->cl_usc, M_DEVBUF); free(cl->cl_usc, M_DEVBUF);
if (cl->cl_q != NULL) if (cl->cl_q != NULL)
FREE(cl->cl_q, M_DEVBUF); free(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF); free(cl, M_DEVBUF);
return (NULL); return (NULL);
} }
@ -649,13 +646,13 @@ hfsc_class_destroy(struct hfsc_class *cl)
IFQ_UNLOCK(cl->cl_hif->hif_ifq); IFQ_UNLOCK(cl->cl_hif->hif_ifq);
if (cl->cl_usc != NULL) if (cl->cl_usc != NULL)
FREE(cl->cl_usc, M_DEVBUF); free(cl->cl_usc, M_DEVBUF);
if (cl->cl_fsc != NULL) if (cl->cl_fsc != NULL)
FREE(cl->cl_fsc, M_DEVBUF); free(cl->cl_fsc, M_DEVBUF);
if (cl->cl_rsc != NULL) if (cl->cl_rsc != NULL)
FREE(cl->cl_rsc, M_DEVBUF); free(cl->cl_rsc, M_DEVBUF);
FREE(cl->cl_q, M_DEVBUF); free(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF); free(cl, M_DEVBUF);
return (0); return (0);
} }
@ -1203,7 +1200,7 @@ ellist_alloc(void)
{ {
ellist_t *head; ellist_t *head;
MALLOC(head, ellist_t *, sizeof(ellist_t), M_DEVBUF, M_WAITOK); head = malloc(sizeof(ellist_t), M_DEVBUF, M_WAITOK);
TAILQ_INIT(head); TAILQ_INIT(head);
return (head); return (head);
} }
@ -1211,7 +1208,7 @@ ellist_alloc(void)
static void static void
ellist_destroy(ellist_t *head) ellist_destroy(ellist_t *head)
{ {
FREE(head, M_DEVBUF); free(head, M_DEVBUF);
} }
static void static void
@ -1306,7 +1303,7 @@ actlist_alloc(void)
{ {
actlist_t *head; actlist_t *head;
MALLOC(head, actlist_t *, sizeof(actlist_t), M_DEVBUF, M_WAITOK); head = malloc(sizeof(actlist_t), M_DEVBUF, M_WAITOK);
TAILQ_INIT(head); TAILQ_INIT(head);
return (head); return (head);
} }
@ -1314,7 +1311,7 @@ actlist_alloc(void)
static void static void
actlist_destroy(actlist_t *head) actlist_destroy(actlist_t *head)
{ {
FREE(head, M_DEVBUF); free(head, M_DEVBUF);
} }
static void static void
actlist_insert(struct hfsc_class *cl) actlist_insert(struct hfsc_class *cl)
@ -1743,7 +1740,7 @@ hfsc_attach(ifq, bandwidth)
{ {
struct hfsc_if *hif; struct hfsc_if *hif;
MALLOC(hif, struct hfsc_if *, sizeof(struct hfsc_if), hif = malloc(sizeof(struct hfsc_if),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (hif == NULL) if (hif == NULL)
return (NULL); return (NULL);
@ -1751,7 +1748,7 @@ hfsc_attach(ifq, bandwidth)
hif->hif_eligible = ellist_alloc(); hif->hif_eligible = ellist_alloc();
if (hif->hif_eligible == NULL) { if (hif->hif_eligible == NULL) {
FREE(hif, M_DEVBUF); free(hif, M_DEVBUF);
return NULL; return NULL;
} }
@ -1787,7 +1784,7 @@ hfsc_detach(hif)
ellist_destroy(hif->hif_eligible); ellist_destroy(hif->hif_eligible);
FREE(hif, M_DEVBUF); free(hif, M_DEVBUF);
return (0); return (0);
} }
@ -1804,22 +1801,19 @@ hfsc_class_modify(cl, rsc, fsc, usc)
rsc_tmp = fsc_tmp = usc_tmp = NULL; rsc_tmp = fsc_tmp = usc_tmp = NULL;
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0) && if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0) &&
cl->cl_rsc == NULL) { cl->cl_rsc == NULL) {
MALLOC(rsc_tmp, struct internal_sc *, rsc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
if (rsc_tmp == NULL) if (rsc_tmp == NULL)
return (ENOMEM); return (ENOMEM);
} }
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0) && if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0) &&
cl->cl_fsc == NULL) { cl->cl_fsc == NULL) {
MALLOC(fsc_tmp, struct internal_sc *, fsc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
if (fsc_tmp == NULL) if (fsc_tmp == NULL)
return (ENOMEM); return (ENOMEM);
} }
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) && if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) &&
cl->cl_usc == NULL) { cl->cl_usc == NULL) {
MALLOC(usc_tmp, struct internal_sc *, usc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
if (usc_tmp == NULL) if (usc_tmp == NULL)
return (ENOMEM); return (ENOMEM);
} }
@ -1837,7 +1831,7 @@ hfsc_class_modify(cl, rsc, fsc, usc)
if (cl->cl_rsc != NULL) { if (cl->cl_rsc != NULL) {
if (!qempty(cl->cl_q)) if (!qempty(cl->cl_q))
hfsc_purgeq(cl); hfsc_purgeq(cl);
FREE(cl->cl_rsc, M_DEVBUF); free(cl->cl_rsc, M_DEVBUF);
cl->cl_rsc = NULL; cl->cl_rsc = NULL;
} }
} else { } else {
@ -1859,7 +1853,7 @@ hfsc_class_modify(cl, rsc, fsc, usc)
if (cl->cl_fsc != NULL) { if (cl->cl_fsc != NULL) {
if (!qempty(cl->cl_q)) if (!qempty(cl->cl_q))
hfsc_purgeq(cl); hfsc_purgeq(cl);
FREE(cl->cl_fsc, M_DEVBUF); free(cl->cl_fsc, M_DEVBUF);
cl->cl_fsc = NULL; cl->cl_fsc = NULL;
} }
} else { } else {
@ -1874,7 +1868,7 @@ hfsc_class_modify(cl, rsc, fsc, usc)
if (usc != NULL) { if (usc != NULL) {
if (usc->m1 == 0 && usc->m2 == 0) { if (usc->m1 == 0 && usc->m2 == 0) {
if (cl->cl_usc != NULL) { if (cl->cl_usc != NULL) {
FREE(cl->cl_usc, M_DEVBUF); free(cl->cl_usc, M_DEVBUF);
cl->cl_usc = NULL; cl->cl_usc = NULL;
cl->cl_myf = 0; cl->cl_myf = 0;
} }

View File

@ -134,7 +134,7 @@ priq_add_altq(struct pf_altq *a)
if (!ALTQ_IS_READY(&ifp->if_snd)) if (!ALTQ_IS_READY(&ifp->if_snd))
return (ENODEV); return (ENODEV);
MALLOC(pif, struct priq_if *, sizeof(struct priq_if), pif = malloc(sizeof(struct priq_if),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (pif == NULL) if (pif == NULL)
return (ENOMEM); return (ENOMEM);
@ -160,7 +160,7 @@ priq_remove_altq(struct pf_altq *a)
(void)priq_clear_interface(pif); (void)priq_clear_interface(pif);
FREE(pif, M_DEVBUF); free(pif, M_DEVBUF);
return (0); return (0);
} }
@ -320,13 +320,13 @@ priq_class_create(struct priq_if *pif, int pri, int qlimit, int flags, int qid)
red_destroy(cl->cl_red); red_destroy(cl->cl_red);
#endif #endif
} else { } else {
MALLOC(cl, struct priq_class *, sizeof(struct priq_class), cl = malloc(sizeof(struct priq_class),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (cl == NULL) if (cl == NULL)
return (NULL); return (NULL);
bzero(cl, sizeof(struct priq_class)); bzero(cl, sizeof(struct priq_class));
MALLOC(cl->cl_q, class_queue_t *, sizeof(class_queue_t), cl->cl_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (cl->cl_q == NULL) if (cl->cl_q == NULL)
goto err_ret; goto err_ret;
@ -397,8 +397,8 @@ priq_class_create(struct priq_if *pif, int pri, int qlimit, int flags, int qid)
#endif #endif
} }
if (cl->cl_q != NULL) if (cl->cl_q != NULL)
FREE(cl->cl_q, M_DEVBUF); free(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF); free(cl, M_DEVBUF);
return (NULL); return (NULL);
} }
@ -447,8 +447,8 @@ priq_class_destroy(struct priq_class *cl)
red_destroy(cl->cl_red); red_destroy(cl->cl_red);
#endif #endif
} }
FREE(cl->cl_q, M_DEVBUF); free(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF); free(cl, M_DEVBUF);
return (0); return (0);
} }
@ -666,7 +666,7 @@ priq_attach(ifq, bandwidth)
{ {
struct priq_if *pif; struct priq_if *pif;
MALLOC(pif, struct priq_if *, sizeof(struct priq_if), pif = malloc(sizeof(struct priq_if),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (pif == NULL) if (pif == NULL)
return (NULL); return (NULL);
@ -702,7 +702,7 @@ priq_detach(pif)
ASSERT(p != NULL); ASSERT(p != NULL);
} }
FREE(pif, M_DEVBUF); free(pif, M_DEVBUF);
return (0); return (0);
} }

View File

@ -233,7 +233,7 @@ red_alloc(int weight, int inv_pmax, int th_min, int th_max, int flags,
int w, i; int w, i;
int npkts_per_sec; int npkts_per_sec;
MALLOC(rp, red_t *, sizeof(red_t), M_DEVBUF, M_WAITOK); rp = malloc(sizeof(red_t), M_DEVBUF, M_WAITOK);
if (rp == NULL) if (rp == NULL)
return (NULL); return (NULL);
bzero(rp, sizeof(red_t)); bzero(rp, sizeof(red_t));
@ -321,7 +321,7 @@ red_destroy(red_t *rp)
#endif #endif
#endif /* ALTQ3_COMPAT */ #endif /* ALTQ3_COMPAT */
wtab_destroy(rp->red_wtab); wtab_destroy(rp->red_wtab);
FREE(rp, M_DEVBUF); free(rp, M_DEVBUF);
} }
void void
@ -646,7 +646,7 @@ wtab_alloc(int weight)
return (w); return (w);
} }
MALLOC(w, struct wtab *, sizeof(struct wtab), M_DEVBUF, M_WAITOK); w = malloc(sizeof(struct wtab), M_DEVBUF, M_WAITOK);
if (w == NULL) if (w == NULL)
panic("wtab_alloc: malloc failed!"); panic("wtab_alloc: malloc failed!");
bzero(w, sizeof(struct wtab)); bzero(w, sizeof(struct wtab));
@ -682,7 +682,7 @@ wtab_destroy(struct wtab *w)
break; break;
} }
FREE(w, M_DEVBUF); free(w, M_DEVBUF);
return (0); return (0);
} }
@ -816,17 +816,17 @@ redioctl(dev, cmd, addr, flag, p)
} }
/* allocate and initialize red_queue_t */ /* allocate and initialize red_queue_t */
MALLOC(rqp, red_queue_t *, sizeof(red_queue_t), M_DEVBUF, M_WAITOK); rqp = malloc(sizeof(red_queue_t), M_DEVBUF, M_WAITOK);
if (rqp == NULL) { if (rqp == NULL) {
error = ENOMEM; error = ENOMEM;
break; break;
} }
bzero(rqp, sizeof(red_queue_t)); bzero(rqp, sizeof(red_queue_t));
MALLOC(rqp->rq_q, class_queue_t *, sizeof(class_queue_t), rqp->rq_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (rqp->rq_q == NULL) { if (rqp->rq_q == NULL) {
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
error = ENOMEM; error = ENOMEM;
break; break;
} }
@ -834,8 +834,8 @@ redioctl(dev, cmd, addr, flag, p)
rqp->rq_red = red_alloc(0, 0, 0, 0, 0, 0); rqp->rq_red = red_alloc(0, 0, 0, 0, 0, 0);
if (rqp->rq_red == NULL) { if (rqp->rq_red == NULL) {
FREE(rqp->rq_q, M_DEVBUF); free(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
error = ENOMEM; error = ENOMEM;
break; break;
} }
@ -854,8 +854,8 @@ redioctl(dev, cmd, addr, flag, p)
NULL, NULL); NULL, NULL);
if (error) { if (error) {
red_destroy(rqp->rq_red); red_destroy(rqp->rq_red);
FREE(rqp->rq_q, M_DEVBUF); free(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
break; break;
} }
@ -1016,8 +1016,8 @@ red_detach(rqp)
} }
red_destroy(rqp->rq_red); red_destroy(rqp->rq_red);
FREE(rqp->rq_q, M_DEVBUF); free(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
return (error); return (error);
} }
@ -1297,16 +1297,16 @@ fv_alloc(rp)
int i, num; int i, num;
num = FV_FLOWLISTSIZE; num = FV_FLOWLISTSIZE;
MALLOC(fv, struct flowvalve *, sizeof(struct flowvalve), fv = malloc(sizeof(struct flowvalve),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (fv == NULL) if (fv == NULL)
return (NULL); return (NULL);
bzero(fv, sizeof(struct flowvalve)); bzero(fv, sizeof(struct flowvalve));
MALLOC(fv->fv_fves, struct fve *, sizeof(struct fve) * num, fv->fv_fves = malloc(sizeof(struct fve) * num,
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (fv->fv_fves == NULL) { if (fv->fv_fves == NULL) {
FREE(fv, M_DEVBUF); free(fv, M_DEVBUF);
return (NULL); return (NULL);
} }
bzero(fv->fv_fves, sizeof(struct fve) * num); bzero(fv->fv_fves, sizeof(struct fve) * num);
@ -1323,11 +1323,11 @@ fv_alloc(rp)
fv->fv_pthresh = (FV_PSCALE(1) << FP_SHIFT) / rp->red_inv_pmax; fv->fv_pthresh = (FV_PSCALE(1) << FP_SHIFT) / rp->red_inv_pmax;
/* initialize drop rate to fraction table */ /* initialize drop rate to fraction table */
MALLOC(fv->fv_p2ftab, int *, sizeof(int) * BRTT_SIZE, fv->fv_p2ftab = malloc(sizeof(int) * BRTT_SIZE,
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (fv->fv_p2ftab == NULL) { if (fv->fv_p2ftab == NULL) {
FREE(fv->fv_fves, M_DEVBUF); free(fv->fv_fves, M_DEVBUF);
FREE(fv, M_DEVBUF); free(fv, M_DEVBUF);
return (NULL); return (NULL);
} }
/* /*
@ -1348,9 +1348,9 @@ fv_alloc(rp)
static void fv_destroy(fv) static void fv_destroy(fv)
struct flowvalve *fv; struct flowvalve *fv;
{ {
FREE(fv->fv_p2ftab, M_DEVBUF); free(fv->fv_p2ftab, M_DEVBUF);
FREE(fv->fv_fves, M_DEVBUF); free(fv->fv_fves, M_DEVBUF);
FREE(fv, M_DEVBUF); free(fv, M_DEVBUF);
} }
static __inline int static __inline int

View File

@ -206,7 +206,7 @@ rio_alloc(int weight, struct redparams *params, int flags, int pkttime)
int w, i; int w, i;
int npkts_per_sec; int npkts_per_sec;
MALLOC(rp, rio_t *, sizeof(rio_t), M_DEVBUF, M_WAITOK); rp = malloc(sizeof(rio_t), M_DEVBUF, M_WAITOK);
if (rp == NULL) if (rp == NULL)
return (NULL); return (NULL);
bzero(rp, sizeof(rio_t)); bzero(rp, sizeof(rio_t));
@ -293,7 +293,7 @@ void
rio_destroy(rio_t *rp) rio_destroy(rio_t *rp)
{ {
wtab_destroy(rp->rio_wtab); wtab_destroy(rp->rio_wtab);
FREE(rp, M_DEVBUF); free(rp, M_DEVBUF);
} }
void void
@ -572,17 +572,17 @@ rioioctl(dev, cmd, addr, flag, p)
} }
/* allocate and initialize rio_queue_t */ /* allocate and initialize rio_queue_t */
MALLOC(rqp, rio_queue_t *, sizeof(rio_queue_t), M_DEVBUF, M_WAITOK); rqp = malloc(sizeof(rio_queue_t), M_DEVBUF, M_WAITOK);
if (rqp == NULL) { if (rqp == NULL) {
error = ENOMEM; error = ENOMEM;
break; break;
} }
bzero(rqp, sizeof(rio_queue_t)); bzero(rqp, sizeof(rio_queue_t));
MALLOC(rqp->rq_q, class_queue_t *, sizeof(class_queue_t), rqp->rq_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (rqp->rq_q == NULL) { if (rqp->rq_q == NULL) {
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
error = ENOMEM; error = ENOMEM;
break; break;
} }
@ -590,8 +590,8 @@ rioioctl(dev, cmd, addr, flag, p)
rqp->rq_rio = rio_alloc(0, NULL, 0, 0); rqp->rq_rio = rio_alloc(0, NULL, 0, 0);
if (rqp->rq_rio == NULL) { if (rqp->rq_rio == NULL) {
FREE(rqp->rq_q, M_DEVBUF); free(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
error = ENOMEM; error = ENOMEM;
break; break;
} }
@ -610,8 +610,8 @@ rioioctl(dev, cmd, addr, flag, p)
NULL, NULL); NULL, NULL);
if (error) { if (error) {
rio_destroy(rqp->rq_rio); rio_destroy(rqp->rq_rio);
FREE(rqp->rq_q, M_DEVBUF); free(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
break; break;
} }
@ -759,8 +759,8 @@ rio_detach(rqp)
} }
rio_destroy(rqp->rq_rio); rio_destroy(rqp->rq_rio);
FREE(rqp->rq_q, M_DEVBUF); free(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF); free(rqp, M_DEVBUF);
return (error); return (error);
} }

View File

@ -220,16 +220,16 @@ rmc_newclass(int pri, struct rm_ifdat *ifd, u_int nsecPerByte,
} }
#endif #endif
MALLOC(cl, struct rm_class *, sizeof(struct rm_class), cl = malloc(sizeof(struct rm_class),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (cl == NULL) if (cl == NULL)
return (NULL); return (NULL);
bzero(cl, sizeof(struct rm_class)); bzero(cl, sizeof(struct rm_class));
CALLOUT_INIT(&cl->callout_); CALLOUT_INIT(&cl->callout_);
MALLOC(cl->q_, class_queue_t *, sizeof(class_queue_t), cl->q_ = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (cl->q_ == NULL) { if (cl->q_ == NULL) {
FREE(cl, M_DEVBUF); free(cl, M_DEVBUF);
return (NULL); return (NULL);
} }
bzero(cl->q_, sizeof(class_queue_t)); bzero(cl->q_, sizeof(class_queue_t));
@ -658,8 +658,8 @@ rmc_delete_class(struct rm_ifdat *ifd, struct rm_class *cl)
red_destroy(cl->red_); red_destroy(cl->red_);
#endif #endif
} }
FREE(cl->q_, M_DEVBUF); free(cl->q_, M_DEVBUF);
FREE(cl, M_DEVBUF); free(cl, M_DEVBUF);
} }

View File

@ -397,13 +397,13 @@ tbr_set(ifq, profile)
return (ENOENT); return (ENOENT);
} }
ifq->altq_tbr = NULL; ifq->altq_tbr = NULL;
FREE(tbr, M_DEVBUF); free(tbr, M_DEVBUF);
IFQ_UNLOCK(ifq); IFQ_UNLOCK(ifq);
return (0); return (0);
} }
IFQ_UNLOCK(ifq); IFQ_UNLOCK(ifq);
MALLOC(tbr, struct tb_regulator *, sizeof(struct tb_regulator), tbr = malloc(sizeof(struct tb_regulator),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (tbr == NULL) { /* can not happen */ if (tbr == NULL) { /* can not happen */
IFQ_UNLOCK(ifq); IFQ_UNLOCK(ifq);
@ -426,7 +426,7 @@ tbr_set(ifq, profile)
ifq->altq_tbr = tbr; /* set the new tbr */ ifq->altq_tbr = tbr; /* set the new tbr */
if (otbr != NULL) if (otbr != NULL)
FREE(otbr, M_DEVBUF); free(otbr, M_DEVBUF);
else { else {
if (tbr_timer == 0) { if (tbr_timer == 0) {
CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0); CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0);
@ -1402,7 +1402,7 @@ acc_add_filter(classifier, filter, class, phandle)
return (EINVAL); return (EINVAL);
#endif #endif
MALLOC(afp, struct acc_filter *, sizeof(struct acc_filter), afp = malloc(sizeof(struct acc_filter),
M_DEVBUF, M_WAITOK); M_DEVBUF, M_WAITOK);
if (afp == NULL) if (afp == NULL)
return (ENOMEM); return (ENOMEM);
@ -1529,7 +1529,7 @@ acc_delete_filter(classifier, handle)
LIST_REMOVE(afp, f_chain); LIST_REMOVE(afp, f_chain);
splx(s); splx(s);
FREE(afp, M_DEVBUF); free(afp, M_DEVBUF);
/* todo: update filt_bmask */ /* todo: update filt_bmask */
@ -1559,7 +1559,7 @@ acc_discard_filters(classifier, class, all)
LIST_FOREACH(afp, &classifier->acc_filters[i], f_chain) LIST_FOREACH(afp, &classifier->acc_filters[i], f_chain)
if (all || afp->f_class == class) { if (all || afp->f_class == class) {
LIST_REMOVE(afp, f_chain); LIST_REMOVE(afp, f_chain);
FREE(afp, M_DEVBUF); free(afp, M_DEVBUF);
/* start again from the head */ /* start again from the head */
break; break;
} }
@ -1981,7 +1981,7 @@ ip4f_init(void)
TAILQ_INIT(&ip4f_list); TAILQ_INIT(&ip4f_list);
for (i=0; i<IP4F_TABSIZE; i++) { for (i=0; i<IP4F_TABSIZE; i++) {
MALLOC(fp, struct ip4_frag *, sizeof(struct ip4_frag), fp = malloc(sizeof(struct ip4_frag),
M_DEVBUF, M_NOWAIT); M_DEVBUF, M_NOWAIT);
if (fp == NULL) { if (fp == NULL) {
printf("ip4f_init: can't alloc %dth entry!\n", i); printf("ip4f_init: can't alloc %dth entry!\n", i);

View File

@ -1662,12 +1662,23 @@ MALLOC_DECLARE(M_IPFILTER);
# endif /* M_IPFILTER */ # endif /* M_IPFILTER */
# endif /* M_PFIL */ # endif /* M_PFIL */
# endif /* IPFILTER_M_IPFILTER */ # endif /* IPFILTER_M_IPFILTER */
# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT) # if defined(__FreeBSD__) && __FreeBSD_version >= 800051
# if !defined(KMALLOCS) # define KMALLOC(a, b) do { \
# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT) a = (b)malloc(sizeof(*(a)), _M_IPF, M_NOWAIT); \
} while (0)
# define KMALLOCS(a, b, c) do { \
a = (b)malloc((c), _M_IPF, ((c) > 4096) ? M_WAITOK : M_NOWAIT); \
} while (0)
# define KFREE(x) free((x), _M_IPF)
# define KFREES(x,s) free((x), _M_IPF)
# else
# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)
# if !defined(KMALLOCS)
# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT)
# endif
# define KFREE(x) FREE((x), _M_IPF)
# define KFREES(x,s) FREE((x), _M_IPF)
# endif # endif
# define KFREE(x) FREE((x), _M_IPF)
# define KFREES(x,s) FREE((x), _M_IPF)
# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,d) # define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,d)
# define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0) # define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
# define WAKEUP(id,x) wakeup(id+x) # define WAKEUP(id,x) wakeup(id+x)

View File

@ -365,7 +365,7 @@ ar_detach(device_t device)
* deallocate any system resources we may have * deallocate any system resources we may have
* allocated on behalf of this driver. * allocated on behalf of this driver.
*/ */
FREE(hc->sc, M_DEVBUF); free(hc->sc, M_DEVBUF);
hc->sc = NULL; hc->sc = NULL;
hc->mem_start = NULL; hc->mem_start = NULL;
return (ar_deallocate_resources(device)); return (ar_deallocate_resources(device));
@ -1071,7 +1071,7 @@ arc_init(struct ar_hardc *hc)
u_char isr, mar; u_char isr, mar;
u_long memst; u_long memst;
MALLOC(sc, struct ar_softc *, hc->numports * sizeof(struct ar_softc), sc = malloc(hc->numports * sizeof(struct ar_softc),
M_DEVBUF, M_WAITOK | M_ZERO); M_DEVBUF, M_WAITOK | M_ZERO);
if (sc == NULL) if (sc == NULL)
return; return;

View File

@ -2366,8 +2366,7 @@ static int ng_ce_rcvmsg (node_p node, struct ng_mesg *msg,
break; break;
} }
#else #else
MALLOC (resp, struct ng_mesg *, dl, resp = malloc (M_NETGRAPH, M_NOWAIT);
M_NETGRAPH, M_NOWAIT);
if (! resp) { if (! resp) {
error = ENOMEM; error = ENOMEM;
break; break;
@ -2400,7 +2399,7 @@ static int ng_ce_rcvmsg (node_p node, struct ng_mesg *msg,
NG_FREE_MSG (msg); NG_FREE_MSG (msg);
#else #else
*rptr = resp; *rptr = resp;
FREE (msg, M_NETGRAPH); free (msg, M_NETGRAPH);
#endif #endif
return error; return error;
} }

View File

@ -838,7 +838,7 @@ amd_init(int cpu)
PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu); PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu);
MALLOC(pcs, struct amd_cpu *, sizeof(struct amd_cpu), M_PMC, pcs = malloc(sizeof(struct amd_cpu), M_PMC,
M_WAITOK|M_ZERO); M_WAITOK|M_ZERO);
phw = &pcs->pc_amdpmcs[0]; phw = &pcs->pc_amdpmcs[0];
@ -911,7 +911,7 @@ amd_cleanup(int cpu)
#endif #endif
pmc_pcpu[cpu] = NULL; pmc_pcpu[cpu] = NULL;
FREE(pcs, M_PMC); free(pcs, M_PMC);
return 0; return 0;
} }
@ -960,7 +960,7 @@ pmc_amd_initialize(void)
amd_pmc_class = class; amd_pmc_class = class;
#endif #endif
MALLOC(pmc_mdep, struct pmc_mdep *, sizeof(struct pmc_mdep), pmc_mdep = malloc(sizeof(struct pmc_mdep),
M_PMC, M_WAITOK|M_ZERO); M_PMC, M_WAITOK|M_ZERO);
pmc_mdep->pmd_cputype = cputype; pmc_mdep->pmd_cputype = cputype;

View File

@ -973,7 +973,7 @@ pmclog_initialize()
/* create global pool of log buffers */ /* create global pool of log buffers */
for (n = 0; n < pmc_nlogbuffers; n++) { for (n = 0; n < pmc_nlogbuffers; n++) {
MALLOC(plb, struct pmclog_buffer *, 1024 * pmclog_buffer_size, plb = malloc(1024 * pmclog_buffer_size,
M_PMC, M_ZERO|M_WAITOK); M_PMC, M_ZERO|M_WAITOK);
PMCLOG_INIT_BUFFER_DESCRIPTOR(plb); PMCLOG_INIT_BUFFER_DESCRIPTOR(plb);
TAILQ_INSERT_HEAD(&pmc_bufferlist, plb, plb_next); TAILQ_INSERT_HEAD(&pmc_bufferlist, plb, plb_next);
@ -999,6 +999,6 @@ pmclog_shutdown()
while ((plb = TAILQ_FIRST(&pmc_bufferlist)) != NULL) { while ((plb = TAILQ_FIRST(&pmc_bufferlist)) != NULL) {
TAILQ_REMOVE(&pmc_bufferlist, plb, plb_next); TAILQ_REMOVE(&pmc_bufferlist, plb, plb_next);
FREE(plb, M_PMC); free(plb, M_PMC);
} }
} }

View File

@ -331,7 +331,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
int error, found, *newbits, tmp; int error, found, *newbits, tmp;
size_t kwlen; size_t kwlen;
MALLOC(tmpflags, struct pmc_debugflags *, sizeof(*tmpflags), tmpflags = malloc(sizeof(*tmpflags),
M_PMC, M_WAITOK|M_ZERO); M_PMC, M_WAITOK|M_ZERO);
p = newstr; p = newstr;
@ -450,7 +450,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
bcopy(tmpflags, &pmc_debugflags, sizeof(pmc_debugflags)); bcopy(tmpflags, &pmc_debugflags, sizeof(pmc_debugflags));
done: done:
FREE(tmpflags, M_PMC); free(tmpflags, M_PMC);
return error; return error;
} }
@ -464,7 +464,7 @@ pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS)
(void) arg1; (void) arg2; /* unused parameters */ (void) arg1; (void) arg2; /* unused parameters */
n = sizeof(pmc_debugstr); n = sizeof(pmc_debugstr);
MALLOC(newstr, char *, n, M_PMC, M_ZERO|M_WAITOK); newstr = malloc(n, M_PMC, M_ZERO|M_WAITOK);
(void) strlcpy(newstr, pmc_debugstr, n); (void) strlcpy(newstr, pmc_debugstr, n);
error = sysctl_handle_string(oidp, newstr, n, req); error = sysctl_handle_string(oidp, newstr, n, req);
@ -477,7 +477,7 @@ pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS)
sizeof(pmc_debugstr)); sizeof(pmc_debugstr));
} }
FREE(newstr, M_PMC); free(newstr, M_PMC);
return error; return error;
} }
@ -777,7 +777,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp)
__LINE__, pp, pm)); __LINE__, pp, pm));
#endif #endif
MALLOC(pt, struct pmc_target *, sizeof(struct pmc_target), pt = malloc(sizeof(struct pmc_target),
M_PMC, M_ZERO|M_WAITOK); M_PMC, M_ZERO|M_WAITOK);
pt->pt_process = pp; pt->pt_process = pp;
@ -849,7 +849,7 @@ pmc_unlink_target_process(struct pmc *pm, struct pmc_process *pp)
"in pmc %p", __LINE__, pp->pp_proc, pp, pm)); "in pmc %p", __LINE__, pp->pp_proc, pp, pm));
LIST_REMOVE(ptgt, pt_next); LIST_REMOVE(ptgt, pt_next);
FREE(ptgt, M_PMC); free(ptgt, M_PMC);
/* if the PMC now lacks targets, send the owner a SIGIO */ /* if the PMC now lacks targets, send the owner a SIGIO */
if (LIST_EMPTY(&pm->pm_targets)) { if (LIST_EMPTY(&pm->pm_targets)) {
@ -972,7 +972,7 @@ pmc_attach_one_process(struct proc *p, struct pmc *pm)
} else } else
pmclog_process_pmcattach(pm, p->p_pid, fullpath); pmclog_process_pmcattach(pm, p->p_pid, fullpath);
if (freepath) if (freepath)
FREE(freepath, M_TEMP); free(freepath, M_TEMP);
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
pmc_log_process_mappings(pm->pm_owner, p); pmc_log_process_mappings(pm->pm_owner, p);
} }
@ -1093,7 +1093,7 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags)
pmc_remove_process_descriptor(pp); pmc_remove_process_descriptor(pp);
if (flags & PMC_FLAG_REMOVE) if (flags & PMC_FLAG_REMOVE)
FREE(pp, M_PMC); free(pp, M_PMC);
PROC_LOCK(p); PROC_LOCK(p);
p->p_flag &= ~P_HWPMC; p->p_flag &= ~P_HWPMC;
@ -1511,7 +1511,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map_in *pkm)
done: done:
if (freepath) if (freepath)
FREE(freepath, M_TEMP); free(freepath, M_TEMP);
} }
@ -1575,7 +1575,7 @@ pmc_log_kernel_mappings(struct pmc *pm)
pmclog_process_map_in(po, (pid_t) -1, km->pm_address, pmclog_process_map_in(po, (pid_t) -1, km->pm_address,
km->pm_file); km->pm_file);
} }
FREE(kmbase, M_LINKER); free(kmbase, M_LINKER);
po->po_flags |= PMC_PO_INITIAL_MAPPINGS_DONE; po->po_flags |= PMC_PO_INITIAL_MAPPINGS_DONE;
} }
@ -1692,7 +1692,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
if (!is_using_hwpmcs) { if (!is_using_hwpmcs) {
if (freepath) if (freepath)
FREE(freepath, M_TEMP); free(freepath, M_TEMP);
break; break;
} }
@ -1712,7 +1712,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
*/ */
if ((pp = pmc_find_process_descriptor(p, 0)) == NULL) { if ((pp = pmc_find_process_descriptor(p, 0)) == NULL) {
if (freepath) if (freepath)
FREE(freepath, M_TEMP); free(freepath, M_TEMP);
break; break;
} }
@ -1732,7 +1732,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
} }
if (freepath) if (freepath)
FREE(freepath, M_TEMP); free(freepath, M_TEMP);
PMCDBG(PRC,EXC,1, "exec proc=%p (%d, %s) cred-changed=%d", PMCDBG(PRC,EXC,1, "exec proc=%p (%d, %s) cred-changed=%d",
@ -1765,7 +1765,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
if (pp->pp_refcnt == 0) { if (pp->pp_refcnt == 0) {
pmc_remove_process_descriptor(pp); pmc_remove_process_descriptor(pp);
FREE(pp, M_PMC); free(pp, M_PMC);
break; break;
} }
@ -1861,7 +1861,7 @@ pmc_allocate_owner_descriptor(struct proc *p)
poh = &pmc_ownerhash[hindex]; poh = &pmc_ownerhash[hindex];
/* allocate space for N pointers and one descriptor struct */ /* allocate space for N pointers and one descriptor struct */
MALLOC(po, struct pmc_owner *, sizeof(struct pmc_owner), po = malloc(sizeof(struct pmc_owner),
M_PMC, M_ZERO|M_WAITOK); M_PMC, M_ZERO|M_WAITOK);
po->po_sscount = po->po_error = po->po_flags = 0; po->po_sscount = po->po_error = po->po_flags = 0;
@ -1888,7 +1888,7 @@ pmc_destroy_owner_descriptor(struct pmc_owner *po)
po, po->po_owner, po->po_owner->p_pid, po->po_owner->p_comm); po, po->po_owner, po->po_owner->p_pid, po->po_owner->p_comm);
mtx_destroy(&po->po_mtx); mtx_destroy(&po->po_mtx);
FREE(po, M_PMC); free(po, M_PMC);
} }
/* /*
@ -1915,8 +1915,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode)
if (mode & PMC_FLAG_ALLOCATE) { if (mode & PMC_FLAG_ALLOCATE) {
/* allocate additional space for 'n' pmc pointers */ /* allocate additional space for 'n' pmc pointers */
MALLOC(ppnew, struct pmc_process *, ppnew = malloc( sizeof(struct pmc_process) + md->pmd_npmc *
sizeof(struct pmc_process) + md->pmd_npmc *
sizeof(struct pmc_targetstate), M_PMC, M_ZERO|M_WAITOK); sizeof(struct pmc_targetstate), M_PMC, M_ZERO|M_WAITOK);
} }
@ -1938,7 +1937,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode)
mtx_unlock_spin(&pmc_processhash_mtx); mtx_unlock_spin(&pmc_processhash_mtx);
if (pp != NULL && ppnew != NULL) if (pp != NULL && ppnew != NULL)
FREE(ppnew, M_PMC); free(ppnew, M_PMC);
return pp; return pp;
} }
@ -1997,7 +1996,7 @@ pmc_allocate_pmc_descriptor(void)
{ {
struct pmc *pmc; struct pmc *pmc;
MALLOC(pmc, struct pmc *, sizeof(struct pmc), M_PMC, M_ZERO|M_WAITOK); pmc = malloc(sizeof(struct pmc), M_PMC, M_ZERO|M_WAITOK);
if (pmc != NULL) { if (pmc != NULL) {
pmc->pm_owner = NULL; pmc->pm_owner = NULL;
@ -2187,7 +2186,7 @@ pmc_release_pmc_descriptor(struct pmc *pm)
if (pp->pp_refcnt == 0) { if (pp->pp_refcnt == 0) {
pmc_remove_process_descriptor(pp); pmc_remove_process_descriptor(pp);
FREE(pp, M_PMC); free(pp, M_PMC);
} }
} }
@ -2819,7 +2818,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
npmc = md->pmd_npmc; npmc = md->pmd_npmc;
pmcinfo_size = npmc * sizeof(struct pmc_info); pmcinfo_size = npmc * sizeof(struct pmc_info);
MALLOC(pmcinfo, struct pmc_info *, pmcinfo_size, M_PMC, pmcinfo = malloc(pmcinfo_size, M_PMC,
M_WAITOK); M_WAITOK);
p = pmcinfo; p = pmcinfo;
@ -2863,7 +2862,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if (error == 0) if (error == 0)
error = copyout(pmcinfo, &gpi->pm_pmcs, pmcinfo_size); error = copyout(pmcinfo, &gpi->pm_pmcs, pmcinfo_size);
FREE(pmcinfo, M_PMC); free(pmcinfo, M_PMC);
} }
break; break;
@ -3127,7 +3126,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if (n == (int) md->pmd_npmc) { if (n == (int) md->pmd_npmc) {
pmc_destroy_pmc_descriptor(pmc); pmc_destroy_pmc_descriptor(pmc);
FREE(pmc, M_PMC); free(pmc, M_PMC);
pmc = NULL; pmc = NULL;
error = EINVAL; error = EINVAL;
break; break;
@ -3162,7 +3161,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
(error = md->pmd_config_pmc(cpu, n, pmc)) != 0) { (error = md->pmd_config_pmc(cpu, n, pmc)) != 0) {
(void) md->pmd_release_pmc(cpu, n, pmc); (void) md->pmd_release_pmc(cpu, n, pmc);
pmc_destroy_pmc_descriptor(pmc); pmc_destroy_pmc_descriptor(pmc);
FREE(pmc, M_PMC); free(pmc, M_PMC);
pmc = NULL; pmc = NULL;
pmc_restore_cpu_binding(&pb); pmc_restore_cpu_binding(&pb);
error = EPERM; error = EPERM;
@ -3190,7 +3189,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if ((error = if ((error =
pmc_register_owner(curthread->td_proc, pmc)) != 0) { pmc_register_owner(curthread->td_proc, pmc)) != 0) {
pmc_release_pmc_descriptor(pmc); pmc_release_pmc_descriptor(pmc);
FREE(pmc, M_PMC); free(pmc, M_PMC);
pmc = NULL; pmc = NULL;
break; break;
} }
@ -3432,7 +3431,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
pmc_release_pmc_descriptor(pm); pmc_release_pmc_descriptor(pm);
pmc_maybe_remove_owner(po); pmc_maybe_remove_owner(po);
FREE(pm, M_PMC); free(pm, M_PMC);
} }
break; break;
@ -4167,7 +4166,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
pmclog_process_procexit(pm, pp); pmclog_process_procexit(pm, pp);
pmc_unlink_target_process(pm, pp); pmc_unlink_target_process(pm, pp);
} }
FREE(pp, M_PMC); free(pp, M_PMC);
} else } else
critical_exit(); /* pp == NULL */ critical_exit(); /* pp == NULL */
@ -4353,12 +4352,11 @@ pmc_initialize(void)
maxcpu = pmc_cpu_max(); maxcpu = pmc_cpu_max();
/* allocate space for the per-cpu array */ /* allocate space for the per-cpu array */
MALLOC(pmc_pcpu, struct pmc_cpu **, maxcpu * sizeof(struct pmc_cpu *), pmc_pcpu = malloc(maxcpu * sizeof(struct pmc_cpu *),
M_PMC, M_WAITOK|M_ZERO); M_PMC, M_WAITOK|M_ZERO);
/* per-cpu 'saved values' for managing process-mode PMCs */ /* per-cpu 'saved values' for managing process-mode PMCs */
MALLOC(pmc_pcpu_saved, pmc_value_t *, pmc_pcpu_saved = malloc( sizeof(pmc_value_t) * maxcpu * md->pmd_npmc, M_PMC, M_WAITOK);
sizeof(pmc_value_t) * maxcpu * md->pmd_npmc, M_PMC, M_WAITOK);
/* Perform CPU-dependent initialization. */ /* Perform CPU-dependent initialization. */
pmc_save_cpu_binding(&pb); pmc_save_cpu_binding(&pb);
@ -4378,8 +4376,7 @@ pmc_initialize(void)
for (cpu = 0; cpu < maxcpu; cpu++) { for (cpu = 0; cpu < maxcpu; cpu++) {
if (!pmc_cpu_is_active(cpu)) if (!pmc_cpu_is_active(cpu))
continue; continue;
MALLOC(sb, struct pmc_samplebuffer *, sb = malloc( sizeof(struct pmc_samplebuffer) +
sizeof(struct pmc_samplebuffer) +
pmc_nsamples * sizeof(struct pmc_sample), M_PMC, pmc_nsamples * sizeof(struct pmc_sample), M_PMC,
M_WAITOK|M_ZERO); M_WAITOK|M_ZERO);
@ -4388,8 +4385,7 @@ pmc_initialize(void)
KASSERT(pmc_pcpu[cpu] != NULL, KASSERT(pmc_pcpu[cpu] != NULL,
("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu)); ("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu));
MALLOC(sb->ps_callchains, uintptr_t *, sb->ps_callchains = malloc( pmc_callchaindepth * pmc_nsamples * sizeof(uintptr_t),
pmc_callchaindepth * pmc_nsamples * sizeof(uintptr_t),
M_PMC, M_WAITOK|M_ZERO); M_PMC, M_WAITOK|M_ZERO);
for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++) for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++)
@ -4554,8 +4550,8 @@ pmc_cleanup(void)
KASSERT(pmc_pcpu[cpu]->pc_sb != NULL, KASSERT(pmc_pcpu[cpu]->pc_sb != NULL,
("[pmc,%d] Null cpu sample buffer cpu=%d", __LINE__, ("[pmc,%d] Null cpu sample buffer cpu=%d", __LINE__,
cpu)); cpu));
FREE(pmc_pcpu[cpu]->pc_sb->ps_callchains, M_PMC); free(pmc_pcpu[cpu]->pc_sb->ps_callchains, M_PMC);
FREE(pmc_pcpu[cpu]->pc_sb, M_PMC); free(pmc_pcpu[cpu]->pc_sb, M_PMC);
pmc_pcpu[cpu]->pc_sb = NULL; pmc_pcpu[cpu]->pc_sb = NULL;
} }
@ -4572,20 +4568,20 @@ pmc_cleanup(void)
if (md->pmd_cleanup) if (md->pmd_cleanup)
md->pmd_cleanup(cpu); md->pmd_cleanup(cpu);
} }
FREE(md, M_PMC); free(md, M_PMC);
md = NULL; md = NULL;
pmc_restore_cpu_binding(&pb); pmc_restore_cpu_binding(&pb);
} }
/* deallocate per-cpu structures */ /* deallocate per-cpu structures */
FREE(pmc_pcpu, M_PMC); free(pmc_pcpu, M_PMC);
pmc_pcpu = NULL; pmc_pcpu = NULL;
FREE(pmc_pcpu_saved, M_PMC); free(pmc_pcpu_saved, M_PMC);
pmc_pcpu_saved = NULL; pmc_pcpu_saved = NULL;
if (pmc_pmcdisp) { if (pmc_pmcdisp) {
FREE(pmc_pmcdisp, M_PMC); free(pmc_pmcdisp, M_PMC);
pmc_pmcdisp = NULL; pmc_pmcdisp = NULL;
} }

View File

@ -628,8 +628,7 @@ p4_init(int cpu)
if (pcs == NULL) /* decline to init */ if (pcs == NULL) /* decline to init */
return ENXIO; return ENXIO;
MALLOC(plcs, struct p4_logicalcpu *, plcs = malloc( sizeof(struct p4_logicalcpu), M_PMC, M_WAITOK|M_ZERO);
sizeof(struct p4_logicalcpu), M_PMC, M_WAITOK|M_ZERO);
/* The TSC is architectural state and is not shared */ /* The TSC is architectural state and is not shared */
plcs->pc_hwpmcs[0] = &plcs->pc_tsc; plcs->pc_hwpmcs[0] = &plcs->pc_tsc;
@ -645,7 +644,7 @@ p4_init(int cpu)
return 0; return 0;
} }
MALLOC(pcs, struct p4_cpu *, sizeof(struct p4_cpu), M_PMC, pcs = malloc(sizeof(struct p4_cpu), M_PMC,
M_WAITOK|M_ZERO); M_WAITOK|M_ZERO);
if (pcs == NULL) if (pcs == NULL)
@ -699,7 +698,7 @@ p4_cleanup(int cpu)
if (!P4_CPU_IS_HTT_SECONDARY(cpu)) if (!P4_CPU_IS_HTT_SECONDARY(cpu))
mtx_destroy(&pcs->pc_mtx); mtx_destroy(&pcs->pc_mtx);
FREE(pcs, M_PMC); free(pcs, M_PMC);
pmc_pcpu[cpu] = NULL; pmc_pcpu[cpu] = NULL;
@ -1081,7 +1080,7 @@ p4_allocate_pmc(int cpu, int ri, struct pmc *pm,
/* /*
* If the system has HTT enabled, and the desired allocation * If the system has HTT enabled, and the desired allocation
* mode is process-private, and the PMC row disposition is not * mode is process-private, and the PMC row disposition is not
* FREE (0), decline the allocation. * free (0), decline the allocation.
*/ */
if (p4_system_has_htt && if (p4_system_has_htt &&

View File

@ -349,7 +349,7 @@ p6_init(int cpu)
PMCDBG(MDP,INI,0,"p6-init cpu=%d", cpu); PMCDBG(MDP,INI,0,"p6-init cpu=%d", cpu);
MALLOC(pcs, struct p6_cpu *, sizeof(struct p6_cpu), M_PMC, pcs = malloc(sizeof(struct p6_cpu), M_PMC,
M_WAITOK|M_ZERO); M_WAITOK|M_ZERO);
phw = pcs->pc_p6pmcs; phw = pcs->pc_p6pmcs;
@ -380,7 +380,7 @@ p6_cleanup(int cpu)
PMCDBG(MDP,INI,0,"p6-cleanup cpu=%d", cpu); PMCDBG(MDP,INI,0,"p6-cleanup cpu=%d", cpu);
if ((pcs = pmc_pcpu[cpu]) != NULL) if ((pcs = pmc_pcpu[cpu]) != NULL)
FREE(pcs, M_PMC); free(pcs, M_PMC);
pmc_pcpu[cpu] = NULL; pmc_pcpu[cpu] = NULL;
return 0; return 0;

View File

@ -293,7 +293,7 @@ pmc_intel_initialize(void)
return NULL; return NULL;
} }
MALLOC(pmc_mdep, struct pmc_mdep *, sizeof(struct pmc_mdep), pmc_mdep = malloc(sizeof(struct pmc_mdep),
M_PMC, M_WAITOK|M_ZERO); M_PMC, M_WAITOK|M_ZERO);
pmc_mdep->pmd_cputype = cputype; pmc_mdep->pmd_cputype = cputype;
@ -346,7 +346,7 @@ pmc_intel_initialize(void)
} }
if (error) { if (error) {
FREE(pmc_mdep, M_PMC); free(pmc_mdep, M_PMC);
pmc_mdep = NULL; pmc_mdep = NULL;
} }

View File

@ -5070,8 +5070,8 @@ ng_rcvmsg(node_p node, struct ng_mesg *msg,
if (rptr != NULL) if (rptr != NULL)
*rptr = resp; *rptr = resp;
else if (resp != NULL) else if (resp != NULL)
FREE(resp, M_NETGRAPH); free(resp, M_NETGRAPH);
FREE(msg, M_NETGRAPH); free(msg, M_NETGRAPH);
# endif # endif
return error; return error;

View File

@ -3177,8 +3177,7 @@ ray_com_malloc(ray_comqfn_t function, int flags, char *mesg)
{ {
struct ray_comq_entry *com; struct ray_comq_entry *com;
MALLOC(com, struct ray_comq_entry *, com = malloc( sizeof(struct ray_comq_entry), M_RAYCOM, M_WAITOK);
sizeof(struct ray_comq_entry), M_RAYCOM, M_WAITOK);
return (ray_com_init(com, function, flags, mesg)); return (ray_com_init(com, function, flags, mesg));
} }

View File

@ -249,7 +249,7 @@ static int mib_info[RAY_MIB_MAX+1][3] = RAY_MIB_INFO;
#define RAY_COM_FREE(com, ncom) do { \ #define RAY_COM_FREE(com, ncom) do { \
int i; \ int i; \
for (i = 0; i < ncom; i++) \ for (i = 0; i < ncom; i++) \
FREE(com[i], M_RAYCOM); \ free(com[i], M_RAYCOM); \
} while (0) } while (0)
/* /*

View File

@ -305,8 +305,7 @@ sr_attach(device_t device)
int unit; /* index: channel w/in card */ int unit; /* index: channel w/in card */
hc = (struct sr_hardc *)device_get_softc(device); hc = (struct sr_hardc *)device_get_softc(device);
MALLOC(sc, struct sr_softc *, sc = malloc( hc->numports * sizeof(struct sr_softc),
hc->numports * sizeof(struct sr_softc),
M_DEVBUF, M_WAITOK | M_ZERO); M_DEVBUF, M_WAITOK | M_ZERO);
if (sc == NULL) if (sc == NULL)
goto errexit; goto errexit;
@ -478,7 +477,7 @@ sr_detach(device_t device)
* deallocate any system resources we may have * deallocate any system resources we may have
* allocated on behalf of this driver. * allocated on behalf of this driver.
*/ */
FREE(hc->sc, M_DEVBUF); free(hc->sc, M_DEVBUF);
hc->sc = NULL; hc->sc = NULL;
hc->mem_start = NULL; hc->mem_start = NULL;
return (sr_deallocate_resources(device)); return (sr_deallocate_resources(device));

View File

@ -411,10 +411,10 @@ udbp_attach(device_t self)
bad: bad:
#if 0 /* probably done in udbp_detach() */ #if 0 /* probably done in udbp_detach() */
if (sc->sc_bulkout_buffer) { if (sc->sc_bulkout_buffer) {
FREE(sc->sc_bulkout_buffer, M_USBDEV); free(sc->sc_bulkout_buffer, M_USBDEV);
} }
if (sc->sc_bulkin_buffer) { if (sc->sc_bulkin_buffer) {
FREE(sc->sc_bulkin_buffer, M_USBDEV); free(sc->sc_bulkin_buffer, M_USBDEV);
} }
if (sc->sc_bulkout_xfer) { if (sc->sc_bulkout_xfer) {
usbd_free_xfer(sc->sc_bulkout_xfer); usbd_free_xfer(sc->sc_bulkout_xfer);

View File

@ -111,7 +111,7 @@ cd9660_reclaim(ap)
*/ */
if (ip->i_mnt->im_devvp) if (ip->i_mnt->im_devvp)
vrele(ip->i_mnt->im_devvp); vrele(ip->i_mnt->im_devvp);
FREE(vp->v_data, M_ISOFSNODE); free(vp->v_data, M_ISOFSNODE);
vp->v_data = NULL; vp->v_data = NULL;
return (0); return (0);
} }

View File

@ -676,7 +676,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
*vpp = NULLVP; *vpp = NULLVP;
return (error); return (error);
} }
MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, ip = malloc(sizeof(struct iso_node), M_ISOFSNODE,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
vp->v_data = ip; vp->v_data = ip;
ip->i_vnode = vp; ip->i_vnode = vp;

View File

@ -207,7 +207,7 @@ cd9660_getattr(ap)
struct uio auio; struct uio auio;
char *cp; char *cp;
MALLOC(cp, char *, MAXPATHLEN, M_TEMP, M_WAITOK); cp = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
aiov.iov_base = cp; aiov.iov_base = cp;
aiov.iov_len = MAXPATHLEN; aiov.iov_len = MAXPATHLEN;
auio.uio_iov = &aiov; auio.uio_iov = &aiov;
@ -222,7 +222,7 @@ cd9660_getattr(ap)
rdlnk.a_cred = ap->a_cred; rdlnk.a_cred = ap->a_cred;
if (cd9660_readlink(&rdlnk) == 0) if (cd9660_readlink(&rdlnk) == 0)
vap->va_size = MAXPATHLEN - auio.uio_resid; vap->va_size = MAXPATHLEN - auio.uio_resid;
FREE(cp, M_TEMP); free(cp, M_TEMP);
} }
vap->va_flags = 0; vap->va_flags = 0;
vap->va_gen = 1; vap->va_gen = 1;
@ -470,7 +470,7 @@ cd9660_readdir(ap)
imp = dp->i_mnt; imp = dp->i_mnt;
bmask = imp->im_bmask; bmask = imp->im_bmask;
MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK); idp = malloc(sizeof(*idp), M_TEMP, M_WAITOK);
idp->saveent.d_namlen = idp->assocent.d_namlen = 0; idp->saveent.d_namlen = idp->assocent.d_namlen = 0;
/* /*
* XXX * XXX
@ -486,7 +486,7 @@ cd9660_readdir(ap)
* Guess the number of cookies needed. * Guess the number of cookies needed.
*/ */
ncookies = uio->uio_resid / 16; ncookies = uio->uio_resid / 16;
MALLOC(cookies, u_long *, ncookies * sizeof(u_long), cookies = malloc(ncookies * sizeof(u_long),
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
idp->cookies = cookies; idp->cookies = cookies;
idp->ncookies = ncookies; idp->ncookies = ncookies;
@ -497,7 +497,7 @@ cd9660_readdir(ap)
if ((entryoffsetinblock = idp->curroff & bmask) && if ((entryoffsetinblock = idp->curroff & bmask) &&
(error = cd9660_blkatoff(vdp, (off_t)idp->curroff, NULL, &bp))) { (error = cd9660_blkatoff(vdp, (off_t)idp->curroff, NULL, &bp))) {
FREE(idp, M_TEMP); free(idp, M_TEMP);
return (error); return (error);
} }
endsearch = dp->i_size; endsearch = dp->i_size;
@ -620,7 +620,7 @@ cd9660_readdir(ap)
uio->uio_offset = idp->uio_off; uio->uio_offset = idp->uio_off;
*ap->a_eofflag = idp->eofflag; *ap->a_eofflag = idp->eofflag;
FREE(idp, M_TEMP); free(idp, M_TEMP);
return (error); return (error);
} }

View File

@ -85,7 +85,7 @@ fdesc_mount(struct mount *mp, struct thread *td)
if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS))
return (EOPNOTSUPP); return (EOPNOTSUPP);
MALLOC(fmp, struct fdescmount *, sizeof(struct fdescmount), fmp = malloc(sizeof(struct fdescmount),
M_FDESCMNT, M_WAITOK); /* XXX */ M_FDESCMNT, M_WAITOK); /* XXX */
/* /*

View File

@ -186,11 +186,11 @@ fdesc_allocvp(ftype, fd_fd, ix, mp, vpp, td)
} }
mtx_unlock(&fdesc_hashmtx); mtx_unlock(&fdesc_hashmtx);
MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK); fd = malloc(sizeof(struct fdescnode), M_TEMP, M_WAITOK);
error = getnewvnode("fdescfs", mp, &fdesc_vnodeops, &vp); error = getnewvnode("fdescfs", mp, &fdesc_vnodeops, &vp);
if (error) { if (error) {
FREE(fd, M_TEMP); free(fd, M_TEMP);
return (error); return (error);
} }
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@ -616,7 +616,7 @@ fdesc_reclaim(ap)
vp = ap->a_vp; vp = ap->a_vp;
fd = VTOFDESC(vp); fd = VTOFDESC(vp);
fdesc_remove_entry(fd); fdesc_remove_entry(fd);
FREE(vp->v_data, M_TEMP); free(vp->v_data, M_TEMP);
vp->v_data = NULL; vp->v_data = NULL;
return (0); return (0);
} }

View File

@ -154,7 +154,7 @@ fifo_cleanup(struct vnode *vp)
vp->v_fifoinfo = NULL; vp->v_fifoinfo = NULL;
(void)soclose(fip->fi_readsock); (void)soclose(fip->fi_readsock);
(void)soclose(fip->fi_writesock); (void)soclose(fip->fi_writesock);
FREE(fip, M_VNODE); free(fip, M_VNODE);
} }
} }
@ -185,7 +185,7 @@ fifo_open(ap)
if (fp == NULL) if (fp == NULL)
return (EINVAL); return (EINVAL);
if ((fip = vp->v_fifoinfo) == NULL) { if ((fip = vp->v_fifoinfo) == NULL) {
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK); fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK);
error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, cred, td); error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, cred, td);
if (error) if (error)
goto fail1; goto fail1;

View File

@ -85,8 +85,8 @@ hpfs_bmdeinit(
} }
} }
FREE(hpmp->hpm_bitmap,M_HPFSMNT); free(hpmp->hpm_bitmap,M_HPFSMNT);
FREE(hpmp->hpm_bmind,M_HPFSMNT); free(hpmp->hpm_bmind,M_HPFSMNT);
dprintf(("\n")); dprintf(("\n"));
} }
@ -109,18 +109,18 @@ hpfs_bminit(
dprintf(("0x%lx data bands, ", hpmp->hpm_dbnum)); dprintf(("0x%lx data bands, ", hpmp->hpm_dbnum));
MALLOC(hpmp->hpm_bmind, lsn_t *, hpmp->hpm_dbnum * sizeof(lsn_t), hpmp->hpm_bmind = malloc(hpmp->hpm_dbnum * sizeof(lsn_t),
M_HPFSMNT, M_WAITOK); M_HPFSMNT, M_WAITOK);
MALLOC(hpmp->hpm_bitmap, u_int8_t *, hpmp->hpm_dbnum * BMSIZE, hpmp->hpm_bitmap = malloc(hpmp->hpm_dbnum * BMSIZE,
M_HPFSMNT, M_WAITOK); M_HPFSMNT, M_WAITOK);
error = bread(hpmp->hpm_devvp, hpmp->hpm_su.su_bitmap.lsn1, error = bread(hpmp->hpm_devvp, hpmp->hpm_su.su_bitmap.lsn1,
((hpmp->hpm_dbnum + 0x7F) & ~(0x7F)) << 2, NOCRED, &bp); ((hpmp->hpm_dbnum + 0x7F) & ~(0x7F)) << 2, NOCRED, &bp);
if (error) { if (error) {
brelse(bp); brelse(bp);
FREE(hpmp->hpm_bitmap, M_HPFSMNT); free(hpmp->hpm_bitmap, M_HPFSMNT);
FREE(hpmp->hpm_bmind, M_HPFSMNT); free(hpmp->hpm_bmind, M_HPFSMNT);
dprintf((" error %d\n", error)); dprintf((" error %d\n", error));
return (error); return (error);
} }
@ -138,8 +138,8 @@ hpfs_bminit(
BMSIZE, NOCRED, &bp); BMSIZE, NOCRED, &bp);
if (error) { if (error) {
brelse(bp); brelse(bp);
FREE(hpmp->hpm_bitmap, M_HPFSMNT); free(hpmp->hpm_bitmap, M_HPFSMNT);
FREE(hpmp->hpm_bmind, M_HPFSMNT); free(hpmp->hpm_bmind, M_HPFSMNT);
dprintf((" error %d\n", error)); dprintf((" error %d\n", error));
return (error); return (error);
} }
@ -278,8 +278,7 @@ hpfs_cpinit (
cpicnt = hpmp->hpm_sp.sp_cpinum; cpicnt = hpmp->hpm_sp.sp_cpinum;
MALLOC(hpmp->hpm_cpdblk, struct cpdblk *, hpmp->hpm_cpdblk = malloc( cpicnt * sizeof(struct cpdblk), M_HPFSMNT, M_WAITOK);
cpicnt * sizeof(struct cpdblk), M_HPFSMNT, M_WAITOK);
cpdbp = hpmp->hpm_cpdblk; cpdbp = hpmp->hpm_cpdblk;
lsn = hpmp->hpm_sp.sp_cpi; lsn = hpmp->hpm_sp.sp_cpi;
@ -317,7 +316,7 @@ hpfs_cpdeinit (
struct hpfsmount *hpmp) struct hpfsmount *hpmp)
{ {
dprintf(("hpmp_cpdeinit: ")); dprintf(("hpmp_cpdeinit: "));
FREE(hpmp->hpm_cpdblk,M_HPFSMNT); free(hpmp->hpm_cpdblk,M_HPFSMNT);
return (0); return (0);
} }

View File

@ -371,7 +371,7 @@ hpfs_unmount(
MNT_ILOCK(mp); MNT_ILOCK(mp);
mp->mnt_flag &= ~MNT_LOCAL; mp->mnt_flag &= ~MNT_LOCAL;
MNT_IUNLOCK(mp); MNT_IUNLOCK(mp);
FREE(hpmp, M_HPFSMNT); free(hpmp, M_HPFSMNT);
return (0); return (0);
} }
@ -476,13 +476,13 @@ hpfs_vget(
* at that time is little, and anyway - we'll * at that time is little, and anyway - we'll
* check for it). * check for it).
*/ */
MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode), hp = malloc(sizeof(struct hpfsnode),
M_HPFSNO, M_WAITOK); M_HPFSNO, M_WAITOK);
error = getnewvnode("hpfs", mp, &hpfs_vnodeops, &vp); error = getnewvnode("hpfs", mp, &hpfs_vnodeops, &vp);
if (error) { if (error) {
printf("hpfs_vget: can't get new vnode\n"); printf("hpfs_vget: can't get new vnode\n");
FREE(hp, M_HPFSNO); free(hp, M_HPFSNO);
return (error); return (error);
} }

View File

@ -611,7 +611,7 @@ hpfs_reclaim(ap)
vp->v_data = NULL; vp->v_data = NULL;
FREE(hp, M_HPFSNO); free(hp, M_HPFSNO);
return (0); return (0);
} }
@ -1003,7 +1003,7 @@ hpfs_readdir(ap)
dpStart = (struct dirent *) dpStart = (struct dirent *)
((caddr_t)uio->uio_iov->iov_base - ((caddr_t)uio->uio_iov->iov_base -
(uio->uio_offset - off)); (uio->uio_offset - off));
MALLOC(cookies, u_long *, ncookies * sizeof(u_long), cookies = malloc(ncookies * sizeof(u_long),
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
for (dp = dpStart, cookiep = cookies, i=0; for (dp = dpStart, cookiep = cookies, i=0;
i < ncookies; i < ncookies;

View File

@ -148,7 +148,7 @@ deget(pmp, dirclust, diroffset, depp)
* might cause a bogus v_data pointer to get dereferenced * might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block. * elsewhere if MALLOC should block.
*/ */
MALLOC(ldep, struct denode *, sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK); ldep = malloc(sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK);
/* /*
* Directory entry was not in cache, have to create a vnode and * Directory entry was not in cache, have to create a vnode and
@ -158,7 +158,7 @@ deget(pmp, dirclust, diroffset, depp)
error = getnewvnode("msdosfs", mntp, &msdosfs_vnodeops, &nvp); error = getnewvnode("msdosfs", mntp, &msdosfs_vnodeops, &nvp);
if (error) { if (error) {
*depp = NULL; *depp = NULL;
FREE(ldep, M_MSDOSFSNODE); free(ldep, M_MSDOSFSNODE);
return error; return error;
} }
bzero((caddr_t)ldep, sizeof *ldep); bzero((caddr_t)ldep, sizeof *ldep);
@ -173,7 +173,7 @@ deget(pmp, dirclust, diroffset, depp)
lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL); lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL);
error = insmntque(nvp, mntp); error = insmntque(nvp, mntp);
if (error != 0) { if (error != 0) {
FREE(ldep, M_MSDOSFSNODE); free(ldep, M_MSDOSFSNODE);
*depp = NULL; *depp = NULL;
return (error); return (error);
} }
@ -567,7 +567,7 @@ msdosfs_reclaim(ap)
#if 0 /* XXX */ #if 0 /* XXX */
dep->de_flag = 0; dep->de_flag = 0;
#endif #endif
FREE(dep, M_MSDOSFSNODE); free(dep, M_MSDOSFSNODE);
vp->v_data = NULL; vp->v_data = NULL;
return (0); return (0);

View File

@ -1561,7 +1561,7 @@ msdosfs_readdir(ap)
if (ap->a_ncookies) { if (ap->a_ncookies) {
ncookies = uio->uio_resid / 16; ncookies = uio->uio_resid / 16;
MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, cookies = malloc(ncookies * sizeof(u_long), M_TEMP,
M_WAITOK); M_WAITOK);
*ap->a_cookies = cookies; *ap->a_cookies = cookies;
*ap->a_ncookies = ncookies; *ap->a_ncookies = ncookies;

View File

@ -190,7 +190,7 @@ ntfs_ntvattrget(
} }
/* Scan $ATTRIBUTE_LIST for requested attribute */ /* Scan $ATTRIBUTE_LIST for requested attribute */
len = lvap->va_datalen; len = lvap->va_datalen;
MALLOC(alpool, caddr_t, len, M_TEMP, M_WAITOK); alpool = malloc(len, M_TEMP, M_WAITOK);
error = ntfs_readntvattr_plain(ntmp, ip, lvap, 0, len, alpool, &len, error = ntfs_readntvattr_plain(ntmp, ip, lvap, 0, len, alpool, &len,
NULL); NULL);
if (error) if (error)
@ -246,7 +246,7 @@ ntfs_ntvattrget(
"ino: %d, type: 0x%x, name: %.*s, vcn: %d\n", \ "ino: %d, type: 0x%x, name: %.*s, vcn: %d\n", \
ip->i_number, type, (int) namelen, name, (u_int32_t) vcn)); ip->i_number, type, (int) namelen, name, (u_int32_t) vcn));
out: out:
FREE(alpool, M_TEMP); free(alpool, M_TEMP);
return (error); return (error);
} }
@ -268,7 +268,7 @@ ntfs_loadntnode(
dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number)); dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number));
MALLOC(mfrp, struct filerec *, ntfs_bntob(ntmp->ntm_bpmftrec), mfrp = malloc(ntfs_bntob(ntmp->ntm_bpmftrec),
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
if (ip->i_number < NTFS_SYSNODESNUM) { if (ip->i_number < NTFS_SYSNODESNUM) {
@ -341,7 +341,7 @@ ntfs_loadntnode(
ip->i_flag |= IN_LOADED; ip->i_flag |= IN_LOADED;
out: out:
FREE(mfrp, M_TEMP); free(mfrp, M_TEMP);
return (error); return (error);
} }
@ -391,7 +391,7 @@ ntfs_ntlookup(
} }
} while (lockmgr(&ntfs_hashlock, LK_EXCLUSIVE | LK_SLEEPFAIL, NULL)); } while (lockmgr(&ntfs_hashlock, LK_EXCLUSIVE | LK_SLEEPFAIL, NULL));
MALLOC(ip, struct ntnode *, sizeof(struct ntnode), M_NTFSNTNODE, ip = malloc(sizeof(struct ntnode), M_NTFSNTNODE,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
ddprintf(("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip)); ddprintf(("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip));
@ -466,7 +466,7 @@ ntfs_ntput(ip)
mtx_destroy(&ip->i_interlock); mtx_destroy(&ip->i_interlock);
lockdestroy(&ip->i_lock); lockdestroy(&ip->i_lock);
vrele(ip->i_devvp); vrele(ip->i_devvp);
FREE(ip, M_NTFSNTNODE); free(ip, M_NTFSNTNODE);
} }
/* /*
@ -513,14 +513,14 @@ ntfs_freentvattr(vap)
{ {
if (vap->va_flag & NTFS_AF_INRUN) { if (vap->va_flag & NTFS_AF_INRUN) {
if (vap->va_vruncn) if (vap->va_vruncn)
FREE(vap->va_vruncn, M_NTFSRUN); free(vap->va_vruncn, M_NTFSRUN);
if (vap->va_vruncl) if (vap->va_vruncl)
FREE(vap->va_vruncl, M_NTFSRUN); free(vap->va_vruncl, M_NTFSRUN);
} else { } else {
if (vap->va_datap) if (vap->va_datap)
FREE(vap->va_datap, M_NTFSRDATA); free(vap->va_datap, M_NTFSRDATA);
} }
FREE(vap, M_NTFSNTVATTR); free(vap, M_NTFSNTVATTR);
} }
/* /*
@ -539,7 +539,7 @@ ntfs_attrtontvattr(
error = 0; error = 0;
*rvapp = NULL; *rvapp = NULL;
MALLOC(vap, struct ntvattr *, sizeof(struct ntvattr), vap = malloc(sizeof(struct ntvattr),
M_NTFSNTVATTR, M_WAITOK | M_ZERO); M_NTFSNTVATTR, M_WAITOK | M_ZERO);
vap->va_ip = NULL; vap->va_ip = NULL;
vap->va_flag = rap->a_hdr.a_flag; vap->va_flag = rap->a_hdr.a_flag;
@ -576,7 +576,7 @@ ntfs_attrtontvattr(
vap->va_allocated = rap->a_r.a_datalen; vap->va_allocated = rap->a_r.a_datalen;
vap->va_vcnstart = 0; vap->va_vcnstart = 0;
vap->va_vcnend = ntfs_btocn(vap->va_allocated); vap->va_vcnend = ntfs_btocn(vap->va_allocated);
MALLOC(vap->va_datap, caddr_t, vap->va_datalen, vap->va_datap = malloc(vap->va_datalen,
M_NTFSRDATA, M_WAITOK); M_NTFSRDATA, M_WAITOK);
memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff, memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff,
rap->a_r.a_datalen); rap->a_r.a_datalen);
@ -584,7 +584,7 @@ ntfs_attrtontvattr(
ddprintf((", len: %d", vap->va_datalen)); ddprintf((", len: %d", vap->va_datalen));
if (error) if (error)
FREE(vap, M_NTFSNTVATTR); free(vap, M_NTFSNTVATTR);
else else
*rvapp = vap; *rvapp = vap;
@ -618,8 +618,8 @@ ntfs_runtovrun(
off += (run[off] & 0xF) + ((run[off] >> 4) & 0xF) + 1; off += (run[off] & 0xF) + ((run[off] >> 4) & 0xF) + 1;
cnt++; cnt++;
} }
MALLOC(cn, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); cn = malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
MALLOC(cl, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); cl = malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
off = 0; off = 0;
cnt = 0; cnt = 0;
@ -769,14 +769,14 @@ ntfs_fget(
if (*fpp) if (*fpp)
return (0); return (0);
MALLOC(fp, struct fnode *, sizeof(struct fnode), M_NTFSFNODE, fp = malloc(sizeof(struct fnode), M_NTFSFNODE,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
dprintf(("ntfs_fget: allocating fnode: %p\n",fp)); dprintf(("ntfs_fget: allocating fnode: %p\n",fp));
fp->f_ip = ip; fp->f_ip = ip;
if (attrname) { if (attrname) {
fp->f_flag |= FN_AATTRNAME; fp->f_flag |= FN_AATTRNAME;
MALLOC(fp->f_attrname, char *, strlen(attrname)+1, M_TEMP, M_WAITOK); fp->f_attrname = malloc(strlen(attrname)+1, M_TEMP, M_WAITOK);
strcpy(fp->f_attrname, attrname); strcpy(fp->f_attrname, attrname);
} else } else
fp->f_attrname = NULL; fp->f_attrname = NULL;
@ -807,10 +807,10 @@ ntfs_frele(
dprintf(("ntfs_frele: deallocating fnode\n")); dprintf(("ntfs_frele: deallocating fnode\n"));
LIST_REMOVE(fp,f_fnlist); LIST_REMOVE(fp,f_fnlist);
if (fp->f_flag & FN_AATTRNAME) if (fp->f_flag & FN_AATTRNAME)
FREE(fp->f_attrname, M_TEMP); free(fp->f_attrname, M_TEMP);
if (fp->f_dirblbuf) if (fp->f_dirblbuf)
FREE(fp->f_dirblbuf, M_NTFSDIR); free(fp->f_dirblbuf, M_NTFSDIR);
FREE(fp, M_NTFSFNODE); free(fp, M_NTFSFNODE);
ntfs_ntrele(ip); ntfs_ntrele(ip);
} }
@ -861,7 +861,7 @@ ntfs_ntlookupattr(
out: out:
if (namelen) { if (namelen) {
MALLOC((*attrname), char *, namelen, M_TEMP, M_WAITOK); (*attrname) = malloc(namelen, M_TEMP, M_WAITOK);
memcpy((*attrname), name, namelen); memcpy((*attrname), name, namelen);
(*attrname)[namelen] = '\0'; (*attrname)[namelen] = '\0';
} }
@ -926,7 +926,7 @@ ntfs_ntlookupfile(
dprintf(("ntfs_ntlookupfile: blksz: %d, rdsz: %jd\n", blsize, rdsize)); dprintf(("ntfs_ntlookupfile: blksz: %d, rdsz: %jd\n", blsize, rdsize));
MALLOC(rdbuf, caddr_t, blsize, M_TEMP, M_WAITOK); rdbuf = malloc(blsize, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30", error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30",
0, rdsize, rdbuf, NULL); 0, rdsize, rdbuf, NULL);
@ -991,7 +991,7 @@ ntfs_ntlookupfile(
/* free the buffer returned by ntfs_ntlookupattr() */ /* free the buffer returned by ntfs_ntlookupattr() */
if (attrname) { if (attrname) {
FREE(attrname, M_TEMP); free(attrname, M_TEMP);
attrname = NULL; attrname = NULL;
} }
@ -1069,10 +1069,10 @@ ntfs_ntlookupfile(
dprintf(("finish\n")); dprintf(("finish\n"));
fail: fail:
if (attrname) FREE(attrname, M_TEMP); if (attrname) free(attrname, M_TEMP);
ntfs_ntvattrrele(vap); ntfs_ntvattrrele(vap);
ntfs_ntput(ip); ntfs_ntput(ip);
FREE(rdbuf, M_TEMP); free(rdbuf, M_TEMP);
return (error); return (error);
} }
@ -1143,8 +1143,7 @@ ntfs_ntreaddir(
if (fp->f_dirblbuf == NULL) { if (fp->f_dirblbuf == NULL) {
fp->f_dirblsz = vap->va_a_iroot->ir_size; fp->f_dirblsz = vap->va_a_iroot->ir_size;
MALLOC(fp->f_dirblbuf, caddr_t, fp->f_dirblbuf = malloc( max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, M_WAITOK);
max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, M_WAITOK);
} }
blsize = fp->f_dirblsz; blsize = fp->f_dirblsz;
@ -1159,7 +1158,7 @@ ntfs_ntreaddir(
error = ENOTDIR; error = ENOTDIR;
goto fail; goto fail;
} }
MALLOC(bmp, u_int8_t *, bmvap->va_datalen, M_TEMP, M_WAITOK); bmp = malloc(bmvap->va_datalen, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", 0, error = ntfs_readattr(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", 0,
bmvap->va_datalen, bmp, NULL); bmvap->va_datalen, bmp, NULL);
if (error) if (error)
@ -1265,7 +1264,7 @@ ntfs_ntreaddir(
if (iavap) if (iavap)
ntfs_ntvattrrele(iavap); ntfs_ntvattrrele(iavap);
if (bmp) if (bmp)
FREE(bmp, M_TEMP); free(bmp, M_TEMP);
ntfs_ntput(ip); ntfs_ntput(ip);
return (error); return (error);
} }
@ -1756,9 +1755,9 @@ ntfs_readattr(
ddprintf(("ntfs_ntreadattr: compression: %d\n", ddprintf(("ntfs_ntreadattr: compression: %d\n",
vap->va_compressalg)); vap->va_compressalg));
MALLOC(cup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), cup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL),
M_NTFSDECOMP, M_WAITOK); M_NTFSDECOMP, M_WAITOK);
MALLOC(uup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), uup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL),
M_NTFSDECOMP, M_WAITOK); M_NTFSDECOMP, M_WAITOK);
cn = (ntfs_btocn(roff)) & (~(NTFS_COMPUNIT_CL - 1)); cn = (ntfs_btocn(roff)) & (~(NTFS_COMPUNIT_CL - 1));
@ -1803,8 +1802,8 @@ ntfs_readattr(
cn += NTFS_COMPUNIT_CL; cn += NTFS_COMPUNIT_CL;
} }
FREE(uup, M_NTFSDECOMP); free(uup, M_NTFSDECOMP);
FREE(cup, M_NTFSDECOMP); free(cup, M_NTFSDECOMP);
} else } else
error = ntfs_readattr_plain(ntmp, ip, attrnum, attrname, error = ntfs_readattr_plain(ntmp, ip, attrnum, attrname,
roff, rsize, rdata, &init, uio); roff, rsize, rdata, &init, uio);
@ -1991,7 +1990,7 @@ ntfs_toupper_use(mp, ntmp)
* XXX for now, just the first 256 entries are used anyway, * XXX for now, just the first 256 entries are used anyway,
* so don't bother reading more * so don't bother reading more
*/ */
MALLOC(ntfs_toupper_tab, wchar *, 65536 * sizeof(wchar), ntfs_toupper_tab = malloc(65536 * sizeof(wchar),
M_NTFSRDATA, M_WAITOK); M_NTFSRDATA, M_WAITOK);
if ((error = VFS_VGET(mp, NTFS_UPCASEINO, LK_EXCLUSIVE, &vp))) if ((error = VFS_VGET(mp, NTFS_UPCASEINO, LK_EXCLUSIVE, &vp)))
@ -2018,7 +2017,7 @@ ntfs_toupper_unuse()
ntfs_toupper_usecount--; ntfs_toupper_usecount--;
if (ntfs_toupper_usecount == 0) { if (ntfs_toupper_usecount == 0) {
FREE(ntfs_toupper_tab, M_NTFSRDATA); free(ntfs_toupper_tab, M_NTFSRDATA);
ntfs_toupper_tab = NULL; ntfs_toupper_tab = NULL;
} }
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
@ -2047,14 +2046,14 @@ ntfs_u28_init(
return (0); return (0);
} }
MALLOC(u28, char **, 256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO); u28 = malloc(256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO);
for (i=0; i<256; i++) { for (i=0; i<256; i++) {
h = (u2w[i] >> 8) & 0xFF; h = (u2w[i] >> 8) & 0xFF;
l = (u2w[i]) &0xFF; l = (u2w[i]) &0xFF;
if (u28[h] == NULL) { if (u28[h] == NULL) {
MALLOC(u28[h], char *, 256 * sizeof(char), M_TEMP, M_WAITOK); u28[h] = malloc(256 * sizeof(char), M_TEMP, M_WAITOK);
for (j=0; j<256; j++) for (j=0; j<256; j++)
u28[h][j] = '_'; u28[h][j] = '_';
} }
@ -2084,9 +2083,9 @@ ntfs_u28_uninit(struct ntfsmount *ntmp)
for (i=0; i<256; i++) for (i=0; i<256; i++)
if (u28[i] != NULL) if (u28[i] != NULL)
FREE(u28[i], M_TEMP); free(u28[i], M_TEMP);
FREE(u28, M_TEMP); free(u28, M_TEMP);
return (0); return (0);
} }
@ -2105,7 +2104,7 @@ ntfs_82u_init(
return (0); return (0);
} }
MALLOC(_82u, wchar *, 256 * sizeof(wchar), M_TEMP, M_WAITOK); _82u = malloc(256 * sizeof(wchar), M_TEMP, M_WAITOK);
for (i=0; i<256; i++) for (i=0; i<256; i++)
_82u[i] = i; _82u[i] = i;
@ -2126,7 +2125,7 @@ ntfs_82u_uninit(struct ntfsmount *ntmp)
return (0); return (0);
} }
FREE(ntmp->ntm_82u, M_TEMP); free(ntmp->ntm_82u, M_TEMP);
return (0); return (0);
} }

View File

@ -416,8 +416,7 @@ ntfs_mountfs(devvp, mp, td)
} }
/* Alloc memory for attribute definitions */ /* Alloc memory for attribute definitions */
MALLOC(ntmp->ntm_ad, struct ntvattrdef *, ntmp->ntm_ad = malloc( num * sizeof(struct ntvattrdef),
num * sizeof(struct ntvattrdef),
M_NTFSMNT, M_WAITOK); M_NTFSMNT, M_WAITOK);
ntmp->ntm_adnum = num; ntmp->ntm_adnum = num;
@ -526,8 +525,8 @@ ntfs_unmount(
MNT_ILOCK(mp); MNT_ILOCK(mp);
mp->mnt_flag &= ~MNT_LOCAL; mp->mnt_flag &= ~MNT_LOCAL;
MNT_IUNLOCK(mp); MNT_IUNLOCK(mp);
FREE(ntmp->ntm_ad, M_NTFSMNT); free(ntmp->ntm_ad, M_NTFSMNT);
FREE(ntmp, M_NTFSMNT); free(ntmp, M_NTFSMNT);
return (error); return (error);
} }
@ -568,7 +567,7 @@ ntfs_calccfree(
bmsize = VTOF(vp)->f_size; bmsize = VTOF(vp)->f_size;
MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, M_WAITOK); tmp = malloc(bmsize, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL, error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL,
0, bmsize, tmp, NULL); 0, bmsize, tmp, NULL);
@ -581,7 +580,7 @@ ntfs_calccfree(
*cfreep = cfree; *cfreep = cfree;
out: out:
FREE(tmp, M_TEMP); free(tmp, M_TEMP);
return(error); return(error);
} }

View File

@ -595,7 +595,7 @@ ntfs_readdir(ap)
dpStart = (struct dirent *) dpStart = (struct dirent *)
((caddr_t)uio->uio_iov->iov_base - ((caddr_t)uio->uio_iov->iov_base -
(uio->uio_offset - off)); (uio->uio_offset - off));
MALLOC(cookies, u_long *, ncookies * sizeof(u_long), cookies = malloc(ncookies * sizeof(u_long),
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
for (dp = dpStart, cookiep = cookies, i=0; for (dp = dpStart, cookiep = cookies, i=0;
i < ncookies; i < ncookies;

View File

@ -173,7 +173,7 @@ null_insmntque_dtr(struct vnode *vp, void *xp)
{ {
vp->v_data = NULL; vp->v_data = NULL;
vp->v_vnlock = &vp->v_lock; vp->v_vnlock = &vp->v_lock;
FREE(xp, M_NULLFSNODE); free(xp, M_NULLFSNODE);
vp->v_op = &dead_vnodeops; vp->v_op = &dead_vnodeops;
(void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); (void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vgone(vp); vgone(vp);
@ -218,12 +218,12 @@ null_nodeget(mp, lowervp, vpp)
* might cause a bogus v_data pointer to get dereferenced * might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block. * elsewhere if MALLOC should block.
*/ */
MALLOC(xp, struct null_node *, sizeof(struct null_node), xp = malloc(sizeof(struct null_node),
M_NULLFSNODE, M_WAITOK); M_NULLFSNODE, M_WAITOK);
error = getnewvnode("null", mp, &null_vnodeops, &vp); error = getnewvnode("null", mp, &null_vnodeops, &vp);
if (error) { if (error) {
FREE(xp, M_NULLFSNODE); free(xp, M_NULLFSNODE);
return (error); return (error);
} }

View File

@ -677,7 +677,7 @@ null_reclaim(struct vop_reclaim_args *ap)
vput(lowervp); vput(lowervp);
} else } else
panic("null_reclaim: reclaiming a node with no lowervp"); panic("null_reclaim: reclaiming a node with no lowervp");
FREE(xp, M_NULLFSNODE); free(xp, M_NULLFSNODE);
return (0); return (0);
} }

View File

@ -169,16 +169,16 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
* might cause a bogus v_data pointer to get dereferenced * might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block. * elsewhere if MALLOC should block.
*/ */
MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO); np = malloc(sizeof *np, M_NWNODE, M_WAITOK | M_ZERO);
error = getnewvnode("nwfs", mp, &nwfs_vnodeops, &vp); error = getnewvnode("nwfs", mp, &nwfs_vnodeops, &vp);
if (error) { if (error) {
*vpp = NULL; *vpp = NULL;
FREE(np, M_NWNODE); free(np, M_NWNODE);
return (error); return (error);
} }
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) { if (error != 0) {
FREE(np, M_NWNODE); free(np, M_NWNODE);
*vpp = NULL; *vpp = NULL;
return (error); return (error);
} }
@ -201,7 +201,7 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
vp->v_data = NULL; vp->v_data = NULL;
np->n_vnode = NULL; np->n_vnode = NULL;
vrele(vp); vrele(vp);
FREE(np, M_NWNODE); free(np, M_NWNODE);
goto rescan; goto rescan;
} }
*vpp = vp; *vpp = vp;
@ -283,7 +283,7 @@ nwfs_reclaim(ap)
nmp->n_root = NULL; nmp->n_root = NULL;
} }
vp->v_data = NULL; vp->v_data = NULL;
FREE(np, M_NWNODE); free(np, M_NWNODE);
if (dvp) { if (dvp) {
vrele(dvp); vrele(dvp);
} }

View File

@ -114,7 +114,7 @@ nwfs_initnls(struct nwmount *nmp) {
nmp->m.nls.u2n = ncp_defnls.u2n; nmp->m.nls.u2n = ncp_defnls.u2n;
return 0; return 0;
} }
MALLOC(pe, char *, 256 * 4, M_NWFSDATA, M_WAITOK); pe = malloc(256 * 4, M_NWFSDATA, M_WAITOK);
pc = pe; pc = pe;
do { do {
COPY_TABLE(nmp->m.nls.to_lower, ncp_defnls.to_lower); COPY_TABLE(nmp->m.nls.to_lower, ncp_defnls.to_lower);
@ -191,7 +191,7 @@ static int nwfs_mount(struct mount *mp, struct thread *td)
ncp_conn_unlock(conn, td); /* we keep the ref */ ncp_conn_unlock(conn, td); /* we keep the ref */
mp->mnt_stat.f_iosize = conn->buffer_size; mp->mnt_stat.f_iosize = conn->buffer_size;
/* We must malloc our own mount info */ /* We must malloc our own mount info */
MALLOC(nmp,struct nwmount *,sizeof(struct nwmount),M_NWFSDATA, nmp = malloc(sizeof(struct nwmount),M_NWFSDATA,
M_WAITOK | M_USE_RESERVE | M_ZERO); M_WAITOK | M_USE_RESERVE | M_ZERO);
if (nmp == NULL) { if (nmp == NULL) {
nwfs_printf("could not alloc nwmount\n"); nwfs_printf("could not alloc nwmount\n");

View File

@ -122,24 +122,24 @@ portal_mount(struct mount *mp, struct thread *td)
return (ESOCKTNOSUPPORT); return (ESOCKTNOSUPPORT);
} }
MALLOC(pn, struct portalnode *, sizeof(struct portalnode), pn = malloc(sizeof(struct portalnode),
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
MALLOC(fmp, struct portalmount *, sizeof(struct portalmount), fmp = malloc(sizeof(struct portalmount),
M_PORTALFSMNT, M_WAITOK); /* XXX */ M_PORTALFSMNT, M_WAITOK); /* XXX */
error = getnewvnode("portal", mp, &portal_vnodeops, &rvp); /* XXX */ error = getnewvnode("portal", mp, &portal_vnodeops, &rvp); /* XXX */
if (error) { if (error) {
FREE(fmp, M_PORTALFSMNT); free(fmp, M_PORTALFSMNT);
FREE(pn, M_TEMP); free(pn, M_TEMP);
fdrop(fp, td); fdrop(fp, td);
return (error); return (error);
} }
error = insmntque(rvp, mp); /* XXX: Too early for mpsafe fs */ error = insmntque(rvp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) { if (error != 0) {
FREE(fmp, M_PORTALFSMNT); free(fmp, M_PORTALFSMNT);
FREE(pn, M_TEMP); free(pn, M_TEMP);
fdrop(fp, td); fdrop(fp, td);
return (error); return (error);
} }

View File

@ -127,12 +127,12 @@ portal_lookup(ap)
* might cause a bogus v_data pointer to get dereferenced * might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block. * elsewhere if MALLOC should block.
*/ */
MALLOC(pt, struct portalnode *, sizeof(struct portalnode), pt = malloc(sizeof(struct portalnode),
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
error = getnewvnode("portal", dvp->v_mount, &portal_vnodeops, &fvp); error = getnewvnode("portal", dvp->v_mount, &portal_vnodeops, &fvp);
if (error) { if (error) {
FREE(pt, M_TEMP); free(pt, M_TEMP);
goto bad; goto bad;
} }
fvp->v_type = VREG; fvp->v_type = VREG;
@ -542,7 +542,7 @@ portal_reclaim(ap)
free((caddr_t) pt->pt_arg, M_TEMP); free((caddr_t) pt->pt_arg, M_TEMP);
pt->pt_arg = 0; pt->pt_arg = 0;
} }
FREE(ap->a_vp->v_data, M_TEMP); free(ap->a_vp->v_data, M_TEMP);
ap->a_vp->v_data = 0; ap->a_vp->v_data = 0;
return (0); return (0);

View File

@ -71,7 +71,7 @@ pfs_alloc_node(struct pfs_info *pi, const char *name, pfs_type_t type)
KASSERT(strlen(name) < PFS_NAMELEN, KASSERT(strlen(name) < PFS_NAMELEN,
("%s(): node name is too long", __func__)); ("%s(): node name is too long", __func__));
MALLOC(pn, struct pfs_node *, sizeof *pn, pn = malloc(sizeof *pn,
M_PFSNODES, M_WAITOK|M_ZERO); M_PFSNODES, M_WAITOK|M_ZERO);
mtx_init(&pn->pn_mutex, "pfs_node", NULL, MTX_DEF | MTX_DUPOK); mtx_init(&pn->pn_mutex, "pfs_node", NULL, MTX_DEF | MTX_DUPOK);
strlcpy(pn->pn_name, name, sizeof pn->pn_name); strlcpy(pn->pn_name, name, sizeof pn->pn_name);
@ -290,7 +290,7 @@ pfs_destroy(struct pfs_node *pn)
/* destroy the node */ /* destroy the node */
pfs_fileno_free(pn); pfs_fileno_free(pn);
mtx_destroy(&pn->pn_mutex); mtx_destroy(&pn->pn_mutex);
FREE(pn, M_PFSNODES); free(pn, M_PFSNODES);
return (0); return (0);
} }

View File

@ -149,7 +149,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
++pfs_vncache_misses; ++pfs_vncache_misses;
/* nope, get a new one */ /* nope, get a new one */
MALLOC(pvd, struct pfs_vdata *, sizeof *pvd, M_PFSVNCACHE, M_WAITOK); pvd = malloc(sizeof *pvd, M_PFSVNCACHE, M_WAITOK);
mtx_lock(&pfs_vncache_mutex); mtx_lock(&pfs_vncache_mutex);
if (++pfs_vncache_entries > pfs_vncache_maxentries) if (++pfs_vncache_entries > pfs_vncache_maxentries)
pfs_vncache_maxentries = pfs_vncache_entries; pfs_vncache_maxentries = pfs_vncache_entries;
@ -159,7 +159,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
mtx_lock(&pfs_vncache_mutex); mtx_lock(&pfs_vncache_mutex);
--pfs_vncache_entries; --pfs_vncache_entries;
mtx_unlock(&pfs_vncache_mutex); mtx_unlock(&pfs_vncache_mutex);
FREE(pvd, M_PFSVNCACHE); free(pvd, M_PFSVNCACHE);
return (error); return (error);
} }
pvd->pvd_pn = pn; pvd->pvd_pn = pn;
@ -203,7 +203,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
mtx_lock(&pfs_vncache_mutex); mtx_lock(&pfs_vncache_mutex);
--pfs_vncache_entries; --pfs_vncache_entries;
mtx_unlock(&pfs_vncache_mutex); mtx_unlock(&pfs_vncache_mutex);
FREE(pvd, M_PFSVNCACHE); free(pvd, M_PFSVNCACHE);
*vpp = NULLVP; *vpp = NULLVP;
return (error); return (error);
} }
@ -237,7 +237,7 @@ pfs_vncache_free(struct vnode *vp)
--pfs_vncache_entries; --pfs_vncache_entries;
mtx_unlock(&pfs_vncache_mutex); mtx_unlock(&pfs_vncache_mutex);
FREE(pvd, M_PFSVNCACHE); free(pvd, M_PFSVNCACHE);
vp->v_data = NULL; vp->v_data = NULL;
return (0); return (0);
} }

View File

@ -229,15 +229,15 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
if (fap == NULL) if (fap == NULL)
return ENOENT; return ENOENT;
MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); np = malloc(sizeof *np, M_SMBNODE, M_WAITOK);
error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp);
if (error) { if (error) {
FREE(np, M_SMBNODE); free(np, M_SMBNODE);
return error; return error;
} }
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) { if (error != 0) {
FREE(np, M_SMBNODE); free(np, M_SMBNODE);
return (error); return (error);
} }
vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG;
@ -269,7 +269,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
continue; continue;
vput(vp); vput(vp);
/* smb_name_free(np->n_name); /* smb_name_free(np->n_name);
FREE(np, M_SMBNODE);*/ free(np, M_SMBNODE);*/
goto loop; goto loop;
} }
LIST_INSERT_HEAD(nhpp, np, n_hash); LIST_INSERT_HEAD(nhpp, np, n_hash);
@ -335,7 +335,7 @@ smbfs_reclaim(ap)
smbfs_hash_unlock(smp); smbfs_hash_unlock(smp);
if (np->n_name) if (np->n_name)
smbfs_name_free(np->n_name); smbfs_name_free(np->n_name);
FREE(np, M_SMBNODE); free(np, M_SMBNODE);
if (dvp != NULL) { if (dvp != NULL) {
vrele(dvp); vrele(dvp);
/* /*

View File

@ -179,7 +179,7 @@ smbfs_mount(struct mount *mp, struct thread *td)
#ifdef SMBFS_USEZONE #ifdef SMBFS_USEZONE
smp = zalloc(smbfsmount_zone); smp = zalloc(smbfsmount_zone);
#else #else
MALLOC(smp, struct smbmount*, sizeof(*smp), M_SMBFSDATA, smp = malloc(sizeof(*smp), M_SMBFSDATA,
M_WAITOK|M_USE_RESERVE); M_WAITOK|M_USE_RESERVE);
#endif #endif
if (smp == NULL) { if (smp == NULL) {

View File

@ -331,7 +331,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp) {
bo = &devvp->v_bufobj; bo = &devvp->v_bufobj;
/* XXX: should be M_WAITOK */ /* XXX: should be M_WAITOK */
MALLOC(udfmp, struct udf_mnt *, sizeof(struct udf_mnt), M_UDFMOUNT, udfmp = malloc(sizeof(struct udf_mnt), M_UDFMOUNT,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
if (udfmp == NULL) { if (udfmp == NULL) {
printf("Cannot allocate UDF mount struct\n"); printf("Cannot allocate UDF mount struct\n");
@ -488,7 +488,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp) {
bail: bail:
if (udfmp != NULL) if (udfmp != NULL)
FREE(udfmp, M_UDFMOUNT); free(udfmp, M_UDFMOUNT);
if (bp != NULL) if (bp != NULL)
brelse(bp); brelse(bp);
DROP_GIANT(); DROP_GIANT();
@ -530,9 +530,9 @@ udf_unmount(struct mount *mp, int mntflags, struct thread *td)
vrele(udfmp->im_devvp); vrele(udfmp->im_devvp);
if (udfmp->s_table != NULL) if (udfmp->s_table != NULL)
FREE(udfmp->s_table, M_UDFMOUNT); free(udfmp->s_table, M_UDFMOUNT);
FREE(udfmp, M_UDFMOUNT); free(udfmp, M_UDFMOUNT);
mp->mnt_data = NULL; mp->mnt_data = NULL;
MNT_ILOCK(mp); MNT_ILOCK(mp);
@ -647,7 +647,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
return (ENOMEM); return (ENOMEM);
} }
size = UDF_FENTRY_SIZE + le32toh(fe->l_ea) + le32toh(fe->l_ad); size = UDF_FENTRY_SIZE + le32toh(fe->l_ea) + le32toh(fe->l_ad);
MALLOC(unode->fentry, struct file_entry *, size, M_UDFFENTRY, unode->fentry = malloc(size, M_UDFFENTRY,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
if (unode->fentry == NULL) { if (unode->fentry == NULL) {
printf("Cannot allocate file entry block\n"); printf("Cannot allocate file entry block\n");
@ -757,8 +757,7 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
pms = (struct part_map_spare *)pmap; pms = (struct part_map_spare *)pmap;
pmap += UDF_PMAP_TYPE2_SIZE; pmap += UDF_PMAP_TYPE2_SIZE;
MALLOC(udfmp->s_table, struct udf_sparing_table *, udfmp->s_table = malloc( le32toh(pms->st_size), M_UDFMOUNT, M_NOWAIT | M_ZERO);
le32toh(pms->st_size), M_UDFMOUNT, M_NOWAIT | M_ZERO);
if (udfmp->s_table == NULL) if (udfmp->s_table == NULL)
return (ENOMEM); return (ENOMEM);
@ -776,7 +775,7 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
brelse(bp); brelse(bp);
printf("Failed to read Sparing Table at sector %d\n", printf("Failed to read Sparing Table at sector %d\n",
le32toh(pms->st_loc[0])); le32toh(pms->st_loc[0]));
FREE(udfmp->s_table, M_UDFMOUNT); free(udfmp->s_table, M_UDFMOUNT);
return (error); return (error);
} }
bcopy(bp->b_data, udfmp->s_table, le32toh(pms->st_size)); bcopy(bp->b_data, udfmp->s_table, le32toh(pms->st_size));
@ -784,7 +783,7 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
if (udf_checktag(&udfmp->s_table->tag, 0)) { if (udf_checktag(&udfmp->s_table->tag, 0)) {
printf("Invalid sparing table found\n"); printf("Invalid sparing table found\n");
FREE(udfmp->s_table, M_UDFMOUNT); free(udfmp->s_table, M_UDFMOUNT);
return (EINVAL); return (EINVAL);
} }

View File

@ -574,7 +574,7 @@ udf_getfid(struct udf_dirstream *ds)
*/ */
if (ds->fid_fragment && ds->buf != NULL) { if (ds->fid_fragment && ds->buf != NULL) {
ds->fid_fragment = 0; ds->fid_fragment = 0;
FREE(ds->buf, M_UDFFID); free(ds->buf, M_UDFFID);
} }
fid = (struct fileid_desc*)&ds->data[ds->off]; fid = (struct fileid_desc*)&ds->data[ds->off];
@ -599,7 +599,7 @@ udf_getfid(struct udf_dirstream *ds)
* File ID descriptors can only be at most one * File ID descriptors can only be at most one
* logical sector in size. * logical sector in size.
*/ */
MALLOC(ds->buf, uint8_t*, ds->udfmp->bsize, M_UDFFID, ds->buf = malloc(ds->udfmp->bsize, M_UDFFID,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
bcopy(fid, ds->buf, frag_size); bcopy(fid, ds->buf, frag_size);
@ -668,7 +668,7 @@ udf_closedir(struct udf_dirstream *ds)
brelse(ds->bp); brelse(ds->bp);
if (ds->fid_fragment && ds->buf != NULL) if (ds->fid_fragment && ds->buf != NULL)
FREE(ds->buf, M_UDFFID); free(ds->buf, M_UDFFID);
uma_zfree(udf_zone_ds, ds); uma_zfree(udf_zone_ds, ds);
} }
@ -701,7 +701,7 @@ udf_readdir(struct vop_readdir_args *a)
* it left off. * it left off.
*/ */
ncookies = uio->uio_resid / 8; ncookies = uio->uio_resid / 8;
MALLOC(cookies, u_long *, sizeof(u_long) * ncookies, cookies = malloc(sizeof(u_long) * ncookies,
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
if (cookies == NULL) if (cookies == NULL)
return (ENOMEM); return (ENOMEM);
@ -787,7 +787,7 @@ udf_readdir(struct vop_readdir_args *a)
if (a->a_ncookies != NULL) { if (a->a_ncookies != NULL) {
if (error) if (error)
FREE(cookies, M_TEMP); free(cookies, M_TEMP);
else { else {
*a->a_ncookies = uiodir.acookies; *a->a_ncookies = uiodir.acookies;
*a->a_cookies = cookies; *a->a_cookies = cookies;
@ -1028,7 +1028,7 @@ udf_reclaim(struct vop_reclaim_args *a)
vfs_hash_remove(vp); vfs_hash_remove(vp);
if (unode->fentry != NULL) if (unode->fentry != NULL)
FREE(unode->fentry, M_UDFFENTRY); free(unode->fentry, M_UDFFENTRY);
uma_zfree(udf_zone_node, unode); uma_zfree(udf_zone_node, unode);
vp->v_data = NULL; vp->v_data = NULL;
} }

View File

@ -257,17 +257,17 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp,
* might cause a bogus v_data pointer to get dereferenced elsewhere * might cause a bogus v_data pointer to get dereferenced elsewhere
* if MALLOC should block. * if MALLOC should block.
*/ */
MALLOC(unp, struct unionfs_node *, sizeof(struct unionfs_node), unp = malloc(sizeof(struct unionfs_node),
M_UNIONFSNODE, M_WAITOK | M_ZERO); M_UNIONFSNODE, M_WAITOK | M_ZERO);
error = getnewvnode("unionfs", mp, &unionfs_vnodeops, &vp); error = getnewvnode("unionfs", mp, &unionfs_vnodeops, &vp);
if (error != 0) { if (error != 0) {
FREE(unp, M_UNIONFSNODE); free(unp, M_UNIONFSNODE);
return (error); return (error);
} }
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) { if (error != 0) {
FREE(unp, M_UNIONFSNODE); free(unp, M_UNIONFSNODE);
return (error); return (error);
} }
if (dvp != NULLVP) if (dvp != NULLVP)
@ -415,7 +415,7 @@ unionfs_noderem(struct vnode *vp, struct thread *td)
LIST_REMOVE(unsp, uns_list); LIST_REMOVE(unsp, uns_list);
free(unsp, M_TEMP); free(unsp, M_TEMP);
} }
FREE(unp, M_UNIONFSNODE); free(unp, M_UNIONFSNODE);
} }
/* /*
@ -440,8 +440,7 @@ unionfs_get_node_status(struct unionfs_node *unp, struct thread *td,
} }
/* create a new unionfs node status */ /* create a new unionfs node status */
MALLOC(unsp, struct unionfs_node_status *, unsp = malloc( sizeof(struct unionfs_node_status), M_TEMP, M_WAITOK | M_ZERO);
sizeof(struct unionfs_node_status), M_TEMP, M_WAITOK | M_ZERO);
unsp->uns_pid = pid; unsp->uns_pid = pid;
LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list); LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list);

View File

@ -409,7 +409,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
} }
bap = (int32_t *)bp->b_data; bap = (int32_t *)bp->b_data;
MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, M_WAITOK); copy = malloc(fs->s_blocksize, M_TEMP, M_WAITOK);
bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize);
bzero((caddr_t)&bap[last + 1], bzero((caddr_t)&bap[last + 1],
(u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t));
@ -451,7 +451,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
blocksreleased += blkcount; blocksreleased += blkcount;
} }
} }
FREE(copy, M_TEMP); free(copy, M_TEMP);
*countp = blocksreleased; *countp = blocksreleased;
return (allerror); return (allerror);
} }
@ -521,7 +521,7 @@ ext2_reclaim(ap)
ext2_update(vp, 0); ext2_update(vp, 0);
} }
vfs_hash_remove(vp); vfs_hash_remove(vp);
FREE(vp->v_data, M_EXT2NODE); free(vp->v_data, M_EXT2NODE);
vp->v_data = 0; vp->v_data = 0;
vnode_destroy_vobject(vp); vnode_destroy_vobject(vp);
return (0); return (0);

View File

@ -177,7 +177,7 @@ ext2_readdir(ap)
auio.uio_resid = count; auio.uio_resid = count;
auio.uio_segflg = UIO_SYSSPACE; auio.uio_segflg = UIO_SYSSPACE;
aiov.iov_len = count; aiov.iov_len = count;
MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK); dirbuf = malloc(count, M_TEMP, M_WAITOK);
aiov.iov_base = dirbuf; aiov.iov_base = dirbuf;
error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred); error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred);
if (error == 0) { if (error == 0) {
@ -237,7 +237,7 @@ ext2_readdir(ap)
if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
panic("ext2_readdir: unexpected uio from NFS server"); panic("ext2_readdir: unexpected uio from NFS server");
MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, cookies = malloc(ncookies * sizeof(u_long), M_TEMP,
M_WAITOK); M_WAITOK);
off = startoffset; off = startoffset;
for (dp = (struct ext2_dir_entry_2 *)dirbuf, for (dp = (struct ext2_dir_entry_2 *)dirbuf,
@ -251,7 +251,7 @@ ext2_readdir(ap)
*ap->a_cookies = cookies; *ap->a_cookies = cookies;
} }
} }
FREE(dirbuf, M_TEMP); free(dirbuf, M_TEMP);
if (ap->a_eofflag) if (ap->a_eofflag)
*ap->a_eofflag = VTOI(ap->a_vp)->i_size <= uio->uio_offset; *ap->a_eofflag = VTOI(ap->a_vp)->i_size <= uio->uio_offset;
return (error); return (error);

View File

@ -964,7 +964,7 @@ ext2_vget(mp, ino, flags, vpp)
dev = ump->um_dev; dev = ump->um_dev;
/* /*
* If this MALLOC() is performed after the getnewvnode() * If this malloc() is performed after the getnewvnode()
* it might block, leaving a vnode with a NULL v_data to be * it might block, leaving a vnode with a NULL v_data to be
* found by ext2_sync() if a sync happens to fire right then, * found by ext2_sync() if a sync happens to fire right then,
* which will cause a panic because ext2_sync() blindly * which will cause a panic because ext2_sync() blindly

View File

@ -157,7 +157,7 @@ reiserfs_reclaim(struct vop_reclaim_args *ap)
vfs_hash_remove(vp); vfs_hash_remove(vp);
reiserfs_log(LOG_DEBUG, "free private data\n"); reiserfs_log(LOG_DEBUG, "free private data\n");
FREE(vp->v_data, M_REISERFSNODE); free(vp->v_data, M_REISERFSNODE);
vp->v_data = NULL; vp->v_data = NULL;
vnode_destroy_vobject(vp); vnode_destroy_vobject(vp);
@ -764,7 +764,7 @@ reiserfs_iget(
dev = rmp->rm_dev; dev = rmp->rm_dev;
/* /*
* If this MALLOC() is performed after the getnewvnode() it might * If this malloc() is performed after the getnewvnode() it might
* block, leaving a vnode with a NULL v_data to be found by * block, leaving a vnode with a NULL v_data to be found by
* reiserfs_sync() if a sync happens to fire right then, which * reiserfs_sync() if a sync happens to fire right then, which
* will cause a panic because reiserfs_sync() blindly dereferences * will cause a panic because reiserfs_sync() blindly dereferences

View File

@ -929,7 +929,7 @@ get_root_node(struct reiserfs_mount *rmp, struct reiserfs_node **root)
/* Allocate the node structure */ /* Allocate the node structure */
reiserfs_log(LOG_DEBUG, "malloc(struct reiserfs_node)\n"); reiserfs_log(LOG_DEBUG, "malloc(struct reiserfs_node)\n");
MALLOC(ip, struct reiserfs_node *, sizeof(struct reiserfs_node), ip = malloc(sizeof(struct reiserfs_node),
M_REISERFSNODE, M_WAITOK | M_ZERO); M_REISERFSNODE, M_WAITOK | M_ZERO);
/* Fill the structure */ /* Fill the structure */

View File

@ -437,14 +437,14 @@ user_ldt_alloc(struct mdproc *mdp, int len)
mtx_assert(&dt_lock, MA_OWNED); mtx_assert(&dt_lock, MA_OWNED);
mtx_unlock_spin(&dt_lock); mtx_unlock_spin(&dt_lock);
MALLOC(new_ldt, struct proc_ldt *, sizeof(struct proc_ldt), new_ldt = malloc(sizeof(struct proc_ldt),
M_SUBPROC, M_WAITOK); M_SUBPROC, M_WAITOK);
new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_len = len = NEW_MAX_LD(len);
new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map, new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
round_page(len * sizeof(union descriptor))); round_page(len * sizeof(union descriptor)));
if (new_ldt->ldt_base == NULL) { if (new_ldt->ldt_base == NULL) {
FREE(new_ldt, M_SUBPROC); free(new_ldt, M_SUBPROC);
mtx_lock_spin(&dt_lock); mtx_lock_spin(&dt_lock);
return (NULL); return (NULL);
} }
@ -474,14 +474,14 @@ user_ldt_alloc(struct mdproc *mdp, int len)
mtx_assert(&dt_lock, MA_OWNED); mtx_assert(&dt_lock, MA_OWNED);
mtx_unlock_spin(&dt_lock); mtx_unlock_spin(&dt_lock);
MALLOC(new_ldt, struct proc_ldt *, sizeof(struct proc_ldt), new_ldt = malloc(sizeof(struct proc_ldt),
M_SUBPROC, M_WAITOK); M_SUBPROC, M_WAITOK);
new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_len = len = NEW_MAX_LD(len);
new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map, new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
len * sizeof(union descriptor)); len * sizeof(union descriptor));
if (new_ldt->ldt_base == NULL) { if (new_ldt->ldt_base == NULL) {
FREE(new_ldt, M_SUBPROC); free(new_ldt, M_SUBPROC);
mtx_lock_spin(&dt_lock); mtx_lock_spin(&dt_lock);
return (NULL); return (NULL);
} }
@ -538,7 +538,7 @@ user_ldt_deref(struct proc_ldt *pldt)
mtx_unlock_spin(&dt_lock); mtx_unlock_spin(&dt_lock);
kmem_free(kernel_map, (vm_offset_t)pldt->ldt_base, kmem_free(kernel_map, (vm_offset_t)pldt->ldt_base,
pldt->ldt_len * sizeof(union descriptor)); pldt->ldt_len * sizeof(union descriptor));
FREE(pldt, M_SUBPROC); free(pldt, M_SUBPROC);
} else } else
mtx_unlock_spin(&dt_lock); mtx_unlock_spin(&dt_lock);
} }
@ -815,7 +815,7 @@ i386_ldt_grow(struct thread *td, int len)
kmem_free(kernel_map, kmem_free(kernel_map,
(vm_offset_t)new_ldt->ldt_base, (vm_offset_t)new_ldt->ldt_base,
new_ldt->ldt_len * sizeof(union descriptor)); new_ldt->ldt_len * sizeof(union descriptor));
FREE(new_ldt, M_SUBPROC); free(new_ldt, M_SUBPROC);
mtx_lock_spin(&dt_lock); mtx_lock_spin(&dt_lock);
return (0); return (0);
} }
@ -848,7 +848,7 @@ i386_ldt_grow(struct thread *td, int len)
if (old_ldt_base != NULL_LDT_BASE) { if (old_ldt_base != NULL_LDT_BASE) {
kmem_free(kernel_map, (vm_offset_t)old_ldt_base, kmem_free(kernel_map, (vm_offset_t)old_ldt_base,
old_ldt_len * sizeof(union descriptor)); old_ldt_len * sizeof(union descriptor));
FREE(new_ldt, M_SUBPROC); free(new_ldt, M_SUBPROC);
} }
mtx_lock_spin(&dt_lock); mtx_lock_spin(&dt_lock);
} }

View File

@ -165,7 +165,7 @@ ssccreate(int unit)
if (sc->unit == unit) if (sc->unit == unit)
return (NULL); return (NULL);
} }
MALLOC(sc, struct ssc_s *,sizeof(*sc), M_SSC, M_WAITOK | M_ZERO); sc = malloc(sizeof(*sc), M_SSC, M_WAITOK | M_ZERO);
LIST_INSERT_HEAD(&ssc_softc_list, sc, list); LIST_INSERT_HEAD(&ssc_softc_list, sc, list);
sc->unit = unit; sc->unit = unit;
bioq_init(&sc->bio_queue); bioq_init(&sc->bio_queue);

View File

@ -852,7 +852,7 @@ funsetown(struct sigio **sigiop)
} }
SIGIO_UNLOCK(); SIGIO_UNLOCK();
crfree(sigio->sio_ucred); crfree(sigio->sio_ucred);
FREE(sigio, M_SIGIO); free(sigio, M_SIGIO);
} }
/* /*
@ -910,7 +910,7 @@ funsetownlst(struct sigiolst *sigiolst)
} }
SIGIO_UNLOCK(); SIGIO_UNLOCK();
crfree(sigio->sio_ucred); crfree(sigio->sio_ucred);
FREE(sigio, M_SIGIO); free(sigio, M_SIGIO);
SIGIO_LOCK(); SIGIO_LOCK();
} }
SIGIO_UNLOCK(); SIGIO_UNLOCK();
@ -938,7 +938,7 @@ fsetown(pid_t pgid, struct sigio **sigiop)
ret = 0; ret = 0;
/* Allocate and fill in the new sigio out of locks. */ /* Allocate and fill in the new sigio out of locks. */
MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, M_WAITOK); sigio = malloc(sizeof(struct sigio), M_SIGIO, M_WAITOK);
sigio->sio_pgid = pgid; sigio->sio_pgid = pgid;
sigio->sio_ucred = crhold(curthread->td_ucred); sigio->sio_ucred = crhold(curthread->td_ucred);
sigio->sio_myref = sigiop; sigio->sio_myref = sigiop;
@ -1020,7 +1020,7 @@ fsetown(pid_t pgid, struct sigio **sigiop)
fail: fail:
sx_sunlock(&proctree_lock); sx_sunlock(&proctree_lock);
crfree(sigio->sio_ucred); crfree(sigio->sio_ucred);
FREE(sigio, M_SIGIO); free(sigio, M_SIGIO);
return (ret); return (ret);
} }
@ -1287,11 +1287,11 @@ fdgrowtable(struct filedesc *fdp, int nfd)
/* allocate a new table and (if required) new bitmaps */ /* allocate a new table and (if required) new bitmaps */
FILEDESC_XUNLOCK(fdp); FILEDESC_XUNLOCK(fdp);
MALLOC(ntable, struct file **, nnfiles * OFILESIZE, ntable = malloc(nnfiles * OFILESIZE,
M_FILEDESC, M_ZERO | M_WAITOK); M_FILEDESC, M_ZERO | M_WAITOK);
nfileflags = (char *)&ntable[nnfiles]; nfileflags = (char *)&ntable[nnfiles];
if (NDSLOTS(nnfiles) > NDSLOTS(onfiles)) if (NDSLOTS(nnfiles) > NDSLOTS(onfiles))
MALLOC(nmap, NDSLOTTYPE *, NDSLOTS(nnfiles) * NDSLOTSIZE, nmap = malloc(NDSLOTS(nnfiles) * NDSLOTSIZE,
M_FILEDESC, M_ZERO | M_WAITOK); M_FILEDESC, M_ZERO | M_WAITOK);
else else
nmap = NULL; nmap = NULL;
@ -1521,7 +1521,7 @@ fddrop(struct filedesc *fdp)
return; return;
FILEDESC_LOCK_DESTROY(fdp); FILEDESC_LOCK_DESTROY(fdp);
FREE(fdp, M_FILEDESC); free(fdp, M_FILEDESC);
} }
/* /*
@ -1696,7 +1696,7 @@ fdfree(struct thread *td)
td->td_proc->p_fdtol = NULL; td->td_proc->p_fdtol = NULL;
FILEDESC_XUNLOCK(fdp); FILEDESC_XUNLOCK(fdp);
if (fdtol != NULL) if (fdtol != NULL)
FREE(fdtol, M_FILEDESC_TO_LEADER); free(fdtol, M_FILEDESC_TO_LEADER);
} }
FILEDESC_XLOCK(fdp); FILEDESC_XLOCK(fdp);
i = --fdp->fd_refcnt; i = --fdp->fd_refcnt;
@ -1720,9 +1720,9 @@ fdfree(struct thread *td)
mtx_unlock(&fdesc_mtx); mtx_unlock(&fdesc_mtx);
if (fdp->fd_nfiles > NDFILE) if (fdp->fd_nfiles > NDFILE)
FREE(fdp->fd_ofiles, M_FILEDESC); free(fdp->fd_ofiles, M_FILEDESC);
if (NDSLOTS(fdp->fd_nfiles) > NDSLOTS(NDFILE)) if (NDSLOTS(fdp->fd_nfiles) > NDSLOTS(NDFILE))
FREE(fdp->fd_map, M_FILEDESC); free(fdp->fd_map, M_FILEDESC);
fdp->fd_nfiles = 0; fdp->fd_nfiles = 0;
@ -2409,8 +2409,7 @@ filedesc_to_leader_alloc(struct filedesc_to_leader *old, struct filedesc *fdp, s
{ {
struct filedesc_to_leader *fdtol; struct filedesc_to_leader *fdtol;
MALLOC(fdtol, struct filedesc_to_leader *, fdtol = malloc( sizeof(struct filedesc_to_leader),
sizeof(struct filedesc_to_leader),
M_FILEDESC_TO_LEADER, M_FILEDESC_TO_LEADER,
M_WAITOK); M_WAITOK);
fdtol->fdl_refcount = 1; fdtol->fdl_refcount = 1;

View File

@ -529,7 +529,7 @@ filt_timerattach(struct knote *kn)
kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_flags |= EV_CLEAR; /* automatically set */
kn->kn_status &= ~KN_DETACHED; /* knlist_add usually sets it */ kn->kn_status &= ~KN_DETACHED; /* knlist_add usually sets it */
MALLOC(calloutp, struct callout *, sizeof(*calloutp), calloutp = malloc(sizeof(*calloutp),
M_KQUEUE, M_WAITOK); M_KQUEUE, M_WAITOK);
callout_init(calloutp, CALLOUT_MPSAFE); callout_init(calloutp, CALLOUT_MPSAFE);
kn->kn_hook = calloutp; kn->kn_hook = calloutp;
@ -547,7 +547,7 @@ filt_timerdetach(struct knote *kn)
calloutp = (struct callout *)kn->kn_hook; calloutp = (struct callout *)kn->kn_hook;
callout_drain(calloutp); callout_drain(calloutp);
FREE(calloutp, M_KQUEUE); free(calloutp, M_KQUEUE);
atomic_add_int(&kq_ncallouts, -1); atomic_add_int(&kq_ncallouts, -1);
kn->kn_status |= KN_DETACHED; /* knlist_remove usually clears it */ kn->kn_status |= KN_DETACHED; /* knlist_remove usually clears it */
} }
@ -1109,19 +1109,18 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
size = kq->kq_knlistsize; size = kq->kq_knlistsize;
while (size <= fd) while (size <= fd)
size += KQEXTENT; size += KQEXTENT;
MALLOC(list, struct klist *, list = malloc( size * sizeof list, M_KQUEUE, mflag);
size * sizeof list, M_KQUEUE, mflag);
if (list == NULL) if (list == NULL)
return ENOMEM; return ENOMEM;
KQ_LOCK(kq); KQ_LOCK(kq);
if (kq->kq_knlistsize > fd) { if (kq->kq_knlistsize > fd) {
FREE(list, M_KQUEUE); free(list, M_KQUEUE);
list = NULL; list = NULL;
} else { } else {
if (kq->kq_knlist != NULL) { if (kq->kq_knlist != NULL) {
bcopy(kq->kq_knlist, list, bcopy(kq->kq_knlist, list,
kq->kq_knlistsize * sizeof list); kq->kq_knlistsize * sizeof list);
FREE(kq->kq_knlist, M_KQUEUE); free(kq->kq_knlist, M_KQUEUE);
kq->kq_knlist = NULL; kq->kq_knlist = NULL;
} }
bzero((caddr_t)list + bzero((caddr_t)list +

View File

@ -137,7 +137,7 @@ jail(struct thread *td, struct jail_args *uap)
if (j.version != 0) if (j.version != 0)
return (EINVAL); return (EINVAL);
MALLOC(pr, struct prison *, sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO);
mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF);
pr->pr_ref = 1; pr->pr_ref = 1;
error = copyinstr(j.path, &pr->pr_path, sizeof(pr->pr_path), 0); error = copyinstr(j.path, &pr->pr_path, sizeof(pr->pr_path), 0);
@ -211,13 +211,13 @@ jail(struct thread *td, struct jail_args *uap)
sx_sunlock(&allprison_lock); sx_sunlock(&allprison_lock);
e_dropvnref: e_dropvnref:
if (pr->pr_slots != NULL) if (pr->pr_slots != NULL)
FREE(pr->pr_slots, M_PRISON); free(pr->pr_slots, M_PRISON);
vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount); vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount);
vrele(pr->pr_root); vrele(pr->pr_root);
VFS_UNLOCK_GIANT(vfslocked); VFS_UNLOCK_GIANT(vfslocked);
e_killmtx: e_killmtx:
mtx_destroy(&pr->pr_mtx); mtx_destroy(&pr->pr_mtx);
FREE(pr, M_PRISON); free(pr, M_PRISON);
return (error); return (error);
} }
@ -343,7 +343,7 @@ prison_complete(void *context, int pending)
} }
sx_sunlock(&allprison_lock); sx_sunlock(&allprison_lock);
if (pr->pr_slots != NULL) if (pr->pr_slots != NULL)
FREE(pr->pr_slots, M_PRISON); free(pr->pr_slots, M_PRISON);
vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount); vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount);
vrele(pr->pr_root); vrele(pr->pr_root);
@ -351,8 +351,8 @@ prison_complete(void *context, int pending)
mtx_destroy(&pr->pr_mtx); mtx_destroy(&pr->pr_mtx);
if (pr->pr_linux != NULL) if (pr->pr_linux != NULL)
FREE(pr->pr_linux, M_PRISON); free(pr->pr_linux, M_PRISON);
FREE(pr, M_PRISON); free(pr, M_PRISON);
} }
void void

View File

@ -1893,14 +1893,13 @@ linker_hwpmc_list_objects(void)
retry: retry:
/* allocate nmappings+1 entries */ /* allocate nmappings+1 entries */
MALLOC(hc.kobase, struct pmckern_map_in *, hc.kobase = malloc( (hc.nmappings + 1) * sizeof(struct pmckern_map_in), M_LINKER,
(hc.nmappings + 1) * sizeof(struct pmckern_map_in), M_LINKER,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
hc.nobjects = 0; hc.nobjects = 0;
if (linker_file_foreach(linker_hwpmc_list_object, &hc) != 0) { if (linker_file_foreach(linker_hwpmc_list_object, &hc) != 0) {
hc.nmappings = hc.nobjects; hc.nmappings = hc.nobjects;
FREE(hc.kobase, M_LINKER); free(hc.kobase, M_LINKER);
goto retry; goto retry;
} }

View File

@ -146,8 +146,7 @@ mtx_pool_create(const char *mtx_name, int pool_size, int opts)
mtx_name); mtx_name);
pool_size = 128; pool_size = 128;
} }
MALLOC(pool, struct mtx_pool *, pool = malloc( sizeof (struct mtx_pool) + ((pool_size - 1) * sizeof (struct mtx)),
sizeof (struct mtx_pool) + ((pool_size - 1) * sizeof (struct mtx)),
M_MTXPOOL, M_WAITOK | M_ZERO); M_MTXPOOL, M_WAITOK | M_ZERO);
mtx_pool_initialize(pool, mtx_name, pool_size, opts); mtx_pool_initialize(pool, mtx_name, pool_size, opts);
return pool; return pool;
@ -161,7 +160,7 @@ mtx_pool_destroy(struct mtx_pool **poolp)
for (i = pool->mtx_pool_size - 1; i >= 0; --i) for (i = pool->mtx_pool_size - 1; i >= 0; --i)
mtx_destroy(&pool->mtx_pool_ary[i]); mtx_destroy(&pool->mtx_pool_ary[i]);
FREE(pool, M_MTXPOOL); free(pool, M_MTXPOOL);
*poolp = NULL; *poolp = NULL;
} }
@ -208,7 +207,7 @@ mtx_pool_alloc(struct mtx_pool *pool)
* memory allocator. The lockmgr subsystem is initialized by * memory allocator. The lockmgr subsystem is initialized by
* SYSINIT(..., SI_SUB_LOCKMGR, ...). * SYSINIT(..., SI_SUB_LOCKMGR, ...).
* *
* We can't call MALLOC() to dynamically allocate the sleep pool * We can't call malloc() to dynamically allocate the sleep pool
* until after kmeminit() has been called, which is done by * until after kmeminit() has been called, which is done by
* SYSINIT(..., SI_SUB_KMEM, ...). * SYSINIT(..., SI_SUB_KMEM, ...).
*/ */

View File

@ -509,7 +509,7 @@ pgdelete(pgrp)
} }
mtx_destroy(&pgrp->pg_mtx); mtx_destroy(&pgrp->pg_mtx);
FREE(pgrp, M_PGRP); free(pgrp, M_PGRP);
sess_release(savesess); sess_release(savesess);
} }
@ -629,7 +629,7 @@ sess_release(struct session *s)
tty_rel_sess(s->s_ttyp, s); tty_rel_sess(s->s_ttyp, s);
} }
mtx_destroy(&s->s_mtx); mtx_destroy(&s->s_mtx);
FREE(s, M_SESSION); free(s, M_SESSION);
} }
} }
@ -1173,7 +1173,7 @@ pargs_alloc(int len)
{ {
struct pargs *pa; struct pargs *pa;
MALLOC(pa, struct pargs *, sizeof(struct pargs) + len, M_PARGS, pa = malloc(sizeof(struct pargs) + len, M_PARGS,
M_WAITOK); M_WAITOK);
refcount_init(&pa->ar_ref, 1); refcount_init(&pa->ar_ref, 1);
pa->ar_length = len; pa->ar_length = len;
@ -1184,7 +1184,7 @@ static void
pargs_free(struct pargs *pa) pargs_free(struct pargs *pa)
{ {
FREE(pa, M_PARGS); free(pa, M_PARGS);
} }
void void

View File

@ -326,8 +326,8 @@ setsid(register struct thread *td, struct setsid_args *uap)
error = 0; error = 0;
pgrp = NULL; pgrp = NULL;
MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); newpgrp = malloc(sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO); newsess = malloc(sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO);
sx_xlock(&proctree_lock); sx_xlock(&proctree_lock);
@ -345,9 +345,9 @@ setsid(register struct thread *td, struct setsid_args *uap)
sx_xunlock(&proctree_lock); sx_xunlock(&proctree_lock);
if (newpgrp != NULL) if (newpgrp != NULL)
FREE(newpgrp, M_PGRP); free(newpgrp, M_PGRP);
if (newsess != NULL) if (newsess != NULL)
FREE(newsess, M_SESSION); free(newsess, M_SESSION);
return (error); return (error);
} }
@ -386,7 +386,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap)
error = 0; error = 0;
MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); newpgrp = malloc(sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
sx_xlock(&proctree_lock); sx_xlock(&proctree_lock);
if (uap->pid != 0 && uap->pid != curp->p_pid) { if (uap->pid != 0 && uap->pid != curp->p_pid) {
@ -450,7 +450,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap)
KASSERT((error == 0) || (newpgrp != NULL), KASSERT((error == 0) || (newpgrp != NULL),
("setpgid failed and newpgrp is NULL")); ("setpgid failed and newpgrp is NULL"));
if (newpgrp != NULL) if (newpgrp != NULL)
FREE(newpgrp, M_PGRP); free(newpgrp, M_PGRP);
return (error); return (error);
} }
@ -1778,7 +1778,7 @@ crget(void)
{ {
register struct ucred *cr; register struct ucred *cr;
MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO); cr = malloc(sizeof(*cr), M_CRED, M_WAITOK | M_ZERO);
refcount_init(&cr->cr_ref, 1); refcount_init(&cr->cr_ref, 1);
#ifdef AUDIT #ifdef AUDIT
audit_cred_init(cr); audit_cred_init(cr);
@ -1830,7 +1830,7 @@ crfree(struct ucred *cr)
#ifdef MAC #ifdef MAC
mac_cred_destroy(cr); mac_cred_destroy(cr);
#endif #endif
FREE(cr, M_CRED); free(cr, M_CRED);
} }
} }

View File

@ -1268,7 +1268,7 @@ uifree(uip)
if (uip->ui_proccnt != 0) if (uip->ui_proccnt != 0)
printf("freeing uidinfo: uid = %d, proccnt = %ld\n", printf("freeing uidinfo: uid = %d, proccnt = %ld\n",
uip->ui_uid, uip->ui_proccnt); uip->ui_uid, uip->ui_proccnt);
FREE(uip, M_UIDINFO); free(uip, M_UIDINFO);
return; return;
} }
/* /*

View File

@ -554,7 +554,7 @@ blst_meta_free(
int next_skip = ((u_int)skip / BLIST_META_RADIX); int next_skip = ((u_int)skip / BLIST_META_RADIX);
#if 0 #if 0
printf("FREE (%llx,%lld) FROM (%llx,%lld)\n", printf("free (%llx,%lld) FROM (%llx,%lld)\n",
(long long)freeBlk, (long long)count, (long long)freeBlk, (long long)count,
(long long)blk, (long long)radix (long long)blk, (long long)radix
); );

View File

@ -708,8 +708,7 @@ witness_initialize(void *dummy __unused)
struct witness *w, *w1; struct witness *w, *w1;
int i; int i;
MALLOC(w_data, struct witness *, w_data = malloc( sizeof (struct witness) * WITNESS_COUNT, M_WITNESS,
sizeof (struct witness) * WITNESS_COUNT, M_WITNESS,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
/* /*

View File

@ -84,7 +84,7 @@ accept_filt_add(struct accept_filter *filt)
} else { } else {
p->accf_callback = filt->accf_callback; p->accf_callback = filt->accf_callback;
ACCEPT_FILTER_UNLOCK(); ACCEPT_FILTER_UNLOCK();
FREE(filt, M_ACCF); free(filt, M_ACCF);
return (0); return (0);
} }
} }
@ -131,7 +131,7 @@ accept_filt_generic_mod_event(module_t mod, int event, void *data)
switch (event) { switch (event) {
case MOD_LOAD: case MOD_LOAD:
MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, p = malloc(sizeof(*p), M_ACCF,
M_WAITOK); M_WAITOK);
bcopy(accfp, p, sizeof(*p)); bcopy(accfp, p, sizeof(*p));
error = accept_filt_add(p); error = accept_filt_add(p);
@ -169,7 +169,7 @@ do_getopt_accept_filter(struct socket *so, struct sockopt *sopt)
int error; int error;
error = 0; error = 0;
MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, afap = malloc(sizeof(*afap), M_TEMP,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
SOCK_LOCK(so); SOCK_LOCK(so);
if ((so->so_options & SO_ACCEPTCONN) == 0) { if ((so->so_options & SO_ACCEPTCONN) == 0) {
@ -187,7 +187,7 @@ do_getopt_accept_filter(struct socket *so, struct sockopt *sopt)
SOCK_UNLOCK(so); SOCK_UNLOCK(so);
if (error == 0) if (error == 0)
error = sooptcopyout(sopt, afap, sizeof(*afap)); error = sooptcopyout(sopt, afap, sizeof(*afap));
FREE(afap, M_TEMP); free(afap, M_TEMP);
return (error); return (error);
} }
@ -215,8 +215,8 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
af->so_accept_filter->accf_destroy(so); af->so_accept_filter->accf_destroy(so);
} }
if (af->so_accept_filter_str != NULL) if (af->so_accept_filter_str != NULL)
FREE(af->so_accept_filter_str, M_ACCF); free(af->so_accept_filter_str, M_ACCF);
FREE(af, M_ACCF); free(af, M_ACCF);
so->so_accf = NULL; so->so_accf = NULL;
} }
so->so_options &= ~SO_ACCEPTFILTER; so->so_options &= ~SO_ACCEPTFILTER;
@ -228,18 +228,18 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
* Pre-allocate any memory we may need later to avoid blocking at * Pre-allocate any memory we may need later to avoid blocking at
* untimely moments. This does not optimize for invalid arguments. * untimely moments. This does not optimize for invalid arguments.
*/ */
MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, afap = malloc(sizeof(*afap), M_TEMP,
M_WAITOK); M_WAITOK);
error = sooptcopyin(sopt, afap, sizeof *afap, sizeof *afap); error = sooptcopyin(sopt, afap, sizeof *afap, sizeof *afap);
afap->af_name[sizeof(afap->af_name)-1] = '\0'; afap->af_name[sizeof(afap->af_name)-1] = '\0';
afap->af_arg[sizeof(afap->af_arg)-1] = '\0'; afap->af_arg[sizeof(afap->af_arg)-1] = '\0';
if (error) { if (error) {
FREE(afap, M_TEMP); free(afap, M_TEMP);
return (error); return (error);
} }
afp = accept_filt_get(afap->af_name); afp = accept_filt_get(afap->af_name);
if (afp == NULL) { if (afp == NULL) {
FREE(afap, M_TEMP); free(afap, M_TEMP);
return (ENOENT); return (ENOENT);
} }
/* /*
@ -248,11 +248,11 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
* attached properly, 'newaf' is NULLed to avoid a free() * attached properly, 'newaf' is NULLed to avoid a free()
* while in use. * while in use.
*/ */
MALLOC(newaf, struct so_accf *, sizeof(*newaf), M_ACCF, M_WAITOK | newaf = malloc(sizeof(*newaf), M_ACCF, M_WAITOK |
M_ZERO); M_ZERO);
if (afp->accf_create != NULL && afap->af_name[0] != '\0') { if (afp->accf_create != NULL && afap->af_name[0] != '\0') {
int len = strlen(afap->af_name) + 1; int len = strlen(afap->af_name) + 1;
MALLOC(newaf->so_accept_filter_str, char *, len, M_ACCF, newaf->so_accept_filter_str = malloc(len, M_ACCF,
M_WAITOK); M_WAITOK);
strcpy(newaf->so_accept_filter_str, afap->af_name); strcpy(newaf->so_accept_filter_str, afap->af_name);
} }
@ -289,10 +289,10 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
SOCK_UNLOCK(so); SOCK_UNLOCK(so);
if (newaf != NULL) { if (newaf != NULL) {
if (newaf->so_accept_filter_str != NULL) if (newaf->so_accept_filter_str != NULL)
FREE(newaf->so_accept_filter_str, M_ACCF); free(newaf->so_accept_filter_str, M_ACCF);
FREE(newaf, M_ACCF); free(newaf, M_ACCF);
} }
if (afap != NULL) if (afap != NULL)
FREE(afap, M_TEMP); free(afap, M_TEMP);
return (error); return (error);
} }

View File

@ -1545,7 +1545,7 @@ mqueue_free(struct mqueue *mq)
while ((msg = TAILQ_FIRST(&mq->mq_msgq)) != NULL) { while ((msg = TAILQ_FIRST(&mq->mq_msgq)) != NULL) {
TAILQ_REMOVE(&mq->mq_msgq, msg, msg_link); TAILQ_REMOVE(&mq->mq_msgq, msg, msg_link);
FREE(msg, M_MQUEUEDATA); free(msg, M_MQUEUEDATA);
} }
mtx_destroy(&mq->mq_mutex); mtx_destroy(&mq->mq_mutex);
@ -1566,11 +1566,11 @@ mqueue_loadmsg(const char *msg_ptr, size_t msg_size, int msg_prio)
int error; int error;
len = sizeof(struct mqueue_msg) + msg_size; len = sizeof(struct mqueue_msg) + msg_size;
MALLOC(msg, struct mqueue_msg *, len, M_MQUEUEDATA, M_WAITOK); msg = malloc(len, M_MQUEUEDATA, M_WAITOK);
error = copyin(msg_ptr, ((char *)msg) + sizeof(struct mqueue_msg), error = copyin(msg_ptr, ((char *)msg) + sizeof(struct mqueue_msg),
msg_size); msg_size);
if (error) { if (error) {
FREE(msg, M_MQUEUEDATA); free(msg, M_MQUEUEDATA);
msg = NULL; msg = NULL;
} else { } else {
msg->msg_size = msg_size; msg->msg_size = msg_size;
@ -1600,7 +1600,7 @@ mqueue_savemsg(struct mqueue_msg *msg, char *msg_ptr, int *msg_prio)
static __inline void static __inline void
mqueue_freemsg(struct mqueue_msg *msg) mqueue_freemsg(struct mqueue_msg *msg)
{ {
FREE(msg, M_MQUEUEDATA); free(msg, M_MQUEUEDATA);
} }
/* /*

View File

@ -457,7 +457,7 @@ kern_accept(struct thread *td, int s, struct sockaddr **name,
} }
noconnection: noconnection:
if (sa) if (sa)
FREE(sa, M_SONAME); free(sa, M_SONAME);
/* /*
* close the new descriptor, assuming someone hasn't ripped it * close the new descriptor, assuming someone hasn't ripped it
@ -720,7 +720,7 @@ sendit(td, s, mp, flags)
bad: bad:
if (to) if (to)
FREE(to, M_SONAME); free(to, M_SONAME);
return (error); return (error);
} }
@ -1068,7 +1068,7 @@ kern_recvit(td, s, mp, fromseg, controlp)
ktrsockaddr(fromsa); ktrsockaddr(fromsa);
#endif #endif
if (fromsa) if (fromsa)
FREE(fromsa, M_SONAME); free(fromsa, M_SONAME);
if (error == 0 && controlp != NULL) if (error == 0 && controlp != NULL)
*controlp = control; *controlp = control;
@ -1661,10 +1661,10 @@ getsockaddr(namp, uaddr, len)
return (ENAMETOOLONG); return (ENAMETOOLONG);
if (len < offsetof(struct sockaddr, sa_data[0])) if (len < offsetof(struct sockaddr, sa_data[0]))
return (EINVAL); return (EINVAL);
MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK); sa = malloc(len, M_SONAME, M_WAITOK);
error = copyin(uaddr, sa, len); error = copyin(uaddr, sa, len);
if (error) { if (error) {
FREE(sa, M_SONAME); free(sa, M_SONAME);
} else { } else {
#if defined(COMPAT_OLDSOCK) && BYTE_ORDER != BIG_ENDIAN #if defined(COMPAT_OLDSOCK) && BYTE_ORDER != BIG_ENDIAN
if (sa->sa_family == 0 && sa->sa_len < AF_MAX) if (sa->sa_family == 0 && sa->sa_len < AF_MAX)

View File

@ -600,7 +600,7 @@ uipc_detach(struct socket *so)
unp->unp_refcount--; unp->unp_refcount--;
freeunp = (unp->unp_refcount == 0); freeunp = (unp->unp_refcount == 0);
if (saved_unp_addr != NULL) if (saved_unp_addr != NULL)
FREE(saved_unp_addr, M_SONAME); free(saved_unp_addr, M_SONAME);
if (freeunp) { if (freeunp) {
UNP_PCB_LOCK_DESTROY(unp); UNP_PCB_LOCK_DESTROY(unp);
uma_zfree(unp_zone, unp); uma_zfree(unp_zone, unp);

View File

@ -330,7 +330,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep,
if (nfs_pub.np_valid) { if (nfs_pub.np_valid) {
nfs_pub.np_valid = 0; nfs_pub.np_valid = 0;
if (nfs_pub.np_index != NULL) { if (nfs_pub.np_index != NULL) {
FREE(nfs_pub.np_index, M_TEMP); free(nfs_pub.np_index, M_TEMP);
nfs_pub.np_index = NULL; nfs_pub.np_index = NULL;
} }
} }
@ -361,7 +361,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep,
* If an indexfile was specified, pull it in. * If an indexfile was specified, pull it in.
*/ */
if (argp->ex_indexfile != NULL) { if (argp->ex_indexfile != NULL) {
MALLOC(nfs_pub.np_index, char *, MAXNAMLEN + 1, M_TEMP, nfs_pub.np_index = malloc(MAXNAMLEN + 1, M_TEMP,
M_WAITOK); M_WAITOK);
error = copyinstr(argp->ex_indexfile, nfs_pub.np_index, error = copyinstr(argp->ex_indexfile, nfs_pub.np_index,
MAXNAMLEN, (size_t *)0); MAXNAMLEN, (size_t *)0);
@ -377,7 +377,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep,
} }
} }
if (error) { if (error) {
FREE(nfs_pub.np_index, M_TEMP); free(nfs_pub.np_index, M_TEMP);
return (error); return (error);
} }
} }

View File

@ -3928,7 +3928,7 @@ ogetdirentries(td, uap)
kuio.uio_iov = &kiov; kuio.uio_iov = &kiov;
kuio.uio_segflg = UIO_SYSSPACE; kuio.uio_segflg = UIO_SYSSPACE;
kiov.iov_len = uap->count; kiov.iov_len = uap->count;
MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK); dirbuf = malloc(uap->count, M_TEMP, M_WAITOK);
kiov.iov_base = dirbuf; kiov.iov_base = dirbuf;
error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag, error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag,
NULL, NULL); NULL, NULL);
@ -3965,7 +3965,7 @@ ogetdirentries(td, uap)
if (dp >= edp) if (dp >= edp)
error = uiomove(dirbuf, readcnt, &auio); error = uiomove(dirbuf, readcnt, &auio);
} }
FREE(dirbuf, M_TEMP); free(dirbuf, M_TEMP);
} }
if (error) { if (error) {
VOP_UNLOCK(vp, 0); VOP_UNLOCK(vp, 0);

View File

@ -619,7 +619,7 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td)
struct bpf_d *d; struct bpf_d *d;
int error; int error;
MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO); d = malloc(sizeof(*d), M_BPF, M_WAITOK | M_ZERO);
error = devfs_set_cdevpriv(d, bpf_dtor); error = devfs_set_cdevpriv(d, bpf_dtor);
if (error != 0) { if (error != 0) {
free(d, M_BPF); free(d, M_BPF);

View File

@ -346,7 +346,7 @@ bsd_alloc(options, opt_len, decomp)
maxmaxcode = MAXCODE(bits); maxmaxcode = MAXCODE(bits);
newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0])); newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0]));
MALLOC(db, struct bsd_db *, newlen, M_DEVBUF, M_NOWAIT); db = malloc(newlen, M_DEVBUF, M_NOWAIT);
if (!db) if (!db)
return NULL; return NULL;
bzero(db, sizeof(*db) - sizeof(db->dict)); bzero(db, sizeof(*db) - sizeof(db->dict));
@ -354,7 +354,7 @@ bsd_alloc(options, opt_len, decomp)
if (!decomp) { if (!decomp) {
db->lens = NULL; db->lens = NULL;
} else { } else {
MALLOC(db->lens, u_int16_t *, (maxmaxcode+1) * sizeof(db->lens[0]), db->lens = malloc((maxmaxcode+1) * sizeof(db->lens[0]),
M_DEVBUF, M_NOWAIT); M_DEVBUF, M_NOWAIT);
if (!db->lens) { if (!db->lens) {
free(db, M_DEVBUF); free(db, M_DEVBUF);

View File

@ -2299,14 +2299,14 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa,
struct ifmultiaddr *ifma; struct ifmultiaddr *ifma;
struct sockaddr *dupsa; struct sockaddr *dupsa;
MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, mflags | ifma = malloc(sizeof *ifma, M_IFMADDR, mflags |
M_ZERO); M_ZERO);
if (ifma == NULL) if (ifma == NULL)
return (NULL); return (NULL);
MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, mflags); dupsa = malloc(sa->sa_len, M_IFMADDR, mflags);
if (dupsa == NULL) { if (dupsa == NULL) {
FREE(ifma, M_IFMADDR); free(ifma, M_IFMADDR);
return (NULL); return (NULL);
} }
bcopy(sa, dupsa, sa->sa_len); bcopy(sa, dupsa, sa->sa_len);
@ -2321,10 +2321,10 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa,
return (ifma); return (ifma);
} }
MALLOC(dupsa, struct sockaddr *, llsa->sa_len, M_IFMADDR, mflags); dupsa = malloc(llsa->sa_len, M_IFMADDR, mflags);
if (dupsa == NULL) { if (dupsa == NULL) {
FREE(ifma->ifma_addr, M_IFMADDR); free(ifma->ifma_addr, M_IFMADDR);
FREE(ifma, M_IFMADDR); free(ifma, M_IFMADDR);
return (NULL); return (NULL);
} }
bcopy(llsa, dupsa, llsa->sa_len); bcopy(llsa, dupsa, llsa->sa_len);
@ -2349,9 +2349,9 @@ if_freemulti(struct ifmultiaddr *ifma)
("if_freemulti: protospec not NULL")); ("if_freemulti: protospec not NULL"));
if (ifma->ifma_lladdr != NULL) if (ifma->ifma_lladdr != NULL)
FREE(ifma->ifma_lladdr, M_IFMADDR); free(ifma->ifma_lladdr, M_IFMADDR);
FREE(ifma->ifma_addr, M_IFMADDR); free(ifma->ifma_addr, M_IFMADDR);
FREE(ifma, M_IFMADDR); free(ifma, M_IFMADDR);
} }
/* /*
@ -2469,13 +2469,13 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa,
} }
if (llsa != NULL) if (llsa != NULL)
FREE(llsa, M_IFMADDR); free(llsa, M_IFMADDR);
return (0); return (0);
free_llsa_out: free_llsa_out:
if (llsa != NULL) if (llsa != NULL)
FREE(llsa, M_IFMADDR); free(llsa, M_IFMADDR);
unlock_out: unlock_out:
IF_ADDR_UNLOCK(ifp); IF_ADDR_UNLOCK(ifp);

View File

@ -778,7 +778,7 @@ arc_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
sin = (struct sockaddr_in *)sa; sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return EADDRNOTAVAIL; return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return ENOMEM; return ENOMEM;
@ -806,7 +806,7 @@ arc_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
} }
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return EADDRNOTAVAIL; return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return ENOMEM; return ENOMEM;

View File

@ -1124,7 +1124,7 @@ ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
sin = (struct sockaddr_in *)sa; sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return EADDRNOTAVAIL; return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO); M_NOWAIT|M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return ENOMEM; return ENOMEM;
@ -1153,7 +1153,7 @@ ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
} }
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return EADDRNOTAVAIL; return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO); M_NOWAIT|M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return (ENOMEM); return (ENOMEM);

View File

@ -718,7 +718,7 @@ fddi_resolvemulti(ifp, llsa, sa)
sin = (struct sockaddr_in *)sa; sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return (EADDRNOTAVAIL); return (EADDRNOTAVAIL);
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return (ENOMEM); return (ENOMEM);
@ -749,7 +749,7 @@ fddi_resolvemulti(ifp, llsa, sa)
} }
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return (EADDRNOTAVAIL); return (EADDRNOTAVAIL);
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO); M_NOWAIT | M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return (ENOMEM); return (ENOMEM);

View File

@ -720,7 +720,7 @@ iso88025_resolvemulti (ifp, llsa, sa)
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
return (EADDRNOTAVAIL); return (EADDRNOTAVAIL);
} }
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO); M_NOWAIT|M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return (ENOMEM); return (ENOMEM);
@ -750,7 +750,7 @@ iso88025_resolvemulti (ifp, llsa, sa)
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
return (EADDRNOTAVAIL); return (EADDRNOTAVAIL);
} }
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO); M_NOWAIT|M_ZERO);
if (sdl == NULL) if (sdl == NULL)
return (ENOMEM); return (ENOMEM);

View File

@ -348,7 +348,7 @@ pppalloc(pid)
sc->sc_relinq = NULL; sc->sc_relinq = NULL;
bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats)); bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats));
#ifdef VJC #ifdef VJC
MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress), sc->sc_comp = malloc(sizeof(struct slcompress),
M_DEVBUF, M_NOWAIT); M_DEVBUF, M_NOWAIT);
if (sc->sc_comp) if (sc->sc_comp)
sl_compress_init(sc->sc_comp, -1); sl_compress_init(sc->sc_comp, -1);
@ -614,7 +614,7 @@ pppioctl(sc, cmd, data, flag, td)
} }
newcodelen = nbp->bf_len * sizeof(struct bpf_insn); newcodelen = nbp->bf_len * sizeof(struct bpf_insn);
if (newcodelen != 0) { if (newcodelen != 0) {
MALLOC(newcode, struct bpf_insn *, newcodelen, M_DEVBUF, M_WAITOK); newcode = malloc(newcodelen, M_DEVBUF, M_WAITOK);
if (newcode == 0) { if (newcode == 0) {
error = EINVAL; /* or sumpin */ error = EINVAL; /* or sumpin */
break; break;

View File

@ -271,7 +271,7 @@ slmarkstatic(int unit)
if (slisstatic(unit)) if (slisstatic(unit))
return; return;
MALLOC(t, int *, sizeof(int) * (st_unit_max+1), M_SL, M_NOWAIT); t = malloc(sizeof(int) * (st_unit_max+1), M_SL, M_NOWAIT);
if (t == NULL) if (t == NULL)
return; return;
@ -291,7 +291,7 @@ slcreate(void)
int unit; int unit;
struct mbuf *m; struct mbuf *m;
MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_WAITOK | M_ZERO); sc = malloc(sizeof(*sc), M_SL, M_WAITOK | M_ZERO);
sc->sc_ifp = if_alloc(IFT_SLIP); sc->sc_ifp = if_alloc(IFT_SLIP);
if (sc->sc_ifp == NULL) { if (sc->sc_ifp == NULL) {
free(sc, M_SL); free(sc, M_SL);
@ -664,8 +664,7 @@ sltstart(struct tty *tp)
register u_char *cp; register u_char *cp;
if (sc->bpfbuf == NULL) if (sc->bpfbuf == NULL)
MALLOC(sc->bpfbuf, u_char *, sc->bpfbuf = malloc( SLTMAX + SLIP_HDRLEN, M_SL, M_NOWAIT);
SLTMAX + SLIP_HDRLEN, M_SL, M_NOWAIT);
if (sc->bpfbuf) { if (sc->bpfbuf) {
cp = sc->bpfbuf + SLIP_HDRLEN; cp = sc->bpfbuf + SLIP_HDRLEN;

View File

@ -412,7 +412,7 @@ tapcreate(struct cdev *dev)
dev->si_flags &= ~SI_CHEAPCLONE; dev->si_flags &= ~SI_CHEAPCLONE;
/* allocate driver storage and create device */ /* allocate driver storage and create device */
MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO); tp = malloc(sizeof(*tp), M_TAP, M_WAITOK | M_ZERO);
mtx_init(&tp->tap_mtx, "tap_mtx", NULL, MTX_DEF); mtx_init(&tp->tap_mtx, "tap_mtx", NULL, MTX_DEF);
mtx_lock(&tapmtx); mtx_lock(&tapmtx);
SLIST_INSERT_HEAD(&taphead, tp, tap_next); SLIST_INSERT_HEAD(&taphead, tp, tap_next);

View File

@ -363,7 +363,7 @@ tuncreate(const char *name, struct cdev *dev)
dev->si_flags &= ~SI_CHEAPCLONE; dev->si_flags &= ~SI_CHEAPCLONE;
MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); sc = malloc(sizeof(*sc), M_TUN, M_WAITOK | M_ZERO);
mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF); mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF);
sc->tun_flags = TUN_INITED; sc->tun_flags = TUN_INITED;
sc->tun_dev = dev; sc->tun_dev = dev;

View File

@ -126,7 +126,7 @@ z_alloc(notused, items, size)
{ {
void *ptr; void *ptr;
MALLOC(ptr, void *, items * size, M_DEVBUF, M_NOWAIT); ptr = malloc(items * size, M_DEVBUF, M_NOWAIT);
return ptr; return ptr;
} }
@ -159,7 +159,7 @@ z_comp_alloc(options, opt_len)
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL; return NULL;
MALLOC(state, struct deflate_state *, sizeof(struct deflate_state), state = malloc(sizeof(struct deflate_state),
M_DEVBUF, M_NOWAIT); M_DEVBUF, M_NOWAIT);
if (state == NULL) if (state == NULL)
return NULL; return NULL;
@ -389,7 +389,7 @@ z_decomp_alloc(options, opt_len)
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL; return NULL;
MALLOC(state, struct deflate_state *, sizeof(struct deflate_state), state = malloc(sizeof(struct deflate_state),
M_DEVBUF, M_NOWAIT); M_DEVBUF, M_NOWAIT);
if (state == NULL) if (state == NULL)
return NULL; return NULL;

View File

@ -169,7 +169,7 @@ rts_attach(struct socket *so, int proto, struct thread *td)
KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL")); KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL"));
/* XXX */ /* XXX */
MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK | M_ZERO); rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO);
if (rp == NULL) if (rp == NULL)
return ENOBUFS; return ENOBUFS;

View File

@ -99,7 +99,7 @@ acl_attach(struct ieee80211vap *vap)
{ {
struct aclstate *as; struct aclstate *as;
MALLOC(as, struct aclstate *, sizeof(struct aclstate), as = malloc(sizeof(struct aclstate),
M_80211_ACL, M_NOWAIT | M_ZERO); M_80211_ACL, M_NOWAIT | M_ZERO);
if (as == NULL) if (as == NULL)
return 0; return 0;
@ -123,7 +123,7 @@ acl_detach(struct ieee80211vap *vap)
acl_free_all(vap); acl_free_all(vap);
vap->iv_as = NULL; vap->iv_as = NULL;
ACL_LOCK_DESTROY(as); ACL_LOCK_DESTROY(as);
FREE(as, M_80211_ACL); free(as, M_80211_ACL);
} }
static __inline struct acl * static __inline struct acl *
@ -147,7 +147,7 @@ _acl_free(struct aclstate *as, struct acl *acl)
TAILQ_REMOVE(&as->as_list, acl, acl_list); TAILQ_REMOVE(&as->as_list, acl, acl_list);
LIST_REMOVE(acl, acl_hash); LIST_REMOVE(acl, acl_hash);
FREE(acl, M_80211_ACL); free(acl, M_80211_ACL);
as->as_nacls--; as->as_nacls--;
} }
@ -175,7 +175,7 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
struct acl *acl, *new; struct acl *acl, *new;
int hash; int hash;
MALLOC(new, struct acl *, sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO); new = malloc(sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO);
if (new == NULL) { if (new == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
"ACL: add %s failed, no memory\n", ether_sprintf(mac)); "ACL: add %s failed, no memory\n", ether_sprintf(mac));
@ -188,7 +188,7 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) { LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) {
if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) { if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) {
ACL_UNLOCK(as); ACL_UNLOCK(as);
FREE(new, M_80211_ACL); free(new, M_80211_ACL);
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
"ACL: add %s failed, already present\n", "ACL: add %s failed, already present\n",
ether_sprintf(mac)); ether_sprintf(mac));
@ -301,7 +301,7 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
ireq->i_len = space; /* return required space */ ireq->i_len = space; /* return required space */
return 0; /* NB: must not error */ return 0; /* NB: must not error */
} }
MALLOC(ap, struct ieee80211req_maclist *, space, ap = malloc(space,
M_TEMP, M_NOWAIT); M_TEMP, M_NOWAIT);
if (ap == NULL) if (ap == NULL)
return ENOMEM; return ENOMEM;
@ -317,7 +317,7 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
ireq->i_len = space; ireq->i_len = space;
} else } else
error = copyout(ap, ireq->i_data, ireq->i_len); error = copyout(ap, ireq->i_data, ireq->i_len);
FREE(ap, M_TEMP); free(ap, M_TEMP);
return error; return error;
} }
return EINVAL; return EINVAL;

View File

@ -96,7 +96,7 @@ ccmp_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{ {
struct ccmp_ctx *ctx; struct ccmp_ctx *ctx;
MALLOC(ctx, struct ccmp_ctx *, sizeof(struct ccmp_ctx), ctx = malloc(sizeof(struct ccmp_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO); M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) { if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++; vap->iv_stats.is_crypto_nomem++;
@ -113,7 +113,7 @@ ccmp_detach(struct ieee80211_key *k)
{ {
struct ccmp_ctx *ctx = k->wk_private; struct ccmp_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO); free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach")); KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */ nrefs--; /* NB: we assume caller locking */
} }

View File

@ -109,7 +109,7 @@ tkip_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{ {
struct tkip_ctx *ctx; struct tkip_ctx *ctx;
MALLOC(ctx, struct tkip_ctx *, sizeof(struct tkip_ctx), ctx = malloc(sizeof(struct tkip_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO); M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) { if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++; vap->iv_stats.is_crypto_nomem++;
@ -126,7 +126,7 @@ tkip_detach(struct ieee80211_key *k)
{ {
struct tkip_ctx *ctx = k->wk_private; struct tkip_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO); free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach")); KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */ nrefs--; /* NB: we assume caller locking */
} }

View File

@ -87,7 +87,7 @@ wep_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{ {
struct wep_ctx *ctx; struct wep_ctx *ctx;
MALLOC(ctx, struct wep_ctx *, sizeof(struct wep_ctx), ctx = malloc(sizeof(struct wep_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO); M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) { if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++; vap->iv_stats.is_crypto_nomem++;
@ -106,7 +106,7 @@ wep_detach(struct ieee80211_key *k)
{ {
struct wep_ctx *ctx = k->wk_private; struct wep_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO); free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach")); KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */ nrefs--; /* NB: we assume caller locking */
} }

View File

@ -234,7 +234,7 @@ ieee80211_sysctl_vattach(struct ieee80211vap *vap)
struct sysctl_oid *oid; struct sysctl_oid *oid;
char num[14]; /* sufficient for 32 bits */ char num[14]; /* sufficient for 32 bits */
MALLOC(ctx, struct sysctl_ctx_list *, sizeof(struct sysctl_ctx_list), ctx = malloc(sizeof(struct sysctl_ctx_list),
M_DEVBUF, M_NOWAIT | M_ZERO); M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctx == NULL) { if (ctx == NULL) {
if_printf(ifp, "%s: cannot allocate sysctl context!\n", if_printf(ifp, "%s: cannot allocate sysctl context!\n",
@ -310,7 +310,7 @@ ieee80211_sysctl_vdetach(struct ieee80211vap *vap)
if (vap->iv_sysctl != NULL) { if (vap->iv_sysctl != NULL) {
sysctl_ctx_free(vap->iv_sysctl); sysctl_ctx_free(vap->iv_sysctl);
FREE(vap->iv_sysctl, M_DEVBUF); free(vap->iv_sysctl, M_DEVBUF);
vap->iv_sysctl = NULL; vap->iv_sysctl = NULL;
} }
} }

View File

@ -902,7 +902,7 @@ hostap_auth_open(struct ieee80211_node *ni, struct ieee80211_frame *wh,
* open auth is attempted. * open auth is attempted.
*/ */
if (ni->ni_challenge != NULL) { if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE); free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL; ni->ni_challenge = NULL;
} }
/* XXX hack to workaround calling convention */ /* XXX hack to workaround calling convention */
@ -1986,7 +1986,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
return; return;
/* discard challenge after association */ /* discard challenge after association */
if (ni->ni_challenge != NULL) { if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE); free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL; ni->ni_challenge = NULL;
} }
/* NB: 802.11 spec says to ignore station's privacy bit */ /* NB: 802.11 spec says to ignore station's privacy bit */

View File

@ -499,7 +499,7 @@ int
ieee80211_alloc_challenge(struct ieee80211_node *ni) ieee80211_alloc_challenge(struct ieee80211_node *ni)
{ {
if (ni->ni_challenge == NULL) if (ni->ni_challenge == NULL)
MALLOC(ni->ni_challenge, uint32_t*, IEEE80211_CHALLENGE_LEN, ni->ni_challenge = malloc(IEEE80211_CHALLENGE_LEN,
M_80211_NODE, M_NOWAIT); M_80211_NODE, M_NOWAIT);
if (ni->ni_challenge == NULL) { if (ni->ni_challenge == NULL) {
IEEE80211_NOTE(ni->ni_vap, IEEE80211_NOTE(ni->ni_vap,

Some files were not shown because too many files have changed in this diff Show More