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
27ecdf3b
Commit
27ecdf3b
authored
Jul 09, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse/pathfs: inline xattr calls for gccgo.
parent
82e5e42f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
5 deletions
+73
-5
fuse/pathfs/loopback_linux.go
fuse/pathfs/loopback_linux.go
+1
-1
fuse/pathfs/syscall_linux.go
fuse/pathfs/syscall_linux.go
+72
-4
No files found.
fuse/pathfs/loopback_linux.go
View file @
27ecdf3b
...
@@ -32,7 +32,7 @@ func (fs *loopbackFileSystem) ListXAttr(name string, context *fuse.Context) ([]s
...
@@ -32,7 +32,7 @@ func (fs *loopbackFileSystem) ListXAttr(name string, context *fuse.Context) ([]s
}
}
func
(
fs
*
loopbackFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
,
context
*
fuse
.
Context
)
fuse
.
Status
{
func
(
fs
*
loopbackFileSystem
)
RemoveXAttr
(
name
string
,
attr
string
,
context
*
fuse
.
Context
)
fuse
.
Status
{
err
:=
sys
call
.
Removexattr
(
fs
.
GetPath
(
name
),
attr
)
err
:=
sysRemovexattr
(
fs
.
GetPath
(
name
),
attr
)
return
fuse
.
ToStatus
(
err
)
return
fuse
.
ToStatus
(
err
)
}
}
...
...
fuse/pathfs/syscall_linux.go
View file @
27ecdf3b
...
@@ -3,13 +3,16 @@ package pathfs
...
@@ -3,13 +3,16 @@ package pathfs
import
(
import
(
"bytes"
"bytes"
"syscall"
"syscall"
"unsafe"
)
)
var
_zero
uintptr
func
getXAttr
(
path
string
,
attr
string
,
dest
[]
byte
)
(
value
[]
byte
,
err
error
)
{
func
getXAttr
(
path
string
,
attr
string
,
dest
[]
byte
)
(
value
[]
byte
,
err
error
)
{
sz
,
err
:=
sys
call
.
Getxattr
(
path
,
attr
,
dest
)
sz
,
err
:=
sysGetxattr
(
path
,
attr
,
dest
)
for
sz
>
cap
(
dest
)
&&
err
==
nil
{
for
sz
>
cap
(
dest
)
&&
err
==
nil
{
dest
=
make
([]
byte
,
sz
)
dest
=
make
([]
byte
,
sz
)
sz
,
err
=
sys
call
.
Getxattr
(
path
,
attr
,
dest
)
sz
,
err
=
sysGetxattr
(
path
,
attr
,
dest
)
}
}
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -21,14 +24,14 @@ func getXAttr(path string, attr string, dest []byte) (value []byte, err error) {
...
@@ -21,14 +24,14 @@ func getXAttr(path string, attr string, dest []byte) (value []byte, err error) {
func
listXAttr
(
path
string
)
(
attributes
[]
string
,
err
error
)
{
func
listXAttr
(
path
string
)
(
attributes
[]
string
,
err
error
)
{
dest
:=
make
([]
byte
,
0
)
dest
:=
make
([]
byte
,
0
)
sz
,
err
:=
sys
call
.
Listxattr
(
path
,
dest
)
sz
,
err
:=
sysListxattr
(
path
,
dest
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
for
sz
>
cap
(
dest
)
&&
err
==
nil
{
for
sz
>
cap
(
dest
)
&&
err
==
nil
{
dest
=
make
([]
byte
,
sz
)
dest
=
make
([]
byte
,
sz
)
sz
,
err
=
sys
call
.
Listxattr
(
path
,
dest
)
sz
,
err
=
sysListxattr
(
path
,
dest
)
}
}
// -1 to drop the final empty slice.
// -1 to drop the final empty slice.
...
@@ -40,3 +43,68 @@ func listXAttr(path string) (attributes []string, err error) {
...
@@ -40,3 +43,68 @@ func listXAttr(path string) (attributes []string, err error) {
}
}
return
attributes
,
err
return
attributes
,
err
}
}
// Below is cut & paste from std lib syscall, so gccgo 4.8.1 can
// compile this too.
func
sysGetxattr
(
path
string
,
attr
string
,
dest
[]
byte
)
(
sz
int
,
err
error
)
{
var
_p0
*
byte
_p0
,
err
=
syscall
.
BytePtrFromString
(
path
)
if
err
!=
nil
{
return
}
var
_p1
*
byte
_p1
,
err
=
syscall
.
BytePtrFromString
(
attr
)
if
err
!=
nil
{
return
}
var
_p2
unsafe
.
Pointer
if
len
(
dest
)
>
0
{
_p2
=
unsafe
.
Pointer
(
&
dest
[
0
])
}
else
{
_p2
=
unsafe
.
Pointer
(
&
_zero
)
}
r0
,
_
,
e1
:=
syscall
.
Syscall6
(
syscall
.
SYS_GETXATTR
,
uintptr
(
unsafe
.
Pointer
(
_p0
)),
uintptr
(
unsafe
.
Pointer
(
_p1
)),
uintptr
(
_p2
),
uintptr
(
len
(
dest
)),
0
,
0
)
sz
=
int
(
r0
)
if
e1
!=
0
{
err
=
e1
}
return
}
func
sysRemovexattr
(
path
string
,
attr
string
)
(
err
error
)
{
var
_p0
*
byte
_p0
,
err
=
syscall
.
BytePtrFromString
(
path
)
if
err
!=
nil
{
return
}
var
_p1
*
byte
_p1
,
err
=
syscall
.
BytePtrFromString
(
attr
)
if
err
!=
nil
{
return
}
_
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_REMOVEXATTR
,
uintptr
(
unsafe
.
Pointer
(
_p0
)),
uintptr
(
unsafe
.
Pointer
(
_p1
)),
0
)
if
e1
!=
0
{
err
=
e1
}
return
}
func
sysListxattr
(
path
string
,
dest
[]
byte
)
(
sz
int
,
err
error
)
{
var
_p0
*
byte
_p0
,
err
=
syscall
.
BytePtrFromString
(
path
)
if
err
!=
nil
{
return
}
var
_p1
unsafe
.
Pointer
if
len
(
dest
)
>
0
{
_p1
=
unsafe
.
Pointer
(
&
dest
[
0
])
}
else
{
_p1
=
unsafe
.
Pointer
(
&
_zero
)
}
r0
,
_
,
e1
:=
syscall
.
Syscall
(
syscall
.
SYS_LISTXATTR
,
uintptr
(
unsafe
.
Pointer
(
_p0
)),
uintptr
(
_p1
),
uintptr
(
len
(
dest
)))
sz
=
int
(
r0
)
if
e1
!=
0
{
err
=
e1
}
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