summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/mod.rs20
-rw-r--r--src/utils/permissions.rs4
2 files changed, 2 insertions, 22 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index 0a9b825..468ebdb 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -21,26 +21,6 @@ pub(crate) fn from_systime(system_time: SystemTime) -> u32 {
.as_secs() as u32
}
-pub(crate) fn make_fileattr(inode_index: usize, inode: &Inode) -> FileAttr {
- FileAttr {
- ino: inode_index as u64,
- size: inode.size as u64,
- blocks: inode.n_blocks as u64,
- atime: to_systime(inode.atime),
- mtime: to_systime(inode.atime),
- ctime: to_systime(inode.ctime),
- crtime: to_systime(inode.crtime),
- kind: inode.mode.into(),
- perm: inode.mode.perm(),
- nlink: inode.n_links as u32,
- uid: inode.uid,
- gid: inode.gid,
- rdev: 0, // 我们不会遇到这个的
- blksize: BLOCK_SIZE as u32,
- flags: inode.flags,
- }
-}
-
pub(crate) fn to_systime(time: u32) -> SystemTime {
UNIX_EPOCH + Duration::from_secs(time as u64)
}
diff --git a/src/utils/permissions.rs b/src/utils/permissions.rs
index b1ec999..6773511 100644
--- a/src/utils/permissions.rs
+++ b/src/utils/permissions.rs
@@ -33,14 +33,14 @@ pub(crate) fn check_access(
incoming_gid: u32,
uid: u32,
gid: u32,
- perm: InodeMode,
+ mode: InodeMode,
mut mask: i32,
) -> bool {
if mask == F_OK {
return true;
}
- let perm = i32::from(perm.0);
+ let perm = i32::from(mode.0);
// root
if incoming_uid == 0 {
// 读写任何东西都是可以的, 执行只有 IXOTH/IXGRP/IXUSR 之一设置才可以