Implemented Rename
This commit is contained in:
parent
9d3fdeb78f
commit
82ed906857
17
fuse/main.go
17
fuse/main.go
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user