diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-04-12 15:19:55 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-04-12 15:19:55 +0000 |
commit | bc9e71f5abe5a0c68deec657115e5fc69a2a7c5b (patch) | |
tree | f5a432b65eccdf431ca6f55b701e0385d2d5169f | |
parent | f12347fca2d2e230e25fb3f6333ee938ba856b21 (diff) |
kill the qid assignment code here; return EINVAL if qid == 0 - similar to
what we do for teh other schedulers already
-rw-r--r-- | sys/altq/altq_hfsc.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/sys/altq/altq_hfsc.c b/sys/altq/altq_hfsc.c index ee317ce6504..d6a2bab9cf8 100644 --- a/sys/altq/altq_hfsc.c +++ b/sys/altq/altq_hfsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_hfsc.c,v 1.15 2003/04/12 14:07:31 henning Exp $ */ +/* $OpenBSD: altq_hfsc.c,v 1.16 2003/04/12 15:19:54 henning Exp $ */ /* $KAME: altq_hfsc.c,v 1.17 2002/11/29 07:48:33 kjc Exp $ */ /* @@ -226,12 +226,12 @@ hfsc_add_queue(struct pf_altq *a) parent = clh_to_clp(hif, a->parent_qid); if (parent == NULL) return (EINVAL); - if (a->qid != 0) { - if (a->qid >= HFSC_MAX_CLASSES) - return (EINVAL); - if (clh_to_clp(hif, a->qid) != NULL) - return (EBUSY); - } + + if (a->qid >= HFSC_MAX_CLASSES || a->qid == 0) + return (EINVAL); + if (clh_to_clp(hif, a->qid) != NULL) + return (EBUSY); + rtsc.m1 = opts->rtsc_m1; rtsc.d = opts->rtsc_d; rtsc.m2 = opts->rtsc_m2; @@ -247,9 +247,6 @@ hfsc_add_queue(struct pf_altq *a) if (cl == NULL) return (ENOMEM); - /* return handle to user space. */ - a->qid = cl->cl_handle; - return (0); } @@ -351,7 +348,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, struct hfsc_class *parent, int qlimit, int flags, int qid) { struct hfsc_class *cl, *p; - int i, s, chandle; + int s; #ifndef ALTQ_RED if (flags & HFCF_RED) { @@ -362,18 +359,6 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, } #endif - if (qid) - chandle = qid; - else { - /* find a free class slot. */ - for (i = 0; i < HFSC_MAX_CLASSES; i++) - if (hif->hif_class_tbl[i] == NULL) - break; - if (i == HFSC_MAX_CLASSES) - return (NULL); - chandle = i + 1; - } - MALLOC(cl, struct hfsc_class *, sizeof(struct hfsc_class), M_DEVBUF, M_WAITOK); if (cl == NULL) @@ -467,13 +452,13 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, } cl->cl_id = hif->hif_classid++; - cl->cl_handle = chandle; + cl->cl_handle = qid; cl->cl_hif = hif; cl->cl_parent = parent; s = splimp(); hif->hif_classes++; - hif->hif_class_tbl[chandle - 1] = cl; + hif->hif_class_tbl[qid - 1] = cl; if (flags & HFCF_DEFAULTCLASS) hif->hif_defaultclass = cl; |