1
- //! Block Device support
1
+ //! Traits and types for working with Block Devices.
2
2
//!
3
3
//! Generic code for handling block devices, such as types for identifying
4
4
//! a particular block on a block device by its index.
5
5
6
- /// Represents a standard 512 byte block (also known as a sector). IBM PC
7
- /// formatted 5.25" and 3.5" floppy disks, SD/MMC cards up to 1 GiB in size
8
- /// and IDE/SATA Hard Drives up to about 2 TiB all have 512 byte blocks.
6
+ /// A standard 512 byte block (also known as a sector).
7
+ ///
8
+ /// IBM PC formatted 5.25" and 3.5" floppy disks, IDE/SATA Hard Drives up to
9
+ /// about 2 TiB, and almost all SD/MMC cards have 512 byte blocks.
9
10
///
10
11
/// This library does not support devices with a block size other than 512
11
12
/// bytes.
@@ -15,15 +16,17 @@ pub struct Block {
15
16
pub contents : [ u8 ; Block :: LEN ] ,
16
17
}
17
18
18
- /// Represents the linear numeric address of a block (or sector). The first
19
- /// block on a disk gets `BlockIdx(0)` (which usually contains the Master Boot
20
- /// Record).
19
+ /// The linear numeric address of a block (or sector).
20
+ ///
21
+ /// The first block on a disk gets `BlockIdx(0)` (which usually contains the
22
+ /// Master Boot Record).
21
23
#[ cfg_attr( feature = "defmt-log" , derive( defmt:: Format ) ) ]
22
24
#[ derive( Debug , Copy , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
23
25
pub struct BlockIdx ( pub u32 ) ;
24
26
25
- /// Represents the a number of blocks (or sectors). Add this to a `BlockIdx`
26
- /// to get an actual address on disk.
27
+ /// The a number of blocks (or sectors).
28
+ ///
29
+ /// Add this to a `BlockIdx` to get an actual address on disk.
27
30
#[ cfg_attr( feature = "defmt-log" , derive( defmt:: Format ) ) ]
28
31
#[ derive( Debug , Copy , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
29
32
pub struct BlockCount ( pub u32 ) ;
@@ -34,7 +37,7 @@ pub struct BlockIter {
34
37
current : BlockIdx ,
35
38
}
36
39
37
- /// Represents a block device - a device which can read and write blocks (or
40
+ /// A block device - a device which can read and write blocks (or
38
41
/// sectors). Only supports devices which are <= 2 TiB in size.
39
42
pub trait BlockDevice {
40
43
/// The errors that the `BlockDevice` can return. Must be debug formattable.
0 commit comments