From baa7c29fad8bee992d9c1bdd518e55b077523b2c Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 24 Jul 2015 15:56:54 +1000 Subject: [PATCH] Use the mount helper in Mount. --- mounted_file_system.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mounted_file_system.go b/mounted_file_system.go index d070353..54532bb 100644 --- a/mounted_file_system.go +++ b/mounted_file_system.go @@ -17,8 +17,6 @@ package fuse import ( "fmt" - "github.com/jacobsa/fuse/internal/fuseshim" - "golang.org/x/net/context" ) @@ -74,10 +72,11 @@ func Mount( joinStatusAvailable: make(chan struct{}), } - // Open a fuseshim connection. - bfConn, err := fuseshim.Mount(mfs.dir, config.bazilfuseOptions()...) + // Begin the mounting process, which will continue in the background. + ready := make(chan error, 1) + dev, err := mount(dir, config, ready) if err != nil { - err = fmt.Errorf("fuseshim.Mount: %v", err) + err = fmt.Errorf("mount: %v", err) return } @@ -87,15 +86,14 @@ func Mount( opContext = context.Background() } - // Create our own Connection object wrapping it. + // Create a Connection object wrapping the device. connection, err := newConnection( opContext, config.DebugLogger, config.ErrorLogger, - bfConn) + dev) if err != nil { - bfConn.Close() err = fmt.Errorf("newConnection: %v", err) return } @@ -107,9 +105,9 @@ func Mount( close(mfs.joinStatusAvailable) }() - // Wait for the connection to say it is ready. - if err = connection.waitForReady(); err != nil { - err = fmt.Errorf("WaitForReady: %v", err) + // Wait for the mount process to complete. + if err = <-ready; err != nil { + err = fmt.Errorf("mount (background): %v", err) return }