From 7af0771f9a3031acc36a6990d07bdb92a61c0c75 Mon Sep 17 00:00:00 2001 From: Chuyan Zhang Date: Wed, 29 Nov 2023 03:29:34 -0800 Subject: symlink, probably not working --- src/utils/mod.rs | 20 -------------------- src/utils/permissions.rs | 4 ++-- 2 files changed, 2 insertions(+), 22 deletions(-) (limited to 'src/utils') 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 之一设置才可以 -- cgit v1.2.3-70-g09d2