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
48305247
Commit
48305247
authored
Dec 07, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move all syscall.Syscall calls into syscall.go.
parent
b1f87d34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
60 deletions
+54
-60
fuse/Makefile
fuse/Makefile
+1
-1
fuse/misc.go
fuse/misc.go
+0
-56
fuse/syscall.go
fuse/syscall.go
+53
-3
No files found.
fuse/Makefile
View file @
48305247
...
...
@@ -31,10 +31,10 @@ MANUAL_GOFILES=api.go \
fsops.go
\
readonlyfs.go
\
request.go
\
syscall.go
\
typeprint.go
\
types.go
\
version.go
\
xattr.go
\
GOFILES
=
$(MANUAL_GOFILES)
version.gen.go
...
...
fuse/misc.go
View file @
48305247
...
...
@@ -56,39 +56,6 @@ func splitDuration(dt time.Duration, secs *uint64, nsecs *uint32) {
*
secs
=
uint64
(
ns
/
1e9
)
}
// 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
,
uintptr
(
fd
),
uintptr
(
unsafe
.
Pointer
(
iovecs
)),
uintptr
(
cnt
))
return
int
(
n1
),
int
(
e1
)
}
func
Writev
(
fd
int
,
packet
[][]
byte
)
(
n
int
,
err
error
)
{
iovecs
:=
make
([]
syscall
.
Iovec
,
0
,
len
(
packet
))
for
_
,
v
:=
range
packet
{
if
v
==
nil
||
len
(
v
)
==
0
{
continue
}
vec
:=
syscall
.
Iovec
{
Base
:
&
v
[
0
],
}
vec
.
SetLen
(
len
(
v
))
iovecs
=
append
(
iovecs
,
vec
)
}
if
len
(
iovecs
)
==
0
{
return
0
,
nil
}
n
,
errno
:=
writev
(
fd
,
&
iovecs
[
0
],
len
(
iovecs
))
if
errno
!=
0
{
err
=
os
.
NewSyscallError
(
"writev"
,
syscall
.
Errno
(
errno
))
}
return
n
,
err
}
func
ModeToType
(
mode
uint32
)
uint32
{
return
(
mode
&
0170000
)
>>
12
}
...
...
@@ -105,13 +72,6 @@ func asSlice(ptr unsafe.Pointer, byteCount uintptr) []byte {
return
*
(
*
[]
byte
)(
unsafe
.
Pointer
(
h
))
}
func
ioctl
(
fd
int
,
cmd
int
,
arg
uintptr
)
(
int
,
int
)
{
r0
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_IOCTL
,
uintptr
(
fd
),
uintptr
(
cmd
),
uintptr
(
arg
))
val
:=
int
(
r0
)
errno
:=
int
(
e1
)
return
val
,
errno
}
func
Version
()
string
{
if
version
!=
nil
{
...
...
@@ -140,22 +100,6 @@ func VerboseTest() bool {
return
flag
!=
nil
&&
flag
.
Value
.
String
()
==
"true"
}
const
AT_FDCWD
=
-
100
func
Linkat
(
fd1
int
,
n1
string
,
fd2
int
,
n2
string
)
int
{
b1
:=
syscall
.
StringBytePtr
(
n1
)
b2
:=
syscall
.
StringBytePtr
(
n2
)
_
,
_
,
errNo
:=
syscall
.
Syscall6
(
syscall
.
SYS_LINKAT
,
uintptr
(
fd1
),
uintptr
(
unsafe
.
Pointer
(
b1
)),
uintptr
(
fd2
),
uintptr
(
unsafe
.
Pointer
(
b2
)),
0
,
0
)
return
int
(
errNo
)
}
func
init
()
{
p
:=
syscall
.
Getpagesize
()
if
p
!=
PAGESIZE
{
...
...
fuse/
xattr
.go
→
fuse/
syscall
.go
View file @
48305247
...
...
@@ -2,14 +2,40 @@ package fuse
import
(
"bytes"
"
fmt
"
"
os
"
"syscall"
"unsafe"
)
var
_
=
fmt
.
Print
// TODO - move these into Go's syscall package.
// TODO - move this into the Go distribution.
func
writev
(
fd
int
,
iovecs
*
syscall
.
Iovec
,
cnt
int
)
(
n
int
,
errno
int
)
{
n1
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_WRITEV
,
uintptr
(
fd
),
uintptr
(
unsafe
.
Pointer
(
iovecs
)),
uintptr
(
cnt
))
return
int
(
n1
),
int
(
e1
)
}
func
Writev
(
fd
int
,
packet
[][]
byte
)
(
n
int
,
err
error
)
{
iovecs
:=
make
([]
syscall
.
Iovec
,
0
,
len
(
packet
))
for
_
,
v
:=
range
packet
{
if
v
==
nil
||
len
(
v
)
==
0
{
continue
}
vec
:=
syscall
.
Iovec
{
Base
:
&
v
[
0
],
}
vec
.
SetLen
(
len
(
v
))
iovecs
=
append
(
iovecs
,
vec
)
}
n
,
errno
:=
writev
(
fd
,
&
iovecs
[
0
],
len
(
iovecs
))
if
errno
!=
0
{
err
=
os
.
NewSyscallError
(
"writev"
,
syscall
.
Errno
(
errno
))
}
return
n
,
err
}
func
getxattr
(
path
string
,
attr
string
,
dest
[]
byte
)
(
sz
int
,
errno
int
)
{
pathBs
:=
syscall
.
StringBytePtr
(
path
)
...
...
@@ -96,3 +122,27 @@ func Removexattr(path string, attr string) (errno int) {
uintptr
(
unsafe
.
Pointer
(
attrbs
)),
0
)
return
int
(
errNo
)
}
func
ioctl
(
fd
int
,
cmd
int
,
arg
uintptr
)
(
int
,
int
)
{
r0
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_IOCTL
,
uintptr
(
fd
),
uintptr
(
cmd
),
uintptr
(
arg
))
val
:=
int
(
r0
)
errno
:=
int
(
e1
)
return
val
,
errno
}
const
AT_FDCWD
=
-
100
func
Linkat
(
fd1
int
,
n1
string
,
fd2
int
,
n2
string
)
int
{
b1
:=
syscall
.
StringBytePtr
(
n1
)
b2
:=
syscall
.
StringBytePtr
(
n2
)
_
,
_
,
errNo
:=
syscall
.
Syscall6
(
syscall
.
SYS_LINKAT
,
uintptr
(
fd1
),
uintptr
(
unsafe
.
Pointer
(
b1
)),
uintptr
(
fd2
),
uintptr
(
unsafe
.
Pointer
(
b2
)),
0
,
0
)
return
int
(
errNo
)
}
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