Use the mount helper in Mount.

geesefs-0-30-9
Aaron Jacobs 2015-07-24 15:56:54 +10:00
parent d2b9accc31
commit baa7c29fad
1 changed files with 9 additions and 11 deletions

View File

@ -17,8 +17,6 @@ package fuse
import ( import (
"fmt" "fmt"
"github.com/jacobsa/fuse/internal/fuseshim"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -74,10 +72,11 @@ func Mount(
joinStatusAvailable: make(chan struct{}), joinStatusAvailable: make(chan struct{}),
} }
// Open a fuseshim connection. // Begin the mounting process, which will continue in the background.
bfConn, err := fuseshim.Mount(mfs.dir, config.bazilfuseOptions()...) ready := make(chan error, 1)
dev, err := mount(dir, config, ready)
if err != nil { if err != nil {
err = fmt.Errorf("fuseshim.Mount: %v", err) err = fmt.Errorf("mount: %v", err)
return return
} }
@ -87,15 +86,14 @@ func Mount(
opContext = context.Background() opContext = context.Background()
} }
// Create our own Connection object wrapping it. // Create a Connection object wrapping the device.
connection, err := newConnection( connection, err := newConnection(
opContext, opContext,
config.DebugLogger, config.DebugLogger,
config.ErrorLogger, config.ErrorLogger,
bfConn) dev)
if err != nil { if err != nil {
bfConn.Close()
err = fmt.Errorf("newConnection: %v", err) err = fmt.Errorf("newConnection: %v", err)
return return
} }
@ -107,9 +105,9 @@ func Mount(
close(mfs.joinStatusAvailable) close(mfs.joinStatusAvailable)
}() }()
// Wait for the connection to say it is ready. // Wait for the mount process to complete.
if err = connection.waitForReady(); err != nil { if err = <-ready; err != nil {
err = fmt.Errorf("WaitForReady: %v", err) err = fmt.Errorf("mount (background): %v", err)
return return
} }