From acff8d558615f8f045e86de45cf298362f211d59 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Thu, 28 Mar 2019 10:44:22 +0800 Subject: [PATCH] fix truncate in FUSE --- rcore-fs-fuse/src/fuse.rs | 5 ++++- rcore-fs-sefs/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rcore-fs-fuse/src/fuse.rs b/rcore-fs-fuse/src/fuse.rs index 6ba5f51..c15c500 100644 --- a/rcore-fs-fuse/src/fuse.rs +++ b/rcore-fs-fuse/src/fuse.rs @@ -130,7 +130,7 @@ impl Filesystem for VfsFuse { mode: Option, uid: Option, gid: Option, - _size: Option, + size: Option, atime: Option, mtime: Option, _fh: Option, @@ -141,6 +141,9 @@ impl Filesystem for VfsFuse { reply: ReplyAttr, ) { let inode = try_vfs!(reply, self.get_inode(ino)); + if let Some(size) = size { + try_vfs!(reply, inode.resize(size as usize)); + } let mut info = try_vfs!(reply, inode.metadata()); if let Some(mode) = mode { info.mode = mode as u16; diff --git a/rcore-fs-sefs/src/lib.rs b/rcore-fs-sefs/src/lib.rs index cea64f4..961b187 100644 --- a/rcore-fs-sefs/src/lib.rs +++ b/rcore-fs-sefs/src/lib.rs @@ -425,7 +425,7 @@ impl Drop for INodeImpl { } } -/// Simple Encrypt File System +/// Simple Encrypted File System pub struct SEFS { /// on-disk superblock super_block: RwLock>,