aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2017-08-05 07:59:59 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-07 00:33:42 -0400
commit5210601945f5aedaf2d7f13a88436e27a39c6a8a (patch)
tree0b196af33c9451344db77f832dbc4d26188e10e5
parent4785c7ae1848244da3435ba5269f6288c15975c7 (diff)
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. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sctp/command.h4
-rw-r--r--include/net/sctp/constants.h4
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/sm.h10
-rw-r--r--include/net/sctp/structs.h2
-rw-r--r--net/sctp/endpointola.c2
-rw-r--r--net/sctp/primitive.c2
-rw-r--r--net/sctp/sm_sideeffect.c12
-rw-r--r--net/sctp/sm_statetable.c16
9 files changed, 28 insertions, 26 deletions
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 1d5f6ff3f440..be12ec946628 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -126,7 +126,7 @@ typedef union {
126 __u8 u8; 126 __u8 u8;
127 int error; 127 int error;
128 __be16 err; 128 __be16 err;
129 sctp_state_t state; 129 enum sctp_state state;
130 sctp_event_timeout_t to; 130 sctp_event_timeout_t to;
131 struct sctp_chunk *chunk; 131 struct sctp_chunk *chunk;
132 struct sctp_association *asoc; 132 struct sctp_association *asoc;
@@ -167,7 +167,7 @@ SCTP_ARG_CONSTRUCTOR(U16, __u16, u16)
167SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) 167SCTP_ARG_CONSTRUCTOR(U8, __u8, u8)
168SCTP_ARG_CONSTRUCTOR(ERROR, int, error) 168SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
169SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */ 169SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */
170SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 170SCTP_ARG_CONSTRUCTOR(STATE, enum sctp_state, state)
171SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 171SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
172SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) 172SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
173SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc) 173SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 9a694653b708..db9f40b657ba 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -181,7 +181,7 @@ enum sctp_ierror {
181 181
182 182
183/* SCTP state defines for internal state machine */ 183/* SCTP state defines for internal state machine */
184typedef enum { 184enum sctp_state {
185 185
186 SCTP_STATE_CLOSED = 0, 186 SCTP_STATE_CLOSED = 0,
187 SCTP_STATE_COOKIE_WAIT = 1, 187 SCTP_STATE_COOKIE_WAIT = 1,
@@ -192,7 +192,7 @@ typedef enum {
192 SCTP_STATE_SHUTDOWN_RECEIVED = 6, 192 SCTP_STATE_SHUTDOWN_RECEIVED = 6,
193 SCTP_STATE_SHUTDOWN_ACK_SENT = 7, 193 SCTP_STATE_SHUTDOWN_ACK_SENT = 7,
194 194
195} sctp_state_t; 195};
196 196
197#define SCTP_STATE_MAX SCTP_STATE_SHUTDOWN_ACK_SENT 197#define SCTP_STATE_MAX SCTP_STATE_SHUTDOWN_ACK_SENT
198#define SCTP_STATE_NUM_STATES (SCTP_STATE_MAX + 1) 198#define SCTP_STATE_NUM_STATES (SCTP_STATE_MAX + 1)
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 0022bc713434..24ff7931d38c 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -558,7 +558,7 @@ static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style)
558/* Is the association in this state? */ 558/* Is the association in this state? */
559#define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state)) 559#define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state))
560static inline int __sctp_state(const struct sctp_association *asoc, 560static inline int __sctp_state(const struct sctp_association *asoc,
561 sctp_state_t state) 561 enum sctp_state state)
562{ 562{
563 return asoc->state == state; 563 return asoc->state == state;
564} 564}
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 860f378333b5..281e8d1e0752 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -175,10 +175,10 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;
175 175
176/* Prototypes for utility support functions. */ 176/* Prototypes for utility support functions. */
177__u8 sctp_get_chunk_type(struct sctp_chunk *chunk); 177__u8 sctp_get_chunk_type(struct sctp_chunk *chunk);
178const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *, 178const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
179 sctp_event_t, 179 sctp_event_t event_type,
180 sctp_state_t, 180 enum sctp_state state,
181 sctp_subtype_t); 181 sctp_subtype_t event_subtype);
182int sctp_chunk_iif(const struct sctp_chunk *); 182int sctp_chunk_iif(const struct sctp_chunk *);
183struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *, 183struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *,
184 struct sctp_chunk *, 184 struct sctp_chunk *,
@@ -313,7 +313,7 @@ struct sctp_chunk *sctp_process_strreset_resp(
313/* Prototypes for statetable processing. */ 313/* Prototypes for statetable processing. */
314 314
315int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype, 315int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
316 sctp_state_t state, 316 enum sctp_state state,
317 struct sctp_endpoint *, 317 struct sctp_endpoint *,
318 struct sctp_association *asoc, 318 struct sctp_association *asoc,
319 void *event_arg, 319 void *event_arg,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 6fab67e7f1e5..fbe6e81b889b 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1577,7 +1577,7 @@ struct sctp_association {
1577 * 1577 *
1578 * State takes values from SCTP_STATE_*. 1578 * State takes values from SCTP_STATE_*.
1579 */ 1579 */
1580 sctp_state_t state; 1580 enum sctp_state state;
1581 1581
1582 /* Overall : The overall association error count. 1582 /* Overall : The overall association error count.
1583 * Error Count : [Clear this any time I get something.] 1583 * Error Count : [Clear this any time I get something.]
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 3d506b2f6193..4111c00a9d9d 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -383,7 +383,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)
383 struct sctp_chunk *chunk; 383 struct sctp_chunk *chunk;
384 struct sctp_inq *inqueue; 384 struct sctp_inq *inqueue;
385 sctp_subtype_t subtype; 385 sctp_subtype_t subtype;
386 sctp_state_t state; 386 enum sctp_state state;
387 int error = 0; 387 int error = 0;
388 int first_time = 1; /* is this the first time through the loop */ 388 int first_time = 1; /* is this the first time through the loop */
389 389
diff --git a/net/sctp/primitive.c b/net/sctp/primitive.c
index f0553a022859..1fb5b9bb3c6d 100644
--- a/net/sctp/primitive.c
+++ b/net/sctp/primitive.c
@@ -54,7 +54,7 @@ int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \
54 void *arg) { \ 54 void *arg) { \
55 int error = 0; \ 55 int error = 0; \
56 sctp_event_t event_type; sctp_subtype_t subtype; \ 56 sctp_event_t event_type; sctp_subtype_t subtype; \
57 sctp_state_t state; \ 57 enum sctp_state state; \
58 struct sctp_endpoint *ep; \ 58 struct sctp_endpoint *ep; \
59 \ 59 \
60 event_type = SCTP_EVENT_T_PRIMITIVE; \ 60 event_type = SCTP_EVENT_T_PRIMITIVE; \
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 5dda8c42b5f6..b77a81aa907b 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -53,7 +53,7 @@
53 53
54static int sctp_cmd_interpreter(sctp_event_t event_type, 54static int sctp_cmd_interpreter(sctp_event_t event_type,
55 sctp_subtype_t subtype, 55 sctp_subtype_t subtype,
56 sctp_state_t state, 56 enum sctp_state state,
57 struct sctp_endpoint *ep, 57 struct sctp_endpoint *ep,
58 struct sctp_association *asoc, 58 struct sctp_association *asoc,
59 void *event_arg, 59 void *event_arg,
@@ -61,7 +61,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
61 sctp_cmd_seq_t *commands, 61 sctp_cmd_seq_t *commands,
62 gfp_t gfp); 62 gfp_t gfp);
63static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, 63static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
64 sctp_state_t state, 64 enum sctp_state state,
65 struct sctp_endpoint *ep, 65 struct sctp_endpoint *ep,
66 struct sctp_association **asoc, 66 struct sctp_association **asoc,
67 void *event_arg, 67 void *event_arg,
@@ -843,7 +843,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds,
843/* Helper function to change the state of an association. */ 843/* Helper function to change the state of an association. */
844static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, 844static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds,
845 struct sctp_association *asoc, 845 struct sctp_association *asoc,
846 sctp_state_t state) 846 enum sctp_state state)
847{ 847{
848 struct sock *sk = asoc->base.sk; 848 struct sock *sk = asoc->base.sk;
849 849
@@ -1140,7 +1140,7 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)
1140 * good place to start. 1140 * good place to start.
1141 */ 1141 */
1142int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype, 1142int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
1143 sctp_state_t state, 1143 enum sctp_state state,
1144 struct sctp_endpoint *ep, 1144 struct sctp_endpoint *ep,
1145 struct sctp_association *asoc, 1145 struct sctp_association *asoc,
1146 void *event_arg, 1146 void *event_arg,
@@ -1179,7 +1179,7 @@ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
1179 * This the master state function side effect processing function. 1179 * This the master state function side effect processing function.
1180 *****************************************************************/ 1180 *****************************************************************/
1181static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, 1181static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
1182 sctp_state_t state, 1182 enum sctp_state state,
1183 struct sctp_endpoint *ep, 1183 struct sctp_endpoint *ep,
1184 struct sctp_association **asoc, 1184 struct sctp_association **asoc,
1185 void *event_arg, 1185 void *event_arg,
@@ -1265,7 +1265,7 @@ bail:
1265/* This is the side-effect interpreter. */ 1265/* This is the side-effect interpreter. */
1266static int sctp_cmd_interpreter(sctp_event_t event_type, 1266static int sctp_cmd_interpreter(sctp_event_t event_type,
1267 sctp_subtype_t subtype, 1267 sctp_subtype_t subtype,
1268 sctp_state_t state, 1268 enum sctp_state state,
1269 struct sctp_endpoint *ep, 1269 struct sctp_endpoint *ep,
1270 struct sctp_association *asoc, 1270 struct sctp_association *asoc,
1271 void *event_arg, 1271 void *event_arg,
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 3e958c1c4b95..f46c11bffea7 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -52,9 +52,10 @@ other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
52static const sctp_sm_table_entry_t 52static const sctp_sm_table_entry_t
53timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES]; 53timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
54 54
55static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net, 55static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(
56 enum sctp_cid cid, 56 struct net *net,
57 sctp_state_t state); 57 enum sctp_cid cid,
58 enum sctp_state state);
58 59
59 60
60static const sctp_sm_table_entry_t bug = { 61static const sctp_sm_table_entry_t bug = {
@@ -78,7 +79,7 @@ static const sctp_sm_table_entry_t bug = {
78 79
79const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net, 80const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
80 sctp_event_t event_type, 81 sctp_event_t event_type,
81 sctp_state_t state, 82 enum sctp_state state,
82 sctp_subtype_t event_subtype) 83 sctp_subtype_t event_subtype)
83{ 84{
84 switch (event_type) { 85 switch (event_type) {
@@ -967,9 +968,10 @@ static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][S
967 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE, 968 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
968}; 969};
969 970
970static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net, 971static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(
971 enum sctp_cid cid, 972 struct net *net,
972 sctp_state_t state) 973 enum sctp_cid cid,
974 enum sctp_state state)
973{ 975{
974 if (state > SCTP_STATE_MAX) 976 if (state > SCTP_STATE_MAX)
975 return &bug; 977 return &bug;