Skip to content

Commit 5210601

Browse files
lxindavem330
authored andcommitted
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>
1 parent 4785c7a commit 5210601

9 files changed

Lines changed: 28 additions & 26 deletions

File tree

‎include/net/sctp/command.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ typedef union {
126126
__u8 u8;
127127
int error;
128128
__be16 err;
129-
sctp_state_t state;
129+
enum sctp_state state;
130130
sctp_event_timeout_t to;
131131
struct sctp_chunk *chunk;
132132
struct sctp_association *asoc;
@@ -167,7 +167,7 @@ SCTP_ARG_CONSTRUCTOR(U16, __u16, u16)
167167
SCTP_ARG_CONSTRUCTOR(U8, __u8, u8)
168168
SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
169169
SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */
170-
SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
170+
SCTP_ARG_CONSTRUCTOR(STATE, enum sctp_state, state)
171171
SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
172172
SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
173173
SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc)

‎include/net/sctp/constants.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ enum sctp_ierror {
181181

182182

183183
/* SCTP state defines for internal state machine */
184-
typedef enum {
184+
enum sctp_state {
185185

186186
SCTP_STATE_CLOSED = 0,
187187
SCTP_STATE_COOKIE_WAIT = 1,
@@ -192,7 +192,7 @@ typedef enum {
192192
SCTP_STATE_SHUTDOWN_RECEIVED = 6,
193193
SCTP_STATE_SHUTDOWN_ACK_SENT = 7,
194194

195-
} sctp_state_t;
195+
};
196196

197197
#define SCTP_STATE_MAX SCTP_STATE_SHUTDOWN_ACK_SENT
198198
#define SCTP_STATE_NUM_STATES (SCTP_STATE_MAX + 1)

‎include/net/sctp/sctp.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style)
558558
/* Is the association in this state? */
559559
#define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state))
560560
static inline int __sctp_state(const struct sctp_association *asoc,
561-
sctp_state_t state)
561+
enum sctp_state state)
562562
{
563563
return asoc->state == state;
564564
}

‎include/net/sctp/sm.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;
175175

176176
/* Prototypes for utility support functions. */
177177
__u8 sctp_get_chunk_type(struct sctp_chunk *chunk);
178-
const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *,
179-
sctp_event_t,
180-
sctp_state_t,
181-
sctp_subtype_t);
178+
const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
179+
sctp_event_t event_type,
180+
enum sctp_state state,
181+
sctp_subtype_t event_subtype);
182182
int sctp_chunk_iif(const struct sctp_chunk *);
183183
struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *,
184184
struct sctp_chunk *,
@@ -313,7 +313,7 @@ struct sctp_chunk *sctp_process_strreset_resp(
313313
/* Prototypes for statetable processing. */
314314

315315
int 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,
317317
struct sctp_endpoint *,
318318
struct sctp_association *asoc,
319319
void *event_arg,

‎include/net/sctp/structs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ struct sctp_association {
15771577
*
15781578
* State takes values from SCTP_STATE_*.
15791579
*/
1580-
sctp_state_t state;
1580+
enum sctp_state state;
15811581

15821582
/* Overall : The overall association error count.
15831583
* Error Count : [Clear this any time I get something.]

‎net/sctp/endpointola.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)
383383
struct sctp_chunk *chunk;
384384
struct sctp_inq *inqueue;
385385
sctp_subtype_t subtype;
386-
sctp_state_t state;
386+
enum sctp_state state;
387387
int error = 0;
388388
int first_time = 1; /* is this the first time through the loop */
389389

‎net/sctp/primitive.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \
5454
void *arg) { \
5555
int error = 0; \
5656
sctp_event_t event_type; sctp_subtype_t subtype; \
57-
sctp_state_t state; \
57+
enum sctp_state state; \
5858
struct sctp_endpoint *ep; \
5959
\
6060
event_type = SCTP_EVENT_T_PRIMITIVE; \

‎net/sctp/sm_sideeffect.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353

5454
static int sctp_cmd_interpreter(sctp_event_t event_type,
5555
sctp_subtype_t subtype,
56-
sctp_state_t state,
56+
enum sctp_state state,
5757
struct sctp_endpoint *ep,
5858
struct sctp_association *asoc,
5959
void *event_arg,
6060
sctp_disposition_t status,
6161
sctp_cmd_seq_t *commands,
6262
gfp_t gfp);
6363
static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
64-
sctp_state_t state,
64+
enum sctp_state state,
6565
struct sctp_endpoint *ep,
6666
struct sctp_association **asoc,
6767
void *event_arg,
@@ -843,7 +843,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds,
843843
/* Helper function to change the state of an association. */
844844
static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds,
845845
struct sctp_association *asoc,
846-
sctp_state_t state)
846+
enum sctp_state state)
847847
{
848848
struct sock *sk = asoc->base.sk;
849849

@@ -1140,7 +1140,7 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)
11401140
* good place to start.
11411141
*/
11421142
int 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,
11441144
struct sctp_endpoint *ep,
11451145
struct sctp_association *asoc,
11461146
void *event_arg,
@@ -1179,7 +1179,7 @@ int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
11791179
* This the master state function side effect processing function.
11801180
*****************************************************************/
11811181
static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
1182-
sctp_state_t state,
1182+
enum sctp_state state,
11831183
struct sctp_endpoint *ep,
11841184
struct sctp_association **asoc,
11851185
void *event_arg,
@@ -1265,7 +1265,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
12651265
/* This is the side-effect interpreter. */
12661266
static int sctp_cmd_interpreter(sctp_event_t event_type,
12671267
sctp_subtype_t subtype,
1268-
sctp_state_t state,
1268+
enum sctp_state state,
12691269
struct sctp_endpoint *ep,
12701270
struct sctp_association *asoc,
12711271
void *event_arg,

‎net/sctp/sm_statetable.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
5252
static const sctp_sm_table_entry_t
5353
timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
5454

55-
static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
56-
enum sctp_cid cid,
57-
sctp_state_t state);
55+
static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(
56+
struct net *net,
57+
enum sctp_cid cid,
58+
enum sctp_state state);
5859

5960

6061
static const sctp_sm_table_entry_t bug = {
@@ -78,7 +79,7 @@ static const sctp_sm_table_entry_t bug = {
7879

7980
const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
8081
sctp_event_t event_type,
81-
sctp_state_t state,
82+
enum sctp_state state,
8283
sctp_subtype_t event_subtype)
8384
{
8485
switch (event_type) {
@@ -967,9 +968,10 @@ static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][S
967968
TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
968969
};
969970

970-
static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
971-
enum sctp_cid cid,
972-
sctp_state_t state)
971+
static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(
972+
struct net *net,
973+
enum sctp_cid cid,
974+
enum sctp_state state)
973975
{
974976
if (state > SCTP_STATE_MAX)
975977
return &bug;

0 commit comments

Comments
 (0)