forked from Elara6331/itd
Implemented Mkdir
This commit is contained in:
parent
85b2145aa5
commit
9d3fdeb78f
27
fuse/main.go
27
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"
|
||||
|
Loading…
Reference in New Issue
Block a user