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
ce646996
Commit
ce646996
authored
Apr 22, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop errorChannel and threaded from MountState.
parent
78e16260
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
41 deletions
+8
-41
fuse/fuse.go
fuse/fuse.go
+8
-41
No files found.
fuse/fuse.go
View file @
ce646996
...
...
@@ -54,11 +54,6 @@ type MountState struct {
// I/O with kernel and daemon.
mountFile
*
os
.
File
errorChannel
chan
os
.
Error
// Run each operation in its own Go-routine.
threaded
bool
// Dump debug info onto stdout.
Debug
bool
...
...
@@ -74,9 +69,6 @@ type MountState struct {
// Mount filesystem on mountPoint.
//
// If threaded is set, each filesystem operation executes in a
// separate goroutine.
//
// TODO - error handling should perhaps be user-serviceable.
func
(
me
*
MountState
)
Mount
(
mountPoint
string
)
os
.
Error
{
file
,
mp
,
err
:=
mount
(
mountPoint
)
...
...
@@ -91,22 +83,6 @@ func (me *MountState) Mount(mountPoint string) os.Error {
return
nil
}
// Normally, callers should run loop() and wait for FUSE to exit, but
// tests will want to run this in a goroutine.
func
(
me
*
MountState
)
Loop
(
threaded
bool
)
{
me
.
threaded
=
threaded
if
me
.
threaded
{
me
.
errorChannel
=
make
(
chan
os
.
Error
,
100
)
go
me
.
DefaultErrorHandler
()
}
me
.
loop
()
if
me
.
threaded
{
close
(
me
.
errorChannel
)
}
}
func
(
me
*
MountState
)
Unmount
()
os
.
Error
{
// Todo: flush/release all files/dirs?
result
:=
unmount
(
me
.
mountPoint
)
...
...
@@ -116,22 +92,8 @@ func (me *MountState) Unmount() os.Error {
return
result
}
func
(
me
*
MountState
)
DefaultErrorHandler
()
{
for
err
:=
range
me
.
errorChannel
{
if
err
==
os
.
EOF
||
err
==
nil
{
break
}
log
.
Println
(
"error: "
,
err
)
}
}
func
(
me
*
MountState
)
Error
(
err
os
.
Error
)
{
// It is safe to do errors unthreaded, since the logger is thread-safe.
if
!
me
.
threaded
||
me
.
Debug
{
log
.
Println
(
"error: "
,
err
)
}
else
{
me
.
errorChannel
<-
err
}
log
.
Println
(
"error: "
,
err
)
}
func
(
me
*
MountState
)
Write
(
req
*
request
)
{
...
...
@@ -233,7 +195,12 @@ func (me *MountState) discardRequest(req *request) {
me
.
buffers
.
FreeBuffer
(
req
.
flatData
)
}
func
(
me
*
MountState
)
loop
()
{
// Normally, callers should run Loop() and wait for FUSE to exit, but
// tests will want to run this in a goroutine.
//
// If threaded is set, each filesystem operation executes in a
// separate goroutine.
func
(
me
*
MountState
)
Loop
(
threaded
bool
)
{
// See fuse_kern_chan_receive()
for
{
req
:=
me
.
newRequest
()
...
...
@@ -263,7 +230,7 @@ func (me *MountState) loop() {
break
}
if
me
.
threaded
{
if
threaded
{
go
me
.
handle
(
req
)
}
else
{
me
.
handle
(
req
)
...
...
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