Commit be9bf672 authored by Aaron Jacobs's avatar Aaron Jacobs

Connection.ReadOp

parent 4f1efbe4
......@@ -85,6 +85,12 @@ func (c *Connection) log(
c.logger.Println(msg)
}
// Set up state for an op that is about to be returned to the user.
func (c *Connection) beginOp()
// Clean up all state associated with an op to which the user has responded.
func (c *Connection) finishOp()
// Read the next op from the kernel process. Return io.EOF if the kernel has
// closed the connection.
//
......@@ -122,14 +128,16 @@ func (c *Connection) ReadOp() (op fuseops.Op, err error) {
c.log(opID, calldepth+1, format, v...)
}
op = fuseops.Convert(c.parentCtx, bfReq, logForOp, &c.opsInFlight)
finished := func(err error) { c.finishOp() }
op = fuseops.Convert(c.parentCtx, bfReq, logForOp, finished)
if op == nil {
c.log(opID, 1, "-> ENOSYS: %v", bfReq)
bfReq.RespondError(ENOSYS)
continue
}
c.opsInFlight.Add(1)
c.beginOp()
return
}
}
......
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