Rework reading from device and clean up.

This commit is contained in:
Olivia Brooks
2025-12-29 11:02:13 -05:00
parent 824d01be95
commit e08e2a0017
10 changed files with 628 additions and 536 deletions

22
src/mapping/domain.rs Normal file
View File

@@ -0,0 +1,22 @@
use serde::{Deserialize, Serialize};
/// Domain, in sectors.
/// Requires sector_size to be provided elsewhere for conversion to bytes.
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
pub struct Domain {
pub start: usize,
pub end: usize,
}
impl Default for Domain {
fn default() -> Self {
Domain { start: 0, end: 1 }
}
}
impl Domain {
/// Return length of domain in sectors.
pub fn len(self) -> usize {
self.end - self.start
}
}