osmo_io: Add io_uring backend

Change-Id: I5152129eb84b31ccc9e02bc2a5c5bdb046d331bc
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index bccf7af..e176099 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -47,6 +47,7 @@
 
 const struct value_string osmo_io_backend_names[] = {
 	{ OSMO_IO_BACKEND_POLL, "poll" },
+	{ OSMO_IO_BACKEND_IO_URING, "io_uring" },
 	{ 0, NULL }
 };
 
@@ -55,12 +56,21 @@
 /* Used by some tests, can't be static */
 struct iofd_backend_ops osmo_iofd_ops;
 
+#if defined(HAVE_URING)
+void osmo_iofd_uring_init(void);
+#endif
+
 /*! initialize osmo_io for the current thread */
 void osmo_iofd_init(void)
 {
 	switch (g_io_backend) {
 	case OSMO_IO_BACKEND_POLL:
 		break;
+#if defined(HAVE_URING)
+	case OSMO_IO_BACKEND_IO_URING:
+		osmo_iofd_uring_init();
+		break;
+#endif
 	default:
 		OSMO_ASSERT(0);
 		break;
@@ -78,6 +88,11 @@
 	if (!strcmp("POLL", backend)) {
 		g_io_backend = OSMO_IO_BACKEND_POLL;
 		osmo_iofd_ops = iofd_poll_ops;
+#if defined(HAVE_URING)
+	} else if (!strcmp("IO_URING", backend)) {
+		g_io_backend = OSMO_IO_BACKEND_IO_URING;
+		osmo_iofd_ops = iofd_uring_ops;
+#endif
 	} else {
 		fprintf(stderr, "Invalid osmo_io backend requested: \"%s\"\nCheck the environment variable %s\n", backend, OSMO_IO_BACKEND_ENV);
 		exit(1);