Implemented Mkdir

This commit is contained in:
Yannick Ulrich 2023-02-19 19:46:38 +00:00
parent 85b2145aa5
commit 9d3fdeb78f
1 changed files with 27 additions and 0 deletions

View File

@ -346,6 +346,33 @@ func (f *ITNode) Create(ctx context.Context, name string, flags uint32, mode uin
return node, fh, fuseFlags, 0
}
var _ = (fs.NodeMkdirer)((*ITNode)(nil))
func (f *ITNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno) {
if f.kind != 2 {
return nil, syscall.EROFS
}
path := f.path + "/" + name
err := myfs.Mkdir(path)
if err != nil {
return nil, syscall.EROFS
}
ino := uint64(len(inodemap)) + 11
inodemap[path] = ino
stable := fs.StableAttr{
Mode: fuse.S_IFDIR,
Ino: ino,
}
operations := &ITNode{
kind: 2, Ino: ino,
path : path,
}
node := f.NewInode(ctx, operations, stable)
return node, 0
}
func main() {
// This is where we'll mount the FS
mntDir := "/tmp/x"