arehbein has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32713 )
Change subject: core: Add function to update osmo_io_ops field for osmo_io_fd ......................................................................
core: Add function to update osmo_io_ops field for osmo_io_fd
Needed, because the field 'io_ops' is not a reference, so subsequent changes to the osmo_io_ops structure that was used to set it up aren't automatically reflected in the osmo_io_fd structure that got its copy.
Change-Id: Ie45402ad8e86e3cecf75ad78a512c17e61e68b19 --- M include/osmocom/core/osmo_io.h M src/core/libosmocore.map M src/core/osmo_io.c 3 files changed, 24 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/32713/1
diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index c085dda..6d10d6a 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -71,3 +71,5 @@ void osmo_iofd_set_priv_nr(struct osmo_io_fd *iofd, unsigned int priv_nr);
int osmo_iofd_get_fd(const struct osmo_io_fd *iofd); + +void osmo_iofd_update_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops); diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index 99a3cef..8e90027 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -269,6 +269,7 @@ osmo_iofd_txqueue_clear; osmo_iofd_txqueue_len; osmo_iofd_unregister; +osmo_iofd_update_ioops; osmo_iofd_uring_init; osmo_iofd_write_disable; osmo_iofd_write_enable; diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index 0139d8f..2a8d104 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -551,4 +551,12 @@ return iofd->fd; }
+/*! Set the segmentation callback for an iofd + * \param[in] iofd Target iofd file descriptor + * \param[in] segmentation_cb Target segmentation callback to be set */ +void osmo_iofd_update_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops) +{ + iofd->io_ops = *ioops; +} + #endif /* HAVE_SYS_SOCKET_H */