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

Change-Id: Ia8ffcbc61883a4e1615c101dbd3307771ae33974
Depends: libosmocore.git Change-Id Idb89ba7bc7c129a6304a76900d17f47daf54d17d
This commit is contained in:
Harald Welte 2020-10-18 23:20:17 +02:00
parent 6d0fe5b1d5
commit 637025b2f7
3 changed files with 11 additions and 11 deletions

View File

@ -95,7 +95,7 @@ static int osmo_dgram_tx_write(struct osmo_dgram_tx *conn)
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 @@ void osmo_dgram_tx_send(struct osmo_dgram_tx *conn,
struct msgb *msg)
{
msgb_enqueue(&conn->tx_queue, msg);
conn->ofd.when |= OSMO_FD_WRITE;
osmo_fd_write_enable(&conn->ofd);
}
/*

View File

@ -62,7 +62,7 @@ void rs232_tx_timer_cb(void *ptr)
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 @@ static int handle_ser_write(struct osmo_fd *bfd)
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 @@ static int handle_ser_write(struct osmo_fd *bfd)
/* 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 @@ int osmo_rs232_read(struct osmo_rs232 *r, struct msgb *msg)
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)

View File

@ -335,7 +335,7 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
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 @@ static int osmo_stream_cli_fd_cb(struct osmo_fd *ofd, unsigned int what)
/* 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 @@ static void cli_timer_cb(void *data)
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 @@ static void osmo_stream_srv_write(struct osmo_stream_srv *conn)
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 @@ void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg)
}
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