rename Volume::len
to Volume::size
This commit is contained in:
parent
d24fde3c3d
commit
83a9d706a3
|
@ -64,7 +64,7 @@ impl BlockGroupDescriptor {
|
||||||
{
|
{
|
||||||
let end =
|
let end =
|
||||||
offset + Address::from(mem::size_of::<BlockGroupDescriptor>());
|
offset + Address::from(mem::size_of::<BlockGroupDescriptor>());
|
||||||
if haystack.len() < end {
|
if haystack.size() < end {
|
||||||
return Err(Error::AddressOutOfBounds(
|
return Err(Error::AddressOutOfBounds(
|
||||||
end.sector(),
|
end.sector(),
|
||||||
end.offset(),
|
end.offset(),
|
||||||
|
@ -92,7 +92,7 @@ impl BlockGroupDescriptor {
|
||||||
{
|
{
|
||||||
let end = offset
|
let end = offset
|
||||||
+ Address::from(count * mem::size_of::<BlockGroupDescriptor>());
|
+ Address::from(count * mem::size_of::<BlockGroupDescriptor>());
|
||||||
if haystack.len() < end {
|
if haystack.size() < end {
|
||||||
return Err(Error::AddressOutOfBounds(
|
return Err(Error::AddressOutOfBounds(
|
||||||
end.sector(),
|
end.sector(),
|
||||||
end.offset(),
|
end.offset(),
|
||||||
|
|
|
@ -113,7 +113,7 @@ impl Inode {
|
||||||
}
|
}
|
||||||
|
|
||||||
let end = offset + Address::from(size);
|
let end = offset + Address::from(size);
|
||||||
if haystack.len() < end {
|
if haystack.size() < end {
|
||||||
return Err(Error::AddressOutOfBounds(
|
return Err(Error::AddressOutOfBounds(
|
||||||
end.sector(),
|
end.sector(),
|
||||||
end.offset(),
|
end.offset(),
|
||||||
|
@ -127,10 +127,6 @@ impl Inode {
|
||||||
|
|
||||||
Ok(inode)
|
Ok(inode)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn in_use(&self) -> bool {
|
|
||||||
self.hard_links > 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
|
|
@ -203,7 +203,7 @@ impl Superblock {
|
||||||
{
|
{
|
||||||
let offset = Address::from(1024_usize);
|
let offset = Address::from(1024_usize);
|
||||||
let end = offset + Address::from(mem::size_of::<Superblock>());
|
let end = offset + Address::from(mem::size_of::<Superblock>());
|
||||||
if haystack.len() < end {
|
if haystack.size() < end {
|
||||||
return Err(Error::AddressOutOfBounds(
|
return Err(Error::AddressOutOfBounds(
|
||||||
end.sector(),
|
end.sector(),
|
||||||
end.offset(),
|
end.offset(),
|
||||||
|
|
|
@ -19,7 +19,7 @@ where
|
||||||
{
|
{
|
||||||
type Error;
|
type Error;
|
||||||
|
|
||||||
fn len(&self) -> Length<Idx>;
|
fn size(&self) -> Length<Idx>;
|
||||||
fn commit(
|
fn commit(
|
||||||
&mut self,
|
&mut self,
|
||||||
slice: Option<VolumeCommit<T, Idx>>,
|
slice: Option<VolumeCommit<T, Idx>>,
|
||||||
|
@ -33,7 +33,7 @@ where
|
||||||
&'a self,
|
&'a self,
|
||||||
range: Range<Idx>,
|
range: Range<Idx>,
|
||||||
) -> Option<VolumeSlice<'a, T, 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)) }
|
unsafe { Some(self.slice_unchecked(range)) }
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -235,7 +235,7 @@ macro_rules! impl_slice {
|
||||||
{
|
{
|
||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
|
|
||||||
fn len(&self) -> Length<Address<S>> {
|
fn size(&self) -> Length<Address<S>> {
|
||||||
Length::Bounded(
|
Length::Bounded(
|
||||||
Address::from(<Self as AsRef<[T]>>::as_ref(self).len())
|
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> {
|
impl<S: Size + PartialOrd + Copy> Volume<u8, Address<S>> for RefCell<File> {
|
||||||
type Error = io::Error;
|
type Error = io::Error;
|
||||||
|
|
||||||
fn len(&self) -> Length<Address<S>> {
|
fn size(&self) -> Length<Address<S>> {
|
||||||
Length::Bounded(
|
Length::Bounded(
|
||||||
self.borrow()
|
self.borrow()
|
||||||
.metadata()
|
.metadata()
|
||||||
|
|
Reference in a new issue