Added FUSE support #55

Merged
Elara6331 merged 65 commits from yannickulrich/itd:fuse into master 2023-03-25 22:23:52 +00:00
Showing only changes of commit 85b2145aa5 - Show all commits

View File

@ -317,6 +317,35 @@ func (f *ITNode) Open(ctx context.Context, openFlags uint32) (fh fs.FileHandle,
return nil, 0, syscall.EROFS 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() { func main() {
// This is where we'll mount the FS // This is where we'll mount the FS
mntDir := "/tmp/x" mntDir := "/tmp/x"