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

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Feb 19 08:43:53 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Update header includes
......................................................................


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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/bts.cpp b/src/bts.cpp
index cbd3a1c..b0d92f0 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 25f8ccd..9b38ba9 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 c45aa39..aa10e45 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 9e4000a..b9664b0 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 0a9803b..805336a 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 41165f3..e80b0f5 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>
 }
 
 static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf)
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 2ed63f9..239b8fd 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 dc4fa6a..c92bfdf 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 46d4d12..a4d3499 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 d4702f2..fb9158f 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: merged
Gerrit-Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
Gerrit-PatchSet: 5
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>


More information about the gerrit-log mailing list