Commit 5bc0863d authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Fix thinko: fold together duplicated variable.

parent 5c0109c6
...@@ -88,9 +88,10 @@ func (me *AutoUnionFs) createFs(name string, roots []string) (*UnionFs, fuse.Sta ...@@ -88,9 +88,10 @@ func (me *AutoUnionFs) createFs(name string, roots []string) (*UnionFs, fuse.Sta
} }
} }
gofs := me.knownFileSystems[name] ufs := me.knownFileSystems[name]
if gofs != nil { if ufs != nil {
return gofs, fuse.OK log.Println("Already have a workspace:", name)
return nil, fuse.EBUSY
} }
ufs, err := NewUnionFsFromRoots(roots, &me.options.UnionFsOptions) ufs, err := NewUnionFsFromRoots(roots, &me.options.UnionFsOptions)
...@@ -99,10 +100,12 @@ func (me *AutoUnionFs) createFs(name string, roots []string) (*UnionFs, fuse.Sta ...@@ -99,10 +100,12 @@ func (me *AutoUnionFs) createFs(name string, roots []string) (*UnionFs, fuse.Sta
return nil, fuse.EPERM return nil, fuse.EPERM
} }
log.Printf("Adding workspace %v for roots %v", name, ufs.Name())
me.knownFileSystems[name] = ufs me.knownFileSystems[name] = ufs
me.nameRootMap[name] = roots[0] me.nameRootMap[name] = roots[0]
return gofs, fuse.OK return ufs, fuse.OK
} }
func (me *AutoUnionFs) rmFs(name string) (code fuse.Status) { func (me *AutoUnionFs) rmFs(name string) (code fuse.Status) {
...@@ -130,9 +133,9 @@ func (me *AutoUnionFs) addFs(name string, roots []string) (code fuse.Status) { ...@@ -130,9 +133,9 @@ func (me *AutoUnionFs) addFs(name string, roots []string) (code fuse.Status) {
log.Println("Illegal name for overlay", roots) log.Println("Illegal name for overlay", roots)
return fuse.EINVAL return fuse.EINVAL
} }
gofs, code := me.createFs(name, roots) fs, code := me.createFs(name, roots)
if gofs != nil { if code.Ok() && fs != nil {
me.connector.Mount("/"+name, gofs, &me.options.FileSystemOptions) code = me.connector.Mount("/"+name, fs, &me.options.FileSystemOptions)
} }
return code return code
} }
......
...@@ -44,9 +44,10 @@ func setup(t *testing.T) (workdir string, cleanup func()) { ...@@ -44,9 +44,10 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile(wd+"/ro/file2", "file2") WriteFile(wd+"/ro/file2", "file2")
fs := NewAutoUnionFs(wd+"/store", testAOpts) fs := NewAutoUnionFs(wd+"/store", testAOpts)
state, _, err := fuse.MountFileSystem(wd + "/mount", fs, &testAOpts.FileSystemOptions) state, conn, err := fuse.MountFileSystem(wd + "/mount", fs, &testAOpts.FileSystemOptions)
CheckSuccess(err) CheckSuccess(err)
state.Debug = true state.Debug = true
conn.Debug = true
go state.Loop(false) go state.Loop(false)
return wd, func() { return wd, func() {
......
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/zipfs" "github.com/hanwen/go-fuse/zipfs"
"log"
"os" "os"
) )
...@@ -30,6 +29,5 @@ func NewUnionFsFromRoots(roots []string, opts *UnionFsOptions) (*UnionFs, os.Err ...@@ -30,6 +29,5 @@ func NewUnionFsFromRoots(roots []string, opts *UnionFsOptions) (*UnionFs, os.Err
} }
identifier := fmt.Sprintf("%v", roots) identifier := fmt.Sprintf("%v", roots)
log.Println("Adding UnionFs for", identifier)
return NewUnionFs(identifier, fses, *opts), nil return NewUnionFs(identifier, fses, *opts), nil
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment