sctp: remove the typedef sctp_state_t
authorXin Long <lucien.xin@gmail.com>
Sat, 5 Aug 2017 11:59:59 +0000 (19:59 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Aug 2017 04:33:42 +0000 (21:33 -0700)
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>
include/net/sctp/command.h
include/net/sctp/constants.h
include/net/sctp/sctp.h
include/net/sctp/sm.h
include/net/sctp/structs.h
net/sctp/endpointola.c
net/sctp/primitive.c
net/sctp/sm_sideeffect.c
net/sctp/sm_statetable.c

index 1d5f6ff3f440816ea184a74b6d5cb706c3df1c08..be12ec946628dc6cfd146aecacb52101755eabaa 100644 (file)
@@ -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)
index 9a694653b7086be28ea96923585f918e6373e49e..db9f40b657ba1d964699f651bee42c78089f62cd 100644 (file)
@@ -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)
index 0022bc713434b2c29095638665321dcd965f3f5d..24ff7931d38cc974162b2e203dfb9a5d104b7ab1 100644 (file)
@@ -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;
 }
index 860f378333b577b5f26357c512e34893a837cfe3..281e8d1e0752666962ab0a360e36abcf54e866d0 100644 (file)
@@ -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,
index 6fab67e7f1e5f5887c16da55179c1c9b149a616f..fbe6e81b889b31f798683d296a51e4f658ae122b 100644 (file)
@@ -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.]
index 3d506b2f619343f5b7ebf1c6f5d824b2bab0d0a7..4111c00a9d9deaed804b2f2c1c28da03d6487462 100644 (file)
@@ -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 */
 
index f0553a022859235ffed49dc190c319995a143798..1fb5b9bb3c6d9ccfc9b0494b290a1af960d3472a 100644 (file)
@@ -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; \
index 5dda8c42b5f6f35ca5ca7018e41357ccb5c2b28d..b77a81aa907b83cfbcfd5970c42f61f427ddf1ba 100644 (file)
@@ -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 @@ bail:
 /* 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,
index 3e958c1c4b95dad376b70d225050168849605103..f46c11bffea7611845cc493f4c92483f03827627 100644 (file)
@@ -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;