Fixed hellofs.
parent
b0d206254f
commit
85b3f9ed42
|
@ -228,11 +228,12 @@ func (fs *helloFS) ReadDir(
|
||||||
|
|
||||||
// Resume at the specified offset into the array.
|
// Resume at the specified offset into the array.
|
||||||
for _, e := range entries {
|
for _, e := range entries {
|
||||||
op.Data = fuseutil.AppendDirent(op.Data, e)
|
n := fuseutil.WriteDirent(op.Dst[op.BytesRead:], e)
|
||||||
if len(op.Data) > op.Size {
|
if n == 0 {
|
||||||
op.Data = op.Data[:op.Size]
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
op.BytesRead += n
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -251,9 +252,7 @@ func (fs *helloFS) ReadFile(
|
||||||
// Let io.ReaderAt deal with the semantics.
|
// Let io.ReaderAt deal with the semantics.
|
||||||
reader := strings.NewReader("Hello, world!")
|
reader := strings.NewReader("Hello, world!")
|
||||||
|
|
||||||
op.Data = make([]byte, op.Size)
|
op.BytesRead, err = reader.ReadAt(op.Dst, op.Offset)
|
||||||
n, err := reader.ReadAt(op.Data, op.Offset)
|
|
||||||
op.Data = op.Data[:n]
|
|
||||||
|
|
||||||
// Special case: FUSE doesn't expect us to return io.EOF.
|
// Special case: FUSE doesn't expect us to return io.EOF.
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
|
|
Loading…
Reference in New Issue