netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 00/11] sctp: remove typedefs from structures part 3
@ 2017-07-23  1:34 Xin Long
  2017-07-23  1:34 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_initack_chunk_t Xin Long
  2017-07-24 23:01 ` [PATCH net-next 00/11] sctp: remove typedefs from structures part 3 David Miller
  0 siblings, 2 replies; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

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 3 to remove it for another 11 basic structures from linux/sctp.h.

Just as the part 1 and 2, No any code's logic would be changed in these
patches, only cleaning up.

Xin Long (11):
  sctp: remove the typedef sctp_initack_chunk_t
  sctp: remove the typedef sctp_cookie_param_t
  sctp: remove the typedef sctp_unrecognized_param_t
  sctp: remove the typedef sctp_gap_ack_block_t
  sctp: remove the typedef sctp_dup_tsn_t
  sctp: remove the typedef sctp_sack_variable_t
  sctp: remove the typedef sctp_sackhdr_t
  sctp: remove the typedef sctp_sack_chunk_t
  sctp: remove the typedef sctp_heartbeathdr_t
  sctp: remove the typedef sctp_heartbeat_chunk_t
  sctp: remove the typedef sctp_abort_chunk_t

 include/linux/sctp.h       | 53 +++++++++++++++++++++++-----------------------
 include/net/sctp/command.h |  4 ++--
 net/sctp/chunk.c           |  2 +-
 net/sctp/outqueue.c        | 10 ++++-----
 net/sctp/sm_make_chunk.c   | 18 +++++++++-------
 net/sctp/sm_statefuns.c    | 50 ++++++++++++++++++++-----------------------
 6 files changed, 68 insertions(+), 69 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH net-next 01/11] sctp: remove the typedef sctp_initack_chunk_t
  2017-07-23  1:34 [PATCH net-next 00/11] sctp: remove typedefs from structures part 3 Xin Long
@ 2017-07-23  1:34 ` Xin Long
  2017-07-23  1:34   ` [PATCH net-next 02/11] sctp: remove the typedef sctp_cookie_param_t Xin Long
  2017-07-24 23:01 ` [PATCH net-next 00/11] sctp: remove typedefs from structures part 3 David Miller
  1 sibling, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_initack_chunk_t, and
replace with struct sctp_initack_chunk in the places where it's
using this typedef.

It is also to use sizeof(variable) instead of sizeof(type).

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h    |  5 ++++-
 net/sctp/sm_statefuns.c | 13 ++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 913474d..05c2099 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -336,7 +336,10 @@ struct sctp_hmac_algo_param {
  *   The INIT ACK chunk is used to acknowledge the initiation of an SCTP
  *   association.
  */
-typedef struct sctp_init_chunk sctp_initack_chunk_t;
+struct sctp_initack_chunk {
+	struct sctp_chunkhdr chunk_hdr;
+	struct sctp_inithdr init_hdr;
+};
 
 /* Section 3.3.3.1 State Cookie (7) */
 typedef struct sctp_cookie_param {
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index ae4c48c..6568fc3 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -518,7 +518,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net,
 		return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands);
 
 	/* Make sure that the INIT-ACK chunk has a valid length */
-	if (!sctp_chunk_length_valid(chunk, sizeof(sctp_initack_chunk_t)))
+	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_initack_chunk)))
 		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
 						  commands);
 	/* Grab the INIT header.  */
@@ -4453,11 +4453,10 @@ static sctp_disposition_t sctp_sf_abort_violation(
 		/* Treat INIT-ACK as a special case during COOKIE-WAIT. */
 		if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK &&
 		    !asoc->peer.i.init_tag) {
-			sctp_initack_chunk_t *initack;
+			struct sctp_initack_chunk *initack;
 
-			initack = (sctp_initack_chunk_t *)chunk->chunk_hdr;
-			if (!sctp_chunk_length_valid(chunk,
-						     sizeof(sctp_initack_chunk_t)))
+			initack = (struct sctp_initack_chunk *)chunk->chunk_hdr;
+			if (!sctp_chunk_length_valid(chunk, sizeof(*initack)))
 				abort->chunk_hdr->flags |= SCTP_CHUNK_FLAG_T;
 			else {
 				unsigned int inittag;
@@ -6106,9 +6105,9 @@ static struct sctp_packet *sctp_ootb_pkt_new(struct net *net,
 		switch (chunk->chunk_hdr->type) {
 		case SCTP_CID_INIT_ACK:
 		{
-			sctp_initack_chunk_t *initack;
+			struct sctp_initack_chunk *initack;
 
-			initack = (sctp_initack_chunk_t *)chunk->chunk_hdr;
+			initack = (struct sctp_initack_chunk *)chunk->chunk_hdr;
 			vtag = ntohl(initack->init_hdr.init_tag);
 			break;
 		}
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 02/11] sctp: remove the typedef sctp_cookie_param_t
  2017-07-23  1:34 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_initack_chunk_t Xin Long
@ 2017-07-23  1:34   ` Xin Long
  2017-07-23  1:34     ` [PATCH net-next 03/11] sctp: remove the typedef sctp_unrecognized_param_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_cookie_param_t, and
replace with struct sctp_cookie_param in the places where it's
using this typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h     |  4 ++--
 net/sctp/sm_make_chunk.c | 18 ++++++++++--------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 05c2099..9e77abd 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -342,10 +342,10 @@ struct sctp_initack_chunk {
 };
 
 /* Section 3.3.3.1 State Cookie (7) */
-typedef struct sctp_cookie_param {
+struct sctp_cookie_param {
 	struct sctp_paramhdr p;
 	__u8 body[0];
-} sctp_cookie_param_t;
+};
 
 /* Section 3.3.3.1 Unrecognized Parameters (8) */
 typedef struct sctp_unrecognized_param {
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 0b36e96..163004e 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -69,7 +69,8 @@ static struct sctp_chunk *sctp_make_data(const struct sctp_association *asoc,
 static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc,
 					   __u8 type, __u8 flags, int paylen,
 					   gfp_t gfp);
-static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
+static struct sctp_cookie_param *sctp_pack_cookie(
+					const struct sctp_endpoint *ep,
 					const struct sctp_association *asoc,
 					const struct sctp_chunk *init_chunk,
 					int *cookie_len,
@@ -387,7 +388,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
 	union sctp_params addrs;
 	struct sctp_sock *sp;
 	int addrs_len;
-	sctp_cookie_param_t *cookie;
+	struct sctp_cookie_param *cookie;
 	int cookie_len;
 	size_t chunksize;
 	struct sctp_adaptation_ind_param aiparam;
@@ -1595,14 +1596,15 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
 /* Build a cookie representing asoc.
  * This INCLUDES the param header needed to put the cookie in the INIT ACK.
  */
-static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
-				      const struct sctp_association *asoc,
-				      const struct sctp_chunk *init_chunk,
-				      int *cookie_len,
-				      const __u8 *raw_addrs, int addrs_len)
+static struct sctp_cookie_param *sctp_pack_cookie(
+					const struct sctp_endpoint *ep,
+					const struct sctp_association *asoc,
+					const struct sctp_chunk *init_chunk,
+					int *cookie_len,
+					const __u8 *raw_addrs, int addrs_len)
 {
-	sctp_cookie_param_t *retval;
 	struct sctp_signed_cookie *cookie;
+	struct sctp_cookie_param *retval;
 	int headersize, bodysize;
 
 	/* Header size is static data prior to the actual cookie, including
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 03/11] sctp: remove the typedef sctp_unrecognized_param_t
  2017-07-23  1:34   ` [PATCH net-next 02/11] sctp: remove the typedef sctp_cookie_param_t Xin Long
@ 2017-07-23  1:34     ` Xin Long
  2017-07-23  1:34       ` [PATCH net-next 04/11] sctp: remove the typedef sctp_gap_ack_block_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_unrecognized_param_t, and
replace with struct sctp_unrecognized_param in the places where it's
using this typedef.

It is also to fix some indents in sctp_sf_do_unexpected_init() and
sctp_sf_do_5_1B_init().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h    |  4 ++--
 net/sctp/sm_statefuns.c | 18 +++++++-----------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 9e77abd..c323b3e 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -348,10 +348,10 @@ struct sctp_cookie_param {
 };
 
 /* Section 3.3.3.1 Unrecognized Parameters (8) */
-typedef struct sctp_unrecognized_param {
+struct sctp_unrecognized_param {
 	struct sctp_paramhdr param_hdr;
 	struct sctp_paramhdr unrecognized;
-} sctp_unrecognized_param_t;
+};
 
 
 
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 6568fc3..7f85239 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -306,12 +306,10 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net,
 					void *arg,
 					sctp_cmd_seq_t *commands)
 {
-	struct sctp_chunk *chunk = arg;
-	struct sctp_chunk *repl;
+	struct sctp_chunk *chunk = arg, *repl, *err_chunk;
+	struct sctp_unrecognized_param *unk_param;
 	struct sctp_association *new_asoc;
-	struct sctp_chunk *err_chunk;
 	struct sctp_packet *packet;
-	sctp_unrecognized_param_t *unk_param;
 	int len;
 
 	/* 6.10 Bundling
@@ -435,7 +433,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net,
 		 * construct the parameters in INIT ACK by copying the
 		 * ERROR causes over.
 		 */
-		unk_param = (sctp_unrecognized_param_t *)
+		unk_param = (struct sctp_unrecognized_param *)
 			    ((__u8 *)(err_chunk->chunk_hdr) +
 			    sizeof(struct sctp_chunkhdr));
 		/* Replace the cause code with the "Unrecognized parameter"
@@ -1419,13 +1417,11 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
 	const sctp_subtype_t type,
 	void *arg, sctp_cmd_seq_t *commands)
 {
-	sctp_disposition_t retval;
-	struct sctp_chunk *chunk = arg;
-	struct sctp_chunk *repl;
+	struct sctp_chunk *chunk = arg, *repl, *err_chunk;
+	struct sctp_unrecognized_param *unk_param;
 	struct sctp_association *new_asoc;
-	struct sctp_chunk *err_chunk;
 	struct sctp_packet *packet;
-	sctp_unrecognized_param_t *unk_param;
+	sctp_disposition_t retval;
 	int len;
 
 	/* 6.10 Bundling
@@ -1555,7 +1551,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
 		 * construct the parameters in INIT ACK by copying the
 		 * ERROR causes over.
 		 */
-		unk_param = (sctp_unrecognized_param_t *)
+		unk_param = (struct sctp_unrecognized_param *)
 			    ((__u8 *)(err_chunk->chunk_hdr) +
 			    sizeof(struct sctp_chunkhdr));
 		/* Replace the cause code with the "Unrecognized parameter"
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 04/11] sctp: remove the typedef sctp_gap_ack_block_t
  2017-07-23  1:34     ` [PATCH net-next 03/11] sctp: remove the typedef sctp_unrecognized_param_t Xin Long
@ 2017-07-23  1:34       ` Xin Long
  2017-07-23  1:34         ` [PATCH net-next 05/11] sctp: remove the typedef sctp_dup_tsn_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_gap_ack_block_t, and
replace with struct sctp_gap_ack_block in the places where it's
using this typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index c323b3e..b84b8e8 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -363,16 +363,16 @@ struct sctp_unrecognized_param {
  *  subsequences of DATA chunks as represented by their TSNs.
  */
 
-typedef struct sctp_gap_ack_block {
+struct sctp_gap_ack_block {
 	__be16 start;
 	__be16 end;
-} sctp_gap_ack_block_t;
+};
 
 typedef __be32 sctp_dup_tsn_t;
 
 typedef union {
-	sctp_gap_ack_block_t	gab;
-        sctp_dup_tsn_t		dup;
+	struct sctp_gap_ack_block gab;
+	sctp_dup_tsn_t dup;
 } sctp_sack_variable_t;
 
 typedef struct sctp_sackhdr {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 05/11] sctp: remove the typedef sctp_dup_tsn_t
  2017-07-23  1:34       ` [PATCH net-next 04/11] sctp: remove the typedef sctp_gap_ack_block_t Xin Long
@ 2017-07-23  1:34         ` Xin Long
  2017-07-23  1:34           ` [PATCH net-next 06/11] sctp: remove the typedef sctp_sack_variable_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_dup_tsn_t, and replace
with __be32 in the places where it's using this typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index b84b8e8..8faf74e 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -368,11 +368,9 @@ struct sctp_gap_ack_block {
 	__be16 end;
 };
 
-typedef __be32 sctp_dup_tsn_t;
-
 typedef union {
 	struct sctp_gap_ack_block gab;
-	sctp_dup_tsn_t dup;
+	__be32 dup;
 } sctp_sack_variable_t;
 
 typedef struct sctp_sackhdr {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 06/11] sctp: remove the typedef sctp_sack_variable_t
  2017-07-23  1:34         ` [PATCH net-next 05/11] sctp: remove the typedef sctp_dup_tsn_t Xin Long
@ 2017-07-23  1:34           ` Xin Long
  2017-07-23  1:34             ` [PATCH net-next 07/11] sctp: remove the typedef sctp_sackhdr_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_sack_variable_t, and
replace with union sctp_sack_variable in the places where it's
using this typedef.

It is also to fix some indents in sctp_acked().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h |  6 +++---
 net/sctp/outqueue.c  | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 8faf74e..8df6ac5 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -368,17 +368,17 @@ struct sctp_gap_ack_block {
 	__be16 end;
 };
 
-typedef union {
+union sctp_sack_variable {
 	struct sctp_gap_ack_block gab;
 	__be32 dup;
-} sctp_sack_variable_t;
+};
 
 typedef struct sctp_sackhdr {
 	__be32 cum_tsn_ack;
 	__be32 a_rwnd;
 	__be16 num_gap_ack_blocks;
 	__be16 num_dup_tsns;
-	sctp_sack_variable_t variable[0];
+	union sctp_sack_variable variable[0];
 } sctp_sackhdr_t;
 
 typedef struct sctp_sack_chunk {
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index e876270..d2a8adf 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -1197,7 +1197,7 @@ static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
 static void sctp_sack_update_unack_data(struct sctp_association *assoc,
 					struct sctp_sackhdr *sack)
 {
-	sctp_sack_variable_t *frags;
+	union sctp_sack_variable *frags;
 	__u16 unack_data;
 	int i;
 
@@ -1224,7 +1224,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
 	struct sctp_transport *transport;
 	struct sctp_chunk *tchunk = NULL;
 	struct list_head *lchunk, *transport_list, *temp;
-	sctp_sack_variable_t *frags = sack->variable;
+	union sctp_sack_variable *frags = sack->variable;
 	__u32 sack_ctsn, ctsn, tsn;
 	__u32 highest_tsn, highest_new_tsn;
 	__u32 sack_a_rwnd;
@@ -1736,10 +1736,10 @@ static void sctp_mark_missing(struct sctp_outq *q,
 /* Is the given TSN acked by this packet?  */
 static int sctp_acked(struct sctp_sackhdr *sack, __u32 tsn)
 {
-	int i;
-	sctp_sack_variable_t *frags;
-	__u16 tsn_offset, blocks;
 	__u32 ctsn = ntohl(sack->cum_tsn_ack);
+	union sctp_sack_variable *frags;
+	__u16 tsn_offset, blocks;
+	int i;
 
 	if (TSN_lte(tsn, ctsn))
 		goto pass;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 07/11] sctp: remove the typedef sctp_sackhdr_t
  2017-07-23  1:34           ` [PATCH net-next 06/11] sctp: remove the typedef sctp_sack_variable_t Xin Long
@ 2017-07-23  1:34             ` Xin Long
  2017-07-23  1:34               ` [PATCH net-next 08/11] sctp: remove the typedef sctp_sack_chunk_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_sackhdr_t, and replace
with struct sctp_sackhdr in the places where it's using this
typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h       | 6 +++---
 include/net/sctp/command.h | 4 ++--
 net/sctp/sm_statefuns.c    | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 8df6ac5..a2e4312 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -373,17 +373,17 @@ union sctp_sack_variable {
 	__be32 dup;
 };
 
-typedef struct sctp_sackhdr {
+struct sctp_sackhdr {
 	__be32 cum_tsn_ack;
 	__be32 a_rwnd;
 	__be16 num_gap_ack_blocks;
 	__be16 num_dup_tsns;
 	union sctp_sack_variable variable[0];
-} sctp_sackhdr_t;
+};
 
 typedef struct sctp_sack_chunk {
 	struct sctp_chunkhdr chunk_hdr;
-	sctp_sackhdr_t sack_hdr;
+	struct sctp_sackhdr sack_hdr;
 } sctp_sack_chunk_t;
 
 
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index d4679e7..1d5f6ff 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -135,7 +135,7 @@ typedef union {
 	struct sctp_init_chunk *init;
 	struct sctp_ulpevent *ulpevent;
 	struct sctp_packet *packet;
-	sctp_sackhdr_t *sackh;
+	struct sctp_sackhdr *sackh;
 	struct sctp_datamsg *msg;
 } sctp_arg_t;
 
@@ -176,7 +176,7 @@ SCTP_ARG_CONSTRUCTOR(BA,	struct sctp_bind_addr *, bp)
 SCTP_ARG_CONSTRUCTOR(PEER_INIT,	struct sctp_init_chunk *, init)
 SCTP_ARG_CONSTRUCTOR(ULPEVENT,  struct sctp_ulpevent *, ulpevent)
 SCTP_ARG_CONSTRUCTOR(PACKET,	struct sctp_packet *, packet)
-SCTP_ARG_CONSTRUCTOR(SACKH,	sctp_sackhdr_t *, sackh)
+SCTP_ARG_CONSTRUCTOR(SACKH,	struct sctp_sackhdr *, sackh)
 SCTP_ARG_CONSTRUCTOR(DATAMSG,	struct sctp_datamsg *, msg)
 
 static inline sctp_arg_t SCTP_FORCE(void)
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 7f85239..c09dfe6 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -3187,7 +3187,7 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(struct net *net,
 					sctp_cmd_seq_t *commands)
 {
 	struct sctp_chunk *chunk = arg;
-	sctp_sackhdr_t *sackh;
+	struct sctp_sackhdr *sackh;
 	__u32 ctsn;
 
 	if (!sctp_vtag_verify(chunk, asoc))
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 08/11] sctp: remove the typedef sctp_sack_chunk_t
  2017-07-23  1:34             ` [PATCH net-next 07/11] sctp: remove the typedef sctp_sackhdr_t Xin Long
@ 2017-07-23  1:34               ` Xin Long
  2017-07-23  1:34                 ` [PATCH net-next 09/11] sctp: remove the typedef sctp_heartbeathdr_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_sack_chunk_t, and
replace with struct sctp_sack_chunk in the places where it's
using this typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h    | 4 ++--
 net/sctp/chunk.c        | 2 +-
 net/sctp/sm_statefuns.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index a2e4312..48f6560 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -381,10 +381,10 @@ struct sctp_sackhdr {
 	union sctp_sack_variable variable[0];
 };
 
-typedef struct sctp_sack_chunk {
+struct sctp_sack_chunk {
 	struct sctp_chunkhdr chunk_hdr;
 	struct sctp_sackhdr sack_hdr;
-} sctp_sack_chunk_t;
+};
 
 
 /* RFC 2960.  Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 1323d41..681b181 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -221,7 +221,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
 	    asoc->outqueue.out_qlen == 0 &&
 	    list_empty(&asoc->outqueue.retransmit) &&
 	    msg_len > max_data)
-		first_len -= SCTP_PAD4(sizeof(sctp_sack_chunk_t));
+		first_len -= SCTP_PAD4(sizeof(struct sctp_sack_chunk));
 
 	/* Encourage Cookie-ECHO bundling. */
 	if (asoc->state < SCTP_STATE_COOKIE_ECHOED)
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index c09dfe6..08ebe8c 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -3194,7 +3194,7 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(struct net *net,
 		return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
 	/* Make sure that the SACK chunk has a valid length. */
-	if (!sctp_chunk_length_valid(chunk, sizeof(sctp_sack_chunk_t)))
+	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_sack_chunk)))
 		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
 						  commands);
 
@@ -4515,7 +4515,7 @@ static sctp_disposition_t sctp_sf_abort_violation(
  * Handle a protocol violation when the chunk length is invalid.
  * "Invalid" length is identified as smaller than the minimal length a
  * given chunk can be.  For example, a SACK chunk has invalid length
- * if its length is set to be smaller than the size of sctp_sack_chunk_t.
+ * if its length is set to be smaller than the size of struct sctp_sack_chunk.
  *
  * We inform the other end by sending an ABORT with a Protocol Violation
  * error code.
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 09/11] sctp: remove the typedef sctp_heartbeathdr_t
  2017-07-23  1:34               ` [PATCH net-next 08/11] sctp: remove the typedef sctp_sack_chunk_t Xin Long
@ 2017-07-23  1:34                 ` Xin Long
  2017-07-23  1:34                   ` [PATCH net-next 10/11] sctp: remove the typedef sctp_heartbeat_chunk_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_heartbeathdr_t, and
replace with struct sctp_heartbeathdr in the places where it's
using this typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h    | 6 +++---
 net/sctp/sm_statefuns.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 48f6560..6e26b86 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -394,13 +394,13 @@ struct sctp_sack_chunk {
  *  the present association.
  */
 
-typedef struct sctp_heartbeathdr {
+struct sctp_heartbeathdr {
 	struct sctp_paramhdr info;
-} sctp_heartbeathdr_t;
+};
 
 typedef struct sctp_heartbeat_chunk {
 	struct sctp_chunkhdr chunk_hdr;
-	sctp_heartbeathdr_t hb_hdr;
+	struct sctp_heartbeathdr hb_hdr;
 } sctp_heartbeat_chunk_t;
 
 
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 08ebe8c..32ac90b 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1096,7 +1096,7 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
 	 * respond with a HEARTBEAT ACK that contains the Heartbeat
 	 * Information field copied from the received HEARTBEAT chunk.
 	 */
-	chunk->subh.hb_hdr = (sctp_heartbeathdr_t *)chunk->skb->data;
+	chunk->subh.hb_hdr = (struct sctp_heartbeathdr *)chunk->skb->data;
 	param_hdr = (struct sctp_paramhdr *)chunk->subh.hb_hdr;
 	paylen = ntohs(chunk->chunk_hdr->length) - sizeof(struct sctp_chunkhdr);
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 10/11] sctp: remove the typedef sctp_heartbeat_chunk_t
  2017-07-23  1:34                 ` [PATCH net-next 09/11] sctp: remove the typedef sctp_heartbeathdr_t Xin Long
@ 2017-07-23  1:34                   ` Xin Long
  2017-07-23  1:34                     ` [PATCH net-next 11/11] sctp: remove the typedef sctp_abort_chunk_t Xin Long
  0 siblings, 1 reply; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_heartbeat_chunk_t, and
replace with struct sctp_heartbeat_chunk in the places where it's
using this typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h    | 4 ++--
 net/sctp/sm_statefuns.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 6e26b86..bfda7c6 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -398,10 +398,10 @@ struct sctp_heartbeathdr {
 	struct sctp_paramhdr info;
 };
 
-typedef struct sctp_heartbeat_chunk {
+struct sctp_heartbeat_chunk {
 	struct sctp_chunkhdr chunk_hdr;
 	struct sctp_heartbeathdr hb_hdr;
-} sctp_heartbeat_chunk_t;
+};
 
 
 /* For the abort and shutdown ACK we must carry the init tag in the
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 32ac90b..7bbee08 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1088,7 +1088,8 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
 		return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
 	/* Make sure that the HEARTBEAT chunk has a valid length. */
-	if (!sctp_chunk_length_valid(chunk, sizeof(sctp_heartbeat_chunk_t)))
+	if (!sctp_chunk_length_valid(chunk,
+				     sizeof(struct sctp_heartbeat_chunk)))
 		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
 						  commands);
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next 11/11] sctp: remove the typedef sctp_abort_chunk_t
  2017-07-23  1:34                   ` [PATCH net-next 10/11] sctp: remove the typedef sctp_heartbeat_chunk_t Xin Long
@ 2017-07-23  1:34                     ` Xin Long
  0 siblings, 0 replies; 13+ messages in thread
From: Xin Long @ 2017-07-23  1:34 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem

This patch is to remove the typedef sctp_abort_chunk_t, and
replace with struct sctp_abort_chunk in the places where it's
using this typedef.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h    | 4 ++--
 net/sctp/sm_statefuns.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index bfda7c6..ba00716 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -408,9 +408,9 @@ struct sctp_heartbeat_chunk {
  * common header. Just the common header is all that is needed with a
  * chunk descriptor.
  */
-typedef struct sctp_abort_chunk {
+struct sctp_abort_chunk {
 	struct sctp_chunkhdr uh;
-} sctp_abort_chunk_t;
+};
 
 
 /* For the graceful shutdown we must carry the tag (in common header)
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 7bbee08..dc0c2c4 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -2164,7 +2164,7 @@ sctp_disposition_t sctp_sf_shutdown_pending_abort(
 	 * as we do not know its true length.  So, to be safe, discard the
 	 * packet.
 	 */
-	if (!sctp_chunk_length_valid(chunk, sizeof(sctp_abort_chunk_t)))
+	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk)))
 		return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
 	/* ADD-IP: Special case for ABORT chunks
@@ -2206,7 +2206,7 @@ sctp_disposition_t sctp_sf_shutdown_sent_abort(struct net *net,
 	 * as we do not know its true length.  So, to be safe, discard the
 	 * packet.
 	 */
-	if (!sctp_chunk_length_valid(chunk, sizeof(sctp_abort_chunk_t)))
+	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk)))
 		return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
 	/* ADD-IP: Special case for ABORT chunks
@@ -2470,7 +2470,7 @@ sctp_disposition_t sctp_sf_do_9_1_abort(struct net *net,
 	 * as we do not know its true length.  So, to be safe, discard the
 	 * packet.
 	 */
-	if (!sctp_chunk_length_valid(chunk, sizeof(sctp_abort_chunk_t)))
+	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk)))
 		return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
 	/* ADD-IP: Special case for ABORT chunks
@@ -2546,7 +2546,7 @@ sctp_disposition_t sctp_sf_cookie_wait_abort(struct net *net,
 	 * as we do not know its true length.  So, to be safe, discard the
 	 * packet.
 	 */
-	if (!sctp_chunk_length_valid(chunk, sizeof(sctp_abort_chunk_t)))
+	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk)))
 		return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
 
 	/* See if we have an error cause code in the chunk.  */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next 00/11] sctp: remove typedefs from structures part 3
  2017-07-23  1:34 [PATCH net-next 00/11] sctp: remove typedefs from structures part 3 Xin Long
  2017-07-23  1:34 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_initack_chunk_t Xin Long
@ 2017-07-24 23:01 ` David Miller
  1 sibling, 0 replies; 13+ messages in thread
From: David Miller @ 2017-07-24 23:01 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Sun, 23 Jul 2017 09:34:25 +0800

> 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 3 to remove it for another 11 basic structures from linux/sctp.h.
> 
> Just as the part 1 and 2, No any code's logic would be changed in these
> patches, only cleaning up.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-07-24 23:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-23  1:34 [PATCH net-next 00/11] sctp: remove typedefs from structures part 3 Xin Long
2017-07-23  1:34 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_initack_chunk_t Xin Long
2017-07-23  1:34   ` [PATCH net-next 02/11] sctp: remove the typedef sctp_cookie_param_t Xin Long
2017-07-23  1:34     ` [PATCH net-next 03/11] sctp: remove the typedef sctp_unrecognized_param_t Xin Long
2017-07-23  1:34       ` [PATCH net-next 04/11] sctp: remove the typedef sctp_gap_ack_block_t Xin Long
2017-07-23  1:34         ` [PATCH net-next 05/11] sctp: remove the typedef sctp_dup_tsn_t Xin Long
2017-07-23  1:34           ` [PATCH net-next 06/11] sctp: remove the typedef sctp_sack_variable_t Xin Long
2017-07-23  1:34             ` [PATCH net-next 07/11] sctp: remove the typedef sctp_sackhdr_t Xin Long
2017-07-23  1:34               ` [PATCH net-next 08/11] sctp: remove the typedef sctp_sack_chunk_t Xin Long
2017-07-23  1:34                 ` [PATCH net-next 09/11] sctp: remove the typedef sctp_heartbeathdr_t Xin Long
2017-07-23  1:34                   ` [PATCH net-next 10/11] sctp: remove the typedef sctp_heartbeat_chunk_t Xin Long
2017-07-23  1:34                     ` [PATCH net-next 11/11] sctp: remove the typedef sctp_abort_chunk_t Xin Long
2017-07-24 23:01 ` [PATCH net-next 00/11] sctp: remove typedefs from structures part 3 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).