initial setup
This commit is contained in:
32
weed/mount/weedfs.go
Normal file
32
weed/mount/weedfs.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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))
|
||||
Reference in New Issue
Block a user