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

在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.

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

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站