Change in libosmo-netif[master]: Use OSMO_FD_* instead of deprecated BSC_FD_*

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

pespin gerrit-no-reply at lists.osmocom.org
Sun May 10 14:55:58 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/18164 )

Change subject: Use OSMO_FD_* instead of deprecated BSC_FD_*
......................................................................

Use OSMO_FD_* instead of deprecated BSC_FD_*

New define is available since libosmocore 1.1.0, and we already require
1.3.0, so no need to update dependenices.
Let's change it to avoid people re-using old BSC_FD_* symbols when
copy-pasting somewhere else.

Change-Id: I269690c1c9e4d19b5b69eef206b95e71f7931188
---
M examples/rs232-write.c
M examples/stream-client.c
M examples/stream-server.c
M src/datagram.c
M src/rs232.c
M src/stream.c
6 files changed, 29 insertions(+), 29 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/examples/rs232-write.c b/examples/rs232-write.c
index dfe1bd5..508c64a 100644
--- a/examples/rs232-write.c
+++ b/examples/rs232-write.c
@@ -377,7 +377,7 @@
                 exit(EXIT_FAILURE);
         }
         kbd_ofd->fd = STDIN_FILENO;
-        kbd_ofd->when = BSC_FD_READ;
+        kbd_ofd->when = OSMO_FD_READ;
         kbd_ofd->data = NULL;
         kbd_ofd->cb = kbd_cb;
         rc = osmo_fd_register(kbd_ofd);
diff --git a/examples/stream-client.c b/examples/stream-client.c
index f590f25..fd1a517 100644
--- a/examples/stream-client.c
+++ b/examples/stream-client.c
@@ -142,7 +142,7 @@
 		exit(EXIT_FAILURE);
 	}
 	kbd_ofd->fd = STDIN_FILENO;
-	kbd_ofd->when = BSC_FD_READ;
+	kbd_ofd->when = OSMO_FD_READ;
 	kbd_ofd->data = conn;
 	kbd_ofd->cb = kbd_cb;
 	rc = osmo_fd_register(kbd_ofd);
diff --git a/examples/stream-server.c b/examples/stream-server.c
index f3ee315..4946e13 100644
--- a/examples/stream-server.c
+++ b/examples/stream-server.c
@@ -166,7 +166,7 @@
 		exit(EXIT_FAILURE);
 	}
 	kbd_ofd->fd = STDIN_FILENO;
-	kbd_ofd->when = BSC_FD_READ;
+	kbd_ofd->when = OSMO_FD_READ;
 	kbd_ofd->data = srv;
 	kbd_ofd->cb = kbd_cb;
 	osmo_fd_register(kbd_ofd);
diff --git a/src/datagram.c b/src/datagram.c
index 634e702..d2233d5 100644
--- a/src/datagram.c
+++ b/src/datagram.c
@@ -95,7 +95,7 @@
 	LOGP(DLINP, LOGL_DEBUG, "sending data\n");
 
 	if (llist_empty(&conn->tx_queue)) {
-		conn->ofd.when &= ~BSC_FD_WRITE;
+		conn->ofd.when &= ~OSMO_FD_WRITE;
 		return 0;
 	}
 	lh = conn->tx_queue.next;
@@ -115,7 +115,7 @@
 {
 	struct osmo_dgram_tx *conn = ofd->data;
 
-	if (what & BSC_FD_WRITE) {
+	if (what & OSMO_FD_WRITE) {
 		LOGP(DLINP, LOGL_DEBUG, "write\n");
 		osmo_dgram_tx_write(conn);
 	}
@@ -136,7 +136,7 @@
 		return NULL;
 
 	conn->ofd.fd = -1;
-	conn->ofd.when |= BSC_FD_READ;
+	conn->ofd.when |= OSMO_FD_READ;
 	conn->ofd.priv_nr = 0;	/* XXX */
 	conn->ofd.cb = osmo_dgram_tx_fd_cb;
 	conn->ofd.data = conn;
@@ -240,7 +240,7 @@
 				 struct msgb *msg)
 {
 	msgb_enqueue(&conn->tx_queue, msg);
-	conn->ofd.when |= BSC_FD_WRITE;
+	conn->ofd.when |= OSMO_FD_WRITE;
 }
 
 /*
@@ -290,7 +290,7 @@
 	struct osmo_dgram_rx *conn = ofd->data;
 
 	LOGP(DLINP, LOGL_DEBUG, "read\n");
-	if (what & BSC_FD_READ)
+	if (what & OSMO_FD_READ)
 		osmo_dgram_rx_read(conn);
 
 	return 0;
@@ -310,7 +310,7 @@
 		return NULL;
 
 	conn->ofd.fd = -1;
-	conn->ofd.when |= BSC_FD_READ;
+	conn->ofd.when |= OSMO_FD_READ;
 	conn->ofd.cb = osmo_dgram_rx_cb;
 	conn->ofd.data = conn;
 
diff --git a/src/rs232.c b/src/rs232.c
index 28f1ba0..4ebc7b9 100644
--- a/src/rs232.c
+++ b/src/rs232.c
@@ -62,7 +62,7 @@
 	struct osmo_rs232 *r = ptr;
 
 	/* we're again ready to transmit. */
-	r->ofd.when |= BSC_FD_WRITE;
+	r->ofd.when |= OSMO_FD_WRITE;
 }
 
 static int handle_ser_write(struct osmo_fd *bfd)
@@ -75,7 +75,7 @@
         LOGP(DLINP, LOGL_DEBUG, "writing data to rs232\n");
 
         if (llist_empty(&r->tx_queue)) {
-                r->ofd.when &= ~BSC_FD_WRITE;
+                r->ofd.when &= ~OSMO_FD_WRITE;
                 return 0;
         }
         lh = r->tx_queue.next;
@@ -92,7 +92,7 @@
 
 	/* We've got more data to write, but we have to wait to make it. */
 	if (!llist_empty(&r->tx_queue) && r->cfg.delay_us) {
-		r->ofd.when &= ~BSC_FD_WRITE;
+		r->ofd.when &= ~OSMO_FD_WRITE;
 		osmo_timer_schedule(&r->tx_timer, 0, r->cfg.delay_us);
 	}
 	return 0;
@@ -114,13 +114,13 @@
 {
 	int rc = 0;
 
-	if (what & BSC_FD_READ)
+	if (what & OSMO_FD_READ)
 		rc = handle_ser_read(bfd);
 
 	if (rc < 0)
 		return rc;
 
-	if (what & BSC_FD_WRITE)
+	if (what & OSMO_FD_WRITE)
 		rc = handle_ser_write(bfd);
 
 	return rc;
@@ -223,7 +223,7 @@
 		return rc;
 	}
 
-	bfd->when = BSC_FD_READ;
+	bfd->when = OSMO_FD_READ;
 	bfd->cb = serial_fd_cb;
 	bfd->data = r;
 
@@ -257,7 +257,7 @@
 void osmo_rs232_write(struct osmo_rs232 *r, struct msgb *msg)
 {
         msgb_enqueue(&r->tx_queue, msg);
-        r->ofd.when |= BSC_FD_WRITE;
+        r->ofd.when |= OSMO_FD_WRITE;
 }
 
 void osmo_rs232_close(struct osmo_rs232 *r)
diff --git a/src/stream.c b/src/stream.c
index 5887bf9..6e4c461 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -258,7 +258,7 @@
 	int ret;
 
 	if (llist_empty(&cli->tx_queue)) {
-		cli->ofd.when &= ~BSC_FD_WRITE;
+		cli->ofd.when &= ~OSMO_FD_WRITE;
 		return 0;
 	}
 	lh = cli->tx_queue.next;
@@ -314,7 +314,7 @@
 		/* If messages got enqueued while 'connecting', keep WRITE flag
 		   up to dispatch them upon next main loop step */
 		if (llist_empty(&cli->tx_queue))
-			cli->ofd.when &= ~BSC_FD_WRITE;
+			cli->ofd.when &= ~OSMO_FD_WRITE;
 
 		LOGSCLI(cli, LOGL_DEBUG, "connection done.\n");
 		cli->state = STREAM_CLI_STATE_CONNECTED;
@@ -332,11 +332,11 @@
 			cli->connect_cb(cli);
 		break;
 	case STREAM_CLI_STATE_CONNECTED:
-		if (what & BSC_FD_READ) {
+		if (what & OSMO_FD_READ) {
 			LOGSCLI(cli, LOGL_DEBUG, "connected read\n");
 			osmo_stream_cli_read(cli);
 		}
-		if (what & BSC_FD_WRITE) {
+		if (what & OSMO_FD_WRITE) {
 			LOGSCLI(cli, LOGL_DEBUG, "connected write\n");
 			osmo_stream_cli_write(cli);
 		}
@@ -601,7 +601,7 @@
 		return ret;
 	}
 	cli->ofd.fd = ret;
-	cli->ofd.when = BSC_FD_READ | BSC_FD_WRITE;
+	cli->ofd.when = OSMO_FD_READ | OSMO_FD_WRITE;
 
 	if (cli->flags & OSMO_STREAM_CLI_F_NODELAY) {
 		ret = setsockopt_nodelay(cli->ofd.fd, cli->proto, 1);
@@ -673,7 +673,7 @@
 		return ret;
 	}
 	cli->ofd.fd = ret;
-	cli->ofd.when = BSC_FD_READ | BSC_FD_WRITE;
+	cli->ofd.when = OSMO_FD_READ | OSMO_FD_WRITE;
 
 	if (cli->flags & OSMO_STREAM_CLI_F_NODELAY) {
 		ret = setsockopt_nodelay(cli->ofd.fd, cli->proto, 1);
@@ -708,7 +708,7 @@
 void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg)
 {
 	msgb_enqueue(&cli->tx_queue, msg);
-	cli->ofd.when |= BSC_FD_WRITE;
+	cli->ofd.when |= OSMO_FD_WRITE;
 }
 
 /*! \brief Receive data via an Osmocom stream client
@@ -815,7 +815,7 @@
 
 	link->proto = IPPROTO_TCP;
 	link->ofd.fd = -1;
-	link->ofd.when |= BSC_FD_READ | BSC_FD_WRITE;
+	link->ofd.when |= OSMO_FD_READ | OSMO_FD_WRITE;
 	link->ofd.cb = osmo_stream_srv_fd_cb;
 	link->ofd.data = link;
 
@@ -1053,7 +1053,7 @@
 	LOGP(DLINP, LOGL_DEBUG, "sending data\n");
 
 	if (llist_empty(&conn->tx_queue)) {
-		conn->ofd.when &= ~BSC_FD_WRITE;
+		conn->ofd.when &= ~OSMO_FD_WRITE;
 		return;
 	}
 	lh = conn->tx_queue.next;
@@ -1090,9 +1090,9 @@
 	int rc = 0;
 
 	LOGP(DLINP, LOGL_DEBUG, "connected read/write\n");
-	if (what & BSC_FD_READ)
+	if (what & OSMO_FD_READ)
 		rc = osmo_stream_srv_read(conn);
-	if (rc != -EBADF && (what & BSC_FD_WRITE))
+	if (rc != -EBADF && (what & OSMO_FD_WRITE))
 		osmo_stream_srv_write(conn);
 
 	return rc;
@@ -1120,7 +1120,7 @@
 	conn->ofd.fd = fd;
 	conn->ofd.data = conn;
 	conn->ofd.cb = osmo_stream_srv_cb;
-	conn->ofd.when = BSC_FD_READ;
+	conn->ofd.when = OSMO_FD_READ;
 	conn->cb = cb;
 	conn->closed_cb = closed_cb;
 	conn->data = data;
@@ -1206,7 +1206,7 @@
 	}
 
 	msgb_enqueue(&conn->tx_queue, msg);
-	conn->ofd.when |= BSC_FD_WRITE;
+	conn->ofd.when |= OSMO_FD_WRITE;
 }
 
 /*! \brief Receive data via Osmocom stream server

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/18164
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I269690c1c9e4d19b5b69eef206b95e71f7931188
Gerrit-Change-Number: 18164
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200510/6fca65cf/attachment.htm>


More information about the gerrit-log mailing list