Commit 05a51a96 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Debug print for filenames in notify/readlink.

parent 1ca9a271
......@@ -309,6 +309,7 @@ type operationHandler struct {
DecodeIn castPointerFunc
DecodeOut castPointerFunc
FileNames int
FileNameOut bool
}
var operationHandlers []*operationHandler
......@@ -338,6 +339,11 @@ func init() {
operationHandlers[i] = &operationHandler{Name: "UNKNOWN"}
}
fileOps := []opcode{_OP_READLINK, _OP_NOTIFY_ENTRY}
for _, op := range fileOps {
operationHandlers[op].FileNameOut = true
}
for op, sz := range map[opcode]uintptr{
_OP_FORGET: unsafe.Sizeof(ForgetIn{}),
_OP_GETATTR: unsafe.Sizeof(GetAttrIn{}),
......
package fuse
import (
"fmt"
"bytes"
"fmt"
"log"
"strings"
"unsafe"
)
......@@ -70,8 +71,13 @@ func (me *request) OutputDebug() string {
flatStr := ""
if len(me.flatData) > 0 {
if me.handler.FileNameOut {
s := strings.TrimRight(string(me.flatData), "\x00")
flatStr = fmt.Sprintf(" %q", s)
} else {
flatStr = fmt.Sprintf(" %d bytes data\n", len(me.flatData))
}
}
return fmt.Sprintf("Serialize: %v code: %v value: %v%v",
me.inHeader.opcode, me.status, dataStr, flatStr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment