diff options
Diffstat (limited to 'src/osmo-bts-sysmo/l1_transp_hw.c')
-rw-r--r-- | src/osmo-bts-sysmo/l1_transp_hw.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/osmo-bts-sysmo/l1_transp_hw.c b/src/osmo-bts-sysmo/l1_transp_hw.c index 01bc2005..cfbc77c9 100644 --- a/src/osmo-bts-sysmo/l1_transp_hw.c +++ b/src/osmo-bts-sysmo/l1_transp_hw.c @@ -12,7 +12,7 @@ * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. @@ -95,18 +95,18 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) queue = container_of(fd, struct osmo_wqueue, bfd); - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) queue->read_cb(fd); - if (what & BSC_FD_EXCEPT) + if (what & OSMO_FD_EXCEPT) queue->except_cb(fd); - if (what & BSC_FD_WRITE) { + if (what & OSMO_FD_WRITE) { struct iovec iov[5]; struct msgb *msg, *tmp; int written, count = 0; - fd->when &= ~BSC_FD_WRITE; + osmo_fd_write_disable(fd); llist_for_each_entry(msg, &queue->msg_queue, list) { /* more writes than we have */ @@ -124,7 +124,7 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) /* Nothing scheduled? This should not happen. */ if (count == 0) { if (!llist_empty(&queue->msg_queue)) - fd->when |= BSC_FD_WRITE; + osmo_fd_write_enable(fd); return 0; } @@ -132,7 +132,7 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) if (written < 0) { /* nothing written?! */ if (!llist_empty(&queue->msg_queue)) - fd->when |= BSC_FD_WRITE; + osmo_fd_write_enable(fd); return 0; } @@ -151,7 +151,7 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) } if (!llist_empty(&queue->msg_queue)) - fd->when |= BSC_FD_WRITE; + osmo_fd_write_enable(fd); } return 0; @@ -271,11 +271,7 @@ int l1if_transport_open(int q, struct femtol1_hdl *hdl) q, rd_devnames[q], strerror(errno)); return rc; } - read_ofd->fd = rc; - read_ofd->priv_nr = q; - read_ofd->data = hdl; - read_ofd->cb = l1if_fd_cb; - read_ofd->when = BSC_FD_READ; + osmo_fd_setup(read_ofd, rc, OSMO_FD_READ, l1if_fd_cb, hdl, q); rc = osmo_fd_register(read_ofd); if (rc < 0) { close(read_ofd->fd); @@ -291,11 +287,7 @@ int l1if_transport_open(int q, struct femtol1_hdl *hdl) } osmo_wqueue_init(wq, 10); wq->write_cb = l1fd_write_cb; - write_ofd->cb = wqueue_vector_cb; - write_ofd->fd = rc; - write_ofd->priv_nr = q; - write_ofd->data = hdl; - write_ofd->when = BSC_FD_WRITE; + osmo_fd_setup(write_ofd, rc, OSMO_FD_WRITE, wqueue_vector_cb, hdl, q); rc = osmo_fd_register(write_ofd); if (rc < 0) { close(write_ofd->fd); |