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
Kirill Smelkov
go-fuse
Commits
2982f4ec
Commit
2982f4ec
authored
Jun 22, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide Debug public members behind SetDebug method.
parent
0abb4be6
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
80 additions
and
48 deletions
+80
-48
benchmark/stat_test.go
benchmark/stat_test.go
+1
-1
example/autounionfs/main.go
example/autounionfs/main.go
+3
-3
example/loopback/main.go
example/loopback/main.go
+1
-1
example/memfs/main.go
example/memfs/main.go
+1
-1
example/multizip/main.go
example/multizip/main.go
+1
-1
example/statfs/main.go
example/statfs/main.go
+1
-1
example/unionfs/main.go
example/unionfs/main.go
+1
-1
example/zipfs/main.go
example/zipfs/main.go
+1
-1
fuse/api.go
fuse/api.go
+6
-0
fuse/defaultnode.go
fuse/defaultnode.go
+4
-0
fuse/defaultraw.go
fuse/defaultraw.go
+3
-0
fuse/fsconnector.go
fuse/fsconnector.go
+6
-2
fuse/fsmount.go
fuse/fsmount.go
+1
-1
fuse/lockingfs.go
fuse/lockingfs.go
+5
-0
fuse/memnode_test.go
fuse/memnode_test.go
+3
-3
fuse/mountstate.go
fuse/mountstate.go
+10
-6
fuse/pathfs/pathfs.go
fuse/pathfs/pathfs.go
+7
-3
fuse/pathfs/xattr_test.go
fuse/pathfs/xattr_test.go
+1
-1
fuse/test/cache_test.go
fuse/test/cache_test.go
+7
-7
fuse/test/defaultread_test.go
fuse/test/defaultread_test.go
+1
-1
fuse/test/delete_test.go
fuse/test/delete_test.go
+1
-1
fuse/test/fsetattr_test.go
fuse/test/fsetattr_test.go
+1
-1
unionfs/autounion.go
unionfs/autounion.go
+7
-5
unionfs/autounion_test.go
unionfs/autounion_test.go
+2
-2
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+3
-3
zipfs/multizip_test.go
zipfs/multizip_test.go
+1
-1
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+1
-1
No files found.
benchmark/stat_test.go
View file @
2982f4ec
...
...
@@ -27,7 +27,7 @@ func setupFs(fs pathfs.FileSystem) (string, func()) {
panic
(
fmt
.
Sprintf
(
"cannot mount %v"
,
err
))
// ugh - benchmark has no error methods.
}
state
.
SetRecordStatistics
(
true
)
// state.
Debug = true
// state.
SetDebug(true)
go
state
.
Loop
()
return
mountPoint
,
func
()
{
...
...
example/autounionfs/main.go
View file @
2982f4ec
...
...
@@ -67,9 +67,9 @@ func main() {
os
.
Exit
(
1
)
}
pathfs
.
Debug
=
*
debug
conn
.
Debug
=
*
debug
state
.
Debug
=
*
debug
pathfs
.
SetDebug
(
*
debug
)
conn
.
SetDebug
(
*
debug
)
state
.
SetDebug
(
*
debug
)
gofs
.
SetMountState
(
state
)
gofs
.
SetFileSystemConnector
(
conn
)
...
...
example/loopback/main.go
View file @
2982f4ec
...
...
@@ -44,7 +44,7 @@ func main() {
pathFs
:=
pathfs
.
NewPathNodeFs
(
finalFs
,
nil
)
conn
:=
fuse
.
NewFileSystemConnector
(
pathFs
,
opts
)
state
:=
fuse
.
NewMountState
(
conn
)
state
.
Debug
=
*
debug
state
.
SetDebug
(
*
debug
)
mountPoint
:=
flag
.
Arg
(
0
)
...
...
example/memfs/main.go
View file @
2982f4ec
...
...
@@ -29,7 +29,7 @@ func main() {
fs
:=
fuse
.
NewMemNodeFs
(
prefix
)
conn
:=
fuse
.
NewFileSystemConnector
(
fs
,
nil
)
state
:=
fuse
.
NewMountState
(
conn
)
state
.
Debug
=
*
debug
state
.
SetDebug
(
*
debug
)
fmt
.
Println
(
"Mounting"
)
err
:=
state
.
Mount
(
mountPoint
,
nil
)
...
...
example/multizip/main.go
View file @
2982f4ec
...
...
@@ -32,6 +32,6 @@ func main() {
os
.
Exit
(
1
)
}
state
.
Debug
=
*
debug
state
.
SetDebug
(
*
debug
)
state
.
Loop
()
}
example/statfs/main.go
View file @
2982f4ec
...
...
@@ -62,7 +62,7 @@ func main() {
}
state
.
SetRecordStatistics
(
*
latencies
)
state
.
Debug
=
*
debug
state
.
SetDebug
(
*
debug
)
runtime
.
GC
()
if
profFile
!=
nil
{
pprof
.
StartCPUProfile
(
profFile
)
...
...
example/unionfs/main.go
View file @
2982f4ec
...
...
@@ -53,6 +53,6 @@ func main() {
log
.
Fatal
(
"Mount fail:"
,
err
)
}
mountState
.
Debug
=
*
debug
mountState
.
SetDebug
(
*
debug
)
mountState
.
Loop
()
}
example/zipfs/main.go
View file @
2982f4ec
...
...
@@ -64,7 +64,7 @@ func main() {
}
state
.
SetRecordStatistics
(
*
latencies
)
state
.
Debug
=
*
debug
state
.
SetDebug
(
*
debug
)
runtime
.
GC
()
if
profFile
!=
nil
{
pprof
.
StartCPUProfile
(
profFile
)
...
...
fuse/api.go
View file @
2982f4ec
...
...
@@ -33,6 +33,9 @@ type NodeFileSystem interface {
// Used for debug outputs
String
()
string
// If called, provide debug output through the log package.
SetDebug
(
debug
bool
)
}
// The FsNode implements the basic functionality of inodes; this is
...
...
@@ -227,6 +230,9 @@ type DefaultFile struct{}
type
RawFileSystem
interface
{
String
()
string
// If called, provide debug output through the log package.
SetDebug
(
debug
bool
)
Lookup
(
out
*
raw
.
EntryOut
,
context
*
Context
,
name
string
)
(
status
Status
)
Forget
(
nodeid
,
nlookup
uint64
)
...
...
fuse/defaultnode.go
View file @
2982f4ec
...
...
@@ -25,6 +25,10 @@ func (fs *DefaultNodeFileSystem) String() string {
return
"DefaultNodeFileSystem"
}
func
(
fs
*
DefaultNodeFileSystem
)
SetDebug
(
dbg
bool
)
{
}
////////////////////////////////////////////////////////////////
// FsNode default
...
...
fuse/defaultraw.go
View file @
2982f4ec
...
...
@@ -15,6 +15,9 @@ func (fs *DefaultRawFileSystem) String() string {
return
os
.
Args
[
0
]
}
func
(
fs
*
DefaultRawFileSystem
)
SetDebug
(
dbg
bool
)
{
}
func
(
fs
*
DefaultRawFileSystem
)
StatFs
(
out
*
StatfsOut
,
context
*
Context
)
Status
{
return
ENOSYS
}
...
...
fuse/fsconnector.go
View file @
2982f4ec
...
...
@@ -37,7 +37,7 @@ type FileSystemConnector struct {
DefaultRawFileSystem
D
ebug
bool
d
ebug
bool
// Callbacks for talking back to the kernel.
fsInit
RawFsInit
...
...
@@ -82,6 +82,10 @@ func NewFileSystemConnector(nodeFs NodeFileSystem, opts *FileSystemOptions) (c *
return
c
}
func
(
c
*
FileSystemConnector
)
SetDebug
(
debug
bool
)
{
c
.
debug
=
debug
}
func
(
c
*
FileSystemConnector
)
nextGeneration
()
uint64
{
return
atomic
.
AddUint64
(
&
c
.
generation
,
1
)
}
...
...
@@ -281,7 +285,7 @@ func (c *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileS
parent
.
addChild
(
name
,
node
)
node
.
mountPoint
.
parentInode
=
parent
if
c
.
D
ebug
{
if
c
.
d
ebug
{
log
.
Println
(
"Mount: "
,
nodeFs
,
"on subdir"
,
name
,
"parent"
,
c
.
inodeMap
.
Handle
(
&
parent
.
handled
))
}
...
...
fuse/fsmount.go
View file @
2982f4ec
...
...
@@ -81,7 +81,7 @@ func (m *fileSystemMount) fillAttr(out *raw.AttrOut, nodeId uint64) {
func
(
m
*
fileSystemMount
)
getOpenedFile
(
h
uint64
)
*
openedFile
{
b
:=
(
*
openedFile
)(
unsafe
.
Pointer
(
m
.
openFiles
.
Decode
(
h
)))
if
m
.
connector
.
D
ebug
&&
b
.
WithFlags
.
Description
!=
""
{
if
m
.
connector
.
d
ebug
&&
b
.
WithFlags
.
Description
!=
""
{
log
.
Printf
(
"File %d = %q"
,
h
,
b
.
WithFlags
.
Description
)
}
return
b
...
...
fuse/lockingfs.go
View file @
2982f4ec
...
...
@@ -38,6 +38,11 @@ func (fs *lockingRawFileSystem) Lookup(out *raw.EntryOut, h *Context, name strin
return
fs
.
RawFS
.
Lookup
(
out
,
h
,
name
)
}
func
(
fs
*
lockingRawFileSystem
)
SetDebug
(
dbg
bool
)
{
defer
fs
.
locked
()()
fs
.
RawFS
.
SetDebug
(
dbg
)
}
func
(
fs
*
lockingRawFileSystem
)
Forget
(
nodeID
uint64
,
nlookup
uint64
)
{
defer
fs
.
locked
()()
fs
.
RawFS
.
Forget
(
nodeID
,
nlookup
)
...
...
fuse/memnode_test.go
View file @
2982f4ec
...
...
@@ -29,12 +29,12 @@ func setupMemNodeTest(t *testing.T) (wd string, fs *MemNodeFs, clean func()) {
AttrTimeout
:
testTtl
,
NegativeTimeout
:
0.0
,
})
connector
.
Debug
=
VerboseTest
(
)
connector
.
SetDebug
(
VerboseTest
()
)
state
:=
NewMountState
(
connector
)
state
.
Mount
(
mnt
,
nil
)
//me.state.
Debug = false
state
.
Debug
=
VerboseTest
(
)
//me.state.
SetDebug(false)
state
.
SetDebug
(
VerboseTest
()
)
// Unthreaded, but in background.
go
state
.
Loop
()
...
...
fuse/mountstate.go
View file @
2982f4ec
...
...
@@ -30,7 +30,7 @@ type MountState struct {
mountFd
int
// Dump debug info onto stdout.
D
ebug
bool
d
ebug
bool
latencies
*
LatencyMap
...
...
@@ -67,6 +67,10 @@ func (ms *MountState) ThreadSanitizerSync() {
ms
.
reqMu
.
Unlock
()
}
func
(
ms
*
MountState
)
SetDebug
(
dbg
bool
)
{
ms
.
debug
=
dbg
}
func
(
ms
*
MountState
)
KernelSettings
()
raw
.
InitIn
{
ms
.
reqMu
.
Lock
()
s
:=
ms
.
kernelSettings
...
...
@@ -342,7 +346,7 @@ func (ms *MountState) handleRequest(req *request) {
req
.
status
=
ENOSYS
}
if
req
.
status
.
Ok
()
&&
ms
.
D
ebug
{
if
req
.
status
.
Ok
()
&&
ms
.
d
ebug
{
log
.
Println
(
req
.
InputDebug
())
}
...
...
@@ -382,7 +386,7 @@ func (ms *MountState) write(req *request) Status {
}
header
:=
req
.
serializeHeader
(
req
.
flatDataSize
())
if
ms
.
D
ebug
{
if
ms
.
d
ebug
{
log
.
Println
(
req
.
OutputDebug
())
}
...
...
@@ -412,7 +416,7 @@ func (ms *MountState) writeInodeNotify(entry *raw.NotifyInvalInodeOut) Status {
result
:=
ms
.
write
(
&
req
)
ms
.
reqMu
.
Unlock
()
if
ms
.
D
ebug
{
if
ms
.
d
ebug
{
log
.
Println
(
"Response: INODE_NOTIFY"
,
result
)
}
return
result
...
...
@@ -449,7 +453,7 @@ func (ms *MountState) writeDeleteNotify(parent uint64, child uint64, name string
result
:=
ms
.
write
(
&
req
)
ms
.
reqMu
.
Unlock
()
if
ms
.
D
ebug
{
if
ms
.
d
ebug
{
log
.
Printf
(
"Response: DELETE_NOTIFY: %v"
,
result
)
}
return
result
...
...
@@ -481,7 +485,7 @@ func (ms *MountState) writeEntryNotify(parent uint64, name string) Status {
result
:=
ms
.
write
(
&
req
)
ms
.
reqMu
.
Unlock
()
if
ms
.
D
ebug
{
if
ms
.
d
ebug
{
log
.
Printf
(
"Response: ENTRY_NOTIFY: %v"
,
result
)
}
return
result
...
...
fuse/pathfs/pathfs.go
View file @
2982f4ec
...
...
@@ -29,7 +29,7 @@ type clientInodePath struct {
// linked files. The clientInode is never exported back to the kernel;
// it is only used to maintain a list of all names of an inode.
type
PathNodeFs
struct
{
D
ebug
bool
d
ebug
bool
fs
FileSystem
root
*
pathInode
connector
*
fuse
.
FileSystemConnector
...
...
@@ -44,6 +44,10 @@ type PathNodeFs struct {
options
*
PathNodeFsOptions
}
func
(
fs
*
PathNodeFs
)
SetDebug
(
dbg
bool
)
{
fs
.
debug
=
dbg
}
func
(
fs
*
PathNodeFs
)
Mount
(
path
string
,
nodeFs
fuse
.
NodeFileSystem
,
opts
*
fuse
.
FileSystemOptions
)
fuse
.
Status
{
dir
,
name
:=
filepath
.
Split
(
path
)
if
dir
!=
""
{
...
...
@@ -264,7 +268,7 @@ func (n *pathInode) GetPath() string {
n
.
pathFs
.
pathLock
.
RUnlock
()
path
:=
string
(
pathBytes
)
if
n
.
pathFs
.
D
ebug
{
if
n
.
pathFs
.
d
ebug
{
// TODO: print node ID.
log
.
Printf
(
"Inode = %q (%s)"
,
path
,
n
.
fs
.
String
())
}
...
...
@@ -510,7 +514,7 @@ func (n *pathInode) createChild(isDir bool) *pathInode {
func
(
n
*
pathInode
)
Open
(
flags
uint32
,
context
*
fuse
.
Context
)
(
file
fuse
.
File
,
code
fuse
.
Status
)
{
file
,
code
=
n
.
fs
.
Open
(
n
.
GetPath
(),
flags
,
context
)
if
n
.
pathFs
.
D
ebug
{
if
n
.
pathFs
.
d
ebug
{
file
=
&
fuse
.
WithFlags
{
File
:
file
,
Description
:
n
.
GetPath
(),
...
...
fuse/pathfs/xattr_test.go
View file @
2982f4ec
...
...
@@ -115,7 +115,7 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func())
if
err
!=
nil
{
t
.
Fatalf
(
"TempDir failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
return
mountPoint
,
func
()
{
...
...
fuse/test/cache_test.go
View file @
2982f4ec
...
...
@@ -47,9 +47,9 @@ func setupCacheTest(t *testing.T) (string, *pathfs.PathNodeFs, func()) {
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
conn
.
Debug
=
fuse
.
VerboseTest
(
)
pfs
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
conn
.
SetDebug
(
fuse
.
VerboseTest
()
)
pfs
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
return
dir
,
pfs
,
func
()
{
...
...
@@ -147,7 +147,7 @@ func TestNonseekable(t *testing.T) {
if
err
!=
nil
{
t
.
Fatalf
(
"failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
defer
state
.
Unmount
()
go
state
.
Loop
()
...
...
@@ -181,9 +181,9 @@ func TestGetAttrRace(t *testing.T) {
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
conn
.
Debug
=
fuse
.
VerboseTest
(
)
pfs
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
conn
.
SetDebug
(
fuse
.
VerboseTest
()
)
pfs
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
defer
state
.
Unmount
()
...
...
fuse/test/defaultread_test.go
View file @
2982f4ec
...
...
@@ -44,7 +44,7 @@ func defaultReadTest(t *testing.T) (root string, cleanup func()) {
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
return
dir
,
func
()
{
...
...
fuse/test/delete_test.go
View file @
2982f4ec
...
...
@@ -46,7 +46,7 @@ func TestDeleteNotify(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
defer
state
.
Unmount
()
...
...
fuse/test/fsetattr_test.go
View file @
2982f4ec
...
...
@@ -142,7 +142,7 @@ func setupFAttrTest(t *testing.T, fs pathfs.FileSystem) (dir string, clean func(
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
...
...
unionfs/autounion.go
View file @
2982f4ec
...
...
@@ -27,7 +27,8 @@ type knownFs struct {
// A union for A/B/C will placed under directory A-B-C.
type
AutoUnionFs
struct
{
pathfs
.
DefaultFileSystem
debug
bool
lock
sync
.
RWMutex
knownFileSystems
map
[
string
]
knownFs
nameRootMap
map
[
string
]
string
...
...
@@ -269,13 +270,14 @@ func (fs *AutoUnionFs) Symlink(pointedTo string, linkName string, context *fuse.
func
(
fs
*
AutoUnionFs
)
SetDebug
(
b
bool
)
{
// Officially, this should use locking, but we don't care
// about race conditions here.
fs
.
nodeFs
.
Debug
=
b
fs
.
connector
.
Debug
=
b
fs
.
mountState
.
Debug
=
b
fs
.
debug
=
b
fs
.
nodeFs
.
SetDebug
(
b
)
fs
.
connector
.
SetDebug
(
b
)
fs
.
mountState
.
SetDebug
(
b
)
}
func
(
fs
*
AutoUnionFs
)
hasDebug
()
bool
{
return
fs
.
nodeFs
.
D
ebug
return
fs
.
d
ebug
}
func
(
fs
*
AutoUnionFs
)
Unlink
(
path
string
,
context
*
fuse
.
Context
)
(
code
fuse
.
Status
)
{
...
...
unionfs/autounion_test.go
View file @
2982f4ec
...
...
@@ -60,8 +60,8 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
conn
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
conn
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
return
wd
,
func
()
{
...
...
unionfs/unionfs_test.go
View file @
2982f4ec
...
...
@@ -97,8 +97,8 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
conn
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
Debug
=
fuse
.
VerboseTest
(
)
conn
.
SetDebug
(
fuse
.
VerboseTest
()
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
return
wd
,
func
()
{
...
...
@@ -1118,7 +1118,7 @@ func TestUnionFsDisappearing(t *testing.T) {
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
defer
state
.
Unmount
()
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
log
.
Println
(
"TestUnionFsDisappearing2"
)
...
...
zipfs/multizip_test.go
View file @
2982f4ec
...
...
@@ -27,7 +27,7 @@ func setupMzfs(t *testing.T) (mountPoint string, cleanup func()) {
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
return
mountPoint
,
func
()
{
...
...
zipfs/zipfs_test.go
View file @
2982f4ec
...
...
@@ -27,7 +27,7 @@ func setupZipfs(t *testing.T) (mountPoint string, cleanup func()) {
mountPoint
,
_
=
ioutil
.
TempDir
(
""
,
""
)
state
,
_
,
err
:=
fuse
.
MountNodeFileSystem
(
mountPoint
,
zfs
,
nil
)
state
.
Debug
=
fuse
.
VerboseTest
(
)
state
.
SetDebug
(
fuse
.
VerboseTest
()
)
go
state
.
Loop
()
return
mountPoint
,
func
()
{
...
...
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