Change in libosmocore[master]: cosmetic: apply changes to match struct_endianess.py output

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Thu May 14 15:41:17 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/18257 )


Change subject: cosmetic: apply changes to match struct_endianess.py output
......................................................................

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
---
M include/osmocom/gsm/protocol/gsm_04_08.h
M include/osmocom/gsm/protocol/gsm_08_08.h
M include/osmocom/gsm/protocol/gsm_23_041.h
3 files changed, 8 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/18257/1

diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 1bca068..f8f2eab 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -664,7 +664,7 @@
 /* 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 @@
 /* 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 e791b07..d8a7773 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -41,27 +41,21 @@
 } __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 e60c324..e726cff 100644
--- a/include/osmocom/gsm/protocol/gsm_23_041.h
+++ b/include/osmocom/gsm/protocol/gsm_23_041.h
@@ -11,9 +11,9 @@
 #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];

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18257
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7432f5337d6589262c31f5186dfd0ac32221c467
Gerrit-Change-Number: 18257
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200514/55ed01ab/attachment.htm>


More information about the gerrit-log mailing list