From 105b37f1b4f77a50625dc997eaab9d71c52495df Mon Sep 17 00:00:00 2001
From: Felix Lange <fjl@users.noreply.github.com>
Date: Fri, 31 Mar 2017 12:11:01 +0200
Subject: 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.
---
 swarm/api/fuse.go | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

(limited to 'swarm/api/fuse.go')

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
-
 }
-- 
cgit v1.2.3