Browse Source

feat: fuser root inode = 1 feature

liujingx 9 months ago
parent
commit
282418b4b1
3 changed files with 7 additions and 3 deletions
  1. 2 1
      Cargo.toml
  2. 1 1
      ext4_fuse/Cargo.toml
  3. 4 1
      src/constants.rs

+ 2 - 1
Cargo.toml

@@ -9,4 +9,5 @@ log = "0.4"
 axsync = { git = "https://github.com/Starry-OS/axsync.git", optional = true }
 
 [features]
-block_cache = ["dep:axsync"]
+block_cache = ["dep:axsync"]
+fuser_root_inode = []

+ 1 - 1
ext4_fuse/Cargo.toml

@@ -5,7 +5,7 @@ edition = "2021"
 
 [dependencies]
 fuser = "0.13"
-another_ext4 = { path = "..", features = [] }
+another_ext4 = { path = "..", features = ["fuser_root_inode"] }
 simple_logger = "4.3"
 log = "0.4"
 clap = { version = "4.5.6", features = ["derive"] }

+ 4 - 1
src/constants.rs

@@ -15,6 +15,9 @@ pub const NAME_MAX: usize = 255;
 pub const SYMLINKS_MAX: usize = 40;
 
 /// The inode number of root inode
+#[cfg(feature = "fuser_root_inode")]
+pub const EXT4_ROOT_INO: InodeId = 1;
+#[cfg(not(feature = "fuser_root_inode"))]
 pub const EXT4_ROOT_INO: InodeId = 2;
 
 /// The base offset of the super block
@@ -41,4 +44,4 @@ pub const SB_GOOD_DESC_SIZE: usize = 64;
 pub const CACHE_SIZE: usize = 4;
 
 /// Cache associativity.
-pub const CACHE_ASSOC: usize = 4;
+pub const CACHE_ASSOC: usize = 4;