Commit a85bbeb2 authored by Xin Long's avatar Xin Long Committed by David S. Miller

sctp: remove the typedef sctp_cmd_seq_t

This patch is to remove the typedef sctp_cmd_seq_t, and
replace with struct sctp_cmd_seq 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
the later patch.
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e2c3108a
...@@ -110,7 +110,7 @@ typedef enum { ...@@ -110,7 +110,7 @@ typedef enum {
SCTP_CMD_LAST SCTP_CMD_LAST
} sctp_verb_t; } sctp_verb_t;
/* How many commands can you put in an sctp_cmd_seq_t? /* How many commands can you put in an struct sctp_cmd_seq?
* This is a rather arbitrary number, ideally derived from a careful * This is a rather arbitrary number, ideally derived from a careful
* analysis of the state functions, but in reality just taken from * analysis of the state functions, but in reality just taken from
* thin air in the hopes othat we don't trigger a kernel panic. * thin air in the hopes othat we don't trigger a kernel panic.
...@@ -201,17 +201,17 @@ struct sctp_cmd { ...@@ -201,17 +201,17 @@ struct sctp_cmd {
sctp_verb_t verb; sctp_verb_t verb;
}; };
typedef struct { struct sctp_cmd_seq {
struct sctp_cmd cmds[SCTP_MAX_NUM_COMMANDS]; struct sctp_cmd cmds[SCTP_MAX_NUM_COMMANDS];
struct sctp_cmd *last_used_slot; struct sctp_cmd *last_used_slot;
struct sctp_cmd *next_cmd; struct sctp_cmd *next_cmd;
} sctp_cmd_seq_t; };
/* Initialize a block of memory as a command sequence. /* Initialize a block of memory as a command sequence.
* Return 0 if the initialization fails. * Return 0 if the initialization fails.
*/ */
static inline int sctp_init_cmd_seq(sctp_cmd_seq_t *seq) static inline int sctp_init_cmd_seq(struct sctp_cmd_seq *seq)
{ {
/* cmds[] is filled backwards to simplify the overflow BUG() check */ /* cmds[] is filled backwards to simplify the overflow BUG() check */
seq->last_used_slot = seq->cmds + SCTP_MAX_NUM_COMMANDS; seq->last_used_slot = seq->cmds + SCTP_MAX_NUM_COMMANDS;
...@@ -220,12 +220,12 @@ static inline int sctp_init_cmd_seq(sctp_cmd_seq_t *seq) ...@@ -220,12 +220,12 @@ static inline int sctp_init_cmd_seq(sctp_cmd_seq_t *seq)
} }
/* Add a command to an sctp_cmd_seq_t. /* Add a command to an struct sctp_cmd_seq.
* *
* Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above
* to wrap data which goes in the obj argument. * to wrap data which goes in the obj argument.
*/ */
static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, static inline void sctp_add_cmd_sf(struct sctp_cmd_seq *seq, sctp_verb_t verb,
sctp_arg_t obj) sctp_arg_t obj)
{ {
struct sctp_cmd *cmd = seq->last_used_slot - 1; struct sctp_cmd *cmd = seq->last_used_slot - 1;
...@@ -240,7 +240,7 @@ static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, ...@@ -240,7 +240,7 @@ static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb,
/* Return the next command structure in an sctp_cmd_seq. /* Return the next command structure in an sctp_cmd_seq.
* Return NULL at the end of the sequence. * Return NULL at the end of the sequence.
*/ */
static inline struct sctp_cmd *sctp_next_cmd(sctp_cmd_seq_t *seq) static inline struct sctp_cmd *sctp_next_cmd(struct sctp_cmd_seq *seq)
{ {
if (seq->next_cmd <= seq->last_used_slot) if (seq->next_cmd <= seq->last_used_slot)
return NULL; return NULL;
......
...@@ -75,7 +75,7 @@ typedef sctp_disposition_t (sctp_state_fn_t) (struct net *, ...@@ -75,7 +75,7 @@ typedef sctp_disposition_t (sctp_state_fn_t) (struct net *,
const struct sctp_association *, const struct sctp_association *,
const union sctp_subtype type, const union sctp_subtype type,
void *arg, void *arg,
sctp_cmd_seq_t *); struct sctp_cmd_seq *);
typedef void (sctp_timer_event_t) (unsigned long); typedef void (sctp_timer_event_t) (unsigned long);
typedef struct { typedef struct {
sctp_state_fn_t *fn; sctp_state_fn_t *fn;
......
...@@ -132,7 +132,7 @@ static sctp_disposition_t jsctp_sf_eat_sack(struct net *net, ...@@ -132,7 +132,7 @@ static sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
const struct sctp_association *asoc, const struct sctp_association *asoc,
const union sctp_subtype type, const union sctp_subtype type,
void *arg, void *arg,
sctp_cmd_seq_t *commands) struct sctp_cmd_seq *commands)
{ {
struct sctp_chunk *chunk = arg; struct sctp_chunk *chunk = arg;
struct sk_buff *skb = chunk->skb; struct sk_buff *skb = chunk->skb;
......
...@@ -58,7 +58,7 @@ static int sctp_cmd_interpreter(enum sctp_event event_type, ...@@ -58,7 +58,7 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,
struct sctp_association *asoc, struct sctp_association *asoc,
void *event_arg, void *event_arg,
sctp_disposition_t status, sctp_disposition_t status,
sctp_cmd_seq_t *commands, struct sctp_cmd_seq *commands,
gfp_t gfp); gfp_t gfp);
static int sctp_side_effects(enum sctp_event event_type, static int sctp_side_effects(enum sctp_event event_type,
union sctp_subtype subtype, union sctp_subtype subtype,
...@@ -67,7 +67,7 @@ static int sctp_side_effects(enum sctp_event event_type, ...@@ -67,7 +67,7 @@ static int sctp_side_effects(enum sctp_event event_type,
struct sctp_association **asoc, struct sctp_association **asoc,
void *event_arg, void *event_arg,
sctp_disposition_t status, sctp_disposition_t status,
sctp_cmd_seq_t *commands, struct sctp_cmd_seq *commands,
gfp_t gfp); gfp_t gfp);
/******************************************************************** /********************************************************************
...@@ -150,7 +150,7 @@ static void sctp_do_ecn_cwr_work(struct sctp_association *asoc, ...@@ -150,7 +150,7 @@ static void sctp_do_ecn_cwr_work(struct sctp_association *asoc,
/* Generate SACK if necessary. We call this at the end of a packet. */ /* Generate SACK if necessary. We call this at the end of a packet. */
static int sctp_gen_sack(struct sctp_association *asoc, int force, static int sctp_gen_sack(struct sctp_association *asoc, int force,
sctp_cmd_seq_t *commands) struct sctp_cmd_seq *commands)
{ {
__u32 ctsn, max_tsn_seen; __u32 ctsn, max_tsn_seen;
struct sctp_chunk *sack; struct sctp_chunk *sack;
...@@ -506,7 +506,7 @@ sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES] = { ...@@ -506,7 +506,7 @@ sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES] = {
* notification SHOULD be sent to the upper layer. * notification SHOULD be sent to the upper layer.
* *
*/ */
static void sctp_do_8_2_transport_strike(sctp_cmd_seq_t *commands, static void sctp_do_8_2_transport_strike(struct sctp_cmd_seq *commands,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_transport *transport, struct sctp_transport *transport,
int is_hb) int is_hb)
...@@ -578,7 +578,7 @@ static void sctp_do_8_2_transport_strike(sctp_cmd_seq_t *commands, ...@@ -578,7 +578,7 @@ static void sctp_do_8_2_transport_strike(sctp_cmd_seq_t *commands,
} }
/* Worker routine to handle INIT command failure. */ /* Worker routine to handle INIT command failure. */
static void sctp_cmd_init_failed(sctp_cmd_seq_t *commands, static void sctp_cmd_init_failed(struct sctp_cmd_seq *commands,
struct sctp_association *asoc, struct sctp_association *asoc,
unsigned int error) unsigned int error)
{ {
...@@ -601,7 +601,7 @@ static void sctp_cmd_init_failed(sctp_cmd_seq_t *commands, ...@@ -601,7 +601,7 @@ static void sctp_cmd_init_failed(sctp_cmd_seq_t *commands,
} }
/* Worker routine to handle SCTP_CMD_ASSOC_FAILED. */ /* Worker routine to handle SCTP_CMD_ASSOC_FAILED. */
static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *commands, static void sctp_cmd_assoc_failed(struct sctp_cmd_seq *commands,
struct sctp_association *asoc, struct sctp_association *asoc,
enum sctp_event event_type, enum sctp_event event_type,
union sctp_subtype subtype, union sctp_subtype subtype,
...@@ -645,7 +645,7 @@ static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *commands, ...@@ -645,7 +645,7 @@ static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *commands,
* since all other cases use "temporary" associations and can do all * since all other cases use "temporary" associations and can do all
* their work in statefuns directly. * their work in statefuns directly.
*/ */
static int sctp_cmd_process_init(sctp_cmd_seq_t *commands, static int sctp_cmd_process_init(struct sctp_cmd_seq *commands,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_chunk *chunk, struct sctp_chunk *chunk,
struct sctp_init_chunk *peer_init, struct sctp_init_chunk *peer_init,
...@@ -667,7 +667,7 @@ static int sctp_cmd_process_init(sctp_cmd_seq_t *commands, ...@@ -667,7 +667,7 @@ static int sctp_cmd_process_init(sctp_cmd_seq_t *commands,
} }
/* Helper function to break out starting up of heartbeat timers. */ /* Helper function to break out starting up of heartbeat timers. */
static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds, static void sctp_cmd_hb_timers_start(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc) struct sctp_association *asoc)
{ {
struct sctp_transport *t; struct sctp_transport *t;
...@@ -680,7 +680,7 @@ static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds, ...@@ -680,7 +680,7 @@ static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds,
sctp_transport_reset_hb_timer(t); sctp_transport_reset_hb_timer(t);
} }
static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds, static void sctp_cmd_hb_timers_stop(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc) struct sctp_association *asoc)
{ {
struct sctp_transport *t; struct sctp_transport *t;
...@@ -695,7 +695,7 @@ static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds, ...@@ -695,7 +695,7 @@ static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds,
} }
/* Helper function to stop any pending T3-RTX timers */ /* Helper function to stop any pending T3-RTX timers */
static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds, static void sctp_cmd_t3_rtx_timers_stop(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc) struct sctp_association *asoc)
{ {
struct sctp_transport *t; struct sctp_transport *t;
...@@ -709,7 +709,7 @@ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds, ...@@ -709,7 +709,7 @@ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds,
/* Helper function to handle the reception of an HEARTBEAT ACK. */ /* Helper function to handle the reception of an HEARTBEAT ACK. */
static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds, static void sctp_cmd_transport_on(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_transport *t, struct sctp_transport *t,
struct sctp_chunk *chunk) struct sctp_chunk *chunk)
...@@ -780,7 +780,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds, ...@@ -780,7 +780,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
/* Helper function to process the process SACK command. */ /* Helper function to process the process SACK command. */
static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds, static int sctp_cmd_process_sack(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_chunk *chunk) struct sctp_chunk *chunk)
{ {
...@@ -802,7 +802,7 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds, ...@@ -802,7 +802,7 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds,
/* Helper function to set the timeout value for T2-SHUTDOWN timer and to set /* Helper function to set the timeout value for T2-SHUTDOWN timer and to set
* the transport for a shutdown chunk. * the transport for a shutdown chunk.
*/ */
static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds, static void sctp_cmd_setup_t2(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_chunk *chunk) struct sctp_chunk *chunk)
{ {
...@@ -819,7 +819,7 @@ static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds, ...@@ -819,7 +819,7 @@ static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds,
asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = t->rto; asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = t->rto;
} }
static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds, static void sctp_cmd_assoc_update(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_association *new) struct sctp_association *new)
{ {
...@@ -842,7 +842,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds, ...@@ -842,7 +842,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds,
} }
/* Helper function to change the state of an association. */ /* Helper function to change the state of an association. */
static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, static void sctp_cmd_new_state(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc, struct sctp_association *asoc,
enum sctp_state state) enum sctp_state state)
{ {
...@@ -902,7 +902,7 @@ static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, ...@@ -902,7 +902,7 @@ static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds,
} }
/* Helper function to delete an association. */ /* Helper function to delete an association. */
static void sctp_cmd_delete_tcb(sctp_cmd_seq_t *cmds, static void sctp_cmd_delete_tcb(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc) struct sctp_association *asoc)
{ {
struct sock *sk = asoc->base.sk; struct sock *sk = asoc->base.sk;
...@@ -924,9 +924,9 @@ static void sctp_cmd_delete_tcb(sctp_cmd_seq_t *cmds, ...@@ -924,9 +924,9 @@ static void sctp_cmd_delete_tcb(sctp_cmd_seq_t *cmds,
* destination address (we use active path instead of primary path just * destination address (we use active path instead of primary path just
* because primary path may be inactive. * because primary path may be inactive.
*/ */
static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds, static void sctp_cmd_setup_t4(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_chunk *chunk) struct sctp_chunk *chunk)
{ {
struct sctp_transport *t; struct sctp_transport *t;
...@@ -936,7 +936,7 @@ static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds, ...@@ -936,7 +936,7 @@ static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds,
} }
/* Process an incoming Operation Error Chunk. */ /* Process an incoming Operation Error Chunk. */
static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds, static void sctp_cmd_process_operr(struct sctp_cmd_seq *cmds,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_chunk *chunk) struct sctp_chunk *chunk)
{ {
...@@ -1025,9 +1025,9 @@ static void sctp_cmd_set_sk_err(struct sctp_association *asoc, int error) ...@@ -1025,9 +1025,9 @@ static void sctp_cmd_set_sk_err(struct sctp_association *asoc, int error)
} }
/* Helper function to generate an association change event */ /* Helper function to generate an association change event */
static void sctp_cmd_assoc_change(sctp_cmd_seq_t *commands, static void sctp_cmd_assoc_change(struct sctp_cmd_seq *commands,
struct sctp_association *asoc, struct sctp_association *asoc,
u8 state) u8 state)
{ {
struct sctp_ulpevent *ev; struct sctp_ulpevent *ev;
...@@ -1040,7 +1040,7 @@ static void sctp_cmd_assoc_change(sctp_cmd_seq_t *commands, ...@@ -1040,7 +1040,7 @@ static void sctp_cmd_assoc_change(sctp_cmd_seq_t *commands,
} }
/* Helper function to generate an adaptation indication event */ /* Helper function to generate an adaptation indication event */
static void sctp_cmd_adaptation_ind(sctp_cmd_seq_t *commands, static void sctp_cmd_adaptation_ind(struct sctp_cmd_seq *commands,
struct sctp_association *asoc) struct sctp_association *asoc)
{ {
struct sctp_ulpevent *ev; struct sctp_ulpevent *ev;
...@@ -1145,7 +1145,7 @@ int sctp_do_sm(struct net *net, enum sctp_event event_type, ...@@ -1145,7 +1145,7 @@ int sctp_do_sm(struct net *net, enum sctp_event event_type,
struct sctp_endpoint *ep, struct sctp_association *asoc, struct sctp_endpoint *ep, struct sctp_association *asoc,
void *event_arg, gfp_t gfp) void *event_arg, gfp_t gfp)
{ {
sctp_cmd_seq_t commands; struct sctp_cmd_seq commands;
const sctp_sm_table_entry_t *state_fn; const sctp_sm_table_entry_t *state_fn;
sctp_disposition_t status; sctp_disposition_t status;
int error = 0; int error = 0;
...@@ -1184,7 +1184,7 @@ static int sctp_side_effects(enum sctp_event event_type, ...@@ -1184,7 +1184,7 @@ static int sctp_side_effects(enum sctp_event event_type,
struct sctp_association **asoc, struct sctp_association **asoc,
void *event_arg, void *event_arg,
sctp_disposition_t status, sctp_disposition_t status,
sctp_cmd_seq_t *commands, struct sctp_cmd_seq *commands,
gfp_t gfp) gfp_t gfp)
{ {
int error; int error;
...@@ -1270,7 +1270,7 @@ static int sctp_cmd_interpreter(enum sctp_event event_type, ...@@ -1270,7 +1270,7 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,
struct sctp_association *asoc, struct sctp_association *asoc,
void *event_arg, void *event_arg,
sctp_disposition_t status, sctp_disposition_t status,
sctp_cmd_seq_t *commands, struct sctp_cmd_seq *commands,
gfp_t gfp) gfp_t gfp)
{ {
struct sock *sk = ep->base.sk; struct sock *sk = ep->base.sk;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment