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

Run Gofmt.

parent 2445a2e9
......@@ -8,6 +8,7 @@ import (
"flag"
"runtime"
)
func main() {
// Scans the arg list and sets up flags
debug := flag.Bool("debug", false, "print debugging messages.")
......
......@@ -17,7 +17,7 @@ type subFsInfo struct {
GlobalNodeId uint64
// Maps Fs's Inodes back to the parent inode.
ParentNodeIds map[uint64] uint64
ParentNodeIds map[uint64]uint64
// This must always be the inner lock in the locking order.
ParentNodeIdsLock sync.RWMutex
......@@ -80,11 +80,11 @@ func (self *subInodeData) Deletable() bool {
// /config directory.
type SubmountFileSystem struct {
toplevelEntriesLock sync.RWMutex
toplevelEntries map[string] *subFsInfo
toplevelEntries map[string]*subFsInfo
// Mutex protects map and nextFreeInode.
nodeMapLock sync.RWMutex
nodeMap map[uint64] *subInodeData
nodeMap map[uint64]*subInodeData
nextFreeInode uint64
Options SubmountFileSystemOptions
......@@ -153,7 +153,7 @@ func (self *SubmountFileSystem) addFileSystem(name string, fs fuse.RawFileSystem
NodeId: fuse.FUSE_ROOT_ID,
LookupCount: 0,
}
subfs.ParentNodeIds = map[uint64]uint64{ fuse.FUSE_ROOT_ID: self.nextFreeInode }
subfs.ParentNodeIds = map[uint64]uint64{fuse.FUSE_ROOT_ID: self.nextFreeInode}
subfs.GlobalNodeId = self.nextFreeInode
subfs.Attr.Mode |= fuse.S_IFDIR
......@@ -180,7 +180,7 @@ func (self *SubmountFileSystem) removeFileSystem(name string) *subFsInfo {
self.nodeMapLock.Lock()
defer self.nodeMapLock.Unlock()
for _, v := range(self.nodeMap) {
for _, v := range self.nodeMap {
if v.SubFs == subfs {
v.SubFs = nil
}
......@@ -197,7 +197,7 @@ func (self *SubmountFileSystem) listFileSystems() ([]string, []uint32) {
modes := make([]uint32, len(self.toplevelEntries))
j := 0
for name, entry := range (self.toplevelEntries) {
for name, entry := range self.toplevelEntries {
names[j] = name
modes[j] = entry.Attr.Mode
j++
......@@ -306,11 +306,11 @@ func (self *SubmountFileSystem) Forget(h *fuse.InHeader, input *fuse.ForgetIn) {
}
}
func NewSubmountFileSystem() (*SubmountFileSystem) {
func NewSubmountFileSystem() *SubmountFileSystem {
out := new(SubmountFileSystem)
out.nextFreeInode = fuse.FUSE_ROOT_ID + 1
out.nodeMap = make(map[uint64] *subInodeData)
out.toplevelEntries = make(map[string] *subFsInfo)
out.nodeMap = make(map[uint64]*subInodeData)
out.toplevelEntries = make(map[string]*subFsInfo)
out.Options.TimeoutOptions = fuse.MakeTimeoutOptions()
return out
}
......@@ -321,7 +321,7 @@ func (self *SubmountFileSystem) Init(h *fuse.InHeader, input *fuse.InitIn) (*fus
}
func (self *SubmountFileSystem) Destroy(h *fuse.InHeader, input *fuse.InitIn) {
for _, v := range(self.toplevelEntries) {
for _, v := range self.toplevelEntries {
v.Fs.Destroy(h, input)
}
}
......@@ -579,7 +579,7 @@ func (self *SubmountFileSystem) Poll(header *fuse.InHeader, input *fuse.PollIn)
}
func (self *SubmountFileSystem) OpenDir(header *fuse.InHeader, input *fuse.OpenIn) (flags uint32, fuseFile fuse.RawFuseDir, status fuse.Status) {
if (header.NodeId == fuse.FUSE_ROOT_ID) {
if header.NodeId == fuse.FUSE_ROOT_ID {
return 0, NewSubmountFileSystemTopDir(self), fuse.OK
}
......@@ -613,7 +613,7 @@ func (self *SubmountFileSystemTopDir) ReadDir(input *fuse.ReadIn) (*fuse.DirEntr
for self.nextRead < len(self.names) {
i := self.nextRead
if (de.AddString(self.names[i], fuse.FUSE_UNKNOWN_INO, self.modes[i])) {
if de.AddString(self.names[i], fuse.FUSE_UNKNOWN_INO, self.modes[i]) {
self.nextRead++
} else {
break
......@@ -629,5 +629,3 @@ func (self *SubmountFileSystemTopDir) ReleaseDir() {
func (self *SubmountFileSystemTopDir) FsyncDir(input *fuse.FsyncIn) (code fuse.Status) {
return fuse.ENOENT
}
......@@ -116,7 +116,7 @@ func (self *testCase) testReaddir() {
self.tester.Errorf("Unexpected name %v", v.Name)
}
if v.Mode & 0777 != magicMode {
if v.Mode&0777 != magicMode {
self.tester.Errorf("Unexpected mode %o, %v", v.Mode, v)
}
}
......@@ -142,7 +142,7 @@ func (self *testCase) testSubFs() {
continue
}
content1 := "booh!"
f, err = os.Open(mountFile, os.O_WRONLY | os.O_CREATE, magicMode)
f, err = os.Open(mountFile, os.O_WRONLY|os.O_CREATE, magicMode)
if err != nil {
self.tester.Errorf("Create %v", err)
}
......@@ -159,7 +159,7 @@ func (self *testCase) testSubFs() {
if err != nil {
self.tester.Errorf("Lstat %v", err)
} else {
if fi.Mode & 0777 != magicMode {
if fi.Mode&0777 != magicMode {
self.tester.Errorf("Mode %o", fi.Mode)
}
}
......@@ -184,7 +184,7 @@ func (self *testCase) testSubFs() {
func (self *testCase) testAddRemove() {
self.tester.Log("testAddRemove")
attr := fuse.Attr{
Mode:0755,
Mode: 0755,
}
conn := fuse.NewPathFileSystemConnector(NewPassThroughFuse(self.origDir1))
......
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