mirror of
https://github.com/vgough/encfs.git
synced 2025-01-01 03:28:57 +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;
|
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 {
|
ssize_t BlockFileIO::cacheReadOneBlock(const IORequest &req) const {
|
||||||
// we can satisfy the request even if _cache.dataLen is too short, because
|
// we can satisfy the request even if _cache.dataLen is too short, because
|
||||||
// we always request a full block during reads..
|
// we always request a full block during reads..
|
||||||
@ -88,6 +94,13 @@ bool BlockFileIO::cacheWriteOneBlock(const IORequest &req) {
|
|||||||
return ok;
|
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 {
|
ssize_t BlockFileIO::read(const IORequest &req) const {
|
||||||
rAssert(_blockSize != 0);
|
rAssert(_blockSize != 0);
|
||||||
|
|
||||||
@ -97,7 +110,7 @@ ssize_t BlockFileIO::read(const IORequest &req) const {
|
|||||||
|
|
||||||
if (partialOffset == 0 && req.dataLen <= _blockSize) {
|
if (partialOffset == 0 && req.dataLen <= _blockSize) {
|
||||||
// read completely within a single block -- can be handled as-is by
|
// read completely within a single block -- can be handled as-is by
|
||||||
// readOneBloc().
|
// readOneBlock().
|
||||||
return cacheReadOneBlock(req);
|
return cacheReadOneBlock(req);
|
||||||
} else {
|
} else {
|
||||||
size_t size = req.dataLen;
|
size_t size = req.dataLen;
|
||||||
|
Loading…
Reference in New Issue
Block a user