fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/43827?usp=email )


Change subject: trxcon/trx_if: make struct trx_instance opaque
......................................................................

trxcon/trx_if: make struct trx_instance opaque

Nothing outside trx_if.c ever dereferences struct trx_instance's
fields, or uses struct trx_ctrl_msg / TRXC_BUF_SIZE / TRXD_BUF_SIZE
at all.  Move them all there and leave a forward declaration of
struct trx_instance in the header.

Change-Id: Idb6ca85dda0ffdc7f3e4cc0f368d74e9c9cab8ed
---
M src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
M src/host/trxcon/src/trx_if.c
2 files changed, 32 insertions(+), 31 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/27/43827/1

diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h 
b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
index 907eb79..c8b3b40 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
@@ -1,40 +1,10 @@
 #pragma once

-#include <osmocom/core/linuxlist.h>
-#include <osmocom/core/select.h>
-#include <osmocom/core/timer.h>
 #include <osmocom/core/fsm.h>

 #include <osmocom/bb/trxcon/phyif.h>

-#define TRXC_BUF_SIZE  1024
-#define TRXD_BUF_SIZE  512
-
-struct trx_instance {
-       struct osmo_fd trx_ofd_ctrl;
-       struct osmo_fd trx_ofd_data;
-
-       struct osmo_timer_list trx_ctrl_timer;
-       struct llist_head trx_ctrl_list;
-       struct osmo_fsm_inst *fi;
-       uint32_t fn_advance;
-
-       /* Rx/Tx frequencies (in kHz) tuned via RXTUNE/TXTUNE */
-       uint32_t rx_freq_khz;
-       uint32_t tx_freq_khz;
-       bool hopping;
-
-       /* Some private data */
-       void *priv;
-};
-
-struct trx_ctrl_msg {
-       struct llist_head list;
-       char cmd[TRXC_BUF_SIZE];
-       int retry_cnt;
-       int critical;
-       int cmd_len;
-};
+struct trx_instance;

 struct trx_if_params {
        const char *local_host;
diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c
index 17e3d62..ec6f3ab 100644
--- a/src/host/trxcon/src/trx_if.c
+++ b/src/host/trxcon/src/trx_if.c
@@ -25,12 +25,14 @@
 #include <stdio.h>
 #include <errno.h>
 #include <stdint.h>
+#include <stdbool.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>

 #include <netinet/in.h>

+#include <osmocom/core/linuxlist.h>
 #include <osmocom/core/logging.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/socket.h>
@@ -46,6 +48,9 @@

 #define TRXDv0_HDR_LEN         8

+#define TRXC_BUF_SIZE          1024
+#define TRXD_BUF_SIZE          512
+
 #define S(x)   (1 << (x))

 enum trx_fsm_states {
@@ -53,6 +58,32 @@
        TRX_ST_POWERON,      /* transceiver powered on */
 };

+struct trx_instance {
+       struct osmo_fd trx_ofd_ctrl;
+       struct osmo_fd trx_ofd_data;
+
+       struct osmo_timer_list trx_ctrl_timer;
+       struct llist_head trx_ctrl_list;
+       struct osmo_fsm_inst *fi;
+       uint32_t fn_advance;
+
+       /* Rx/Tx frequencies (in kHz) tuned via RXTUNE/TXTUNE */
+       uint32_t rx_freq_khz;
+       uint32_t tx_freq_khz;
+       bool hopping;
+
+       /* Some private data */
+       void *priv;
+};
+
+struct trx_ctrl_msg {
+       struct llist_head list;
+       char cmd[TRXC_BUF_SIZE];
+       int retry_cnt;
+       int critical;
+       int cmd_len;
+};
+
 static struct osmo_fsm trx_fsm;

 static int trx_udp_open(void *priv, struct osmo_fd *ofd, const char 
*host_local,

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/43827?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Idb6ca85dda0ffdc7f3e4cc0f368d74e9c9cab8ed
Gerrit-Change-Number: 43827
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>

Reply via email to