fix truncate in FUSE

master
WangRunji 6 years ago
parent 05a4df20bf
commit acff8d5586

@ -130,7 +130,7 @@ impl Filesystem for VfsFuse {
mode: Option<u32>, mode: Option<u32>,
uid: Option<u32>, uid: Option<u32>,
gid: Option<u32>, gid: Option<u32>,
_size: Option<u64>, size: Option<u64>,
atime: Option<Timespec>, atime: Option<Timespec>,
mtime: Option<Timespec>, mtime: Option<Timespec>,
_fh: Option<u64>, _fh: Option<u64>,
@ -141,6 +141,9 @@ impl Filesystem for VfsFuse {
reply: ReplyAttr, reply: ReplyAttr,
) { ) {
let inode = try_vfs!(reply, self.get_inode(ino)); 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()); let mut info = try_vfs!(reply, inode.metadata());
if let Some(mode) = mode { if let Some(mode) = mode {
info.mode = mode as u16; info.mode = mode as u16;

@ -425,7 +425,7 @@ impl Drop for INodeImpl {
} }
} }
/// Simple Encrypt File System /// Simple Encrypted File System
pub struct SEFS { pub struct SEFS {
/// on-disk superblock /// on-disk superblock
super_block: RwLock<Dirty<SuperBlock>>, super_block: RwLock<Dirty<SuperBlock>>,

Loading…
Cancel
Save