[MERGED] libosmocore[master]: sercomm: introduce osmo_ naming prefix in struct and functio...

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 17 10:46:41 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: sercomm: introduce osmo_ naming prefix in struct and function names
......................................................................


sercomm: introduce osmo_ naming prefix in struct and function names

Change-Id: If4e22f182a47b72b1fe43146716a4fbccceb62e6
---
M include/osmocom/core/sercomm.h
M src/sercomm.c
2 files changed, 28 insertions(+), 28 deletions(-)

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



diff --git a/include/osmocom/core/sercomm.h b/include/osmocom/core/sercomm.h
index b751bcd..10deb7c 100644
--- a/include/osmocom/core/sercomm.h
+++ b/include/osmocom/core/sercomm.h
@@ -21,10 +21,10 @@
 	_SC_DLCI_MAX
 };
 
-struct sercomm_inst;
-typedef void (*dlci_cb_t)(struct sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg);
+struct osmo_sercomm_inst;
+typedef void (*dlci_cb_t)(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg);
 
-struct sercomm_inst {
+struct osmo_sercomm_inst {
 	int initialized;
 	int uart_id;
 
@@ -50,35 +50,35 @@
 #ifndef HOST_BUILD
 #include <uart.h>
 /* helper functions for target */
-void sercomm_bind_uart(struct sercomm_inst *sercomm, int uart);
-int sercomm_get_uart(struct sercomm_inst *sercomm);
-void sercomm_change_speed(struct sercomm_inst *sercomm, enum uart_baudrate bdrt);
+void osmo_sercomm_bind_uart(struct osmo_sercomm_inst *sercomm, int uart);
+int osmo_sercomm_get_uart(struct osmo_sercomm_inst *sercomm);
+void osmo_sercomm_change_speed(struct osmo_sercomm_inst *sercomm, enum uart_baudrate bdrt);
 #endif
 
-void sercomm_init(struct sercomm_inst *sercomm);
-int sercomm_initialized(struct sercomm_inst *sercomm);
+void osmo_sercomm_init(struct osmo_sercomm_inst *sercomm);
+int osmo_sercomm_initialized(struct osmo_sercomm_inst *sercomm);
 
 /* User Interface: Tx */
 
 /* user interface for transmitting messages for a given DLCI */
-void sercomm_sendmsg(struct sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg);
+void osmo_sercomm_sendmsg(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg);
 /* how deep is the Tx queue for a given DLCI */
-unsigned int sercomm_tx_queue_depth(struct sercomm_inst *sercomm, uint8_t dlci);
+unsigned int osmo_sercomm_tx_queue_depth(struct osmo_sercomm_inst *sercomm, uint8_t dlci);
 
 /* User Interface: Rx */
 
 /* receiving messages for a given DLCI */
-int sercomm_register_rx_cb(struct sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb);
+int osmo_sercomm_register_rx_cb(struct osmo_sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb);
 
 /* Driver Interface */
 
 /* fetch one octet of to-be-transmitted serial data. returns 0 if no more data */
-int sercomm_drv_pull(struct sercomm_inst *sercomm, uint8_t *ch);
+int osmo_sercomm_drv_pull(struct osmo_sercomm_inst *sercomm, uint8_t *ch);
 /* the driver has received one byte, pass it into sercomm layer.
    returns 1 in case of success, 0 in case of unrecognized char */
-int sercomm_drv_rx_char(struct sercomm_inst *sercomm, uint8_t ch);
+int osmo_sercomm_drv_rx_char(struct osmo_sercomm_inst *sercomm, uint8_t ch);
 
-static inline struct msgb *sercomm_alloc_msgb(unsigned int len)
+static inline struct msgb *osmo_sercomm_alloc_msgb(unsigned int len)
 {
 	return msgb_alloc_headroom(len+4, 4, "sercomm_tx");
 }
diff --git a/src/sercomm.c b/src/sercomm.c
index 4fd979a..b0ba492 100644
--- a/src/sercomm.c
+++ b/src/sercomm.c
@@ -69,18 +69,18 @@
 
 
 #ifndef HOST_BUILD
-void sercomm_bind_uart(struct sercomm_inst *sercomm, int uart)
+void osmo_sercomm_bind_uart(struct osmo_sercomm_inst *sercomm, int uart)
 {
 	sercomm->uart_id = uart;
 }
 
-int sercomm_get_uart(struct sercomm_inst *sercomm)
+int osmo_sercomm_get_uart(struct osmo_sercomm_inst *sercomm)
 {
 	return sercomm->uart_id;
 }
 #endif
 
-void sercomm_init(struct sercomm_inst *sercomm)
+void osmo_sercomm_init(struct osmo_sercomm_inst *sercomm)
 {
 	unsigned int i;
 	for (i = 0; i < ARRAY_SIZE(sercomm->tx.dlci_queues); i++)
@@ -90,16 +90,16 @@
 	sercomm->initialized = 1;
 
 	/* set up the echo dlci */
-	sercomm_register_rx_cb(sercomm, SC_DLCI_ECHO, &sercomm_sendmsg);
+	osmo_sercomm_register_rx_cb(sercomm, SC_DLCI_ECHO, &osmo_sercomm_sendmsg);
 }
 
-int sercomm_initialized(struct sercomm_inst *sercomm)
+int osmo_sercomm_initialized(struct osmo_sercomm_inst *sercomm)
 {
 	return sercomm->initialized;
 }
 
 /* user interface for transmitting messages for a given DLCI */
-void sercomm_sendmsg(struct sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
+void osmo_sercomm_sendmsg(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
 {
 	unsigned long flags;
 	uint8_t *hdr;
@@ -122,7 +122,7 @@
 }
 
 /* how deep is the Tx queue for a given DLCI */
-unsigned int sercomm_tx_queue_depth(struct sercomm_inst *sercomm, uint8_t dlci)
+unsigned int osmo_sercomm_tx_queue_depth(struct osmo_sercomm_inst *sercomm, uint8_t dlci)
 {
 	struct llist_head *le;
 	unsigned int num = 0;
@@ -137,7 +137,7 @@
 #ifndef HOST_BUILD
 /* wait until everything has been transmitted, then grab the lock and
  * change the baud rate as requested */
-void sercomm_change_speed(struct sercomm_inst *sercomm, enum uart_baudrate bdrt)
+void osmo_sercomm_change_speed(struct osmo_sercomm_inst *sercomm, enum uart_baudrate bdrt)
 {
 	unsigned int i, count;
 	unsigned long flags;
@@ -168,7 +168,7 @@
 #endif
 
 /* fetch one octet of to-be-transmitted serial data */
-int sercomm_drv_pull(struct sercomm_inst *sercomm, uint8_t *ch)
+int osmo_sercomm_drv_pull(struct osmo_sercomm_inst *sercomm, uint8_t *ch)
 {
 	unsigned long flags;
 
@@ -230,7 +230,7 @@
 }
 
 /* register a handler for a given DLCI */
-int sercomm_register_rx_cb(struct sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb)
+int osmo_sercomm_register_rx_cb(struct osmo_sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb)
 {
 	if (dlci >= ARRAY_SIZE(sercomm->rx.dlci_handler))
 		return -EINVAL;
@@ -243,7 +243,7 @@
 }
 
 /* dispatch an incoming message once it is completely received */
-static void dispatch_rx_msg(struct sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
+static void dispatch_rx_msg(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
 {
 	if (dlci >= ARRAY_SIZE(sercomm->rx.dlci_handler) ||
 	    !sercomm->rx.dlci_handler[dlci]) {
@@ -254,7 +254,7 @@
 }
 
 /* the driver has received one byte, pass it into sercomm layer */
-int sercomm_drv_rx_char(struct sercomm_inst *sercomm, uint8_t ch)
+int osmo_sercomm_drv_rx_char(struct osmo_sercomm_inst *sercomm, uint8_t ch)
 {
 	uint8_t *ptr;
 
@@ -262,12 +262,12 @@
 	 * which means that any data structures we use need to be for
 	 * our exclusive access */
 	if (!sercomm->rx.msg)
-		sercomm->rx.msg = sercomm_alloc_msgb(SERCOMM_RX_MSG_SIZE);
+		sercomm->rx.msg = osmo_sercomm_alloc_msgb(SERCOMM_RX_MSG_SIZE);
 
 	if (msgb_tailroom(sercomm->rx.msg) == 0) {
 		//cons_puts("sercomm_drv_rx_char() overflow!\n");
 		msgb_free(sercomm->rx.msg);
-		sercomm->rx.msg = sercomm_alloc_msgb(SERCOMM_RX_MSG_SIZE);
+		sercomm->rx.msg = osmo_sercomm_alloc_msgb(SERCOMM_RX_MSG_SIZE);
 		sercomm->rx.state = RX_ST_WAIT_START;
 		return 0;
 	}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If4e22f182a47b72b1fe43146716a4fbccceb62e6
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list