2022-03-28 20:23:47 +00:00
|
|
|
//go:build darwin || freebsd || linux
|
2020-05-12 09:30:41 +00:00
|
|
|
// +build darwin freebsd linux
|
2017-12-03 16:25:00 +00:00
|
|
|
|
|
|
|
package fuse
|
|
|
|
|
|
|
|
import (
|
2020-10-05 21:09:52 +00:00
|
|
|
"context"
|
|
|
|
|
2022-11-12 13:52:37 +00:00
|
|
|
"github.com/anacrolix/fuse"
|
2017-12-03 16:25:00 +00:00
|
|
|
"github.com/restic/restic/internal/restic"
|
|
|
|
)
|
|
|
|
|
|
|
|
type other struct {
|
|
|
|
root *Root
|
|
|
|
node *restic.Node
|
|
|
|
inode uint64
|
|
|
|
}
|
|
|
|
|
2022-08-19 18:29:33 +00:00
|
|
|
func newOther(root *Root, inode uint64, node *restic.Node) (*other, error) {
|
2017-12-03 16:25:00 +00:00
|
|
|
return &other{root: root, inode: inode, node: node}, nil
|
|
|
|
}
|
|
|
|
|
2023-05-18 17:18:09 +00:00
|
|
|
func (l *other) Readlink(_ context.Context, req *fuse.ReadlinkRequest) (string, error) {
|
2017-12-03 16:25:00 +00:00
|
|
|
return l.node.LinkTarget, nil
|
|
|
|
}
|
|
|
|
|
2023-05-18 17:18:09 +00:00
|
|
|
func (l *other) Attr(_ context.Context, a *fuse.Attr) error {
|
2017-12-03 16:25:00 +00:00
|
|
|
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
|
|
|
|
}
|