Connection.ReadOp

geesefs-0-30-9
Aaron Jacobs 2015-05-05 10:04:03 +10:00
parent 4f1efbe41b
commit be9bf6720f
1 changed files with 10 additions and 2 deletions

View File

@ -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
}
}