You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
608 B
32 lines
608 B
package mount
|
|
|
|
import (
|
|
"context"
|
|
"syscall"
|
|
|
|
"github.com/hanwen/go-fuse/v2/fs"
|
|
"github.com/hanwen/go-fuse/v2/fuse"
|
|
)
|
|
|
|
type WeedFS struct {
|
|
fs.Inode
|
|
}
|
|
|
|
func (r *WeedFS) OnAdd(ctx context.Context) {
|
|
ch := r.NewPersistentInode(
|
|
ctx, &fs.MemRegularFile{
|
|
Data: []byte("file.txt"),
|
|
Attr: fuse.Attr{
|
|
Mode: 0644,
|
|
},
|
|
}, fs.StableAttr{Ino: 2})
|
|
r.AddChild("file.txt", ch, false)
|
|
}
|
|
|
|
func (r *WeedFS) Getattr(ctx context.Context, fh fs.FileHandle, out *fuse.AttrOut) syscall.Errno {
|
|
out.Mode = 0755
|
|
return 0
|
|
}
|
|
|
|
var _ = (fs.NodeGetattrer)((*WeedFS)(nil))
|
|
var _ = (fs.NodeOnAdder)((*WeedFS)(nil))
|