Skip to content

Commit 5477f7f

Browse files
committed
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: David S. Miller <[email protected]>
2 parents ddb0804 + bb96dec commit 5477f7f

File tree

8 files changed

+162
-157
lines changed

8 files changed

+162
-157
lines changed

include/linux/sctp.h

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -416,27 +416,27 @@ struct sctp_abort_chunk {
416416
/* For the graceful shutdown we must carry the tag (in common header)
417417
* and the highest consecutive acking value.
418418
*/
419-
typedef struct sctp_shutdownhdr {
419+
struct sctp_shutdownhdr {
420420
__be32 cum_tsn_ack;
421-
} sctp_shutdownhdr_t;
421+
};
422422

423-
struct sctp_shutdown_chunk_t {
423+
struct sctp_shutdown_chunk {
424424
struct sctp_chunkhdr chunk_hdr;
425-
sctp_shutdownhdr_t shutdown_hdr;
425+
struct sctp_shutdownhdr shutdown_hdr;
426426
};
427427

428428
/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
429429

430-
typedef struct sctp_errhdr {
430+
struct sctp_errhdr {
431431
__be16 cause;
432432
__be16 length;
433433
__u8 variable[0];
434-
} sctp_errhdr_t;
434+
};
435435

436-
typedef struct sctp_operr_chunk {
436+
struct sctp_operr_chunk {
437437
struct sctp_chunkhdr chunk_hdr;
438-
sctp_errhdr_t err_hdr;
439-
} sctp_operr_chunk_t;
438+
struct sctp_errhdr err_hdr;
439+
};
440440

441441
/* RFC 2960 3.3.10 - Operation Error
442442
*
@@ -457,7 +457,7 @@ typedef struct sctp_operr_chunk {
457457
* 9 No User Data
458458
* 10 Cookie Received While Shutting Down
459459
*/
460-
typedef enum {
460+
enum sctp_error {
461461

462462
SCTP_ERROR_NO_ERROR = cpu_to_be16(0x00),
463463
SCTP_ERROR_INV_STRM = cpu_to_be16(0x01),
@@ -512,33 +512,28 @@ typedef enum {
512512
* 0x0105 Unsupported HMAC Identifier
513513
*/
514514
SCTP_ERROR_UNSUP_HMAC = cpu_to_be16(0x0105)
515-
} sctp_error_t;
515+
};
516516

517517

518518

519519
/* RFC 2960. Appendix A. Explicit Congestion Notification.
520520
* Explicit Congestion Notification Echo (ECNE) (12)
521521
*/
522-
typedef struct sctp_ecnehdr {
522+
struct sctp_ecnehdr {
523523
__be32 lowest_tsn;
524-
} sctp_ecnehdr_t;
524+
};
525525

526-
typedef struct sctp_ecne_chunk {
526+
struct sctp_ecne_chunk {
527527
struct sctp_chunkhdr chunk_hdr;
528-
sctp_ecnehdr_t ence_hdr;
529-
} sctp_ecne_chunk_t;
528+
struct sctp_ecnehdr ence_hdr;
529+
};
530530

531531
/* RFC 2960. Appendix A. Explicit Congestion Notification.
532532
* Congestion Window Reduced (CWR) (13)
533533
*/
534-
typedef struct sctp_cwrhdr {
534+
struct sctp_cwrhdr {
535535
__be32 lowest_tsn;
536-
} sctp_cwrhdr_t;
537-
538-
typedef struct sctp_cwr_chunk {
539-
struct sctp_chunkhdr chunk_hdr;
540-
sctp_cwrhdr_t cwr_hdr;
541-
} sctp_cwr_chunk_t;
536+
};
542537

543538
/* PR-SCTP
544539
* 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
@@ -634,20 +629,20 @@ struct sctp_fwdtsn_chunk {
634629
* The ASCONF Parameter Response is used in the ASCONF-ACK to
635630
* report status of ASCONF processing.
636631
*/
637-
typedef struct sctp_addip_param {
638-
struct sctp_paramhdr param_hdr;
639-
__be32 crr_id;
640-
} sctp_addip_param_t;
632+
struct sctp_addip_param {
633+
struct sctp_paramhdr param_hdr;
634+
__be32 crr_id;
635+
};
641636

642-
typedef struct sctp_addiphdr {
637+
struct sctp_addiphdr {
643638
__be32 serial;
644639
__u8 params[0];
645-
} sctp_addiphdr_t;
640+
};
646641

647-
typedef struct sctp_addip_chunk {
642+
struct sctp_addip_chunk {
648643
struct sctp_chunkhdr chunk_hdr;
649-
sctp_addiphdr_t addip_hdr;
650-
} sctp_addip_chunk_t;
644+
struct sctp_addiphdr addip_hdr;
645+
};
651646

652647
/* AUTH
653648
* Section 4.1 Authentication Chunk (AUTH)
@@ -698,16 +693,16 @@ typedef struct sctp_addip_chunk {
698693
* HMAC: n bytes (unsigned integer) This hold the result of the HMAC
699694
* calculation.
700695
*/
701-
typedef struct sctp_authhdr {
696+
struct sctp_authhdr {
702697
__be16 shkey_id;
703698
__be16 hmac_id;
704699
__u8 hmac[0];
705-
} sctp_authhdr_t;
700+
};
706701

707-
typedef struct sctp_auth_chunk {
702+
struct sctp_auth_chunk {
708703
struct sctp_chunkhdr chunk_hdr;
709-
sctp_authhdr_t auth_hdr;
710-
} sctp_auth_chunk_t;
704+
struct sctp_authhdr auth_hdr;
705+
};
711706

712707
struct sctp_infox {
713708
struct sctp_info *sctpinfo;

include/net/sctp/sctp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,13 @@ for (pos.v = chunk->member;\
479479
_sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
480480

481481
#define _sctp_walk_errors(err, chunk_hdr, end)\
482-
for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
482+
for (err = (struct sctp_errhdr *)((void *)chunk_hdr + \
483483
sizeof(struct sctp_chunkhdr));\
484-
((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <=\
484+
((void *)err + offsetof(struct sctp_errhdr, length) + sizeof(err->length) <=\
485485
(void *)chunk_hdr + end) &&\
486486
(void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
487-
ntohs(err->length) >= sizeof(sctp_errhdr_t); \
488-
err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
487+
ntohs(err->length) >= sizeof(struct sctp_errhdr); \
488+
err = (struct sctp_errhdr *)((void *)err + SCTP_PAD4(ntohs(err->length))))
489489

490490
#define sctp_walk_fwdtsn(pos, chunk)\
491491
_sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk))

net/sctp/chunk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
201201
struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc);
202202

203203
if (hmac_desc)
204-
max_data -= SCTP_PAD4(sizeof(sctp_auth_chunk_t) +
204+
max_data -= SCTP_PAD4(sizeof(struct sctp_auth_chunk) +
205205
hmac_desc->hmac_len);
206206
}
207207

net/sctp/input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
11111111
__be16 peer_port,
11121112
struct sctp_transport **transportp)
11131113
{
1114-
sctp_addip_chunk_t *asconf = (struct sctp_addip_chunk *)ch;
1114+
struct sctp_addip_chunk *asconf = (struct sctp_addip_chunk *)ch;
11151115
struct sctp_af *af;
11161116
union sctp_addr_param *param;
11171117
union sctp_addr paddr;

0 commit comments

Comments
 (0)