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
9eb5e079
Commit
9eb5e079
authored
Dec 19, 2016
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buffer: define OutMessage's contents.
parent
6e5247d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
internal/buffer/out_message.go
internal/buffer/out_message.go
+20
-2
No files found.
internal/buffer/out_message.go
View file @
9eb5e079
...
@@ -33,12 +33,18 @@ const OutMessageHeaderSize = unsafe.Sizeof(fusekernel.OutHeader{})
...
@@ -33,12 +33,18 @@ const OutMessageHeaderSize = unsafe.Sizeof(fusekernel.OutHeader{})
//
//
// Must be initialized with Reset.
// Must be initialized with Reset.
type
OutMessage
struct
{
type
OutMessage
struct
{
// The offset into payload to which we're currently writing.
payloadOffset
int
header
[
OutMessageHeaderSize
]
byte
payload
[
MaxReadSize
]
byte
}
}
// Make sure alignment works out correctly, at least for the header.
// Make sure that the header field is aligned correctly for
// fusekernel.OutHeader type punning.
func
init
()
{
func
init
()
{
a
:=
unsafe
.
Alignof
(
OutMessage
{})
a
:=
unsafe
.
Alignof
(
OutMessage
{})
o
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
storage
)
o
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
header
)
e
:=
unsafe
.
Alignof
(
fusekernel
.
OutHeader
{})
e
:=
unsafe
.
Alignof
(
fusekernel
.
OutHeader
{})
if
a
%
e
!=
0
||
o
%
e
!=
0
{
if
a
%
e
!=
0
||
o
%
e
!=
0
{
...
@@ -46,6 +52,18 @@ func init() {
...
@@ -46,6 +52,18 @@ func init() {
}
}
}
}
// Make sure that the header and payload are contiguous.
func
init
()
{
a
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
header
)
+
OutMessageHeaderSize
b
:=
unsafe
.
Offsetof
(
OutMessage
{}
.
payload
)
if
a
!=
b
{
log
.
Panicf
(
"header ends at offset %d, but payload starts at offset %d"
,
a
,
b
)
}
}
// Reset resets m so that it's ready to be used again. Afterward, the contents
// Reset resets m so that it's ready to be used again. Afterward, the contents
// are solely a zeroed fusekernel.OutHeader struct.
// are solely a zeroed fusekernel.OutHeader struct.
func
(
m
*
OutMessage
)
Reset
()
func
(
m
*
OutMessage
)
Reset
()
...
...
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