uint32_tdestination_block=fileInfo.blockId?fileInfo.blockId:0;//if we want the first file on tape (fileInfo.blockId==0) we need to skip the VOL1 header
//we position using the sg locate because it is supposed to do the right thing possibly in a more optimized way (better than st's spaceBlocksForward/Backwards)
dg.positionToLogicalObject(destination_block);
//at this point we should be at the beginning of the headers of the desired file, so now let's check the headers...
//the following should never ever happen... but never say never...
if(hdr1.getVSN().compare(VSN)){
std::stringstreamex_str;
ex_str<<"Wrong volume ID info found in header. Detected: "<<hdr1.getVSN()<<". Wanted: "<<VSN;
throwTapeFormatError(ex_str.str());
}
//we disregard hdr2 on purpose as it contains no useful information, we now check that also uhl1 (hdr1 also contains fseq info but it is modulo 10000, therefore useless)
ex_str<<"Invalid fseq in uhl1. Detected: "<<atol(uhl1.getfSeq().c_str())<<". Wanted: "<<fileInfo.fseq;
throwTapeFormatError(ex_str.str());
}
//now that we are all happy with the information contained within the headers we finally get the block size for our file (provided it has a reasonable value)
* Class containing all the information related to a file being migrated to
* tape.
*/
classInformation{
classInformation{//no information about path and filename here as it cannot be used nor checked on tape
public:
std::stringlastKnownPath;
uint32_tchecksum;
uint64_tnsFileId;
uint64_tsize;
uint32_tfseq;
uint32_tfseq;//this is the payload (i.e. real file) sequence number, not the tape file sequence number (which would include headers and trailers as well)