Change in libosmo-netif[master]: migrate to osmo_fd_{read, write}_{enable, disable}()

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

laforge gerrit-no-reply at lists.osmocom.org
Wed Oct 21 12:04:20 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/20821 )


Change subject: migrate to osmo_fd_{read,write}_{enable,disable}()
......................................................................

migrate to osmo_fd_{read,write}_{enable,disable}()

Change-Id: Ia8ffcbc61883a4e1615c101dbd3307771ae33974
Depends: libosmocore.git Change-Id Idb89ba7bc7c129a6304a76900d17f47daf54d17d
---
M src/datagram.c
M src/rs232.c
M src/stream.c
3 files changed, 11 insertions(+), 11 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/21/20821/1

diff --git a/src/datagram.c b/src/datagram.c
index 8b68244..afae3e7 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 &= ~OSMO_FD_WRITE;
+		osmo_fd_write_disable(&conn->ofd);
 		return 0;
 	}
 	lh = conn->tx_queue.next;
@@ -236,7 +236,7 @@
 				 struct msgb *msg)
 {
 	msgb_enqueue(&conn->tx_queue, msg);
-	conn->ofd.when |= OSMO_FD_WRITE;
+	osmo_fd_write_enable(&conn->ofd);
 }
 
 /*
diff --git a/src/rs232.c b/src/rs232.c
index 865ec97..b20c111 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 |= OSMO_FD_WRITE;
+	osmo_fd_write_enable(&r->ofd);
 }
 
 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 &= ~OSMO_FD_WRITE;
+		osmo_fd_write_disable(&r->ofd);
 		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 &= ~OSMO_FD_WRITE;
+		osmo_fd_write_disable(&r->ofd);
 		osmo_timer_schedule(&r->tx_timer, 0, r->cfg.delay_us);
 	}
 	return 0;
@@ -255,7 +255,7 @@
 void osmo_rs232_write(struct osmo_rs232 *r, struct msgb *msg)
 {
 	msgb_enqueue(&r->tx_queue, msg);
-	r->ofd.when |= OSMO_FD_WRITE;
+	osmo_fd_write_enable(&r->ofd);
 }
 
 void osmo_rs232_close(struct osmo_rs232 *r)
diff --git a/src/stream.c b/src/stream.c
index 3376126..e4fb668 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -335,7 +335,7 @@
 	int ret;
 
 	if (llist_empty(&cli->tx_queue)) {
-		cli->ofd.when &= ~OSMO_FD_WRITE;
+		osmo_fd_write_disable(&cli->ofd);
 		return 0;
 	}
 	lh = cli->tx_queue.next;
@@ -391,7 +391,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 &= ~OSMO_FD_WRITE;
+			osmo_fd_write_disable(&cli->ofd);
 
 		LOGSCLI(cli, LOGL_DEBUG, "connection done.\n");
 		cli->state = STREAM_CLI_STATE_CONNECTED;
@@ -787,7 +787,7 @@
 void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg)
 {
 	msgb_enqueue(&cli->tx_queue, msg);
-	cli->ofd.when |= OSMO_FD_WRITE;
+	osmo_fd_write_enable(&cli->ofd);
 }
 
 /*! \brief Receive data via an Osmocom stream client
@@ -1137,7 +1137,7 @@
 	LOGP(DLINP, LOGL_DEBUG, "sending data\n");
 
 	if (llist_empty(&conn->tx_queue)) {
-		conn->ofd.when &= ~OSMO_FD_WRITE;
+		osmo_fd_write_disable(&conn->ofd);
 		return;
 	}
 	lh = conn->tx_queue.next;
@@ -1287,7 +1287,7 @@
 	}
 
 	msgb_enqueue(&conn->tx_queue, msg);
-	conn->ofd.when |= OSMO_FD_WRITE;
+	osmo_fd_write_enable(&conn->ofd);
 }
 
 /*! \brief Receive data via Osmocom stream server

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

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ia8ffcbc61883a4e1615c101dbd3307771ae33974
Gerrit-Change-Number: 20821
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201021/6a4a1203/attachment.htm>


More information about the gerrit-log mailing list