func (n *fileNode) Truncate(file fuse.File, size uint64, context *fuse.Context) (code fuse.Status) { if file != nil { return file.Truncate(size) } else if n.backing != "" { return fuse.ToStatus(os.Truncate(n.backing, int64(size))) } return fuse.OK }
func (me *memNode) Truncate(file fuse.File, size uint64, context *fuse.Context) (code fuse.Status) { me.mutex.Lock() defer me.mutex.Unlock() me.promote() if file != nil { code = file.Truncate(size) } else { code = fuse.ToStatus(os.Truncate(me.backing, int64(size))) } if code.Ok() { me.info.Size = size me.touch() } return code }