27inline auto setup(
int control_fd, ublksrv_ctrl_dev_info *info)
noexcept {
28 return detail::task_invoke(detail::daemon_setup_t{}, control_fd, info);
42inline auto configure(
int control_fd, uint32_t dev_id,
43 ublk_params *params)
noexcept {
44 return detail::task_invoke(detail::daemon_configure_t{}, control_fd, dev_id,
55inline auto start(
int control_fd, uint32_t dev_id,
56 int32_t daemon_pid)
noexcept {
57 return detail::task_invoke(detail::daemon_start_t{}, control_fd, dev_id,
81template <IoHandler Handler>
82inline auto run(
int control_fd, uint32_t dev_id, Handler &handler,
84 return detail::task_invoke(detail::daemon_run_t{}, control_fd, dev_id,
85 &handler, options.runtime_options,
86 options.nr_files, options.nr_buffers);
101template <ShmHandler Handler>
103 std::string_view path, Handler &handler,
104 uint32_t flags)
noexcept {
105 return detail::task_invoke(detail::daemon_shm_server_t{}, control_fd,
106 dev_id, path, &handler, flags);
Runtime options for ublk device.
Implementation of the ublk daemon API for managing ublk device servers.
High-level API for running a ublk daemon.
auto setup(int control_fd, ublksrv_ctrl_dev_info *info) noexcept
Ensure the device described by info has been created and return its current information.
auto run_shm_server(int control_fd, uint32_t dev_id, std::string_view path, Handler &handler, uint32_t flags) noexcept
Run the shared memory buffer registration service over a Unix domain socket (UBLK_F_SHMEM_ZC).
auto start(int control_fd, uint32_t dev_id, int32_t daemon_pid) noexcept
Start the device, served by this daemon, if possible.
auto configure(int control_fd, uint32_t dev_id, ublk_params *params) noexcept
Ensure the device has been configured and return its current configuration in params.
auto run(int control_fd, uint32_t dev_id, Handler &handler, Options options) noexcept
Run the daemon serving a device until it stops.
The main namespace of the ublk-cpp library.
Runtime options based on condy::RuntimeOptions.
Extra options for daemon::run().
size_t nr_buffers
Number of fixed buffers in each queue's io_uring buffer table.
size_t nr_files
Number of registered files in each queue's io_uring.
const RuntimeOptions * runtime_options
Per-queue runtime options, or nullptr for defaults.