Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-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
jacobsa-fuse
Commits
0a22738a
Commit
0a22738a
authored
Dec 19, 2016
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OutMessage.Bytes
parent
6f4af617
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
internal/buffer/out_message.go
internal/buffer/out_message.go
+11
-4
No files found.
internal/buffer/out_message.go
View file @
0a22738a
...
...
@@ -25,7 +25,7 @@ import (
// OutMessageHeaderSize is the size of the leading header in every
// properly-constructed OutMessage. Reset brings the message back to this size.
const
OutMessageHeaderSize
=
unsafe
.
Sizeof
(
fusekernel
.
OutHeader
{}
)
const
OutMessageHeaderSize
=
int
(
unsafe
.
Sizeof
(
fusekernel
.
OutHeader
{})
)
// OutMessage provides a mechanism for constructing a single contiguous fuse
// message from multiple segments, where the first segment is always a
...
...
@@ -54,7 +54,7 @@ func init() {
// Make sure that the header and payload are contiguous.
func
init
()
{
a
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
header
)
+
OutMessageHeaderSize
a
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
header
)
+
uintptr
(
OutMessageHeaderSize
)
b
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
payload
)
if
a
!=
b
{
...
...
@@ -68,7 +68,7 @@ func init() {
// are solely a zeroed fusekernel.OutHeader struct.
func
(
m
*
OutMessage
)
Reset
()
{
m
.
payloadOffset
=
0
memclr
(
unsafe
.
Pointer
(
&
m
.
header
),
OutMessageHeaderSize
)
memclr
(
unsafe
.
Pointer
(
&
m
.
header
),
uintptr
(
OutMessageHeaderSize
)
)
}
// OutHeader returns a pointer to the header at the start of the message.
...
...
@@ -122,5 +122,12 @@ func (m *OutMessage) Len() int {
// Bytes returns a reference to the current contents of the buffer, including
// the leading header.
func
(
m
*
OutMessage
)
Bytes
()
[]
byte
{
return
int
(
m
.
offset
)
l
:=
m
.
Len
()
sh
:=
reflect
.
SliceHeader
{
Data
:
uintptr
(
unsafe
.
Pointer
(
&
m
.
header
)),
Len
:
l
,
Cap
:
l
,
}
return
*
(
*
[]
byte
)(
unsafe
.
Pointer
(
&
sh
))
}
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