From 079d2844ecde061d45c6884aa0ffee7fdc05de63 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 20 May 2007 13:57:56 +0000 Subject: New files --- src/FileAllocationEntry.cc | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/FileAllocationEntry.cc (limited to 'src/FileAllocationEntry.cc') diff --git a/src/FileAllocationEntry.cc b/src/FileAllocationEntry.cc new file mode 100644 index 00000000..77690475 --- /dev/null +++ b/src/FileAllocationEntry.cc @@ -0,0 +1,54 @@ +/* */ +#include "FileAllocationEntry.h" + +#define BUFSIZE 16*1024 + +void FileAllocationEntry::allocateChunk() +{ + int32_t bufSize = BUFSIZE; + char buf[BUFSIZE]; + memset(buf, 0, bufSize); + + _requestGroup->getSegmentMan()->diskWriter->writeData(buf, bufSize, _offset); + _offset += bufSize; + + int64_t totalLength = _requestGroup->getSegmentMan()->totalSize; + if(totalLength < _offset) { + _requestGroup->getSegmentMan()->diskWriter->truncate(totalLength); + _offset = totalLength; + } +} + -- cgit