diff options
author | Neil Horman <nhorman@tuxdriver.com> | 2008-02-15 09:53:59 -0500 |
---|---|---|
committer | Vlad Yasevich <vladislav.yasevich@hp.com> | 2008-02-28 16:41:05 -0500 |
commit | 15efbe763978d7cc327d824d9e8f8f9e525dd40d (patch) | |
tree | b327c7e80268d2362f20f3cf8ec9dffaf33869c9 | |
parent | b90a137d30a6322d76023d879d40fc31f3edf0a6 (diff) |
[SCTP]: Clean up naming conventions of sctp protocol/address family registration
I noticed while looking into some odd behavior in sctp, that the variable
name sctp_pf_inet6_specific was used twice to represent two different
pieces of data (its both a structure name and a pointer to that type of
structure), which is confusing to say the least, and potentially dangerous
depending on the variable scope. This patch cleans that up, and makes the
protocol and address family registration names in SCTP more regular,
increasing readability.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
ipv6.c | 12 ++++++------
protocol.c | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
-rw-r--r-- | net/sctp/ipv6.c | 12 | ||||
-rw-r--r-- | net/sctp/protocol.c | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 4d7ec961ae1d..87f940587d5f 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -966,7 +966,7 @@ static struct inet6_protocol sctpv6_protocol = { | |||
966 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL, | 966 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL, |
967 | }; | 967 | }; |
968 | 968 | ||
969 | static struct sctp_af sctp_ipv6_specific = { | 969 | static struct sctp_af sctp_af_inet6 = { |
970 | .sa_family = AF_INET6, | 970 | .sa_family = AF_INET6, |
971 | .sctp_xmit = sctp_v6_xmit, | 971 | .sctp_xmit = sctp_v6_xmit, |
972 | .setsockopt = ipv6_setsockopt, | 972 | .setsockopt = ipv6_setsockopt, |
@@ -998,7 +998,7 @@ static struct sctp_af sctp_ipv6_specific = { | |||
998 | #endif | 998 | #endif |
999 | }; | 999 | }; |
1000 | 1000 | ||
1001 | static struct sctp_pf sctp_pf_inet6_specific = { | 1001 | static struct sctp_pf sctp_pf_inet6 = { |
1002 | .event_msgname = sctp_inet6_event_msgname, | 1002 | .event_msgname = sctp_inet6_event_msgname, |
1003 | .skb_msgname = sctp_inet6_skb_msgname, | 1003 | .skb_msgname = sctp_inet6_skb_msgname, |
1004 | .af_supported = sctp_inet6_af_supported, | 1004 | .af_supported = sctp_inet6_af_supported, |
@@ -1008,7 +1008,7 @@ static struct sctp_pf sctp_pf_inet6_specific = { | |||
1008 | .supported_addrs = sctp_inet6_supported_addrs, | 1008 | .supported_addrs = sctp_inet6_supported_addrs, |
1009 | .create_accept_sk = sctp_v6_create_accept_sk, | 1009 | .create_accept_sk = sctp_v6_create_accept_sk, |
1010 | .addr_v4map = sctp_v6_addr_v4map, | 1010 | .addr_v4map = sctp_v6_addr_v4map, |
1011 | .af = &sctp_ipv6_specific, | 1011 | .af = &sctp_af_inet6, |
1012 | }; | 1012 | }; |
1013 | 1013 | ||
1014 | /* Initialize IPv6 support and register with socket layer. */ | 1014 | /* Initialize IPv6 support and register with socket layer. */ |
@@ -1017,10 +1017,10 @@ int sctp_v6_init(void) | |||
1017 | int rc; | 1017 | int rc; |
1018 | 1018 | ||
1019 | /* Register the SCTP specific PF_INET6 functions. */ | 1019 | /* Register the SCTP specific PF_INET6 functions. */ |
1020 | sctp_register_pf(&sctp_pf_inet6_specific, PF_INET6); | 1020 | sctp_register_pf(&sctp_pf_inet6, PF_INET6); |
1021 | 1021 | ||
1022 | /* Register the SCTP specific AF_INET6 functions. */ | 1022 | /* Register the SCTP specific AF_INET6 functions. */ |
1023 | sctp_register_af(&sctp_ipv6_specific); | 1023 | sctp_register_af(&sctp_af_inet6); |
1024 | 1024 | ||
1025 | rc = proto_register(&sctpv6_prot, 1); | 1025 | rc = proto_register(&sctpv6_prot, 1); |
1026 | if (rc) | 1026 | if (rc) |
@@ -1051,7 +1051,7 @@ void sctp_v6_exit(void) | |||
1051 | inet6_unregister_protosw(&sctpv6_seqpacket_protosw); | 1051 | inet6_unregister_protosw(&sctpv6_seqpacket_protosw); |
1052 | inet6_unregister_protosw(&sctpv6_stream_protosw); | 1052 | inet6_unregister_protosw(&sctpv6_stream_protosw); |
1053 | proto_unregister(&sctpv6_prot); | 1053 | proto_unregister(&sctpv6_prot); |
1054 | list_del(&sctp_ipv6_specific.list); | 1054 | list_del(&sctp_af_inet6.list); |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | /* Unregister with inet6 layer. */ | 1057 | /* Unregister with inet6 layer. */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 22a16571499c..688546dccd82 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -832,7 +832,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
832 | return ip_queue_xmit(skb, ipfragok); | 832 | return ip_queue_xmit(skb, ipfragok); |
833 | } | 833 | } |
834 | 834 | ||
835 | static struct sctp_af sctp_ipv4_specific; | 835 | static struct sctp_af sctp_af_inet; |
836 | 836 | ||
837 | static struct sctp_pf sctp_pf_inet = { | 837 | static struct sctp_pf sctp_pf_inet = { |
838 | .event_msgname = sctp_inet_event_msgname, | 838 | .event_msgname = sctp_inet_event_msgname, |
@@ -844,7 +844,7 @@ static struct sctp_pf sctp_pf_inet = { | |||
844 | .supported_addrs = sctp_inet_supported_addrs, | 844 | .supported_addrs = sctp_inet_supported_addrs, |
845 | .create_accept_sk = sctp_v4_create_accept_sk, | 845 | .create_accept_sk = sctp_v4_create_accept_sk, |
846 | .addr_v4map = sctp_v4_addr_v4map, | 846 | .addr_v4map = sctp_v4_addr_v4map, |
847 | .af = &sctp_ipv4_specific, | 847 | .af = &sctp_af_inet |
848 | }; | 848 | }; |
849 | 849 | ||
850 | /* Notifier for inetaddr addition/deletion events. */ | 850 | /* Notifier for inetaddr addition/deletion events. */ |
@@ -906,7 +906,7 @@ static struct net_protocol sctp_protocol = { | |||
906 | }; | 906 | }; |
907 | 907 | ||
908 | /* IPv4 address related functions. */ | 908 | /* IPv4 address related functions. */ |
909 | static struct sctp_af sctp_ipv4_specific = { | 909 | static struct sctp_af sctp_af_inet = { |
910 | .sa_family = AF_INET, | 910 | .sa_family = AF_INET, |
911 | .sctp_xmit = sctp_v4_xmit, | 911 | .sctp_xmit = sctp_v4_xmit, |
912 | .setsockopt = ip_setsockopt, | 912 | .setsockopt = ip_setsockopt, |
@@ -1192,7 +1192,7 @@ SCTP_STATIC __init int sctp_init(void) | |||
1192 | sctp_sysctl_register(); | 1192 | sctp_sysctl_register(); |
1193 | 1193 | ||
1194 | INIT_LIST_HEAD(&sctp_address_families); | 1194 | INIT_LIST_HEAD(&sctp_address_families); |
1195 | sctp_register_af(&sctp_ipv4_specific); | 1195 | sctp_register_af(&sctp_af_inet); |
1196 | 1196 | ||
1197 | status = proto_register(&sctp_prot, 1); | 1197 | status = proto_register(&sctp_prot, 1); |
1198 | if (status) | 1198 | if (status) |
@@ -1249,7 +1249,7 @@ err_v6_init: | |||
1249 | proto_unregister(&sctp_prot); | 1249 | proto_unregister(&sctp_prot); |
1250 | err_proto_register: | 1250 | err_proto_register: |
1251 | sctp_sysctl_unregister(); | 1251 | sctp_sysctl_unregister(); |
1252 | list_del(&sctp_ipv4_specific.list); | 1252 | list_del(&sctp_af_inet.list); |
1253 | free_pages((unsigned long)sctp_port_hashtable, | 1253 | free_pages((unsigned long)sctp_port_hashtable, |
1254 | get_order(sctp_port_hashsize * | 1254 | get_order(sctp_port_hashsize * |
1255 | sizeof(struct sctp_bind_hashbucket))); | 1255 | sizeof(struct sctp_bind_hashbucket))); |
@@ -1299,7 +1299,7 @@ SCTP_STATIC __exit void sctp_exit(void) | |||
1299 | inet_unregister_protosw(&sctp_seqpacket_protosw); | 1299 | inet_unregister_protosw(&sctp_seqpacket_protosw); |
1300 | 1300 | ||
1301 | sctp_sysctl_unregister(); | 1301 | sctp_sysctl_unregister(); |
1302 | list_del(&sctp_ipv4_specific.list); | 1302 | list_del(&sctp_af_inet.list); |
1303 | 1303 | ||
1304 | free_pages((unsigned long)sctp_assoc_hashtable, | 1304 | free_pages((unsigned long)sctp_assoc_hashtable, |
1305 | get_order(sctp_assoc_hashsize * | 1305 | get_order(sctp_assoc_hashsize * |