diff --git a/fuse/main.go b/fuse/main.go index ac1347d..e1a9699 100644 --- a/fuse/main.go +++ b/fuse/main.go @@ -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"