你好,我即将从 bazillion fuse 移植我的两个几乎可以工作的简单 fuse 文件系统。去融合。 go-fuse api似乎更复杂。 问题是:
- 在
NewServer()
中,使用哪个 RawFileSystem? - 如何实现 read、readdir 等的回调?
- 在哪里使用
WaitMount()
? - 什么是
DeleteNotify()
、EntryNotify()
?
最佳答案
好的,我找到了解决方案
1. 创建一个包含 nodefs.Node 的结构:
type my_root struct {nodefs.Node}
初始化
my = &my_root{Node: nodefs.NewDefaultNode()}
建立连接和原始文件系统
con := nodefs.NewFileSystemConnector(my, nil)
raw := fuse.NewRawFileSystem(con.RawFS())
最后,点燃 fuse fs
server, err := fuse.NewServer(raw, f.dir, optz)
像这样:
func (my_root) OpenDir(context *fuse.Context) ([]fuse.DirEntry, fuse.Status) {} func (my_root) Lookup(out *fuse.Attr, name string, context *fuse.Context) (node *nodefs.Inode, code fuse.Status)
在第 1 步之后,像这样:
server.WaitMount()
我不需要这个。
关于go - 在 Golang 中使用 go-fuse 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26489416/