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