sctp: remove typedefs from structures part 5
Subsystems (3)
Xin Long
maintainercover sctp: remove typedefs from structures part 5
As we know, typedef is suggested not to use in kernel, even checkpatch.pl also gives warnings about it. Now sctp is using it for many structures.
All this kind of typedef's using should be removed. This patchset is the part 5 to remove all typedefs in include/net/sctp/constants.h.
Just as the part 1-4, No any code's logic would be changed in these patches, only cleaning up.
Xin Long (14):
sctp: remove the typedef sctp_lower_cwnd_t
sctp: remove the typedef sctp_retransmit_reason_t
sctp: remove the typedef sctp_scope_policy_t
sctp: remove the typedef sctp_scope_t
sctp: remove the typedef sctp_transport_cmd_t
sctp: remove the typedef sctp_sock_state_t
sctp: remove the typedef sctp_xmit_t
sctp: remove the typedef sctp_ierror_t
sctp: remove the typedef sctp_state_t
sctp: remove the typedef sctp_event_primitive_t
sctp: remove the typedef sctp_event_other_t
sctp: remove the typedef sctp_event_timeout_t
sctp: remove the typedef sctp_event_t
sctp: remove the typedef sctp_subtype_t
include/net/sctp/command.h | 8 +- include/net/sctp/constants.h | 89 +++++++++--------- include/net/sctp/sctp.h | 9 +- include/net/sctp/sm.h | 21 ++--- include/net/sctp/structs.h | 42 +++++---- net/sctp/associola.c | 21 ++--- net/sctp/bind_addr.c | 20 ++-- net/sctp/debug.c | 8 +- net/sctp/endpointola.c | 4 +- net/sctp/ipv6.c | 6 +- net/sctp/output.c | 60 ++++++------ net/sctp/outqueue.c | 10 +- net/sctp/primitive.c | 4 +- net/sctp/probe.c | 2 +- net/sctp/protocol.c | 6 +- net/sctp/sm_make_chunk.c | 29 +++--- net/sctp/sm_sideeffect.c | 46 ++++----- net/sctp/sm_statefuns.c | 215 ++++++++++++++++++++++--------------------- net/sctp/sm_statetable.c | 23 +++-- net/sctp/socket.c | 4 +- net/sctp/sysctl.c | 2 +- net/sctp/transport.c | 2 +- 22 files changed, 320 insertions(+), 311 deletions(-)
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 1/14 sctp: remove the typedef sctp_lower_cwnd_t
This patch is to remove the typedef sctp_lower_cwnd_t, and replace with enum sctp_lower_cwnd in the places where it's using this typedef.
--- include/net/sctp/constants.h | 4 ++-- include/net/sctp/structs.h | 3 ++- net/sctp/transport.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
include/net/sctp/constants.h +2 -2
@@ -378,12 +378,12 @@ typedef enum { } sctp_retransmit_reason_t;/* Reasons to lower cwnd. */ -typedef enum { +enum sctp_lower_cwnd {SCTP_LOWER_CWND_T3_RTX ,SCTP_LOWER_CWND_FAST_RTX ,SCTP_LOWER_CWND_ECNE ,SCTP_LOWER_CWND_INACTIVE , -}sctp_lower_cwnd_t ; +};/* SCTP-AUTH Necessary constants */
include/net/sctp/structs.h +2 -1
@@ -950,7 +950,8 @@ int sctp_transport_hold(struct sctp_transport *);void sctp_transport_put (struct sctp_transport *);void sctp_transport_update_rto (struct sctp_transport *,__u32 );void sctp_transport_raise_cwnd (struct sctp_transport *,__u32 ,__u32 ); -void sctp_transport_lower_cwnd (struct sctp_transport *,sctp_lower_cwnd_t ); +void sctp_transport_lower_cwnd (struct sctp_transport *t, +enum sctp_lower_cwnd reason);void sctp_transport_burst_limited (struct sctp_transport *);void sctp_transport_burst_reset (struct sctp_transport *);unsigned long sctp_transport_timeout (struct sctp_transport *);
net/sctp/transport.c +1 -1
@@ -490,7 +490,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,* detected. */ void sctp_transport_lower_cwnd (struct sctp_transport *transport, -sctp_lower_cwnd_t reason) +enum sctp_lower_cwnd reason) {struct sctp_association *asoc = transport->asoc;
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 2/14 sctp: remove the typedef sctp_retransmit_reason_t
This patch is to remove the typedef sctp_retransmit_reason_t, and replace with enum sctp_retransmit_reason in the places where it's using this typedef.
--- include/net/sctp/constants.h | 4 ++-- include/net/sctp/structs.h | 4 ++-- net/sctp/outqueue.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
include/net/sctp/constants.h +2 -2
@@ -370,12 +370,12 @@ typedef enum {peer */ /* Reasons to retransmit. */ -typedef enum { +enum sctp_retransmit_reason {SCTP_RTXR_T3_RTX ,SCTP_RTXR_FAST_RTX ,SCTP_RTXR_PMTUD ,SCTP_RTXR_T1_RTX , -}sctp_retransmit_reason_t ; +};/* Reasons to lower cwnd. */ enum sctp_lower_cwnd {
include/net/sctp/structs.h +2 -2
@@ -1054,8 +1054,8 @@ int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *);int sctp_outq_is_empty (const struct sctp_outq *);void sctp_outq_restart (struct sctp_outq *); -void sctp_retransmit (struct sctp_outq *,struct sctp_transport *, -sctp_retransmit_reason_t ); +void sctp_retransmit (struct sctp_outq *q,struct sctp_transport *transport, +enum sctp_retransmit_reason reason);void sctp_retransmit_mark (struct sctp_outq *,struct sctp_transport *,__u8 );void sctp_outq_uncork (struct sctp_outq *,gfp_t gfp); void sctp_prsctp_prune(struct sctp_association *asoc,
net/sctp/outqueue.c +1 -1
@@ -534,7 +534,7 @@ void sctp_retransmit_mark(struct sctp_outq *q,* one packet out. */ void sctp_retransmit (struct sctp_outq *q,struct sctp_transport *transport, -sctp_retransmit_reason_t reason) +enum sctp_retransmit_reason reason) {struct net *net =sock_net (q->asoc->base.sk);
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 3/14 sctp: remove the typedef sctp_scope_policy_t
This patch is to remove the typedef sctp_scope_policy_t and keep it's members as an anonymous enum.
It is also to define SCTP_SCOPE_POLICY_MAX to replace the num 3 in sysctl.c to make codes clear.
--- include/net/sctp/constants.h | 6 ++++-- net/sctp/sysctl.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
include/net/sctp/constants.h +4 -2
@@ -341,12 +341,14 @@ typedef enum {SCTP_SCOPE_UNUSABLE ,/* IPv4 unusable addresses */ } sctp_scope_t; -typedef enum { +enum {SCTP_SCOPE_POLICY_DISABLE ,/* Disable IPv4 address scoping */ SCTP_SCOPE_POLICY_ENABLE ,/* Enable IPv4 address scoping */ SCTP_SCOPE_POLICY_PRIVATE ,/* Follow draft but allow IPv4 private addresses */ SCTP_SCOPE_POLICY_LINK ,/* Follow draft but allow IPv4 link local addresses */ -}sctp_scope_policy_t ; +}; + +#define SCTP_SCOPE_POLICY_MAX SCTP_SCOPE_POLICY_LINK/* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>, * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24,
net/sctp/sysctl.c +1 -1
@@ -46,7 +46,7 @@ static int timer_max = 86400000; /* ms in one day */static int int_max =INT_MAX ;static int sack_timer_min =1 ;static int sack_timer_max =500 ; -static int addr_scope_max =3 ;/* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */ +static int addr_scope_max =SCTP_SCOPE_POLICY_MAX ;static int rwnd_scale_max =16 ;static int rto_alpha_min =0 ;static int rto_beta_min =0 ;
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 4/14 sctp: remove the typedef sctp_scope_t
This patch is to remove the typedef sctp_scope_t, and replace with enum sctp_scope in the places where it's using this typedef.
--- include/net/sctp/constants.h | 4 ++-- include/net/sctp/sctp.h | 4 ++-- include/net/sctp/structs.h | 17 +++++++++-------- net/sctp/associola.c | 17 ++++++++--------- net/sctp/bind_addr.c | 20 ++++++++++---------- net/sctp/ipv6.c | 6 +++--- net/sctp/protocol.c | 6 +++--- net/sctp/sm_make_chunk.c | 6 +++--- net/sctp/socket.c | 4 ++-- 9 files changed, 42 insertions(+), 42 deletions(-)
include/net/sctp/constants.h +2 -2
@@ -333,13 +333,13 @@ typedef enum {* At this point, the IPv6 scopes will be mapped to these internal scopes * as much as possible. */ -typedef enum { +enum sctp_scope {SCTP_SCOPE_GLOBAL ,/* IPv4 global addresses */ SCTP_SCOPE_PRIVATE ,/* IPv4 private addresses */ SCTP_SCOPE_LINK ,/* IPv4 link local address */ SCTP_SCOPE_LOOPBACK ,/* IPv4 loopback address */ SCTP_SCOPE_UNUSABLE ,/* IPv4 unusable addresses */ -}sctp_scope_t ; +};enum {SCTP_SCOPE_POLICY_DISABLE ,/* Disable IPv4 address scoping */
include/net/sctp/sctp.h +2 -2
@@ -94,8 +94,8 @@/* * sctp/protocol.c */ -int sctp_copy_local_addr_list (struct net *,struct sctp_bind_addr *, -sctp_scope_t ,gfp_t gfp,int flags); +int sctp_copy_local_addr_list (struct net *net,struct sctp_bind_addr *addr, +enum sctp_scope ,gfp_t gfp,int flags);struct sctp_pf *sctp_get_pf_specific (sa_family_t family);int sctp_register_pf (struct sctp_pf *,sa_family_t );void sctp_addr_wq_mgmt (struct net *,struct sctp_sockaddr_entry *,int );
include/net/sctp/structs.h +9 -8
@@ -449,7 +449,7 @@ struct sctp_af {int (*addr_valid) (union sctp_addr *,struct sctp_sock *,const struct sk_buff *); -sctp_scope_t (*scope) (union sctp_addr *); +enum sctp_scope (*scope)(union sctp_addr *);void (*inaddr_any) (union sctp_addr *,__be16 );int (*is_any) (const union sctp_addr *); int (*available) (union sctp_addr *,
@@ -1111,7 +1111,7 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);void sctp_bind_addr_free (struct sctp_bind_addr *);int sctp_bind_addr_copy (struct net *net,struct sctp_bind_addr *dest,const struct sctp_bind_addr *src, -sctp_scope_t scope,gfp_t gfp, +enum sctp_scope scope,gfp_t gfp,int flags); int sctp_bind_addr_dup(struct sctp_bind_addr *dest, const struct sctp_bind_addr *src,
@@ -1135,8 +1135,9 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,int sctp_raw_to_bind_addrs (struct sctp_bind_addr *bp,__u8 *raw,int len,__u16 port,gfp_t gfp); -sctp_scope_t sctp_scope (const union sctp_addr *); -int sctp_in_scope (struct net *net,const union sctp_addr *addr,const sctp_scope_t scope); +enum sctp_scope sctp_scope (const union sctp_addr *addr); +int sctp_in_scope (struct net *net,const union sctp_addr *addr, +const enum sctp_scope scope);int sctp_is_any (struct sock *sk,const union sctp_addr *addr);int sctp_is_ep_boundall (struct sock *sk);
@@ -1925,8 +1926,8 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)struct sctp_association * -sctp_association_new (const struct sctp_endpoint *,const struct sock *, -sctp_scope_t scope,gfp_t gfp); +sctp_association_new (const struct sctp_endpoint *ep,const struct sock *sk, +enum sctp_scope scope,gfp_t gfp);void sctp_association_free (struct sctp_association *);void sctp_association_put (struct sctp_association *);void sctp_association_hold (struct sctp_association *);
@@ -1967,8 +1968,8 @@ void sctp_assoc_set_primary(struct sctp_association *, struct sctp_transport *);void sctp_assoc_del_nonprimary_peers (struct sctp_association *,struct sctp_transport *); -int sctp_assoc_set_bind_addr_from_ep (struct sctp_association *, -sctp_scope_t ,gfp_t ); +int sctp_assoc_set_bind_addr_from_ep (struct sctp_association *asoc, +enum sctp_scope scope,gfp_t gfp);int sctp_assoc_set_bind_addr_from_cookie (struct sctp_association *,struct sctp_cookie *,gfp_t gfp);
net/sctp/associola.c +8 -9
@@ -63,11 +63,11 @@ static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc);/* 1st Level Abstractions. */ /* Initialize a new association from provided memory. */ -static struct sctp_association *sctp_association_init (struct sctp_association *asoc, -const struct sctp_endpoint *ep, -const struct sock *sk, -sctp_scope_t scope, -gfp_t gfp) +static struct sctp_association *sctp_association_init ( +struct sctp_association *asoc, +const struct sctp_endpoint *ep, +const struct sock *sk, +enum sctp_scope scope,gfp_t gfp) {struct net *net =sock_net (sk);struct sctp_sock *sp;
@@ -301,9 +301,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a/* Allocate and initialize a new association */ struct sctp_association *sctp_association_new (const struct sctp_endpoint *ep, -const struct sock *sk, -sctp_scope_t scope, -gfp_t gfp) +const struct sock *sk, +enum sctp_scope scope,gfp_t gfp) {struct sctp_association *asoc;
@@ -1564,7 +1563,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)* local endpoint and the remote peer. */ int sctp_assoc_set_bind_addr_from_ep (struct sctp_association *asoc, -sctp_scope_t scope,gfp_t gfp) +enum sctp_scope scope,gfp_t gfp) {int flags;
net/sctp/bind_addr.c +10 -10
@@ -45,9 +45,9 @@#include <net/sctp/sm.h> /* Forward declarations for internal helpers. */ -static int sctp_copy_one_addr (struct net *,struct sctp_bind_addr *, -union sctp_addr *,sctp_scope_t scope,gfp_t gfp, -int flags); +static int sctp_copy_one_addr (struct net *net,struct sctp_bind_addr *dest, +union sctp_addr *addr,enum sctp_scope scope, +gfp_t gfp,int flags);static void sctp_bind_addr_clean (struct sctp_bind_addr *);/* First Level Abstractions. */
@@ -57,7 +57,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *);*/ int sctp_bind_addr_copy (struct net *net,struct sctp_bind_addr *dest,const struct sctp_bind_addr *src, -sctp_scope_t scope,gfp_t gfp, +enum sctp_scope scope,gfp_t gfp,int flags) {struct sctp_sockaddr_entry *addr;
@@ -440,9 +440,8 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,/* Copy out addresses from the global local address list. */ static int sctp_copy_one_addr (struct net *net,struct sctp_bind_addr *dest, -union sctp_addr *addr, -sctp_scope_t scope,gfp_t gfp, -int flags) +union sctp_addr *addr,enum sctp_scope scope, +gfp_t gfp,int flags) {int error =0 ;
@@ -485,9 +484,10 @@ int sctp_is_any(struct sock *sk, const union sctp_addr *addr) }/* Is 'addr' valid for 'scope'? */ -int sctp_in_scope (struct net *net,const union sctp_addr *addr,sctp_scope_t scope) +int sctp_in_scope (struct net *net,const union sctp_addr *addr, +enum sctp_scope scope) { -sctp_scope_t addr_scope =sctp_scope (addr); +enum sctp_scope addr_scope =sctp_scope (addr);/* The unusable SCTP addresses will not be considered with * any defined scopes.
@@ -545,7 +545,7 @@ int sctp_is_ep_boundall(struct sock *sk)********************************************************************/ /* What is the scope of 'addr'? */ -sctp_scope_t sctp_scope (const union sctp_addr *addr) +enum sctp_scope sctp_scope (const union sctp_addr *addr) {struct sctp_af *af;
net/sctp/ipv6.c +3 -3
@@ -243,8 +243,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,union sctp_addr *daddr = &t->ipaddr;union sctp_addr dst_saddr;struct in6_addr *final_p, final; +enum sctp_scope scope;__u8 matchlen =0 ; -sctp_scope_t scope;memset (fl6,0 ,sizeof (struct flowi6 )); fl6->daddr = daddr->v6.sin6_addr;
@@ -624,10 +624,10 @@ static int sctp_v6_addr_valid(union sctp_addr *addr, }/* What is the scope of 'addr'? */ -static sctp_scope_t sctp_v6_scope (union sctp_addr *addr) +static enum sctp_scope sctp_v6_scope (union sctp_addr *addr) { +enum sctp_scope retval;int v6scope; -sctp_scope_t retval;/* The IPv6 scope is really a set of bit fields. * See IFA_* in <net/if_inet6.h>. Map to a generic SCTP scope.
net/sctp/protocol.c +3 -3
@@ -196,7 +196,7 @@ static void sctp_free_local_addr_list(struct net *net)/* Copy the local addresses which are valid for 'scope' into 'bp'. */ int sctp_copy_local_addr_list (struct net *net,struct sctp_bind_addr *bp, -sctp_scope_t scope,gfp_t gfp,int copy_flags) +enum sctp_scope scope,gfp_t gfp,int copy_flags) {struct sctp_sockaddr_entry *addr;union sctp_addr laddr;
@@ -400,9 +400,9 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)* IPv4 scoping can be controlled through sysctl option * net.sctp.addr_scope_policy */ -static sctp_scope_t sctp_v4_scope (union sctp_addr *addr) +static enum sctp_scope sctp_v4_scope (union sctp_addr *addr) { -sctp_scope_t retval; +enum sctp_scope retval;/* Check for unusable SCTP addresses. */ if (IS_IPV4_UNUSABLE_ADDRESS (addr->v4.sin_addr.s_addr)) {
net/sctp/sm_make_chunk.c +3 -3
@@ -1578,8 +1578,8 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep, gfp_t gfp) {struct sctp_association *asoc; +enum sctp_scope scope;struct sk_buff *skb; -sctp_scope_t scope;/* Create the bare association. */ scope =sctp_scope (sctp_source (chunk));
@@ -1701,7 +1701,7 @@ struct sctp_association *sctp_unpack_cookie(int headersize, bodysize, fixed_size;__u8 *digest = ep->digest;unsigned int len; -sctp_scope_t scope; +enum sctp_scope scope;struct sk_buff *skb = chunk->skb;ktime_t kt;
@@ -2502,7 +2502,7 @@ static int sctp_process_param(struct sctp_association *asoc,int i;__u16 sat;int retval =1 ; -sctp_scope_t scope; +enum sctp_scope scope;u32 stale;struct sctp_af *af;union sctp_addr_param *addr_param;
net/sctp/socket.c +2 -2
@@ -1055,7 +1055,7 @@ static int __sctp_connect(struct sock *sk,struct sctp_association *asoc2;struct sctp_transport *transport;union sctp_addr to; -sctp_scope_t scope; +enum sctp_scope scope;long timeo;int err =0 ;int addrcnt =0 ;
@@ -1610,7 +1610,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)struct sctp_initmsg *sinit;sctp_assoc_t associd =0 ;sctp_cmsgs_t cmsgs = {NULL }; -sctp_scope_t scope; +enum sctp_scope scope;bool fill_sinfo_ttl = false, wait_connect = false;struct sctp_datamsg *datamsg;int msg_flags = msg->msg_flags;
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 5/14 sctp: remove the typedef sctp_transport_cmd_t
This patch is to remove the typedef sctp_transport_cmd_t, and replace with enum sctp_transport_cmd in the places where it's using this typedef.
--- include/net/sctp/constants.h | 4 ++-- include/net/sctp/structs.h | 7 ++++--- net/sctp/associola.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-)
include/net/sctp/constants.h +2 -2
@@ -320,11 +320,11 @@ typedef enum { } sctp_xmit_t;/* These are the commands for manipulating transports. */ -typedef enum { +enum sctp_transport_cmd {SCTP_TRANSPORT_UP ,SCTP_TRANSPORT_DOWN ,SCTP_TRANSPORT_PF , -}sctp_transport_cmd_t ; +};/* These are the address scopes defined mainly for IPv4 addresses * based on draft of SCTP IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>.
include/net/sctp/structs.h +4 -3
@@ -1947,9 +1947,10 @@ void sctp_assoc_del_peer(struct sctp_association *asoc, const union sctp_addr *addr);void sctp_assoc_rm_peer (struct sctp_association *asoc,struct sctp_transport *peer); -void sctp_assoc_control_transport (struct sctp_association *, -struct sctp_transport *, -sctp_transport_cmd_t ,sctp_sn_error_t ); +void sctp_assoc_control_transport (struct sctp_association *asoc, +struct sctp_transport *transport, +enum sctp_transport_cmd command, +sctp_sn_error_t error);struct sctp_transport *sctp_assoc_lookup_tsn (struct sctp_association *,__u32 ); struct sctp_transport *sctp_assoc_is_match(struct sctp_association *, struct net *,
net/sctp/associola.c +1 -1
@@ -796,7 +796,7 @@ void sctp_assoc_del_nonprimary_peers(struct sctp_association *asoc,*/ void sctp_assoc_control_transport (struct sctp_association *asoc,struct sctp_transport *transport, -sctp_transport_cmd_t command, +enum sctp_transport_cmd command,sctp_sn_error_t error) {struct sctp_ulpevent *event;
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 6/14 sctp: remove the typedef sctp_sock_state_t
This patch is to remove the typedef sctp_sock_state_t, and replace with enum sctp_sock_state in the places where it's using this typedef.
--- include/net/sctp/constants.h | 6 +++--- include/net/sctp/sctp.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
include/net/sctp/constants.h +3 -3
@@ -42,7 +42,7 @@#include <linux/sctp.h> #include <linux/ipv6.h> /* For ipv6hdr. */ -#include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */ +#include <net/tcp_states.h> /* For TCP states used in enum sctp_sock_state */ /* Value used for stream negotiation. */ enum {SCTP_MAX_STREAM =0xffff };
@@ -214,13 +214,13 @@ typedef enum {* - A socket in SCTP_SS_ESTABLISHED state indicates that it has a single * association. */ -typedef enum { +enum sctp_sock_state {SCTP_SS_CLOSED =TCP_CLOSE ,SCTP_SS_LISTENING =TCP_LISTEN ,SCTP_SS_ESTABLISHING =TCP_SYN_SENT ,SCTP_SS_ESTABLISHED =TCP_ESTABLISHED ,SCTP_SS_CLOSING =TCP_CLOSE_WAIT , -}sctp_sock_state_t ; +};/* These functions map various type to printable names. */ const char *sctp_cname (const sctp_subtype_t );/* chunk types */
include/net/sctp/sctp.h +2 -1
@@ -565,7 +565,8 @@ static inline int __sctp_state(const struct sctp_association *asoc,/* Is the socket in this state? */ #define sctp_sstate (sk, state) __sctp_sstate((sk), (SCTP_SS_##state)) -static inline int __sctp_sstate (const struct sock *sk,sctp_sock_state_t state) +static inline int __sctp_sstate (const struct sock *sk, +enum sctp_sock_state state) {return sk->sk_state = state; }
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 7/14 sctp: remove the typedef sctp_xmit_t
This patch is to remove the typedef sctp_xmit_t, and replace with enum sctp_xmit in the places where it's using this typedef.
--- include/net/sctp/constants.h | 4 +-- include/net/sctp/structs.h | 9 ++++--- net/sctp/output.c | 60 ++++++++++++++++++++++---------------------- net/sctp/outqueue.c | 8 +++--- 4 files changed, 41 insertions(+), 40 deletions(-)
include/net/sctp/constants.h +2 -2
@@ -312,12 +312,12 @@ enum { SCTP_MAX_GABS = 16 };/* These return values describe the success or failure of a number of * routines which form the lower interface to SCTP_outqueue. */ -typedef enum { +enum sctp_xmit {SCTP_XMIT_OK ,SCTP_XMIT_PMTU_FULL ,SCTP_XMIT_RWND_FULL ,SCTP_XMIT_DELAY , -}sctp_xmit_t ; +};/* These are the commands for manipulating transports. */ enum sctp_transport_cmd {
include/net/sctp/structs.h +5 -4
@@ -697,10 +697,11 @@ struct sctp_packet {void sctp_packet_init (struct sctp_packet *,struct sctp_transport *,__u16 sport,__u16 dport);void sctp_packet_config (struct sctp_packet *,__u32 vtag,int ); -sctp_xmit_t sctp_packet_transmit_chunk (struct sctp_packet *, -struct sctp_chunk *,int ,gfp_t ); -sctp_xmit_t sctp_packet_append_chunk (struct sctp_packet *, -struct sctp_chunk *); +enum sctp_xmit sctp_packet_transmit_chunk (struct sctp_packet *packet, +struct sctp_chunk *chunk, +int one_packet,gfp_t gfp); +enum sctp_xmit sctp_packet_append_chunk (struct sctp_packet *packet, +struct sctp_chunk *chunk);int sctp_packet_transmit (struct sctp_packet *,gfp_t );void sctp_packet_free (struct sctp_packet *);
net/sctp/output.c +30 -30
119 lines not on this page · raw message
net/sctp/outqueue.c +4 -4
@@ -594,14 +594,14 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,static int sctp_outq_flush_rtx (struct sctp_outq *q,struct sctp_packet *pkt,int rtx_timeout,int *start_timer) { -struct list_head *lqueue;struct sctp_transport *transport = pkt->transport; -sctp_xmit_t status;struct sctp_chunk *chunk, *chunk1; -int fast_rtx; +struct list_head *lqueue; +enum sctp_xmit status;int error =0 ;int timer =0 ;int done =0 ; +int fast_rtx; lqueue = &q->retransmit; fast_rtx = q->fast_rtx;
@@ -781,7 +781,7 @@ static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)struct sctp_transport *transport =NULL ;struct sctp_transport *new_transport;struct sctp_chunk *chunk, *tmp; -sctp_xmit_t status; +enum sctp_xmit status;int error =0 ;int start_timer =0 ;int one_packet =0 ;
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 8/14 sctp: remove the typedef sctp_ierror_t
This patch is to remove the typedef sctp_ierror_t, and replace with enum sctp_ierror in the places where it's using this typedef.
--- include/net/sctp/constants.h | 5 ++--- net/sctp/sm_make_chunk.c | 23 ++++++++++++----------- net/sctp/sm_statefuns.c | 28 +++++++++++++++------------- 3 files changed, 29 insertions(+), 27 deletions(-)
include/net/sctp/constants.h +2 -3
@@ -155,8 +155,7 @@ SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) - sizeof(struct sctp_data_chunk)))/* Internal error codes */ -typedef enum { - +enum sctp_ierror {SCTP_IERROR_NO_ERROR =0 ,SCTP_IERROR_BASE =1000 ,SCTP_IERROR_NO_COOKIE ,
@@ -177,7 +176,7 @@ typedef enum {SCTP_IERROR_PROTO_VIOLATION ,SCTP_IERROR_ERROR , SCTP_IERROR_ABORT, -} sctp_ierror_t; +};
net/sctp/sm_make_chunk.c +12 -11
@@ -2065,10 +2065,11 @@ static void sctp_process_ext_param(struct sctp_association *asoc,* SCTP_IERROR_ERROR - stop and report an error. * SCTP_IERROR_NOMEME - out of memory. */ -static sctp_ierror_t sctp_process_unk_param (const struct sctp_association *asoc, -union sctp_params param, -struct sctp_chunk *chunk, -struct sctp_chunk **errp) +static enum sctp_ierror sctp_process_unk_param ( +const struct sctp_association *asoc, +union sctp_params param, +struct sctp_chunk *chunk, +struct sctp_chunk **errp) {int retval =SCTP_IERROR_NO_ERROR ;
@@ -2117,13 +2118,13 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc,* SCTP_IERROR_ERROR - stop processing, trigger an ERROR * SCTP_IERROR_NO_ERROR - continue with the chunk */ -static sctp_ierror_t sctp_verify_param (struct net *net, -const struct sctp_endpoint *ep, -const struct sctp_association *asoc, -union sctp_params param, -enum sctp_cid cid, -struct sctp_chunk *chunk, -struct sctp_chunk **err_chunk) +static enum sctp_ierror sctp_verify_param (struct net *net, +const struct sctp_endpoint *ep, +const struct sctp_association *asoc, +union sctp_params param, +enum sctp_cid cid, +struct sctp_chunk *chunk, +struct sctp_chunk **err_chunk) {struct sctp_hmac_algo_param *hmacs;int retval =SCTP_IERROR_NO_ERROR ;
net/sctp/sm_statefuns.c +15 -13
@@ -144,11 +144,12 @@ static sctp_disposition_t sctp_sf_violation_chunk(void *arg, sctp_cmd_seq_t *commands); -static sctp_ierror_t sctp_sf_authenticate (struct net *net, -const struct sctp_endpoint *ep, -const struct sctp_association *asoc, -const sctp_subtype_t type, -struct sctp_chunk *chunk); +static enum sctp_ierror sctp_sf_authenticate ( +struct net *net, +const struct sctp_endpoint *ep, +const struct sctp_association *asoc, +const sctp_subtype_t type, +struct sctp_chunk *chunk); static sctp_disposition_t __sctp_sf_do_9_1_abort(struct net *net, const struct sctp_endpoint *ep,
@@ -756,7 +757,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,*/ if (chunk->auth_chunk) {struct sctp_chunk auth; -sctp_ierror_t ret; +enum sctp_ierror ret;/* Make sure that we and the peer are AUTH capable */ if (!net->sctp.auth_enable || !new_asoc->peer.auth_capable) {
@@ -4077,11 +4078,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast(* * The return value is the disposition of the chunk. */ -static sctp_ierror_t sctp_sf_authenticate (struct net *net, -const struct sctp_endpoint *ep, -const struct sctp_association *asoc, -const sctp_subtype_t type, -struct sctp_chunk *chunk) +static enum sctp_ierror sctp_sf_authenticate ( +struct net *net, +const struct sctp_endpoint *ep, +const struct sctp_association *asoc, +const sctp_subtype_t type, +struct sctp_chunk *chunk) {struct sctp_authhdr *auth_hdr;struct sctp_hmac *hmac;
@@ -4159,10 +4161,10 @@ sctp_disposition_t sctp_sf_eat_auth(struct net *net,void *arg, sctp_cmd_seq_t *commands) { - struct sctp_authhdr *auth_hdr; struct sctp_chunk *chunk = arg; +struct sctp_authhdr *auth_hdr;struct sctp_chunk *err_chunk; -sctp_ierror_t error; +enum sctp_ierror error;/* Make sure that the peer has AUTH capable */ if (!asoc->peer.auth_capable)
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 9/14 sctp: remove the typedef sctp_state_t
This patch is to remove the typedef sctp_state_t, and replace with enum sctp_state in the places where it's using this typedef.
--- include/net/sctp/command.h | 4 ++-- include/net/sctp/constants.h | 4 ++-- include/net/sctp/sctp.h | 2 +- include/net/sctp/sm.h | 10 +++++----- include/net/sctp/structs.h | 2 +- net/sctp/endpointola.c | 2 +- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 12 ++++++------ net/sctp/sm_statetable.c | 16 +++++++++------- 9 files changed, 28 insertions(+), 26 deletions(-)
include/net/sctp/command.h +2 -2
@@ -126,7 +126,7 @@ typedef union {__u8 u8;int error;__be16 err; -sctp_state_t state; +enum sctp_state state;sctp_event_timeout_t to;struct sctp_chunk *chunk;struct sctp_association *asoc;
@@ -167,7 +167,7 @@ SCTP_ARG_CONSTRUCTOR(U16, __u16, u16) SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) SCTP_ARG_CONSTRUCTOR(ERROR, int, error) SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */ -SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) +SCTP_ARG_CONSTRUCTOR(STATE, enum sctp_state, state) SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc)
include/net/sctp/constants.h +2 -2
@@ -181,7 +181,7 @@ enum sctp_ierror {/* SCTP state defines for internal state machine */ -typedef enum { +enum sctp_state {SCTP_STATE_CLOSED =0 ,SCTP_STATE_COOKIE_WAIT =1 ,
@@ -192,7 +192,7 @@ typedef enum {SCTP_STATE_SHUTDOWN_RECEIVED =6 , SCTP_STATE_SHUTDOWN_ACK_SENT = 7, -} sctp_state_t; +};#define SCTP_STATE_MAX SCTP_STATE_SHUTDOWN_ACK_SENT#define SCTP_STATE_NUM_STATES (SCTP_STATE_MAX + 1)
include/net/sctp/sctp.h +1 -1
@@ -558,7 +558,7 @@ static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style)/* Is the association in this state? */ #define sctp_state (asoc, state) __sctp_state((asoc), (SCTP_STATE_##state))static inline int __sctp_state (const struct sctp_association *asoc, -sctp_state_t state) +enum sctp_state state) {return asoc->state = state; }
include/net/sctp/sm.h +5 -5
@@ -175,10 +175,10 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;/* Prototypes for utility support functions. */ __u8 sctp_get_chunk_type (struct sctp_chunk *chunk); -const sctp_sm_table_entry_t *sctp_sm_lookup_event (struct net *, -sctp_event_t , -sctp_state_t , -sctp_subtype_t ); +const sctp_sm_table_entry_t *sctp_sm_lookup_event (struct net *net, +sctp_event_t event_type, +enum sctp_state state, +sctp_subtype_t event_subtype);int sctp_chunk_iif (const struct sctp_chunk *); struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *, struct sctp_chunk *,
@@ -313,7 +313,7 @@ struct sctp_chunk *sctp_process_strreset_resp(/* Prototypes for statetable processing. */ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype, - sctp_state_t state, + enum sctp_state state, struct sctp_endpoint *, struct sctp_association *asoc, void *event_arg,
include/net/sctp/structs.h +1 -1
@@ -1577,7 +1577,7 @@ struct sctp_association {* * State takes values from SCTP_STATE_*. */ -sctp_state_t state; +enum sctp_state state;/* Overall : The overall association error count. * Error Count : [Clear this any time I get something.]
net/sctp/endpointola.c +1 -1
@@ -383,7 +383,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)struct sctp_chunk *chunk;struct sctp_inq *inqueue;sctp_subtype_t subtype; -sctp_state_t state; +enum sctp_state state;int error =0 ;int first_time =1 ;/* is this the first time through the loop */
net/sctp/primitive.c +1 -1
@@ -54,7 +54,7 @@ int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \ void *arg) { \int error =0 ; \sctp_event_t event_type;sctp_subtype_t subtype; \ -sctp_state_t state; \ +enum sctp_state state; \struct sctp_endpoint *ep; \ \ event_type =SCTP_EVENT_T_PRIMITIVE ; \
net/sctp/sm_sideeffect.c +6 -6
@@ -53,7 +53,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype, - sctp_state_t state, + enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association *asoc, void *event_arg,
@@ -61,7 +61,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,sctp_cmd_seq_t *commands, gfp_t gfp); static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, - sctp_state_t state, + enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association **asoc, void *event_arg,
@@ -843,7 +843,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds,/* Helper function to change the state of an association. */ static void sctp_cmd_new_state (sctp_cmd_seq_t *cmds,struct sctp_association *asoc, -sctp_state_t state) +enum sctp_state state) {struct sock *sk = asoc->base.sk;
@@ -1140,7 +1140,7 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)* good place to start. */ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype, - sctp_state_t state, + enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association *asoc, void *event_arg,
@@ -1179,7 +1179,7 @@ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,* This the master state function side effect processing function. *****************************************************************/ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, - sctp_state_t state, + enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association **asoc, void *event_arg,
@@ -1265,7 +1265,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,/* This is the side-effect interpreter. */ static int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype, - sctp_state_t state, + enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association *asoc, void *event_arg,
net/sctp/sm_statetable.c +9 -7
@@ -52,9 +52,10 @@ other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES ][SCTP_STATE_NUM_STATES ]; -static const sctp_sm_table_entry_t *sctp_chunk_event_lookup (struct net *net, -enum sctp_cid cid, -sctp_state_t state); +static const sctp_sm_table_entry_t *sctp_chunk_event_lookup ( +struct net *net, +enum sctp_cid cid, +enum sctp_state state);static const sctp_sm_table_entry_t bug = {
@@ -78,7 +79,7 @@ static const sctp_sm_table_entry_t bug = {const sctp_sm_table_entry_t *sctp_sm_lookup_event (struct net *net,sctp_event_t event_type, -sctp_state_t state, +enum sctp_state state,sctp_subtype_t event_subtype) {switch (event_type) {
@@ -967,9 +968,10 @@ static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][S TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE, }; -static const sctp_sm_table_entry_t *sctp_chunk_event_lookup (struct net *net, -enum sctp_cid cid, -sctp_state_t state) +static const sctp_sm_table_entry_t *sctp_chunk_event_lookup ( +struct net *net, +enum sctp_cid cid, +enum sctp_state state) {if (state >SCTP_STATE_MAX )return &bug;
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 10/14 sctp: remove the typedef sctp_event_primitive_t
This patch is to remove the typedef sctp_event_primitive_t, and replace with enum sctp_event_primitive in the places where it's using this typedef.
--- include/net/sctp/constants.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/net/sctp/constants.h +4 -4
@@ -110,7 +110,7 @@ typedef enum {#define SCTP_NUM_OTHER_TYPES (SCTP_EVENT_OTHER_MAX + 1)/* These are primitive requests from the ULP. */ -typedef enum { +enum sctp_event_primitive {SCTP_PRIMITIVE_ASSOCIATE =0 ,SCTP_PRIMITIVE_SHUTDOWN ,SCTP_PRIMITIVE_ABORT ,
@@ -118,7 +118,7 @@ typedef enum {SCTP_PRIMITIVE_REQUESTHEARTBEAT ,SCTP_PRIMITIVE_ASCONF , SCTP_PRIMITIVE_RECONF, -} sctp_event_primitive_t; +};#define SCTP_EVENT_PRIMITIVE_MAX SCTP_PRIMITIVE_RECONF#define SCTP_NUM_PRIMITIVE_TYPES (SCTP_EVENT_PRIMITIVE_MAX + 1)
@@ -133,7 +133,7 @@ typedef union {enum sctp_cid chunk;sctp_event_timeout_t timeout;sctp_event_other_t other; -sctp_event_primitive_t primitive; +enum sctp_event_primitive primitive; } sctp_subtype_t;#define SCTP_SUBTYPE_CONSTRUCTOR (_name, _type, _elt) \
@@ -144,7 +144,7 @@ SCTP_ST_## _name (_type _arg) \ SCTP_SUBTYPE_CONSTRUCTOR(CHUNK, enum sctp_cid, chunk) SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, sctp_event_timeout_t, timeout) SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other) -SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) +SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, enum sctp_event_primitive, primitive)#define sctp_chunk_is_data (a) (a->chunk_hdr->type = SCTP_CID_DATA)
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 11/14 sctp: remove the typedef sctp_event_other_t
This patch is to remove the typedef sctp_event_other_t, and replace with enum sctp_event_other in the places where it's using this typedef.
--- include/net/sctp/constants.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/net/sctp/constants.h +4 -4
@@ -101,10 +101,10 @@ typedef enum {#define SCTP_EVENT_TIMEOUT_MAX SCTP_EVENT_TIMEOUT_AUTOCLOSE#define SCTP_NUM_TIMEOUT_TYPES (SCTP_EVENT_TIMEOUT_MAX + 1) -typedef enum { +enum sctp_event_other {SCTP_EVENT_NO_PENDING_TSN =0 ,SCTP_EVENT_ICMP_PROTO_UNREACH , -}sctp_event_other_t ; +};#define SCTP_EVENT_OTHER_MAX SCTP_EVENT_ICMP_PROTO_UNREACH#define SCTP_NUM_OTHER_TYPES (SCTP_EVENT_OTHER_MAX + 1)
@@ -132,7 +132,7 @@ enum sctp_event_primitive {typedef union {enum sctp_cid chunk;sctp_event_timeout_t timeout; -sctp_event_other_t other; +enum sctp_event_other other;enum sctp_event_primitive primitive; }sctp_subtype_t ;
@@ -143,7 +143,7 @@ SCTP_ST_## _name (_type _arg) \ SCTP_SUBTYPE_CONSTRUCTOR(CHUNK, enum sctp_cid, chunk) SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, sctp_event_timeout_t, timeout) -SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other) +SCTP_SUBTYPE_CONSTRUCTOR(OTHER, enum sctp_event_other, other) SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, enum sctp_event_primitive, primitive)
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 12/14 sctp: remove the typedef sctp_event_timeout_t
This patch is to remove the typedef sctp_event_timeout_t, and replace with enum sctp_event_timeout in the places where it's using this typedef.
--- include/net/sctp/command.h | 4 ++-- include/net/sctp/constants.h | 8 ++++---- net/sctp/sm_sideeffect.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
include/net/sctp/command.h +2 -2
@@ -127,7 +127,7 @@ typedef union {int error;__be16 err;enum sctp_state state; -sctp_event_timeout_t to; +enum sctp_event_timeout to;struct sctp_chunk *chunk;struct sctp_association *asoc;struct sctp_transport *transport;
@@ -168,7 +168,7 @@ SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) SCTP_ARG_CONSTRUCTOR(ERROR, int, error) SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */ SCTP_ARG_CONSTRUCTOR(STATE, enum sctp_state, state) -SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) +SCTP_ARG_CONSTRUCTOR(TO, enum sctp_event_timeout, to) SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc) SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport)
include/net/sctp/constants.h +4 -4
@@ -84,7 +84,7 @@ typedef enum {* SCTP_ULP_* to the list of possible chunks. */ -typedef enum { +enum sctp_event_timeout {SCTP_EVENT_TIMEOUT_NONE =0 ,SCTP_EVENT_TIMEOUT_T1_COOKIE ,SCTP_EVENT_TIMEOUT_T1_INIT ,
@@ -96,7 +96,7 @@ typedef enum {SCTP_EVENT_TIMEOUT_RECONF ,SCTP_EVENT_TIMEOUT_SACK , SCTP_EVENT_TIMEOUT_AUTOCLOSE, -} sctp_event_timeout_t; +};#define SCTP_EVENT_TIMEOUT_MAX SCTP_EVENT_TIMEOUT_AUTOCLOSE#define SCTP_NUM_TIMEOUT_TYPES (SCTP_EVENT_TIMEOUT_MAX + 1)
@@ -131,7 +131,7 @@ enum sctp_event_primitive {typedef union {enum sctp_cid chunk; -sctp_event_timeout_t timeout; +enum sctp_event_timeout timeout;enum sctp_event_other other;enum sctp_event_primitive primitive; }sctp_subtype_t ;
@@ -142,7 +142,7 @@ SCTP_ST_## _name (_type _arg) \ {sctp_subtype_t _retval; _retval._elt = _arg;return _retval; } SCTP_SUBTYPE_CONSTRUCTOR(CHUNK, enum sctp_cid, chunk) -SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, sctp_event_timeout_t, timeout) +SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, enum sctp_event_timeout, timeout) SCTP_SUBTYPE_CONSTRUCTOR(OTHER, enum sctp_event_other, other) SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, enum sctp_event_primitive, primitive)
net/sctp/sm_sideeffect.c +3 -3
@@ -280,7 +280,7 @@ void sctp_generate_t3_rtx_event(unsigned long peer)* for timeouts which use the association as their parameter. */ static void sctp_generate_timeout_event (struct sctp_association *asoc, -sctp_event_timeout_t timeout_type) +enum sctp_event_timeout timeout_type) {struct sock *sk = asoc->base.sk;struct net *net =sock_net (sk);
@@ -1052,8 +1052,8 @@ static void sctp_cmd_adaptation_ind(sctp_cmd_seq_t *commands,static void sctp_cmd_t1_timer_update (struct sctp_association *asoc, -sctp_event_timeout_t timer, -char *name) +enum sctp_event_timeout timer, +char *name) {struct sctp_transport *t;
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 13/14 sctp: remove the typedef sctp_event_t
This patch is to remove the typedef sctp_event_t, and replace with enum sctp_event in the places where it's using this typedef.
--- include/net/sctp/constants.h | 6 ++---- include/net/sctp/sm.h | 12 +++++------- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 20 +++++++++----------- net/sctp/sm_statetable.c | 2 +- 5 files changed, 18 insertions(+), 24 deletions(-)
include/net/sctp/constants.h +2 -4
@@ -71,14 +71,12 @@ enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM }; SCTP_NUM_AUTH_CHUNK_TYPES)/* These are the different flavours of event. */ -typedef enum { - +enum sctp_event {SCTP_EVENT_T_CHUNK =1 ,SCTP_EVENT_T_TIMEOUT ,SCTP_EVENT_T_OTHER ,SCTP_EVENT_T_PRIMITIVE - -}sctp_event_t ; +};/* As a convenience for the state machine, we append SCTP_EVENT_* and * SCTP_ULP_* to the list of possible chunks.
include/net/sctp/sm.h +5 -7
@@ -176,7 +176,7 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;/* Prototypes for utility support functions. */ __u8 sctp_get_chunk_type (struct sctp_chunk *chunk);const sctp_sm_table_entry_t *sctp_sm_lookup_event (struct net *net, -sctp_event_t event_type, +enum sctp_event event_type,enum sctp_state state,sctp_subtype_t event_subtype);int sctp_chunk_iif (const struct sctp_chunk *);
@@ -312,12 +312,10 @@ struct sctp_chunk *sctp_process_strreset_resp(/* Prototypes for statetable processing. */ -int sctp_do_sm (struct net *net,sctp_event_t event_type,sctp_subtype_t subtype, -enum sctp_state state, -struct sctp_endpoint *, -struct sctp_association *asoc, -void *event_arg, -gfp_t gfp); +int sctp_do_sm (struct net *net,enum sctp_event event_type, +sctp_subtype_t subtype,enum sctp_state state, +struct sctp_endpoint *ep,struct sctp_association *asoc, +void *event_arg,gfp_t gfp);/* 2nd level prototypes */ void sctp_generate_t3_rtx_event (unsigned long peer);
net/sctp/primitive.c +1 -1
@@ -53,7 +53,7 @@ int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \ void *arg) { \ int error = 0; \ - sctp_event_t event_type; sctp_subtype_t subtype; \ + enum sctp_event event_type; sctp_subtype_t subtype; \ enum sctp_state state; \ struct sctp_endpoint *ep; \ \
net/sctp/sm_sideeffect.c +9 -11
@@ -51,7 +51,7 @@#include <net/sctp/sctp.h> #include <net/sctp/sm.h> -static int sctp_cmd_interpreter(sctp_event_t event_type, +static int sctp_cmd_interpreter(enum sctp_event event_type, sctp_subtype_t subtype, enum sctp_state state, struct sctp_endpoint *ep,
@@ -60,7 +60,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,sctp_disposition_t status, sctp_cmd_seq_t *commands, gfp_t gfp); -static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, +static int sctp_side_effects(enum sctp_event event_type, sctp_subtype_t subtype, enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association **asoc,
@@ -602,7 +602,7 @@ static void sctp_cmd_init_failed(sctp_cmd_seq_t *commands,/* Worker routine to handle SCTP_CMD_ASSOC_FAILED. */ static void sctp_cmd_assoc_failed (sctp_cmd_seq_t *commands,struct sctp_association *asoc, -sctp_event_t event_type, +enum sctp_event event_type,sctp_subtype_t subtype,struct sctp_chunk *chunk,unsigned int error)
@@ -1139,12 +1139,10 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)* If you want to understand all of lksctp, this is a * good place to start. */ -int sctp_do_sm (struct net *net,sctp_event_t event_type,sctp_subtype_t subtype, -enum sctp_state state, -struct sctp_endpoint *ep, -struct sctp_association *asoc, -void *event_arg, -gfp_t gfp) +int sctp_do_sm (struct net *net,enum sctp_event event_type, +sctp_subtype_t subtype,enum sctp_state state, +struct sctp_endpoint *ep,struct sctp_association *asoc, +void *event_arg,gfp_t gfp) {sctp_cmd_seq_t commands;const sctp_sm_table_entry_t *state_fn;
@@ -1178,7 +1176,7 @@ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,/***************************************************************** * This the master state function side effect processing function. *****************************************************************/ -static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, +static int sctp_side_effects(enum sctp_event event_type, sctp_subtype_t subtype, enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association **asoc,
@@ -1263,7 +1261,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,********************************************************************/ /* This is the side-effect interpreter. */ -static int sctp_cmd_interpreter(sctp_event_t event_type, +static int sctp_cmd_interpreter(enum sctp_event event_type, sctp_subtype_t subtype, enum sctp_state state, struct sctp_endpoint *ep,
net/sctp/sm_statetable.c +1 -1
@@ -78,7 +78,7 @@ static const sctp_sm_table_entry_t bug = { })const sctp_sm_table_entry_t *sctp_sm_lookup_event (struct net *net, -sctp_event_t event_type, +enum sctp_event event_type,enum sctp_state state,sctp_subtype_t event_subtype) {
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 14/14 sctp: remove the typedef sctp_subtype_t
This patch is to remove the typedef sctp_subtype_t, and replace with union sctp_subtype in the places where it's using this typedef.
Note that it doesn't fix many indents although it should, as sctp_disposition_t's removal would mess them up again. So better to fix them when removing sctp_disposition_t in later patch.
--- include/net/sctp/constants.h | 18 ++-- include/net/sctp/sm.h | 13 +-- net/sctp/associola.c | 2 +- net/sctp/debug.c | 8 +- net/sctp/endpointola.c | 2 +- net/sctp/primitive.c | 2 +- net/sctp/probe.c | 2 +- net/sctp/sm_sideeffect.c | 16 ++-- net/sctp/sm_statefuns.c | 191 ++++++++++++++++++++++--------------------- net/sctp/sm_statetable.c | 9 +- 10 files changed, 134 insertions(+), 129 deletions(-)
include/net/sctp/constants.h +9 -9
@@ -124,20 +124,20 @@ enum sctp_event_primitive {/* We define here a utility type for manipulating subtypes. * The subtype constructors all work like this: * -* sctp_subtype_t foo = SCTP_ST_CHUNK(SCTP_CID_INIT); +* union sctp_subtype foo = SCTP_ST_CHUNK(SCTP_CID_INIT); */ -typedef union { +union sctp_subtype {enum sctp_cid chunk;enum sctp_event_timeout timeout;enum sctp_event_other other;enum sctp_event_primitive primitive; -}sctp_subtype_t ; +};#define SCTP_SUBTYPE_CONSTRUCTOR (_name, _type, _elt) \ -static inline sctp_subtype_t \ +static inline union sctp_subtype \ SCTP_ST_## _name (_type _arg) \ -{ sctp_subtype_t _retval; _retval._elt = _arg; return _retval; } +{ union sctp_subtype _retval; _retval._elt = _arg; return _retval; } SCTP_SUBTYPE_CONSTRUCTOR(CHUNK, enum sctp_cid, chunk) SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, enum sctp_event_timeout, timeout)
@@ -220,10 +220,10 @@ enum sctp_sock_state { };/* These functions map various type to printable names. */ -const char *sctp_cname (const sctp_subtype_t );/* chunk types */ -const char *sctp_oname (const sctp_subtype_t );/* other events */ -const char *sctp_tname (const sctp_subtype_t );/* timeouts */ -const char *sctp_pname (const sctp_subtype_t );/* primitives */ +const char *sctp_cname (const union sctp_subtype id);/* chunk types */ +const char *sctp_oname (const union sctp_subtype id);/* other events */ +const char *sctp_tname (const union sctp_subtype id);/* timeouts */ +const char *sctp_pname (const union sctp_subtype id);/* primitives */ /* This is a table of printable names of sctp_state_t's. */ extern const char *const sctp_state_tbl[];
include/net/sctp/sm.h +7 -6
@@ -73,7 +73,7 @@ typedef struct {typedef sctp_disposition_t (sctp_state_fn_t ) (struct net *,const struct sctp_endpoint *,const struct sctp_association *, -const sctp_subtype_t type, +const union sctp_subtype type,void *arg,sctp_cmd_seq_t *);typedef void (sctp_timer_event_t ) (unsigned long );
@@ -175,10 +175,11 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;/* Prototypes for utility support functions. */ __u8 sctp_get_chunk_type (struct sctp_chunk *chunk); -const sctp_sm_table_entry_t *sctp_sm_lookup_event (struct net *net, -enum sctp_event event_type, -enum sctp_state state, -sctp_subtype_t event_subtype); +const sctp_sm_table_entry_t *sctp_sm_lookup_event ( +struct net *net, +enum sctp_event event_type, +enum sctp_state state, +union sctp_subtype event_subtype);int sctp_chunk_iif (const struct sctp_chunk *); struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *, struct sctp_chunk *,
@@ -313,7 +314,7 @@ struct sctp_chunk *sctp_process_strreset_resp(/* Prototypes for statetable processing. */ int sctp_do_sm (struct net *net,enum sctp_event event_type, -sctp_subtype_t subtype,enum sctp_state state, +union sctp_subtype subtype,enum sctp_state state,struct sctp_endpoint *ep,struct sctp_association *asoc,void *event_arg,gfp_t gfp);
net/sctp/associola.c +1 -1
@@ -1021,11 +1021,11 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) container_of(work, struct sctp_association, base.inqueue.immediate);struct net *net =sock_net (asoc->base.sk); +union sctp_subtype subtype;struct sctp_endpoint *ep;struct sctp_chunk *chunk;struct sctp_inq *inqueue;int state; -sctp_subtype_t subtype;int error =0 ;/* The association should be held so we should be safe. */
net/sctp/debug.c +4 -4
@@ -60,7 +60,7 @@ static const char *const sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = { };/* Lookup "chunk type" debug name. */ -const char *sctp_cname (const sctp_subtype_t cid) +const char *sctp_cname (const union sctp_subtype cid) {if (cid.chunk <=SCTP_CID_BASE_MAX )return sctp_cid_tbl[cid.chunk];
@@ -130,7 +130,7 @@ static const char *const sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = { };/* Lookup primitive debug name. */ -const char *sctp_pname (const sctp_subtype_t id) +const char *sctp_pname (const union sctp_subtype id) {if (id.primitive <=SCTP_EVENT_PRIMITIVE_MAX )return sctp_primitive_tbl[id.primitive];
@@ -143,7 +143,7 @@ static const char *const sctp_other_tbl[] = { };/* Lookup "other" debug name. */ -const char *sctp_oname (const sctp_subtype_t id) +const char *sctp_oname (const union sctp_subtype id) {if (id.other <=SCTP_EVENT_OTHER_MAX )return sctp_other_tbl[id.other];
@@ -165,7 +165,7 @@ static const char *const sctp_timer_tbl[] = { };/* Lookup timer debug name. */ -const char *sctp_tname (const sctp_subtype_t id) +const char *sctp_tname (const union sctp_subtype id) {BUILD_BUG_ON (SCTP_EVENT_TIMEOUT_MAX +1 !=ARRAY_SIZE (sctp_timer_tbl));
net/sctp/endpointola.c +1 -1
@@ -382,7 +382,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)struct sctp_transport *transport;struct sctp_chunk *chunk;struct sctp_inq *inqueue; -sctp_subtype_t subtype; +union sctp_subtype subtype;enum sctp_state state;int error =0 ;int first_time =1 ;/* is this the first time through the loop */
net/sctp/primitive.c +1 -1
@@ -53,7 +53,7 @@ int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \ void *arg) { \ int error = 0; \ - enum sctp_event event_type; sctp_subtype_t subtype; \ + enum sctp_event event_type; union sctp_subtype subtype; \ enum sctp_state state; \ struct sctp_endpoint *ep; \ \
net/sctp/probe.c +1 -1
@@ -130,7 +130,7 @@ static const struct file_operations sctpprobe_fops = {static sctp_disposition_t jsctp_sf_eat_sack (struct net *net,const struct sctp_endpoint *ep,const struct sctp_association *asoc, -const sctp_subtype_t type, +const union sctp_subtype type,void *arg,sctp_cmd_seq_t *commands) {
net/sctp/sm_sideeffect.c +9 -7
@@ -52,7 +52,7 @@#include <net/sctp/sm.h> static int sctp_cmd_interpreter(enum sctp_event event_type, - sctp_subtype_t subtype, + union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association *asoc,
@@ -60,7 +60,8 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,sctp_disposition_t status, sctp_cmd_seq_t *commands, gfp_t gfp); -static int sctp_side_effects(enum sctp_event event_type, sctp_subtype_t subtype, +static int sctp_side_effects(enum sctp_event event_type, + union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association **asoc,
@@ -603,7 +604,7 @@ static void sctp_cmd_init_failed(sctp_cmd_seq_t *commands,static void sctp_cmd_assoc_failed (sctp_cmd_seq_t *commands,struct sctp_association *asoc,enum sctp_event event_type, -sctp_subtype_t subtype, +union sctp_subtype subtype,struct sctp_chunk *chunk,unsigned int error) {
@@ -1140,7 +1141,7 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)* good place to start. */ int sctp_do_sm (struct net *net,enum sctp_event event_type, -sctp_subtype_t subtype,enum sctp_state state, +union sctp_subtype subtype,enum sctp_state state,struct sctp_endpoint *ep,struct sctp_association *asoc,void *event_arg,gfp_t gfp) {
@@ -1148,7 +1149,7 @@ int sctp_do_sm(struct net *net, enum sctp_event event_type,const sctp_sm_table_entry_t *state_fn;sctp_disposition_t status;int error =0 ; -typedef const char *(printfn_t )(sctp_subtype_t ); +typedef const char *(printfn_t )(union sctp_subtype );static printfn_t *table[] = {NULL , sctp_cname, sctp_tname, sctp_oname, sctp_pname, };
@@ -1176,7 +1177,8 @@ int sctp_do_sm(struct net *net, enum sctp_event event_type,/***************************************************************** * This the master state function side effect processing function. *****************************************************************/ -static int sctp_side_effects(enum sctp_event event_type, sctp_subtype_t subtype, +static int sctp_side_effects(enum sctp_event event_type, + union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association **asoc,
@@ -1262,7 +1264,7 @@ static int sctp_side_effects(enum sctp_event event_type, sctp_subtype_t subtype,/* This is the side-effect interpreter. */ static int sctp_cmd_interpreter(enum sctp_event event_type, - sctp_subtype_t subtype, + union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep, struct sctp_association *asoc,
net/sctp/sm_statefuns.c +96 -95
758 lines not on this page · raw message
net/sctp/sm_statetable.c +5 -4
@@ -77,10 +77,11 @@ static const sctp_sm_table_entry_t bug = { rtn; \ }) -const sctp_sm_table_entry_t *sctp_sm_lookup_event (struct net *net, -enum sctp_event event_type, -enum sctp_state state, -sctp_subtype_t event_subtype) +const sctp_sm_table_entry_t *sctp_sm_lookup_event ( +struct net *net, +enum sctp_event event_type, +enum sctp_state state, +union sctp_subtype event_subtype) {switch (event_type) {case SCTP_EVENT_T_CHUNK :
Signature · 1 line
2.1.0
RE: [PATCH net-next 03/14] sctp: remove the typedef sctp_scope_policy_t
In reply to Xin LongFrom: Xin Long
Quoted 21 lines
Sent: 05 August 2017 13:00
This patch is to remove the typedefsctp_scope_policy_tand keep it's members as an anonymous enum.It is also to define
SCTP_SCOPE_POLICY_MAXto replace the num 3 insysctl.cto make codes clear.Signed-off-by Xin Long <[email protected]>--- include/net/sctp/constants.h | 6 ++++-- net/sctp/sysctl.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)include/net/sctp/constants.h +0
-0@@ -341,12 +341,14 @@ typedef enum { SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */ } sctp_scope_t;
include/net/sctp/constants.h typedef enum { · line 351
Quoted 10 lines
include/net/sctp/constants.h +4
-2-typedef enum { +enum {SCTP_SCOPE_POLICY_DISABLE ,/* Disable IPv4 address scoping */ SCTP_SCOPE_POLICY_ENABLE ,/* Enable IPv4 address scoping */ SCTP_SCOPE_POLICY_PRIVATE ,/* Follow draft but allow IPv4 private addresses */ SCTP_SCOPE_POLICY_LINK ,/* Follow draft but allow IPv4 link local addresses */ -}sctp_scope_policy_t ; +}; + +#define SCTP_SCOPE_POLICY_MAX SCTP_SCOPE_POLICY_LINK
Perhaps slightly better to end the enum with:
SCTP_SCOPE_POLICY_COUNT, /* Number of policies */
SCTP_SCOPE_POLICY_MAX = SCTP_SCOPE_POLICY_COUNT - 1 /* Last policy */
};
David
Xin Long
maintainerRe: [PATCH net-next 03/14] sctp: remove the typedef sctp_scope_policy_t
Quoted 22 lines · David Laight
From: Xin Long
Quoted 21 lines
Sent: 05 August 2017 13:00
This patch is to remove the typedefsctp_scope_policy_tand keep it's members as an anonymous enum.It is also to define
SCTP_SCOPE_POLICY_MAXto replace the num 3 insysctl.cto make codes clear.Signed-off-by Xin Long <[email protected]>--- include/net/sctp/constants.h | 6 ++++-- net/sctp/sysctl.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)include/net/sctp/constants.h +0
-0@@ -341,12 +341,14 @@ typedef enum { SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */ } sctp_scope_t;
Quoted 15 lines
include/net/sctp/constants.h typedef enum { · line 351
Quoted 10 lines
include/net/sctp/constants.h +4
-2-typedef enum { +enum {SCTP_SCOPE_POLICY_DISABLE ,/* Disable IPv4 address scoping */ SCTP_SCOPE_POLICY_ENABLE ,/* Enable IPv4 address scoping */ SCTP_SCOPE_POLICY_PRIVATE ,/* Follow draft but allow IPv4 private addresses */ SCTP_SCOPE_POLICY_LINK ,/* Follow draft but allow IPv4 link local addresses */ -}sctp_scope_policy_t ; +}; + +#define SCTP_SCOPE_POLICY_MAX SCTP_SCOPE_POLICY_LINKPerhaps slightly better to end the enum with:
SCTP_SCOPE_POLICY_COUNT, /* Number of policies */
SCTP_SCOPE_POLICY_MAX=SCTP_SCOPE_POLICY_COUNT- 1 /* Last policy */
};
It might be, so that new member coming will not change too much.
I just copied the idea of SCTP_EVENT_xxxx_MAX, SCTP_STATE_MAX :-)
David Miller
maintainerFrom: Xin Long <[email protected]>
Date: Sat, 5 Aug 2017 19:59:50 +0800
Quoted 8 lines
As we know, typedef is suggested not to use in kernel, even checkpatch.pl also gives warnings about it. Now sctp is using it for many structures.
All this kind of typedef's using should be removed. This patchset is the part 5 to remove all typedefs in
include/net/sctp/constants.h.Just as the part 1-4, No any code's logic would be changed in these patches, only cleaning up.
Series applied, thank you.