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
5d8ba04f
Commit
5d8ba04f
authored
Nov 30, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify socketpair function.
parent
53e99700
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
16 deletions
+4
-16
fuse/misc.go
fuse/misc.go
+1
-0
fuse/mount.go
fuse/mount.go
+3
-16
No files found.
fuse/misc.go
View file @
5d8ba04f
...
...
@@ -77,6 +77,7 @@ func CopyFileInfo(fi *os.FileInfo, attr *Attr) {
attr
.
Blksize
=
uint32
(
fi
.
Blksize
)
}
// TODO - expose in Go's syscall package.
func
writev
(
fd
int
,
iovecs
*
syscall
.
Iovec
,
cnt
int
)
(
n
int
,
errno
int
)
{
n1
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_WRITEV
,
...
...
fuse/mount.go
View file @
5d8ba04f
package
fuse
// Written with a look to http://ptspts.blogspot.com/2009/11/fuse-protocol-tutorial-for-linux-26.html
import
(
"fmt"
"log"
...
...
@@ -14,20 +13,8 @@ import (
var
fusermountBinary
string
var
umountBinary
string
func
Socketpair
(
network
string
)
(
l
,
r
*
os
.
File
,
err
error
)
{
var
domain
int
var
typ
int
switch
network
{
case
"unix"
:
domain
=
syscall
.
AF_UNIX
typ
=
syscall
.
SOCK_STREAM
case
"unixgram"
:
domain
=
syscall
.
AF_UNIX
typ
=
syscall
.
SOCK_SEQPACKET
default
:
log
.
Panicf
(
"unknown network %q"
,
network
)
}
fd
,
err
:=
syscall
.
Socketpair
(
domain
,
typ
,
0
)
func
unixgramSocketpair
()
(
l
,
r
*
os
.
File
,
err
error
)
{
fd
,
err
:=
syscall
.
Socketpair
(
syscall
.
AF_UNIX
,
syscall
.
SOCK_SEQPACKET
,
0
)
if
err
!=
nil
{
return
nil
,
nil
,
os
.
NewSyscallError
(
"socketpair"
,
err
.
(
syscall
.
Errno
))
...
...
@@ -40,7 +27,7 @@ func Socketpair(network string) (l, r *os.File, err error) {
// Create a FUSE FS on the specified mount point. The returned
// mount point is always absolute.
func
mount
(
mountPoint
string
,
options
string
)
(
f
*
os
.
File
,
finalMountPoint
string
,
err
error
)
{
local
,
remote
,
err
:=
Socketpair
(
"unixgram"
)
local
,
remote
,
err
:=
unixgramSocketpair
(
)
if
err
!=
nil
{
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