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

Threading fixes: one input buffer per goroutine, allow debug with

threaded.
parent 9ab6ad5b
...@@ -196,10 +196,9 @@ func (self *MountState) syncWrite(packet [][]byte) { ...@@ -196,10 +196,9 @@ func (self *MountState) syncWrite(packet [][]byte) {
// Logic for the control loop. // Logic for the control loop.
func (self *MountState) loop() { func (self *MountState) loop() {
buf := make([]byte, bufSize)
// See fuse_kern_chan_receive() // See fuse_kern_chan_receive()
for { for {
buf := make([]byte, bufSize)
n, err := self.mountFile.Read(buf) n, err := self.mountFile.Read(buf)
if err != nil { if err != nil {
errNo := OsErrorToFuseError(err) errNo := OsErrorToFuseError(err)
...@@ -224,7 +223,7 @@ func (self *MountState) loop() { ...@@ -224,7 +223,7 @@ func (self *MountState) loop() {
break break
} }
if self.threaded && !self.Debug { if self.threaded {
go self.handle(buf[0:n]) go self.handle(buf[0:n])
} else { } else {
self.handle(buf[0:n]) self.handle(buf[0:n])
...@@ -372,7 +371,7 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b ...@@ -372,7 +371,7 @@ func dispatch(state *MountState, h *InHeader, arg *bytes.Buffer) (outBytes [][]b
// TODO - figure out how to support this // TODO - figure out how to support this
// case FUSE_INTERRUPT // case FUSE_INTERRUPT
default: default:
state.Error(os.NewError(fmt.Sprintf("Unsupported OpCode: %d", h.Opcode))) state.Error(os.NewError(fmt.Sprintf("Unsupported OpCode: %d=%v", h.Opcode, operationName(h.Opcode))))
return serialize(h, ENOSYS, nil, false) return serialize(h, ENOSYS, nil, false)
} }
......
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