Commit 2d65aab9 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt.

parent ed34f5da
package fuse
import (
"os"
"fmt"
......
......@@ -680,7 +680,7 @@ func TestRecursiveMount(t *testing.T) {
t.Error("expect EBUSY")
}
err = os.Rename(ts.mountPoint + "/mnt", ts.mountPoint + "/foobar")
err = os.Rename(ts.mountPoint+"/mnt", ts.mountPoint+"/foobar")
CheckSuccess(err)
f.Close()
......
......@@ -189,4 +189,3 @@ func CurrentOwner() *Owner {
Gid: uint32(os.Getgid()),
}
}
......@@ -70,4 +70,3 @@ func TestOwnerOverride(t *testing.T) {
t.Fatal("Should use current uid for mount", fi.Uid, fi.Gid)
}
}
......@@ -80,14 +80,14 @@ func (me *FileSystemDebug) GetAttr(path string) (*os.FileInfo, Status) {
if path == DebugDir {
return &os.FileInfo{
Mode: S_IFDIR | 0755,
},OK
}, OK
}
c := me.getContent(path)
if c != nil {
return &os.FileInfo{
Mode: S_IFREG | 0644,
Size: int64(len(c)),
},OK
}, OK
}
return nil, ENOENT
}
......
......@@ -492,4 +492,3 @@ func (me *FileSystemConnector) Ioctl(header *InHeader, input *IoctlIn) (out *Ioc
}
return f.Ioctl(input)
}
......@@ -283,7 +283,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
if me.getUnionFs(path) != nil {
return &os.FileInfo{
Mode: fuse.S_IFDIR | 0755,
},fuse.OK
}, fuse.OK
}
return nil, fuse.ENOENT
......@@ -306,13 +306,13 @@ func (me *AutoUnionFs) StatusDir() (stream chan fuse.DirEntry, status fuse.Statu
func (me *AutoUnionFs) Open(path string, flags uint32) (fuse.File, fuse.Status) {
if path == filepath.Join(_STATUS, _VERSION) {
if flags & fuse.O_ANYWRITE != 0 {
if flags&fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM
}
return fuse.NewReadOnlyFile([]byte(fuse.Version())), fuse.OK
}
if path == filepath.Join(_CONFIG, _SCAN_CONFIG) {
if flags & fuse.O_ANYWRITE != 0 {
if flags&fuse.O_ANYWRITE != 0 {
me.updateKnownFses()
}
return fuse.NewDevNullFile(), fuse.OK
......
......@@ -44,7 +44,7 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile(wd+"/ro/file2", "file2")
fs := NewAutoUnionFs(wd+"/store", testAOpts)
state, conn, err := fuse.MountFileSystem(wd + "/mount", fs, &testAOpts.FileSystemOptions)
state, conn, err := fuse.MountFileSystem(wd+"/mount", fs, &testAOpts.FileSystemOptions)
CheckSuccess(err)
state.Debug = true
conn.Debug = true
......@@ -60,7 +60,7 @@ func TestVersion(t *testing.T) {
wd, clean := setup(t)
defer clean()
c, err := ioutil.ReadFile(wd+"/mount/status/gounionfs_version")
c, err := ioutil.ReadFile(wd + "/mount/status/gounionfs_version")
CheckSuccess(err)
if len(c) == 0 {
t.Fatal("No version found.")
......@@ -91,7 +91,7 @@ func TestAutoFsSymlink(t *testing.T) {
time.Sleep(2 * entryTtl * 1e9)
scan := wd + "/mount/config/" + _SCAN_CONFIG
err = ioutil.WriteFile(scan, []byte("something"), 0644 )
err = ioutil.WriteFile(scan, []byte("something"), 0644)
if err != nil {
t.Error("error writing:", err)
}
......@@ -128,7 +128,7 @@ func TestExplicitScan(t *testing.T) {
t.Error(".scan_config missing:", err)
}
err = ioutil.WriteFile(scan, []byte("something"), 0644 )
err = ioutil.WriteFile(scan, []byte("something"), 0644)
if err != nil {
t.Error("error writing:", err)
}
......
......@@ -136,10 +136,10 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem {
c.links = NewTimedCache(func(n string) interface{} { return readLink(fs, n) }, ttlNs)
c.xattr = NewTimedCache(func(n string) interface{} {
return getXAttr(fs, n)
},ttlNs)
}, ttlNs)
c.files = NewTimedCache(func(n string) interface{} {
return openFile(fs, n)
},ttlNs)
}, ttlNs)
return c
}
......
......@@ -570,7 +570,7 @@ func (me *UnionFs) GetAttr(name string) (a *os.FileInfo, s fuse.Status) {
if name == _DROP_CACHE {
return &os.FileInfo{
Mode: fuse.S_IFREG | 0777,
},fuse.OK
}, fuse.OK
}
if name == me.options.DeletionDirName {
return nil, fuse.ENOENT
......
......@@ -48,7 +48,7 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
NegativeTimeout: entryTtl,
}
state, _, err := fuse.MountFileSystem(wd + "/mount", ufs, opts)
state, _, err := fuse.MountFileSystem(wd+"/mount", ufs, opts)
CheckSuccess(err)
state.Debug = true
go state.Loop(false)
......@@ -123,13 +123,13 @@ func TestAutocreateDeletionDir(t *testing.T) {
wd, clean := setupUfs(t)
defer clean()
err := os.Remove(wd+"/rw/DELETIONS")
err := os.Remove(wd + "/rw/DELETIONS")
CheckSuccess(err)
err = os.Mkdir(wd+"/mount/dir", 0755)
CheckSuccess(err)
_, err = ioutil.ReadDir(wd+"/mount/dir")
_, err = ioutil.ReadDir(wd + "/mount/dir")
CheckSuccess(err)
}
......@@ -498,7 +498,7 @@ func TestRemoveAll(t *testing.T) {
wd, clean := setupUfs(t)
defer clean()
err := os.Mkdir(wd + "/ro/dir", 0755)
err := os.Mkdir(wd+"/ro/dir", 0755)
CheckSuccess(err)
contents := "hello"
......@@ -506,7 +506,7 @@ func TestRemoveAll(t *testing.T) {
err = ioutil.WriteFile(fn, []byte(contents), 0644)
CheckSuccess(err)
err = os.RemoveAll(wd+"/mount/dir")
err = os.RemoveAll(wd + "/mount/dir")
if err != nil {
t.Error("Should delete all")
}
......@@ -527,7 +527,7 @@ func TestDropCache(t *testing.T) {
wd, clean := setupUfs(t)
defer clean()
err := ioutil.WriteFile(wd + "/ro/file", []byte("bla"), 0644)
err := ioutil.WriteFile(wd+"/ro/file", []byte("bla"), 0644)
CheckSuccess(err)
_, err = os.Lstat(wd + "/mount/.drop_cache")
......@@ -539,14 +539,14 @@ func TestDropCache(t *testing.T) {
t.Fatal("unexpected names", names)
}
err = ioutil.WriteFile(wd + "/ro/file2", []byte("blabla"), 0644)
err = ioutil.WriteFile(wd+"/ro/file2", []byte("blabla"), 0644)
names2, err := Readdirnames(wd + "/mount")
CheckSuccess(err)
if len(names2) != len(names) {
t.Fatal("mismatch", names2)
}
err = ioutil.WriteFile(wd + "/mount/.drop_cache", []byte("does not matter"), 0644)
err = ioutil.WriteFile(wd+"/mount/.drop_cache", []byte("does not matter"), 0644)
CheckSuccess(err)
names2, err = Readdirnames(wd + "/mount")
if len(names2) != 2 {
......@@ -568,7 +568,7 @@ func TestDisappearing(t *testing.T) {
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
wrFs := fuse.NewLoopbackFileSystem(wd+"/rw")
wrFs := fuse.NewLoopbackFileSystem(wd + "/rw")
var fses []fuse.FileSystem
fses = append(fses, wrFs)
fses = append(fses, fuse.NewLoopbackFileSystem(wd+"/ro"))
......@@ -580,7 +580,7 @@ func TestDisappearing(t *testing.T) {
NegativeTimeout: entryTtl,
}
state, _, err := fuse.MountFileSystem(wd + "/mount", ufs, opts)
state, _, err := fuse.MountFileSystem(wd+"/mount", ufs, opts)
CheckSuccess(err)
defer state.Unmount()
state.Debug = true
......@@ -588,23 +588,23 @@ func TestDisappearing(t *testing.T) {
log.Println("TestDisappearing2")
err = ioutil.WriteFile(wd + "/ro/file", []byte("blabla"), 0644)
err = ioutil.WriteFile(wd+"/ro/file", []byte("blabla"), 0644)
CheckSuccess(err)
err = os.Remove(wd+"/mount/file")
err = os.Remove(wd + "/mount/file")
CheckSuccess(err)
oldRoot := wrFs.Root
wrFs.Root = "/dev/null"
time.Sleep(1.5*entryTtl*1e9)
time.Sleep(1.5 * entryTtl * 1e9)
_, err = ioutil.ReadDir(wd+"/mount")
_, err = ioutil.ReadDir(wd + "/mount")
if err == nil {
t.Fatal("Readdir should have failed")
}
log.Println("expected readdir failure:", err)
err = ioutil.WriteFile(wd + "/mount/file2", []byte("blabla"), 0644)
err = ioutil.WriteFile(wd+"/mount/file2", []byte("blabla"), 0644)
if err == nil {
t.Fatal("write should have failed")
}
......@@ -612,15 +612,14 @@ func TestDisappearing(t *testing.T) {
// Restore, and wait for caches to catch up.
wrFs.Root = oldRoot
time.Sleep(1.5*entryTtl*1e9)
time.Sleep(1.5 * entryTtl * 1e9)
_, err = ioutil.ReadDir(wd+"/mount")
_, err = ioutil.ReadDir(wd + "/mount")
if err != nil {
t.Fatal("Readdir should succeed", err)
}
err = ioutil.WriteFile(wd + "/mount/file2", []byte("blabla"), 0644)
err = ioutil.WriteFile(wd+"/mount/file2", []byte("blabla"), 0644)
if err != nil {
t.Fatal("write should succeed", err)
}
}
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