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

Run Gofmt.

parent 39d680ab
// The fuse package provides APIs to implement filesystems in
// userspace, using libfuse on Linux.
package fuse
import (
"os"
)
......@@ -89,7 +90,6 @@ type MountOptions struct {
EntryTimeout float64
AttrTimeout float64
NegativeTimeout float64
}
// DefaultFileSystem implements a FileSystem that returns ENOSYS for every operation.
......
......@@ -15,6 +15,7 @@ type BufferPool interface {
}
type GcBufferPool struct {
}
// NewGcBufferPool is just a fallback to the standard allocation routines.
......
package fuse
import (
"os"
"syscall"
......@@ -108,4 +109,3 @@ func (me *LoopbackFile) GetAttr() (*os.FileInfo, Status) {
}
return fi, OK
}
......@@ -664,4 +664,3 @@ func TestRecursiveMount(t *testing.T) {
ts.Cleanup()
}
......@@ -215,7 +215,7 @@ func (me *FileSystemConnector) Statistics() string {
len(me.openFiles), len(me.inodeMap))
}
func (me *FileSystemConnector) unregisterFile(node *inode, handle uint64) (interface{}) {
func (me *FileSystemConnector) unregisterFile(node *inode, handle uint64) interface{} {
me.fileLock.Lock()
defer me.fileLock.Unlock()
b, ok := me.openFiles[handle]
......@@ -248,7 +248,7 @@ func (me *FileSystemConnector) registerFile(node *inode, mount *mountData, f int
return h
}
func (me *FileSystemConnector) decodeFileHandle(h uint64) (*fileBridge) {
func (me *FileSystemConnector) decodeFileHandle(h uint64) *fileBridge {
b := (*fileBridge)(unsafe.Pointer(uintptr(h)))
return b
}
......
......@@ -385,7 +385,7 @@ func (me *FileSystemConnector) Flush(input *FlushIn) Status {
f, b := me.getFile(input.Fh)
code := f.Flush()
if code.Ok() && b.Flags & O_ANYWRITE != 0 {
if code.Ok() && b.Flags&O_ANYWRITE != 0 {
// We only signal releases to the FS if the
// open could have changed things.
var path string
......@@ -491,4 +491,3 @@ func (me *FileSystemConnector) Ioctl(header *InHeader, input *IoctlIn) (out *Ioc
}
return f.Ioctl(input)
}
......@@ -453,5 +453,3 @@ type NotifyInvalEntryOut struct {
NameLen uint32
Padding uint32
}
......@@ -68,25 +68,25 @@ func TestAutoFsSymlink(t *testing.T) {
err = os.Symlink(wd+"/store/foo", wd+"/mount/config/bar")
CheckSuccess(err)
fi, err := os.Lstat(wd+"/mount/bar/file1")
fi, err := os.Lstat(wd + "/mount/bar/file1")
CheckSuccess(err)
err = os.Remove(wd+"/mount/config/bar")
err = os.Remove(wd + "/mount/config/bar")
CheckSuccess(err)
// Need time for the unmount to be noticed.
log.Println("sleeping...")
time.Sleep(entryTtl*2e9)
time.Sleep(entryTtl * 2e9)
fi, _ = os.Lstat(wd+"/mount/foo")
fi, _ = os.Lstat(wd + "/mount/foo")
if fi != nil {
t.Error("Should not have file:", fi)
}
_, err = ioutil.ReadDir(wd+"/mount/config")
_, err = ioutil.ReadDir(wd + "/mount/config")
CheckSuccess(err)
_, err = os.Lstat(wd+"/mount/foo/file1")
_, err = os.Lstat(wd + "/mount/foo/file1")
CheckSuccess(err)
}
......
......@@ -89,7 +89,7 @@ func openFile(fs fuse.FileSystem, name string) (result *openResponse) {
buf := bytes.NewBuffer(nil)
input := fuse.ReadIn{
Offset: 0,
Size: 128 * (1<<10),
Size: 128 * (1 << 10),
Flags: flags,
}
......@@ -181,7 +181,7 @@ func (me *CachingFileSystem) OpenDir(name string) (stream chan fuse.DirEntry, st
// Caching file contents easily overflows available memory.
func (me *CachingFileSystem) DisabledOpen(name string, flags uint32) (f fuse.File, status fuse.Status) {
if flags & fuse.O_ANYWRITE != 0 {
if flags&fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM
}
......
......@@ -70,4 +70,3 @@ func TestCachingFs(t *testing.T) {
t.Error("Unexpected readdir result", results, expected)
}
}
......@@ -94,12 +94,12 @@ func (me *TimedCache) Purge() {
}
func (me *TimedCache) RecurringPurge() {
if (me.ttlNs <= 0) {
if me.ttlNs <= 0 {
return
}
me.Purge()
me.PurgeTimer = time.AfterFunc(me.ttlNs * 5,
me.PurgeTimer = time.AfterFunc(me.ttlNs*5,
func() { me.RecurringPurge() })
}
......
......@@ -497,7 +497,7 @@ func (me *UnionFs) promoteDirsTo(filename string) fuse.Status {
if r.code != fuse.OK {
log.Println("path component does not exist", filename, dirName)
}
if r.attr.Mode & fuse.S_IFDIR == 0 {
if r.attr.Mode&fuse.S_IFDIR == 0 {
log.Println("path component is not a directory.", dirName, r)
return fuse.EPERM
}
......@@ -511,7 +511,7 @@ func (me *UnionFs) promoteDirsTo(filename string) fuse.Status {
}
for i, _ := range todo {
j := len(todo)-i-1
j := len(todo) - i - 1
d := todo[j]
log.Println("Promoting directory", d)
code := me.fileSystems[0].Mkdir(d, 0755)
......
......@@ -140,13 +140,13 @@ func TestChtimes(t *testing.T) {
defer clean()
writeToFile(wd+"/ro/file", "a")
err := os.Chtimes(wd + "/ro/file", 42e9, 43e9)
err := os.Chtimes(wd+"/ro/file", 42e9, 43e9)
CheckSuccess(err)
err = os.Chtimes(wd + "/mount/file", 82e9, 83e9)
err = os.Chtimes(wd+"/mount/file", 82e9, 83e9)
CheckSuccess(err)
fi, err := os.Lstat(wd +"/mount/file")
fi, err := os.Lstat(wd + "/mount/file")
if fi.Atime_ns != 82e9 || fi.Mtime_ns != 83e9 {
t.Error("Incorrect timestamp", fi)
}
......@@ -199,7 +199,7 @@ func TestBasic(t *testing.T) {
t.Errorf("missing file in rw layer", names)
}
contents := readFromFile(wd+"/mount/new")
contents := readFromFile(wd + "/mount/new")
if contents != "new contents" {
t.Errorf("read mismatch: '%v'", contents)
}
......@@ -297,7 +297,7 @@ func TestMkdirPromote(t *testing.T) {
err = os.Mkdir(wd+"/mount/subdir/subdir2/dir3", 0755)
CheckSuccess(err)
fi, _ := os.Lstat(wd+"/rw/subdir/subdir2/dir3")
fi, _ := os.Lstat(wd + "/rw/subdir/subdir2/dir3")
CheckSuccess(err)
if fi == nil || !fi.IsDirectory() {
t.Error("is not a directory: ", fi)
......@@ -409,13 +409,13 @@ func TestCopyChmod(t *testing.T) {
fi, err := os.Lstat(fn)
CheckSuccess(err)
if fi.Mode & 0111 == 0 {
if fi.Mode&0111 == 0 {
t.Errorf("1st attr error %o", fi.Mode)
}
time.Sleep(entryTtl * 1.1e9)
fi, err = os.Lstat(fn)
CheckSuccess(err)
if fi.Mode & 0111 == 0 {
if fi.Mode&0111 == 0 {
t.Errorf("uncached attr error %o", fi.Mode)
}
}
......@@ -445,7 +445,7 @@ func TestTruncateTimestamp(t *testing.T) {
fi, err := os.Lstat(fn)
CheckSuccess(err)
if abs(truncTs - fi.Mtime_ns) > 0.1e9 {
if abs(truncTs-fi.Mtime_ns) > 0.1e9 {
t.Error("timestamp drift", truncTs, fi.Mtime_ns)
}
}
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