2018-06-16 06:48:45 +00:00
|
|
|
// +build !netbsd
|
2017-12-03 16:25:00 +00:00
|
|
|
// +build !openbsd
|
2018-03-04 13:30:06 +00:00
|
|
|
// +build !solaris
|
2017-12-03 16:25:00 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package fuse
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bazil.org/fuse"
|
|
|
|
"github.com/restic/restic/internal/restic"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
)
|
|
|
|
|
|
|
|
type other struct {
|
|
|
|
root *Root
|
|
|
|
node *restic.Node
|
|
|
|
inode uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
func newOther(ctx context.Context, root *Root, inode uint64, node *restic.Node) (*other, error) {
|
|
|
|
return &other{root: root, inode: inode, node: node}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *other) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) {
|
|
|
|
return l.node.LinkTarget, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *other) Attr(ctx context.Context, a *fuse.Attr) error {
|
|
|
|
a.Inode = l.inode
|
|
|
|
a.Mode = l.node.Mode
|
|
|
|
|
|
|
|
if !l.root.cfg.OwnerIsRoot {
|
|
|
|
a.Uid = l.node.UID
|
|
|
|
a.Gid = l.node.GID
|
|
|
|
}
|
|
|
|
a.Atime = l.node.AccessTime
|
|
|
|
a.Ctime = l.node.ChangeTime
|
|
|
|
a.Mtime = l.node.ModTime
|
|
|
|
|
|
|
|
a.Nlink = uint32(l.node.Links)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|