aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/api/fuse.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-03-31 18:11:01 +0800
committerGitHub <noreply@github.com>2017-03-31 18:11:01 +0800
commit105b37f1b4f77a50625dc997eaab9d71c52495df (patch)
tree21b3f45a59ab1288649910fc5b5dda61798e7bef /swarm/api/fuse.go
parentc4a0efafd71519a4ef4542af7ca492b4b50f918a (diff)
downloaddexon-105b37f1b4f77a50625dc997eaab9d71c52495df.tar
dexon-105b37f1b4f77a50625dc997eaab9d71c52495df.tar.gz
dexon-105b37f1b4f77a50625dc997eaab9d71c52495df.tar.bz2
dexon-105b37f1b4f77a50625dc997eaab9d71c52495df.tar.lz
dexon-105b37f1b4f77a50625dc997eaab9d71c52495df.tar.xz
dexon-105b37f1b4f77a50625dc997eaab9d71c52495df.tar.zst
dexon-105b37f1b4f77a50625dc997eaab9d71c52495df.zip
swarm/api: improve FUSE build constraints, logging and APIs (#3818)
* swarm/api: fix build/tests on unsupported platforms Skip FUSE tests if FUSE is unavailable and change build constraints so the 'lesser' platforms aren't mentioned explicitly. The test are compiled on all platforms to prevent regressions in _fallback.go Also gofmt -w -s because why not. * internal/web3ext: fix swarmfs wrappers Remove inputFormatter specifications so users get an error when passing the wrong number of arguments. * swarm/api: improve FUSE-related logging and APIs The API now returns JSON objects instead of strings. Log messages for invalid arguments are removed.
Diffstat (limited to 'swarm/api/fuse.go')
-rw-r--r--swarm/api/fuse.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/swarm/api/fuse.go b/swarm/api/fuse.go
index 4b1f817f8..2a1cc9bf1 100644
--- a/swarm/api/fuse.go
+++ b/swarm/api/fuse.go
@@ -14,7 +14,9 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-// +build !windows
+// +build linux darwin freebsd
+
+// Data structures used for Fuse filesystem, serving directories and serving files to Fuse driver.
package api
@@ -29,10 +31,6 @@ import (
"golang.org/x/net/context"
)
-
-
-
-// Data structures used for Fuse filesystem, serving directories and serving files to Fuse driver
type FS struct {
root *Dir
}
@@ -55,7 +53,6 @@ type File struct {
reader storage.LazySectionReader
}
-
// Functions which satisfy the Fuse File System requests
func (filesystem *FS) Root() (fs.Node, error) {
return filesystem.root, nil
@@ -104,14 +101,12 @@ func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
}
func (file *File) Attr(ctx context.Context, a *fuse.Attr) error {
-
a.Inode = file.inode
//TODO: need to get permission as argument
a.Mode = 0500
a.Uid = uint32(os.Getuid())
a.Gid = uint32(os.Getegid())
-
reader := file.swarmApi.Retrieve(file.key)
quitC := make(chan bool)
size, err := reader.Size(quitC)
@@ -135,5 +130,4 @@ func (file *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.Re
}
resp.Data = buf[:n]
return err
-
}