go - 在 Golang 中使用 go-fuse 包

标签 go fuse

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

  1. NewServer() 中,使用哪个 RawFileSystem?
  2. 如何实现 read、readdir 等的回调?
  3. 在哪里使用 WaitMount()
  4. 什么是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)
  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. 我不需要这个。

关于go - 在 Golang 中使用 go-fuse 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26489416/

相关文章:

go - 在 go 的 while-equivalent 中分配和比较?

go - 如何制作unix套接字监听器

go - Float64 在 go 中键入常量,失去精度

linux - git 在内部使用符号链接(symbolic link)吗? ( fuse 相关)

c - 选择在写入时阻止接收 ENOSPC

mysql - 如何防止gorm将自定义整数类型转换为字符串?

go - 带有聚合和分组的 mgo

python - CUSE IOCTL 使用包含指向字符数组的指针的结构进行回复

c - 如何在 AVR 编程上配置 CKDIV8 熔丝

linux - 如何使用fuse挂载远程计算机中的目录?