【问题标题】:Using the go-fuse package in Golang在 Golang 中使用 go-fuse 包
【发布时间】:2014-12-16 20:07:09
【问题描述】:

您好,我即将将我的两个几乎可以正常工作的简单 fuse 文件系统从 bazillion fuse 移植到 go-fuse。 go-fuse api 似乎更复杂。 问题是:

  1. NewServer() 中,使用哪个 RawFileSystem?
  2. 如何实现 read、readdir 等的回调?
  3. 在哪里使用WaitMount()
  4. 什么是DeleteNotify()EntryNotify()

【问题讨论】:

标签: go fuse


【解决方案1】:

好的,我找到了解决方案

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())

最后,点燃保险丝 fs

    server, err := fuse.NewServer(raw, f.dir, optz)
  1. 像这样:

    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)
    
  2. 在第 1 步之后,如下所示:

    server.WaitMount()
    
  3. 我不需要这个。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-17
    • 2018-02-23
    • 1970-01-01
    • 2017-12-07
    • 2013-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多