Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jacobsa-fuse
Commits
0b9db0a7
Commit
0b9db0a7
authored
May 16, 2016
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: improve debug logging, including more inode and name info.
To aid in debugging GoogleCloudPlatform/gcsfuse#170.
parent
652a72aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
connection.go
connection.go
+1
-1
debug.go
debug.go
+29
-4
No files found.
connection.go
View file @
0b9db0a7
...
...
@@ -471,7 +471,7 @@ func (c *Connection) Reply(ctx context.Context, opErr error) {
// Debug logging
if
c
.
debugLogger
!=
nil
{
if
opErr
==
nil
{
c
.
debugLog
(
fuseID
,
1
,
"-> OK
"
)
c
.
debugLog
(
fuseID
,
1
,
"-> OK
(%s)"
,
describeResponse
(
op
)
)
}
else
{
c
.
debugLog
(
fuseID
,
1
,
"-> Error: %q"
,
opErr
.
Error
())
}
...
...
debug.go
View file @
0b9db0a7
...
...
@@ -45,6 +45,16 @@ func describeRequest(op interface{}) (s string) {
addComponent
(
"inode %v"
,
f
.
Interface
())
}
// Include a parent inode number, if available.
if
f
:=
v
.
FieldByName
(
"Parent"
);
f
.
IsValid
()
{
addComponent
(
"parent %v"
,
f
.
Interface
())
}
// Include a name, if available.
if
f
:=
v
.
FieldByName
(
"Name"
);
f
.
IsValid
()
{
addComponent
(
"name %q"
,
f
.
Interface
())
}
// Handle special cases.
switch
typed
:=
op
.
(
type
)
{
case
*
interruptOp
:
...
...
@@ -53,10 +63,6 @@ func describeRequest(op interface{}) (s string) {
case
*
unknownOp
:
addComponent
(
"opcode %d"
,
typed
.
OpCode
)
case
*
fuseops
.
LookUpInodeOp
:
addComponent
(
"parent %d"
,
typed
.
Parent
)
addComponent
(
"name %q"
,
typed
.
Name
)
case
*
fuseops
.
SetInodeAttributesOp
:
if
typed
.
Size
!=
nil
{
addComponent
(
"size %d"
,
*
typed
.
Size
)
...
...
@@ -93,3 +99,22 @@ func describeRequest(op interface{}) (s string) {
// Otherwise, include the extra info.
return
fmt
.
Sprintf
(
"%s (%s)"
,
opName
(
op
),
strings
.
Join
(
components
,
", "
))
}
func
describeResponse
(
op
interface
{})
string
{
v
:=
reflect
.
ValueOf
(
op
)
.
Elem
()
// We will set up a comma-separated list of components.
var
components
[]
string
addComponent
:=
func
(
format
string
,
v
...
interface
{})
{
components
=
append
(
components
,
fmt
.
Sprintf
(
format
,
v
...
))
}
// Include a resulting inode number, if available.
if
f
:=
v
.
FieldByName
(
"Entry"
);
f
.
IsValid
()
{
if
entry
,
ok
:=
f
.
Interface
()
.
(
fuseops
.
ChildInodeEntry
);
ok
{
addComponent
(
"inode %v"
,
entry
.
Child
)
}
}
return
fmt
.
Sprintf
(
"%s"
,
strings
.
Join
(
components
,
", "
))
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment