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 { ...@@ -309,6 +309,7 @@ type operationHandler struct {
DecodeIn castPointerFunc DecodeIn castPointerFunc
DecodeOut castPointerFunc DecodeOut castPointerFunc
FileNames int FileNames int
FileNameOut bool
} }
var operationHandlers []*operationHandler var operationHandlers []*operationHandler
...@@ -338,6 +339,11 @@ func init() { ...@@ -338,6 +339,11 @@ func init() {
operationHandlers[i] = &operationHandler{Name: "UNKNOWN"} 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{ for op, sz := range map[opcode]uintptr{
_OP_FORGET: unsafe.Sizeof(ForgetIn{}), _OP_FORGET: unsafe.Sizeof(ForgetIn{}),
_OP_GETATTR: unsafe.Sizeof(GetAttrIn{}), _OP_GETATTR: unsafe.Sizeof(GetAttrIn{}),
......
package fuse package fuse
import ( import (
"fmt"
"bytes" "bytes"
"fmt"
"log" "log"
"strings"
"unsafe" "unsafe"
) )
...@@ -70,7 +71,12 @@ func (me *request) OutputDebug() string { ...@@ -70,7 +71,12 @@ func (me *request) OutputDebug() string {
flatStr := "" flatStr := ""
if len(me.flatData) > 0 { if len(me.flatData) > 0 {
flatStr = fmt.Sprintf(" %d bytes data\n", len(me.flatData)) 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", return fmt.Sprintf("Serialize: %v code: %v value: %v%v",
......
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