From b3db8a5a710aa0890c80241ffb3fd9792bf1cbe7 Mon Sep 17 00:00:00 2001 From: Chuyan Zhang Date: Wed, 29 Nov 2023 13:29:03 -0800 Subject: Add rename --- src/disk/allocation.rs | 10 ++++++++-- src/disk/inode.rs | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/disk') 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 { - 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> { 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::(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 { 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() } -- cgit v1.2.3-70-g09d2