Better debug logging for getattr.
parent
85cd1cb299
commit
497407fde2
|
@ -248,9 +248,9 @@ func (c *Connection) ReadOp() (op fuseops.Op, err error) {
|
|||
// Debug logging
|
||||
if c.debugLogger != nil {
|
||||
if opErr == nil {
|
||||
op.Logf("-> %s OK", op.ShortDesc())
|
||||
op.Logf("-> OK: %s", op.DebugString())
|
||||
} else {
|
||||
op.Logf("-> %s error: %v", op.ShortDesc(), opErr)
|
||||
op.Logf("-> error: %v", opErr)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,11 @@ func (o *commonOp) ShortDesc() (desc string) {
|
|||
return
|
||||
}
|
||||
|
||||
func (o *commonOp) DebugString() string {
|
||||
// By default, defer to ShortDesc.
|
||||
return o.op.ShortDesc()
|
||||
}
|
||||
|
||||
func (o *commonOp) init(
|
||||
ctx context.Context,
|
||||
op internalOp,
|
||||
|
|
|
@ -32,6 +32,9 @@ type Op interface {
|
|||
// A short description of the op, to be used in logging.
|
||||
ShortDesc() string
|
||||
|
||||
// A long description of the op, to be used in debug logging.
|
||||
DebugString() string
|
||||
|
||||
// A context that can be used for long-running operations.
|
||||
Context() context.Context
|
||||
|
||||
|
@ -122,6 +125,14 @@ func (o *GetInodeAttributesOp) kernelResponse() (msg []byte) {
|
|||
return
|
||||
}
|
||||
|
||||
func (o *GetInodeAttributesOp) DebugString() string {
|
||||
return fmt.Sprintf(
|
||||
"Inode: %d, Exp: %v, Attr: %s",
|
||||
o.Inode,
|
||||
o.AttributesExpiration,
|
||||
o.Attributes.DebugString())
|
||||
}
|
||||
|
||||
// Change attributes for an inode.
|
||||
//
|
||||
// The kernel sends this for obvious cases like chmod(2), and for less obvious
|
||||
|
|
|
@ -97,6 +97,16 @@ type InodeAttributes struct {
|
|||
Gid uint32
|
||||
}
|
||||
|
||||
func (a *InodeAttributes) DebugString() string {
|
||||
return fmt.Sprintf(
|
||||
"%d %d %v %d %d",
|
||||
a.Size,
|
||||
a.Nlink,
|
||||
a.Mode,
|
||||
a.Uid,
|
||||
a.Gid)
|
||||
}
|
||||
|
||||
// A generation number for an inode. Irrelevant for file systems that won't be
|
||||
// exported over NFS. For those that will and that reuse inode IDs when they
|
||||
// become free, the generation number must change when an ID is reused.
|
||||
|
|
Loading…
Reference in New Issue