From d90ada9b4e0398ffcd6448ae488260184028265e Mon Sep 17 00:00:00 2001 From: Ho-Sheng Hsiao <talktohosh@gmail.com> Date: Tue, 31 Mar 2015 17:13:28 -0700 Subject: [PATCH] Added fuse allow_other option ipfs config Mounts.FuseAllowOther --bool true ipfs daemon --mount --- fuse/ipns/mount_unix.go | 5 ++++- fuse/mount/fuse.go | 12 ++++++++++-- fuse/readonly/mount_unix.go | 4 +++- repo/config/mounts.go | 5 +++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/fuse/ipns/mount_unix.go b/fuse/ipns/mount_unix.go index 1177598da..dde9485ba 100644 --- a/fuse/ipns/mount_unix.go +++ b/fuse/ipns/mount_unix.go @@ -10,10 +10,13 @@ import ( // Mount mounts ipns at a given location, and returns a mount.Mount instance. 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) if err != nil { return nil, err } - return mount.NewMount(ipfs, fsys, ipnsmp) + return mount.NewMount(ipfs, fsys, ipnsmp, allow_other) } diff --git a/fuse/mount/fuse.go b/fuse/mount/fuse.go index d40a583f8..6aed12957 100644 --- a/fuse/mount/fuse.go +++ b/fuse/mount/fuse.go @@ -23,8 +23,16 @@ type mount struct { // 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. -func NewMount(p ctxgroup.ContextGroup, fsys fs.FS, mountpoint string) (Mount, error) { - conn, err := fuse.Mount(mountpoint) +func NewMount(p ctxgroup.ContextGroup, fsys fs.FS, mountpoint string, allow_other bool) (Mount, error) { + 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 { return nil, err } diff --git a/fuse/readonly/mount_unix.go b/fuse/readonly/mount_unix.go index 07f234638..60d14ffe8 100644 --- a/fuse/readonly/mount_unix.go +++ b/fuse/readonly/mount_unix.go @@ -10,6 +10,8 @@ import ( // Mount mounts ipfs at a given location, and returns a mount.Mount instance. func Mount(ipfs *core.IpfsNode, mountpoint string) (mount.Mount, error) { + cfg := ipfs.Repo.Config() + allow_other := cfg.Mounts.FuseAllowOther fsys := NewFileSystem(ipfs) - return mount.NewMount(ipfs, fsys, mountpoint) + return mount.NewMount(ipfs, fsys, mountpoint, allow_other) } diff --git a/repo/config/mounts.go b/repo/config/mounts.go index a0f420059..b23d30b2e 100644 --- a/repo/config/mounts.go +++ b/repo/config/mounts.go @@ -2,6 +2,7 @@ package config // Mounts stores the (string) mount points type Mounts struct { - IPFS string - IPNS string + IPFS string + IPNS string + FuseAllowOther bool } -- GitLab