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