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
9f9e950d
Commit
9f9e950d
authored
Mar 24, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Mount.
parent
94292e49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
28 deletions
+19
-28
mounted_file_system.go
mounted_file_system.go
+19
-28
No files found.
mounted_file_system.go
View file @
9f9e950d
...
...
@@ -22,6 +22,10 @@ import (
"golang.org/x/net/context"
)
// A Server is a function that reads ops from the supplied Connection,
// responding to them as appropriate.
type
Server
func
(
*
Connection
)
// A struct representing the status of a mount operation, with a method that
// waits for unmounting.
type
MountedFileSystem
struct
{
...
...
@@ -43,22 +47,9 @@ func (mfs *MountedFileSystem) Dir() string {
return
mfs
.
dir
}
// Wait until the mount point is ready to be used. After a successful return
// from this function, the contents of the mounted file system should be
// visible in the directory supplied to NewMountPoint. May be called multiple
// times.
func
(
mfs
*
MountedFileSystem
)
WaitForReady
(
ctx
context
.
Context
)
error
{
select
{
case
<-
mfs
.
readyStatusAvailable
:
return
mfs
.
readyStatus
case
<-
ctx
.
Done
()
:
return
ctx
.
Err
()
}
}
// Block until a mounted file system has been unmounted. The return value will
// be non-nil if anything unexpected happened while serving. May be called
// multiple times.
Must not be called unless WaitForReady has returned nil.
// multiple times.
func
(
mfs
*
MountedFileSystem
)
Join
(
ctx
context
.
Context
)
error
{
select
{
case
<-
mfs
.
joinStatusAvailable
:
...
...
@@ -69,8 +60,10 @@ func (mfs *MountedFileSystem) Join(ctx context.Context) error {
}
// Attempt to unmount the file system. Use Join to wait for it to actually be
// unmounted. You must first call WaitForReady to ensure there is no race with
// mounting.
// unmounted.
//
// TODO(jacobsa): Kill this in favor of an Unmount free function that can be
// used even from outside of the daemon process.
func
(
mfs
*
MountedFileSystem
)
Unmount
()
error
{
return
bazilfuse
.
Unmount
(
mfs
.
dir
)
}
...
...
@@ -147,21 +140,15 @@ func (c *MountConfig) bazilfuseOptions() (opts []bazilfuse.MountOption) {
return
}
// Attempt to mount
the supplied file system on the given directory.
//
mfs.WaitForReady() must be called to find out whether the mount was
// s
uccessful.
//
//
TODO(jacobsa): Fold in WaitForReady. See issue #3
.
// Attempt to mount
a file system on the given directory, using the supplied
//
Server to serve connection requests. This function blocks until the file
// s
ystem is successfully mounted. On some systems, this requires the supplied
//
Server to make forward progress (in particular, to respond to
//
fuseops.InitOp)
.
func
Mount
(
dir
string
,
fs
FileSystem
,
server
Server
,
config
*
MountConfig
)
(
mfs
*
MountedFileSystem
,
err
error
)
{
// Create a server object.
server
,
err
:=
newServer
(
fs
)
if
err
!=
nil
{
return
}
// Initialize the struct.
mfs
=
&
MountedFileSystem
{
dir
:
dir
,
...
...
@@ -172,5 +159,9 @@ func Mount(
// Mount in the background.
go
mfs
.
mountAndServe
(
server
,
config
.
bazilfuseOptions
())
// Wait for ready.
<-
mfs
.
readyStatusAvailable
err
=
mfs
.
readyStatus
return
}
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