Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-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
Levin Zimmermann
go-fuse
Commits
5af34567
Commit
5af34567
authored
May 09, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add LoggingFileSystem, an FS that prints which functions are executed.
parent
c13cb759
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
1 deletion
+142
-1
fuse/Makefile
fuse/Makefile
+2
-1
fuse/loggingfs.go
fuse/loggingfs.go
+140
-0
No files found.
fuse/Makefile
View file @
5af34567
...
...
@@ -22,7 +22,8 @@ GOFILES=api.go \
pathdebug.go
\
opcode.go
\
pathops.go
\
latencymap.go
latencymap.go
\
loggingfs.go
include
$(GOROOT)/src/Make.pkg
fuse/loggingfs.go
0 → 100644
View file @
5af34567
package
fuse
import
(
"log"
"os"
"fmt"
)
var
_
=
log
.
Print
var
_
=
fmt
.
Print
// LoggingFileSystem is a wrapper that prints out what a FileSystem is doing.
type
LoggingFileSystem
struct
{
FileSystem
}
func
NewLoggingFileSystem
(
fs
FileSystem
)
*
LoggingFileSystem
{
t
:=
new
(
LoggingFileSystem
)
t
.
FileSystem
=
fs
return
t
}
func
(
me
*
LoggingFileSystem
)
Print
(
name
string
,
arg
string
)
{
log
.
Printf
(
"Op %s arg %s"
,
name
,
arg
)
}
func
(
me
*
LoggingFileSystem
)
GetAttr
(
name
string
)
(
*
os
.
FileInfo
,
Status
)
{
me
.
Print
(
"GetAttr"
,
name
)
return
me
.
FileSystem
.
GetAttr
(
name
)
}
func
(
me
*
LoggingFileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
me
.
Print
(
"GetXAttr"
,
name
)
return
me
.
FileSystem
.
GetXAttr
(
name
,
attr
)
}
func
(
me
*
LoggingFileSystem
)
SetXAttr
(
name
string
,
attr
string
,
data
[]
byte
,
flags
int
)
Status
{
me
.
Print
(
"SetXAttr"
,
name
)
return
me
.
FileSystem
.
SetXAttr
(
name
,
attr
,
data
,
flags
)
}
func
(
me
*
LoggingFileSystem
)
ListXAttr
(
name
string
)
([]
string
,
Status
)
{
me
.
Print
(
"ListXAttr"
,
name
)
return
me
.
FileSystem
.
ListXAttr
(
name
)
}
func
(
me
*
LoggingFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
)
Status
{
me
.
Print
(
"RemoveXAttr"
,
name
)
return
me
.
FileSystem
.
RemoveXAttr
(
name
,
attr
)
}
func
(
me
*
LoggingFileSystem
)
Readlink
(
name
string
)
(
string
,
Status
)
{
me
.
Print
(
"Readlink"
,
name
)
return
me
.
FileSystem
.
Readlink
(
name
)
}
func
(
me
*
LoggingFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
Status
{
me
.
Print
(
"Mknod"
,
name
)
return
me
.
FileSystem
.
Mknod
(
name
,
mode
,
dev
)
}
func
(
me
*
LoggingFileSystem
)
Mkdir
(
name
string
,
mode
uint32
)
Status
{
me
.
Print
(
"Mkdir"
,
name
)
return
me
.
FileSystem
.
Mkdir
(
name
,
mode
)
}
func
(
me
*
LoggingFileSystem
)
Unlink
(
name
string
)
(
code
Status
)
{
me
.
Print
(
"Unlink"
,
name
)
return
me
.
FileSystem
.
Unlink
(
name
)
}
func
(
me
*
LoggingFileSystem
)
Rmdir
(
name
string
)
(
code
Status
)
{
me
.
Print
(
"Rmdir"
,
name
)
return
me
.
FileSystem
.
Rmdir
(
name
)
}
func
(
me
*
LoggingFileSystem
)
Symlink
(
value
string
,
linkName
string
)
(
code
Status
)
{
me
.
Print
(
"Symlink"
,
linkName
)
return
me
.
FileSystem
.
Symlink
(
value
,
linkName
)
}
func
(
me
*
LoggingFileSystem
)
Rename
(
oldName
string
,
newName
string
)
(
code
Status
)
{
me
.
Print
(
"Rename"
,
oldName
)
return
me
.
FileSystem
.
Rename
(
oldName
,
newName
)
}
func
(
me
*
LoggingFileSystem
)
Link
(
oldName
string
,
newName
string
)
(
code
Status
)
{
me
.
Print
(
"Link"
,
newName
)
return
me
.
FileSystem
.
Link
(
oldName
,
newName
)
}
func
(
me
*
LoggingFileSystem
)
Chmod
(
name
string
,
mode
uint32
)
(
code
Status
)
{
me
.
Print
(
"Chmod"
,
name
)
return
me
.
FileSystem
.
Chmod
(
name
,
mode
)
}
func
(
me
*
LoggingFileSystem
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
me
.
Print
(
"Chown"
,
name
)
return
me
.
FileSystem
.
Chown
(
name
,
uid
,
gid
)
}
func
(
me
*
LoggingFileSystem
)
Truncate
(
name
string
,
offset
uint64
)
(
code
Status
)
{
me
.
Print
(
"Truncate"
,
name
)
return
me
.
FileSystem
.
Truncate
(
name
,
offset
)
}
func
(
me
*
LoggingFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
file
File
,
code
Status
)
{
me
.
Print
(
"Open"
,
name
)
return
me
.
FileSystem
.
Open
(
name
,
flags
)
}
func
(
me
*
LoggingFileSystem
)
OpenDir
(
name
string
)
(
stream
chan
DirEntry
,
status
Status
)
{
me
.
Print
(
"OpenDir"
,
name
)
return
me
.
FileSystem
.
OpenDir
(
name
)
}
func
(
me
*
LoggingFileSystem
)
Mount
(
conn
*
FileSystemConnector
)
Status
{
me
.
Print
(
"Mount"
,
""
)
return
me
.
FileSystem
.
Mount
(
conn
)
}
func
(
me
*
LoggingFileSystem
)
Unmount
()
{
me
.
Print
(
"Unmount"
,
""
)
me
.
FileSystem
.
Unmount
()
}
func
(
me
*
LoggingFileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
me
.
Print
(
"Access"
,
name
)
return
me
.
FileSystem
.
Access
(
name
,
mode
)
}
func
(
me
*
LoggingFileSystem
)
Create
(
name
string
,
flags
uint32
,
mode
uint32
)
(
file
File
,
code
Status
)
{
me
.
Print
(
"Create"
,
name
)
return
me
.
FileSystem
.
Create
(
name
,
flags
,
mode
)
}
func
(
me
*
LoggingFileSystem
)
Utimens
(
name
string
,
AtimeNs
uint64
,
CtimeNs
uint64
)
(
code
Status
)
{
me
.
Print
(
"Utimens"
,
name
)
return
me
.
FileSystem
.
Utimens
(
name
,
AtimeNs
,
CtimeNs
)
}
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