diff --git a/src/sys/block_group.rs b/src/sys/block_group.rs index 2cc40e7..5a713d8 100644 --- a/src/sys/block_group.rs +++ b/src/sys/block_group.rs @@ -64,7 +64,7 @@ impl BlockGroupDescriptor { { let end = offset + Address::from(mem::size_of::()); - if haystack.len() < end { + if haystack.size() < end { return Err(Error::AddressOutOfBounds( end.sector(), end.offset(), @@ -92,7 +92,7 @@ impl BlockGroupDescriptor { { let end = offset + Address::from(count * mem::size_of::()); - if haystack.len() < end { + if haystack.size() < end { return Err(Error::AddressOutOfBounds( end.sector(), end.offset(), diff --git a/src/sys/inode.rs b/src/sys/inode.rs index e537ccb..a969fef 100644 --- a/src/sys/inode.rs +++ b/src/sys/inode.rs @@ -113,7 +113,7 @@ impl Inode { } let end = offset + Address::from(size); - if haystack.len() < end { + if haystack.size() < end { return Err(Error::AddressOutOfBounds( end.sector(), end.offset(), @@ -127,10 +127,6 @@ impl Inode { Ok(inode) } - - pub fn in_use(&self) -> bool { - self.hard_links > 0 - } } bitflags! { diff --git a/src/sys/superblock.rs b/src/sys/superblock.rs index 301bb35..2ad9cc6 100644 --- a/src/sys/superblock.rs +++ b/src/sys/superblock.rs @@ -203,7 +203,7 @@ impl Superblock { { let offset = Address::from(1024_usize); let end = offset + Address::from(mem::size_of::()); - if haystack.len() < end { + if haystack.size() < end { return Err(Error::AddressOutOfBounds( end.sector(), end.offset(), diff --git a/src/volume/mod.rs b/src/volume/mod.rs index f9c5738..1103013 100644 --- a/src/volume/mod.rs +++ b/src/volume/mod.rs @@ -19,7 +19,7 @@ where { type Error; - fn len(&self) -> Length; + fn size(&self) -> Length; fn commit( &mut self, slice: Option>, @@ -33,7 +33,7 @@ where &'a self, range: Range, ) -> Option> { - if self.len() >= range.end && self.len() > range.start { + if self.size() >= range.end && self.size() > range.start { unsafe { Some(self.slice_unchecked(range)) } } else { None @@ -235,7 +235,7 @@ macro_rules! impl_slice { { type Error = Infallible; - fn len(&self) -> Length> { + fn size(&self) -> Length> { Length::Bounded( Address::from(>::as_ref(self).len()) ) @@ -298,7 +298,7 @@ mod file { impl Volume> for RefCell { type Error = io::Error; - fn len(&self) -> Length> { + fn size(&self) -> Length> { Length::Bounded( self.borrow() .metadata()