Skip to content

Commit 19c37c9

Browse files
Andreas Hindborgaxboe
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. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-11-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8c32697 commit 19c37c9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

rust/kernel/block.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,16 @@
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+
/// The difference between the size of a page and the size of a sector,
17+
/// expressed as a power of two.
18+
pub const PAGE_SECTORS_SHIFT: u32 = bindings::PAGE_SECTORS_SHIFT;

0 commit comments

Comments
 (0)