2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 22:27:35 +00:00

fuse: Clean up inode generation

This commit is contained in:
greatroar 2022-11-27 13:53:42 +01:00
parent 189e0fe5a9
commit c9c7671c58
2 changed files with 9 additions and 7 deletions

View File

@ -204,15 +204,16 @@ func (d *dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
debug.Log(" Lookup(%v) -> not found", name)
return nil, fuse.ENOENT
}
inode := inodeFromNode(d.inode, node)
switch node.Type {
case "dir":
return newDir(d.root, inodeFromNode(d.inode, node), d.inode, node)
return newDir(d.root, inode, d.inode, node)
case "file":
return newFile(d.root, inodeFromNode(d.inode, node), node)
return newFile(d.root, inode, node)
case "symlink":
return newLink(d.root, inodeFromNode(d.inode, node), node)
return newLink(d.root, inode, node)
case "dev", "chardev", "fifo", "socket":
return newOther(d.root, inodeFromNode(d.inode, node), node)
return newOther(d.root, inode, node)
default:
debug.Log(" node %v has unknown type %v", name, node.Type)
return nil, fuse.ENOENT

View File

@ -104,12 +104,13 @@ func (d *SnapshotsDir) Lookup(ctx context.Context, name string) (fs.Node, error)
entry := meta.names[name]
if entry != nil {
inode := inodeFromName(d.inode, name)
if entry.linkTarget != "" {
return newSnapshotLink(d.root, inodeFromName(d.inode, name), entry.linkTarget, entry.snapshot)
return newSnapshotLink(d.root, inode, entry.linkTarget, entry.snapshot)
} else if entry.snapshot != nil {
return newDirFromSnapshot(d.root, inodeFromName(d.inode, name), entry.snapshot)
return newDirFromSnapshot(d.root, inode, entry.snapshot)
} else {
return NewSnapshotsDir(d.root, inodeFromName(d.inode, name), d.inode, d.dirStruct, d.prefix+"/"+name), nil
return NewSnapshotsDir(d.root, inode, d.inode, d.dirStruct, d.prefix+"/"+name), nil
}
}