pub struct UblkCtrlBuilder<'a> { /* private fields */ }Expand description
UblkSession: build one new ublk control device or recover the old one.
High level API.
One limit is that IO handling closure doesn’t support FnMut, and low level API doesn’t have such limit.
Implementations§
Source§impl<'a> UblkCtrlBuilder<'a>
impl<'a> UblkCtrlBuilder<'a>
Sourcepub fn id(self, value: i32) -> Self
pub fn id(self, value: i32) -> Self
device id: -1 can only be used for adding one new device, and ublk driver will allocate one new ID for the created device; otherwise, we are asking driver to create or recover or list one device with specified ID
Sourcepub fn io_buf_bytes(self, value: u32) -> Self
pub fn io_buf_bytes(self, value: u32) -> Self
max size of each IO buffer size, which will be converted to block layer’s queue limit of max hw sectors
Sourcepub fn ctrl_flags(self, value: u64) -> Self
pub fn ctrl_flags(self, value: u64) -> Self
passed to ublk driver via sys::ublksrv_ctrl_dev_info.flags,
usually for adding or recovering device
Sourcepub fn ctrl_target_flags(self, value: u64) -> Self
pub fn ctrl_target_flags(self, value: u64) -> Self
store target flags in sys::ublksrv_ctrl_dev_info.ublksrv_flags,
which is immutable in the whole device lifetime
Source§impl UblkCtrlBuilder<'_>
impl UblkCtrlBuilder<'_>
Sourcepub fn build(self) -> Result<UblkCtrl, UblkError>
pub fn build(self) -> Result<UblkCtrl, UblkError>
create one pair of ublk devices, the 1st one is control device(UblkCtrl),
and the 2nd one is data device(UblkDev)