[PATCH] osmo-pcu[master]: Update header includes

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

Max gerrit-no-reply at lists.osmocom.org
Tue Jan 30 12:55:52 UTC 2018


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/6100

to look at the new patch set (#4).

Update header includes

Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Related: OS#1539
Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
---
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_bssgp_pcu.h
M src/gprs_ms.cpp
M src/gprs_ms.h
M src/gprs_ms_storage.cpp
M src/gprs_rlcmac.cpp
M src/gprs_rlcmac_sched.cpp
M src/gprs_rlcmac_ts_alloc.cpp
M src/llc.h
M src/osmobts_sock.cpp
M src/pcu_l1_if.cpp
M src/pcu_main.cpp
M src/pcu_vty_functions.cpp
M src/poll_controller.cpp
M src/poll_controller.h
M src/rlc.cpp
M src/sba.cpp
M src/sba.h
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_ul.cpp
M tests/edge/EdgeTest.cpp
M tests/tbf/TbfTest.cpp
26 files changed, 118 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/00/6100/4

diff --git a/src/bts.cpp b/src/bts.cpp
index 1d5b29f..24be5d4 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -25,9 +25,10 @@
 #include <decoding.h>
 #include <rlc.h>
 #include <pcu_l1_if.h>
-
+#include <gprs_ms.h>
 #include <gprs_rlcmac.h>
 #include <gprs_debug.h>
+#include <cxx_linuxlist.h>
 
 extern "C" {
 	#include <osmocom/core/talloc.h>
@@ -37,9 +38,11 @@
 	#include <osmocom/gsm/gsm_utils.h>
 	#include <osmocom/core/gsmtap_util.h>
 	#include <osmocom/core/application.h>
+	#include <osmocom/core/bitvec.h>
+	#include <osmocom/core/gsmtap.h>
+	#include <osmocom/core/logging.h>
+	#include <osmocom/core/utils.h>
 }
-
-#include <arpa/inet.h>
 
 #include <errno.h>
 #include <string.h>
diff --git a/src/bts.h b/src/bts.h
index 173e6e8..c3bee12 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -26,17 +26,17 @@
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/rate_ctr.h>
 #include <osmocom/core/stat_item.h>
-#include <osmocom/core/timer.h>
-#include <osmocom/core/gsmtap.h>
 #include <osmocom/gsm/l1sap.h>
 #include <osmocom/gsm/protocol/gsm_04_08.h>
 }
 
+#include <gsm_rlcmac.h>
 #include "poll_controller.h"
 #include "sba.h"
 #include "tbf.h"
 #include "gprs_ms_storage.h"
 #include "gprs_coding_scheme.h"
+#include <cxx_linuxlist.h>
 #endif
 
 #include <stdint.h>
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index a86e09d..e0d756a 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -21,8 +21,10 @@
 #include <gprs_rlcmac.h>
 #include <gprs_bssgp_pcu.h>
 #include <pcu_l1_if.h>
+#include <gprs_debug.h>
 #include <bts.h>
 #include <tbf.h>
+#include <gprs_coding_scheme.h>
 
 #define BSSGP_TIMER_T1	30	/* Guards the (un)blocking procedures */
 #define BSSGP_TIMER_T2	30	/* Guards the reset procedure */
diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h
index bb44903..4eda57d 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -42,8 +42,6 @@
 #define NS_HDR_LEN 4
 #define IE_LLC_PDU 14
 
-struct gprs_rlcmac_bts;
-
 struct gprs_bssgp_pcu {
 	struct gprs_nsvc *nsvc;
 	struct bssgp_bvc_ctx *bctx;
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 33d9cad..740ef6b 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -20,7 +20,7 @@
 
 
 #include "gprs_ms.h"
-
+#include <gprs_coding_scheme.h>
 #include "bts.h"
 #include "tbf.h"
 #include "gprs_debug.h"
@@ -33,6 +33,7 @@
 	#include <osmocom/core/talloc.h>
 	#include <osmocom/core/utils.h>
 	#include <osmocom/gsm/protocol/gsm_04_08.h>
+	#include <osmocom/core/logging.h>
 }
 
 #define GPRS_CODEL_SLOW_INTERVAL_MS 4000
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index f094e96..857f0c9 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -22,13 +22,16 @@
 
 struct gprs_codel;
 
+#include <gprs_coding_scheme.h>
 #include "cxx_linuxlist.h"
 #include "llc.h"
 #include "tbf.h"
 #include "pcu_l1_if.h"
+#include <gprs_coding_scheme.h>
 
 extern "C" {
 	#include <osmocom/core/timer.h>
+	#include <osmocom/core/linuxlist.h>
 }
 
 #include <stdint.h>
diff --git a/src/gprs_ms_storage.cpp b/src/gprs_ms_storage.cpp
index 6a7f336..c7de6d3 100644
--- a/src/gprs_ms_storage.cpp
+++ b/src/gprs_ms_storage.cpp
@@ -23,7 +23,10 @@
 
 #include "tbf.h"
 #include "bts.h"
-#include "gprs_debug.h"
+
+extern "C" {
+	#include <osmocom/core/linuxlist.h>
+}
 
 #define GPRS_UNDEFINED_IMSI "000"
 
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 06c5479..da5c541 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -24,7 +24,7 @@
 #include <bts.h>
 #include <encoding.h>
 #include <tbf.h>
-
+#include <gprs_debug.h>
 
 extern void *tall_pcu_ctx;
 
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index ebf4714..e4e40b1 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -22,9 +22,16 @@
 #include <pcu_l1_if.h>
 #include <bts.h>
 #include <tbf.h>
-
+#include <gprs_debug.h>
+#include <gprs_ms.h>
+#include <rlc.h>
+#include <sba.h>
 #include "pcu_utils.h"
 
+extern "C" {
+	#include <osmocom/core/gsmtap.h>
+}
+
 static uint32_t sched_poll(BTS *bts,
 		    uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr,
 		    struct gprs_rlcmac_tbf **poll_tbf,
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index e394a6e..e555466 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -31,6 +31,9 @@
 
 extern "C" {
 #include "mslot_class.h"
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/logging.h>
+#include <osmocom/core/utils.h>
 }
 
 /* Consider a PDCH as idle if has at most this number of TBFs assigned to it */
diff --git a/src/llc.h b/src/llc.h
index 9d402c3..2e7229c 100644
--- a/src/llc.h
+++ b/src/llc.h
@@ -29,7 +29,6 @@
 #define LLC_MAX_LEN 1543
 
 struct BTS;
-struct msgb;
 
 /**
  * I represent the LLC data to a MS
diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp
index 577d41e..f56332e 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.cpp
@@ -29,9 +29,11 @@
 #include <osmocom/core/talloc.h>
 #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 <gprs_rlcmac.h>
 #include <pcu_l1_if.h>
 #include <gprs_debug.h>
 #include <gprs_bssgp_pcu.h>
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 7112b04..2a354d8 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -26,12 +26,18 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <arpa/inet.h>
+
 extern "C" {
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/gsmtap_util.h>
 #include <osmocom/core/gsmtap.h>
+#include <osmocom/core/bitvec.h>
+#include <osmocom/core/logging.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/gsm/l1sap.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
 }
 
 #include <gprs_rlcmac.h>
@@ -40,7 +46,6 @@
 #include <gprs_bssgp_pcu.h>
 #include <osmocom/pcu/pcuif_proto.h>
 #include <bts.h>
-#include <tbf.h>
 
 // FIXME: move this, when changed from c++ to c.
 extern "C" {
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index b7574f9..0c3a414 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -17,22 +17,34 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include <gprs_bssgp_pcu.h>
-#include <arpa/inet.h>
 #include <pcu_l1_if.h>
 #include <gprs_rlcmac.h>
 #include <gsm_timer.h>
 #include <gprs_debug.h>
 #include <unistd.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
 #include <getopt.h>
 #include <signal.h>
 #include <sched.h>
 #include <bts.h>
+#include <gprs_coding_scheme.h>
+#include <osmocom/pcu/pcuif_proto.h>
 extern "C" {
 #include "pcu_vty.h"
+#include <osmocom/gprs/gprs_bssgp.h>
+#include <osmocom/gprs/gprs_ns.h>
 #include <osmocom/vty/telnet_interface.h>
-#include <osmocom/vty/logging.h>
+#include <osmocom/vty/command.h>
+#include <osmocom/vty/vty.h>
 #include <osmocom/vty/ports.h>
+#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/application.h>
+#include <osmocom/core/msgb.h>
 #include <osmocom/core/stats.h>
 #include <osmocom/core/gsmtap.h>
 #include <osmocom/core/gsmtap_util.h>
diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index eb15aa6..d4162a9 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -27,11 +27,19 @@
 #include "gprs_ms_storage.h"
 #include "gprs_ms.h"
 #include "cxx_linuxlist.h"
+#include <gprs_coding_scheme.h>
+#include <llc.h>
+#include <pcu_l1_if.h>
+#include <rlc.h>
+#include <tbf.h>
 
 extern "C" {
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/logging.h>
 #include <osmocom/vty/misc.h>
+	#include <osmocom/core/linuxlist.h>
+	#include <osmocom/core/utils.h>
+	#include <osmocom/vty/vty.h>
 }
 
 int pcu_vty_config_write_pcu_ext(struct vty *vty)
diff --git a/src/poll_controller.cpp b/src/poll_controller.cpp
index 5c5a717..744b612 100644
--- a/src/poll_controller.cpp
+++ b/src/poll_controller.cpp
@@ -23,6 +23,13 @@
 #include <poll_controller.h>
 #include <bts.h>
 #include <tbf.h>
+#include <cxx_linuxlist.h>
+#include <sba.h>
+
+extern "C" {
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/gsm/gsm_utils.h>
+}
 
 PollController::PollController(BTS& bts)
 	: m_bts(bts)
diff --git a/src/poll_controller.h b/src/poll_controller.h
index b9ae80e..65d1fee 100644
--- a/src/poll_controller.h
+++ b/src/poll_controller.h
@@ -21,8 +21,6 @@
 
 #pragma once
 
-struct gprs_rlcmac_bts;
-
 struct BTS;
 
 /**
diff --git a/src/rlc.cpp b/src/rlc.cpp
index d7f0609..a82f550 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -18,11 +18,17 @@
 
 #include "bts.h"
 #include "gprs_debug.h"
+#include <gprs_coding_scheme.h>
+#include <rlc.h>
 
-#include <errno.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sys/types.h>
 
 extern "C" {
 #include <osmocom/core/utils.h>
+#include <osmocom/core/bitvec.h>
+#include <osmocom/core/logging.h>
 }
 
 
diff --git a/src/sba.cpp b/src/sba.cpp
index 56a7543..5dfdddb 100644
--- a/src/sba.cpp
+++ b/src/sba.cpp
@@ -20,14 +20,15 @@
  */
 
 #include <sba.h>
-#include <gprs_rlcmac.h>
 #include <gprs_debug.h>
 #include <bts.h>
 #include <pcu_utils.h>
 
 extern "C" {
+#include <osmocom/core/logging.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/gsm/protocol/gsm_04_08.h>
+#include <osmocom/gsm/gsm_utils.h>
 }
 
 #include <errno.h>
diff --git a/src/sba.h b/src/sba.h
index d2d3106..27dae21 100644
--- a/src/sba.h
+++ b/src/sba.h
@@ -27,7 +27,6 @@
 }
 
 struct BTS;
-class PollController;
 struct gprs_rlcmac_pdch;
 
 /*
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 8cfca3a..74f2cd8 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -25,10 +25,13 @@
 #include <encoding.h>
 #include <gprs_rlcmac.h>
 #include <gprs_debug.h>
-#include <gprs_bssgp_pcu.h>
 #include <gprs_ms.h>
-#include <decoding.h>
 #include <pcu_utils.h>
+#include <gprs_ms_storage.h>
+#include <gsm_rlcmac.h>
+#include <sba.h>
+#include <gprs_coding_scheme.h>
+#include <gsm_timer.h>
 
 extern "C" {
 #include <osmocom/core/msgb.h>
@@ -36,6 +39,9 @@
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/stats.h>
 #include <osmocom/core/logging.h>
+	#include <osmocom/core/bitvec.h>
+	#include <osmocom/core/rate_ctr.h>
+	#include <osmocom/gsm/protocol/gsm_04_08.h>
 }
 
 #include <errno.h>
diff --git a/src/tbf.h b/src/tbf.h
index 803ea33..fbef20e 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -20,20 +20,23 @@
 
 #ifdef __cplusplus
 
-#include "gprs_rlcmac.h"
 #include "llc.h"
 #include "rlc.h"
 #include "cxx_linuxlist.h"
 #include <gprs_debug.h>
-
+#include <gprs_coding_scheme.h>
+#include <gsm_timer.h>
 #include <stdint.h>
 extern "C" {
 #include <osmocom/core/utils.h>
+	#include <osmocom/core/linuxlist.h>
+	#include <osmocom/core/logging.h>
+	#include <osmocom/core/timer.h>
 }
 
 struct bssgp_bvc_ctx;
-struct pcu_l1_meas;
 class GprsMs;
+struct gprs_rlcmac_bts;
 
 /*
  * TBF instance
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index e8aec23..ae487c2 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -28,18 +28,28 @@
 #include <gprs_codel.h>
 #include <decoding.h>
 #include <encoding.h>
-
+#include <gprs_coding_scheme.h>
+#include <gprs_ms.h>
+#include <gprs_ms_storage.h>
+#include <llc.h>
 #include "pcu_utils.h"
 
 extern "C" {
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/gprs/gprs_bssgp_bss.h>
+	#include <osmocom/core/bitvec.h>
+	#include <osmocom/core/linuxlist.h>
+	#include <osmocom/core/logging.h>
+	#include <osmocom/core/rate_ctr.h>
+	#include <osmocom/core/timer.h>
+	#include <osmocom/core/utils.h>
+	#include <osmocom/gsm/gsm_utils.h>
+	#include <osmocom/gsm/protocol/gsm_04_08.h>
 }
 
 #include <errno.h>
 #include <string.h>
-#include <math.h>
 
 /* After sending these frames, we poll for ack/nack. */
 #define POLL_ACK_AFTER_FRAMES 20
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 1560eb0..6960ea9 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -28,12 +28,21 @@
 #include <gprs_bssgp_pcu.h>
 #include <decoding.h>
 #include <pcu_l1_if.h>
-
+#include <gprs_coding_scheme.h>
+#include <gprs_ms.h>
+#include <llc.h>
 #include "pcu_utils.h"
 
 extern "C" {
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
+	#include <osmocom/core/bitvec.h>
+	#include <osmocom/core/logging.h>
+	#include <osmocom/core/rate_ctr.h>
+	#include <osmocom/core/utils.h>
+	#include <osmocom/gprs/gprs_bssgp_bss.h>
+	#include <osmocom/gprs/protocol/gsm_08_18.h>
+	#include <osmocom/gsm/tlv.h>
 }
 
 #include <errno.h>
diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp
index 1abdcfd..eb9ef42 100644
--- a/tests/edge/EdgeTest.cpp
+++ b/tests/edge/EdgeTest.cpp
@@ -27,6 +27,8 @@
 #include "rlc.h"
 #include "llc.h"
 #include "bts.h"
+#include <gprs_rlcmac.h>
+
 extern "C" {
 #include "pcu_vty.h"
 
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index fbed45a..0a6be87 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -27,6 +27,7 @@
 #include "gprs_bssgp_pcu.h"
 #include "pcu_l1_if.h"
 #include "decoding.h"
+#include <gprs_rlcmac.h>
 
 extern "C" {
 #include "pcu_vty.h"

-- 
To view, visit https://gerrit.osmocom.org/6100
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
Gerrit-PatchSet: 4
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list