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

Run Gofmt.

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