Commit d90ada9b authored by Ho-Sheng Hsiao's avatar Ho-Sheng Hsiao

Added fuse allow_other option

    ipfs config Mounts.FuseAllowOther --bool true
    ipfs daemon --mount
parent b107eb89
...@@ -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)
} }
...@@ -4,4 +4,5 @@ package config ...@@ -4,4 +4,5 @@ package config
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