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

Run gofmt.

parent e3ad7b09
...@@ -142,8 +142,8 @@ type File interface { ...@@ -142,8 +142,8 @@ type File interface {
// Wrappers around other File implementations, should return // Wrappers around other File implementations, should return
// the inner file here. // the inner file here.
InnerFile() File InnerFile() File
Read(*ReadIn, BufferPool) ([]byte, Status) Read(*ReadIn, BufferPool) ([]byte, Status)
Write(*WriteIn, []byte) (written uint32, code Status) Write(*WriteIn, []byte) (written uint32, code Status)
Truncate(size uint64) Status Truncate(size uint64) Status
......
...@@ -155,7 +155,7 @@ func TestFSetAttr(t *testing.T) { ...@@ -155,7 +155,7 @@ func TestFSetAttr(t *testing.T) {
defer f.Close() defer f.Close()
fi, err := f.Stat() fi, err := f.Stat()
CheckSuccess(err) CheckSuccess(err)
_, err = f.WriteString("hello") _, err = f.WriteString("hello")
CheckSuccess(err) CheckSuccess(err)
......
...@@ -42,7 +42,7 @@ func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *Entry ...@@ -42,7 +42,7 @@ func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *Entry
} }
mount := parent.mount mount := parent.mount
child := parent.GetChild(name) child := parent.GetChild(name)
if child != nil { if child != nil {
parent = nil parent = nil
......
...@@ -494,20 +494,20 @@ func init() { ...@@ -494,20 +494,20 @@ func init() {
// Inputs. // Inputs.
for op, f := range map[opcode]castPointerFunc{ for op, f := range map[opcode]castPointerFunc{
_OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*GetAttrIn)(ptr) }, _OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*GetAttrIn)(ptr) },
_OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*SetAttrIn)(ptr) }, _OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*SetAttrIn)(ptr) },
_OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*InitIn)(ptr) }, _OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*InitIn)(ptr) },
_OP_IOCTL: func(ptr unsafe.Pointer) interface{} { return (*IoctlIn)(ptr) }, _OP_IOCTL: func(ptr unsafe.Pointer) interface{} { return (*IoctlIn)(ptr) },
_OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*OpenIn)(ptr) }, _OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*OpenIn)(ptr) },
_OP_MKNOD: func(ptr unsafe.Pointer) interface{} { return (*MknodIn)(ptr) }, _OP_MKNOD: func(ptr unsafe.Pointer) interface{} { return (*MknodIn)(ptr) },
_OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*CreateIn)(ptr) }, _OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*CreateIn)(ptr) },
_OP_READ: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) }, _OP_READ: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) },
_OP_READDIR: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) }, _OP_READDIR: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) },
_OP_ACCESS: func(ptr unsafe.Pointer) interface{} { return (*AccessIn)(ptr) }, _OP_ACCESS: func(ptr unsafe.Pointer) interface{} { return (*AccessIn)(ptr) },
_OP_FORGET: func(ptr unsafe.Pointer) interface{} { return (*ForgetIn)(ptr) }, _OP_FORGET: func(ptr unsafe.Pointer) interface{} { return (*ForgetIn)(ptr) },
_OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*LinkIn)(ptr) }, _OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*LinkIn)(ptr) },
_OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*MkdirIn)(ptr) }, _OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*MkdirIn)(ptr) },
_OP_RELEASE: func(ptr unsafe.Pointer) interface{} { return (*ReleaseIn)(ptr) }, _OP_RELEASE: func(ptr unsafe.Pointer) interface{} { return (*ReleaseIn)(ptr) },
_OP_RELEASEDIR: func(ptr unsafe.Pointer) interface{} { return (*ReleaseIn)(ptr) }, _OP_RELEASEDIR: func(ptr unsafe.Pointer) interface{} { return (*ReleaseIn)(ptr) },
} { } {
operationHandlers[op].DecodeIn = f operationHandlers[op].DecodeIn = f
......
...@@ -32,7 +32,7 @@ type PathNodeFs struct { ...@@ -32,7 +32,7 @@ type PathNodeFs struct {
connector *FileSystemConnector connector *FileSystemConnector
// protects clientInodeMap and pathInode.Parent pointers // protects clientInodeMap and pathInode.Parent pointers
pathLock sync.RWMutex pathLock sync.RWMutex
// This map lists all the parent links known for a given // This map lists all the parent links known for a given
// nodeId. // nodeId.
...@@ -174,12 +174,12 @@ type pathInode struct { ...@@ -174,12 +174,12 @@ type pathInode struct {
DefaultFsNode DefaultFsNode
} }
func (me *pathInode) LockTree() (func()) { func (me *pathInode) LockTree() func() {
me.pathFs.pathLock.Lock() me.pathFs.pathLock.Lock()
return func() { me.pathFs.pathLock.Unlock() } return func() { me.pathFs.pathLock.Unlock() }
} }
func (me *pathInode) RLockTree() (func()) { func (me *pathInode) RLockTree() func() {
me.pathFs.pathLock.RLock() me.pathFs.pathLock.RLock()
return func() { me.pathFs.pathLock.RUnlock() } return func() { me.pathFs.pathLock.RUnlock() }
} }
...@@ -282,7 +282,7 @@ func (me *pathInode) setClientInode(ino uint64) { ...@@ -282,7 +282,7 @@ func (me *pathInode) setClientInode(ino uint64) {
if me.clientInode != 0 { if me.clientInode != 0 {
me.pathFs.clientInodeMap[me.clientInode] = nil, false me.pathFs.clientInodeMap[me.clientInode] = nil, false
} }
me.clientInode = ino me.clientInode = ino
if me.Parent != nil { if me.Parent != nil {
e := &clientInodePath{ e := &clientInodePath{
...@@ -421,7 +421,7 @@ func (me *pathInode) Link(name string, existingFsnode FsNode, context *Context) ...@@ -421,7 +421,7 @@ func (me *pathInode) Link(name string, existingFsnode FsNode, context *Context)
me.addChild(name, existing) me.addChild(name, existing)
} else { } else {
pNode := me.createChild(false) pNode := me.createChild(false)
newNode = pNode newNode = pNode
pNode.clientInode = fi.Ino pNode.clientInode = fi.Ino
me.addChild(name, pNode) me.addChild(name, pNode)
} }
......
...@@ -224,7 +224,6 @@ type CreateOut struct { ...@@ -224,7 +224,6 @@ type CreateOut struct {
OpenOut OpenOut
} }
const RELEASE_FLUSH = (1 << 0) const RELEASE_FLUSH = (1 << 0)
type ReleaseIn struct { type ReleaseIn struct {
......
...@@ -186,7 +186,7 @@ func (me *AutoUnionFs) updateKnownFses() { ...@@ -186,7 +186,7 @@ func (me *AutoUnionFs) updateKnownFses() {
filepath.Walk(path, filepath.Walk(path,
func(path string, fi *os.FileInfo, err os.Error) os.Error { func(path string, fi *os.FileInfo, err os.Error) os.Error {
return me.visit(path, fi, err) return me.visit(path, fi, err)
}) })
} }
} }
} }
......
...@@ -163,8 +163,8 @@ type branchResult struct { ...@@ -163,8 +163,8 @@ type branchResult struct {
func printFileInfo(me *os.FileInfo) string { func printFileInfo(me *os.FileInfo) string {
return fmt.Sprintf( return fmt.Sprintf(
"{0%o S=%d L=%d %d:%d %d*%d %d:%d " + "{0%o S=%d L=%d %d:%d %d*%d %d:%d "+
"A %.09f M %.09f C %.09f}", "A %.09f M %.09f C %.09f}",
me.Mode, me.Size, me.Nlink, me.Uid, me.Gid, me.Blocks, me.Blksize, me.Rdev, me.Ino, me.Mode, me.Size, me.Nlink, me.Uid, me.Gid, me.Blocks, me.Blksize, me.Rdev, me.Ino,
float64(me.Atime_ns)*1e-9, float64(me.Mtime_ns)*1e-9, float64(me.Ctime_ns)*1e-9) float64(me.Atime_ns)*1e-9, float64(me.Mtime_ns)*1e-9, float64(me.Ctime_ns)*1e-9)
} }
...@@ -173,7 +173,6 @@ func (me branchResult) String() string { ...@@ -173,7 +173,6 @@ func (me branchResult) String() string {
return fmt.Sprintf("{%s %v branch %d}", printFileInfo(me.attr), me.code, me.branch) return fmt.Sprintf("{%s %v branch %d}", printFileInfo(me.attr), me.code, me.branch)
} }
func (me *UnionFs) getBranchAttrNoCache(name string) branchResult { func (me *UnionFs) getBranchAttrNoCache(name string) branchResult {
name = stripSlash(name) name = stripSlash(name)
...@@ -299,7 +298,7 @@ func (me *UnionFs) Promote(name string, srcResult branchResult, context *fuse.Co ...@@ -299,7 +298,7 @@ func (me *UnionFs) Promote(name string, srcResult branchResult, context *fuse.Co
if uf == nil { if uf == nil {
panic("no unionFsFile found inside") panic("no unionFsFile found inside")
} }
if uf.layer > 0 { if uf.layer > 0 {
uf.layer = 0 uf.layer = 0
uf.File.Release() uf.File.Release()
...@@ -961,15 +960,15 @@ func (me *UnionFs) StatFs() *fuse.StatfsOut { ...@@ -961,15 +960,15 @@ func (me *UnionFs) StatFs() *fuse.StatfsOut {
type unionFsFile struct { type unionFsFile struct {
fuse.File fuse.File
ufs *UnionFs ufs *UnionFs
node *fuse.Inode node *fuse.Inode
layer int layer int
} }
func (me *UnionFs) newUnionFsFile(f fuse.File, branch int) *unionFsFile { func (me *UnionFs) newUnionFsFile(f fuse.File, branch int) *unionFsFile {
return &unionFsFile{ return &unionFsFile{
File: f, File: f,
ufs: me, ufs: me,
layer: branch, layer: branch,
} }
} }
......
...@@ -1027,8 +1027,8 @@ func TestFlushRename(t *testing.T) { ...@@ -1027,8 +1027,8 @@ func TestFlushRename(t *testing.T) {
wd, clean := setupUfs(t) wd, clean := setupUfs(t)
defer clean() defer clean()
err := ioutil.WriteFile(wd +"/mount/file", []byte("x"), 0644) err := ioutil.WriteFile(wd+"/mount/file", []byte("x"), 0644)
fn := wd + "/mount/tmp" fn := wd + "/mount/tmp"
f, err := os.OpenFile(fn, os.O_WRONLY|os.O_CREATE, 0644) f, err := os.OpenFile(fn, os.O_WRONLY|os.O_CREATE, 0644)
CheckSuccess(err) CheckSuccess(err)
...@@ -1042,7 +1042,7 @@ func TestFlushRename(t *testing.T) { ...@@ -1042,7 +1042,7 @@ func TestFlushRename(t *testing.T) {
dst := wd + "/mount/file" dst := wd + "/mount/file"
err = os.Rename(fn, dst) err = os.Rename(fn, dst)
CheckSuccess(err) CheckSuccess(err)
fi, err = os.Lstat(dst) fi, err = os.Lstat(dst)
CheckSuccess(err) CheckSuccess(err)
if fi.Size != int64(n) { if fi.Size != int64(n) {
......
...@@ -83,7 +83,7 @@ func TestMultiZipFs(t *testing.T) { ...@@ -83,7 +83,7 @@ func TestMultiZipFs(t *testing.T) {
if !fi.IsDirectory() { if !fi.IsDirectory() {
t.Fatal("expect directory for /zipmount, got %v", fi) t.Fatal("expect directory for /zipmount, got %v", fi)
} }
// Check that zipfs itself works. // Check that zipfs itself works.
fi, err = os.Stat(mountPoint + "/zipmount/subdir") fi, err = os.Stat(mountPoint + "/zipmount/subdir")
CheckSuccess(err) CheckSuccess(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