Commit ee7dc425 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Signal end-of-directory using channel close. Change callers.

parent b68c22d2
......@@ -124,7 +124,7 @@ func (me *MultiZipFs) OpenDir(name string) (stream chan fuse.DirEntry, code fuse
stream <- fuse.DirEntry(d)
}
stream <- fuse.DirEntry{Name: ""}
close(stream)
return stream, fuse.OK
}
......
......@@ -167,7 +167,7 @@ func (me *ZipFileFuse) OpenDir(name string) (stream chan fuse.DirEntry, code fus
Mode: zip_DIRMODE,
}
}
stream <- fuse.DirEntry{}
close(stream)
}()
return stream, fuse.OK
}
......
......@@ -9,11 +9,11 @@ import (
func TestZipFs(t *testing.T) {
wd, err := os.Getwd()
CheckSuccess(err)
zfs := NewZipFileFuse(wd + "/test.zip")
zfs := NewZipArchiveFileSystem(wd + "/test.zip")
connector := fuse.NewPathFileSystemConnector(zfs)
mountPoint := fuse.MakeTempDir()
state := fuse.NewMountState(connector)
state.Mount(mountPoint)
......@@ -21,12 +21,12 @@ func TestZipFs(t *testing.T) {
d, err := os.Open(mountPoint, os.O_RDONLY, 0)
CheckSuccess(err)
names, err := d.Readdirnames(-1)
CheckSuccess(err)
err = d.Close()
CheckSuccess(err)
if len(names) != 2 {
t.Error("wrong length", names)
}
......@@ -38,7 +38,7 @@ func TestZipFs(t *testing.T) {
fi, err = os.Stat(mountPoint + "/file.txt")
CheckSuccess(err)
if !fi.IsRegular() {
t.Error("file type", fi)
}
......@@ -54,6 +54,6 @@ func TestZipFs(t *testing.T) {
t.Error("content fail", b[:n])
}
f.Close()
state.Unmount()
}
......@@ -99,9 +99,8 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
}
for {
d := <-me.stream
if d.Name == "" {
close(me.stream)
d, isOpen := <-me.stream
if !isOpen {
me.stream = nil
break
}
......
......@@ -70,7 +70,7 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status
break
}
}
output <- DirEntry{}
close(output)
f.Close()
}()
......
......@@ -52,9 +52,10 @@ func mount(mountPoint string) (f *os.File, finalMountPoint string, err os.Error)
}
proc, err := os.StartProcess("/bin/fusermount",
[]string{"/bin/fusermount", mountPoint},
[]string{"_FUSE_COMMFD=3"},
"",
[]*os.File{os.Stdin, os.Stdout, os.Stderr, remote})
&os.ProcAttr{
Env:[]string{"_FUSE_COMMFD=3"},
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr, remote}})
if err != nil {
return
}
......@@ -76,9 +77,7 @@ func unmount(mountPoint string) (err os.Error) {
dir, _ := filepath.Split(mountPoint)
proc, err := os.StartProcess("/bin/fusermount",
[]string{"/bin/fusermount", "-u", mountPoint},
nil,
dir,
[]*os.File{nil, nil, os.Stderr})
&os.ProcAttr{Dir: dir, Files: []*os.File{nil, nil, os.Stderr}})
if err != nil {
return
}
......
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