Struct AttachOptions
pub struct AttachOptions {
mtd_number: u32,
number: Option<u32>,
vid_header_offset: Option<u32>,
max_beb_per1024: Option<u16>,
disable_fastmap: bool,
reserve_pool: bool,
wl_threshold: Option<u32>,
}Expand description
Attach of an MTD device to UBI, returned by DeviceInfo::attach.
Options that aren’t set leave the choice to the kernel, and kernels that
don’t know an option ignore it. AttachOptions::run attaches the
device.
use flashkit_ubi_linux::DeviceInfo;
let device = DeviceInfo::attach(3)
.vid_header_offset(2048)
.max_beb_per1024(20)
.run()?;Fields§
§mtd_number: u32§number: Option<u32>§vid_header_offset: Option<u32>§max_beb_per1024: Option<u16>§disable_fastmap: bool§reserve_pool: bool§wl_threshold: Option<u32>Implementations§
§impl AttachOptions
impl AttachOptions
pub(crate) const fn new(mtd_number: u32) -> Self
pub(crate) const fn new(mtd_number: u32) -> Self
Returns the options for MTD device mtd_number with nothing set.
pub const fn number(self, number: u32) -> Self
pub const fn number(self, number: u32) -> Self
Sets the number of the new UBI device. By default, the kernel picks one.
pub const fn vid_header_offset(self, offset: u32) -> Self
pub const fn vid_header_offset(self, offset: u32) -> Self
Sets the offset of the VID header in each physical eraseblock. By default, it follows the EC header at the next subpage.
pub const fn max_beb_per1024(self, count: u16) -> Self
pub const fn max_beb_per1024(self, count: u16) -> Self
Sets the most bad physical eraseblocks expected per 1024, from 0 to
768. UBI reserves blocks to replace them. By default, the kernel uses
CONFIG_MTD_UBI_BEB_LIMIT. Added in Linux 3.7.
pub const fn disable_fastmap(self) -> Self
pub const fn disable_fastmap(self) -> Self
Stops using fastmap and removes an existing one. Added in Linux 6.1.
pub const fn reserve_pool(self) -> Self
pub const fn reserve_pool(self) -> Self
Reserves free physical eraseblocks for the fastmap pools. Added in Linux 6.7.
pub const fn wl_threshold(self, threshold: u32) -> Self
pub const fn wl_threshold(self, threshold: u32) -> Self
Sets the largest difference between the highest and the lowest erase
counter before wear leveling moves data, from 2 to 65536. By default,
the kernel uses CONFIG_MTD_UBI_WL_THRESHOLD. Added in Linux 7.3.
pub fn run(&self) -> Result<DeviceInfo, DeviceError>
pub fn run(&self) -> Result<DeviceInfo, DeviceError>
Attaches the MTD device to UBI with these options.
§Errors
Returns DeviceError::OutOfRange if a number doesn’t fit into the
request of the kernel, DeviceError::Attach if the kernel refuses
to attach, for example because the MTD device is attached already,
and another error if the UBI control device or the new device in
sysfs can’t be read.
fn request(&self) -> Result<UbiAttachReq, DeviceError>
fn request(&self) -> Result<UbiAttachReq, DeviceError>
Returns the request of the kernel.
Trait Implementations§
§impl Clone for AttachOptions
impl Clone for AttachOptions
§fn clone(&self) -> AttachOptions
fn clone(&self) -> AttachOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more