Change in osmo-pcu[master]: Convert osmo_bts_sock.cpp to C

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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Jan 19 16:40:09 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22297 )

Change subject: Convert osmo_bts_sock.cpp to C
......................................................................

Convert osmo_bts_sock.cpp to C

There's no real point in using C++ there, and using C++ makes the
compiler fail to use llist_head in multi-bts patches added later due to:
"""
'offsetof' within non-standard-layout type is conditionally-supported
"""

Change-Id: I8965b5cc5a713e64788b5b6aa183d3035341ddbb
---
M src/Makefile.am
R src/osmobts_sock.c
M src/pcu_l1_if.h
M src/pdch.cpp
M src/pdch.h
M tests/tbf/TbfTest.cpp
6 files changed, 17 insertions(+), 15 deletions(-)

Approvals:
  Jenkins Builder: Verified
  neels: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve



diff --git a/src/Makefile.am b/src/Makefile.am
index 60f05a5..de924a6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -65,7 +65,7 @@
 	decoding.cpp \
 	llc.cpp \
 	rlc.cpp \
-	osmobts_sock.cpp \
+	osmobts_sock.c \
 	gprs_codel.c \
 	coding_scheme.c \
 	egprs_rlc_compression.cpp \
diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.c
similarity index 98%
rename from src/osmobts_sock.cpp
rename to src/osmobts_sock.c
index c68b7b9..ec9d7ce 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.c
@@ -25,13 +25,13 @@
 #include <assert.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-extern "C" {
+
 #include <osmocom/core/select.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/logging.h>
 #include <osmocom/core/timer.h>
-}
+
 
 #include <pcu_l1_if.h>
 #include <gprs_debug.h>
@@ -41,9 +41,7 @@
 #include <tbf.h>
 #include <pdch.h>
 
-extern "C" {
 int l1if_close_pdch(void *obj);
-}
 
 /*
  * osmo-bts PCU socket functions
@@ -115,7 +113,7 @@
 		}
 #endif
 		for (ts = 0; ts < 8; ts++)
-			bts->trx[trx].pdch[ts].disable();
+			pdch_disable(&bts->trx[trx].pdch[ts]);
 /* FIXME: NOT ALL RESOURCES are freed in this case... inconsistent with the other code. Share the code with pcu_l1if.c
 for the reset. */
 		bts_trx_free_all_tbf(&bts->trx[trx]);
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 674ccca..8ef262c 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -150,19 +150,18 @@
 void pcu_l1if_tx_agch(bitvec * block, int len);
 
 void pcu_l1if_tx_pch(bitvec * block, int plen, uint16_t pgroup);
-
-int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...);
-
-int pcu_l1if_open(void);
-void pcu_l1if_close(void);
-
-int pcu_rx(uint8_t msg_type, struct gsm_pcu_if *pcu_prim);
-int pcu_sock_send(struct msgb *msg);
 #endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
+int pcu_rx(uint8_t msg_type, struct gsm_pcu_if *pcu_prim);
+int pcu_l1if_open(void);
+void pcu_l1if_close(void);
+int pcu_sock_send(struct msgb *msg);
+
+int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...);
+
 int pcu_rx_rts_req_pdtch(uint8_t trx, uint8_t ts,
 	uint32_t fn, uint8_t block_nr);
 int pcu_rx_rts_req_ptcch(uint8_t trx, uint8_t ts,
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 15fd139..5a329f3 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -1031,3 +1031,7 @@
 			tbf_free(tbf);
 	}
 }
+
+void pdch_disable(struct gprs_rlcmac_pdch *pdch) {
+	pdch->disable();
+}
diff --git a/src/pdch.h b/src/pdch.h
index 57e0f43..8871986 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -188,6 +188,7 @@
 extern "C" {
 #endif
 void pdch_free_all_tbf(struct gprs_rlcmac_pdch *pdch);
+void pdch_disable(struct gprs_rlcmac_pdch *pdch);
 #ifdef __cplusplus
 }
 #endif
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index fbcb503..798dc3c 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -166,7 +166,7 @@
 
 /* override, requires '-Wl,--wrap=pcu_sock_send' */
 int __real_pcu_sock_send(struct msgb *msg);
-int __wrap_pcu_sock_send(struct msgb *msg)
+extern "C" int __wrap_pcu_sock_send(struct msgb *msg)
 {
 	return 0;
 }

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I8965b5cc5a713e64788b5b6aa183d3035341ddbb
Gerrit-Change-Number: 22297
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210119/8e46e413/attachment.htm>


More information about the gerrit-log mailing list