Example #1
0
File: symlink.go Project: ovh/svfs
// 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
}
Example #2
0
File: object.go Project: ovh/svfs
// 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
}
Example #3
0
func (f *file) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Inode = f.node.Inode
	a.Mode = f.node.Mode
	a.Size = f.node.Size
	a.Blocks = (f.node.Size / blockSize) + 1
	a.BlockSize = blockSize

	if !f.ownerIsRoot {
		a.Uid = f.node.UID
		a.Gid = f.node.GID
	}
	a.Atime = f.node.AccessTime
	a.Ctime = f.node.ChangeTime
	a.Mtime = f.node.ModTime
	return nil
}
Example #4
0
func (t *Node) Attr(ctx context.Context, a *fuse.Attr) error {
	fi, err := os.Stat(t.getTargetPath(""))
	if err != nil {
		return err
	}
	st := fi.Sys().(*syscall.Stat_t)
	a.Nlink = uint32(st.Nlink)
	a.Size = uint64(st.Size)
	a.Gid = st.Gid
	a.Uid = st.Uid
	a.Ctime = time.Unix(st.Ctimespec.Unix())
	a.Blocks = uint64(st.Blocks)
	a.BlockSize = uint32(st.Blksize)
	a.Inode = st.Ino
	a.Mode = fi.Mode()
	logex.Struct(a)
	return nil
}