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

Run Gofmt.

parent 20262305
...@@ -66,8 +66,8 @@ func (me *DirEntryList) Bytes() []byte { ...@@ -66,8 +66,8 @@ func (me *DirEntryList) Bytes() []byte {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
type FuseDir struct { type FuseDir struct {
stream chan DirEntry stream chan DirEntry
leftOver DirEntry leftOver DirEntry
DefaultRawFuseDir DefaultRawFuseDir
} }
...@@ -116,7 +116,7 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) { ...@@ -116,7 +116,7 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
// Read everything so we make goroutines exit. // Read everything so we make goroutines exit.
func (me *FuseDir) Release() { func (me *FuseDir) Release() {
for ok := true; ok && me.stream != nil; { for ok := true; ok && me.stream != nil; {
_, ok = <-me.stream _, ok = <-me.stream
if !ok { if !ok {
break break
} }
......
...@@ -529,7 +529,7 @@ func doOpen(state *MountState, header *InHeader, input *OpenIn) (unsafe.Pointer, ...@@ -529,7 +529,7 @@ func doOpen(state *MountState, header *InHeader, input *OpenIn) (unsafe.Pointer,
if status != OK { if status != OK {
return nil, status return nil, status
} }
out := new(OpenOut) out := new(OpenOut)
out.Fh = handle out.Fh = handle
out.OpenFlags = flags out.OpenFlags = flags
...@@ -609,4 +609,3 @@ func doReadDir(state *MountState, header *InHeader, input *ReadIn) (out []byte, ...@@ -609,4 +609,3 @@ func doReadDir(state *MountState, header *InHeader, input *ReadIn) (out []byte,
} }
return entries.Bytes(), code return entries.Bytes(), code
} }
...@@ -64,7 +64,7 @@ func (me *testCase) Setup(t *testing.T) { ...@@ -64,7 +64,7 @@ func (me *testCase) Setup(t *testing.T) {
rfs = me.connector rfs = me.connector
rfs = NewTimingRawFilesystem(rfs) rfs = NewTimingRawFilesystem(rfs)
rfs = NewLockingRawFilesystem(rfs) rfs = NewLockingRawFilesystem(rfs)
me.connector.Debug = true me.connector.Debug = true
me.state = NewMountState(rfs) me.state = NewMountState(rfs)
me.state.Mount(me.mountPoint) me.state.Mount(me.mountPoint)
......
...@@ -44,7 +44,7 @@ func OsErrorToFuseError(err os.Error) Status { ...@@ -44,7 +44,7 @@ func OsErrorToFuseError(err os.Error) Status {
} }
func replyString(opcode uint32, ptr unsafe.Pointer) string { func replyString(opcode uint32, ptr unsafe.Pointer) string {
var val interface{} var val interface{}
switch opcode { switch opcode {
case FUSE_LOOKUP: case FUSE_LOOKUP:
val = (*EntryOut)(ptr) val = (*EntryOut)(ptr)
......
...@@ -36,7 +36,7 @@ type inode struct { ...@@ -36,7 +36,7 @@ type inode struct {
Name string Name string
LookupCount int LookupCount int
OpenCount int OpenCount int
Type uint32 // dirent type, used to check if mounts are valid. Type uint32 // dirent type, used to check if mounts are valid.
mount *mountData mount *mountData
} }
...@@ -143,7 +143,7 @@ type PathFileSystemConnector struct { ...@@ -143,7 +143,7 @@ type PathFileSystemConnector struct {
Debug bool Debug bool
//////////////// ////////////////
// Protects the inode hashmap, its contents and the nextFreeInode counter. // Protects the inode hashmap, its contents and the nextFreeInode counter.
lock sync.RWMutex lock sync.RWMutex
...@@ -152,8 +152,8 @@ type PathFileSystemConnector struct { ...@@ -152,8 +152,8 @@ type PathFileSystemConnector struct {
nextFreeInode uint64 nextFreeInode uint64
// Open files/directories. // Open files/directories.
fileLock sync.RWMutex fileLock sync.RWMutex
openFiles map[uint64]interface{} openFiles map[uint64]interface{}
nextFreeHandle uint64 nextFreeHandle uint64
} }
...@@ -179,7 +179,7 @@ func (me *PathFileSystemConnector) registerFile(node *inode, f interface{}) uint ...@@ -179,7 +179,7 @@ func (me *PathFileSystemConnector) registerFile(node *inode, f interface{}) uint
if ok { if ok {
panic("handle counter wrapped") panic("handle counter wrapped")
} }
node.OpenCount++ node.OpenCount++
me.openFiles[h] = f me.openFiles[h] = f
return h return h
...@@ -190,7 +190,7 @@ func (me *PathFileSystemConnector) getDir(h uint64) RawFuseDir { ...@@ -190,7 +190,7 @@ func (me *PathFileSystemConnector) getDir(h uint64) RawFuseDir {
defer me.fileLock.RUnlock() defer me.fileLock.RUnlock()
return me.openFiles[h].(RawFuseDir) return me.openFiles[h].(RawFuseDir)
} }
func (me *PathFileSystemConnector) getFile(h uint64) FuseFile { func (me *PathFileSystemConnector) getFile(h uint64) FuseFile {
me.fileLock.RLock() me.fileLock.RLock()
defer me.fileLock.RUnlock() defer me.fileLock.RUnlock()
...@@ -215,7 +215,7 @@ func (me *PathFileSystemConnector) newInode() *inode { ...@@ -215,7 +215,7 @@ func (me *PathFileSystemConnector) newInode() *inode {
me.nextFreeInode++ me.nextFreeInode++
me.inodeMap[data.NodeId] = data me.inodeMap[data.NodeId] = data
return data return data
} }
...@@ -325,7 +325,7 @@ func NewPathFileSystemConnector(fs PathFilesystem) (out *PathFileSystemConnector ...@@ -325,7 +325,7 @@ func NewPathFileSystemConnector(fs PathFilesystem) (out *PathFileSystemConnector
out = new(PathFileSystemConnector) out = new(PathFileSystemConnector)
out.inodeMap = make(map[uint64]*inode) out.inodeMap = make(map[uint64]*inode)
out.openFiles = make(map[uint64]interface{}) out.openFiles = make(map[uint64]interface{})
out.nextFreeInode = FUSE_ROOT_ID out.nextFreeInode = FUSE_ROOT_ID
rootData := out.newInode() rootData := out.newInode()
rootData.NodeId = FUSE_ROOT_ID rootData.NodeId = FUSE_ROOT_ID
...@@ -374,7 +374,7 @@ func (me *PathFileSystemConnector) Mount(mountPoint string, fs PathFilesystem) S ...@@ -374,7 +374,7 @@ func (me *PathFileSystemConnector) Mount(mountPoint string, fs PathFilesystem) S
if hasChildren { if hasChildren {
return EBUSY return EBUSY
} }
code := fs.Mount(me) code := fs.Mount(me)
if code != OK { if code != OK {
if me.Debug { if me.Debug {
...@@ -538,7 +538,7 @@ func (me *PathFileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (fla ...@@ -538,7 +538,7 @@ func (me *PathFileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (fla
de.stream = stream de.stream = stream
h := me.registerFile(node, de) h := me.registerFile(node, de)
return 0, h, OK return 0, h, OK
} }
...@@ -556,14 +556,14 @@ func (me *PathFileSystemConnector) Open(header *InHeader, input *OpenIn) (flags ...@@ -556,14 +556,14 @@ func (me *PathFileSystemConnector) Open(header *InHeader, input *OpenIn) (flags
if mount == nil { if mount == nil {
return 0, 0, ENOENT return 0, 0, ENOENT
} }
// TODO - how to handle return flags, the FUSE open flags? // TODO - how to handle return flags, the FUSE open flags?
f, err := mount.fs.Open(fullPath, input.Flags) f, err := mount.fs.Open(fullPath, input.Flags)
if err != OK { if err != OK {
return 0, 0, err return 0, 0, err
} }
h := me.registerFile(node, f) h := me.registerFile(node, f)
return 0, h, OK return 0, h, OK
} }
...@@ -741,7 +741,7 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam ...@@ -741,7 +741,7 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam
if err != OK { if err != OK {
return 0, 0, nil, err return 0, 0, nil, err
} }
out, code, inode := me.internalLookupWithNode(parent, name, 1) out, code, inode := me.internalLookupWithNode(parent, name, 1)
return 0, me.registerFile(inode, f), out, code return 0, me.registerFile(inode, f), out, code
} }
......
...@@ -207,6 +207,6 @@ func (me *TimingRawFilesystem) ReleaseDir(header *InHeader, input *ReleaseIn) { ...@@ -207,6 +207,6 @@ func (me *TimingRawFilesystem) ReleaseDir(header *InHeader, input *ReleaseIn) {
} }
func (me *TimingRawFilesystem) FsyncDir(header *InHeader, input *FsyncIn) (code Status) { func (me *TimingRawFilesystem) FsyncDir(header *InHeader, input *FsyncIn) (code Status) {
defer me.startTimer("FsyncDir")() defer me.startTimer("FsyncDir")()
return me.Original.FsyncDir(header, input) return me.Original.FsyncDir(header, input)
} }
...@@ -541,7 +541,7 @@ type RawFileSystem interface { ...@@ -541,7 +541,7 @@ type RawFileSystem interface {
OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status) OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status)
ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status) ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status)
ReleaseDir(header *InHeader, input *ReleaseIn) ReleaseDir(header *InHeader, input *ReleaseIn)
FsyncDir(header *InHeader, input *FsyncIn) (code Status) FsyncDir(header *InHeader, input *FsyncIn) (code Status)
} }
type FuseFile interface { type FuseFile interface {
......
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