Commit a2888551 authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-typedef-remove-part-2'

Xin Long says:

====================
sctp: remove typedefs from structures part 2

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.

Note that v1->v2, nothing changed, just because net-next were closed when
posting v1.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents aed20a53 1474774a
......@@ -273,69 +273,64 @@ 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;
};
/* 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 {
struct sctp_cookie_preserve_param {
struct sctp_paramhdr param_hdr;
__be32 lifespan_increment;
} sctp_cookie_preserve_param_t;
};
/* 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 {
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 {
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_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 {
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 {
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 {
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 {
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
......
......@@ -1556,9 +1556,9 @@ 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;
sctp_chunks_param_t *peer_chunks;
sctp_hmac_algo_param_t *peer_hmacs;
struct sctp_random_param *peer_random;
struct sctp_chunks_param *peer_chunks;
struct sctp_hmac_algo_param *peer_hmacs;
} peer;
/* State : A state variable indicating what state the
......
......@@ -185,9 +185,9 @@ 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,
sctp_chunks_param_t *chunks,
sctp_hmac_algo_param_t *hmacs,
struct sctp_random_param *random,
struct sctp_chunks_param *chunks,
struct sctp_hmac_algo_param *hmacs,
gfp_t gfp)
{
struct sctp_auth_bytes *new;
......@@ -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,
(struct sctp_chunks_param *)asoc->c.auth_chunks,
(struct sctp_hmac_algo_param *)asoc->c.auth_hmacs, gfp);
}
/* Make a key vector based on peer's parameters */
......
......@@ -73,12 +73,12 @@ 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) +
auth_hmacs = kzalloc(sizeof(*auth_hmacs) +
sizeof(__u16) * SCTP_AUTH_NUM_HMACS, gfp);
if (!auth_hmacs)
goto nomem;
auth_chunks = kzalloc(sizeof(sctp_chunks_param_t) +
auth_chunks = kzalloc(sizeof(*auth_chunks) +
SCTP_NUM_CHUNK_TYPES, gfp);
if (!auth_chunks)
goto nomem;
......
......@@ -497,7 +497,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);
......
......@@ -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);
......
......@@ -223,10 +223,10 @@ 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;
struct sctp_adaptation_ind_param aiparam;
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);
}
......@@ -393,8 +390,8 @@ 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;
sctp_supported_ext_param_t ext_param;
struct sctp_adaptation_ind_param aiparam;
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)
......@@ -3153,7 +3147,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.
......@@ -3163,7 +3157,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;
......
......@@ -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,
......
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