From baa74c00fe3190b0a83b19b0981d420ad8df80ea Mon Sep 17 00:00:00 2001 From: dlg Date: Sat, 11 Apr 2015 13:00:12 +0000 Subject: [PATCH] the hfsc pools are only used in hfsc.c, so move the init of them there instead of pf_ioctl.c. ok henning@ --- sys/net/hfsc.c | 15 ++++++++++++++- sys/net/hfsc.h | 3 ++- sys/net/pf.c | 3 +-- sys/net/pf_ioctl.c | 9 ++------- sys/net/pfvar.h | 4 +--- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/sys/net/hfsc.c b/sys/net/hfsc.c index 4036fe44db7..00dafb83f49 100644 --- a/sys/net/hfsc.c +++ b/sys/net/hfsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hfsc.c,v 1.16 2015/03/03 11:14:00 henning Exp $ */ +/* $OpenBSD: hfsc.c,v 1.17 2015/04/11 13:00:12 dlg Exp $ */ /* * Copyright (c) 2012-2013 Henning Brauer @@ -121,6 +121,8 @@ struct hfsc_class *hfsc_clh2cph(struct hfsc_if *, u_int32_t); #define HFSC_HT_INFINITY 0xffffffffffffffffLL /* infinite time value */ +struct pool hfsc_class_pl, hfsc_classq_pl, hfsc_internal_sc_pl; + u_int64_t hfsc_microuptime(void) { @@ -155,6 +157,17 @@ hfsc_grow_class_tbl(struct hfsc_if *hif, u_int howmany) free(old, M_DEVBUF, 0); } +void +hfsc_initialize(void) +{ + pool_init(&hfsc_class_pl, sizeof(struct hfsc_class), 0, 0, PR_WAITOK, + "hfscclass", NULL); + pool_init(&hfsc_classq_pl, sizeof(struct hfsc_classq), 0, 0, PR_WAITOK, + "hfscclassq", NULL); + pool_init(&hfsc_internal_sc_pl, sizeof(struct hfsc_internal_sc), 0, 0, + PR_WAITOK, "hfscintsc", NULL); +} + int hfsc_attach(struct ifnet *ifp) { diff --git a/sys/net/hfsc.h b/sys/net/hfsc.h index 8cbef7d277a..722c93d01d7 100644 --- a/sys/net/hfsc.h +++ b/sys/net/hfsc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hfsc.h,v 1.6 2014/04/19 16:02:17 henning Exp $ */ +/* $OpenBSD: hfsc.h,v 1.7 2015/04/11 13:00:12 dlg Exp $ */ /* * Copyright (c) 2012-2013 Henning Brauer @@ -258,6 +258,7 @@ struct hfsc_if { struct ifnet; struct ifqueue; struct pf_queuespec; +void hfsc_initialize(void); int hfsc_attach(struct ifnet *); int hfsc_detach(struct ifnet *); void hfsc_purge(struct ifqueue *); diff --git a/sys/net/pf.c b/sys/net/pf.c index e6a395ab188..3ad4278d264 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.910 2015/04/08 12:50:21 mikeb Exp $ */ +/* $OpenBSD: pf.c,v 1.911 2015/04/11 13:00:12 dlg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -135,7 +135,6 @@ union pf_headers { struct pool pf_src_tree_pl, pf_rule_pl, pf_queue_pl; struct pool pf_state_pl, pf_state_key_pl, pf_state_item_pl; struct pool pf_rule_item_pl, pf_sn_item_pl; -struct pool hfsc_class_pl, hfsc_classq_pl, hfsc_internal_sc_pl; void pf_init_threshold(struct pf_threshold *, u_int32_t, u_int32_t); diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index fbed2e38b0c..857ad2152c4 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.284 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.285 2015/04/11 13:00:12 dlg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -155,12 +155,7 @@ pfattach(int num) "pfruleitem", NULL); pool_init(&pf_queue_pl, sizeof(struct pf_queuespec), 0, 0, 0, "pfqueue", NULL); - pool_init(&hfsc_class_pl, sizeof(struct hfsc_class), 0, 0, PR_WAITOK, - "hfscclass", NULL); - pool_init(&hfsc_classq_pl, sizeof(struct hfsc_classq), 0, 0, PR_WAITOK, - "hfscclassq", NULL); - pool_init(&hfsc_internal_sc_pl, sizeof(struct hfsc_internal_sc), 0, 0, - PR_WAITOK, "hfscintsc", NULL); + hfsc_initialize(); pfr_initialize(); pfi_initialize(); pf_osfp_initialize(); diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index a0423b190e6..2a26374066b 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.413 2015/02/15 10:40:53 sthen Exp $ */ +/* $OpenBSD: pfvar.h,v 1.414 2015/04/11 13:00:12 dlg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1760,8 +1760,6 @@ extern struct pool pf_src_tree_pl, pf_sn_item_pl, pf_rule_pl; extern struct pool pf_state_pl, pf_state_key_pl, pf_state_item_pl, pf_rule_item_pl, pf_queue_pl; extern struct pool pf_state_scrub_pl; -extern struct pool hfsc_class_pl, hfsc_classq_pl, - hfsc_internal_sc_pl; extern void pf_purge_thread(void *); extern void pf_purge_expired_src_nodes(int); extern void pf_purge_expired_states(u_int32_t); -- 2.20.1