rename Volume::len to Volume::size

This commit is contained in:
Szymon Walter 2018-03-20 14:56:09 +01:00
parent d24fde3c3d
commit 83a9d706a3
4 changed files with 8 additions and 12 deletions

View file

@ -64,7 +64,7 @@ impl BlockGroupDescriptor {
{
let end =
offset + Address::from(mem::size_of::<BlockGroupDescriptor>());
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::<BlockGroupDescriptor>());
if haystack.len() < end {
if haystack.size() < end {
return Err(Error::AddressOutOfBounds(
end.sector(),
end.offset(),

View file

@ -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! {

View file

@ -203,7 +203,7 @@ impl Superblock {
{
let offset = Address::from(1024_usize);
let end = offset + Address::from(mem::size_of::<Superblock>());
if haystack.len() < end {
if haystack.size() < end {
return Err(Error::AddressOutOfBounds(
end.sector(),
end.offset(),

View file

@ -19,7 +19,7 @@ where
{
type Error;
fn len(&self) -> Length<Idx>;
fn size(&self) -> Length<Idx>;
fn commit(
&mut self,
slice: Option<VolumeCommit<T, Idx>>,
@ -33,7 +33,7 @@ where
&'a self,
range: Range<Idx>,
) -> Option<VolumeSlice<'a, T, Idx>> {
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<Address<S>> {
fn size(&self) -> Length<Address<S>> {
Length::Bounded(
Address::from(<Self as AsRef<[T]>>::as_ref(self).len())
)
@ -298,7 +298,7 @@ mod file {
impl<S: Size + PartialOrd + Copy> Volume<u8, Address<S>> for RefCell<File> {
type Error = io::Error;
fn len(&self) -> Length<Address<S>> {
fn size(&self) -> Length<Address<S>> {
Length::Bounded(
self.borrow()
.metadata()