瀏覽代碼

refactor: rename crate as another_ext4

liujingx 10 月之前
父節點
當前提交
4474ef05df
共有 8 個文件被更改,包括 74 次插入46 次删除
  1. 7 14
      Cargo.lock
  2. 1 2
      Cargo.toml
  3. 44 10
      ext4_fuse/Cargo.lock
  4. 2 1
      ext4_fuse/Cargo.toml
  5. 9 16
      ext4_test/Cargo.lock
  6. 1 1
      ext4_test/Cargo.toml
  7. 1 1
      ext4_test/src/block_file.rs
  8. 9 1
      ext4_test/src/main.rs

+ 7 - 14
Cargo.lock

@@ -3,26 +3,19 @@
 version = 3
 
 [[package]]
-name = "bitflags"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
-
-[[package]]
-name = "byteorder"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
-
-[[package]]
-name = "ext4_rs"
+name = "another_ext4"
 version = "0.1.0"
 dependencies = [
  "bitflags",
- "byteorder",
  "log",
 ]
 
+[[package]]
+name = "bitflags"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
+
 [[package]]
 name = "log"
 version = "0.4.21"

+ 1 - 2
Cargo.toml

@@ -1,9 +1,8 @@
 [package]
-name = "ext4_rs"
+name = "another_ext4"
 version = "0.1.0"
 edition = "2021"
 
 [dependencies]
 bitflags = "2.2.1"
-byteorder = "1.5.0"
 log = "0.4"

+ 44 - 10
ext4_fuse/Cargo.lock

@@ -2,6 +2,14 @@
 # It is not intended for manual editing.
 version = 3
 
+[[package]]
+name = "another_ext4"
+version = "0.1.0"
+dependencies = [
+ "bitflags",
+ "log",
+]
+
 [[package]]
 name = "anstream"
 version = "0.6.14"
@@ -63,6 +71,18 @@ version = "1.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
 
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "cfg_aliases"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
+
 [[package]]
 name = "clap"
 version = "4.5.6"
@@ -119,6 +139,16 @@ dependencies = [
  "windows-sys 0.48.0",
 ]
 
+[[package]]
+name = "ctrlc"
+version = "3.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
+dependencies = [
+ "nix",
+ "windows-sys 0.52.0",
+]
+
 [[package]]
 name = "deranged"
 version = "0.3.11"
@@ -132,22 +162,14 @@ dependencies = [
 name = "ext4_fuse"
 version = "0.1.0"
 dependencies = [
+ "another_ext4",
  "clap",
- "ext4_rs",
+ "ctrlc",
  "fuser",
  "log",
  "simple_logger",
 ]
 
-[[package]]
-name = "ext4_rs"
-version = "0.1.0"
-dependencies = [
- "bitflags",
- "byteorder",
- "log",
-]
-
 [[package]]
 name = "fuser"
 version = "0.13.0"
@@ -205,6 +227,18 @@ version = "2.7.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
 
+[[package]]
+name = "nix"
+version = "0.28.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
+dependencies = [
+ "bitflags",
+ "cfg-if",
+ "cfg_aliases",
+ "libc",
+]
+
 [[package]]
 name = "num-conv"
 version = "0.1.0"

+ 2 - 1
ext4_fuse/Cargo.toml

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

+ 9 - 16
ext4_test/Cargo.lock

@@ -2,18 +2,20 @@
 # It is not intended for manual editing.
 version = 3
 
+[[package]]
+name = "another_ext4"
+version = "0.1.0"
+dependencies = [
+ "bitflags",
+ "log",
+]
+
 [[package]]
 name = "bitflags"
 version = "2.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
 
-[[package]]
-name = "byteorder"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
-
 [[package]]
 name = "colored"
 version = "2.1.0"
@@ -33,20 +35,11 @@ dependencies = [
  "powerfmt",
 ]
 
-[[package]]
-name = "ext4_rs"
-version = "0.1.0"
-dependencies = [
- "bitflags",
- "byteorder",
- "log",
-]
-
 [[package]]
 name = "ext4_test"
 version = "0.1.0"
 dependencies = [
- "ext4_rs",
+ "another_ext4",
  "log",
  "simple_logger",
 ]

+ 1 - 1
ext4_test/Cargo.toml

@@ -4,6 +4,6 @@ version = "0.1.0"
 edition = "2021"
 
 [dependencies]
-ext4_rs = { path = ".." }
+another_ext4 = { path = ".." }
 simple_logger = "4.3"
 log = "0.4"

+ 1 - 1
ext4_test/src/block_file.rs

@@ -1,4 +1,4 @@
-use ext4_rs::{Block, BlockDevice, BLOCK_SIZE};
+use another_ext4::{Block, BlockDevice, BLOCK_SIZE};
 use std::fs::{File, OpenOptions};
 use std::io::{Read, Seek, SeekFrom, Write};
 

+ 9 - 1
ext4_test/src/main.rs

@@ -1,5 +1,5 @@
 use block_file::BlockFile;
-use ext4_rs::{Ext4, InodeMode, OpenFlags, EXT4_ROOT_INO};
+use another_ext4::{Ext4, InodeMode, OpenFlags, EXT4_ROOT_INO};
 use simple_logger::SimpleLogger;
 use std::sync::Arc;
 
@@ -29,6 +29,14 @@ fn open_ext4() -> Ext4 {
 
 fn mkdir_test(ext4: &mut Ext4) {
     let dir_mode: InodeMode = InodeMode::DIRECTORY | InodeMode::ALL_RWX;
+    for i in 0..1000 {
+        ext4.generic_create(ROOT_INO, &format!("d{}", i), dir_mode)
+            .expect("mkdir failed");
+    }
+    for i in 0..1000 {
+        ext4.generic_lookup(ROOT_INO, &format!("d{}", i))
+            .expect("lookup failed");
+    }
     ext4.generic_create(ROOT_INO, "d1", dir_mode)
         .expect("mkdir failed");
     ext4.generic_create(ROOT_INO, "d1/d2", dir_mode)