aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-09 19:13:03 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-05-09 19:14:17 +0200
commitb988f2bb36d77684baf780ece950a92b5b7e4bd6 (patch)
tree75970c959ab43fd5ac917a531c0c28ffe69084e1
parent141b64f25bf73f0759bcde63a534ac35fabed3b7 (diff)
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
-rw-r--r--examples/rs232-write.c2
-rw-r--r--examples/stream-client.c2
-rw-r--r--examples/stream-server.c2
-rw-r--r--src/datagram.c12
-rw-r--r--src/rs232.c14
-rw-r--r--src/stream.c26
6 files changed, 29 insertions, 29 deletions
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 @@ int main(void)
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 @@ int main(void)
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 @@ int main(void)
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 @@ 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 &= ~BSC_FD_WRITE;
+ conn->ofd.when &= ~OSMO_FD_WRITE;
return 0;
}
lh = conn->tx_queue.next;
@@ -115,7 +115,7 @@ static int osmo_dgram_tx_fd_cb(struct osmo_fd *ofd, unsigned int what)
{
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 @@ struct osmo_dgram_tx *osmo_dgram_tx_create(void *ctx)
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 @@ void osmo_dgram_tx_send(struct osmo_dgram_tx *conn,
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 @@ static int osmo_dgram_rx_cb(struct osmo_fd *ofd, unsigned int what)
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 @@ struct osmo_dgram_rx *osmo_dgram_rx_create(void *ctx)
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 @@ void rs232_tx_timer_cb(void *ptr)
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 @@ 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 &= ~BSC_FD_WRITE;
+ r->ofd.when &= ~OSMO_FD_WRITE;
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 &= ~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 @@ static int serial_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
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 @@ int osmo_rs232_open(struct osmo_rs232 *r)
return rc;
}
- bfd->when = BSC_FD_READ;
+ bfd->when = OSMO_FD_READ;
bfd->cb = serial_fd_cb;
bfd->data = r;
@@ -257,7 +257,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 |= 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 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
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 @@ 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 &= ~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 @@ static int osmo_stream_cli_fd_cb(struct osmo_fd *ofd, unsigned int what)
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 @@ int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect)
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 @@ int osmo_stream_cli_open(struct osmo_stream_cli *cli)
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 @@ 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 |= BSC_FD_WRITE;
+ cli->ofd.when |= OSMO_FD_WRITE;
}
/*! \brief Receive data via an Osmocom stream client
@@ -815,7 +815,7 @@ struct osmo_stream_srv_link *osmo_stream_srv_link_create(void *ctx)
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 @@ 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 &= ~BSC_FD_WRITE;
+ conn->ofd.when &= ~OSMO_FD_WRITE;
return;
}
lh = conn->tx_queue.next;
@@ -1090,9 +1090,9 @@ static int osmo_stream_srv_cb(struct osmo_fd *ofd, unsigned int what)
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 @@ osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link,
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 @@ void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg)
}
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