summaryrefslogtreecommitdiff
path: root/src/disk
diff options
context:
space:
mode:
authorChuyan Zhang <me@zcy.moe>2023-11-29 13:29:03 -0800
committerChuyan Zhang <me@zcy.moe>2023-11-29 13:29:03 -0800
commitb3db8a5a710aa0890c80241ffb3fd9792bf1cbe7 (patch)
tree4eca8b17a08a32a7a86217d18f1c5f1c42b8c490 /src/disk
parent7af0771f9a3031acc36a6990d07bdb92a61c0c75 (diff)
downloadmyfs-b3db8a5a710aa0890c80241ffb3fd9792bf1cbe7.tar.gz
myfs-b3db8a5a710aa0890c80241ffb3fd9792bf1cbe7.zip
Add rename
Diffstat (limited to 'src/disk')
-rw-r--r--src/disk/allocation.rs10
-rw-r--r--src/disk/inode.rs10
2 files changed, 15 insertions, 5 deletions
diff --git a/src/disk/allocation.rs b/src/disk/allocation.rs
index d4ad397..d0142c9 100644
--- a/src/disk/allocation.rs
+++ b/src/disk/allocation.rs
@@ -404,7 +404,10 @@ impl AyaFS {
inode: &Inode,
mut block_index_within_inode: usize,
) -> Option<usize> {
- debug!("get_block_index(block_index_within_inode: {})", block_index_within_inode);
+ debug!(
+ "get_block_index(block_index_within_inode: {})",
+ block_index_within_inode
+ );
// direct block
if block_index_within_inode < DIRECT_NUMBER {
let block_index = inode.direct[block_index_within_inode] as usize;
@@ -525,7 +528,10 @@ impl AyaFS {
) -> Option<&mut CachedBlock<T>> {
self.get_block_index(inode, block_index_within_inode)
.map(|block_index| {
- debug!("access_block_mut(index: {}) found", block_index_within_inode);
+ debug!(
+ "access_block_mut(index: {}) found",
+ block_index_within_inode
+ );
self.get_block_mut::<T>(block_index).unwrap() // 可以 unwrap 吧这里 ??
})
}
diff --git a/src/disk/inode.rs b/src/disk/inode.rs
index 1f5e54e..e686d01 100644
--- a/src/disk/inode.rs
+++ b/src/disk/inode.rs
@@ -82,7 +82,9 @@ impl InodeMode {
(self.0 & 0xF000) == Self::IFDIR.0
}
- pub(crate) fn is_symlink(&self) -> bool { self.0 & 0xF000 == Self::IFLNK.0 }
+ pub(crate) fn is_symlink(&self) -> bool {
+ self.0 & 0xF000 == Self::IFLNK.0
+ }
pub(crate) fn validate(mode_value: u16) -> Option<Self> {
let valid_flags: [u16; 7] = [0x1000, 0x2000, 0x4000, 0x6000, 0x8000, 0xA000, 0xC000];
@@ -274,8 +276,10 @@ impl Inode {
self.mode.is_dir()
}
- pub(crate) fn is_symlink(&self) -> bool { self.mode.is_symlink() }
-
+ pub(crate) fn is_symlink(&self) -> bool {
+ self.mode.is_symlink()
+ }
+
pub(crate) fn file_type(&self) -> FileType {
self.mode.into()
}