mirror of
https://github.com/restic/restic.git
synced 2025-12-04 02:31:57 +00:00
Moves files
This commit is contained in:
46
internal/fuse/link.go
Normal file
46
internal/fuse/link.go
Normal file
@@ -0,0 +1,46 @@
|
||||
// +build !openbsd
|
||||
// +build !windows
|
||||
|
||||
package fuse
|
||||
|
||||
import (
|
||||
"restic"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Statically ensure that *file implements the given interface
|
||||
var _ = fs.NodeReadlinker(&link{})
|
||||
|
||||
type link struct {
|
||||
root *Root
|
||||
node *restic.Node
|
||||
inode uint64
|
||||
}
|
||||
|
||||
func newLink(ctx context.Context, root *Root, inode uint64, node *restic.Node) (*link, error) {
|
||||
return &link{root: root, inode: inode, node: node}, nil
|
||||
}
|
||||
|
||||
func (l *link) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) {
|
||||
return l.node.LinkTarget, nil
|
||||
}
|
||||
|
||||
func (l *link) 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
|
||||
}
|
||||
Reference in New Issue
Block a user