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