Refactored fields a bit.

geesefs-0-30-9
Aaron Jacobs 2015-07-24 15:32:50 +10:00
parent ee2b961839
commit cd47dbb4b8
1 changed files with 10 additions and 3 deletions

View File

@ -38,6 +38,11 @@ type Connection struct {
errorLogger *log.Logger errorLogger *log.Logger
wrapped *fuseshim.Conn wrapped *fuseshim.Conn
// The device through which we're talking to the kernel, and the protocol
// version that we're using to talk to it.
dev *os.File
protocol fusekernel.Protocol
// The context from which all op contexts inherit. // The context from which all op contexts inherit.
parentCtx context.Context parentCtx context.Context
@ -66,6 +71,8 @@ func newConnection(
debugLogger: debugLogger, debugLogger: debugLogger,
errorLogger: errorLogger, errorLogger: errorLogger,
wrapped: wrapped, wrapped: wrapped,
dev: wrapped.Dev,
protocol: wrapped.Protocol(),
parentCtx: parentCtx, parentCtx: parentCtx,
cancelFuncs: make(map[uint64]func()), cancelFuncs: make(map[uint64]func()),
} }
@ -225,7 +232,7 @@ func (c *Connection) readMessage() (m *buffer.InMessage, err error) {
// Loop past transient errors. // Loop past transient errors.
for { for {
// Attempt a reaed. // Attempt a reaed.
err = m.Init(c.wrapped.Dev) err = m.Init(c.dev)
// Special cases: // Special cases:
// //
@ -258,7 +265,7 @@ func (c *Connection) readMessage() (m *buffer.InMessage, err error) {
// Write the supplied message to the kernel. // Write the supplied message to the kernel.
func (c *Connection) writeMessage(msg []byte) (err error) { func (c *Connection) writeMessage(msg []byte) (err error) {
// Avoid the retry loop in os.File.Write. // Avoid the retry loop in os.File.Write.
n, err := syscall.Write(int(c.wrapped.Dev.Fd()), msg) n, err := syscall.Write(int(c.dev.Fd()), msg)
if err != nil { if err != nil {
return return
} }
@ -341,7 +348,7 @@ func (c *Connection) ReadOp() (op fuseops.Op, err error) {
op, err = fuseops.Convert( op, err = fuseops.Convert(
opCtx, opCtx,
m, m,
c.wrapped.Protocol(), c.protocol,
debugLogForOp, debugLogForOp,
c.errorLogger, c.errorLogger,
sendReply) sendReply)