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
384f32c2
Commit
384f32c2
authored
Jul 28, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connection.kernelResponseForOp
parent
5238806c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
45 deletions
+44
-45
conversions.go
conversions.go
+44
-45
No files found.
conversions.go
View file @
384f32c2
...
@@ -419,29 +419,28 @@ func (c *Connection) kernelResponse(
...
@@ -419,29 +419,28 @@ func (c *Connection) kernelResponse(
// Like kernelResponse, but assumes the user replied with a nil error to the
// Like kernelResponse, but assumes the user replied with a nil error to the
// op. Returns a nil response if no response is required.
// op. Returns a nil response if no response is required.
func
kernelResponseForOp
(
func
(
c
*
Connection
)
kernelResponseForOp
(
op
interface
{},
op
interface
{})
(
m
*
buffer
.
OutMessage
)
{
protocol
fusekernel
.
Protocol
)
(
b
buffer
.
OutMessage
)
{
// Create the appropriate output message
// Create the appropriate output message
switch
o
:=
op
.
(
type
)
{
switch
o
:=
op
.
(
type
)
{
case
*
fuseops
.
LookUpInodeOp
:
case
*
fuseops
.
LookUpInodeOp
:
size
:=
fusekernel
.
EntryOutSize
(
protocol
)
size
:=
fusekernel
.
EntryOutSize
(
c
.
protocol
)
b
=
buffer
.
NewOutMessage
(
size
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
EntryOut
)(
b
.
Grow
(
size
))
out
:=
(
*
fusekernel
.
EntryOut
)(
m
.
Grow
(
size
))
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
case
*
fuseops
.
GetInodeAttributesOp
:
case
*
fuseops
.
GetInodeAttributesOp
:
size
:=
fusekernel
.
AttrOutSize
(
protocol
)
size
:=
fusekernel
.
AttrOutSize
(
c
.
protocol
)
b
=
buffer
.
NewOutMessage
(
size
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
AttrOut
)(
b
.
Grow
(
size
))
out
:=
(
*
fusekernel
.
AttrOut
)(
m
.
Grow
(
size
))
out
.
AttrValid
,
out
.
AttrValidNsec
=
convertExpirationTime
(
out
.
AttrValid
,
out
.
AttrValidNsec
=
convertExpirationTime
(
o
.
AttributesExpiration
)
o
.
AttributesExpiration
)
convertAttributes
(
o
.
Inode
,
&
o
.
Attributes
,
&
out
.
Attr
)
convertAttributes
(
o
.
Inode
,
&
o
.
Attributes
,
&
out
.
Attr
)
case
*
fuseops
.
SetInodeAttributesOp
:
case
*
fuseops
.
SetInodeAttributesOp
:
size
:=
fusekernel
.
AttrOutSize
(
protocol
)
size
:=
fusekernel
.
AttrOutSize
(
c
.
protocol
)
b
=
buffer
.
NewOutMessage
(
size
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
AttrOut
)(
b
.
Grow
(
size
))
out
:=
(
*
fusekernel
.
AttrOut
)(
m
.
Grow
(
size
))
out
.
AttrValid
,
out
.
AttrValidNsec
=
convertExpirationTime
(
out
.
AttrValid
,
out
.
AttrValidNsec
=
convertExpirationTime
(
o
.
AttributesExpiration
)
o
.
AttributesExpiration
)
convertAttributes
(
o
.
Inode
,
&
o
.
Attributes
,
&
out
.
Attr
)
convertAttributes
(
o
.
Inode
,
&
o
.
Attributes
,
&
out
.
Attr
)
...
@@ -450,85 +449,85 @@ func kernelResponseForOp(
...
@@ -450,85 +449,85 @@ func kernelResponseForOp(
// No response.
// No response.
case
*
fuseops
.
MkDirOp
:
case
*
fuseops
.
MkDirOp
:
size
:=
fusekernel
.
EntryOutSize
(
protocol
)
size
:=
fusekernel
.
EntryOutSize
(
c
.
protocol
)
b
=
buffer
.
NewOutMessage
(
size
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
EntryOut
)(
b
.
Grow
(
size
))
out
:=
(
*
fusekernel
.
EntryOut
)(
m
.
Grow
(
size
))
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
case
*
fuseops
.
CreateFileOp
:
case
*
fuseops
.
CreateFileOp
:
eSize
:=
fusekernel
.
EntryOutSize
(
protocol
)
eSize
:=
fusekernel
.
EntryOutSize
(
c
.
protocol
)
b
=
buffer
.
NewOutMessage
(
eSize
+
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})
)
m
=
c
.
getOutMessage
(
)
e
:=
(
*
fusekernel
.
EntryOut
)(
b
.
Grow
(
eSize
))
e
:=
(
*
fusekernel
.
EntryOut
)(
m
.
Grow
(
eSize
))
convertChildInodeEntry
(
&
o
.
Entry
,
e
)
convertChildInodeEntry
(
&
o
.
Entry
,
e
)
oo
:=
(
*
fusekernel
.
OpenOut
)(
b
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})))
oo
:=
(
*
fusekernel
.
OpenOut
)(
m
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})))
oo
.
Fh
=
uint64
(
o
.
Handle
)
oo
.
Fh
=
uint64
(
o
.
Handle
)
case
*
fuseops
.
CreateSymlinkOp
:
case
*
fuseops
.
CreateSymlinkOp
:
size
:=
fusekernel
.
EntryOutSize
(
protocol
)
size
:=
fusekernel
.
EntryOutSize
(
c
.
protocol
)
b
=
buffer
.
NewOutMessage
(
size
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
EntryOut
)(
b
.
Grow
(
size
))
out
:=
(
*
fusekernel
.
EntryOut
)(
m
.
Grow
(
size
))
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
convertChildInodeEntry
(
&
o
.
Entry
,
out
)
case
*
fuseops
.
RenameOp
:
case
*
fuseops
.
RenameOp
:
b
=
buffer
.
NewOutMessage
(
0
)
m
=
c
.
getOutMessage
(
)
case
*
fuseops
.
RmDirOp
:
case
*
fuseops
.
RmDirOp
:
b
=
buffer
.
NewOutMessage
(
0
)
m
=
c
.
getOutMessage
(
)
case
*
fuseops
.
UnlinkOp
:
case
*
fuseops
.
UnlinkOp
:
b
=
buffer
.
NewOutMessage
(
0
)
m
=
c
.
getOutMessage
(
)
case
*
fuseops
.
OpenDirOp
:
case
*
fuseops
.
OpenDirOp
:
b
=
buffer
.
NewOutMessage
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
OpenOut
)(
b
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})))
out
:=
(
*
fusekernel
.
OpenOut
)(
m
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})))
out
.
Fh
=
uint64
(
o
.
Handle
)
out
.
Fh
=
uint64
(
o
.
Handle
)
case
*
fuseops
.
ReadDirOp
:
case
*
fuseops
.
ReadDirOp
:
b
=
buffer
.
NewOutMessage
(
uintptr
(
len
(
o
.
Data
))
)
m
=
c
.
getOutMessage
(
)
b
.
Append
(
o
.
Data
)
m
.
Append
(
o
.
Data
)
case
*
fuseops
.
ReleaseDirHandleOp
:
case
*
fuseops
.
ReleaseDirHandleOp
:
b
=
buffer
.
NewOutMessage
(
0
)
m
=
c
.
getOutMessage
(
)
case
*
fuseops
.
OpenFileOp
:
case
*
fuseops
.
OpenFileOp
:
b
=
buffer
.
NewOutMessage
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
OpenOut
)(
b
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})))
out
:=
(
*
fusekernel
.
OpenOut
)(
m
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
OpenOut
{})))
out
.
Fh
=
uint64
(
o
.
Handle
)
out
.
Fh
=
uint64
(
o
.
Handle
)
case
*
fuseops
.
ReadFileOp
:
case
*
fuseops
.
ReadFileOp
:
b
=
buffer
.
NewOutMessage
(
uintptr
(
len
(
o
.
Data
))
)
m
=
c
.
getOutMessage
(
)
b
.
Append
(
o
.
Data
)
m
.
Append
(
o
.
Data
)
case
*
fuseops
.
WriteFileOp
:
case
*
fuseops
.
WriteFileOp
:
b
=
buffer
.
NewOutMessage
(
unsafe
.
Sizeof
(
fusekernel
.
WriteOut
{})
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
WriteOut
)(
b
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
WriteOut
{})))
out
:=
(
*
fusekernel
.
WriteOut
)(
m
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
WriteOut
{})))
out
.
Size
=
uint32
(
len
(
o
.
Data
))
out
.
Size
=
uint32
(
len
(
o
.
Data
))
case
*
fuseops
.
SyncFileOp
:
case
*
fuseops
.
SyncFileOp
:
b
=
buffer
.
NewOutMessage
(
0
)
m
=
c
.
getOutMessage
(
)
case
*
fuseops
.
FlushFileOp
:
case
*
fuseops
.
FlushFileOp
:
b
=
buffer
.
NewOutMessage
(
0
)
m
=
c
.
getOutMessage
(
)
case
*
fuseops
.
ReleaseFileHandleOp
:
case
*
fuseops
.
ReleaseFileHandleOp
:
b
=
buffer
.
NewOutMessage
(
0
)
m
=
c
.
getOutMessage
(
)
case
*
fuseops
.
ReadSymlinkOp
:
case
*
fuseops
.
ReadSymlinkOp
:
b
=
buffer
.
NewOutMessage
(
uintptr
(
len
(
o
.
Target
))
)
m
=
c
.
getOutMessage
(
)
b
.
AppendString
(
o
.
Target
)
m
.
AppendString
(
o
.
Target
)
case
*
statFSOp
:
case
*
statFSOp
:
b
=
buffer
.
NewOutMessage
(
unsafe
.
Sizeof
(
fusekernel
.
StatfsOut
{})
)
m
=
c
.
getOutMessage
(
)
b
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
StatfsOut
{}))
m
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
StatfsOut
{}))
case
*
interruptOp
:
case
*
interruptOp
:
// No response.
// No response.
case
*
initOp
:
case
*
initOp
:
b
=
buffer
.
NewOutMessage
(
unsafe
.
Sizeof
(
fusekernel
.
InitOut
{})
)
m
=
c
.
getOutMessage
(
)
out
:=
(
*
fusekernel
.
InitOut
)(
b
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
InitOut
{})))
out
:=
(
*
fusekernel
.
InitOut
)(
m
.
Grow
(
unsafe
.
Sizeof
(
fusekernel
.
InitOut
{})))
out
.
Major
=
o
.
Library
.
Major
out
.
Major
=
o
.
Library
.
Major
out
.
Minor
=
o
.
Library
.
Minor
out
.
Minor
=
o
.
Library
.
Minor
...
...
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