daniel has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32790 )
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
Added, because the field 'io_ops' of 'struct osmo_io_fd' 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, 25 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve daniel: Looks good to me, approved
diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index ffc8cfa..c19ca67 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -88,3 +88,5 @@
int osmo_iofd_get_fd(const struct osmo_io_fd *iofd); const char *osmo_iofd_get_name(const struct osmo_io_fd *iofd); + +void osmo_iofd_set_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 7bca331..bce3399 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -267,6 +267,7 @@ osmo_iofd_sendto_msgb; osmo_iofd_set_alloc_info; osmo_iofd_set_data; +osmo_iofd_set_ioops; osmo_iofd_set_priv_nr; osmo_iofd_setup; osmo_iofd_txqueue_clear; diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index cfb6d68..b06e63c 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -599,4 +599,12 @@ return iofd->name; }
+/*! Set the osmo_io_ops for an iofd + * \param[in] iofd Target iofd file descriptor + * \param[in] ioops osmo_io_ops structure to be set */ +void osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops) +{ + iofd->io_ops = *ioops; +} + #endif /* defined(__linux__) */