mirror of
https://github.com/octoleo/restic.git
synced 2024-11-29 16:23:59 +00:00
parent
23d7d91597
commit
7092af6329
@ -185,6 +185,8 @@ func (d *dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
|||||||
return newFile(ctx, d.root, fs.GenerateDynamicInode(d.inode, name), node)
|
return newFile(ctx, d.root, fs.GenerateDynamicInode(d.inode, name), node)
|
||||||
case "symlink":
|
case "symlink":
|
||||||
return newLink(ctx, d.root, fs.GenerateDynamicInode(d.inode, name), node)
|
return newLink(ctx, d.root, fs.GenerateDynamicInode(d.inode, name), node)
|
||||||
|
case "dev", "chardev", "fifo", "socket":
|
||||||
|
return newOther(ctx, d.root, fs.GenerateDynamicInode(d.inode, name), node)
|
||||||
default:
|
default:
|
||||||
debug.Log(" node %v has unknown type %v", name, node.Type)
|
debug.Log(" node %v has unknown type %v", name, node.Type)
|
||||||
return nil, fuse.ENOENT
|
return nil, fuse.ENOENT
|
||||||
|
41
internal/fuse/other.go
Normal file
41
internal/fuse/other.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// +build !openbsd
|
||||||
|
// +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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user