Start to add zap logger everywhere

This commit is contained in:
Ben Sarmiento
2023-11-05 00:02:22 +01:00
parent 4136310622
commit 1b116c2194
9 changed files with 204 additions and 50 deletions

45
internal/zfs/mount.go Normal file
View 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
}