commonOp.ShortDesc

geesefs-0-30-9
Aaron Jacobs 2015-07-24 08:41:16 +10:00
parent a2c287f90a
commit 36e4dd8331
1 changed files with 6 additions and 3 deletions

View File

@ -66,7 +66,8 @@ type commonOp struct {
}
func (o *commonOp) ShortDesc() (desc string) {
opName := reflect.TypeOf(o.op).String()
v := reflect.ValueOf(o.op)
opName := v.Type().String()
// Attempt to better handle the usual case: a string that looks like
// "*fuseops.GetInodeAttributesOp".
@ -76,8 +77,10 @@ func (o *commonOp) ShortDesc() (desc string) {
opName = opName[len(prefix) : len(opName)-len(suffix)]
}
// Include the inode number to which the op applies.
desc = fmt.Sprintf("%s(inode=%v)", opName, o.bazilReq.Hdr().Node)
// Include the inode number to which the op applies, if possible.
if f := v.FieldByName("Inode"); f.IsValid() {
desc = fmt.Sprintf("%s(inode=%v)", opName, f.Interface())
}
return
}