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
0cd689f5
Commit
0cd689f5
authored
Dec 19, 2016
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buffer: simplify storage of the header.
parent
d1ff915b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
14 deletions
+2
-14
internal/buffer/out_message.go
internal/buffer/out_message.go
+2
-14
No files found.
internal/buffer/out_message.go
View file @
0cd689f5
...
...
@@ -36,22 +36,10 @@ type OutMessage struct {
// The offset into payload to which we're currently writing.
payloadOffset
int
header
[
OutMessageHeaderSize
]
byte
header
fusekernel
.
OutHeader
payload
[
MaxReadSize
]
byte
}
// Make sure that the header field is aligned correctly for
// fusekernel.OutHeader type punning.
func
init
()
{
a
:=
unsafe
.
Alignof
(
OutMessage
{})
o
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
header
)
e
:=
unsafe
.
Alignof
(
fusekernel
.
OutHeader
{})
if
a
%
e
!=
0
||
o
%
e
!=
0
{
log
.
Panicf
(
"Bad alignment or offset: %d, %d, need %d"
,
a
,
o
,
e
)
}
}
// Make sure that the header and payload are contiguous.
func
init
()
{
a
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
header
)
+
uintptr
(
OutMessageHeaderSize
)
...
...
@@ -73,7 +61,7 @@ func (m *OutMessage) Reset() {
// OutHeader returns a pointer to the header at the start of the message.
func
(
m
*
OutMessage
)
OutHeader
()
*
fusekernel
.
OutHeader
{
return
(
*
fusekernel
.
OutHeader
)(
unsafe
.
Pointer
(
&
m
.
header
))
return
&
m
.
header
}
// Grow grows m's buffer by the given number of bytes, returning a pointer to
...
...
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