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

Run gofmt.

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