mirror of
https://github.com/vgough/encfs.git
synced 2024-12-29 10:09:20 +01:00
Add function descriptions to BlockFileIO
This commit is contained in:
parent
7565fb149a
commit
1227df72e2
@ -48,6 +48,12 @@ BlockFileIO::~BlockFileIO() {
|
||||
delete[] _cache.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serve a read request for the size of one block or less,
|
||||
* at block-aligned offsets.
|
||||
* Always requests full blocks form the lower layer, truncates the
|
||||
* returned data as neccessary.
|
||||
*/
|
||||
ssize_t BlockFileIO::cacheReadOneBlock(const IORequest &req) const {
|
||||
// we can satisfy the request even if _cache.dataLen is too short, because
|
||||
// we always request a full block during reads..
|
||||
@ -88,6 +94,13 @@ bool BlockFileIO::cacheWriteOneBlock(const IORequest &req) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serve a read request of arbitrary size at an arbitrary offset.
|
||||
* Stitches together multiple blocks to serve large requests, drops
|
||||
* data from the front of the first block if the request is not aligned.
|
||||
* Always requests aligned data of the size of one block or less from the
|
||||
* lower layer.
|
||||
*/
|
||||
ssize_t BlockFileIO::read(const IORequest &req) const {
|
||||
rAssert(_blockSize != 0);
|
||||
|
||||
@ -97,7 +110,7 @@ ssize_t BlockFileIO::read(const IORequest &req) const {
|
||||
|
||||
if (partialOffset == 0 && req.dataLen <= _blockSize) {
|
||||
// read completely within a single block -- can be handled as-is by
|
||||
// readOneBloc().
|
||||
// readOneBlock().
|
||||
return cacheReadOneBlock(req);
|
||||
} else {
|
||||
size_t size = req.dataLen;
|
||||
|
Loading…
Reference in New Issue
Block a user