osmo_io: Remove osmo_iofd_read/write_enable/disable
This API is not really used or needed, so remove it.
See discussion in https://gerrit.osmocom.org/c/libosmocore/+/33084
Change-Id: I0dbc14a8cbbdc7b6e4688942c0dac865bbd72c8b
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 9960fb4..d260da4 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -170,7 +170,7 @@
llist_add_tail(&msghdr->list, &iofd->tx_queue.msg_queue);
iofd->tx_queue.current_length++;
- if (iofd->write_enabled && iofd->tx_queue.current_length == 1)
+ if (iofd->tx_queue.current_length == 1)
osmo_iofd_ops.write_enable(iofd);
return 0;
@@ -368,46 +368,6 @@
return 0;
}
-/*! Enable reading from this iofd
- *
- * \param[in] iofd the file descriptor
- */
-void osmo_iofd_read_enable(struct osmo_io_fd *iofd)
-{
- iofd->read_enabled = true;
- osmo_iofd_ops.read_enable(iofd);
-}
-
-/*! Disable reading from this iofd
- *
- * \param[in] iofd the file descriptor
- */
-void osmo_iofd_read_disable(struct osmo_io_fd *iofd)
-{
- iofd->read_enabled = false;
- osmo_iofd_ops.read_disable(iofd);
-}
-
-/*! Enable writing to this iofd
- *
- * \param[in] iofd the file descriptor
- */
-void osmo_iofd_write_enable(struct osmo_io_fd *iofd)
-{
- iofd->write_enabled = true;
- osmo_iofd_ops.write_enable(iofd);
-}
-
-/*! Disable writing to this iofd
- *
- * \param[in] iofd the file descriptor
- */
-void osmo_iofd_write_disable(struct osmo_io_fd *iofd)
-{
- iofd->write_enabled = false;
- osmo_iofd_ops.write_disable(iofd);
-}
-
/*! Allocate and setup a new iofd
* \param[in] ctx the parent context from which to allocate
* \param[in] fd the underlying system file descriptor
@@ -454,14 +414,19 @@
*/
int osmo_iofd_register(struct osmo_io_fd *iofd, int fd)
{
+ int rc = 0;
+
if (fd >= 0)
iofd->fd = fd;
iofd->closed = false;
if (osmo_iofd_ops.register_fd)
- return osmo_iofd_ops.register_fd(iofd);
+ rc = osmo_iofd_ops.register_fd(iofd);
- return 0;
+ osmo_iofd_ops.read_enable(iofd);
+ osmo_iofd_ops.write_enable(iofd);
+
+ return rc;
}
/*! Unregister the fd from the underlying backend