forked from TrueCloudLab/restic
fuse: Clean up inode generation
This commit is contained in:
parent
189e0fe5a9
commit
c9c7671c58
2 changed files with 9 additions and 7 deletions
|
@ -204,15 +204,16 @@ func (d *dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||||
debug.Log(" Lookup(%v) -> not found", name)
|
debug.Log(" Lookup(%v) -> not found", name)
|
||||||
return nil, fuse.ENOENT
|
return nil, fuse.ENOENT
|
||||||
}
|
}
|
||||||
|
inode := inodeFromNode(d.inode, node)
|
||||||
switch node.Type {
|
switch node.Type {
|
||||||
case "dir":
|
case "dir":
|
||||||
return newDir(d.root, inodeFromNode(d.inode, node), d.inode, node)
|
return newDir(d.root, inode, d.inode, node)
|
||||||
case "file":
|
case "file":
|
||||||
return newFile(d.root, inodeFromNode(d.inode, node), node)
|
return newFile(d.root, inode, node)
|
||||||
case "symlink":
|
case "symlink":
|
||||||
return newLink(d.root, inodeFromNode(d.inode, node), node)
|
return newLink(d.root, inode, node)
|
||||||
case "dev", "chardev", "fifo", "socket":
|
case "dev", "chardev", "fifo", "socket":
|
||||||
return newOther(d.root, inodeFromNode(d.inode, node), node)
|
return newOther(d.root, inode, 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
|
||||||
|
|
|
@ -104,12 +104,13 @@ func (d *SnapshotsDir) Lookup(ctx context.Context, name string) (fs.Node, error)
|
||||||
|
|
||||||
entry := meta.names[name]
|
entry := meta.names[name]
|
||||||
if entry != nil {
|
if entry != nil {
|
||||||
|
inode := inodeFromName(d.inode, name)
|
||||||
if entry.linkTarget != "" {
|
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 {
|
} else if entry.snapshot != nil {
|
||||||
return newDirFromSnapshot(d.root, inodeFromName(d.inode, name), entry.snapshot)
|
return newDirFromSnapshot(d.root, inode, entry.snapshot)
|
||||||
} else {
|
} 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue