Commit 6a7e4067 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt on dummyfuse* and fuse.go.

parent 16a98c3e
...@@ -129,7 +129,7 @@ func (self *DummyFuseFile) FsyncDir(input *FsyncIn) (code Status) { ...@@ -129,7 +129,7 @@ func (self *DummyFuseFile) FsyncDir(input *FsyncIn) (code Status) {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// DummyPathFuse // DummyPathFuse
type DummyPathFuse struct {} type DummyPathFuse struct{}
func (self *DummyPathFuse) GetAttr(name string) (*Attr, Status) { func (self *DummyPathFuse) GetAttr(name string) (*Attr, Status) {
return nil, ENOSYS return nil, ENOSYS
......
...@@ -14,4 +14,3 @@ func TestDummy(t *testing.T) { ...@@ -14,4 +14,3 @@ func TestDummy(t *testing.T) {
NewPathFileSystemConnector(pathFs) NewPathFileSystemConnector(pathFs)
} }
...@@ -15,9 +15,7 @@ const ( ...@@ -15,9 +15,7 @@ const (
bufSize = 66000 bufSize = 66000
) )
type Empty interface { type Empty interface{}
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// State related to this mount point. // State related to this mount point.
...@@ -27,11 +25,11 @@ type MountState struct { ...@@ -27,11 +25,11 @@ type MountState struct {
// otherwise our files may be GCd. Here, the index is the Fh // otherwise our files may be GCd. Here, the index is the Fh
// field // field
openedFiles map[uint64] RawFuseFile openedFiles map[uint64]RawFuseFile
openedFilesMutex sync.RWMutex openedFilesMutex sync.RWMutex
nextFreeFile uint64 nextFreeFile uint64
openedDirs map[uint64] RawFuseDir openedDirs map[uint64]RawFuseDir
openedDirsMutex sync.RWMutex openedDirsMutex sync.RWMutex
nextFreeDir uint64 nextFreeDir uint64
...@@ -162,8 +160,8 @@ func (self *MountState) Write(packet [][]byte) { ...@@ -162,8 +160,8 @@ func (self *MountState) Write(packet [][]byte) {
func NewMountState(fs RawFileSystem) *MountState { func NewMountState(fs RawFileSystem) *MountState {
self := new(MountState) self := new(MountState)
self.openedDirs = make(map[uint64] RawFuseDir) self.openedDirs = make(map[uint64]RawFuseDir)
self.openedFiles = make(map[uint64] RawFuseFile) self.openedFiles = make(map[uint64]RawFuseFile)
self.mountPoint = "" self.mountPoint = ""
self.fileSystem = fs self.fileSystem = fs
return self return self
...@@ -204,12 +202,12 @@ func (self *MountState) loop() { ...@@ -204,12 +202,12 @@ func (self *MountState) loop() {
// According to fuse_chan_receive() // According to fuse_chan_receive()
if errNo == syscall.ENODEV { if errNo == syscall.ENODEV {
break; break
} }
// What I see on linux-x86 2.6.35.10. // What I see on linux-x86 2.6.35.10.
if errNo == syscall.ENOSYS { if errNo == syscall.ENOSYS {
break; break
} }
readErr := os.NewError(fmt.Sprintf("Failed to read from fuse conn: %v", err)) readErr := os.NewError(fmt.Sprintf("Failed to read from fuse conn: %v", err))
...@@ -246,8 +244,6 @@ func (self *MountState) handle(in_data []byte) { ...@@ -246,8 +244,6 @@ func (self *MountState) handle(in_data []byte) {
} }
func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]byte) { func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]byte) {
input := newInput(h.Opcode) input := newInput(h.Opcode)
if input != nil && !parseLittleEndian(arg, input) { if input != nil && !parseLittleEndian(arg, input) {
...@@ -263,10 +259,10 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b ...@@ -263,10 +259,10 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b
filename := "" filename := ""
// Perhaps a map is faster? // Perhaps a map is faster?
if (h.Opcode == FUSE_UNLINK || h.Opcode == FUSE_RMDIR || if h.Opcode == FUSE_UNLINK || h.Opcode == FUSE_RMDIR ||
h.Opcode == FUSE_LOOKUP || h.Opcode == FUSE_MKDIR || h.Opcode == FUSE_LOOKUP || h.Opcode == FUSE_MKDIR ||
h.Opcode == FUSE_MKNOD || h.Opcode == FUSE_CREATE || h.Opcode == FUSE_MKNOD || h.Opcode == FUSE_CREATE ||
h.Opcode == FUSE_LINK) { h.Opcode == FUSE_LINK {
filename = strings.TrimRight(string(arg.Bytes()), "\x00") filename = strings.TrimRight(string(arg.Bytes()), "\x00")
} }
...@@ -405,7 +401,7 @@ func serialize(h *InHeader, res Status, out interface{}) (data [][]byte) { ...@@ -405,7 +401,7 @@ func serialize(h *InHeader, res Status, out interface{}) (data [][]byte) {
return data return data
} }
func initFuse(state* MountState, h *InHeader, input *InitIn) (Empty, Status) { func initFuse(state *MountState, h *InHeader, input *InitIn) (Empty, Status) {
out, initStatus := state.fileSystem.Init(h, input) out, initStatus := state.fileSystem.Init(h, input)
if initStatus != OK { if initStatus != OK {
return nil, initStatus return nil, initStatus
...@@ -433,7 +429,7 @@ func initFuse(state* MountState, h *InHeader, input *InitIn) (Empty, Status) { ...@@ -433,7 +429,7 @@ func initFuse(state* MountState, h *InHeader, input *InitIn) (Empty, Status) {
// Handling files. // Handling files.
func doOpen(state *MountState, header *InHeader, input *OpenIn) (genericOut Empty, code Status) { func doOpen(state *MountState, header *InHeader, input *OpenIn) (genericOut Empty, code Status) {
flags, fuseFile, status := state.fileSystem.Open(header, input); flags, fuseFile, status := state.fileSystem.Open(header, input)
if status != OK { if status != OK {
return nil, status return nil, status
} }
...@@ -447,7 +443,7 @@ func doOpen(state *MountState, header *InHeader, input *OpenIn) (genericOut Empt ...@@ -447,7 +443,7 @@ func doOpen(state *MountState, header *InHeader, input *OpenIn) (genericOut Empt
} }
func doCreate(state *MountState, header *InHeader, input *CreateIn, name string) (genericOut Empty, code Status) { func doCreate(state *MountState, header *InHeader, input *CreateIn, name string) (genericOut Empty, code Status) {
flags, fuseFile, entry, status := state.fileSystem.Create(header, input, name); flags, fuseFile, entry, status := state.fileSystem.Create(header, input, name)
if status != OK { if status != OK {
return nil, status return nil, status
} }
...@@ -501,7 +497,7 @@ func doReleaseDir(state *MountState, header *InHeader, input *ReleaseIn) (out Em ...@@ -501,7 +497,7 @@ func doReleaseDir(state *MountState, header *InHeader, input *ReleaseIn) (out Em
} }
func doOpenDir(state *MountState, header *InHeader, input *OpenIn) (genericOut Empty, code Status) { func doOpenDir(state *MountState, header *InHeader, input *OpenIn) (genericOut Empty, code Status) {
flags, fuseDir, status := state.fileSystem.OpenDir(header, input); flags, fuseDir, status := state.fileSystem.OpenDir(header, input)
if status != OK { if status != OK {
return nil, status return nil, status
} }
......
...@@ -264,7 +264,7 @@ func (self *PathFileSystemConnector) Symlink(header *InHeader, pointedTo string, ...@@ -264,7 +264,7 @@ func (self *PathFileSystemConnector) Symlink(header *InHeader, pointedTo string,
} }
func (self *PathFileSystemConnector) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status) { func (self *PathFileSystemConnector) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status) {
// TODO - should also update the path <-> inode mapping?
oldPath := path.Join(self.GetPath(header.NodeId), oldName) oldPath := path.Join(self.GetPath(header.NodeId), oldName)
newPath := path.Join(self.GetPath(input.Newdir), newName) newPath := path.Join(self.GetPath(input.Newdir), newName)
return self.fileSystem.Rename(oldPath, newPath) return self.fileSystem.Rename(oldPath, newPath)
......
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