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
8d0ca045
Commit
8d0ca045
authored
Aug 11, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use binary.Read. It fails because the struct is private
parent
e2ee3e08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
fuse/fuse.go
fuse/fuse.go
+28
-0
No files found.
fuse/fuse.go
View file @
8d0ca045
...
...
@@ -3,6 +3,8 @@ package fuse
// Written with a look to http://ptspts.blogspot.com/2009/11/fuse-protocol-tutorial-for-linux-26.html
import
(
"bytes"
"encoding/binary"
"fmt"
"net"
"os"
...
...
@@ -11,6 +13,10 @@ import (
"unsafe"
)
const
(
bufSize
=
65536
+
100
// See the link above for the details
)
type
FileSystem
interface
{
}
...
...
@@ -58,9 +64,31 @@ func Mount(mountPoint string, fs FileSystem) (m *MountPoint, err os.Error) {
return
}
m
=
&
MountPoint
{
mountPoint
,
f
}
go
m
.
loop
()
return
}
func
(
m
*
MountPoint
)
loop
()
{
buf
:=
make
([]
byte
,
bufSize
)
f
:=
m
.
f
for
{
n
,
err
:=
f
.
Read
(
buf
)
r
:=
bytes
.
NewBuffer
(
buf
[
0
:
n
])
if
err
!=
nil
{
fmt
.
Printf
(
"MountPoint.loop: Read failed, err: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
var
h
fuse_in_header
err
=
binary
.
Read
(
r
,
binary
.
LittleEndian
,
&
h
)
if
err
!=
nil
{
fmt
.
Printf
(
"MountPoint.loop: binary.Read of fuse_in_header failed with err: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
fmt
.
Printf
(
"Here! n = %d, buf = %v, h = %v
\n
"
,
n
,
buf
[
0
:
n
],
h
)
os
.
Exit
(
0
)
}
}
func
(
m
*
MountPoint
)
Unmount
()
(
err
os
.
Error
)
{
if
m
==
nil
{
return
nil
...
...
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