@cryptotaxi247 / kubo / commits / d90ada9b4

Added fuse allow_other option

ipfs config Mounts.FuseAllowOther --bool true ipfs daemon --mount

Ho-Sheng Hsiao committed Mar 31, 2015 at 17:13 UTC d90ada9b4e0398ffcd6448ae488260184028265e
4 files changed +20 -6
fuse/ipns/mount_unix.go
+4 -1
@@ -10,10 +10,13 @@ import (
10
11 // Mount mounts ipns at a given location, and returns a mount.Mount instance.
12 func Mount(ipfs *core.IpfsNode, ipnsmp, ipfsmp string) (mount.Mount, error) {
13 + cfg := ipfs.Repo.Config()
14 + allow_other := cfg.Mounts.FuseAllowOther
15 +
16 fsys, err := NewFileSystem(ipfs, ipfs.PrivateKey, ipfsmp)
17 if err != nil {
18 return nil, err
19 }
20
18 - return mount.NewMount(ipfs, fsys, ipnsmp)
21 + return mount.NewMount(ipfs, fsys, ipnsmp, allow_other)
22 }
fuse/mount/fuse.go
+10 -2
@@ -23,8 +23,16 @@ type mount struct {
23
24 // Mount mounts a fuse fs.FS at a given location, and returns a Mount instance.
25 // parent is a ContextGroup to bind the mount's ContextGroup to.
26 -func NewMount(p ctxgroup.ContextGroup, fsys fs.FS, mountpoint string) (Mount, error) {
27 - conn, err := fuse.Mount(mountpoint)
26 +func NewMount(p ctxgroup.ContextGroup, fsys fs.FS, mountpoint string, allow_other bool) (Mount, error) {
27 + var conn *fuse.Conn
28 + var err error
29 +
30 + if allow_other {
31 + conn, err = fuse.Mount(mountpoint, fuse.AllowOther())
32 + } else {
33 + conn, err = fuse.Mount(mountpoint)
34 + }
35 +
36 if err != nil {
37 return nil, err
38 }
fuse/readonly/mount_unix.go
+3 -1
@@ -10,6 +10,8 @@ import (
10
11 // Mount mounts ipfs at a given location, and returns a mount.Mount instance.
12 func Mount(ipfs *core.IpfsNode, mountpoint string) (mount.Mount, error) {
13 + cfg := ipfs.Repo.Config()
14 + allow_other := cfg.Mounts.FuseAllowOther
15 fsys := NewFileSystem(ipfs)
14 - return mount.NewMount(ipfs, fsys, mountpoint)
16 + return mount.NewMount(ipfs, fsys, mountpoint, allow_other)
17 }
repo/config/mounts.go
+3 -2
@@ -2,6 +2,7 @@ package config
2
3 // Mounts stores the (string) mount points
4 type Mounts struct {
5 - IPFS string
6 - IPNS string
5 + IPFS string
6 + IPNS string
7 + FuseAllowOther bool
8 }