pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/39940?usp=email )
(
1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: core: osmo_io: Introduce API osmo_io_get_backend() ......................................................................
core: osmo_io: Introduce API osmo_io_get_backend()
It came up several times already that it's difficult figuring out the osmo-io backend a process is actually using. Add this API so that we can display the osmo-io backend through VTY command in a follow-up commit.
Related: OS#6740 Change-Id: I9432efd6cb0453d7ab42d71765e897db6bd4c787 --- M TODO-RELEASE M include/osmocom/core/osmo_io.h M src/core/libosmocore.map M src/core/osmo_io.c 4 files changed, 11 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved
diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..5d97425 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmocore add API osmo_io_get_backend() \ No newline at end of file diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index f4bfec4..c8b8517 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -79,6 +79,8 @@ OSMO_IO_BACKEND_IO_URING, };
+enum osmo_io_backend osmo_io_get_backend(void); + extern const struct value_string osmo_io_backend_names[]; /*! return the string name of an osmo_io_backend */ static inline const char *osmo_io_backend_name(enum osmo_io_backend val) diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index cd5dc94..b48c4e6 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -256,6 +256,7 @@ osmo_init_logging2; osmo_int_to_float_str_buf; osmo_int_to_float_str_c; +osmo_io_get_backend; osmo_io_backend_names; osmo_iofd_close; osmo_iofd_free; diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index 65c9b33..9d377a8 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -122,6 +122,13 @@ osmo_iofd_init(); }
+/*! Obtain the osmo_io_backend in use by the process + * \returns The osmo_io backend which was configured at startup time */ +enum osmo_io_backend osmo_io_get_backend(void) +{ + return g_io_backend; +} + /*! Allocate the msghdr. * \param[in] iofd the osmo_io file structure * \param[in] action the action this msg(hdr) is for (read, write, ..)