mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-08 21:06:48 +00:00
Add an API for BioRequest to return the number of sectors
This commit is contained in:
parent
0078c18068
commit
4fff7cdc22
@ -163,6 +163,13 @@ impl BioRequest {
|
||||
self.bios.iter()
|
||||
}
|
||||
|
||||
/// Returns the number of sectors of this request.
|
||||
pub fn num_sectors(&self) -> usize {
|
||||
(self.sid_range.end.to_raw() - self.sid_range.start.to_raw())
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// Returns the number of segments.
|
||||
pub fn num_segments(&self) -> usize {
|
||||
self.num_segments
|
||||
|
Loading…
x
Reference in New Issue
Block a user