Fixed flushfs.
parent
85b3f9ed42
commit
c12f80b1e2
|
@ -180,8 +180,7 @@ func (fs *flushFS) ReadFile(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read what we can.
|
// Read what we can.
|
||||||
op.Data = make([]byte, op.Size)
|
op.BytesRead = copy(op.Dst, fs.fooContents[op.Offset:])
|
||||||
copy(op.Data, fs.fooContents[op.Offset:])
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -298,13 +297,15 @@ func (fs *flushFS) ReadDir(
|
||||||
|
|
||||||
// Fill in the listing.
|
// Fill in the listing.
|
||||||
for _, de := range dirents {
|
for _, de := range dirents {
|
||||||
op.Data = fuseutil.AppendDirent(op.Data, de)
|
n := fuseutil.WriteDirent(op.Dst[op.BytesRead:], de)
|
||||||
}
|
|
||||||
|
|
||||||
// We don't support doing this in anything more than one shot.
|
// We don't support doing this in anything more than one shot.
|
||||||
if len(op.Data) > op.Size {
|
if n == 0 {
|
||||||
err = fmt.Errorf("Couldn't fit listing in %v bytes", op.Size)
|
err = fmt.Errorf("Couldn't fit listing in %v bytes", len(op.Dst))
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
op.BytesRead += n
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue