io_uring params and polling added
Added new functionality to io_uring wrapper - specifically for
processing additional params in the constructor and supporting polling
files.
Main purpose is to support the io_uring usage in cached reads for
phosphor-hwmon.
Signed-off-by: Jerry Zhu <jzhu379@gmail.com>
Change-Id: I782972c75d642e1e91729b836f6a3bb18fd428bd
diff --git a/src/stdplus/io_uring.cpp b/src/stdplus/io_uring.cpp
index 1402b8a..eaa2848 100644
--- a/src/stdplus/io_uring.cpp
+++ b/src/stdplus/io_uring.cpp
@@ -1,4 +1,5 @@
#include <liburing.h>
+
#include <sys/eventfd.h>
#include <stdplus/fd/managed.hpp>
@@ -16,6 +17,12 @@
CHECK_RET(io_uring_queue_init(queue_size, &ring, 0), "io_uring_queue_init");
}
+IoUring::IoUring(size_t queue_size, io_uring_params& params)
+{
+ CHECK_RET(io_uring_queue_init_params(queue_size, &ring, ¶ms),
+ "io_uring_queue_init_params");
+}
+
IoUring::~IoUring()
{
io_uring_queue_exit(&ring);
diff --git a/src/stdplus/io_uring.hpp b/src/stdplus/io_uring.hpp
index 7ea2114..f4cd269 100644
--- a/src/stdplus/io_uring.hpp
+++ b/src/stdplus/io_uring.hpp
@@ -1,4 +1,5 @@
#pragma once
+
#include <liburing.h>
#include <stdplus/fd/managed.hpp>
@@ -44,6 +45,8 @@
};
explicit IoUring(size_t queue_size = 10);
+ explicit IoUring(size_t queue_size, io_uring_params& params);
+
IoUring(IoUring&&) = delete;
IoUring& operator=(IoUring&&) = delete;
IoUring(const IoUring&) = delete;