Renamed existing debug logging functions.
parent
df7aea90d2
commit
e0db5cf622
|
@ -40,7 +40,7 @@ var fTraceByPID = flag.Bool(
|
||||||
|
|
||||||
// A connection to the fuse kernel process.
|
// A connection to the fuse kernel process.
|
||||||
type Connection struct {
|
type Connection struct {
|
||||||
logger *log.Logger
|
debugLogger *log.Logger
|
||||||
wrapped *bazilfuse.Conn
|
wrapped *bazilfuse.Conn
|
||||||
opsInFlight sync.WaitGroup
|
opsInFlight sync.WaitGroup
|
||||||
|
|
||||||
|
@ -68,10 +68,10 @@ type Connection struct {
|
||||||
// result. You must call c.close() eventually.
|
// result. You must call c.close() eventually.
|
||||||
func newConnection(
|
func newConnection(
|
||||||
parentCtx context.Context,
|
parentCtx context.Context,
|
||||||
logger *log.Logger,
|
debugLogger *log.Logger,
|
||||||
wrapped *bazilfuse.Conn) (c *Connection, err error) {
|
wrapped *bazilfuse.Conn) (c *Connection, err error) {
|
||||||
c = &Connection{
|
c = &Connection{
|
||||||
logger: logger,
|
debugLogger: debugLogger,
|
||||||
wrapped: wrapped,
|
wrapped: wrapped,
|
||||||
parentCtx: parentCtx,
|
parentCtx: parentCtx,
|
||||||
cancelFuncs: make(map[bazilfuse.RequestID]func()),
|
cancelFuncs: make(map[bazilfuse.RequestID]func()),
|
||||||
|
@ -83,7 +83,7 @@ func newConnection(
|
||||||
|
|
||||||
// Log information for an operation with the given ID. calldepth is the depth
|
// Log information for an operation with the given ID. calldepth is the depth
|
||||||
// to use when recovering file:line information with runtime.Caller.
|
// to use when recovering file:line information with runtime.Caller.
|
||||||
func (c *Connection) log(
|
func (c *Connection) debugLog(
|
||||||
opID uint32,
|
opID uint32,
|
||||||
calldepth int,
|
calldepth int,
|
||||||
format string,
|
format string,
|
||||||
|
@ -108,7 +108,7 @@ func (c *Connection) log(
|
||||||
fmt.Sprintf(format, v...))
|
fmt.Sprintf(format, v...))
|
||||||
|
|
||||||
// Print it.
|
// Print it.
|
||||||
c.logger.Println(msg)
|
c.debugLogger.Println(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOCKS_EXCLUDED(c.mu)
|
// LOCKS_EXCLUDED(c.mu)
|
||||||
|
@ -316,13 +316,13 @@ func (c *Connection) ReadOp() (op fuseops.Op, err error) {
|
||||||
c.nextOpID++
|
c.nextOpID++
|
||||||
|
|
||||||
// Log the receipt of the operation.
|
// Log the receipt of the operation.
|
||||||
c.log(opID, 1, "<- %v", bfReq)
|
c.debugLog(opID, 1, "<- %v", bfReq)
|
||||||
|
|
||||||
// Special case: responding to statfs is required to make mounting work on
|
// Special case: responding to statfs is required to make mounting work on
|
||||||
// OS X. We don't currently expose the capability for the file system to
|
// OS X. We don't currently expose the capability for the file system to
|
||||||
// intercept this.
|
// intercept this.
|
||||||
if statfsReq, ok := bfReq.(*bazilfuse.StatfsRequest); ok {
|
if statfsReq, ok := bfReq.(*bazilfuse.StatfsRequest); ok {
|
||||||
c.log(opID, 1, "-> (Statfs) OK")
|
c.debugLog(opID, 1, "-> (Statfs) OK")
|
||||||
statfsReq.Respond(&bazilfuse.StatfsResponse{})
|
statfsReq.Respond(&bazilfuse.StatfsResponse{})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -336,13 +336,13 @@ func (c *Connection) ReadOp() (op fuseops.Op, err error) {
|
||||||
// Set up op dependencies.
|
// Set up op dependencies.
|
||||||
opCtx := c.beginOp(bfReq)
|
opCtx := c.beginOp(bfReq)
|
||||||
|
|
||||||
logForOp := func(calldepth int, format string, v ...interface{}) {
|
debugLogForOp := func(calldepth int, format string, v ...interface{}) {
|
||||||
c.log(opID, calldepth+1, format, v...)
|
c.debugLog(opID, calldepth+1, format, v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
finished := func(err error) { c.finishOp(bfReq) }
|
finished := func(err error) { c.finishOp(bfReq) }
|
||||||
|
|
||||||
op = fuseops.Convert(opCtx, bfReq, logForOp, finished)
|
op = fuseops.Convert(opCtx, bfReq, debugLogForOp, finished)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ type commonOp struct {
|
||||||
// The underlying bazilfuse request for this op.
|
// The underlying bazilfuse request for this op.
|
||||||
bazilReq bazilfuse.Request
|
bazilReq bazilfuse.Request
|
||||||
|
|
||||||
// A function that can be used to log information about the op. The first
|
// A function that can be used to log debug information about the op. The
|
||||||
// argument is a call depth.
|
// first argument is a call depth.
|
||||||
log func(int, string, ...interface{})
|
debugLog func(int, string, ...interface{})
|
||||||
|
|
||||||
// A function that is invoked with the error given to Respond, for use in
|
// A function that is invoked with the error given to Respond, for use in
|
||||||
// closing off traces and reporting back to the connection.
|
// closing off traces and reporting back to the connection.
|
||||||
|
@ -76,13 +76,13 @@ func (o *commonOp) init(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op internalOp,
|
op internalOp,
|
||||||
bazilReq bazilfuse.Request,
|
bazilReq bazilfuse.Request,
|
||||||
log func(int, string, ...interface{}),
|
debugLog func(int, string, ...interface{}),
|
||||||
finished func(error)) {
|
finished func(error)) {
|
||||||
// Initialize basic fields.
|
// Initialize basic fields.
|
||||||
o.ctx = ctx
|
o.ctx = ctx
|
||||||
o.op = op
|
o.op = op
|
||||||
o.bazilReq = bazilReq
|
o.bazilReq = bazilReq
|
||||||
o.log = log
|
o.debugLog = debugLog
|
||||||
o.finished = finished
|
o.finished = finished
|
||||||
|
|
||||||
// Set up a trace span for this op.
|
// Set up a trace span for this op.
|
||||||
|
@ -111,7 +111,7 @@ func (o *commonOp) Context() context.Context {
|
||||||
|
|
||||||
func (o *commonOp) Logf(format string, v ...interface{}) {
|
func (o *commonOp) Logf(format string, v ...interface{}) {
|
||||||
const calldepth = 2
|
const calldepth = 2
|
||||||
o.log(calldepth, format, v...)
|
o.debugLog(calldepth, format, v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *commonOp) Respond(err error) {
|
func (o *commonOp) Respond(err error) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import (
|
||||||
func Convert(
|
func Convert(
|
||||||
opCtx context.Context,
|
opCtx context.Context,
|
||||||
r bazilfuse.Request,
|
r bazilfuse.Request,
|
||||||
logForOp func(int, string, ...interface{}),
|
debugLogForOp func(int, string, ...interface{}),
|
||||||
finished func(error)) (o Op) {
|
finished func(error)) (o Op) {
|
||||||
var co *commonOp
|
var co *commonOp
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ func Convert(
|
||||||
co = &to.commonOp
|
co = &to.commonOp
|
||||||
}
|
}
|
||||||
|
|
||||||
co.init(opCtx, io, r, logForOp, finished)
|
co.init(opCtx, io, r, debugLogForOp, finished)
|
||||||
|
|
||||||
o = io
|
o = io
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue