func (n *fileNode) GetAttr(file fuse.File, context *fuse.Context) (fi *fuse.Attr, code fuse.Status) { if file != nil { return file.GetAttr() } a := &fuse.Attr{Mode: fuse.S_IFREG | 0644} if n.backing != "" { fi, err := os.Stat(n.backing) if err != nil { return nil, fuse.ToStatus(err) } a.Size = uint64(fi.Size()) t := n.file.Mtime() if n.dirty { t = fi.ModTime() } a.SetTimes(&t, &t, &t) } else if n.file != nil { a.Size = uint64(n.file.filesize) t := n.file.Mtime() a.SetTimes(&t, &t, &t) } return a, fuse.OK }
func (n *fileNode) GetAttr(out *fuse.Attr, file fuse.File, context *fuse.Context) (code fuse.Status) { if file != nil { return file.GetAttr(out) } out.Mode = fuse.S_IFREG | 0644 f := n.File() if n.backing != "" { fi, err := os.Stat(n.backing) if err != nil { return fuse.ToStatus(err) } out.Size = uint64(fi.Size()) t := f.Mtime() if n.dirty { t = fi.ModTime() } out.SetTimes(&t, &t, &t) } else if f != nil { out.Size = uint64(f.filesize) t := f.Mtime() out.SetTimes(&t, &t, &t) } return fuse.OK }
func (me *memNode) GetAttr(file fuse.File, context *fuse.Context) (fi *fuse.Attr, code fuse.Status) { var sz uint64 if file != nil { fi, code := file.GetAttr() if code.Ok() { sz = fi.Size } else { msg := fmt.Sprintf("File.GetAttr(%s) = %v, %v", file.String(), fi, code) panic(msg) } } me.mutex.RLock() defer me.mutex.RUnlock() info := me.info if file != nil { info.Size = sz } return &info, fuse.OK }