diff options
author | rwatson <rwatson@FreeBSD.org> | 2010-03-14 18:59:11 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2010-03-14 18:59:11 +0000 |
commit | 1fdd3bccc0217643bd336f00c0ffe11fcf22f906 (patch) | |
tree | 17f74ef6c048f38cf428a40d8856694105998a44 /sys/netinet/raw_ip.c | |
parent | 08d0d0b9a9e34bc0f3e3ea091437486c47f6bae5 (diff) | |
download | FreeBSD-src-1fdd3bccc0217643bd336f00c0ffe11fcf22f906.zip FreeBSD-src-1fdd3bccc0217643bd336f00c0ffe11fcf22f906.tar.gz |
Abstract out initialization of most aspects of struct inpcbinfo from
their calling contexts in {IP divert, raw IP sockets, TCP, UDP} and
create new helper functions: in_pcbinfo_init() and in_pcbinfo_destroy()
to do this work in a central spot. As inpcbinfo becomes more complex
due to ongoing work to add connection groups, this will reduce code
duplication.
MFC after: 1 month
Reviewed by: bz
Sponsored by: Juniper Networks
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r-- | sys/netinet/raw_ip.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 9341cf2..88c1e61 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -185,19 +185,8 @@ void rip_init(void) { - INP_INFO_LOCK_INIT(&V_ripcbinfo, "rip"); - LIST_INIT(&V_ripcb); -#ifdef VIMAGE - V_ripcbinfo.ipi_vnet = curvnet; -#endif - V_ripcbinfo.ipi_listhead = &V_ripcb; - V_ripcbinfo.ipi_hashbase = - hashinit(INP_PCBHASH_RAW_SIZE, M_PCB, &V_ripcbinfo.ipi_hashmask); - V_ripcbinfo.ipi_porthashbase = - hashinit(1, M_PCB, &V_ripcbinfo.ipi_porthashmask); - V_ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb), - NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(V_ripcbinfo.ipi_zone, maxsockets); + in_pcbinfo_init(&V_ripcbinfo, "rip", &V_ripcb, INP_PCBHASH_RAW_SIZE, + 1, "ripcb", rip_inpcb_init, NULL, UMA_ZONE_NOFREE); EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change, NULL, EVENTHANDLER_PRI_ANY); } @@ -207,10 +196,7 @@ void rip_destroy(void) { - hashdestroy(V_ripcbinfo.ipi_hashbase, M_PCB, - V_ripcbinfo.ipi_hashmask); - hashdestroy(V_ripcbinfo.ipi_porthashbase, M_PCB, - V_ripcbinfo.ipi_porthashmask); + in_pcbinfo_destroy(&V_ripcbinfo); } #endif |