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
3c358ed9
Commit
3c358ed9
authored
Aug 11, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented getFuseConn (compiles but never was run)
parent
2d21448b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
4 deletions
+53
-4
fuse/fuse.go
fuse/fuse.go
+53
-4
No files found.
fuse/fuse.go
View file @
3c358ed9
...
...
@@ -7,6 +7,8 @@ import (
"net"
"os"
"path"
"syscall"
"unsafe"
)
type
FileSystem
interface
{
...
...
@@ -77,11 +79,58 @@ func (m *MountPoint) Unmount() (err os.Error) {
return
}
func
recvmsg
(
fd
int
,
msg
*
syscall
.
Msghdr
,
flags
int
)
(
n
int
,
errno
int
)
{
n1
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_RECVMSG
,
uintptr
(
fd
),
uintptr
(
unsafe
.
Pointer
(
msg
)),
uintptr
(
flags
))
n
=
int
(
n1
)
errno
=
int
(
e1
)
return
}
func
Recvmsg
(
fd
int
,
msg
*
syscall
.
Msghdr
,
flags
int
)
(
n
int
,
err
os
.
Error
)
{
n
,
errno
:=
recvmsg
(
fd
,
msg
,
flags
)
if
errno
!=
0
{
err
=
os
.
NewSyscallError
(
"recvmsg"
,
errno
)
}
return
}
func
getFuseConn
(
local
net
.
Conn
)
(
f
*
os
.
File
,
err
os
.
Error
)
{
var
fd
int
return
nil
,
os
.
NewError
(
fmt
.
Sprintf
(
"receive_fuse_conn failed with errno: %d"
,
errno
))
// f = os.NewFile(fd, "fuse-conn")
// return
var
msg
syscall
.
Msghdr
var
iov
syscall
.
Iovec
base
:=
make
([]
int32
,
256
)
control
:=
make
([]
int32
,
256
)
iov
.
Base
=
(
*
byte
)(
unsafe
.
Pointer
(
&
base
))
iov
.
Len
=
uint64
(
len
(
base
)
*
4
)
msg
.
Iov
=
&
iov
msg
.
Iovlen
=
1
msg
.
Control
=
(
*
byte
)(
unsafe
.
Pointer
(
&
control
))
msg
.
Controllen
=
uint64
(
len
(
control
)
*
4
)
_
,
err
=
Recvmsg
(
local
.
File
()
.
Fd
(),
&
msg
,
0
)
if
err
!=
nil
{
return
}
length
:=
control
[
0
]
typ
:=
control
[
2
]
// syscall.Cmsghdr.Type
fd
:=
control
[
4
]
if
typ
!=
1
{
err
=
os
.
NewError
(
fmt
.
Sprintf
(
"getFuseConn: recvmsg returned wrong control type: %d"
,
typ
))
return
}
if
length
<
20
{
err
=
os
.
NewError
(
fmt
.
Sprintf
(
"getFuseConn: too short control message. Length: %d"
,
length
))
return
}
if
(
fd
<
0
)
{
err
=
os
.
NewError
(
fmt
.
Sprintf
(
"getFuseConn: fd < 0: %d"
,
fd
))
return
}
f
=
os
.
NewFile
(
int
(
fd
),
"fuse-conn"
)
return
}
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