Skip to main content

MirroredBlockDevice

Struct MirroredBlockDevice 

Source
pub struct MirroredBlockDevice<B: BlockDevice> {
    backend: B,
    mirrored: bool,
    usable_sectors: usize,
}
Expand description

データの二重化 (ミラーリング) & 自動自己修復 (Self-Healing) を提供する上位ブロックデバイス層 SDカード等の外部不揮発性ストレージでは二重化を行い、 RAMディスク等の揮発性メモリでは多重化を行わずに全RAM容量を有効活用する。

Fields§

§backend: B§mirrored: bool§usable_sectors: usize

Implementations§

Source§

impl<B: BlockDevice> MirroredBlockDevice<B>

Source

pub fn new(backend: B) -> Self

Source

pub fn new_mirrored(backend: B) -> Self

Source

pub fn new_single(backend: B) -> Self

Source

pub fn is_mirrored(&self) -> bool

Source

pub fn total_usable_sectors(&self) -> usize

Source

pub fn write_sector( &mut self, sector: usize, data: &[u8], ) -> Result<(), &'static str>

チェックサム (CRC32) 付きでデータをセクタに書き込みします

Source

pub fn read_sector( &mut self, sector: usize, data: &mut [u8], ) -> Result<(), &'static str>

チェックサム (CRC32) 検証付きでセクタからデータを読み込みます (外部記憶ミラーリング時は破損から自動修復)

Source

pub fn force_corrupt_raw_sector( &mut self, sector: usize, ) -> Result<(), &'static str>

デバッグ検証用: 意図的に特定の生セクタを破壊します (自己修復のテストに使用)

Auto Trait Implementations§

§

impl<B> Freeze for MirroredBlockDevice<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for MirroredBlockDevice<B>
where B: RefUnwindSafe,

§

impl<B> Send for MirroredBlockDevice<B>
where B: Send,

§

impl<B> Sync for MirroredBlockDevice<B>
where B: Sync,

§

impl<B> Unpin for MirroredBlockDevice<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for MirroredBlockDevice<B>
where B: UnsafeUnpin,

§

impl<B> UnwindSafe for MirroredBlockDevice<B>
where B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.