From 7cd7cfd3ceb9fd6c9c13c5edf92fb8fa24b855f4 Mon Sep 17 00:00:00 2001 From: buhe Date: Mon, 29 Nov 2021 14:45:44 +0800 Subject: [PATCH] fix bug --- fs-fat-fuse/src/main.rs | 24 ++++++++++++------- fs-fat/src/fat_layout.rs | 2 +- .../src/bin/{pipe_large_test.rs => pipe_l.rs} | 0 3 files changed, 17 insertions(+), 9 deletions(-) rename user/src/bin/{pipe_large_test.rs => pipe_l.rs} (100%) diff --git a/fs-fat-fuse/src/main.rs b/fs-fat-fuse/src/main.rs index fbc1845..fe96931 100644 --- a/fs-fat-fuse/src/main.rs +++ b/fs-fat-fuse/src/main.rs @@ -94,7 +94,10 @@ fn easy_fs_pack() -> std::io::Result<()> { let inode = root_inode.create(app.as_str(), ATTRIBUTE_ARCHIVE); // write data to easy-fs match inode { - Some(i) => {i.write_at(0, all_data.as_slice());}, + Some(i) => { + println!("create {}", &app); + i.write_at(0, all_data.as_slice()); + }, None => {println!("Not create app.")}, } @@ -106,13 +109,18 @@ fn easy_fs_pack() -> std::io::Result<()> { let hello_app = root_inode.find("hello").unwrap(); hello_app.read_at(0, &mut cache); println!("hello app data {:?}", cache); - hello_app.clear(); - println!("clear hello app"); - let hello_clear = root_inode.find("hello"); - match hello_clear { - Some(_) => {}, - None => {println!("can not found hello..")}, - } + // hello_app.clear(); + // // write_dev(); + // println!("clear hello app"); + // assert_eq!( + // hello_app.read_at(0, &mut cache), + // 0, + // ); + // let hello_clear = root_inode.find("hello"); + // match hello_clear { + // Some(_) => {println!("hello alreadly found..")}, + // None => {println!("can not found hello..")}, + // } Ok(()) } diff --git a/fs-fat/src/fat_layout.rs b/fs-fat/src/fat_layout.rs index 8aa3534..04dfc6c 100644 --- a/fs-fat/src/fat_layout.rs +++ b/fs-fat/src/fat_layout.rs @@ -633,7 +633,7 @@ impl ShortDirEntry{ /* 清空文件,删除时使用 */ pub fn clear(&mut self){ self.size = 0; - //self.name[0] = 0xE5; + self.name[0] = 0xE5; self.set_first_cluster(0); } diff --git a/user/src/bin/pipe_large_test.rs b/user/src/bin/pipe_l.rs similarity index 100% rename from user/src/bin/pipe_large_test.rs rename to user/src/bin/pipe_l.rs