diff options
author | ru <ru@FreeBSD.org> | 2005-11-09 13:29:16 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-11-09 13:29:16 +0000 |
commit | dcace5669d81e83aea7a22539593b0f158eb224c (patch) | |
tree | 54d0f8642eec5f374a08d8a2b18c53a66b4ba269 /sys/netgraph | |
parent | eba5310ce5792d913219b571cd4890c26fea82d8 (diff) | |
download | FreeBSD-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/netgraph')
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket.c | 86 | ||||
-rw-r--r-- | sys/netgraph/ng_socket.c | 51 |
2 files changed, 49 insertions, 88 deletions
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket.c b/sys/netgraph/bluetooth/socket/ng_btsocket.c index 9b8fdd6..16b9a20 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket.c @@ -140,56 +140,39 @@ static struct pr_usrreqs ng_btsocket_rfcomm_usrreqs = { static struct protosw ng_btsocket_protosw[] = { { - SOCK_RAW, /* protocol type */ - &ng_btsocket_domain, /* backpointer to domain */ - BLUETOOTH_PROTO_HCI, /* protocol */ - PR_ATOMIC | PR_ADDR, /* flags */ - NULL, NULL, NULL, /* input, output, ctlinput */ - ng_btsocket_hci_raw_ctloutput, /* ctloutput */ - NULL, /* ousrreq() */ - ng_btsocket_hci_raw_init, /* init */ - NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */ - &ng_btsocket_hci_raw_usrreqs, /* usrreq table (above) */ - /* { NULL } */ /* pfh (protocol filter head?) */ + .pr_type = SOCK_RAW, + .pr_domain = &ng_btsocket_domain, + .pr_protocol = BLUETOOTH_PROTO_HCI, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_ctloutput = ng_btsocket_hci_raw_ctloutput, + .pr_init = ng_btsocket_hci_raw_init, + .pr_usrreqs = &ng_btsocket_hci_raw_usrreqs, }, { - SOCK_RAW, /* protocol type */ - &ng_btsocket_domain, /* backpointer to domain */ - BLUETOOTH_PROTO_L2CAP, /* protocol */ - PR_ATOMIC | PR_ADDR, /* flags */ - NULL, NULL, NULL, /* input, output, ctlinput */ - NULL, /* ctloutput */ - NULL, /* ousrreq() */ - ng_btsocket_l2cap_raw_init, /* init */ - NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */ - &ng_btsocket_l2cap_raw_usrreqs, /* usrreq table (above) */ - /* { NULL } */ /* pfh (protocol filter head?) */ + .pr_type = SOCK_RAW, + .pr_domain = &ng_btsocket_domain, + .pr_protocol = BLUETOOTH_PROTO_L2CAP, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_init = ng_btsocket_l2cap_raw_init, + .pr_usrreqs = &ng_btsocket_l2cap_raw_usrreqs, }, { - SOCK_SEQPACKET, /* protocol type */ - &ng_btsocket_domain, /* backpointer to domain */ - BLUETOOTH_PROTO_L2CAP, /* protocol */ - PR_ATOMIC | PR_CONNREQUIRED, /* flags */ - NULL, NULL, NULL, /* input, output, ctlinput */ - ng_btsocket_l2cap_ctloutput, /* ctloutput */ - NULL, /* ousrreq() */ - ng_btsocket_l2cap_init, /* init */ - NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */ - &ng_btsocket_l2cap_usrreqs, /* usrreq table (above) */ - /* { NULL } */ /* pfh (protocol filter head?) */ + .pr_type = SOCK_SEQPACKET, + .pr_domain = &ng_btsocket_domain, + .pr_protocol = BLUETOOTH_PROTO_L2CAP, + .pr_flags = PR_ATOMIC|PR_CONNREQUIRED, + .pr_ctloutput = ng_btsocket_l2cap_ctloutput, + .pr_init = ng_btsocket_l2cap_init, + .pr_usrreqs = &ng_btsocket_l2cap_usrreqs, }, { - SOCK_STREAM, /* protocol type */ - &ng_btsocket_domain, /* backpointer to domain */ - BLUETOOTH_PROTO_RFCOMM, /* protocol */ - PR_CONNREQUIRED, /* flags */ - NULL, NULL, NULL, /* input, output, ctlinput */ - ng_btsocket_rfcomm_ctloutput, /* ctloutput */ - NULL, /* ousrreq() */ - ng_btsocket_rfcomm_init, /* init */ - NULL, NULL, NULL, /* fasttimeo, slowtimo, drain */ - &ng_btsocket_rfcomm_usrreqs, /* usrreq table (above) */ - /* { NULL } */ /* pfh (protocol filter head?) */ + .pr_type = SOCK_STREAM, + .pr_domain = &ng_btsocket_domain, + .pr_protocol = BLUETOOTH_PROTO_RFCOMM, + .pr_flags = PR_CONNREQUIRED, + .pr_ctloutput = ng_btsocket_rfcomm_ctloutput, + .pr_init = ng_btsocket_rfcomm_init, + .pr_usrreqs = &ng_btsocket_rfcomm_usrreqs, } }; #define ng_btsocket_protosw_size \ @@ -202,17 +185,10 @@ static struct protosw ng_btsocket_protosw[] = { */ struct domain ng_btsocket_domain = { - AF_BLUETOOTH, /* family */ - "bluetooth", /* domain name */ - NULL, /* init() */ - NULL, /* externalize() */ - NULL, /* dispose() */ - ng_btsocket_protosw, /* protosw entry */ - ng_btsocket_protosw_end, /* end of protosw entries */ - NULL, /* next domain in list */ - NULL, /* rtattach() */ - 0, /* arg to rtattach in bits */ - 0 /* maxrtkey */ + .dom_family = AF_BLUETOOTH, + .dom_name = "bluetooth", + .dom_protosw = ng_btsocket_protosw, + .dom_protoswNPROTOSW = ng_btsocket_protosw_end }; /* diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index e3399c5..5ad1bd6 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -1130,42 +1130,27 @@ static struct pr_usrreqs ngd_usrreqs = { extern struct domain ngdomain; /* stop compiler warnings */ static struct protosw ngsw[] = { - { - SOCK_DGRAM, /* protocol type */ - &ngdomain, /* backpointer to domain */ - NG_CONTROL, - PR_ATOMIC | PR_ADDR /* | PR_RIGHTS */, /* flags */ - 0, 0, 0, 0, /* input, output, ctlinput, ctloutput */ - NULL, /* ousrreq */ - 0, 0, 0, 0, /* init, fasttimeo, slowtimo, drain */ - &ngc_usrreqs, /* usrreq table (above) */ - /*{NULL}*/ /* pffh (protocol filter head?) */ - }, - { - SOCK_DGRAM, /* protocol type */ - &ngdomain, /* backpointer to domain */ - NG_DATA, - PR_ATOMIC | PR_ADDR, /* flags */ - 0, 0, 0, 0, /* input, output, ctlinput, ctloutput */ - NULL, /* ousrreq() */ - 0, 0, 0, 0, /* init, fasttimeo, slowtimo, drain */ - &ngd_usrreqs, /* usrreq table (above) */ - /*{NULL}*/ /* pffh (protocol filter head?) */ - } +{ + .pr_type = SOCK_DGRAM, + .pr_domain = &ngdomain, + .pr_protocol = NG_CONTROL, + .pr_flags = PR_ATOMIC | PR_ADDR /* | PR_RIGHTS */, + .pr_usrreqs = &ngc_usrreqs +}, +{ + .pr_type = SOCK_DGRAM, + .pr_domain = &ngdomain, + .pr_protocol = NG_DATA, + .pr_flags = PR_ATOMIC | PR_ADDR, + .pr_usrreqs = &ngd_usrreqs +} }; struct domain ngdomain = { - AF_NETGRAPH, - "netgraph", - NULL, /* init() */ - NULL, /* externalise() */ - NULL, /* dispose() */ - ngsw, /* protosw entry */ - &ngsw[sizeof(ngsw) / sizeof(ngsw[0])], /* Number of protosw entries */ - NULL, /* next domain in list */ - NULL, /* rtattach() */ - 0, /* arg to rtattach in bits */ - 0 /* maxrtkey */ + .dom_family = AF_NETGRAPH, + .dom_name = "netgraph", + .dom_protosw = ngsw, + .dom_protoswNPROTOSW = &ngsw[sizeof(ngsw) / sizeof(ngsw[0])] }; /* |