From 9d1368b0ea380a9446b4697af668d1685464b6c7 Mon Sep 17 00:00:00 2001 From: Chuyan Zhang Date: Sun, 26 Nov 2023 02:33:01 -0800 Subject: more code idk what they are im so tired ohno --- src/disk/inode.rs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/disk/inode.rs') diff --git a/src/disk/inode.rs b/src/disk/inode.rs index 256d2f5..6f9d338 100644 --- a/src/disk/inode.rs +++ b/src/disk/inode.rs @@ -1,6 +1,6 @@ +use crate::utils; use bitflags::bitflags; use fuser::{FileAttr, FileType}; -use crate::utils; pub const DIRECT_NUMBER: usize = 15; @@ -103,7 +103,6 @@ impl From for u8 { } } - /// Pretty much the same with ext2, with minor changes: /// - removed OS dependent attributes (osd1 & osd2) /// - removed i_faddr since fragmentation is not supported @@ -153,7 +152,7 @@ impl Inode { mtime: time, crtime: time, gid, - n_links: 0, + n_links: 1, n_blocks: 0, flags, direct: [0; DIRECT_NUMBER], @@ -242,7 +241,26 @@ impl Inode { } pub fn empty() -> Self { - Self::new(InodeMode(0), 0, 0, 0, 0, 0, 0, 0) + Self { + mode: InodeMode(0), + uid: 0, + size: 0, + atime: 0, + ctime: 0, + mtime: 0, + crtime: 0, + gid: 0, + n_links: 0, + n_blocks: 0, + flags: 0, + direct: [0; 15], + single_indirect: 0, + double_indirect: 0, + triple_indirect: 0, + generation: 0, + file_acl: 0, + dir_acl: 0, + } } } pub const INODE_SIZE: usize = std::mem::size_of::(); -- cgit v1.2.3-70-g09d2