From de3959e62cb907abaa26aab21c7b884551134bd9 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 18 Oct 2020 22:28:50 +0200 Subject: Use OSMO_FD_* instead of deprecated BSC_FD_* Change-Id: Ib676eda521f0e89a1f4d8f9eac810598a3c813b9 --- src/input/dahdi.c | 34 +++++++++++++++++----------------- src/input/e1d.c | 22 +++++++++++----------- src/input/ipa.c | 28 ++++++++++++++-------------- src/input/ipaccess.c | 14 +++++++------- src/input/misdn.c | 18 +++++++++--------- src/input/rs232.c | 10 +++++----- src/input/unixsocket.c | 10 +++++----- src/trau/osmo_ortp.c | 8 ++++---- tests/e1inp_ipa_bts_test.c | 2 +- 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/input/dahdi.c b/src/input/dahdi.c index bf6da3e..55abc7c 100644 --- a/src/input/dahdi.c +++ b/src/input/dahdi.c @@ -204,7 +204,7 @@ static int ts_want_write(struct e1inp_ts *e1i_ts) return 0; } - e1i_ts->driver.dahdi.fd.when |= BSC_FD_WRITE; + e1i_ts->driver.dahdi.fd.when |= OSMO_FD_WRITE; return 0; } @@ -250,7 +250,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) struct e1inp_sign_link *sign_link; struct msgb *msg; - bfd->when &= ~BSC_FD_WRITE; + bfd->when &= ~OSMO_FD_WRITE; /* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, &sign_link); @@ -472,38 +472,38 @@ static int dahdi_fd_cb(struct osmo_fd *bfd, unsigned int what) switch (e1i_ts->type) { case E1INP_TS_TYPE_SIGN: - if (what & BSC_FD_EXCEPT) + if (what & OSMO_FD_EXCEPT) handle_dahdi_exception(e1i_ts); - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_ts1_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) rc = handle_ts1_write(bfd); break; case E1INP_TS_TYPE_HDLC: - if (what & BSC_FD_EXCEPT) + if (what & OSMO_FD_EXCEPT) handle_dahdi_exception(e1i_ts); - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_hdlc_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) handle_hdlc_write(bfd); break; case E1INP_TS_TYPE_TRAU: - if (what & BSC_FD_EXCEPT) + if (what & OSMO_FD_EXCEPT) handle_dahdi_exception(e1i_ts); - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_tsX_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) rc = handle_tsX_write(bfd); /* We never include the DAHDI B-Channel FD into the * writeset, since it doesn't support poll() based * write flow control */ break; case E1INP_TS_TYPE_RAW: - if (what & BSC_FD_EXCEPT) + if (what & OSMO_FD_EXCEPT) handle_dahdi_exception(e1i_ts); - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_ts_raw_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) rc = handle_ts_raw_write(bfd); /* We never include the DAHDI B-Channel FD into the * writeset, since it doesn't support poll() based @@ -665,7 +665,7 @@ static int dahdi_e1_setup(struct e1inp_line *line) bfd->fd = dahdi_open_slot(dev_nr); if (bfd->fd < 0) return -EIO; - bfd->when = BSC_FD_READ | BSC_FD_EXCEPT; + bfd->when = OSMO_FD_READ | OSMO_FD_EXCEPT; ret = dahdi_set_bufinfo(bfd->fd, 1); if (ret < 0) return ret; @@ -683,7 +683,7 @@ static int dahdi_e1_setup(struct e1inp_line *line) bfd->fd = dahdi_open_slot(dev_nr); if (bfd->fd < 0) return -EIO; - bfd->when = BSC_FD_READ | BSC_FD_EXCEPT; + bfd->when = OSMO_FD_READ | OSMO_FD_EXCEPT; ret = dahdi_set_bufinfo(bfd->fd, 1); if (ret < 0) return ret; @@ -705,7 +705,7 @@ static int dahdi_e1_setup(struct e1inp_line *line) /* We never include the DAHDI B-Channel FD into the * writeset, since it doesn't support poll() based * write flow control */ - bfd->when = BSC_FD_READ | BSC_FD_EXCEPT;// | BSC_FD_WRITE; + bfd->when = OSMO_FD_READ | OSMO_FD_EXCEPT;// | OSMO_FD_WRITE; break; } diff --git a/src/input/e1d.c b/src/input/e1d.c index beef93e..6323f90 100644 --- a/src/input/e1d.c +++ b/src/input/e1d.c @@ -100,7 +100,7 @@ handle_ts_sign_write(struct osmo_fd *bfd) struct e1inp_sign_link *sign_link; struct msgb *msg; - bfd->when &= ~BSC_FD_WRITE; + bfd->when &= ~OSMO_FD_WRITE; /* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, &sign_link); @@ -280,21 +280,21 @@ e1d_fd_cb(struct osmo_fd *bfd, unsigned int what) switch (e1i_ts->type) { case E1INP_TS_TYPE_SIGN: - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) ret = handle_ts_sign_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) ret = handle_ts_sign_write(bfd); break; case E1INP_TS_TYPE_TRAU: - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) ret = handle_ts_trau_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) ret = handle_ts_trau_write(bfd); break; case E1INP_TS_TYPE_RAW: - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) ret = handle_ts_raw_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) ret = handle_ts_raw_write(bfd); break; default: @@ -315,7 +315,7 @@ e1d_want_write(struct e1inp_ts *e1i_ts) return 0; } - e1i_ts->driver.e1d.fd.when |= BSC_FD_WRITE; + e1i_ts->driver.e1d.fd.when |= OSMO_FD_WRITE; return 0; } @@ -400,7 +400,7 @@ e1d_line_update(struct e1inp_line *line) talloc_free(ts_info); return -EIO; } - bfd->when = BSC_FD_READ; + bfd->when = OSMO_FD_READ; if (!e1i_ts->lapd) { char name[32]; @@ -430,7 +430,7 @@ e1d_line_update(struct e1inp_line *line) talloc_free(ts_info); return -EIO; } - bfd->when = BSC_FD_READ; + bfd->when = OSMO_FD_READ; break; case E1INP_TS_TYPE_TRAU: case E1INP_TS_TYPE_RAW: @@ -453,7 +453,7 @@ e1d_line_update(struct e1inp_line *line) talloc_free(ts_info); return -EIO; } - bfd->when = BSC_FD_READ; + bfd->when = OSMO_FD_READ; break; }; diff --git a/src/input/ipa.c b/src/input/ipa.c index 0f67dca..c3e4ad3 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -89,7 +89,7 @@ static int ipa_client_write_default_cb(struct ipa_client_conn *link) LOGIPA(link, LOGL_DEBUG, "sending data\n"); if (llist_empty(&link->tx_queue)) { - ofd->when &= ~BSC_FD_WRITE; + ofd->when &= ~OSMO_FD_WRITE; return 0; } lh = link->tx_queue.next; @@ -124,18 +124,18 @@ static int ipa_client_fd_cb(struct osmo_fd *ofd, unsigned int what) link->updown_cb(link, 0); return 0; } - ofd->when &= ~BSC_FD_WRITE; + ofd->when &= ~OSMO_FD_WRITE; LOGIPA(link, LOGL_NOTICE, "connection done\n"); link->state = IPA_CLIENT_LINK_STATE_CONNECTED; if (link->updown_cb) link->updown_cb(link, 1); break; case IPA_CLIENT_LINK_STATE_CONNECTED: - if (what & BSC_FD_READ) { + if (what & OSMO_FD_READ) { LOGIPA(link, LOGL_DEBUG, "connected read\n"); ret = ipa_client_read(link); } - if (ret != -EBADF && (what & BSC_FD_WRITE)) { + if (ret != -EBADF && (what & OSMO_FD_WRITE)) { LOGIPA(link, LOGL_DEBUG, "connected write\n"); ipa_client_write(link); } @@ -189,7 +189,7 @@ ipa_client_conn_create2(void *ctx, struct e1inp_ts *ts, } } - ipa_link->ofd->when |= BSC_FD_READ | BSC_FD_WRITE; + ipa_link->ofd->when |= OSMO_FD_READ | OSMO_FD_WRITE; ipa_link->ofd->priv_nr = priv_nr; ipa_link->ofd->cb = ipa_client_fd_cb; ipa_link->ofd->data = ipa_link; @@ -232,7 +232,7 @@ int ipa_client_conn_open(struct ipa_client_conn *link) if (ret < 0) return ret; link->ofd->fd = ret; - link->ofd->when |= BSC_FD_WRITE; + link->ofd->when |= OSMO_FD_WRITE; if (osmo_fd_register(link->ofd) < 0) { close(ret); link->ofd->fd = -1; @@ -245,7 +245,7 @@ int ipa_client_conn_open(struct ipa_client_conn *link) void ipa_client_conn_send(struct ipa_client_conn *link, struct msgb *msg) { msgb_enqueue(&link->tx_queue, msg); - link->ofd->when |= BSC_FD_WRITE; + link->ofd->when |= OSMO_FD_WRITE; } size_t ipa_client_conn_clear_queue(struct ipa_client_conn *link) @@ -258,7 +258,7 @@ size_t ipa_client_conn_clear_queue(struct ipa_client_conn *link) deleted += 1; } - link->ofd->when &= ~BSC_FD_WRITE; + link->ofd->when &= ~OSMO_FD_WRITE; return deleted; } @@ -312,7 +312,7 @@ ipa_server_link_create(void *ctx, struct e1inp_line *line, if (!ipa_link) return NULL; - ipa_link->ofd.when |= BSC_FD_READ | BSC_FD_WRITE; + ipa_link->ofd.when |= OSMO_FD_READ | OSMO_FD_WRITE; ipa_link->ofd.cb = ipa_server_fd_cb; ipa_link->ofd.fd = -1; ipa_link->ofd.data = ipa_link; @@ -394,7 +394,7 @@ static void ipa_server_conn_write(struct ipa_server_conn *conn) msg = msgb_dequeue(&conn->tx_queue); if (!msg) { - conn->ofd.when &= ~BSC_FD_WRITE; + conn->ofd.when &= ~OSMO_FD_WRITE; return; } @@ -411,9 +411,9 @@ static int ipa_server_conn_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 = ipa_server_conn_read(conn); - if (rc != -EBADF && (what & BSC_FD_WRITE)) + if (rc != -EBADF && (what & OSMO_FD_WRITE)) ipa_server_conn_write(conn); return 0; @@ -438,7 +438,7 @@ ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, conn->ofd.fd = fd; conn->ofd.data = conn; conn->ofd.cb = ipa_server_conn_cb; - conn->ofd.when = BSC_FD_READ; + conn->ofd.when = OSMO_FD_READ; conn->cb = cb; conn->closed_cb = closed_cb; conn->data = data; @@ -542,5 +542,5 @@ void ipa_server_conn_destroy(struct ipa_server_conn *conn) void ipa_server_conn_send(struct ipa_server_conn *conn, struct msgb *msg) { msgb_enqueue(&conn->tx_queue, msg); - conn->ofd.when |= BSC_FD_WRITE; + conn->ofd.when |= OSMO_FD_WRITE; } diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 30bcaf9..18cf7f5 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -422,7 +422,7 @@ err: static int ts_want_write(struct e1inp_ts *e1i_ts) { - e1i_ts->driver.ipaccess.fd.when |= BSC_FD_WRITE; + e1i_ts->driver.ipaccess.fd.when |= OSMO_FD_WRITE; return 0; } @@ -474,7 +474,7 @@ static int __handle_ts1_write(struct osmo_fd *bfd, struct e1inp_line *line) int ret; e1i_ts = ipaccess_line_ts(bfd, line); - bfd->when &= ~BSC_FD_WRITE; + bfd->when &= ~OSMO_FD_WRITE; /* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, &sign_link); @@ -489,7 +489,7 @@ static int __handle_ts1_write(struct osmo_fd *bfd, struct e1inp_line *line) case E1INP_SIGN_OSMO: break; default: - bfd->when |= BSC_FD_WRITE; /* come back for more msg */ + bfd->when |= OSMO_FD_WRITE; /* come back for more msg */ ret = -EINVAL; goto out; } @@ -540,9 +540,9 @@ int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what) { int rc = 0; - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_ts1_read(bfd); - if (rc != -EBADF && (what & BSC_FD_WRITE)) + if (rc != -EBADF && (what & OSMO_FD_WRITE)) rc = handle_ts1_write(bfd); return rc; @@ -649,7 +649,7 @@ static int ipaccess_bsc_oml_cb(struct ipa_server_link *link, int fd) e1i_ts = e1inp_line_ipa_oml_ts(line); bfd = &e1i_ts->driver.ipaccess.fd; - osmo_fd_setup(bfd, fd, BSC_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_OML); + osmo_fd_setup(bfd, fd, OSMO_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_OML); ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "could not register FD\n"); @@ -702,7 +702,7 @@ static int ipaccess_bsc_rsl_cb(struct ipa_server_link *link, int fd) e1i_ts = e1inp_line_ipa_rsl_ts(line, 0); bfd = &e1i_ts->driver.ipaccess.fd; - osmo_fd_setup(bfd, fd, BSC_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_RSL); + osmo_fd_setup(bfd, fd, OSMO_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_RSL); ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "could not register FD\n"); diff --git a/src/input/misdn.c b/src/input/misdn.c index 564d008..9d33932 100644 --- a/src/input/misdn.c +++ b/src/input/misdn.c @@ -216,7 +216,7 @@ static int ts_want_write(struct e1inp_ts *e1i_ts) if (e1i_ts->type == E1INP_TS_TYPE_TRAU) return 0; - e1i_ts->driver.misdn.fd.when |= BSC_FD_WRITE; + e1i_ts->driver.misdn.fd.when |= OSMO_FD_WRITE; return 0; } @@ -242,7 +242,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) uint8_t *l2_data; int ret; - bfd->when &= ~BSC_FD_WRITE; + bfd->when &= ~OSMO_FD_WRITE; /* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, &sign_link); @@ -481,20 +481,20 @@ static int misdn_fd_cb(struct osmo_fd *bfd, unsigned int what) switch (e1i_ts->type) { case E1INP_TS_TYPE_SIGN: - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_ts1_read(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) rc = handle_ts1_write(bfd); break; case E1INP_TS_TYPE_TRAU: - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_tsX_read(bfd); /* We never include the mISDN B-Channel FD into the * writeset, since it doesn't support poll() based * write flow control */ break; case E1INP_TS_TYPE_RAW: - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) rc = handle_ts_raw_read(bfd); /* We never include the mISDN B-Channel FD into the * writeset, since it doesn't support poll() based @@ -603,7 +603,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) case E1INP_TS_TYPE_HDLC: bfd->fd = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_HDLC); - bfd->when = BSC_FD_READ; + bfd->when = OSMO_FD_READ; break; case E1INP_TS_TYPE_SIGN: if (mline->use_userspace_lapd) @@ -612,7 +612,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) else bfd->fd = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_LAPD_NT); - bfd->when = BSC_FD_READ; + bfd->when = OSMO_FD_READ; break; case E1INP_TS_TYPE_TRAU: case E1INP_TS_TYPE_RAW: @@ -620,7 +620,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) /* We never include the mISDN B-Channel FD into the * writeset, since it doesn't support poll() based * write flow control */ - bfd->when = BSC_FD_READ; + bfd->when = OSMO_FD_READ; break; } diff --git a/src/input/rs232.c b/src/input/rs232.c index dfbf97c..390d7fe 100644 --- a/src/input/rs232.c +++ b/src/input/rs232.c @@ -86,7 +86,7 @@ static int handle_ser_write(struct osmo_fd *bfd) struct msgb *msg; int written; - bfd->when &= ~BSC_FD_WRITE; + bfd->when &= ~OSMO_FD_WRITE; /* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, &sign_link); @@ -193,13 +193,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; @@ -207,7 +207,7 @@ static int serial_fd_cb(struct osmo_fd *bfd, unsigned int what) static int rs232_want_write(struct e1inp_ts *e1i_ts) { - e1i_ts->driver.rs232.fd.when |= BSC_FD_WRITE; + e1i_ts->driver.rs232.fd.when |= OSMO_FD_WRITE; return 0; } @@ -256,7 +256,7 @@ rs232_setup(struct e1inp_line *line, const char *serial_port, unsigned int delay ser_handle->line = line; ser_handle->delay_ms = delay_ms; - bfd->when = BSC_FD_READ; + bfd->when = OSMO_FD_READ; bfd->cb = serial_fd_cb; bfd->data = ser_handle; diff --git a/src/input/unixsocket.c b/src/input/unixsocket.c index cfb4979..252da03 100644 --- a/src/input/unixsocket.c +++ b/src/input/unixsocket.c @@ -147,7 +147,7 @@ static int unixsocket_write_cb(struct osmo_fd *bfd) struct msgb *msg; struct e1inp_sign_link *sign_link; - bfd->when &= ~BSC_FD_WRITE; + bfd->when &= ~OSMO_FD_WRITE; /* get the next msg for this timeslot */ msg = e1inp_tx_ts(e1i_ts, &sign_link); @@ -173,9 +173,9 @@ static int unixsocket_cb(struct osmo_fd *bfd, unsigned int what) { int ret = 0; - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) ret = unixsocket_read_cb(bfd); - if (what & BSC_FD_WRITE) + if (what & OSMO_FD_WRITE) ret = unixsocket_write_cb(bfd); return ret; @@ -185,7 +185,7 @@ static int ts_want_write(struct e1inp_ts *e1i_ts) { struct unixsocket_line *line = e1i_ts->line->driver_data; - line->fd.when |= BSC_FD_WRITE; + line->fd.when |= OSMO_FD_WRITE; return 0; } @@ -243,7 +243,7 @@ static int unixsocket_line_update(struct e1inp_line *line) config = line->driver_data; config->fd.data = line; - config->fd.when = BSC_FD_READ; + config->fd.when = OSMO_FD_READ; config->fd.cb = unixsocket_cb; /* Open unix domain socket */ diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index c070915..fab6471 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -213,10 +213,10 @@ static int osmo_rtp_fd_cb(struct osmo_fd *fd, unsigned int what) { struct osmo_rtp_socket *rs = fd->data; - if (what & BSC_FD_READ) { + if (what & OSMO_FD_READ) { /* in polling mode, we don't want to be called here */ if (rs->flags & OSMO_RTP_F_POLL) { - fd->when &= ~BSC_FD_READ; + fd->when &= ~OSMO_FD_READ; return 0; } if (!recv_with_cb(rs)) @@ -224,7 +224,7 @@ static int osmo_rtp_fd_cb(struct osmo_fd *fd, unsigned int what) rs->rx_user_ts); rs->rx_user_ts += 160; } - /* writing is not queued at the moment, so BSC_FD_WRITE + /* writing is not queued at the moment, so OSMO_FD_WRITE * shouldn't occur */ return 0; } @@ -249,7 +249,7 @@ static int osmo_rtp_socket_fdreg(struct osmo_rtp_socket *rs) rs->rtp_bfd.fd = rtp_session_get_rtp_socket(rs->sess); rs->rtcp_bfd.fd = rtp_session_get_rtcp_socket(rs->sess); - rs->rtp_bfd.when = rs->rtcp_bfd.when = BSC_FD_READ; + rs->rtp_bfd.when = rs->rtcp_bfd.when = OSMO_FD_READ; rs->rtp_bfd.data = rs->rtcp_bfd.data = rs; rs->rtp_bfd.cb = osmo_rtp_fd_cb; rs->rtcp_bfd.cb = osmo_rtcp_fd_cb; diff --git a/tests/e1inp_ipa_bts_test.c b/tests/e1inp_ipa_bts_test.c index d6c3772..3c7613e 100644 --- a/tests/e1inp_ipa_bts_test.c +++ b/tests/e1inp_ipa_bts_test.c @@ -309,7 +309,7 @@ int main(void) } bts_eventfd.fd = eventfds[0]; bts_eventfd.cb = test_bts_gsm_12_21_cb; - bts_eventfd.when = BSC_FD_READ; + bts_eventfd.when = OSMO_FD_READ; bts_eventfd.data = &bts_dev_info; if (osmo_fd_register(&bts_eventfd) < 0) { LOGP(DBTSTEST, LOGL_ERROR, "could not register event fd\n"); -- cgit v1.2.3