Implementing remove

This commit is contained in:
Yannick Ulrich 2023-02-19 20:02:20 +00:00
parent 82ed906857
commit 9d28a2a1f8
1 changed files with 15 additions and 0 deletions

View File

@ -390,6 +390,21 @@ func (f *ITNode) Rename(ctx context.Context, name string, newParent fs.InodeEmbe
return 0
}
var _ = (fs.NodeUnlinker)((*ITNode)(nil))
func (f *ITNode) Unlink(ctx context.Context, name string) syscall.Errno {
delete(inodemap, f.path + "/" + name)
err := myfs.Remove(f.path + "/" + name)
if err != nil {
return syscall.EROFS
}
return 0
}
var _ = (fs.NodeRmdirer)((*ITNode)(nil))
func (f *ITNode) Rmdir(ctx context.Context, name string) syscall.Errno {
return f.Unlink(ctx, name)
}
func main() {
// This is where we'll mount the FS
mntDir := "/tmp/x"