From 534f0f402b6cd70ffa737b1bc7836cf77a059ef9 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 14 May 2020 17:28:39 +0200 Subject: cosmetic: apply changes to match struct_endianess.py output gsm48_pag_resp and gsm48_service_request: omit comments in big endian part. dtap_header: better segment the substruct. gsm23041_msg_param_gsm: match up whitespace / comments. Rationale: the script is a good way to avoid bugs from manually composing the big endian parts (for example, it detected the missing endian.h include, fixed in I593cc5e8272469b570559206bb02b6e79797340b). However, it becomes cumbersome if it creates numerous edits in the source tree, which cause more time spent for whoever wanted to rather save time with it. So let's keep the code tree matching that struct's output. Change-Id: I7432f5337d6589262c31f5186dfd0ac32221c467 --- include/osmocom/gsm/protocol/gsm_04_08.h | 4 ++-- include/osmocom/gsm/protocol/gsm_08_08.h | 12 +++--------- include/osmocom/gsm/protocol/gsm_23_041.h | 6 +++--- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 1bca0682..f8f2eabd 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -664,7 +664,7 @@ struct gsm48_pag_resp { /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t key_seq:4, spare:4; union { - uint32_t classmark2; /* Backward compatibility */ + uint32_t classmark2; struct { uint8_t cm2_len; struct gsm48_classmark2 cm2; @@ -815,7 +815,7 @@ struct gsm48_service_request { /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t cipher_key_seq:4, cm_service_type:4; union { - uint32_t classmark; /* Backward compatibility */ + uint32_t classmark; struct { uint8_t cm2_len; struct gsm48_classmark2 classmark2; diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index e791b070..d8a77733 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -41,27 +41,21 @@ struct bssmap_header { } __attribute__((packed)); struct dtap_header { -#if OSMO_IS_LITTLE_ENDIAN uint8_t type; union { uint8_t link_id; /* Backward compatibility */ struct { +#if OSMO_IS_LITTLE_ENDIAN uint8_t dlci_cc:2, dlci_spare:3, dlci_sapi:3; /* enum gsm0406_dlc_sapi */ - }; - }; - uint8_t length; #elif OSMO_IS_BIG_ENDIAN - uint8_t type; - union { - uint8_t link_id; - struct { +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t dlci_sapi:3, dlci_spare:3, dlci_cc:2; +#endif }; }; uint8_t length; -#endif } __attribute__((packed)); /* Data Link Control SAPI, GSM 08.06 § 6.3.2, GSM 04.06 § 3.3.3 */ diff --git a/include/osmocom/gsm/protocol/gsm_23_041.h b/include/osmocom/gsm/protocol/gsm_23_041.h index e60c3243..e726cff2 100644 --- a/include/osmocom/gsm/protocol/gsm_23_041.h +++ b/include/osmocom/gsm/protocol/gsm_23_041.h @@ -11,9 +11,9 @@ struct gsm23041_msg_param_gsm { #if OSMO_IS_LITTLE_ENDIAN uint8_t num_pages:4, page_nr:4; -#else - uint8_t page_nr:4, - num_pages:4; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t page_nr:4, num_pages:4; #endif } page_param; uint8_t content[0]; -- cgit v1.2.3