Commit 64f6a843 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

Merge pull request #997 from ipfs/hosh/fuse-mount-opts

Fuse allow options
parents b107eb89 d90ada9b
...@@ -10,10 +10,13 @@ import ( ...@@ -10,10 +10,13 @@ import (
// Mount mounts ipns at a given location, and returns a mount.Mount instance. // Mount mounts ipns at a given location, and returns a mount.Mount instance.
func Mount(ipfs *core.IpfsNode, ipnsmp, ipfsmp string) (mount.Mount, error) { func Mount(ipfs *core.IpfsNode, ipnsmp, ipfsmp string) (mount.Mount, error) {
cfg := ipfs.Repo.Config()
allow_other := cfg.Mounts.FuseAllowOther
fsys, err := NewFileSystem(ipfs, ipfs.PrivateKey, ipfsmp) fsys, err := NewFileSystem(ipfs, ipfs.PrivateKey, ipfsmp)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return mount.NewMount(ipfs, fsys, ipnsmp) return mount.NewMount(ipfs, fsys, ipnsmp, allow_other)
} }
...@@ -23,8 +23,16 @@ type mount struct { ...@@ -23,8 +23,16 @@ type mount struct {
// Mount mounts a fuse fs.FS at a given location, and returns a Mount instance. // Mount mounts a fuse fs.FS at a given location, and returns a Mount instance.
// parent is a ContextGroup to bind the mount's ContextGroup to. // parent is a ContextGroup to bind the mount's ContextGroup to.
func NewMount(p ctxgroup.ContextGroup, fsys fs.FS, mountpoint string) (Mount, error) { func NewMount(p ctxgroup.ContextGroup, fsys fs.FS, mountpoint string, allow_other bool) (Mount, error) {
conn, err := fuse.Mount(mountpoint) var conn *fuse.Conn
var err error
if allow_other {
conn, err = fuse.Mount(mountpoint, fuse.AllowOther())
} else {
conn, err = fuse.Mount(mountpoint)
}
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -10,6 +10,8 @@ import ( ...@@ -10,6 +10,8 @@ import (
// Mount mounts ipfs at a given location, and returns a mount.Mount instance. // Mount mounts ipfs at a given location, and returns a mount.Mount instance.
func Mount(ipfs *core.IpfsNode, mountpoint string) (mount.Mount, error) { func Mount(ipfs *core.IpfsNode, mountpoint string) (mount.Mount, error) {
cfg := ipfs.Repo.Config()
allow_other := cfg.Mounts.FuseAllowOther
fsys := NewFileSystem(ipfs) fsys := NewFileSystem(ipfs)
return mount.NewMount(ipfs, fsys, mountpoint) return mount.NewMount(ipfs, fsys, mountpoint, allow_other)
} }
...@@ -2,6 +2,7 @@ package config ...@@ -2,6 +2,7 @@ package config
// Mounts stores the (string) mount points // Mounts stores the (string) mount points
type Mounts struct { type Mounts struct {
IPFS string IPFS string
IPNS string IPNS string
FuseAllowOther bool
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment