arehbein has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/34720?usp=email )

Change subject: gsmtap: Hide implementation of gsmtap_inst
......................................................................

gsmtap: Hide implementation of gsmtap_inst

 - Use forward decl. of struct gsmtap_inst in header
 - Remove 'static inline' attributes from gsmtap_inst_fd() declaration,
   move function definition to gsmtap_util.c and mark it as deprecated
 - Add gsmtap_inst_fd2() as replacement for gsmtap_inst_fd()

Related: OS#6213
Change-Id: Ibe1a51205a6df764571b6d074e365825555609a5
---
M TODO-RELEASE
M include/osmocom/core/gsmtap_util.h
M src/core/gsmtap_util.c
M src/core/libosmocore.map
4 files changed, 48 insertions(+), 15 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  arehbein: Looks good to me, approved
  pespin: Looks good to me, approved




diff --git a/TODO-RELEASE b/TODO-RELEASE
index 2f9903d..b67161d 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,4 +7,5 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library       what                    description / commit summary line
-core      ADD       osmo_sock_multiaddr_{add,del}_local_addr()
\ No newline at end of file
+core      ADD       osmo_sock_multiaddr_{add,del}_local_addr()
+core      ADD       gsmtap_inst_fd2() core, DEPRECATE gsmtap_inst_fd()
diff --git a/include/osmocom/core/gsmtap_util.h 
b/include/osmocom/core/gsmtap_util.h
index 9137c1d..d24ee95 100644
--- a/include/osmocom/core/gsmtap_util.h
+++ b/include/osmocom/core/gsmtap_util.h
@@ -24,19 +24,12 @@
                            int8_t snr, const uint8_t *data, unsigned int len);

 /*! one gsmtap instance */
-struct gsmtap_inst {
-       int ofd_wq_mode;        /*!< wait queue mode? */
-       struct osmo_wqueue wq;  /*!< the wait queue */
-       struct osmo_fd sink_ofd;/*!< file descriptor */
-};
+struct gsmtap_inst;

-/*! obtain the file descriptor associated with a gsmtap instance
- *  \param[in] gti GSMTAP instance
- *  \returns file descriptor of GSMTAP instance */
-static inline int gsmtap_inst_fd(struct gsmtap_inst *gti)
-{
-       return gti->wq.bfd.fd;
-}
+int gsmtap_inst_fd(struct gsmtap_inst *gti)
+       OSMO_DEPRECATED("Use gsmtap_inst_fd2() instead");
+
+int gsmtap_inst_fd2(const struct gsmtap_inst *gti);

 int gsmtap_source_init_fd(const char *host, uint16_t port);
 int gsmtap_source_init_fd2(const char *local_host, uint16_t local_port, const 
char *rem_host, uint16_t rem_port);
diff --git a/src/core/gsmtap_util.c b/src/core/gsmtap_util.c
index 20c0ce1..dcbd304 100644
--- a/src/core/gsmtap_util.c
+++ b/src/core/gsmtap_util.c
@@ -46,6 +46,28 @@
  *
  * \file gsmtap_util.c */

+/*! one gsmtap instance */
+struct gsmtap_inst {
+       int ofd_wq_mode;        /*!< wait queue mode? This field member may not 
be changed or moved (backwards compatibility) */
+       struct osmo_wqueue wq;  /*!< the wait queue. This field member may not 
be changed or moved (backwards compatibility) */
+       struct osmo_fd sink_ofd; /*!< file descriptor */
+};
+
+/*! Deprecated, use gsmtap_inst_fd2() instead
+ *  \param[in] gti GSMTAP instance
+ *  \returns file descriptor of GSMTAP instance */
+int gsmtap_inst_fd(struct gsmtap_inst *gti)
+{
+       return gsmtap_inst_fd2(gti);
+}
+
+/*! obtain the file descriptor associated with a gsmtap instance
+ *  \param[in] gti GSMTAP instance
+ *  \returns file descriptor of GSMTAP instance */
+int gsmtap_inst_fd2(const struct gsmtap_inst *gti)
+{
+       return gti->wq.bfd.fd;
+}

 /*! convert RSL channel number to GSMTAP channel type
  *  \param[in] rsl_chantype RSL channel type
@@ -330,7 +352,7 @@
                /* try immediate send and return error if any */
                int rc;

-               rc = write(gsmtap_inst_fd(gti), msg->data, msg->len);
+               rc = write(gsmtap_inst_fd2(gti), msg->data, msg->len);
                if (rc < 0) {
                        return rc;
                } else if (rc >= msg->len) {
@@ -447,7 +469,7 @@
 {
        int fd, rc;

-       fd = gsmtap_source_add_sink_fd(gsmtap_inst_fd(gti));
+       fd = gsmtap_source_add_sink_fd(gsmtap_inst_fd2(gti));
        if (fd < 0)
                return fd;

diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map
index 6c02cd3..e5f8bd8 100644
--- a/src/core/libosmocore.map
+++ b/src/core/libosmocore.map
@@ -39,6 +39,8 @@
 get_value_string;
 get_value_string_or_null;
 gsmtap_gsm_channel_names;
+gsmtap_inst_fd;
+gsmtap_inst_fd2;
 gsmtap_makemsg;
 gsmtap_makemsg_ex;
 gsmtap_send;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibe1a51205a6df764571b6d074e365825555609a5
Gerrit-Change-Number: 34720
Gerrit-PatchSet: 5
Gerrit-Owner: arehbein <arehb...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehb...@sysmocom.de>
Gerrit-Reviewer: daniel <dwillm...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to