Commit 5477f7f3 authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-remove-typedefs-from-structures-part-4'

Xin Long says:

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

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 4 to remove it for another 14 basic structures from linux/sctp.h.
After this patchset, all typedefs are cleaned in linux/sctp.h.

Just as the part 1-3, No any code's logic would be changed in these patches,
only cleaning up.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ddb08042 bb96dec7
...@@ -416,27 +416,27 @@ struct sctp_abort_chunk { ...@@ -416,27 +416,27 @@ struct sctp_abort_chunk {
/* For the graceful shutdown we must carry the tag (in common header) /* For the graceful shutdown we must carry the tag (in common header)
* and the highest consecutive acking value. * and the highest consecutive acking value.
*/ */
typedef struct sctp_shutdownhdr { struct sctp_shutdownhdr {
__be32 cum_tsn_ack; __be32 cum_tsn_ack;
} sctp_shutdownhdr_t; };
struct sctp_shutdown_chunk_t { struct sctp_shutdown_chunk {
struct sctp_chunkhdr chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_shutdownhdr_t shutdown_hdr; struct sctp_shutdownhdr shutdown_hdr;
}; };
/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
typedef struct sctp_errhdr { struct sctp_errhdr {
__be16 cause; __be16 cause;
__be16 length; __be16 length;
__u8 variable[0]; __u8 variable[0];
} sctp_errhdr_t; };
typedef struct sctp_operr_chunk { struct sctp_operr_chunk {
struct sctp_chunkhdr chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_errhdr_t err_hdr; struct sctp_errhdr err_hdr;
} sctp_operr_chunk_t; };
/* RFC 2960 3.3.10 - Operation Error /* RFC 2960 3.3.10 - Operation Error
* *
...@@ -457,7 +457,7 @@ typedef struct sctp_operr_chunk { ...@@ -457,7 +457,7 @@ typedef struct sctp_operr_chunk {
* 9 No User Data * 9 No User Data
* 10 Cookie Received While Shutting Down * 10 Cookie Received While Shutting Down
*/ */
typedef enum { enum sctp_error {
SCTP_ERROR_NO_ERROR = cpu_to_be16(0x00), SCTP_ERROR_NO_ERROR = cpu_to_be16(0x00),
SCTP_ERROR_INV_STRM = cpu_to_be16(0x01), SCTP_ERROR_INV_STRM = cpu_to_be16(0x01),
...@@ -512,33 +512,28 @@ typedef enum { ...@@ -512,33 +512,28 @@ typedef enum {
* 0x0105 Unsupported HMAC Identifier * 0x0105 Unsupported HMAC Identifier
*/ */
SCTP_ERROR_UNSUP_HMAC = cpu_to_be16(0x0105) SCTP_ERROR_UNSUP_HMAC = cpu_to_be16(0x0105)
} sctp_error_t; };
/* RFC 2960. Appendix A. Explicit Congestion Notification. /* RFC 2960. Appendix A. Explicit Congestion Notification.
* Explicit Congestion Notification Echo (ECNE) (12) * Explicit Congestion Notification Echo (ECNE) (12)
*/ */
typedef struct sctp_ecnehdr { struct sctp_ecnehdr {
__be32 lowest_tsn; __be32 lowest_tsn;
} sctp_ecnehdr_t; };
typedef struct sctp_ecne_chunk { struct sctp_ecne_chunk {
struct sctp_chunkhdr chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_ecnehdr_t ence_hdr; struct sctp_ecnehdr ence_hdr;
} sctp_ecne_chunk_t; };
/* RFC 2960. Appendix A. Explicit Congestion Notification. /* RFC 2960. Appendix A. Explicit Congestion Notification.
* Congestion Window Reduced (CWR) (13) * Congestion Window Reduced (CWR) (13)
*/ */
typedef struct sctp_cwrhdr { struct sctp_cwrhdr {
__be32 lowest_tsn; __be32 lowest_tsn;
} sctp_cwrhdr_t; };
typedef struct sctp_cwr_chunk {
struct sctp_chunkhdr chunk_hdr;
sctp_cwrhdr_t cwr_hdr;
} sctp_cwr_chunk_t;
/* PR-SCTP /* PR-SCTP
* 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN) * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
...@@ -634,20 +629,20 @@ struct sctp_fwdtsn_chunk { ...@@ -634,20 +629,20 @@ struct sctp_fwdtsn_chunk {
* The ASCONF Parameter Response is used in the ASCONF-ACK to * The ASCONF Parameter Response is used in the ASCONF-ACK to
* report status of ASCONF processing. * report status of ASCONF processing.
*/ */
typedef struct sctp_addip_param { struct sctp_addip_param {
struct sctp_paramhdr param_hdr; struct sctp_paramhdr param_hdr;
__be32 crr_id; __be32 crr_id;
} sctp_addip_param_t; };
typedef struct sctp_addiphdr { struct sctp_addiphdr {
__be32 serial; __be32 serial;
__u8 params[0]; __u8 params[0];
} sctp_addiphdr_t; };
typedef struct sctp_addip_chunk { struct sctp_addip_chunk {
struct sctp_chunkhdr chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_addiphdr_t addip_hdr; struct sctp_addiphdr addip_hdr;
} sctp_addip_chunk_t; };
/* AUTH /* AUTH
* Section 4.1 Authentication Chunk (AUTH) * Section 4.1 Authentication Chunk (AUTH)
...@@ -698,16 +693,16 @@ typedef struct sctp_addip_chunk { ...@@ -698,16 +693,16 @@ typedef struct sctp_addip_chunk {
* HMAC: n bytes (unsigned integer) This hold the result of the HMAC * HMAC: n bytes (unsigned integer) This hold the result of the HMAC
* calculation. * calculation.
*/ */
typedef struct sctp_authhdr { struct sctp_authhdr {
__be16 shkey_id; __be16 shkey_id;
__be16 hmac_id; __be16 hmac_id;
__u8 hmac[0]; __u8 hmac[0];
} sctp_authhdr_t; };
typedef struct sctp_auth_chunk { struct sctp_auth_chunk {
struct sctp_chunkhdr chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_authhdr_t auth_hdr; struct sctp_authhdr auth_hdr;
} sctp_auth_chunk_t; };
struct sctp_infox { struct sctp_infox {
struct sctp_info *sctpinfo; struct sctp_info *sctpinfo;
......
...@@ -479,13 +479,13 @@ for (pos.v = chunk->member;\ ...@@ -479,13 +479,13 @@ for (pos.v = chunk->member;\
_sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
#define _sctp_walk_errors(err, chunk_hdr, end)\ #define _sctp_walk_errors(err, chunk_hdr, end)\
for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ for (err = (struct sctp_errhdr *)((void *)chunk_hdr + \
sizeof(struct sctp_chunkhdr));\ sizeof(struct sctp_chunkhdr));\
((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <=\ ((void *)err + offsetof(struct sctp_errhdr, length) + sizeof(err->length) <=\
(void *)chunk_hdr + end) &&\ (void *)chunk_hdr + end) &&\
(void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
ntohs(err->length) >= sizeof(sctp_errhdr_t); \ ntohs(err->length) >= sizeof(struct sctp_errhdr); \
err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) err = (struct sctp_errhdr *)((void *)err + SCTP_PAD4(ntohs(err->length))))
#define sctp_walk_fwdtsn(pos, chunk)\ #define sctp_walk_fwdtsn(pos, chunk)\
_sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk)) _sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk))
......
...@@ -201,7 +201,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -201,7 +201,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc); struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc);
if (hmac_desc) if (hmac_desc)
max_data -= SCTP_PAD4(sizeof(sctp_auth_chunk_t) + max_data -= SCTP_PAD4(sizeof(struct sctp_auth_chunk) +
hmac_desc->hmac_len); hmac_desc->hmac_len);
} }
......
...@@ -1111,7 +1111,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup( ...@@ -1111,7 +1111,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
__be16 peer_port, __be16 peer_port,
struct sctp_transport **transportp) struct sctp_transport **transportp)
{ {
sctp_addip_chunk_t *asconf = (struct sctp_addip_chunk *)ch; struct sctp_addip_chunk *asconf = (struct sctp_addip_chunk *)ch;
struct sctp_af *af; struct sctp_af *af;
union sctp_addr_param *param; union sctp_addr_param *param;
union sctp_addr paddr; union sctp_addr paddr;
......
This diff is collapsed.
...@@ -828,7 +828,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds, ...@@ -828,7 +828,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds,
if (!sctp_assoc_update(asoc, new)) if (!sctp_assoc_update(asoc, new))
return; return;
abort = sctp_make_abort(asoc, NULL, sizeof(sctp_errhdr_t)); abort = sctp_make_abort(asoc, NULL, sizeof(struct sctp_errhdr));
if (abort) { if (abort) {
sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0);
sctp_add_cmd_sf(cmds, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); sctp_add_cmd_sf(cmds, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
......
This diff is collapsed.
...@@ -371,19 +371,19 @@ sctp_ulpevent_make_remote_error(const struct sctp_association *asoc, ...@@ -371,19 +371,19 @@ sctp_ulpevent_make_remote_error(const struct sctp_association *asoc,
struct sctp_chunk *chunk, __u16 flags, struct sctp_chunk *chunk, __u16 flags,
gfp_t gfp) gfp_t gfp)
{ {
struct sctp_ulpevent *event;
struct sctp_remote_error *sre; struct sctp_remote_error *sre;
struct sctp_ulpevent *event;
struct sctp_errhdr *ch;
struct sk_buff *skb; struct sk_buff *skb;
sctp_errhdr_t *ch;
__be16 cause; __be16 cause;
int elen; int elen;
ch = (sctp_errhdr_t *)(chunk->skb->data); ch = (struct sctp_errhdr *)(chunk->skb->data);
cause = ch->cause; cause = ch->cause;
elen = SCTP_PAD4(ntohs(ch->length)) - sizeof(sctp_errhdr_t); elen = SCTP_PAD4(ntohs(ch->length)) - sizeof(*ch);
/* Pull off the ERROR header. */ /* Pull off the ERROR header. */
skb_pull(chunk->skb, sizeof(sctp_errhdr_t)); skb_pull(chunk->skb, sizeof(*ch));
/* Copy the skb to a new skb with room for us to prepend /* Copy the skb to a new skb with room for us to prepend
* notification with. * notification with.
......
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