From 0c374c68a1f77e95de3043577c7b6058dcf23026 Mon Sep 17 00:00:00 2001 From: arehbein Date: Sun, 14 May 2023 21:43:11 +0200 Subject: [PATCH] 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 --- include/osmocom/core/osmo_io.h | 2 ++ src/core/libosmocore.map | 1 + src/core/osmo_io.c | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index ffc8cfa5a..c19ca678e 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -88,3 +88,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); 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 7bca33115..bce339934 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -267,6 +267,7 @@ osmo_iofd_register; 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 cfb6d6867..b06e63cf9 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -599,4 +599,12 @@ const char *osmo_iofd_get_name(const struct osmo_io_fd *iofd) 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__) */