Skip to content

Commit 67dcf4e

Browse files
Andreas Hindborgkawasaki
authored andcommitted
rust: block: add block related constants
Add a few block subsystem constants to the rust `kernel::block` name space. This makes it easier to access the constants from rust code. Signed-off-by: Andreas Hindborg <[email protected]>
1 parent 5ac77a0 commit 67dcf4e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

rust/kernel/block.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@
33
//! Types for working with the block layer.
44
55
pub mod mq;
6+
7+
/// Bit mask for masking out [`SECTOR_SIZE`]
8+
pub const SECTOR_MASK: u32 = bindings::SECTOR_MASK;
9+
10+
/// Sectors are size `1 << SECTOR_SHIFT`.
11+
pub const SECTOR_SHIFT: u32 = bindings::SECTOR_SHIFT;
12+
13+
/// Size of a sector.
14+
pub const SECTOR_SIZE: u32 = bindings::SECTOR_SIZE;
15+
16+
/// Power of two difference in size of a page and size of a sector.
17+
pub const PAGE_SECTORS_SHIFT: u32 = bindings::PAGE_SECTORS_SHIFT;

0 commit comments

Comments
 (0)