dongliu5475 2014-10-21 14:39
浏览 506
已采纳

在Golang中使用go-fuse包

Hello I'm about to port my two almost working simple fuse filesystems from bazillion fuse to go-fuse. go-fuse api seems more complex. The question is:

  1. In NewServer(), which RawFileSystem to use?
  2. How to implement callbacks for read, readdir etc.?
  3. Where to use WaitMount()?
  4. What are DeleteNotify(), EntryNotify()?
  • 写回答

1条回答 默认 最新

  • douju6651 2014-10-25 13:19
    关注

    ok i found the solutions

    1. make a struct that contains nodefs.Node:

        type my_root struct {nodefs.Node}
    

    initialize it

        my = &my_root{Node: nodefs.NewDefaultNode()}
    

    make a connection and a raw filesystem

        con := nodefs.NewFileSystemConnector(my, nil)
        raw := fuse.NewRawFileSystem(con.RawFS())
    

    finally, fire up the fuse fs

        server, err := fuse.NewServer(raw, f.dir, optz)
    
    1. like this:

      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. after step 1, like this:

      server.WaitMount()
      
    3. i didn't need this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 模电中二极管,三极管和电容的应用
  • ¥15 关于模型导入UNITY的.FBX: Check external application preferences.警告。
  • ¥15 气象网格数据与卫星轨道数据如何匹配
  • ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
  • ¥15 微软账户问题不小心注销了好像
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused
  • ¥20 关于web前端如何播放二次加密m3u8视频的问题
  • ¥15 使用百度地图api 位置函数报错?
  • ¥15 metamask如何添加TRON自定义网络