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
28605268
Commit
28605268
authored
Jul 24, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated newConnection.
parent
baa7c29f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
connection.go
connection.go
+15
-3
internal/fuseshim/fuse.go
internal/fuseshim/fuse.go
+7
-4
No files found.
connection.go
View file @
28605268
...
...
@@ -58,15 +58,27 @@ type Connection struct {
cancelFuncs
map
[
uint64
]
func
()
}
//
Responsibility for closing the wrapped connection is transferr
ed to the
//
result. You must call c.close() eventually
.
//
Create a connection wrapping the supplied file descriptor connect
ed to the
//
kernel. You must eventually call c.close()
.
//
// The loggers may be nil.
func
newConnection
(
parentCtx
context
.
Context
,
debugLogger
*
log
.
Logger
,
errorLogger
*
log
.
Logger
,
wrapped
*
fuseshim
.
Conn
)
(
c
*
Connection
,
err
error
)
{
dev
*
os
.
File
)
(
c
*
Connection
,
err
error
)
{
// Create an initialized a wrapped fuseshim connection.
wrapped
:=
&
fuseshim
.
Conn
{
Dev
:
dev
,
}
err
=
fuseshim
.
InitMount
(
wrapped
,
TODO
,
TODO
)
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"fuseshim.InitMount: %v"
,
err
)
return
}
// Create an object wrapping it.
c
=
&
Connection
{
debugLogger
:
debugLogger
,
errorLogger
:
errorLogger
,
...
...
internal/fuseshim/fuse.go
View file @
28605268
...
...
@@ -164,7 +164,7 @@ func Mount(dir string, options ...MountOption) (*Conn, error) {
}
c
.
Dev
=
f
if
err
:=
initMount
(
c
,
&
conf
);
err
!=
nil
{
if
err
:=
InitMount
(
c
,
conf
.
maxReadahead
,
conf
.
initFlags
);
err
!=
nil
{
c
.
Close
()
return
nil
,
err
}
...
...
@@ -181,7 +181,10 @@ func (e *OldVersionError) Error() string {
return
fmt
.
Sprintf
(
"kernel FUSE version is too old: %v < %v"
,
e
.
Kernel
,
e
.
LibraryMin
)
}
func
initMount
(
c
*
Conn
,
conf
*
mountConfig
)
error
{
func
InitMount
(
c
*
Conn
,
maxReadahead
uint32
,
initFlags
fusekernel
.
InitFlags
)
error
{
req
,
err
:=
c
.
ReadRequest
()
if
err
!=
nil
{
if
err
==
io
.
EOF
{
...
...
@@ -213,9 +216,9 @@ func initMount(c *Conn, conf *mountConfig) error {
s
:=
&
InitResponse
{
Library
:
proto
,
MaxReadahead
:
conf
.
maxReadahead
,
MaxReadahead
:
maxReadahead
,
MaxWrite
:
maxWrite
,
Flags
:
fusekernel
.
InitBigWrites
|
conf
.
initFlags
,
Flags
:
fusekernel
.
InitBigWrites
|
initFlags
,
}
r
.
Respond
(
s
)
return
nil
...
...
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