summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-11-09 13:29:16 +0000
committerru <ru@FreeBSD.org>2005-11-09 13:29:16 +0000
commitdcace5669d81e83aea7a22539593b0f158eb224c (patch)
tree54d0f8642eec5f374a08d8a2b18c53a66b4ba269 /sys/net
parenteba5310ce5792d913219b571cd4890c26fea82d8 (diff)
downloadFreeBSD-src-dcace5669d81e83aea7a22539593b0f158eb224c.zip
FreeBSD-src-dcace5669d81e83aea7a22539593b0f158eb224c.tar.gz
Use sparse initializers for "struct domain" and "struct protosw",
so they are easier to follow for the human being.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gre.c32
-rw-r--r--sys/net/if_stf.c15
-rw-r--r--sys/net/rtsock.c22
3 files changed, 43 insertions, 26 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 22ceba5..f8165dc 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -118,19 +118,27 @@ static void greattach(void);
#ifdef INET
extern struct domain inetdomain;
-static const struct protosw in_gre_protosw =
-{ SOCK_RAW, &inetdomain, IPPROTO_GRE, PR_ATOMIC|PR_ADDR,
- (pr_input_t*)gre_input, (pr_output_t*)rip_output, rip_ctlinput, rip_ctloutput,
- 0,
- 0, 0, 0, 0,
- &rip_usrreqs
+static const struct protosw in_gre_protosw = {
+ .pr_type = SOCK_RAW,
+ .pr_domain = &inetdomain,
+ .pr_protocol = IPPROTO_GRE,
+ .pr_flags = PR_ATOMIC|PR_ADDR,
+ .pr_input = (pr_input_t *)gre_input,
+ .pr_output = (pr_output_t *)rip_output,
+ .pr_ctlinput = rip_ctlinput,
+ .pr_ctloutput = rip_ctloutput,
+ .pr_usrreqs = &rip_usrreqs
};
-static const struct protosw in_mobile_protosw =
-{ SOCK_RAW, &inetdomain, IPPROTO_MOBILE, PR_ATOMIC|PR_ADDR,
- (pr_input_t*)gre_mobile_input, (pr_output_t*)rip_output, rip_ctlinput, rip_ctloutput,
- 0,
- 0, 0, 0, 0,
- &rip_usrreqs
+static const struct protosw in_mobile_protosw = {
+ .pr_type = SOCK_RAW,
+ .pr_domain = &inetdomain,
+ .pr_protocol = IPPROTO_MOBILE,
+ .pr_flags = PR_ATOMIC|PR_ADDR,
+ .pr_input = (pr_input_t *)gre_mobile_input,
+ .pr_output = (pr_output_t *)rip_output,
+ .pr_ctlinput = rip_ctlinput,
+ .pr_ctloutput = rip_ctloutput,
+ .pr_usrreqs = &rip_usrreqs
};
#endif
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c
index a08291a..9b0bfac 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -150,12 +150,15 @@ static MALLOC_DEFINE(M_STF, STFNAME, "6to4 Tunnel Interface");
static const int ip_stf_ttl = 40;
extern struct domain inetdomain;
-struct protosw in_stf_protosw =
-{ SOCK_RAW, &inetdomain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR,
- in_stf_input, (pr_output_t*)rip_output, 0, rip_ctloutput,
- 0,
- 0, 0, 0, 0,
- &rip_usrreqs
+struct protosw in_stf_protosw = {
+ .pr_type = SOCK_RAW,
+ .pr_domain = &inetdomain,
+ .pr_protocol = IPPROTO_IPV6,
+ .pr_flags = PR_ATOMIC|PR_ADDR,
+ .pr_input = in_stf_input,
+ .pr_output = (pr_output_t *)rip_output,
+ .pr_ctloutput = rip_ctloutput,
+ .pr_usrreqs = &rip_usrreqs
};
static char *stfnames[] = {"stf0", "stf", "6to4", NULL};
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 3942561..641a796 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1257,16 +1257,22 @@ SYSCTL_NODE(_net, PF_ROUTE, routetable, CTLFLAG_RD, sysctl_rtsock, "");
static struct domain routedomain; /* or at least forward */
static struct protosw routesw[] = {
-{ SOCK_RAW, &routedomain, 0, PR_ATOMIC|PR_ADDR,
- 0, route_output, raw_ctlinput, 0,
- 0,
- raw_init, 0, 0, 0,
- &route_usrreqs
+{
+ .pr_type = SOCK_RAW,
+ .pr_domain = &routedomain,
+ .pr_flags = PR_ATOMIC|PR_ADDR,
+ .pr_output = route_output,
+ .pr_ctlinput = raw_ctlinput,
+ .pr_init = raw_init,
+ .pr_usrreqs = &route_usrreqs
}
};
-static struct domain routedomain =
- { PF_ROUTE, "route", 0, 0, 0,
- routesw, &routesw[sizeof(routesw)/sizeof(routesw[0])] };
+static struct domain routedomain = {
+ .dom_family = PF_ROUTE,
+ .dom_name = "route",
+ .dom_protosw = routesw,
+ .dom_protoswNPROTOSW = &routesw[sizeof(routesw)/sizeof(routesw[0])]
+};
DOMAIN_SET(route);
OpenPOWER on IntegriCloud