|
ublk-cpp v0.0
|
The main namespace of the ublk-cpp library. More...
Namespaces | |
| namespace | daemon |
| High-level API for running a ublk daemon. | |
| namespace | raw |
| Low-level io_uring command senders for ublk control and I/O commands. | |
Classes | |
| struct | IoData |
| Context of a single I/O request delivered to a handler. More... | |
| struct | fetch_dev_info_t |
| Environment query for the cached ublk device info. Returns nullptr if the environment doesn't provide it. More... | |
| class | RuntimeOptions |
| Runtime options for ublk device. More... | |
Concepts | |
| concept | IoHandler |
| Concept of an async handler with handle_io(const IoData&). | |
| concept | QueueHandler |
| Concept of a handler with per-queue init/destroy callbacks. | |
| concept | ShmHandler |
| Concept of a handler notified of shared memory buffer registration. | |
Functions | |
| auto | get_queue_affinity (int control_fd, uint32_t dev_id, uint16_t q_id, cpu_set_t *cpuset) noexcept |
| Get the queue affinity for a specific ublk queue. | |
| auto | get_dev_info (int control_fd, uint32_t dev_id, ublksrv_ctrl_dev_info *info) noexcept |
| Get the device information for a specific ublk device. | |
| auto | add_dev (int control_fd, ublksrv_ctrl_dev_info *info) noexcept |
| Add a new ublk device. | |
| auto | del_dev (int control_fd, uint32_t dev_id) noexcept |
| Delete a ublk device. | |
| auto | start_dev (int control_fd, uint32_t dev_id, int32_t daemon_pid) noexcept |
| Start a ublk device. | |
| auto | stop_dev (int control_fd, uint32_t dev_id) noexcept |
| Stop a ublk device. | |
| auto | set_params (int control_fd, uint32_t dev_id, const ublk_params *params) noexcept |
| Set the parameters of a ublk device. | |
| auto | get_params (int control_fd, uint32_t dev_id, ublk_params *params) noexcept |
| Get the parameters of a ublk device. | |
| auto | start_user_recovery (int control_fd, uint32_t dev_id) noexcept |
| Start user recovery for a ublk device. | |
| auto | end_user_recovery (int control_fd, uint32_t dev_id, int32_t daemon_pid) noexcept |
| End user recovery for a ublk device. | |
| auto | get_features (int control_fd, uint64_t *features) noexcept |
| Get the feature flags supported by the ublk driver. | |
| auto | del_dev_async (int control_fd, uint32_t dev_id) noexcept |
| Delete a ublk device asynchronously. | |
| auto | update_size (int control_fd, uint32_t dev_id, uint64_t sectors) noexcept |
| Update the size of a ublk device. | |
| auto | quiesce_dev (int control_fd, uint32_t dev_id, uint64_t timeout_ms) noexcept |
| Quiesce a ublk device (UBLK_F_QUIESCE). | |
| auto | try_stop_dev (int control_fd, uint32_t dev_id) noexcept |
| Try to stop a ublk device if it has no openers (UBLK_F_SAFE_STOP_DEV). | |
| auto | register_shm_buf (int control_fd, uint32_t dev_id, const ublk_shmem_buf_reg *reg) noexcept |
| Register a shared memory buffer for zero-copy I/O on a ublk device (UBLK_F_SHMEM_ZC). | |
| auto | unregister_shm_buf (int control_fd, uint32_t dev_id, uint64_t buf_index) noexcept |
| Unregister a shared memory buffer from a ublk device. | |
| uint16_t | shmem_zc_index (uint64_t addr) noexcept |
| Extract the buffer index from a shared memory zero-copy encoded address (UBLK_IO_F_SHMEM_ZC). | |
| uint32_t | shmem_zc_offset (uint64_t addr) noexcept |
| Extract the byte offset within the buffer from a shared memory zero-copy encoded address (UBLK_IO_F_SHMEM_ZC). | |
| uint64_t | user_copy_pos (uint16_t q_id, uint16_t tag, uint32_t offset) noexcept |
| Compute the byte position in /dev/ublkcN for user-space data copy (UBLK_F_USER_COPY). | |
| template<IoHandler F> | |
| auto | run_dev (int ublkc_fd, uint16_t q_id, const ublksrv_ctrl_dev_info *info, F &handler) noexcept |
| Run the I/O loop of a single ublk queue until it stops. | |
Variables | |
| constexpr fetch_dev_info_t | fetch_dev_info {} |
| Query object instance of fetch_dev_info_t. | |
| constexpr int | version_major = UBLKCPP_VERSION_MAJOR |
| ublk-cpp major version. | |
| constexpr int | version_minor = UBLKCPP_VERSION_MINOR |
| ublk-cpp minor version. | |
The main namespace of the ublk-cpp library.
|
inlinenoexcept |
Add a new ublk device.
| control_fd | The control file descriptor for the ublk device. |
| info | A pointer to the device information structure describing the device to add. |
Definition at line 47 of file control.hpp.
|
inlinenoexcept |
Delete a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device to delete. |
Definition at line 58 of file control.hpp.
|
inlinenoexcept |
Delete a ublk device asynchronously.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device to delete. |
Definition at line 153 of file control.hpp.
|
inlinenoexcept |
End user recovery for a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| daemon_pid | The PID of the daemon process that serves the device. |
Definition at line 130 of file control.hpp.
|
inlinenoexcept |
Get the device information for a specific ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| info | A pointer to the device information structure to populate. |
Definition at line 34 of file control.hpp.
|
inlinenoexcept |
Get the feature flags supported by the ublk driver.
| control_fd | The control file descriptor for the ublk device. |
| features | A pointer to store the returned UBLK_F_* feature flags. |
Definition at line 142 of file control.hpp.
|
inlinenoexcept |
Get the parameters of a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| params | A pointer to the parameters structure to populate. |
Definition at line 106 of file control.hpp.
|
inlinenoexcept |
Get the queue affinity for a specific ublk queue.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| q_id | The queue ID for which to retrieve the affinity information. |
| cpuset | A pointer to the CPU set to store the affinity information. |
Definition at line 21 of file control.hpp.
|
inlinenoexcept |
Quiesce a ublk device (UBLK_F_QUIESCE).
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| timeout_ms | The timeout in milliseconds allowed for the device to quiesce. |
Definition at line 179 of file control.hpp.
|
inlinenoexcept |
Register a shared memory buffer for zero-copy I/O on a ublk device (UBLK_F_SHMEM_ZC).
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| reg | A pointer to the shared memory buffer registration describing the buffer to register. |
Definition at line 206 of file control.hpp.
|
inlinenoexcept |
Run the I/O loop of a single ublk queue until it stops.
| ublkc_fd | The file descriptor of the ublk queue (/dev/ublkcN). |
| q_id | The queue ID of the queue to run. |
| info | A pointer to the device information of the ublk device. |
| handler | The IoHandler invoked for each fetched request. |
|
inlinenoexcept |
Set the parameters of a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| params | A pointer to the parameters to apply to the device. |
Definition at line 93 of file control.hpp.
|
inlinenoexcept |
Extract the buffer index from a shared memory zero-copy encoded address (UBLK_IO_F_SHMEM_ZC).
| addr | The encoded addr field of an I/O descriptor, set by the driver when a request's pages match a registered shared memory buffer. |
Definition at line 21 of file helpers.hpp.
|
inlinenoexcept |
Extract the byte offset within the buffer from a shared memory zero-copy encoded address (UBLK_IO_F_SHMEM_ZC).
| addr | The encoded addr field of an I/O descriptor, set by the driver when a request's pages match a registered shared memory buffer. |
Definition at line 32 of file helpers.hpp.
|
inlinenoexcept |
Start a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| daemon_pid | The PID of the daemon process that serves the device. |
Definition at line 69 of file control.hpp.
|
inlinenoexcept |
Start user recovery for a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
Definition at line 118 of file control.hpp.
|
inlinenoexcept |
Stop a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device to stop. |
Definition at line 81 of file control.hpp.
|
inlinenoexcept |
Try to stop a ublk device if it has no openers (UBLK_F_SAFE_STOP_DEV).
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device to stop. |
Definition at line 191 of file control.hpp.
|
inlinenoexcept |
Unregister a shared memory buffer from a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| buf_index | The index of the shared memory buffer to unregister, as returned by register_shm_buf(). |
Definition at line 220 of file control.hpp.
|
inlinenoexcept |
Update the size of a ublk device.
| control_fd | The control file descriptor for the ublk device. |
| dev_id | The device ID of the ublk device. |
| sectors | The new device size in sectors. |
Definition at line 165 of file control.hpp.
|
inlinenoexcept |
Compute the byte position in /dev/ublkcN for user-space data copy (UBLK_F_USER_COPY).
| q_id | The queue ID of the request. |
| tag | The tag of the request. |
| offset | The byte offset within the request buffer. |
Definition at line 45 of file helpers.hpp.