Implemented Create
This commit is contained in:
parent
74afbc7c20
commit
85b2145aa5
29
fuse/main.go
29
fuse/main.go
@ -317,6 +317,35 @@ func (f *ITNode) Open(ctx context.Context, openFlags uint32) (fh fs.FileHandle,
|
||||
return nil, 0, syscall.EROFS
|
||||
}
|
||||
|
||||
var _ = (fs.NodeCreater)((*ITNode)(nil))
|
||||
func (f *ITNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (node *fs.Inode, fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno) {
|
||||
if f.kind != 2 {
|
||||
return nil, nil, 0, syscall.EROFS
|
||||
}
|
||||
|
||||
path := f.path + "/" + name
|
||||
ino := uint64(len(inodemap)) + 11
|
||||
inodemap[path] = ino
|
||||
|
||||
stable := fs.StableAttr{
|
||||
Mode: fuse.S_IFREG,
|
||||
Ino: ino,
|
||||
}
|
||||
operations := &ITNode{
|
||||
kind: 2, Ino: ino,
|
||||
path : path,
|
||||
}
|
||||
node = f.NewInode(ctx, operations, stable)
|
||||
|
||||
fh = &bytesFileWriteHandle{
|
||||
path : path,
|
||||
content : make([]byte, 0),
|
||||
}
|
||||
|
||||
errno = 0
|
||||
return node, fh, fuseFlags, 0
|
||||
}
|
||||
|
||||
func main() {
|
||||
// This is where we'll mount the FS
|
||||
mntDir := "/tmp/x"
|
||||
|
Loading…
Reference in New Issue
Block a user