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
}
}
gofs := me.knownFileSystems[name]
if gofs != nil {
return gofs, fuse.OK
ufs := me.knownFileSystems[name]
if ufs != nil {
log.Println("Already have a workspace:", name)
return nil, fuse.EBUSY
}
ufs, err := NewUnionFsFromRoots(roots, &me.options.UnionFsOptions)
......@@ -99,10 +100,12 @@ func (me *AutoUnionFs) createFs(name string, roots []string) (*UnionFs, fuse.Sta
return nil, fuse.EPERM
}
log.Printf("Adding workspace %v for roots %v", name, ufs.Name())
me.knownFileSystems[name] = ufs
me.nameRootMap[name] = roots[0]
return gofs, fuse.OK
return ufs, fuse.OK
}
func (me *AutoUnionFs) rmFs(name 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)
return fuse.EINVAL
}
gofs, code := me.createFs(name, roots)
if gofs != nil {
me.connector.Mount("/"+name, gofs, &me.options.FileSystemOptions)
fs, code := me.createFs(name, roots)
if code.Ok() && fs != nil {
code = me.connector.Mount("/"+name, fs, &me.options.FileSystemOptions)
}
return code
}
......
......@@ -44,9 +44,10 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile(wd+"/ro/file2", "file2")
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)
state.Debug = true
conn.Debug = true
go state.Loop(false)
return wd, func() {
......
......@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/zipfs"
"log"
"os"
)
......@@ -30,6 +29,5 @@ func NewUnionFsFromRoots(roots []string, opts *UnionFsOptions) (*UnionFs, os.Err
}
identifier := fmt.Sprintf("%v", roots)
log.Println("Adding UnionFs for", identifier)
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