#include <df_filter.h>


Definition at line 24 of file df_filter.h.
Public Types | |
| enum | ConsistencyCheckMode { RIGOROUS, WARN, NONE } |
| Consistency check mode is strict by default, however in the error recovery cleanup (e.g. More... | |
Public Member Functions | |
| df_Filter (UInt32_t a_blkSize, const string &a_diskBufferFS, const string &a_dbName, ivd_FileLocVect_t &a_files, bool a_append, const ivd_FileSize_t a_dbFileSize=0) | |
| virtual | ~df_Filter () |
| UInt8_t * | NextInputBlock () |
| This function is called by the user of the df_Filter (e.g. | |
| void | SetConsistencyMode (ConsistencyCheckMode a_mode) |
| ConsistencyCheckMode | GetConsistencyMode () const |
| virtual void | Reset () |
| virtual void | ProcEndOfInput () |
| method ProcEndOfInput() must be called at the end of input when block per block parsing is used (migration, FRI check before wirtten to media. | |
| void | CheckLeftovers () |
| This function shall be used at the end of processing the input data stream to verify if everything has been processed by the filter. | |
| bool | ProcessingFile () const |
| Is filter currently procesing (copying) a file from the input stream? | |
| UInt32_t | NextBlockToCopy () const |
| Which is the next block number that the filter will use for copying data? | |
Private Member Functions | |
| void | Init () |
| void | LookupInTable (ivd_FileID_t a_fid, ivd_MigrationID_t a_migID) |
| The function looks up the passed file and migration ID in the filter table. | |
| void | CopyRecord (const df_RecCmn_t *a_recCmn_p) |
| Copy data format records from input stream to the output stream. | |
| void | CloseCopiedSplit () |
| void | CheckUnhandledFiles () |
| virtual void | ProcBlock (const UInt8_t *a_dataBlock) |
| virtual void | ProcRecFileHdr (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecFileEnd (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecBSStart (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecEmbData (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecRawData (const UInt8_t *a_block_p) |
| virtual void | ProcRecBSEnd (const df_RecCmn_t *a_recCmn_p) |
Private Attributes | |
| log_CLASSID_m | |
| Macro to add class name member s_className. | |
| ConsistencyCheckMode | m_checkMode |
| auto_ptr< df_Writer > | m_output |
| UInt32_t | m_outRecNum |
| ivd_FileLocVect_t & | m_files |
| ivd_FileLocIter_t | m_blockBegin |
| ivd_FileLocIter_t | m_blockEnd |
| ivd_FileLocationData_t * | m_curFile |
| vector< UInt8_t > | m_block |
| Buffer, which is used for filtering records inside one block. | |
| UInt8_t * | m_inputBlock_p |
| ivd_FileType_e | m_fileType |
| ivd_FileID_t | m_fileID |
| ivd_MigrationID_t | m_migrationID |
| ivd_FileSize_t | m_fileSize |
| UInt64_t | m_streamSplitSize |
| UInt64_t | m_splitProcessed |
| bool | m_alteredBSS |
| UInt64_t | m_streamSize |
| UInt64_t | m_allStreamSize |
| bool | m_bsEndMissing |
| bool | m_fileEndMissing |
Consistency check mode is strict by default, however in the error recovery cleanup (e.g.
after a medium error) the consistency check level must be decreased.
Definition at line 31 of file df_filter.h.
| df_Filter::df_Filter | ( | UInt32_t | a_blkSize, | |
| const string & | a_diskBufferFS, | |||
| const string & | a_dbName, | |||
| ivd_FileLocVect_t & | a_files, | |||
| bool | a_append, | |||
| const ivd_FileSize_t | a_dbFileSize = 0 | |||
| ) |
Definition at line 39 of file df_filter.cpp.
References Init(), log_FUNC_m, and m_output.
00047 : df_RecReader(new df_BlockProxy(blk_Data_c, bbt_DISK_BUF, a_blkSize)), 00048 m_checkMode(RIGOROUS), 00049 m_output(new df_Writer(blk_Data_c, bbt_DISK_BUF, a_blkSize)), 00050 m_outRecNum(0), 00051 m_files(a_files), 00052 m_blockBegin(m_files.begin()), // files with same block offset are in range 00053 m_blockEnd(m_files.begin()), // block range not defined yet 00054 m_block(GetBlkSize()) { 00055 00056 log_FUNC_m(df_Filter); 00057 00058 Init(); 00059 00060 m_output->NewDiskBuffer(a_diskbufferID, a_diskBufferFS, a_dbFileSize, a_append); 00061 m_output->Go(); 00062 }

| df_Filter::~df_Filter | ( | ) | [virtual] |
Definition at line 65 of file df_filter.cpp.
References log_FUNC_m, and m_output.
00065 { 00066 log_FUNC_m(~df_Filter); 00067 00068 m_output->EndOfData(); 00069 }
| UInt8_t * df_Filter::NextInputBlock | ( | ) |
This function is called by the user of the df_Filter (e.g.
ivd-bea). It fills input data (e.g. from tape) in the buffer returned by this function and then calls df_Writer::Unpack(buffer).
| NULL | when finished parsing input stream, no block is allocated |
Definition at line 179 of file df_filter.cpp.
References ie_DF_BROKEN_PIPE, df_RecReader::IsNextRecordRaw(), ivd_Error, m_alteredBSS, m_block, m_blockBegin, m_files, m_inputBlock_p, m_output, m_splitProcessed, m_streamSize, NULL, and ProcessingFile().
Referenced by bea_RecallThread::Recall().
00179 { 00180 00181 // All the files in the file list have been processed 00182 if (!ProcessingFile() && m_blockBegin == m_files.end() ){ 00183 return NULL; 00184 } 00185 00186 // End-of-split detected 00187 if (m_alteredBSS && m_splitProcessed >= m_streamSize ) { 00188 return NULL; 00189 } 00190 00191 if (ProcessingFile() && IsNextRecordRaw()) { 00192 00193 UInt8_t* buffer_p = m_output->AllocateRawBlock(); 00194 00195 if (buffer_p == NULL) { 00196 throw ivd_Error(ie_DF_BROKEN_PIPE, "Output thread down."); 00197 } 00198 m_inputBlock_p = buffer_p; 00199 } 00200 else { 00201 m_inputBlock_p = &(m_block[0]); 00202 } 00203 00204 return m_inputBlock_p; 00205 }


| void df_Filter::SetConsistencyMode | ( | ConsistencyCheckMode | a_mode | ) | [inline] |
Definition at line 45 of file df_filter.h.
Referenced by bea_RecallThread::Recall().
00045 { 00046 m_checkMode = a_mode; 00047 };

| ConsistencyCheckMode df_Filter::GetConsistencyMode | ( | ) | const [inline] |
| void df_Filter::Reset | ( | ) | [virtual] |
Definition at line 120 of file df_filter.cpp.
References Init(), log_FUNC_m, and df_RecReader::Reset().
Referenced by bea_RecallThread::Recall().
00120 { 00121 log_FUNC_m(Reset); 00122 00123 // Reset own members first 00124 Init(); 00125 00126 df_RecReader::Reset(); 00127 }


| void df_Filter::ProcEndOfInput | ( | ) | [virtual] |
method ProcEndOfInput() must be called at the end of input when block per block parsing is used (migration, FRI check before wirtten to media.
).
Reimplemented from df_RecReader.
Definition at line 607 of file df_filter.cpp.
References CloseCopiedSplit(), and log_FUNC_m.
Referenced by bea_RecallThread::Recall().
00607 { 00608 log_FUNC_m(ProcEndOfInput); 00609 00610 CloseCopiedSplit(); 00611 }


| void df_Filter::CheckLeftovers | ( | ) |
This function shall be used at the end of processing the input data stream to verify if everything has been processed by the filter.
Uses m_checkMode, which can be set by SetConsistencyMode().
Definition at line 78 of file df_filter.cpp.
References CheckUnhandledFiles(), log_FUNC_m, m_blockEnd, and m_files.
Referenced by bea_RecallThread::Recall().
00078 { 00079 log_FUNC_m(CheckLeftovers); 00080 00081 // Make sure to verify if anything has been left in the table 00082 // by moving the iterator to the end(). 00083 m_blockEnd = m_files.end(); 00084 CheckUnhandledFiles(); 00085 }


| bool df_Filter::ProcessingFile | ( | ) | const |
Is filter currently procesing (copying) a file from the input stream?
Definition at line 92 of file df_filter.cpp.
References m_curFile, and NULL.
Referenced by NextInputBlock(), and bea_RecallThread::Recall().

| UInt32_t df_Filter::NextBlockToCopy | ( | ) | const |
Which is the next block number that the filter will use for copying data?
| 0 | No more blocks to be processed. |
Definition at line 136 of file df_filter.cpp.
References m_blockEnd, and m_files.
Referenced by bea_RecallThread::Recall().
00136 { 00137 00138 if (m_blockEnd == m_files.end()) { 00139 return 0; 00140 } 00141 00142 return (m_blockEnd->blockOffset); 00143 }

| void df_Filter::Init | ( | ) | [private] |
Definition at line 98 of file df_filter.cpp.
References ift_UNKNOWN, m_allStreamSize, m_alteredBSS, m_bsEndMissing, m_curFile, m_fileEndMissing, m_fileID, m_fileSize, m_fileType, m_inputBlock_p, m_migrationID, m_splitProcessed, m_streamSize, m_streamSplitSize, and NULL.
Referenced by df_Filter(), and Reset().
00098 { 00099 00100 #if TGT_OS_linux 00101 #warning "Put some of the members to base class and give them better names." 00102 #endif 00103 m_curFile = NULL; 00104 m_fileType = ift_UNKNOWN; 00105 m_fileID = 0; 00106 m_migrationID = 0; 00107 m_fileSize = 0; 00108 m_allStreamSize = 0; 00109 m_streamSplitSize = 0; 00110 m_splitProcessed = 0; 00111 m_alteredBSS = false; 00112 m_bsEndMissing = false; 00113 m_fileEndMissing = false; 00114 m_streamSize = 0; 00115 m_inputBlock_p = NULL; 00116 }

| void df_Filter::LookupInTable | ( | ivd_FileID_t | a_fid, | |
| ivd_MigrationID_t | a_migID | |||
| ) | [private] |
The function looks up the passed file and migration ID in the filter table.
Definition at line 156 of file df_filter.cpp.
References ivd_FileLocationData_t::fileID, m_blockBegin, m_blockEnd, m_curFile, and NULL.
Referenced by ProcRecFileHdr().
00156 { 00157 00158 for (ivd_FileLocIter_t i(m_blockBegin); i != m_blockEnd; ++i) { 00159 if (i->fileID == a_fid && i->migrationID == a_migID) { 00160 m_curFile = &(*i); 00161 00162 // Mark the file immediatelly as found to prevent bogus 00163 // warnings emitted by CheckUnhandledFiles(). 00164 m_curFile->fileID = 0; 00165 return; 00166 } 00167 } 00168 m_curFile = NULL; 00169 }

| void df_Filter::CopyRecord | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private] |
Copy data format records from input stream to the output stream.
Definition at line 211 of file df_filter.cpp.
References dbg_NORM, df_RecReader::GetBlkSize(), df_RecReader::GetCurBlockPos(), df_RecReader::GetCurBlockUsed(), hton(), ie_DF_BROKEN_PIPE, ivd_Error, log_DBG_m, log_FUNC_m, m_output, m_outRecNum, m_streamSplitSize, ntoh(), NULL, rec_BSStart_c, df_RecCmn_t::seqNum, df_RecCmn_t::size, and df_RecCmn_t::type.
Referenced by ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), ProcRecFileEnd(), and ProcRecFileHdr().
00211 { 00212 // Copy record to the Writer 00213 UInt32_t recSize = ntoh(a_recCmn_p->size); 00214 00215 UInt32_t allocSize = recSize; 00216 // Heuristic check if next record is embeded data 00217 // if true then BSS and EMB data has to be writen together. 00218 // Allocate space for all non-processed data in input block. 00219 if (a_recCmn_p->type == rec_BSStart_c && 00220 m_streamSplitSize >= GetBlkSize()) { 00221 00222 log_FUNC_m(CopyRecord); 00223 00224 Int32_t blkSizeLeft = GetCurBlockUsed() - GetCurBlockPos(); 00225 00226 if (blkSizeLeft > 0) { 00227 // Allocate for BSE and the following EMB data. 00228 allocSize += blkSizeLeft; 00229 } 00230 00231 log_DBG_m(dbg_NORM, 00232 "Allocating for BSSt and EMB: " << allocSize); 00233 } 00234 00235 UInt8_t* target = m_output->Allocate(allocSize); 00236 if (target == NULL) { 00237 log_FUNC_m(CopyRecord); 00238 throw ivd_Error(ie_DF_BROKEN_PIPE, "Output thread down."); 00239 } 00240 00241 memcpy(target, a_recCmn_p, recSize); 00242 00243 df_RecCmn_t *outRec_p = reinterpret_cast<df_RecCmn_t*>(target); 00244 outRec_p->seqNum = hton(++m_outRecNum); 00245 00246 m_output->Move(recSize); 00247 }


| void df_Filter::CloseCopiedSplit | ( | ) | [private] |
Definition at line 250 of file df_filter.cpp.
References dbg_DETAIL, dbg_NORM, df_ALIGN_m, df_FS_COMPLETE, df_RF_SPLITTED, df_RecReader::GetBlockID(), ie_DF_INVSTATE, log_DBG_m, log_FUNC_m, log_WRN_m, m_allStreamSize, m_alteredBSS, m_bsEndMissing, m_checkMode, df_RecReader::m_curRecType, df_RecReader::m_curStreamLeft, df_RecReader::m_curStreamName, df_RecReader::m_curStreamType, m_fileEndMissing, m_fileID, m_migrationID, m_output, m_outRecNum, df_RecReader::m_prevRecType, m_streamSize, m_streamSplitSize, NONE, NULL, rec_BSEnd_c, rec_FileEnd_c, true, df_Packer::WriteRecBSEndRaw(), and df_Packer::WriteRecFileEndRaw().
Referenced by ProcEndOfInput().
00250 { 00251 log_FUNC_m(CloseCopiedSplit); 00252 00253 if (m_checkMode == NONE) { 00254 log_DBG_m(dbg_DETAIL, "Consistency check mode set to NONE."); 00255 } 00256 00257 log_DBG_m(dbg_NORM, "Trying to close copied split."); 00258 00259 m_alteredBSS = false; 00260 00261 if (m_bsEndMissing) { 00262 log_DBG_m(dbg_NORM, "BSE is missing. Write it."); 00263 00264 // When BSS is altered, the size of the split at the end must match 00265 // with the size from the FSC. 00266 if (m_curStreamLeft > 0 && m_checkMode != NONE) { 00267 ostringstream sstr; 00268 sstr 00269 << "Closing copied split, but m_curStreamLeft == " 00270 << m_curStreamLeft << "."; 00271 00272 throw ivd_DFError(ie_DF_INVSTATE, GetBlockID(), 00273 "Improperly copied split, FSC might contain wrong split size.", 00274 sstr.str(), true ); 00275 } 00276 00277 // -- Append ByteStreamEnd -- 00278 00279 m_bsEndMissing = false; 00280 00281 UInt32_t recSize = df_ALIGN_m( 00282 sizeof(df_RecCmn_t) + sizeof(df_RecByteStreamEnd_t) + 00283 m_curStreamName.length()+1); 00284 00285 UInt8_t *wp = m_output->Allocate(recSize); 00286 if (wp == NULL) { 00287 log_WRN_m("NULL block pointer from Allocate(). No reader available."); 00288 return; 00289 } 00290 00291 df_Packer::WriteRecBSEndRaw( 00292 m_fileID, 00293 df_FS_COMPLETE, m_curStreamType, 00294 m_streamSize, 00295 // m_streamSplitSize contains the size of the 00296 // split if the split is at the end of medium or 00297 // in the middle. 00298 m_allStreamSize + m_streamSplitSize, 00299 m_curStreamName, 00300 ++m_outRecNum, wp); 00301 00302 m_output->Move(recSize); 00303 // simulating proper record type read 00304 m_prevRecType = m_curRecType = rec_BSEnd_c; 00305 } 00306 00307 if (m_fileEndMissing) { 00308 log_DBG_m(dbg_NORM, "FEnd is missing. Write it."); 00309 00310 // -- Append FileEnd -- 00311 UInt32_t recSize = df_ALIGN_m( sizeof(df_RecCmn_t) + sizeof(df_RecFileEnd_t) ); 00312 00313 UInt8_t* target = m_output->Allocate(recSize); 00314 df_Packer::WriteRecFileEndRaw( 00315 m_fileID, m_migrationID, df_FS_COMPLETE, ++m_outRecNum, target, df_RF_SPLITTED); 00316 00317 m_output->Move(recSize); 00318 00319 m_fileEndMissing = false; 00320 // simulating proper record type read 00321 m_prevRecType = m_curRecType = rec_FileEnd_c; 00322 } 00323 00324 m_allStreamSize = 0; 00325 }


| void df_Filter::CheckUnhandledFiles | ( | ) | [private] |
Definition at line 328 of file df_filter.cpp.
References dbg_DETAIL, df_RecReader::GetBlockID(), ie_DATA_CORRUPTION, log_DBG_m, log_ERR_m, log_FUNC_m, log_MARKLINE_m, m_blockBegin, m_blockEnd, m_checkMode, NONE, and RIGOROUS.
Referenced by CheckLeftovers(), and ProcBlock().
00328 { 00329 log_FUNC_m(CheckUnhandledFiles); 00330 00331 if (m_checkMode == NONE) { 00332 log_DBG_m(dbg_DETAIL, "Consistency check set to NONE."); 00333 return; 00334 } 00335 00336 // Verify that all of the files from the previous block have been 00337 // processed. 00338 UInt32_t numUnhandled(0); 00339 00340 for (ivd_FileLocIter_t i(m_blockBegin); i != m_blockEnd; ++i) { 00341 if (i->fileID != 0) { 00342 log_ERR_m( 00343 "FileID " << i->fileID << 00344 ", migID " << i->migrationID << 00345 ", splitSize " << i->splitSize << 00346 " not found on position " << i->blockOffset); 00347 ++numUnhandled; 00348 } 00349 } 00350 00351 if (numUnhandled > 0 && m_checkMode == RIGOROUS) { 00352 log_MARKLINE_m; 00353 throw ivd_DFError(ie_DATA_CORRUPTION, GetBlockID(), 00354 "State on medium doesn't match FSC. See error.log."); 00355 } 00356 }


| void df_Filter::ProcBlock | ( | const UInt8_t * | a_dataBlock | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 359 of file df_filter.cpp.
References CheckUnhandledFiles(), dbg_DETAIL, dbg_LOW, evt_ERROR, df_RecReader::GetBlockID(), df_RecReader::GetBlockNum(), ie_DF_INVSTREAMFMT, ie_NOTFOUND, log_DBG_m, log_FUNC_m, log_MARKLINE_m, log_WriteEvent(), m_blockBegin, m_blockEnd, m_curFile, m_fileID, m_files, NULL, df_RecReader::PositionToRecord(), and rec_FileHdr_c.
00359 { 00360 log_FUNC_m(ProcBlock); 00361 00362 CheckUnhandledFiles(); 00363 00364 // Prepare pointers for LookupInTable() to work properly, 00365 // based on block ID (== block number) 00366 UInt32_t blockID(GetBlockID()); 00367 log_DBG_m(dbg_DETAIL,"ProcBlock() ID: " << blockID); 00368 00369 if (GetBlockNum() == 1) { 00370 if (m_curFile != NULL) { 00371 ostringstream sstr; 00372 sstr 00373 << "Detected file stream that spans over the migration boundary. " 00374 << "Recreate FRI for this medium and " 00375 << "run FSC vs media check with autocorrect."; 00376 00377 log_WriteEvent(evt_ERROR, sstr.str(), "DF"); 00378 00379 throw ivd_DFError(ie_DF_INVSTREAMFMT, 00380 blockID, "Incomplete file.", sstr.str() ); 00381 } 00382 } 00383 00384 // TODO: What if blockID differs from the block ID in the recall list? 00385 00386 m_blockBegin = m_blockEnd; 00387 00388 while (m_blockEnd != m_files.end() && m_blockEnd->blockOffset <= blockID) { 00389 ++m_blockEnd; 00390 } 00391 00392 // If no files have been processed yet then 00393 // position to first FILE record. 00394 00395 if (m_fileID == 0) { 00396 const df_RecCmn_t* pos = PositionToRecord(rec_FileHdr_c); 00397 if (pos == NULL) { 00398 log_MARKLINE_m; 00399 ostringstream sstr; 00400 sstr 00401 << "Record " 00402 << string((const char*)(&rec_FileHdr_c), sizeof(rec_FileHdr_c)) 00403 << " not found in block."; 00404 throw ivd_DFError( 00405 ie_NOTFOUND, GetBlockID(), sstr.str(), true); 00406 } 00407 } 00408 00409 if (m_blockBegin != m_files.end() && m_blockBegin->blockOffset != blockID) { 00410 log_DBG_m(dbg_LOW, 00411 "Medium block offset is different from offset on the list. " << 00412 "Medium: " << blockID << ", list: " << m_blockBegin->blockOffset); 00413 } 00414 }

| void df_Filter::ProcRecFileHdr | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 418 of file df_filter.cpp.
References CopyRecord(), dbg_DETAIL, dbg_NORM, df_RF_CONTINUED, df_StandardAttr_t::flags, df_RecCmn_t::GetVarDataNet(), df_RecFile_t::idFile, df_RecFile_t::idMig, log_DBG_m, log_FUNC_m, LookupInTable(), m_curFile, m_fileEndMissing, m_fileID, m_fileSize, m_fileType, m_migrationID, m_streamSplitSize, df_RecFile_t::name, ntoh(), NULL, df_StandardAttr_t::size, df_RecFile_t::stdAttr, and df_StandardAttr_t::type.
00418 { 00419 log_FUNC_m(ProcRecFileHdr); 00420 00421 const df_RecFile_t *fh_p = df_GetSpecificRec<df_RecFile_t>(a_recCmn_p); 00422 00423 m_fileType = static_cast<ivd_FileType_e>( ntoh(fh_p->stdAttr.type) ); 00424 m_fileID = static_cast<ivd_FileID_t>(ntoh(fh_p->idFile)); 00425 m_migrationID = ntoh(fh_p->idMig); 00426 m_fileSize = ntoh(fh_p->stdAttr.size); 00427 00428 string name(a_recCmn_p->GetVarDataNet(fh_p->name)); 00429 00430 UInt32_t ff = ntoh(fh_p->stdAttr.flags); 00431 00432 log_DBG_m(dbg_DETAIL, 00433 "File ID (mig ID): " << m_fileID << "(" << m_migrationID << ")" << 00434 " file name: " << name << 00435 " 1st split:" << ( (ff & df_RF_CONTINUED)? "NO" : "YES") ); 00436 00437 LookupInTable(m_fileID, m_migrationID); 00438 00439 if (m_curFile != NULL) { 00440 log_DBG_m(dbg_NORM, "Start of copying the file: " << m_fileID); 00441 m_streamSplitSize = 0; 00442 m_fileEndMissing = true; 00443 CopyRecord(a_recCmn_p); 00444 } 00445 00446 }

| void df_Filter::ProcRecFileEnd | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 449 of file df_filter.cpp.
References CopyRecord(), dbg_DETAIL, dbg_NORM, df_RecFileEnd_t::idFile, ie_DATA_CORRUPTION, log_DBG_m, log_FUNC_m, m_allStreamSize, m_curFile, m_fileEndMissing, m_fileID, m_splitProcessed, m_streamSplitSize, ntoh(), NULL, and df_RecFileEnd_t::status.
00449 { 00450 log_FUNC_m(ProcRecFileEnd); 00451 00452 const df_RecFileEnd_t* fe_p = df_GetSpecificRec<df_RecFileEnd_t>(a_recCmn_p); 00453 UInt32_t status = ntoh(fe_p->status); 00454 00455 // TODO: Overchecking? To be put in the base class? 00456 if (m_fileID != ntoh(fe_p->idFile)) { 00457 ostringstream sstr; 00458 sstr 00459 << "Incorrect File ID on FileEnd. " 00460 << "Expected (" << m_fileID << ") " 00461 << "Found (" << ntoh(fe_p->idFile) << ")."; 00462 00463 throw ivd_InternalError(ie_DATA_CORRUPTION, sstr.str()); 00464 }; 00465 00466 log_DBG_m(dbg_DETAIL, 00467 "FileEnd: " << m_fileID << " status: " << status); 00468 00469 if (m_curFile != NULL) { 00470 // TODO: Check if the file was copied, but was aborted. 00471 00472 m_fileEndMissing = false; 00473 00474 log_DBG_m(dbg_NORM, "End of copying the file: " << m_fileID); 00475 00476 CopyRecord(a_recCmn_p); 00477 m_splitProcessed = 0; 00478 m_streamSplitSize = 0; 00479 m_allStreamSize = 0; 00480 00481 // We're done with this file 00482 m_curFile = NULL; 00483 } 00484 }

| void df_Filter::ProcRecBSStart | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 487 of file df_filter.cpp.
References CopyRecord(), dbg_LOW, dbg_NORM, df_RF_SPLITTED, df_RecCmn_t::flags, hton(), log_DBG_m, log_FUNC_m, m_allStreamSize, m_alteredBSS, m_bsEndMissing, m_curFile, df_RecReader::m_curStreamLeft, df_RecReader::m_curStreamName, m_fileID, m_splitProcessed, m_streamSize, m_streamSplitSize, ntoh(), NULL, and ivd_FileLocationData_t::splitSize.
00487 { 00488 00489 log_FUNC_m(ProcRecBSStart); 00490 00491 if (m_curFile != NULL) { 00492 00493 const df_RecByteStreamStart_t* bssConst_p = 00494 df_GetSpecificRec<df_RecByteStreamStart_t>(a_recCmn_p); 00495 00496 df_RecByteStreamStart_t* bss_p = 00497 const_cast<df_RecByteStreamStart_t*>(bssConst_p); 00498 00499 df_RecCmn_t* recCmnNotConst_p = const_cast<df_RecCmn_t*>(a_recCmn_p); 00500 00501 m_streamSplitSize = m_curStreamLeft; 00502 log_DBG_m(dbg_NORM, 00503 "BSS: size " << ntoh(bss_p->streamSize) 00504 << ", Current stream left: " << m_curStreamLeft 00505 << ", FSC.splitSize: " << m_curFile->splitSize 00506 << ", splitProcessed: " << m_splitProcessed); 00507 00508 m_bsEndMissing = true; 00509 m_allStreamSize = ntoh(bss_p->allStreamSize); 00510 m_streamSize = ntoh(bss_p->streamSize); 00511 00512 // if stream split size > expected stream size 00513 if ( m_streamSplitSize > ((UInt64_t)m_curFile->splitSize - (UInt64_t)m_splitProcessed) ) { 00514 log_DBG_m(dbg_LOW, 00515 "Detected a stream that is split at the end of volume." << 00516 " Correcting BSS."); 00517 00518 // NOTE: Updating a member of a base class! 00519 m_curStreamLeft 00520 = m_streamSplitSize 00521 = m_curFile->splitSize - m_splitProcessed; 00522 00523 bss_p->streamSplitSize = hton(m_curStreamLeft); 00524 recCmnNotConst_p->flags |= hton(UInt32_t(df_RF_SPLITTED)); 00525 00526 m_alteredBSS = true; 00527 00528 log_DBG_m(dbg_NORM, 00529 "File ID: " << m_fileID << 00530 ", stream \'" << m_curStreamName << "\' is split at: " << 00531 m_streamSplitSize); 00532 } 00533 CopyRecord(a_recCmn_p); 00534 } 00535 }

| void df_Filter::ProcRecEmbData | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 538 of file df_filter.cpp.
References CopyRecord(), df_RecEmbeddedData_t::data, m_curFile, m_splitProcessed, ntoh(), NULL, and ivd_VarData_t::size.
00538 { 00539 00540 // TODO: Try to optimize target EMbD by joining them together. 00541 if (m_curFile != NULL) { 00542 CopyRecord(a_recCmn_p); 00543 00544 const df_RecEmbeddedData_t *emd_p = 00545 df_GetSpecificRec<df_RecEmbeddedData_t>(a_recCmn_p); 00546 m_splitProcessed += ntoh(emd_p->data.size); 00547 } 00548 }

| void df_Filter::ProcRecRawData | ( | const UInt8_t * | a_block_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 551 of file df_filter.cpp.
References df_RecReader::GetBlkSize(), m_curFile, m_output, m_splitProcessed, and NULL.
00551 { 00552 if (m_curFile != NULL) { 00553 UInt32_t blkSize = GetBlkSize(); 00554 m_output->Move(blkSize); 00555 m_splitProcessed += blkSize; 00556 } 00557 }

| void df_Filter::ProcRecBSEnd | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 560 of file df_filter.cpp.
References df_RecByteStreamEnd_t::allStreamSize, CopyRecord(), hton(), df_RecByteStreamEnd_t::idFile, log_ERR_m, log_FUNC_m, log_WRN_m, m_allStreamSize, m_bsEndMissing, m_curFile, m_streamSize, m_streamSplitSize, ntoh(), and NULL.
00560 { 00561 log_FUNC_m(ProcRecBSEnd); 00562 00563 if (m_curFile != NULL) { 00564 const df_RecByteStreamEnd_t *bse_p = 00565 df_GetSpecificRec<df_RecByteStreamEnd_t>(a_recCmn_p); 00566 00567 // Calculate relative position in the stream at the BSEn 00568 // regardless of the split. 00569 UInt64_t relStreamPos = m_streamSize; 00570 00571 if (m_streamSplitSize > 0) { 00572 if (m_streamSplitSize < m_streamSize) { 00573 relStreamPos -= (m_streamSize - m_streamSplitSize); 00574 } 00575 else if (m_streamSplitSize > m_streamSize){ 00576 log_ERR_m( 00577 "File ID: " << ntoh(bse_p->idFile) << 00578 "Stream split size > stream size. " << 00579 m_streamSplitSize << " > " << m_streamSize); 00580 } 00581 } 00582 00583 // Reorg/redundant copy of a split might have created wrong BSEn 00584 // record (invalid allStreamSize). It will be corrected. 00585 if ( (m_allStreamSize + relStreamPos) != ntoh(bse_p->allStreamSize)) { 00586 00587 df_RecByteStreamEnd_t *bse_nc_p = 00588 const_cast<df_RecByteStreamEnd_t *>(bse_p); 00589 00590 log_WRN_m( 00591 "File ID: " << ntoh(bse_p->idFile) << 00592 "Corrected BSE.allStreamSize from " << 00593 ntoh(bse_p->allStreamSize) << " to " << 00594 m_allStreamSize + relStreamPos); 00595 00596 bse_nc_p->allStreamSize = hton(m_allStreamSize + relStreamPos); 00597 } 00598 00599 // TODO: Check if the stream was copied, but was aborted. 00600 CopyRecord(a_recCmn_p); 00601 m_streamSplitSize = 0; 00602 m_bsEndMissing = false; 00603 } 00604 }

df_Filter::log_CLASSID_m [private] |
Macro to add class name member s_className.
Reimplemented from df_RecReader.
Definition at line 61 of file df_filter.h.
ConsistencyCheckMode df_Filter::m_checkMode [private] |
Definition at line 63 of file df_filter.h.
Referenced by CheckUnhandledFiles(), and CloseCopiedSplit().
auto_ptr<df_Writer> df_Filter::m_output [private] |
Definition at line 66 of file df_filter.h.
Referenced by CloseCopiedSplit(), CopyRecord(), df_Filter(), NextInputBlock(), ProcRecRawData(), and ~df_Filter().
UInt32_t df_Filter::m_outRecNum [private] |
ivd_FileLocVect_t& df_Filter::m_files [private] |
Definition at line 70 of file df_filter.h.
Referenced by CheckLeftovers(), NextBlockToCopy(), NextInputBlock(), and ProcBlock().
ivd_FileLocIter_t df_Filter::m_blockBegin [private] |
Definition at line 71 of file df_filter.h.
Referenced by CheckUnhandledFiles(), LookupInTable(), NextInputBlock(), and ProcBlock().
ivd_FileLocIter_t df_Filter::m_blockEnd [private] |
Definition at line 72 of file df_filter.h.
Referenced by CheckLeftovers(), CheckUnhandledFiles(), LookupInTable(), NextBlockToCopy(), and ProcBlock().
ivd_FileLocationData_t* df_Filter::m_curFile [private] |
Definition at line 73 of file df_filter.h.
Referenced by Init(), LookupInTable(), ProcBlock(), ProcessingFile(), ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), ProcRecFileEnd(), ProcRecFileHdr(), and ProcRecRawData().
vector<UInt8_t> df_Filter::m_block [private] |
Buffer, which is used for filtering records inside one block.
Definition at line 77 of file df_filter.h.
Referenced by NextInputBlock().
UInt8_t* df_Filter::m_inputBlock_p [private] |
ivd_FileType_e df_Filter::m_fileType [private] |
ivd_FileID_t df_Filter::m_fileID [private] |
Definition at line 82 of file df_filter.h.
Referenced by CloseCopiedSplit(), Init(), ProcBlock(), ProcRecBSStart(), ProcRecFileEnd(), and ProcRecFileHdr().
ivd_MigrationID_t df_Filter::m_migrationID [private] |
Definition at line 83 of file df_filter.h.
Referenced by CloseCopiedSplit(), Init(), and ProcRecFileHdr().
ivd_FileSize_t df_Filter::m_fileSize [private] |
UInt64_t df_Filter::m_streamSplitSize [private] |
Definition at line 85 of file df_filter.h.
Referenced by CloseCopiedSplit(), CopyRecord(), Init(), ProcRecBSEnd(), ProcRecBSStart(), ProcRecFileEnd(), and ProcRecFileHdr().
UInt64_t df_Filter::m_splitProcessed [private] |
Definition at line 86 of file df_filter.h.
Referenced by Init(), NextInputBlock(), ProcRecBSStart(), ProcRecEmbData(), ProcRecFileEnd(), and ProcRecRawData().
bool df_Filter::m_alteredBSS [private] |
Definition at line 89 of file df_filter.h.
Referenced by CloseCopiedSplit(), Init(), NextInputBlock(), and ProcRecBSStart().
UInt64_t df_Filter::m_streamSize [private] |
Definition at line 91 of file df_filter.h.
Referenced by CloseCopiedSplit(), Init(), NextInputBlock(), ProcRecBSEnd(), and ProcRecBSStart().
UInt64_t df_Filter::m_allStreamSize [private] |
Definition at line 92 of file df_filter.h.
Referenced by CloseCopiedSplit(), Init(), ProcRecBSEnd(), ProcRecBSStart(), and ProcRecFileEnd().
bool df_Filter::m_bsEndMissing [private] |
Definition at line 95 of file df_filter.h.
Referenced by CloseCopiedSplit(), Init(), ProcRecBSEnd(), and ProcRecBSStart().
bool df_Filter::m_fileEndMissing [private] |
Definition at line 96 of file df_filter.h.
Referenced by CloseCopiedSplit(), Init(), ProcRecFileEnd(), and ProcRecFileHdr().
1.5.6