* [PATCH net-next 00/11] sctp: remove typedefs from structures part 2 @ 2017-07-05 0:32 Xin Long 2017-07-05 0:32 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_ipv4addr_param_t Xin Long 2017-07-05 8:06 ` [PATCH net-next 00/11] sctp: remove typedefs from structures part 2 David Miller 0 siblings, 2 replies; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 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 2 to remove it for another 11 basic structures. Just as the part 1, No any code's logic would be changed in these patches, only cleaning up. Xin Long (11): sctp: remove the typedef sctp_ipv4addr_param_t sctp: remove the typedef sctp_ipv6addr_param_t sctp: remove the typedef sctp_cookie_preserve_param_t sctp: remove the typedef sctp_hostname_param_t sctp: remove the typedef sctp_supported_addrs_param_t sctp: remove struct sctp_ecn_capable_param sctp: remove the typedef sctp_adaptation_ind_param_t sctp: remove the typedef sctp_supported_ext_param_t sctp: remove the typedef sctp_random_param_t sctp: remove the typedef sctp_chunks_param_t sctp: remove the typedef sctp_hmac_algo_param_t include/linux/sctp.h | 49 +++++++++++++++++++++------------------------- include/net/sctp/structs.h | 6 +++--- net/sctp/auth.c | 13 ++++++------ net/sctp/endpointola.c | 8 ++++---- net/sctp/ipv6.c | 2 +- net/sctp/protocol.c | 2 +- net/sctp/sm_make_chunk.c | 32 ++++++++++++------------------ net/sctp/sm_statefuns.c | 11 +++++------ 8 files changed, 55 insertions(+), 68 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net-next 01/11] sctp: remove the typedef sctp_ipv4addr_param_t 2017-07-05 0:32 [PATCH net-next 00/11] sctp: remove typedefs from structures part 2 Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 02/11] sctp: remove the typedef sctp_ipv6addr_param_t Xin Long 2017-07-05 8:06 ` [PATCH net-next 00/11] sctp: remove typedefs from structures part 2 David Miller 1 sibling, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_ipv4addr_param_t, and replace with struct sctp_ipv4addr_param 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/protocol.c | 2 +- net/sctp/sm_make_chunk.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 99e8664..e42095d 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -273,10 +273,10 @@ struct sctp_init_chunk { /* Section 3.3.2.1. IPv4 Address Parameter (5) */ -typedef struct sctp_ipv4addr_param { +struct sctp_ipv4addr_param { struct sctp_paramhdr param_hdr; - struct in_addr addr; -} sctp_ipv4addr_param_t; + struct in_addr addr; +}; /* Section 3.3.2.1. IPv6 Address Parameter (6) */ typedef struct sctp_ipv6addr_param { diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 989a900..852556d 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -292,7 +292,7 @@ static void sctp_v4_from_addr_param(union sctp_addr *addr, static int sctp_v4_to_addr_param(const union sctp_addr *addr, union sctp_addr_param *param) { - int length = sizeof(sctp_ipv4addr_param_t); + int length = sizeof(struct sctp_ipv4addr_param); param->v4.param_hdr.type = SCTP_PARAM_IPV4_ADDRESS; param->v4.param_hdr.length = htons(length); diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 4e16b02..0dc64da 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -3153,7 +3153,7 @@ bool sctp_verify_asconf(const struct sctp_association *asoc, case SCTP_PARAM_ERR_CAUSE: break; case SCTP_PARAM_IPV4_ADDRESS: - if (length != sizeof(sctp_ipv4addr_param_t)) + if (length != sizeof(struct sctp_ipv4addr_param)) return false; /* ensure there is only one addr param and it's in the * beginning of addip_hdr params, or we reject it. -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 02/11] sctp: remove the typedef sctp_ipv6addr_param_t 2017-07-05 0:32 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_ipv4addr_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 03/11] sctp: remove the typedef sctp_cookie_preserve_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_ipv6addr_param_t, and replace with struct sctp_ipv6addr_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/ipv6.c | 2 +- net/sctp/sm_make_chunk.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index e42095d..6b45c8a 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -279,10 +279,10 @@ struct sctp_ipv4addr_param { }; /* Section 3.3.2.1. IPv6 Address Parameter (6) */ -typedef struct sctp_ipv6addr_param { +struct sctp_ipv6addr_param { struct sctp_paramhdr param_hdr; struct in6_addr addr; -} sctp_ipv6addr_param_t; +}; /* Section 3.3.2.1 Cookie Preservative (9) */ typedef struct sctp_cookie_preserve_param { diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index f5b45b8..5304532 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c @@ -495,7 +495,7 @@ static void sctp_v6_from_addr_param(union sctp_addr *addr, static int sctp_v6_to_addr_param(const union sctp_addr *addr, union sctp_addr_param *param) { - int length = sizeof(sctp_ipv6addr_param_t); + int length = sizeof(struct sctp_ipv6addr_param); param->v6.param_hdr.type = SCTP_PARAM_IPV6_ADDRESS; param->v6.param_hdr.length = htons(length); diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 0dc64da..e5be305 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -3163,7 +3163,7 @@ bool sctp_verify_asconf(const struct sctp_association *asoc, addr_param_seen = true; break; case SCTP_PARAM_IPV6_ADDRESS: - if (length != sizeof(sctp_ipv6addr_param_t)) + if (length != sizeof(struct sctp_ipv6addr_param)) return false; if (param.v != addip->addip_hdr.params) return false; -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 03/11] sctp: remove the typedef sctp_cookie_preserve_param_t 2017-07-05 0:32 ` [PATCH net-next 02/11] sctp: remove the typedef sctp_ipv6addr_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 04/11] sctp: remove the typedef sctp_hostname_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_cookie_preserve_param_t, and replace with struct sctp_cookie_preserve_param in the places where it's using this typedef. It is also to fix some indents in sctp_sf_do_5_2_6_stale(). Signed-off-by: Xin Long <lucien.xin@gmail.com> --- include/linux/sctp.h | 6 +++--- net/sctp/sm_statefuns.c | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 6b45c8a..d8f9d8f 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -285,10 +285,10 @@ struct sctp_ipv6addr_param { }; /* Section 3.3.2.1 Cookie Preservative (9) */ -typedef struct sctp_cookie_preserve_param { +struct sctp_cookie_preserve_param { struct sctp_paramhdr param_hdr; - __be32 lifespan_increment; -} sctp_cookie_preserve_param_t; + __be32 lifespan_increment; +}; /* Section 3.3.2.1 Host Name Address (11) */ typedef struct sctp_hostname_param { diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index b2a74c3..ae4c48c 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -2336,13 +2336,12 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net, void *arg, sctp_cmd_seq_t *commands) { - struct sctp_chunk *chunk = arg; - u32 stale; - sctp_cookie_preserve_param_t bht; - sctp_errhdr_t *err; - struct sctp_chunk *reply; - struct sctp_bind_addr *bp; int attempts = asoc->init_err_counter + 1; + struct sctp_chunk *chunk = arg, *reply; + struct sctp_cookie_preserve_param bht; + struct sctp_bind_addr *bp; + sctp_errhdr_t *err; + u32 stale; if (attempts > asoc->max_init_attempts) { sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 04/11] sctp: remove the typedef sctp_hostname_param_t 2017-07-05 0:32 ` [PATCH net-next 03/11] sctp: remove the typedef sctp_cookie_preserve_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 05/11] sctp: remove the typedef sctp_supported_addrs_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem Remove this typedef, there is even no places using it. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- include/linux/sctp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index d8f9d8f..c43e906 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -291,10 +291,10 @@ struct sctp_cookie_preserve_param { }; /* Section 3.3.2.1 Host Name Address (11) */ -typedef struct sctp_hostname_param { +struct sctp_hostname_param { struct sctp_paramhdr param_hdr; uint8_t hostname[0]; -} sctp_hostname_param_t; +}; /* Section 3.3.2.1 Supported Address Types (12) */ typedef struct sctp_supported_addrs_param { -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 05/11] sctp: remove the typedef sctp_supported_addrs_param_t 2017-07-05 0:32 ` [PATCH net-next 04/11] sctp: remove the typedef sctp_hostname_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 06/11] sctp: remove struct sctp_ecn_capable_param Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_supported_addrs_param_t, and replace with struct sctp_supported_addrs_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 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index c43e906..3ca3ab7 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -297,10 +297,10 @@ struct sctp_hostname_param { }; /* Section 3.3.2.1 Supported Address Types (12) */ -typedef struct sctp_supported_addrs_param { +struct sctp_supported_addrs_param { struct sctp_paramhdr param_hdr; __be16 types[0]; -} sctp_supported_addrs_param_t; +}; /* Appendix A. ECN Capable (32768) */ typedef struct sctp_ecn_capable_param { diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index e5be305..fb06d4f 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -223,7 +223,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, struct sctp_chunk *retval = NULL; int num_types, addrs_len = 0; struct sctp_sock *sp; - sctp_supported_addrs_param_t sat; + struct sctp_supported_addrs_param sat; __be16 types[2]; sctp_adaptation_ind_param_t aiparam; sctp_supported_ext_param_t ext_param; -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 06/11] sctp: remove struct sctp_ecn_capable_param 2017-07-05 0:32 ` [PATCH net-next 05/11] sctp: remove the typedef sctp_supported_addrs_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 07/11] sctp: remove the typedef sctp_adaptation_ind_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem Remove it, there is even no places using it. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- include/linux/sctp.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 3ca3ab7..7552482 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -302,11 +302,6 @@ struct sctp_supported_addrs_param { __be16 types[0]; }; -/* Appendix A. ECN Capable (32768) */ -typedef struct sctp_ecn_capable_param { - struct sctp_paramhdr param_hdr; -} sctp_ecn_capable_param_t; - /* ADDIP Section 3.2.6 Adaptation Layer Indication */ typedef struct sctp_adaptation_ind_param { struct sctp_paramhdr param_hdr; -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 07/11] sctp: remove the typedef sctp_adaptation_ind_param_t 2017-07-05 0:32 ` [PATCH net-next 06/11] sctp: remove struct sctp_ecn_capable_param Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 08/11] sctp: remove the typedef sctp_supported_ext_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_adaptation_ind_param_t, and replace with struct sctp_adaptation_ind_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 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 7552482..72b8787 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -303,10 +303,10 @@ struct sctp_supported_addrs_param { }; /* ADDIP Section 3.2.6 Adaptation Layer Indication */ -typedef struct sctp_adaptation_ind_param { +struct sctp_adaptation_ind_param { struct sctp_paramhdr param_hdr; __be32 adaptation_ind; -} sctp_adaptation_ind_param_t; +}; /* ADDIP Section 4.2.7 Supported Extensions Parameter */ typedef struct sctp_supported_ext_param { diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index fb06d4f..d5f82c2 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -225,7 +225,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, struct sctp_sock *sp; struct sctp_supported_addrs_param sat; __be16 types[2]; - sctp_adaptation_ind_param_t aiparam; + struct sctp_adaptation_ind_param aiparam; sctp_supported_ext_param_t ext_param; int num_ext = 0; __u8 extensions[3]; @@ -393,7 +393,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, sctp_cookie_param_t *cookie; int cookie_len; size_t chunksize; - sctp_adaptation_ind_param_t aiparam; + struct sctp_adaptation_ind_param aiparam; sctp_supported_ext_param_t ext_param; int num_ext = 0; __u8 extensions[3]; -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 08/11] sctp: remove the typedef sctp_supported_ext_param_t 2017-07-05 0:32 ` [PATCH net-next 07/11] sctp: remove the typedef sctp_adaptation_ind_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 09/11] sctp: remove the typedef sctp_random_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_supported_ext_param_t, and replace with struct sctp_supported_ext_param 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 | 4 ++-- net/sctp/sm_make_chunk.c | 22 ++++++++-------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 72b8787..7624568 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -309,10 +309,10 @@ struct sctp_adaptation_ind_param { }; /* ADDIP Section 4.2.7 Supported Extensions Parameter */ -typedef struct sctp_supported_ext_param { +struct sctp_supported_ext_param { struct sctp_paramhdr param_hdr; __u8 chunks[0]; -} sctp_supported_ext_param_t; +}; /* AUTH Section 3.1 Random */ typedef struct sctp_random_param { diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index d5f82c2..06dc351 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -226,7 +226,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, struct sctp_supported_addrs_param sat; __be16 types[2]; struct sctp_adaptation_ind_param aiparam; - sctp_supported_ext_param_t ext_param; + struct sctp_supported_ext_param ext_param; int num_ext = 0; __u8 extensions[3]; struct sctp_paramhdr *auth_chunks = NULL, @@ -305,8 +305,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, /* If we have any extensions to report, account for that */ if (num_ext) - chunksize += SCTP_PAD4(sizeof(sctp_supported_ext_param_t) + - num_ext); + chunksize += SCTP_PAD4(sizeof(ext_param) + num_ext); /* RFC 2960 3.3.2 Initiation (INIT) (1) * @@ -348,10 +347,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, */ if (num_ext) { ext_param.param_hdr.type = SCTP_PARAM_SUPPORTED_EXT; - ext_param.param_hdr.length = - htons(sizeof(sctp_supported_ext_param_t) + num_ext); - sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t), - &ext_param); + ext_param.param_hdr.length = htons(sizeof(ext_param) + num_ext); + sctp_addto_chunk(retval, sizeof(ext_param), &ext_param); sctp_addto_param(retval, num_ext, extensions); } @@ -394,7 +391,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, int cookie_len; size_t chunksize; struct sctp_adaptation_ind_param aiparam; - sctp_supported_ext_param_t ext_param; + struct sctp_supported_ext_param ext_param; int num_ext = 0; __u8 extensions[3]; struct sctp_paramhdr *auth_chunks = NULL, @@ -468,8 +465,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, } if (num_ext) - chunksize += SCTP_PAD4(sizeof(sctp_supported_ext_param_t) + - num_ext); + chunksize += SCTP_PAD4(sizeof(ext_param) + num_ext); /* Now allocate and fill out the chunk. */ retval = sctp_make_control(asoc, SCTP_CID_INIT_ACK, 0, chunksize, gfp); @@ -495,10 +491,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param); if (num_ext) { ext_param.param_hdr.type = SCTP_PARAM_SUPPORTED_EXT; - ext_param.param_hdr.length = - htons(sizeof(sctp_supported_ext_param_t) + num_ext); - sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t), - &ext_param); + ext_param.param_hdr.length = htons(sizeof(ext_param) + num_ext); + sctp_addto_chunk(retval, sizeof(ext_param), &ext_param); sctp_addto_param(retval, num_ext, extensions); } if (asoc->peer.prsctp_capable) -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 09/11] sctp: remove the typedef sctp_random_param_t 2017-07-05 0:32 ` [PATCH net-next 08/11] sctp: remove the typedef sctp_supported_ext_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 10/11] sctp: remove the typedef sctp_chunks_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_random_param_t, and replace with struct sctp_random_param in the places where it's using this typedef. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- include/linux/sctp.h | 4 ++-- include/net/sctp/structs.h | 2 +- net/sctp/auth.c | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 7624568..9b1aa39 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -315,10 +315,10 @@ struct sctp_supported_ext_param { }; /* AUTH Section 3.1 Random */ -typedef struct sctp_random_param { +struct sctp_random_param { struct sctp_paramhdr param_hdr; __u8 random_val[0]; -} sctp_random_param_t; +}; /* AUTH Section 3.2 Chunk List */ typedef struct sctp_chunks_param { diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 5ab29af..f22c079 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1556,7 +1556,7 @@ struct sctp_association { * and authenticated chunk list. All that is part of the * cookie and these are just pointers to those locations */ - sctp_random_param_t *peer_random; + struct sctp_random_param *peer_random; sctp_chunks_param_t *peer_chunks; sctp_hmac_algo_param_t *peer_hmacs; } peer; diff --git a/net/sctp/auth.c b/net/sctp/auth.c index e001b01..0d9c63e 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -185,7 +185,7 @@ static int sctp_auth_compare_vectors(struct sctp_auth_bytes *vector1, * are called the two key vectors. */ static struct sctp_auth_bytes *sctp_auth_make_key_vector( - sctp_random_param_t *random, + struct sctp_random_param *random, sctp_chunks_param_t *chunks, sctp_hmac_algo_param_t *hmacs, gfp_t gfp) @@ -226,10 +226,9 @@ static struct sctp_auth_bytes *sctp_auth_make_local_vector( gfp_t gfp) { return sctp_auth_make_key_vector( - (sctp_random_param_t *)asoc->c.auth_random, - (sctp_chunks_param_t *)asoc->c.auth_chunks, - (sctp_hmac_algo_param_t *)asoc->c.auth_hmacs, - gfp); + (struct sctp_random_param *)asoc->c.auth_random, + (sctp_chunks_param_t *)asoc->c.auth_chunks, + (sctp_hmac_algo_param_t *)asoc->c.auth_hmacs, gfp); } /* Make a key vector based on peer's parameters */ -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 10/11] sctp: remove the typedef sctp_chunks_param_t 2017-07-05 0:32 ` [PATCH net-next 09/11] sctp: remove the typedef sctp_random_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 2017-07-05 0:32 ` [PATCH net-next 11/11] sctp: remove the typedef sctp_hmac_algo_param_t Xin Long 0 siblings, 1 reply; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_chunks_param_t, and replace with struct sctp_chunks_param 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 | 4 ++-- include/net/sctp/structs.h | 2 +- net/sctp/auth.c | 4 ++-- net/sctp/endpointola.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 9b1aa39..b52def9 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -321,10 +321,10 @@ struct sctp_random_param { }; /* AUTH Section 3.2 Chunk List */ -typedef struct sctp_chunks_param { +struct sctp_chunks_param { struct sctp_paramhdr param_hdr; __u8 chunks[0]; -} sctp_chunks_param_t; +}; /* AUTH Section 3.3 HMAC Algorithm */ typedef struct sctp_hmac_algo_param { diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index f22c079..8042e63 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1557,7 +1557,7 @@ struct sctp_association { * cookie and these are just pointers to those locations */ struct sctp_random_param *peer_random; - sctp_chunks_param_t *peer_chunks; + struct sctp_chunks_param *peer_chunks; sctp_hmac_algo_param_t *peer_hmacs; } peer; diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 0d9c63e..367994d 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -186,7 +186,7 @@ static int sctp_auth_compare_vectors(struct sctp_auth_bytes *vector1, */ static struct sctp_auth_bytes *sctp_auth_make_key_vector( struct sctp_random_param *random, - sctp_chunks_param_t *chunks, + struct sctp_chunks_param *chunks, sctp_hmac_algo_param_t *hmacs, gfp_t gfp) { @@ -227,7 +227,7 @@ static struct sctp_auth_bytes *sctp_auth_make_local_vector( { return sctp_auth_make_key_vector( (struct sctp_random_param *)asoc->c.auth_random, - (sctp_chunks_param_t *)asoc->c.auth_chunks, + (struct sctp_chunks_param *)asoc->c.auth_chunks, (sctp_hmac_algo_param_t *)asoc->c.auth_hmacs, gfp); } diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 0e86f98..35bf5af 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c @@ -78,8 +78,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, if (!auth_hmacs) goto nomem; - auth_chunks = kzalloc(sizeof(sctp_chunks_param_t) + - SCTP_NUM_CHUNK_TYPES, gfp); + auth_chunks = kzalloc(sizeof(*auth_chunks) + + SCTP_NUM_CHUNK_TYPES, gfp); if (!auth_chunks) goto nomem; -- 2.1.0 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 11/11] sctp: remove the typedef sctp_hmac_algo_param_t 2017-07-05 0:32 ` [PATCH net-next 10/11] sctp: remove the typedef sctp_chunks_param_t Xin Long @ 2017-07-05 0:32 ` Xin Long 0 siblings, 0 replies; 13+ messages in thread From: Xin Long @ 2017-07-05 0:32 UTC (permalink / raw) To: network dev, linux-sctp; +Cc: Marcelo Ricardo Leitner, Neil Horman, davem This patch is to remove the typedef sctp_hmac_algo_param_t, and replace with struct sctp_hmac_algo_param 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 | 4 ++-- include/net/sctp/structs.h | 2 +- net/sctp/auth.c | 4 ++-- net/sctp/endpointola.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index b52def9..913474d 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -327,10 +327,10 @@ struct sctp_chunks_param { }; /* AUTH Section 3.3 HMAC Algorithm */ -typedef struct sctp_hmac_algo_param { +struct sctp_hmac_algo_param { struct sctp_paramhdr param_hdr; __be16 hmac_ids[0]; -} sctp_hmac_algo_param_t; +}; /* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): * The INIT ACK chunk is used to acknowledge the initiation of an SCTP diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 8042e63..66cd763 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1558,7 +1558,7 @@ struct sctp_association { */ struct sctp_random_param *peer_random; struct sctp_chunks_param *peer_chunks; - sctp_hmac_algo_param_t *peer_hmacs; + struct sctp_hmac_algo_param *peer_hmacs; } peer; /* State : A state variable indicating what state the diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 367994d..00667c5 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -187,7 +187,7 @@ static int sctp_auth_compare_vectors(struct sctp_auth_bytes *vector1, static struct sctp_auth_bytes *sctp_auth_make_key_vector( struct sctp_random_param *random, struct sctp_chunks_param *chunks, - sctp_hmac_algo_param_t *hmacs, + struct sctp_hmac_algo_param *hmacs, gfp_t gfp) { struct sctp_auth_bytes *new; @@ -228,7 +228,7 @@ static struct sctp_auth_bytes *sctp_auth_make_local_vector( return sctp_auth_make_key_vector( (struct sctp_random_param *)asoc->c.auth_random, (struct sctp_chunks_param *)asoc->c.auth_chunks, - (sctp_hmac_algo_param_t *)asoc->c.auth_hmacs, gfp); + (struct sctp_hmac_algo_param *)asoc->c.auth_hmacs, gfp); } /* Make a key vector based on peer's parameters */ diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 35bf5af..3d506b2 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c @@ -73,8 +73,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, * variables. There are arrays that we encode directly * into parameters to make the rest of the operations easier. */ - auth_hmacs = kzalloc(sizeof(sctp_hmac_algo_param_t) + - sizeof(__u16) * SCTP_AUTH_NUM_HMACS, gfp); + auth_hmacs = kzalloc(sizeof(*auth_hmacs) + + sizeof(__u16) * SCTP_AUTH_NUM_HMACS, gfp); if (!auth_hmacs) goto nomem; -- 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 2 2017-07-05 0:32 [PATCH net-next 00/11] sctp: remove typedefs from structures part 2 Xin Long 2017-07-05 0:32 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_ipv4addr_param_t Xin Long @ 2017-07-05 8:06 ` David Miller 1 sibling, 0 replies; 13+ messages in thread From: David Miller @ 2017-07-05 8:06 UTC (permalink / raw) To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman From: Xin Long <lucien.xin@gmail.com> Date: Wed, 5 Jul 2017 08:32:18 +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 2 to remove it for another 11 basic structures. > > Just as the part 1, No any code's logic would be changed in these patches, > only cleaning up. net-next is closed, please resubmit this when the tree opens back up. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-07-05 8:07 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-07-05 0:32 [PATCH net-next 00/11] sctp: remove typedefs from structures part 2 Xin Long 2017-07-05 0:32 ` [PATCH net-next 01/11] sctp: remove the typedef sctp_ipv4addr_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 02/11] sctp: remove the typedef sctp_ipv6addr_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 03/11] sctp: remove the typedef sctp_cookie_preserve_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 04/11] sctp: remove the typedef sctp_hostname_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 05/11] sctp: remove the typedef sctp_supported_addrs_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 06/11] sctp: remove struct sctp_ecn_capable_param Xin Long 2017-07-05 0:32 ` [PATCH net-next 07/11] sctp: remove the typedef sctp_adaptation_ind_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 08/11] sctp: remove the typedef sctp_supported_ext_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 09/11] sctp: remove the typedef sctp_random_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 10/11] sctp: remove the typedef sctp_chunks_param_t Xin Long 2017-07-05 0:32 ` [PATCH net-next 11/11] sctp: remove the typedef sctp_hmac_algo_param_t Xin Long 2017-07-05 8:06 ` [PATCH net-next 00/11] sctp: remove typedefs from structures part 2 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).