func (f *File) Attr(c context.Context, a *fuse.Attr) error { defer log.Debugln("file_attr:", f.dir.path, f.name, a) f.mu.Lock() defer f.mu.Unlock() return f.dir.fs.backend.View(c, func(ctx Context) error { b, err := ctx.Dir(f.dir.path) if err != nil { return err } meta, err := b.Meta(f.name) if err != nil { return err } a.Uid = meta.Uid a.Gid = meta.Gid a.Mode = meta.Perm a.Nlink = f.links if f.link { a.Mode = a.Mode | os.ModeSymlink } a.Size = uint64(len(f.data)) if f.writers == 0 { // not in memory, fetch correct size. // Attr can't fail, so ignore errors _ = f.load(c, func(buff []byte) { a.Size = uint64(len(buff)) }) } return nil }) }
func (f *File) Attr(ctx context.Context, o *fuse.Attr) error { f.RLock() defer f.RUnlock() *o = f.attr // calculate size if !f.opened { if err := f.dir.reconnectKafkaIfNecessary(); err != nil { return err } latestOffset, err := f.dir.GetOffset(f.topic, f.partitionId, sarama.OffsetNewest) if err != nil { log.Error(err) return err } oldestOffset, err := f.dir.GetOffset(f.topic, f.partitionId, sarama.OffsetOldest) if err != nil { log.Error(err) return err } o.Size = uint64(latestOffset - oldestOffset) } else { o.Size = uint64(len(f.content)) } log.Trace("File Attr, topic=%s, partitionId=%d, size=%d", f.topic, f.partitionId, o.Size) return nil }
func (mi MemInfoFile) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = INODE_MEMINFO a.Mode = 0444 data, _ := mi.readAll() a.Size = uint64(len(data)) return nil }
func (f *file) Attr(ctx context.Context, a *fuse.Attr) (retErr error) { defer func() { if retErr == nil { protolion.Debug(&FileAttr{&f.Node, &Attr{uint32(a.Mode)}, errorToString(retErr)}) } else { protolion.Error(&FileAttr{&f.Node, &Attr{uint32(a.Mode)}, errorToString(retErr)}) } }() fileInfo, err := f.fs.apiClient.InspectFileUnsafe( f.File.Commit.Repo.Name, f.File.Commit.ID, f.File.Path, f.fs.getFromCommitID(f.getRepoOrAliasName()), f.Shard, f.fs.handleID, ) if err != nil { return err } if fileInfo != nil { a.Size = fileInfo.SizeBytes a.Mtime = prototime.TimestampToTime(fileInfo.Modified) } a.Mode = 0666 a.Inode = f.fs.inode(f.File) return nil }
// fillAttr sets attributes based on the entry info. It only handles fields // common to all entryinfo types. func fillAttr(ei *libkbfs.EntryInfo, a *fuse.Attr) { a.Valid = 1 * time.Minute a.Size = ei.Size a.Mtime = time.Unix(0, ei.Mtime) a.Ctime = time.Unix(0, ei.Ctime) }
func (v VMStatFile) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = INODE_VMSTAT a.Mode = 0444 data, _ := v.readAll() a.Size = uint64(len(data)) return nil }
func (f *File) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = 2 a.Mode = 0444 t := f.content.Load().(string) a.Size = uint64(len(t)) return nil }
func (f File) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = 0 a.Mode = f.info.Mode a.Size = uint64(f.info.Size) a.Mtime = f.info.ModTime return nil }
func (n *mutFile) Attr(ctx context.Context, a *fuse.Attr) error { // TODO: don't grab n.mu three+ times in here. var mode os.FileMode = 0600 // writable n.mu.Lock() size := n.size var blocks uint64 if size > 0 { blocks = uint64(size)/512 + 1 } inode := n.permanode.Sum64() if n.symLink { mode |= os.ModeSymlink } n.mu.Unlock() a.Inode = inode a.Mode = mode a.Uid = uint32(os.Getuid()) a.Gid = uint32(os.Getgid()) a.Size = uint64(size) a.Blocks = blocks a.Mtime = n.modTime() a.Atime = n.accessTime() a.Ctime = serverStart a.Crtime = serverStart return nil }
func (f *File) Attr(ctx context.Context, a *fuse.Attr) error { // a.Inode = 2 fmt.Printf("File.Attr(%s) -> size=%d\n", f.path, f.size) a.Mode = 0444 a.Size = f.size return nil }
func (ds DiskStatsFile) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = INODE_DISKSTATS a.Mode = 0444 data, _ := ds.readAll() a.Size = uint64(len(data)) return nil }
func (f File) Attr(a *fuse.Attr) { println(" fac attr") data, _ := pluginManager.ProcessFile(f.Path, f.Name) length := uint64(len(data)) a.Mode = 0444 a.Size = length }
func (f *File) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = f.Inode // FIXME: compute the size dynamically a.Size = uint64(100) a.Mode = 0444 logrus.Infof("File.Attr: ctx=%q, a=%q", ctx, a) return nil }
// Attr is called to retrieve stat-metadata about the directory. func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error { return Errorize("dir-attr", d.fsys.Store.ViewNode(d.path, func(nd store.Node) error { a.Mode = os.ModeDir | 0755 a.Size = nd.Size() a.Mtime = nd.ModTime() return nil })) }
func (f File) Attr(ctx context.Context, a *fuse.Attr) error { entry := f.m.GetEntry(f.folder, f.path) a.Mode = 0444 a.Mtime = time.Unix(entry.Modified, 0) a.Size = uint64(entry.Size()) return nil }
// Attr is called to get the stat(2) attributes of a file. func (e *Entry) Attr(ctx context.Context, a *fuse.Attr) error { return Errorize("entry-attr", e.fsys.Store.ViewNode(e.path, func(nd store.Node) error { a.Mode = 0755 a.Size = nd.Size() a.Mtime = nd.ModTime() return nil })) }
// Attr implements fs.Node. func (f *etcdFile) Attr(ctx context.Context, attr *fuse.Attr) error { attr.Inode = inode(f.n.Key) attr.Size = uint64(len(f.n.Value)) attr.Mode = 0444 // attr.Uid = uint32(os.Getuid()) // attr.Gid = uint32(os.Getgid()) return nil }
func (s staticFileNode) Attr(ctx context.Context, a *fuse.Attr) error { a.Mode = 0400 a.Uid = uint32(os.Getuid()) a.Gid = uint32(os.Getgid()) a.Size = uint64(len(s)) a.Mtime = serverStart a.Ctime = serverStart a.Crtime = serverStart return nil }
func (f File) Attr(ctx context.Context, attr *fuse.Attr) error { val, err := f.KV.Get("web/nginxkey") if err != nil { return err } attr.Inode = 2 attr.Mode = 0444 attr.Size = uint64(len(val)) return nil }
func (this *TreeEntry) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = this.E.Inode a.Mode = this.Mode if this.E.Type == fuse.DT_File { a.Size = this.sizeCallback(this) } return nil }
func (f *file) Attr(ctx context.Context, a *fuse.Attr) error { f.mu.Lock() defer f.mu.Unlock() a.Inode = f.inode a.Mode = 0644 a.Uid = env.MyUID a.Gid = env.MyGID a.Size = f.blob.Size() return nil }
func (e fuseFile) Attr(ctx context.Context, a *fuse.Attr) error { a.Mode = 0444 a.Uid = env.MyUID a.Gid = env.MyGID a.Size = e.de.File.Manifest.Size // a.Mtime = e.Meta.Written.UTC() // a.Ctime = e.Meta.Written.UTC() // a.Crtime = e.Meta.Written.UTC() a.Blocks = statBlocks(e.de.File.Manifest.Size) // TODO .Space? return nil }
func copyAttr(dst *fuse.Attr, src *pb.Attr) { dst.Inode = src.Inode dst.Mode = os.FileMode(src.Mode) dst.Size = src.Size dst.Mtime = time.Unix(src.Mtime, 0) dst.Atime = time.Unix(src.Atime, 0) dst.Ctime = time.Unix(src.Ctime, 0) dst.Crtime = time.Unix(src.Crtime, 0) dst.Uid = src.Uid dst.Gid = src.Gid }
func (f File) Attr(ctx context.Context, a *fuse.Attr) error { a.Mode = f.mode a.Size = f.size a.Atime = f.Atime a.Mtime = f.Mtime a.Ctime = f.Ctime a.Crtime = f.Ctime a.Uid = f.Uid a.Gid = f.Gid return nil }
func (f *File) Attr(ctx context.Context, a *fuse.Attr) error { log.Debugf("path: %s", f.path) f.fs.files[f.path] = f a.Inode = 2 a.Mode = 0444 a.Size = uint64(len(f.content)) a.Valid = time.Second * 1 return nil }
// Attr fills the file attributes for a symlink node. func (s *Symlink) Attr(ctx context.Context, a *fuse.Attr) (err error) { a.Size = uint64(s.so.Bytes) a.BlockSize = 0 a.Blocks = 0 a.Mode = os.ModeSymlink | os.FileMode(DefaultMode) a.Gid = uint32(DefaultGID) a.Uid = uint32(DefaultUID) a.Mtime = getMtime(s.so, s.sh) a.Ctime = a.Mtime a.Crtime = a.Mtime return nil }
func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error { glog.Infof("Entered Attr dir: Artist: %s, Album: %s\n", d.artist, d.album) a.Mode = os.ModeDir | 0777 if config_params.uid != 0 { a.Uid = uint32(config_params.uid) } if config_params.gid != 0 { a.Gid = uint32(config_params.gid) } a.Size = 4096 return nil }
// Attr fills the file attributes for an object node. func (o *Object) Attr(ctx context.Context, a *fuse.Attr) (err error) { a.Size = o.size() a.BlockSize = uint32(BlockSize) a.Blocks = (a.Size / uint64(a.BlockSize)) * 8 a.Mode = os.FileMode(DefaultMode) a.Gid = uint32(DefaultGID) a.Uid = uint32(DefaultUID) a.Mtime = getMtime(o.so, o.sh) a.Ctime = a.Mtime a.Crtime = a.Mtime return nil }
// Converts Attrs datastructure into FUSE represnetation func (this *Attrs) Attr(a *fuse.Attr) error { a.Inode = this.Inode a.Mode = this.Mode if (a.Mode & os.ModeDir) == 0 { a.Size = this.Size } a.Uid = this.Uid a.Gid = this.Gid a.Mtime = this.Mtime a.Ctime = this.Ctime a.Crtime = this.Crtime return nil }
// Attr returns attributes about this Secret func (s Secret) Attr(ctx context.Context, a *fuse.Attr) error { a.Inode = s.inode a.Mode = 0444 content, err := s.ReadAll(ctx) if err != nil { logrus.WithError(err).Error("could not determine content length") return fuse.EIO } a.Size = uint64(len(content)) return nil }