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
bbb262ee
Commit
bbb262ee
authored
Jul 29, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read directly into out messages for files.
parent
2e422a13
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
52 deletions
+81
-52
connection.go
connection.go
+3
-4
conversions.go
conversions.go
+64
-46
internal/buffer/out_message.go
internal/buffer/out_message.go
+14
-2
No files found.
connection.go
View file @
bbb262ee
...
...
@@ -378,8 +378,10 @@ func (c *Connection) ReadOp() (ctx context.Context, op interface{}, err error) {
}
// Convert the message to an op.
op
,
err
=
convertInMessage
(
inMsg
,
c
.
protocol
)
outMsg
:=
c
.
getOutMessage
()
op
,
err
=
convertInMessage
(
inMsg
,
outMsg
,
c
.
protocol
)
if
err
!=
nil
{
c
.
putOutMessage
(
outMsg
)
err
=
fmt
.
Errorf
(
"convertInMessage: %v"
,
err
)
return
}
...
...
@@ -396,9 +398,6 @@ func (c *Connection) ReadOp() (ctx context.Context, op interface{}, err error) {
continue
}
// Allocate an output message up front, to be used later when replying.
outMsg
:=
c
.
getOutMessage
()
// Set up a context that remembers information about this op.
ctx
=
c
.
beginOp
(
inMsg
.
Header
()
.
Opcode
,
inMsg
.
Header
()
.
Unique
)
ctx
=
context
.
WithValue
(
ctx
,
contextKey
,
opState
{
inMsg
,
outMsg
,
op
,
opID
})
...
...
conversions.go
View file @
bbb262ee
This diff is collapsed.
Click to expand it.
internal/buffer/out_message.go
View file @
bbb262ee
...
...
@@ -25,6 +25,9 @@ import (
const
outHeaderSize
=
unsafe
.
Sizeof
(
fusekernel
.
OutHeader
{})
// OutMessage structs begin life with Len() == OutMessageInitialSize.
const
OutMessageInitialSize
=
outHeaderSize
// We size out messages to be large enough to hold a header for the response
// plus the largest read that may come in.
const
outMessageSize
=
outHeaderSize
+
MaxReadSize
...
...
@@ -53,8 +56,8 @@ func init() {
// Reset the message so that it is ready to be used again. Afterward, the
// contents are solely a zeroed header.
func
(
m
*
OutMessage
)
Reset
()
{
m
.
offset
=
outHeader
Size
memclr
(
unsafe
.
Pointer
(
&
m
.
storage
),
outHeader
Size
)
m
.
offset
=
OutMessageInitial
Size
memclr
(
unsafe
.
Pointer
(
&
m
.
storage
),
OutMessageInitial
Size
)
}
// Return a pointer to the header at the start of the message.
...
...
@@ -87,6 +90,15 @@ func (b *OutMessage) GrowNoZero(size uintptr) (p unsafe.Pointer) {
return
}
// Throw away the last n bytes. Panics if n is out of range.
func
(
b
*
OutMessage
)
Shrink
(
n
uintptr
)
{
if
n
>
b
.
offset
-
OutMessageInitialSize
{
panic
(
fmt
.
Sprintf
(
"Shrink(%d) out of range for offset %d"
,
n
,
b
.
offset
))
}
b
.
offset
-=
n
}
// Equivalent to growing by the length of p, then copying p over the new
// segment. Panics if there is not enough room available.
func
(
b
*
OutMessage
)
Append
(
src
[]
byte
)
{
...
...
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