Commit a3347006 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt.

parent 0bf98e92
...@@ -50,4 +50,3 @@ func (m *LatencyMap) Counts() map[string]int { ...@@ -50,4 +50,3 @@ func (m *LatencyMap) Counts() map[string]int {
return r return r
} }
...@@ -7,10 +7,10 @@ import ( ...@@ -7,10 +7,10 @@ import (
func TestLatencyMap(t *testing.T) { func TestLatencyMap(t *testing.T) {
m := NewLatencyMap() m := NewLatencyMap()
m.Add("foo", 100 * time.Millisecond) m.Add("foo", 100*time.Millisecond)
m.Add("foo", 200 * time.Millisecond) m.Add("foo", 200*time.Millisecond)
c, d := m.Get("foo") c, d := m.Get("foo")
if c != 2 || d != 300 * time.Millisecond { if c != 2 || d != 300*time.Millisecond {
t.Errorf("got %v, %d, want 2, 150ms", c, d) t.Errorf("got %v, %d, want 2, 150ms", c, d)
} }
} }
...@@ -63,7 +63,7 @@ func (me *StatFs) OpenDir(name string, context *fuse.Context) (stream []fuse.Dir ...@@ -63,7 +63,7 @@ func (me *StatFs) OpenDir(name string, context *fuse.Context) (stream []fuse.Dir
func NewStatFs() *StatFs { func NewStatFs() *StatFs {
return &StatFs{ return &StatFs{
FileSystem: pathfs.NewDefaultFileSystem(), FileSystem: pathfs.NewDefaultFileSystem(),
entries: make(map[string]*fuse.Attr), entries: make(map[string]*fuse.Attr),
dirs: make(map[string][]fuse.DirEntry), dirs: make(map[string][]fuse.DirEntry),
} }
} }
...@@ -48,7 +48,7 @@ func main() { ...@@ -48,7 +48,7 @@ func main() {
mOpts := &fuse.MountOptions{ mOpts := &fuse.MountOptions{
AllowOther: *other, AllowOther: *other,
} }
state, err := fuse.NewServer(conn.RawFS(),mountPoint, mOpts) state, err := fuse.NewServer(conn.RawFS(), mountPoint, mOpts)
if err != nil { if err != nil {
fmt.Printf("Mount fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
......
...@@ -25,7 +25,7 @@ func main() { ...@@ -25,7 +25,7 @@ func main() {
prefix := flag.Arg(1) prefix := flag.Arg(1)
fs := nodefs.NewMemNodeFs(prefix) fs := nodefs.NewMemNodeFs(prefix)
conn := nodefs.NewFileSystemConnector(fs, nil) conn := nodefs.NewFileSystemConnector(fs, nil)
server, err := fuse.NewServer(conn.RawFS(),mountPoint, nil) server, err := fuse.NewServer(conn.RawFS(), mountPoint, nil)
if err != nil { if err != nil {
fmt.Printf("Mount fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
......
...@@ -313,7 +313,6 @@ func (m *int64HandleMap) Handle(obj *handled) (handle uint64) { ...@@ -313,7 +313,6 @@ func (m *int64HandleMap) Handle(obj *handled) (handle uint64) {
return m.handle(obj) return m.handle(obj)
} }
func (m *int64HandleMap) Forget(handle uint64, count int) (forgotten bool, obj *handled) { func (m *int64HandleMap) Forget(handle uint64, count int) (forgotten bool, obj *handled) {
defer m.verify() defer m.verify()
obj = m.Decode(handle) obj = m.Decode(handle)
......
...@@ -2,14 +2,14 @@ package nodefs ...@@ -2,14 +2,14 @@ package nodefs
import ( import (
"fmt" "fmt"
"time"
"sync" "sync"
"time"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
) )
type lockingFile struct { type lockingFile struct {
mu *sync.Mutex mu *sync.Mutex
file File file File
} }
...@@ -17,8 +17,8 @@ type lockingFile struct { ...@@ -17,8 +17,8 @@ type lockingFile struct {
// every operation. // every operation.
func NewLockingFile(mu *sync.Mutex, f File) File { func NewLockingFile(mu *sync.Mutex, f File) File {
return &lockingFile{ return &lockingFile{
mu: mu, mu: mu,
file: f, file: f,
} }
} }
......
...@@ -36,7 +36,7 @@ func setupMemNodeTest(t *testing.T) (wd string, fs FileSystem, clean func()) { ...@@ -36,7 +36,7 @@ func setupMemNodeTest(t *testing.T) (wd string, fs FileSystem, clean func()) {
if err != nil { if err != nil {
t.Fatal("NewServer", err) t.Fatal("NewServer", err)
} }
//me.state.SetDebug(false) //me.state.SetDebug(false)
state.SetDebug(fuse.VerboseTest()) state.SetDebug(fuse.VerboseTest())
......
...@@ -127,10 +127,10 @@ func NewServer(fs RawFileSystem, mountPoint string, opts *MountOptions) (*Server ...@@ -127,10 +127,10 @@ func NewServer(fs RawFileSystem, mountPoint string, opts *MountOptions) (*Server
opts = &o opts = &o
ms := &Server{ ms := &Server{
fileSystem: fs, fileSystem: fs,
started: make(chan struct{}), started: make(chan struct{}),
opts: &o, opts: &o,
} }
optStrs := opts.Options optStrs := opts.Options
if opts.AllowOther { if opts.AllowOther {
optStrs = append(optStrs, "allow_other") optStrs = append(optStrs, "allow_other")
......
...@@ -154,10 +154,10 @@ func setupFAttrTest(t *testing.T, fs pathfs.FileSystem) (dir string, clean func( ...@@ -154,10 +154,10 @@ func setupFAttrTest(t *testing.T, fs pathfs.FileSystem) (dir string, clean func(
} }
return dir, func() { return dir, func() {
if state.Unmount() == nil { if state.Unmount() == nil {
os.RemoveAll(dir) os.RemoveAll(dir)
}
} }
}
} }
func TestDataReadLarge(t *testing.T) { func TestDataReadLarge(t *testing.T) {
...@@ -222,7 +222,7 @@ func TestFSetAttr(t *testing.T) { ...@@ -222,7 +222,7 @@ func TestFSetAttr(t *testing.T) {
a, status = fs.GetAttr("file", nil) a, status = fs.GetAttr("file", nil)
if !status.Ok() || a.Mode&07777 != 024 { if !status.Ok() || a.Mode&07777 != 024 {
t.Errorf("chmod: %o, status %v", a.Mode & 0777, status) t.Errorf("chmod: %o, status %v", a.Mode&0777, status)
} }
err = os.Chtimes(fn, time.Unix(0, 100e3), time.Unix(0, 101e3)) err = os.Chtimes(fn, time.Unix(0, 100e3), time.Unix(0, 101e3))
......
...@@ -1083,11 +1083,11 @@ func TestUnionFsDropCache(t *testing.T) { ...@@ -1083,11 +1083,11 @@ func TestUnionFsDropCache(t *testing.T) {
type disappearingFS struct { type disappearingFS struct {
pathfs.FileSystem pathfs.FileSystem
normal pathfs.FileSystem normal pathfs.FileSystem
nop pathfs.FileSystem nop pathfs.FileSystem
visible bool visible bool
visibleChan chan bool visibleChan chan bool
} }
func (d *disappearingFS) fs() pathfs.FileSystem { func (d *disappearingFS) fs() pathfs.FileSystem {
...@@ -1111,14 +1111,14 @@ func (d *disappearingFS) GetAttr(name string, context *fuse.Context) (a *fuse.At ...@@ -1111,14 +1111,14 @@ func (d *disappearingFS) GetAttr(name string, context *fuse.Context) (a *fuse.At
func (d *disappearingFS) OpenDir(name string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status) { func (d *disappearingFS) OpenDir(name string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status) {
return d.fs().OpenDir(name, context) return d.fs().OpenDir(name, context)
} }
func newDisappearingFS(fs, nop pathfs.FileSystem) *disappearingFS { func newDisappearingFS(fs, nop pathfs.FileSystem) *disappearingFS {
return &disappearingFS{ return &disappearingFS{
visibleChan: make(chan bool, 1), visibleChan: make(chan bool, 1),
visible: true, visible: true,
normal: fs, normal: fs,
nop: nop, nop: nop,
FileSystem: fs, FileSystem: fs,
} }
} }
...@@ -1142,7 +1142,7 @@ func TestUnionFsDisappearing(t *testing.T) { ...@@ -1142,7 +1142,7 @@ func TestUnionFsDisappearing(t *testing.T) {
t.Fatalf("Mkdir failed: %v", err) t.Fatalf("Mkdir failed: %v", err)
} }
wrFs := newDisappearingFS(pathfs.NewLoopbackFileSystem(wd + "/rw"), wrFs := newDisappearingFS(pathfs.NewLoopbackFileSystem(wd+"/rw"),
pathfs.NewLoopbackFileSystem("/dev/null")) pathfs.NewLoopbackFileSystem("/dev/null"))
var fses []pathfs.FileSystem var fses []pathfs.FileSystem
fses = append(fses, pathfs.NewLockingFileSystem(wrFs)) fses = append(fses, pathfs.NewLockingFileSystem(wrFs))
......
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