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

Run gofmt.

parent 4cc77e52
...@@ -33,7 +33,7 @@ type MountState struct { ...@@ -33,7 +33,7 @@ type MountState struct {
*LatencyMap *LatencyMap
opts *MountOptions opts *MountOptions
kernelSettings InitIn kernelSettings InitIn
} }
...@@ -53,7 +53,7 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) os.Error { ...@@ -53,7 +53,7 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) os.Error {
} }
} }
me.opts = opts me.opts = opts
optStr := "" optStr := ""
if opts.AllowOther { if opts.AllowOther {
optStr = "allow_other" optStr = "allow_other"
......
...@@ -78,11 +78,11 @@ func (me *fileSystemMount) registerFileHandle(node *inode, dir rawDir, f File, f ...@@ -78,11 +78,11 @@ func (me *fileSystemMount) registerFileHandle(node *inode, dir rawDir, f File, f
node.OpenCountMutex.Lock() node.OpenCountMutex.Lock()
defer node.OpenCountMutex.Unlock() defer node.OpenCountMutex.Unlock()
b := &openedFile{ b := &openedFile{
dir: dir, dir: dir,
file: f, file: f,
inode: node, inode: node,
fileSystemMount: me, fileSystemMount: me,
Flags: flags, Flags: flags,
} }
node.OpenCount++ node.OpenCount++
return me.openFiles.Register(&b.Handled) return me.openFiles.Register(&b.Handled)
...@@ -133,8 +133,8 @@ type inode struct { ...@@ -133,8 +133,8 @@ type inode struct {
// Can only be called on untouched inodes. // Can only be called on untouched inodes.
func (me *inode) mountFs(fs FileSystem, opts *FileSystemOptions) { func (me *inode) mountFs(fs FileSystem, opts *FileSystemOptions) {
me.mountPoint = &fileSystemMount{ me.mountPoint = &fileSystemMount{
fs: fs, fs: fs,
openFiles: NewHandleMap(), openFiles: NewHandleMap(),
mountInode: me, mountInode: me,
options: opts, options: opts,
} }
...@@ -497,8 +497,8 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *Fil ...@@ -497,8 +497,8 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *Fil
me.mountRoot(fs, opts) me.mountRoot(fs, opts)
return OK return OK
} }
dirParent, base := filepath.Split(mountPoint) dirParent, base := filepath.Split(mountPoint)
parent := me.findInode(dirParent) parent := me.findInode(dirParent)
if parent == nil { if parent == nil {
log.Println("Could not find mountpoint parent:", dirParent) log.Println("Could not find mountpoint parent:", dirParent)
......
...@@ -65,7 +65,7 @@ func NewSwitchFileSystem(fsMap []SwitchedFileSystem) *SwitchFileSystem { ...@@ -65,7 +65,7 @@ func NewSwitchFileSystem(fsMap []SwitchedFileSystem) *SwitchFileSystem {
// numbers of switched filesystems. // numbers of switched filesystems.
func (me *SwitchFileSystem) findFileSystem(path string) (string, *SwitchedFileSystem) { func (me *SwitchFileSystem) findFileSystem(path string) (string, *SwitchedFileSystem) {
for _, swFs := range me.fileSystems { for _, swFs := range me.fileSystems {
if swFs.Prefix == "" || swFs.Prefix == path || strings.HasPrefix(path, swFs.Prefix + string(filepath.Separator)) { if swFs.Prefix == "" || swFs.Prefix == path || strings.HasPrefix(path, swFs.Prefix+string(filepath.Separator)) {
if swFs.StripPrefix { if swFs.StripPrefix {
path = strings.TrimLeft(path[len(swFs.Prefix):], string(filepath.Separator)) path = strings.TrimLeft(path[len(swFs.Prefix):], string(filepath.Separator))
} }
...@@ -135,7 +135,7 @@ func (me *SwitchFileSystem) Symlink(value string, linkName string) (code Status) ...@@ -135,7 +135,7 @@ func (me *SwitchFileSystem) Symlink(value string, linkName string) (code Status)
func (me *SwitchFileSystem) Rename(oldName string, newName string) (code Status) { func (me *SwitchFileSystem) Rename(oldName string, newName string) (code Status) {
oldName, fs1 := me.findFileSystem(oldName) oldName, fs1 := me.findFileSystem(oldName)
newName, fs2 := me.findFileSystem(newName) newName, fs2 := me.findFileSystem(newName)
if fs1 != fs2 { if fs1 != fs2 {
return syscall.EXDEV return syscall.EXDEV
} }
if fs1 == nil { if fs1 == nil {
...@@ -147,7 +147,7 @@ func (me *SwitchFileSystem) Rename(oldName string, newName string) (code Status) ...@@ -147,7 +147,7 @@ func (me *SwitchFileSystem) Rename(oldName string, newName string) (code Status)
func (me *SwitchFileSystem) Link(oldName string, newName string) (code Status) { func (me *SwitchFileSystem) Link(oldName string, newName string) (code Status) {
oldName, fs1 := me.findFileSystem(oldName) oldName, fs1 := me.findFileSystem(oldName)
newName, fs2 := me.findFileSystem(newName) newName, fs2 := me.findFileSystem(newName)
if fs1 != fs2 { if fs1 != fs2 {
return syscall.EXDEV return syscall.EXDEV
} }
if fs1 == nil { if fs1 == nil {
...@@ -271,4 +271,3 @@ func (me *SwitchFileSystem) Flush(name string) Status { ...@@ -271,4 +271,3 @@ func (me *SwitchFileSystem) Flush(name string) Status {
} }
return fs.FileSystem.Flush(name) return fs.FileSystem.Flush(name)
} }
...@@ -7,14 +7,14 @@ import ( ...@@ -7,14 +7,14 @@ import (
func TestSwitchFsSlash(t *testing.T) { func TestSwitchFsSlash(t *testing.T) {
fsMap := []SwitchedFileSystem{ fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""}, SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"/home"}, SwitchedFileSystem{Prefix: "/home"},
SwitchedFileSystem{Prefix:"usr/"}, SwitchedFileSystem{Prefix: "usr/"},
} }
sfs := NewSwitchFileSystem(fsMap) sfs := NewSwitchFileSystem(fsMap)
for path, expectPrefix := range map[string]string { for path, expectPrefix := range map[string]string{
"home/foo/bar": "home", "home/foo/bar": "home",
"usr/local": "usr", "usr/local": "usr",
} { } {
_, fs := sfs.findFileSystem(path) _, fs := sfs.findFileSystem(path)
if fs.Prefix != expectPrefix { if fs.Prefix != expectPrefix {
...@@ -26,21 +26,21 @@ func TestSwitchFsSlash(t *testing.T) { ...@@ -26,21 +26,21 @@ func TestSwitchFsSlash(t *testing.T) {
func TestSwitchFs(t *testing.T) { func TestSwitchFs(t *testing.T) {
fsMap := []SwitchedFileSystem{ fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""}, SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"home/foo"}, SwitchedFileSystem{Prefix: "home/foo"},
SwitchedFileSystem{Prefix:"home"}, SwitchedFileSystem{Prefix: "home"},
SwitchedFileSystem{Prefix:"usr"}, SwitchedFileSystem{Prefix: "usr"},
} }
sfs := NewSwitchFileSystem(fsMap) sfs := NewSwitchFileSystem(fsMap)
for path, expectPrefix := range map[string]string { for path, expectPrefix := range map[string]string{
"xyz": "", "xyz": "",
"home/foo/bar": "home/foo", "home/foo/bar": "home/foo",
"home/fooz/bar": "home", "home/fooz/bar": "home",
"home/efg": "home", "home/efg": "home",
"lib": "", "lib": "",
"abc": "", "abc": "",
"usr/local": "usr", "usr/local": "usr",
} { } {
_, fs := sfs.findFileSystem(path) _, fs := sfs.findFileSystem(path)
if fs.Prefix != expectPrefix { if fs.Prefix != expectPrefix {
...@@ -53,19 +53,19 @@ func TestSwitchFs(t *testing.T) { ...@@ -53,19 +53,19 @@ func TestSwitchFs(t *testing.T) {
func TestSwitchFsStrip(t *testing.T) { func TestSwitchFsStrip(t *testing.T) {
fsMap := []SwitchedFileSystem{ fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""}, SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"dev", StripPrefix: true}, SwitchedFileSystem{Prefix: "dev", StripPrefix: true},
SwitchedFileSystem{Prefix:"home", StripPrefix: false}, SwitchedFileSystem{Prefix: "home", StripPrefix: false},
} }
sfs := NewSwitchFileSystem(fsMap) sfs := NewSwitchFileSystem(fsMap)
// Don't check for inputs ending in '/' since Go-FUSE never // Don't check for inputs ending in '/' since Go-FUSE never
// generates them. // generates them.
for path, expectPath := range map[string]string { for path, expectPath := range map[string]string{
"xyz": "xyz", "xyz": "xyz",
"home/foo/bar": "home/foo/bar", "home/foo/bar": "home/foo/bar",
"home": "home", "home": "home",
"dev/null": "null", "dev/null": "null",
"dev": "", "dev": "",
} { } {
stripPath, _ := sfs.findFileSystem(path) stripPath, _ := sfs.findFileSystem(path)
if stripPath != expectPath { if stripPath != expectPath {
......
...@@ -76,7 +76,7 @@ func (me *AutoUnionFs) addAutomaticFs(roots []string) { ...@@ -76,7 +76,7 @@ func (me *AutoUnionFs) addAutomaticFs(roots []string) {
} }
} }
func (me *AutoUnionFs) createFs(name string, roots []string) (fuse.Status) { func (me *AutoUnionFs) createFs(name string, roots []string) fuse.Status {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
......
...@@ -109,7 +109,7 @@ func (me *CachingFileSystem) GetAttr(name string) (*os.FileInfo, fuse.Status) { ...@@ -109,7 +109,7 @@ func (me *CachingFileSystem) GetAttr(name string) (*os.FileInfo, fuse.Status) {
Mode: fuse.S_IFREG | 0777, Mode: fuse.S_IFREG | 0777,
},fuse.OK },fuse.OK
} }
r := me.attributes.Get(name).(*attrResponse) r := me.attributes.Get(name).(*attrResponse)
return r.FileInfo, r.Status return r.FileInfo, r.Status
} }
......
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