diff options
Diffstat (limited to 'sys/contrib/altq/altq/altq_hfsc.c')
-rw-r--r-- | sys/contrib/altq/altq/altq_hfsc.c | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/sys/contrib/altq/altq/altq_hfsc.c b/sys/contrib/altq/altq/altq_hfsc.c index bf7a4f0..8beead7 100644 --- a/sys/contrib/altq/altq/altq_hfsc.c +++ b/sys/contrib/altq/altq/altq_hfsc.c @@ -202,7 +202,7 @@ hfsc_add_altq(struct pf_altq *a) if (!ALTQ_IS_READY(&ifp->if_snd)) return (ENODEV); - MALLOC(hif, struct hfsc_if *, sizeof(struct hfsc_if), + hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK); if (hif == NULL) return (ENOMEM); @@ -210,7 +210,7 @@ hfsc_add_altq(struct pf_altq *a) hif->hif_eligible = ellist_alloc(); if (hif->hif_eligible == NULL) { - FREE(hif, M_DEVBUF); + free(hif, M_DEVBUF); return (ENOMEM); } @@ -236,7 +236,7 @@ hfsc_remove_altq(struct pf_altq *a) ellist_destroy(hif->hif_eligible); - FREE(hif, M_DEVBUF); + free(hif, M_DEVBUF); return (0); } @@ -404,13 +404,13 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, } #endif - MALLOC(cl, struct hfsc_class *, sizeof(struct hfsc_class), + cl = malloc(sizeof(struct hfsc_class), M_DEVBUF, M_WAITOK); if (cl == NULL) return (NULL); 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); if (cl->cl_q == NULL) goto err_ret; @@ -471,8 +471,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, #endif /* ALTQ_RED */ if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0)) { - MALLOC(cl->cl_rsc, struct internal_sc *, - sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); + cl->cl_rsc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); if (cl->cl_rsc == NULL) goto err_ret; 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); } if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0)) { - MALLOC(cl->cl_fsc, struct internal_sc *, - sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); + cl->cl_fsc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); if (cl->cl_fsc == NULL) goto err_ret; sc2isc(fsc, cl->cl_fsc); rtsc_init(&cl->cl_virtual, cl->cl_fsc, 0, 0); } if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0)) { - MALLOC(cl->cl_usc, struct internal_sc *, - sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); + cl->cl_usc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); if (cl->cl_usc == NULL) goto err_ret; sc2isc(usc, cl->cl_usc); @@ -565,14 +562,14 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, #endif } if (cl->cl_fsc != NULL) - FREE(cl->cl_fsc, M_DEVBUF); + free(cl->cl_fsc, M_DEVBUF); if (cl->cl_rsc != NULL) - FREE(cl->cl_rsc, M_DEVBUF); + free(cl->cl_rsc, M_DEVBUF); if (cl->cl_usc != NULL) - FREE(cl->cl_usc, M_DEVBUF); + free(cl->cl_usc, M_DEVBUF); if (cl->cl_q != NULL) - FREE(cl->cl_q, M_DEVBUF); - FREE(cl, M_DEVBUF); + free(cl->cl_q, M_DEVBUF); + free(cl, M_DEVBUF); return (NULL); } @@ -649,13 +646,13 @@ hfsc_class_destroy(struct hfsc_class *cl) IFQ_UNLOCK(cl->cl_hif->hif_ifq); if (cl->cl_usc != NULL) - FREE(cl->cl_usc, M_DEVBUF); + free(cl->cl_usc, M_DEVBUF); if (cl->cl_fsc != NULL) - FREE(cl->cl_fsc, M_DEVBUF); + free(cl->cl_fsc, M_DEVBUF); if (cl->cl_rsc != NULL) - FREE(cl->cl_rsc, M_DEVBUF); - FREE(cl->cl_q, M_DEVBUF); - FREE(cl, M_DEVBUF); + free(cl->cl_rsc, M_DEVBUF); + free(cl->cl_q, M_DEVBUF); + free(cl, M_DEVBUF); return (0); } @@ -1203,7 +1200,7 @@ ellist_alloc(void) { 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); return (head); } @@ -1211,7 +1208,7 @@ ellist_alloc(void) static void ellist_destroy(ellist_t *head) { - FREE(head, M_DEVBUF); + free(head, M_DEVBUF); } static void @@ -1306,7 +1303,7 @@ actlist_alloc(void) { 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); return (head); } @@ -1314,7 +1311,7 @@ actlist_alloc(void) static void actlist_destroy(actlist_t *head) { - FREE(head, M_DEVBUF); + free(head, M_DEVBUF); } static void actlist_insert(struct hfsc_class *cl) @@ -1743,7 +1740,7 @@ hfsc_attach(ifq, bandwidth) { struct hfsc_if *hif; - MALLOC(hif, struct hfsc_if *, sizeof(struct hfsc_if), + hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK); if (hif == NULL) return (NULL); @@ -1751,7 +1748,7 @@ hfsc_attach(ifq, bandwidth) hif->hif_eligible = ellist_alloc(); if (hif->hif_eligible == NULL) { - FREE(hif, M_DEVBUF); + free(hif, M_DEVBUF); return NULL; } @@ -1787,7 +1784,7 @@ hfsc_detach(hif) ellist_destroy(hif->hif_eligible); - FREE(hif, M_DEVBUF); + free(hif, M_DEVBUF); return (0); } @@ -1804,22 +1801,19 @@ hfsc_class_modify(cl, rsc, fsc, usc) rsc_tmp = fsc_tmp = usc_tmp = NULL; if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0) && cl->cl_rsc == NULL) { - MALLOC(rsc_tmp, struct internal_sc *, - sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); + rsc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); if (rsc_tmp == NULL) return (ENOMEM); } if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0) && cl->cl_fsc == NULL) { - MALLOC(fsc_tmp, struct internal_sc *, - sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); + fsc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); if (fsc_tmp == NULL) return (ENOMEM); } if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) && cl->cl_usc == NULL) { - MALLOC(usc_tmp, struct internal_sc *, - sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); + usc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK); if (usc_tmp == NULL) return (ENOMEM); } @@ -1837,7 +1831,7 @@ hfsc_class_modify(cl, rsc, fsc, usc) if (cl->cl_rsc != NULL) { if (!qempty(cl->cl_q)) hfsc_purgeq(cl); - FREE(cl->cl_rsc, M_DEVBUF); + free(cl->cl_rsc, M_DEVBUF); cl->cl_rsc = NULL; } } else { @@ -1859,7 +1853,7 @@ hfsc_class_modify(cl, rsc, fsc, usc) if (cl->cl_fsc != NULL) { if (!qempty(cl->cl_q)) hfsc_purgeq(cl); - FREE(cl->cl_fsc, M_DEVBUF); + free(cl->cl_fsc, M_DEVBUF); cl->cl_fsc = NULL; } } else { @@ -1874,7 +1868,7 @@ hfsc_class_modify(cl, rsc, fsc, usc) if (usc != NULL) { if (usc->m1 == 0 && usc->m2 == 0) { if (cl->cl_usc != NULL) { - FREE(cl->cl_usc, M_DEVBUF); + free(cl->cl_usc, M_DEVBUF); cl->cl_usc = NULL; cl->cl_myf = 0; } |