Skip to content

Commit

Permalink
Merge branch 'sctp-remove-typedefs-from-structures-part-4'
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
davem330 committed Aug 3, 2017
2 parents ddb0804 + bb96dec commit 5477f7f
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 157 deletions.
69 changes: 32 additions & 37 deletions include/linux/sctp.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,27 +416,27 @@ struct sctp_abort_chunk {
/* For the graceful shutdown we must carry the tag (in common header)
* and the highest consecutive acking value.
*/
typedef struct sctp_shutdownhdr {
struct sctp_shutdownhdr {
__be32 cum_tsn_ack;
} sctp_shutdownhdr_t;
};

struct sctp_shutdown_chunk_t {
struct sctp_shutdown_chunk {
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) */

typedef struct sctp_errhdr {
struct sctp_errhdr {
__be16 cause;
__be16 length;
__u8 variable[0];
} sctp_errhdr_t;
};

typedef struct sctp_operr_chunk {
struct sctp_operr_chunk {
struct sctp_chunkhdr chunk_hdr;
sctp_errhdr_t err_hdr;
} sctp_operr_chunk_t;
struct sctp_errhdr err_hdr;
};

/* RFC 2960 3.3.10 - Operation Error
*
Expand All @@ -457,7 +457,7 @@ typedef struct sctp_operr_chunk {
* 9 No User Data
* 10 Cookie Received While Shutting Down
*/
typedef enum {
enum sctp_error {

SCTP_ERROR_NO_ERROR = cpu_to_be16(0x00),
SCTP_ERROR_INV_STRM = cpu_to_be16(0x01),
Expand Down Expand Up @@ -512,33 +512,28 @@ typedef enum {
* 0x0105 Unsupported HMAC Identifier
*/
SCTP_ERROR_UNSUP_HMAC = cpu_to_be16(0x0105)
} sctp_error_t;
};



/* RFC 2960. Appendix A. Explicit Congestion Notification.
* Explicit Congestion Notification Echo (ECNE) (12)
*/
typedef struct sctp_ecnehdr {
struct sctp_ecnehdr {
__be32 lowest_tsn;
} sctp_ecnehdr_t;
};

typedef struct sctp_ecne_chunk {
struct sctp_ecne_chunk {
struct sctp_chunkhdr chunk_hdr;
sctp_ecnehdr_t ence_hdr;
} sctp_ecne_chunk_t;
struct sctp_ecnehdr ence_hdr;
};

/* RFC 2960. Appendix A. Explicit Congestion Notification.
* Congestion Window Reduced (CWR) (13)
*/
typedef struct sctp_cwrhdr {
struct sctp_cwrhdr {
__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
* 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
Expand Down Expand Up @@ -634,20 +629,20 @@ struct sctp_fwdtsn_chunk {
* The ASCONF Parameter Response is used in the ASCONF-ACK to
* report status of ASCONF processing.
*/
typedef struct sctp_addip_param {
struct sctp_paramhdr param_hdr;
__be32 crr_id;
} sctp_addip_param_t;
struct sctp_addip_param {
struct sctp_paramhdr param_hdr;
__be32 crr_id;
};

typedef struct sctp_addiphdr {
struct sctp_addiphdr {
__be32 serial;
__u8 params[0];
} sctp_addiphdr_t;
};

typedef struct sctp_addip_chunk {
struct sctp_addip_chunk {
struct sctp_chunkhdr chunk_hdr;
sctp_addiphdr_t addip_hdr;
} sctp_addip_chunk_t;
struct sctp_addiphdr addip_hdr;
};

/* AUTH
* Section 4.1 Authentication Chunk (AUTH)
Expand Down Expand Up @@ -698,16 +693,16 @@ typedef struct sctp_addip_chunk {
* HMAC: n bytes (unsigned integer) This hold the result of the HMAC
* calculation.
*/
typedef struct sctp_authhdr {
struct sctp_authhdr {
__be16 shkey_id;
__be16 hmac_id;
__u8 hmac[0];
} sctp_authhdr_t;
};

typedef struct sctp_auth_chunk {
struct sctp_auth_chunk {
struct sctp_chunkhdr chunk_hdr;
sctp_authhdr_t auth_hdr;
} sctp_auth_chunk_t;
struct sctp_authhdr auth_hdr;
};

struct sctp_infox {
struct sctp_info *sctpinfo;
Expand Down
8 changes: 4 additions & 4 deletions include/net/sctp/sctp.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,13 @@ for (pos.v = chunk->member;\
_sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))

#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));\
((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 *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
ntohs(err->length) >= sizeof(sctp_errhdr_t); \
err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
ntohs(err->length) >= sizeof(struct sctp_errhdr); \
err = (struct sctp_errhdr *)((void *)err + SCTP_PAD4(ntohs(err->length))))

#define sctp_walk_fwdtsn(pos, chunk)\
_sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk))
Expand Down
2 changes: 1 addition & 1 deletion net/sctp/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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);
}

Expand Down
2 changes: 1 addition & 1 deletion net/sctp/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
__be16 peer_port,
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;
union sctp_addr_param *param;
union sctp_addr paddr;
Expand Down
Loading

0 comments on commit 5477f7f

Please sign in to comment.