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
52225370
Commit
52225370
authored
Oct 02, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement Linkat() syscall wrapper.
parent
2c888896
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
fuse/misc.go
fuse/misc.go
+15
-0
fuse/misc_test.go
fuse/misc_test.go
+24
-0
No files found.
fuse/misc.go
View file @
52225370
...
...
@@ -159,3 +159,18 @@ func VerboseTest() bool {
flag
:=
flag
.
Lookup
(
"test.v"
)
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
)
}
fuse/misc_test.go
View file @
52225370
package
fuse
import
(
"io/ioutil"
"os"
"testing"
"syscall"
...
...
@@ -24,3 +25,26 @@ func TestOsErrorToErrno(t *testing.T) {
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
ENOENT
)
}
}
func
TestLinkAt
(
t
*
testing
.
T
)
{
dir
,
_
:=
ioutil
.
TempDir
(
""
,
"go-fuse"
)
ioutil
.
WriteFile
(
dir
+
"/a"
,
[]
byte
{
42
},
0644
)
f
,
_
:=
os
.
Open
(
dir
)
e
:=
Linkat
(
f
.
Fd
(),
"a"
,
f
.
Fd
(),
"b"
)
if
e
!=
0
{
t
.
Fatalf
(
"Linkat %d"
,
e
)
}
f1
,
err
:=
os
.
Lstat
(
dir
+
"/a"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Lstat a: %v"
,
err
)
}
f2
,
err
:=
os
.
Lstat
(
dir
+
"/b"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Lstat b: %v"
,
err
)
}
if
f1
.
Ino
!=
f2
.
Ino
{
t
.
Fatal
(
"Ino mismatch"
,
f1
,
f2
)
}
}
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