From 4468b0b48343bf644a129ee6dfbb15171070e9a5 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 30 Nov 2004 19:21:26 +0000 Subject: [PATCH] Remove struct ipprotosw. It's identical to protosw, so use the generic version directly. --- sys/net/gif/if_gif.c | 3 +- sys/net/stf/if_stf.c | 5 +- sys/netinet/in_proto.c | 5 +- sys/netinet/ip_encap.c | 7 +-- sys/netinet/ip_input.c | 13 ++-- sys/netinet/ipprotosw.h | 104 -------------------------------- sys/netinet6/ah_input.c | 5 +- sys/netinet6/esp_input.c | 5 +- sys/netinet6/ipcomp_input.c | 5 +- sys/netproto/atm/atm_proto.c | 6 +- sys/netproto/ipsec/xform_ipip.c | 5 +- 11 files changed, 25 insertions(+), 138 deletions(-) delete mode 100644 sys/netinet/ipprotosw.h diff --git a/sys/net/gif/if_gif.c b/sys/net/gif/if_gif.c index 8413800f0c..c030abc880 100644 --- a/sys/net/gif/if_gif.c +++ b/sys/net/gif/if_gif.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/net/if_gif.c,v 1.4.2.15 2002/11/08 16:57:13 ume Exp $ */ -/* $DragonFly: src/sys/net/gif/if_gif.c,v 1.9 2004/03/23 22:19:06 hsu Exp $ */ +/* $DragonFly: src/sys/net/gif/if_gif.c,v 1.10 2004/11/30 19:21:26 joerg Exp $ */ /* $KAME: if_gif.c,v 1.87 2001/10/19 08:50:27 itojun Exp $ */ /* @@ -63,7 +63,6 @@ #include #include #include -#include #endif /* INET */ #ifdef INET6 diff --git a/sys/net/stf/if_stf.c b/sys/net/stf/if_stf.c index c1340ee839..d15d806541 100644 --- a/sys/net/stf/if_stf.c +++ b/sys/net/stf/if_stf.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/net/if_stf.c,v 1.1.2.11 2003/01/23 21:06:44 sam Exp $ */ -/* $DragonFly: src/sys/net/stf/if_stf.c,v 1.10 2004/06/03 18:30:03 joerg Exp $ */ +/* $DragonFly: src/sys/net/stf/if_stf.c,v 1.11 2004/11/30 19:21:26 joerg Exp $ */ /* $KAME: if_stf.c,v 1.73 2001/12/03 11:08:30 keiichi Exp $ */ /* @@ -99,7 +99,6 @@ #include #include #include -#include #include #include @@ -135,7 +134,7 @@ static MALLOC_DEFINE(M_STF, "stf", "6to4 Tunnel Interface"); static int ip_stf_ttl = 40; extern struct domain inetdomain; -struct ipprotosw in_stf_protosw = +struct protosw in_stf_protosw = { SOCK_RAW, &inetdomain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR, in_stf_input, rip_output, 0, rip_ctloutput, 0, diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c index f71699795b..f6834e3080 100644 --- a/sys/netinet/in_proto.c +++ b/sys/netinet/in_proto.c @@ -32,7 +32,7 @@ * * @(#)in_proto.c 8.2 (Berkeley) 2/9/95 * $FreeBSD: src/sys/netinet/in_proto.c,v 1.53.2.7 2003/08/24 08:24:38 hsu Exp $ - * $DragonFly: src/sys/netinet/in_proto.c,v 1.8 2004/10/15 22:59:10 hsu Exp $ + * $DragonFly: src/sys/netinet/in_proto.c,v 1.9 2004/11/30 19:21:26 joerg Exp $ */ #include "opt_ipdivert.h" @@ -68,7 +68,6 @@ #include #include -#include /* * TCP/IP protocol family: IP, ICMP, UDP, TCP. @@ -101,7 +100,7 @@ extern struct domain inetdomain; static struct pr_usrreqs nousrreqs; -struct ipprotosw inetsw[] = { +struct protosw inetsw[] = { { 0, &inetdomain, 0, 0, 0, 0, 0, 0, cpu0_soport, diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index 02066edb1d..2cec801bbe 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet/ip_encap.c,v 1.1.2.5 2003/01/23 21:06:45 sam Exp $ */ -/* $DragonFly: src/sys/netinet/ip_encap.c,v 1.8 2004/06/03 18:30:03 joerg Exp $ */ +/* $DragonFly: src/sys/netinet/ip_encap.c,v 1.9 2004/11/30 19:21:26 joerg Exp $ */ /* $KAME: ip_encap.c,v 1.41 2001/03/15 08:35:08 itojun Exp $ */ /* @@ -78,7 +78,6 @@ #include #include #include -#include #ifdef INET6 #include @@ -135,7 +134,7 @@ encap4_input(struct mbuf *m, ...) int off, proto; struct ip *ip; struct sockaddr_in s, d; - const struct ipprotosw *psw; + const struct protosw *psw; struct encaptab *ep, *match; int prio, matchprio; __va_list ap; @@ -202,7 +201,7 @@ encap4_input(struct mbuf *m, ...) if (match) { /* found a match, "match" has the best one */ - psw = (const struct ipprotosw *)match->psw; + psw = match->psw; if (psw && psw->pr_input) { encap_fillarg(m, match); (*psw->pr_input)(m, off, proto); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 23e1c39427..558277fa5b 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -82,7 +82,7 @@ * * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/sys/netinet/ip_input.c,v 1.130.2.52 2003/03/07 07:01:28 silby Exp $ - * $DragonFly: src/sys/netinet/ip_input.c,v 1.36 2004/10/16 23:20:00 hsu Exp $ + * $DragonFly: src/sys/netinet/ip_input.c,v 1.37 2004/11/30 19:21:26 joerg Exp $ */ #define _IP_VHL @@ -134,7 +134,6 @@ #include #include -#include #include @@ -222,7 +221,7 @@ static struct ifqueue ipintrq; static int ipqmaxlen = IFQ_MAXLEN; extern struct domain inetdomain; -extern struct ipprotosw inetsw[]; +extern struct protosw inetsw[]; u_char ip_protox[IPPROTO_MAX]; struct in_ifaddrhead in_ifaddrhead; /* first inet address */ struct in_ifaddrhashhead *in_ifaddrhashtbl; /* inet addr hash table */ @@ -333,7 +332,7 @@ static struct mbuf *ip_reass (struct mbuf *, struct ipq *, void ip_init(void) { - struct ipprotosw *pr; + struct protosw *pr; int i; #ifdef SMP int cpu; @@ -347,13 +346,13 @@ ip_init(void) IFQ_MAXLEN, 4000, 0, NULL); TAILQ_INIT(&in_ifaddrhead); in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &in_ifaddrhmask); - pr = (struct ipprotosw *)pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); + pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); if (pr == NULL) panic("ip_init"); for (i = 0; i < IPPROTO_MAX; i++) ip_protox[i] = pr - inetsw; - for (pr = (struct ipprotosw *)inetdomain.dom_protosw; - pr < (struct ipprotosw *)inetdomain.dom_protoswNPROTOSW; pr++) + for (pr = inetdomain.dom_protosw; + pr < inetdomain.dom_protoswNPROTOSW; pr++) if (pr->pr_domain->dom_family == PF_INET && pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) ip_protox[pr->pr_protocol] = pr - inetsw; diff --git a/sys/netinet/ipprotosw.h b/sys/netinet/ipprotosw.h deleted file mode 100644 index 14411fbd1e..0000000000 --- a/sys/netinet/ipprotosw.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)protosw.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: src/sys/netinet/ipprotosw.h,v 1.1 1999/12/22 19:13:23 shin Exp $ - * $DragonFly: src/sys/netinet/Attic/ipprotosw.h,v 1.6 2004/06/03 18:30:03 joerg Exp $ - */ - -#ifndef _NETINET_IPPROTOSW_H_ -#define _NETINET_IPPROTOSW_H_ - -/* Forward declare these structures referenced from prototypes below. */ -struct mbuf; -struct proc; -struct sockaddr; -struct socket; -struct sockopt; - -struct ipprotosw { - short pr_type; /* socket type used for */ - const struct domain *pr_domain; /* domain protocol a member of */ - short pr_protocol; /* protocol number */ - short pr_flags; /* see below */ -/* protocol-protocol hooks */ - void (*pr_input) (struct mbuf *, ...); - /* input to protocol (from below) */ - int (*pr_output) (struct mbuf *m, struct socket *so, ...); - /* output to protocol (from above) */ - void (*pr_ctlinput)(int, struct sockaddr *, void *); - /* control input (from below) */ - int (*pr_ctloutput)(struct socket *, struct sockopt *); - /* control output (from above) */ -/* user-protocol hook */ - void *pr_ousrreq; -/* utility hooks */ - void (*pr_init) (void); /* initialization hook */ - void (*pr_fasttimo) (void); - /* fast timeout (200ms) */ - void (*pr_slowtimo) (void); - /* slow timeout (500ms) */ - void (*pr_drain) (void); - /* flush any excess space possible */ - const struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ -}; - -#endif /* !_NETINET_IPPROTOSW_H_ */ diff --git a/sys/netinet6/ah_input.c b/sys/netinet6/ah_input.c index b58aa2c211..87d7d484cb 100644 --- a/sys/netinet6/ah_input.c +++ b/sys/netinet6/ah_input.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ah_input.c,v 1.1.2.6 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/ah_input.c,v 1.9 2004/10/20 05:00:36 hsu Exp $ */ +/* $DragonFly: src/sys/netinet6/ah_input.c,v 1.10 2004/11/30 19:21:26 joerg Exp $ */ /* $KAME: ah_input.c,v 1.67 2002/01/07 11:39:56 kjc Exp $ */ /* @@ -96,8 +96,7 @@ #define IPLEN_FLIPPED #ifdef INET -#include -extern struct ipprotosw inetsw[]; +extern struct protosw inetsw[]; void ah4_input(struct mbuf *m, ...) diff --git a/sys/netinet6/esp_input.c b/sys/netinet6/esp_input.c index fd5a9c247e..fc4084131c 100644 --- a/sys/netinet6/esp_input.c +++ b/sys/netinet6/esp_input.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/esp_input.c,v 1.1.2.8 2003/01/23 21:06:47 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/esp_input.c,v 1.8 2004/10/20 05:00:36 hsu Exp $ */ +/* $DragonFly: src/sys/netinet6/esp_input.c,v 1.9 2004/11/30 19:21:26 joerg Exp $ */ /* $KAME: esp_input.c,v 1.62 2002/01/07 11:39:57 kjc Exp $ */ /* @@ -98,8 +98,7 @@ ? sizeof(struct newesp) : sizeof(struct esp)) #ifdef INET -#include -extern struct ipprotosw inetsw[]; +extern struct protosw inetsw[]; void esp4_input(struct mbuf *m, ...) diff --git a/sys/netinet6/ipcomp_input.c b/sys/netinet6/ipcomp_input.c index eb3f565175..2d6d7f14be 100644 --- a/sys/netinet6/ipcomp_input.c +++ b/sys/netinet6/ipcomp_input.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ipcomp_input.c,v 1.1.2.3 2002/04/28 05:40:27 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/ipcomp_input.c,v 1.6 2004/06/03 18:30:04 joerg Exp $ */ +/* $DragonFly: src/sys/netinet6/ipcomp_input.c,v 1.7 2004/11/30 19:21:26 joerg Exp $ */ /* $KAME: ipcomp_input.c,v 1.25 2001/03/01 09:12:09 itojun Exp $ */ /* @@ -84,8 +84,7 @@ #define IPLEN_FLIPPED #ifdef INET -#include -extern struct ipprotosw inetsw[]; +extern struct protosw inetsw[]; void ipcomp4_input(struct mbuf *m, ...) diff --git a/sys/netproto/atm/atm_proto.c b/sys/netproto/atm/atm_proto.c index beac59b431..3f3bf8f47f 100644 --- a/sys/netproto/atm/atm_proto.c +++ b/sys/netproto/atm/atm_proto.c @@ -24,7 +24,7 @@ * notice must be reproduced on all copies. * * @(#) $FreeBSD: src/sys/netatm/atm_proto.c,v 1.3 1999/08/28 00:48:36 peter Exp $ - * @(#) $DragonFly: src/sys/netproto/atm/atm_proto.c,v 1.7 2004/06/07 07:01:36 dillon Exp $ + * @(#) $DragonFly: src/sys/netproto/atm/atm_proto.c,v 1.8 2004/11/30 19:21:26 joerg Exp $ */ /* @@ -62,7 +62,7 @@ struct protosw atmsw[] = { 0, /* pr_output */ 0, /* pr_ctlinput */ atm_aal5_ctloutput, /* pr_ctloutput */ - cpu0_soport, /* pr_ousrreq */ + cpu0_soport, /* pr_mport */ 0, /* pr_init */ 0, /* pr_fasttimo */ 0, /* pr_slowtimo */ @@ -79,7 +79,7 @@ struct protosw atmsw[] = { x, /* pr_output */ x, /* pr_ctlinput */ x, /* pr_ctloutput */ - 0, /* pr_ousrreq */ + 0, /* pr_mport */ 0, /* pr_init */ 0, /* pr_fasttimo */ 0, /* pr_slowtimo */ diff --git a/sys/netproto/ipsec/xform_ipip.c b/sys/netproto/ipsec/xform_ipip.c index 5d4e0ed559..685b470826 100644 --- a/sys/netproto/ipsec/xform_ipip.c +++ b/sys/netproto/ipsec/xform_ipip.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/xform_ipip.c,v 1.9 2004/10/15 22:59:10 hsu Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/xform_ipip.c,v 1.10 2004/11/30 19:21:26 joerg Exp $ */ /* $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -63,7 +63,6 @@ #include #include #include -#include #include #include @@ -646,7 +645,7 @@ static struct xformsw ipe4_xformsw = { }; extern struct domain inetdomain; -static struct ipprotosw ipe4_protosw[] = { +static struct protosw ipe4_protosw[] = { { SOCK_RAW, &inetdomain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR, ip4_input, 0, 0, rip_ctloutput, -- 2.41.0