Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
buhe committed Nov 29, 2021
1 parent 23d366b commit 7cd7cfd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
24 changes: 16 additions & 8 deletions fs-fat-fuse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.")},
}

Expand All @@ -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(())
}

Expand Down
2 changes: 1 addition & 1 deletion fs-fat/src/fat_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
File renamed without changes.

0 comments on commit 7cd7cfd

Please sign in to comment.