Implemented Rename

This commit is contained in:
Yannick Ulrich 2023-02-19 19:58:34 +00:00
parent 9d3fdeb78f
commit 82ed906857

View File

@ -373,6 +373,23 @@ func (f *ITNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.
return node, 0
}
var _ = (fs.NodeRenamer)((*ITNode)(nil))
func (f *ITNode) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno {
p1 := f.path + "/" + name
p2 := newParent.EmbeddedInode().Path(nil)[2:] + "/" + newName
err := myfs.Rename(p1, p2)
if err != nil {
return syscall.EROFS
}
ino := inodemap[p1]
delete(inodemap, p1)
inodemap[p2] = ino
return 0
}
func main() {
// This is where we'll mount the FS
mntDir := "/tmp/x"