0
go-fuse : nodefs를 사용하여 FUSE 파일 시스템을 만들었습니다. 파일을 제외하고는 모두 작동하지 않습니다.go-fuse 열린 파일
type SomeFileNode struct {
nodefs.Node
content string
}
func (this *SomeFileNode) Open(flags uint32, context *fuse.Context) (nodefs.File, fuse.Status) {
return nodefs.NewDataFile([]byte(this.content)), fuse.OK
}
내가 그 파일을 cat
것으로 예상하지만, 아무것도 표준 출력에 인쇄되지 않습니다 :
무엇이 누락 되었습니까?
전체 생식 코드 :
func main() {
mountPoint := "/some/mountpoint"
fs := &SomeFs{Root: &SomeRootNode{nodefs.NewDefaultNode()}}
server, _, err := nodefs.MountRoot(mountPoint, fs.Root, nil)
if err != nil {
log.Fatalln("Mount fail")
os.Exit(1)
}
server.Serve()
}
type SomeFs struct {
Root *SomeRootNode
}
type SomeRootNode struct {
nodefs.Node
}
type SomeFileNode struct {
nodefs.Node
content string
}
func (this *SomeRootNode) OnMount(c *nodefs.FileSystemConnector) {
this.Inode().NewChild("leaf", false, &SomeFileNode{Node: nodefs.NewDefaultNode(), content: "hello"})
}
func (this *SomeFileNode) Open(flags uint32, context *fuse.Context) (nodefs.File, fuse.Status) {
return nodefs.NewDataFile([]byte(this.content)), fuse.OK
}