Start to add zap logger everywhere
This commit is contained in:
21
internal/zfs/fs.go
Normal file
21
internal/zfs/fs.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package zfs
|
||||
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"bazil.org/fuse/fs"
|
||||
)
|
||||
|
||||
type FS struct {
|
||||
uid uint32
|
||||
gid uint32
|
||||
umask os.FileMode
|
||||
directIO bool
|
||||
lock sync.RWMutex
|
||||
}
|
||||
|
||||
// Root returns the root path
|
||||
func (f *FS) Root() (fs.Node, error) {
|
||||
return nil, nil
|
||||
}
|
||||
45
internal/zfs/mount.go
Normal file
45
internal/zfs/mount.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package zfs
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func Mount(mountpoint string) error {
|
||||
options := []fuse.MountOption{
|
||||
fuse.AllowOther(),
|
||||
fuse.AllowNonEmptyMount(),
|
||||
fuse.MaxReadahead(uint32(128 << 10)),
|
||||
fuse.DefaultPermissions(),
|
||||
fuse.FSName("zurgfs"),
|
||||
}
|
||||
c, err := fuse.Mount(mountpoint, options...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
srv := fs.New(c, nil)
|
||||
|
||||
filesys := &FS{
|
||||
uid: uint32(unix.Geteuid()),
|
||||
gid: uint32(unix.Getegid()),
|
||||
umask: os.FileMode(0),
|
||||
}
|
||||
|
||||
// Serve our tree via FUSE.
|
||||
if err := srv.Serve(filesys); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Unmount(mountpoint string) error {
|
||||
fuse.Unmount(mountpoint)
|
||||
return nil
|
||||
}
|
||||
50
internal/zfs/object.go
Normal file
50
internal/zfs/object.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package zfs
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
||||
)
|
||||
|
||||
type Object struct {
|
||||
fs *FS
|
||||
objectID string
|
||||
}
|
||||
|
||||
func (o Object) GetObject() (object *torrent.Torrent, err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o Object) Attr(ctx context.Context, attr *fuse.Attr) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o Object) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o Object) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o Object) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o Object) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o Object) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o Object) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o Object) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user