#include <bea_tapemedium.h>


Definition at line 28 of file bea_tapemedium.h.
Public Member Functions | |
| bea_TapeMedium (scsi_IO *const a_scsiIO_p) | |
| virtual void | ChangeVolume (UInt32_t a_volNum, UInt32_t a_block=0) |
| virtual UInt32_t | ReadCurrentVolume () |
| virtual void | Format (vector< UInt32_t > a_volSizes, bool a_duplAITMode) |
| virtual void | AppendVolume (UInt32_t a_volSize) |
Protected Member Functions | |
| virtual | ~bea_TapeMedium () |
| virtual void | Refresh () |
Private Member Functions | |
| void | RefreshTapeInfo () |
| void | RefreshMemoryInfo () |
| void | DetectAITWORM () |
| void | DetectLTOWORM () |
| void | RefreshCompressionState () |
Private Attributes | |
| log_CLASSID_m | |
| scsi_IO *const | m_scsiIO_p |
| auto_ptr< bea_MediumMemory > | m_mediumMem |
| bea_TapeMedium::bea_TapeMedium | ( | scsi_IO *const | a_scsiIO_p | ) |
Definition at line 41 of file bea_tapemedium.cpp.
References bmf_AIT, bmf_LTO, bmf_SAIT, dbg_LOW, log_DBG_m, log_FUNC_m, bea_Medium::m_mediumFamily, m_mediumMem, RefreshMemoryInfo(), RefreshTapeInfo(), and bea_Medium::SetMediumMem().
00042 : m_scsiIO_p(a_scsiIO_p) { 00043 00044 log_FUNC_m(bea_TapeMedium); 00045 00046 RefreshTapeInfo(); 00047 00048 switch (m_mediumFamily) { 00049 case bmf_AIT: { 00050 m_mediumMem.reset(new bea_MicMemory(a_scsiIO_p)); 00051 log_DBG_m(dbg_LOW, "MIC Object created."); 00052 break; 00053 } 00054 case bmf_LTO: 00055 case bmf_SAIT: { 00056 m_mediumMem.reset(new bea_MamMemory(a_scsiIO_p)); 00057 log_DBG_m(dbg_LOW, "MAM Object created."); 00058 break; 00059 } 00060 default: { 00061 log_DBG_m(dbg_LOW, "No CM Object created."); 00062 break; 00063 } 00064 } // switch (m_mediumFamily) 00065 SetMediumMem(m_mediumMem.get()); 00066 00067 // Detect CM and refresh data from CM 00068 RefreshMemoryInfo(); 00069 }

| bea_TapeMedium::~bea_TapeMedium | ( | ) | [protected, virtual] |
Definition at line 73 of file bea_tapemedium.cpp.
References log_FUNC_m.
00073 { 00074 log_FUNC_m(~bea_TapeMedium); 00075 }
Implements bea_Medium.
Definition at line 94 of file bea_tapemedium.cpp.
References dbg_NORM, bea_Medium::DoMediumLogging(), bea_Medium::GetCurrentVolume(), ivd_BaseException::GetError(), bea_Medium::GetJobID(), bea_Volume::GetVolumeNumber(), ie_INVALID_ARG, ie_MEDIUM_BLANK, ie_MEDIUM_EOD, ie_MEDIUM_EOM, ie_SCSI_NOT_READY, bea_Volume::InvalidateEOD(), scsi_IO::IOCtl(), log_DBG_m, log_FUNC_A_m, log_WriteEvent(), bea_Medium::m_barcode, m_scsiIO_p, ReadCurrentVolume(), cdb_Locate::SetBlockNum(), bea_Medium::SetCurrentVolume(), cdb_Locate::SetPartitionNum(), and str.
00094 { 00095 log_FUNC_A_m(ChangeVolume, 00096 "volume: " << a_volNum << 00097 " blk: " << a_block); 00098 00099 if (a_volNum < 1) { 00100 throw ivd_InternalError( 00101 ie_INVALID_ARG, "Media volume number must be greater than 0."); 00102 }; 00103 00104 UInt32_t curVolume = ReadCurrentVolume(); 00105 cdb_Locate pos; 00106 00107 GetCurrentVolume()->InvalidateEOD(); // sets m_atEOD = false; 00108 00109 if (curVolume != a_volNum) { 00110 pos.SetPartitionNum(UInt8_t(a_volNum) - 1); 00111 } 00112 pos.SetBlockNum(a_block); 00113 00114 bool retried(false); 00115 00116 if (DoMediumLogging()) { 00117 ostringstream str; 00118 str << "Vol " << GetCurrentVolume()->GetVolumeNumber() 00119 << ": Changing to volume " << a_volNum << "..."; 00120 00121 log_WriteEvent(str.str(), "", GetJobID(), m_barcode); 00122 } 00123 00124 while (true) { 00125 try { 00126 m_scsiIO_p->IOCtl(pos); 00127 SetCurrentVolume(a_volNum); 00128 break; 00129 } 00130 catch (const ivd_Error &ie) { 00131 if (ie.GetError() == ie_MEDIUM_BLANK || 00132 ie.GetError() == ie_MEDIUM_EOD || 00133 ie.GetError() == ie_MEDIUM_EOM) { 00134 00135 if (a_block == 0) { 00136 log_DBG_m(dbg_NORM, 00137 "Got blank check on positioning to the beginning. Ignore."); 00138 break; 00139 } 00140 else { 00141 throw; 00142 } 00143 } 00144 else if (!retried && ie.GetError() == ie_SCSI_NOT_READY) { 00145 log_DBG_m(dbg_NORM, 00146 "Not yet ready. Try once more."); 00147 retried = true; 00148 } 00149 else { 00150 throw; 00151 } 00152 } 00153 }; 00154 }

| UInt32_t bea_TapeMedium::ReadCurrentVolume | ( | ) | [virtual] |
Implements bea_Medium.
Definition at line 79 of file bea_tapemedium.cpp.
References dbg_DETAIL, data_Mode::GetCurPartNumber(), bea_Medium::GetCurVolNumber(), scsi_IO::IOCtl(), log_DBG_m, log_FUNC_m, m_scsiIO_p, data_Mode::pg_DEVCFG, and bea_Medium::SetCurrentVolume().
Referenced by ChangeVolume(), and RefreshTapeInfo().
00079 { 00080 log_FUNC_m(ReadCurrentVolume); 00081 00082 data_Mode devCfg(data_Mode::pg_DEVCFG); 00083 cdb_ModeSense modeSns(devCfg); 00084 00085 m_scsiIO_p->IOCtl(modeSns); 00086 log_DBG_m(dbg_DETAIL,"Current partition: " << (devCfg.GetCurPartNumber() + 1)) 00087 SetCurrentVolume(devCfg.GetCurPartNumber() + 1); 00088 00089 return GetCurVolNumber(); 00090 }


Implements bea_Medium.
Definition at line 158 of file bea_tapemedium.cpp.
References df_TCMMedium_t::barcode, bmf_AIT, bmf_LTO, bmf_SAIT, bmf_VXA, bmt_AIT5, dbg_LOW, dbg_NORM, bea_Volume::Erase(), evt_WARNING, bea_Medium::GetBarcode(), ivd_BaseException::GetFriendly(), bea_Medium::GetJobID(), bea_Medium::GetMediumFamily(), scsi_IO::GetProductID(), scsi_IO::GetProductRevision(), scsi_IO::GetProductSerialNumber(), scsi_IO::GetVendorID(), bea_Medium::GetVolume(), bea_Medium::GetVolumeCount(), ie_BEA_FORMAT, scsi_IO::IOCtl(), bea_Medium::IsWORM(), ivd_Error, df_TCMMedium_t::loadCount, log_DBG_m, log_FUNC_A_m, log_MARKLINE_m, log_WriteEvent(), m_mediumMem, bea_Medium::m_mediumType, m_scsiIO_p, mode_AIT, mode_DDS, data_Mode::pg_AITCFG, data_Mode::pg_PART, df_TCMMedium_t::productID, bea_Volume::ReadVolInfoFromHeader(), Refresh(), df_TCMMedium_t::revisionID, bea_Volume::Rewind(), scsi_TIMEOUT_FORMAT_d, df_TCMMedium_t::serialNumber, data_Mode::SetAITMode(), data_Mode::SetAITUnloadAtPBOT(), data_Mode::SetPartitions(), df_TCMMedium_t::vendorID, VOL_BLANK, and VOL_OTHER.
00158 { 00159 log_FUNC_A_m(Format, "# volumes:" << a_volSizes.size() ); 00160 00161 if (IsWORM()) { 00162 if (GetVolumeCount() > 1) { 00163 log_MARKLINE_m; 00164 throw ivd_Error( 00165 ie_BEA_FORMAT, "WORM medium: medium already has volumes."); 00166 }; 00167 00168 // Verify volume type and prevent formatting non-blank media. 00169 if (GetVolume(1)->GetVolumeType() == VOL_OTHER) { 00170 GetVolume(1)->ReadVolInfoFromHeader(); 00171 } 00172 00173 if (GetVolume(1)->GetVolumeType() != VOL_BLANK) { 00174 log_MARKLINE_m; 00175 throw ivd_Error(ie_BEA_FORMAT, "WORM medium: volume is not blank."); 00176 } 00177 } // if (IsWORM()) 00178 00179 UInt32_t oldLoadCount(0); 00180 00181 if (m_mediumMem->IsValid()) { 00182 try { 00183 // Get old CM volume note 00184 oldLoadCount = m_mediumMem->GetMediumRecord().loadCount; 00185 } 00186 catch (ivd_Exception &ie) { 00187 log_DBG_m(dbg_LOW, "Get medium record failed. " << ie); 00188 }; 00189 }; 00190 00191 switch (GetMediumFamily()) { 00192 case bmf_LTO: 00193 case bmf_VXA: 00194 case bmf_SAIT: { 00195 log_DBG_m(dbg_LOW, 00196 "Dummy format of LTO/SAIT/VXA medium (1 volume): Erasing single medium volume."); 00197 if (a_volSizes.size() == 1) { 00198 GetVolume(1)->Rewind(); 00199 GetVolume(1)->Erase(); 00200 } 00201 else { 00202 log_MARKLINE_m; 00203 throw ivd_Error( 00204 ie_BEA_FORMAT, "Multi-volume format of non-AIT tape medium not possible."); 00205 } 00206 break; 00207 } 00208 case bmf_AIT: { 00209 // Acquire current settings 00210 data_Mode ad(data_Mode::pg_AITCFG); 00211 data_Mode pi(data_Mode::pg_PART); 00212 00213 cdb_ModeSense aitInfo(ad); 00214 cdb_ModeSense partInfo(pi); 00215 00216 log_DBG_m(dbg_NORM, "Getting AIT/medium volume info."); 00217 m_scsiIO_p->IOCtl(aitInfo); 00218 m_scsiIO_p->IOCtl(partInfo); 00219 00220 // Set new settings and media volume sizes 00221 if ( a_volSizes.size() != 1 00222 || a_duplAITMode 00223 || m_mediumType == bmt_AIT5 ){ 00224 log_DBG_m(dbg_NORM, "Setting AIT mode."); 00225 ad.SetAITMode(mode_AIT); 00226 } 00227 else { 00228 log_DBG_m(dbg_NORM, "Setting DDS mode."); 00229 ad.SetAITMode(mode_DDS); 00230 } 00231 00232 if ( m_mediumType == bmt_AIT5){ 00233 log_DBG_m(dbg_NORM, "AIT5: setting ulpbot bit"); 00234 ad.SetAITUnloadAtPBOT(1); 00235 } 00236 00237 cdb_ModeSelect aitSel(ad); 00238 m_scsiIO_p->IOCtl(aitSel); 00239 00240 pi.SetPartitions(a_volSizes); 00241 cdb_ModeSelect partSel(pi); 00242 00243 // Format tape (MIC content is lost). 00244 log_DBG_m(dbg_LOW, "Creating medium volumes. (Will take a long time > 60 minutes."); 00245 m_scsiIO_p->IOCtl(partSel, scsi_TIMEOUT_FORMAT_d); 00246 log_DBG_m(dbg_NORM, "Medium volumes created. "); 00247 00248 break; 00249 } 00250 default: { 00251 log_MARKLINE_m; 00252 throw ivd_Error( 00253 ie_BEA_FORMAT, "Unsupported tape medium family!"); 00254 break; 00255 } 00256 } 00257 Refresh(); 00258 m_mediumMem->ClearRecords(); 00259 00260 if (m_mediumMem->IsDetected()) { 00261 try { 00262 df_TCMMedium_t mediumNote; 00263 00264 mediumNote.loadCount = oldLoadCount; 00265 00266 memcpy(mediumNote.barcode, GetBarcode().data(), GetBarcode().length()); 00267 mediumNote.barcode[GetBarcode().length()] = '\0'; 00268 00269 // NOTE: It does not include the trailing \0 00270 memcpy( 00271 mediumNote.vendorID, 00272 m_scsiIO_p->GetVendorID().data(), 00273 m_scsiIO_p->GetVendorID().length() ); 00274 00275 // NOTE: It does not include the trailing \0 00276 memcpy( 00277 mediumNote.productID, 00278 m_scsiIO_p->GetProductID().data(), 00279 m_scsiIO_p->GetProductID().length() ); 00280 00281 // NOTE: It does not include the trailing \0 00282 memcpy( 00283 mediumNote.revisionID, 00284 m_scsiIO_p->GetProductRevision().data(), 00285 m_scsiIO_p->GetProductRevision().length() ); 00286 00287 // NOTE: Trailing \0 is provided by constructor, which sets 00288 // everything to 0. 00289 memcpy( 00290 mediumNote.serialNumber, 00291 m_scsiIO_p->GetProductSerialNumber().data(), 00292 m_scsiIO_p->GetProductSerialNumber().length() ); 00293 00294 m_mediumMem->UpdateMediumRecord(mediumNote); 00295 m_mediumMem->Write(); 00296 00297 log_DBG_m(dbg_LOW, 00298 "Available space in CM after format: " << 00299 m_mediumMem->GetAvailable() ); 00300 } 00301 catch (ivd_Exception &ie) { 00302 ostringstream sstr; 00303 sstr 00304 << "Creating records in CM FAILED (" 00305 << ie.GetFriendly() << ")."; 00306 00307 log_WriteEvent( 00308 evt_WARNING, 00309 sstr.str(), 00310 "", 00311 GetJobID(), 00312 GetBarcode()); 00313 } 00314 catch(...) { 00315 log_WriteEvent( 00316 evt_WARNING, 00317 "Creating records in CM FAILED.", 00318 "", 00319 GetJobID(), 00320 GetBarcode()); 00321 } 00322 } // if (m_mediumMem->IsDetected()) 00323 }

| void bea_TapeMedium::AppendVolume | ( | UInt32_t | a_volSize | ) | [virtual] |
Implements bea_Medium.
Definition at line 327 of file bea_tapemedium.cpp.
References bmf_AIT, bea_Medium::GetMediumFamily(), ie_BEA_FORMAT, scsi_IO::IOCtl(), ivd_Error, log_FUNC_A_m, log_MARKLINE_m, m_scsiIO_p, data_Mode::pg_AIT_APPENDPART, data_Mode::pg_PART, Refresh(), scsi_TIMEOUT_FORMAT_d, data_Mode::SetPage(), and data_Mode::SetPartitions().
00327 { 00328 log_FUNC_A_m(AppendVolume, "size: " << a_volSize); 00329 00330 if (GetMediumFamily() != bmf_AIT) { 00331 log_MARKLINE_m; 00332 throw ivd_Error( 00333 ie_BEA_FORMAT, "Appending volumes on non-AIT medium not possible."); 00334 }; 00335 00336 data_Mode pi(data_Mode::pg_PART); 00337 cdb_ModeSense partInfo(pi); 00338 m_scsiIO_p->IOCtl(partInfo); 00339 00340 pi.SetPage(data_Mode::pg_AIT_APPENDPART); 00341 00342 vector<UInt32_t> psize; 00343 psize.push_back(a_volSize); 00344 00345 pi.SetPartitions(psize); 00346 cdb_ModeSelect partSel(pi); 00347 m_scsiIO_p->IOCtl(partSel, scsi_TIMEOUT_FORMAT_d); 00348 00349 // Re-read object properties. 00350 Refresh(); 00351 }

| void bea_TapeMedium::Refresh | ( | ) | [protected, virtual] |
Implements bea_Medium.
Definition at line 355 of file bea_tapemedium.cpp.
References log_FUNC_m, RefreshMemoryInfo(), and RefreshTapeInfo().
Referenced by AppendVolume(), and Format().
00355 { 00356 log_FUNC_m(Refresh); 00357 00358 RefreshTapeInfo(); 00359 00360 RefreshMemoryInfo(); 00361 }


| void bea_TapeMedium::RefreshTapeInfo | ( | ) | [private] |
Definition at line 365 of file bea_tapemedium.cpp.
References bea_Medium::AddVolume(), bmf_AIT, bmf_DDS, bmf_LTO, bmf_SAIT, bmf_UNKNOWN, bmf_VXA, bmt_DDS1, bmt_DDS2, bmt_DDS3, bmt_DDS4, bmt_LTO, bmt_LTO2, bmt_LTO3, bmt_LTO4, bmt_LTO5, bmt_SAIT1, bmt_UNKNOWN, bmt_VXA320, dbg_DETAIL, dbg_LOW, dbg_NORM, bea_Medium::DeleteVolumes(), DetectAITWORM(), DetectLTOWORM(), data_Density::GetAssigningOrg(), data_Density::GetBitsPerMM(), data_Density::GetCapacity(), data_Mode::GetDensityCode(), data_Density::GetDensityCount(), data_Density::GetDensityName(), data_Density::GetDescription(), data_Density::GetMediaWidth(), data_Mode::GetPartCount(), data_Mode::GetPartSize(), data_Density::GetPrimaryCode(), data_Density::GetSecondaryCode(), bea_Medium::GetSize(), data_Density::GetTracks(), ie_FATAL_ERROR, ie_MEDIUM_MEDERR, scsi_IO::IOCtl(), ivd_Error, log_DBG_m, log_FUNC_m, log_MARKLINE_m, bea_Medium::m_barcode, bea_Medium::m_mediumFamily, bea_Medium::m_mediumType, m_scsiIO_p, bea_Medium::m_serialNum, data_Mode::pg_DEVCFG, data_Mode::pg_PART, ReadCurrentVolume(), RefreshCompressionState(), bea_Medium::SetSize(), bea_Medium::SetWORM(), and size.
Referenced by bea_TapeMedium(), and Refresh().
00365 { 00366 00367 log_FUNC_m(RefreshTapeInfo); 00368 00369 m_barcode.clear(); 00370 m_serialNum.clear(); 00371 m_mediumFamily = bmf_UNKNOWN; 00372 m_mediumType = bmt_UNKNOWN; 00373 SetWORM(false); 00374 00375 // Delete old volume information (not in Cartridge memory!) 00376 DeleteVolumes(); 00377 00378 ReadCurrentVolume(); 00379 00380 // Try to get density code from the block descriptor. 00381 data_Mode devCfg(data_Mode::pg_DEVCFG); 00382 cdb_ModeSense modeSns(devCfg); 00383 00384 m_scsiIO_p->IOCtl(modeSns); 00385 m_mediumType = devCfg.GetDensityCode(); 00386 00387 00388 // See codes in the SCSI standard (SCSI Stream Commands 2, Table A.3) 00389 // and SCSI specification documents of tape drive vendors. 00390 switch (m_mediumType) { 00391 case bmt_DDS1: 00392 case bmt_DDS2: 00393 case bmt_DDS3: 00394 case bmt_DDS4: 00395 { 00396 m_mediumFamily = bmf_DDS; 00397 break; 00398 } 00399 case bmt_VXA320: 00400 { 00401 m_mediumFamily = bmf_VXA; 00402 break; 00403 } 00404 default: 00405 { 00406 m_mediumFamily = m_mediumType; 00407 break; 00408 } 00409 } 00410 log_DBG_m(dbg_NORM, 00411 "** Medium density info of the loaded medium:" << endl << 00412 "Primary code : " << int(m_mediumType) << endl << 00413 "Secondary code : " << int(m_mediumFamily) ); 00414 00415 // Try to get more density information for non-DDS and non-VXA media: 00416 if ( (m_mediumFamily != bmf_DDS) 00417 && (m_mediumFamily != bmf_VXA) ) { 00418 // Report density for the loaded medium 00419 data_Density dens; 00420 cdb_ReportDensity dc(dens, true); 00421 m_scsiIO_p->IOCtl(dc); 00422 00423 if (dens.GetDensityCount() < 1) { 00424 log_MARKLINE_m; 00425 throw ivd_InternalError( 00426 ie_FATAL_ERROR, 00427 "CHECK THIS: Get Density Support didn't return any records."); 00428 } 00429 else if (dens.GetDensityCount() > 1) { 00430 log_MARKLINE_m; 00431 throw ivd_InternalError( 00432 ie_FATAL_ERROR, 00433 "CHECK THIS: Get Density Support returned more than one record."); 00434 } 00435 log_DBG_m(dbg_NORM, 00436 "** Medium density info of the loaded medium:" << endl << 00437 "Primary code : " << int(dens.GetPrimaryCode(0)) << endl << 00438 "Secondary code : " << int(dens.GetSecondaryCode(0)) << endl << 00439 "Bits per mm : " << dens.GetBitsPerMM(0) << endl << 00440 "Media width : " << dens.GetMediaWidth(0) << endl << 00441 "Tracks : " << dens.GetTracks(0) << endl << 00442 "Capacity : " << dens.GetCapacity(0) << endl << 00443 "Assigning org : " << dens.GetAssigningOrg(0) << endl << 00444 "Name : " << dens.GetDensityName(0) << endl << 00445 "Description : " << dens.GetDescription(0) ); 00446 00447 m_mediumType = UInt32_t(dens.GetPrimaryCode(0)); 00448 m_mediumFamily = UInt32_t(dens.GetSecondaryCode(0)); 00449 00450 if ( m_mediumType == bmt_LTO 00451 || m_mediumType == bmt_LTO2 00452 || m_mediumType == bmt_LTO3 00453 || m_mediumType == bmt_LTO4 00454 || m_mediumType == bmt_LTO5 ) { 00455 00456 RefreshCompressionState(); 00457 00458 // both LTO and SAIT reports same value (40h), so... 00459 const string sait("SAIT-1"); 00460 const string densName(dens.GetDensityName(0), 0, sait.length()); 00461 00462 log_DBG_m(dbg_DETAIL, 00463 "sait: \'" << sait << "\' densName: \'" << densName << "\'"); 00464 00465 if (densName == sait) { 00466 log_DBG_m(dbg_LOW, "Detected Sony SAIT medium."); 00467 m_mediumType = bmt_SAIT1; 00468 m_mediumFamily = bmf_SAIT; 00469 } // if (densName == sait) 00470 else { 00471 m_mediumFamily = bmf_LTO; 00472 } 00473 } 00474 // Store medium's declared total capacity 00475 SetSize(dens.GetCapacity(0)); 00476 } // if (m_mediumFamily != bmf_DDS) 00477 00478 // LTO has only one medium volume and does not support 00479 // mode medium partitions page. 00480 // It is valid to define its medium volume this way. 00481 switch (m_mediumFamily) { 00482 case bmf_LTO: 00483 case bmf_SAIT: 00484 { 00485 DetectLTOWORM(); 00486 data_Density dens; 00487 cdb_ReportDensity dc(dens, true); 00488 m_scsiIO_p->IOCtl(dc); 00489 00490 AddVolume( 00491 new bea_TapeVolume( m_scsiIO_p, this, 1, dens.GetCapacity(0)) ); 00492 break; 00493 } 00494 case bmf_AIT: 00495 { 00496 DetectAITWORM(); 00497 data_Mode pi(data_Mode::pg_PART); 00498 cdb_ModeSense partInfo(pi); 00499 00500 UInt32_t medSize(0); 00501 00502 log_DBG_m(dbg_NORM, "Getting medium volume info"); 00503 m_scsiIO_p->IOCtl(partInfo); 00504 00505 log_DBG_m(dbg_LOW, "Medium volumes: " << (int)pi.GetPartCount()); 00506 for (UInt8_t i = 0; i < pi.GetPartCount(); i++) { 00507 UInt32_t size(pi.GetPartSize(i)); 00508 00509 // We treat zero-size volumes as medium error 00510 if (size == 0) { 00511 log_MARKLINE_m; 00512 throw ivd_Error(ie_MEDIUM_MEDERR, 00513 "Reported medium volume size is 0.", true); 00514 } 00515 AddVolume(new bea_TapeVolume( m_scsiIO_p, this, (i+1), size) ); 00516 00517 medSize += size; 00518 00519 // If the sum of reported volumes is twice the size of the 00520 // declared medium size, then this is a medium error. 00521 if (GetSize() > 0 && medSize > (GetSize()*2) ) { 00522 log_MARKLINE_m; 00523 ostringstream sstr; 00524 sstr << "Reported medium volume sizes are too large: " << medSize; 00525 throw ivd_Error(ie_MEDIUM_MEDERR, sstr.str(), true); 00526 } 00527 }; 00528 log_DBG_m(dbg_NORM, "Sum of volume sizes: " << medSize); 00529 if (m_mediumFamily == bmf_DDS) { 00530 log_DBG_m(dbg_LOW, "DDS size: " << medSize); 00531 SetSize(medSize); 00532 } 00533 break; 00534 } 00535 } // switch (m_mediumFamily) 00536 RefreshCompressionState(); 00537 }


| void bea_TapeMedium::RefreshMemoryInfo | ( | ) | [private] |
Definition at line 540 of file bea_tapemedium.cpp.
References df_TCMMedium_t::barcode, dbg_NORM, ivd_BaseException::GetFriendly(), bea_Medium::GetVolumeCount(), log_DBG_m, log_FUNC_m, bea_Medium::m_barcode, m_mediumMem, and bea_Medium::m_serialNum.
Referenced by bea_TapeMedium(), and Refresh().
00540 { 00541 log_FUNC_m(RefreshMemoryInfo); 00542 00543 // 00544 // Medium memory refresh must follow detection of medium volumes 00545 // 00546 m_mediumMem->Refresh(GetVolumeCount()); 00547 00548 try { 00549 if (m_mediumMem->IsValid()) { 00550 const df_TCMMedium_t med = m_mediumMem->GetMediumRecord(); 00551 m_barcode.assign( reinterpret_cast<const char*>(med.barcode) ); 00552 } 00553 } 00554 catch (ivd_Error &ie) { 00555 log_DBG_m(dbg_NORM, 00556 "Can't check if CM is valid: " << ie.GetFriendly()); 00557 } 00558 catch (...) { 00559 log_DBG_m(dbg_NORM, 00560 "ERROR: Can't check if CM is valid."); 00561 } 00562 00563 try { 00564 m_serialNum = m_mediumMem->GetSerialNumber(); 00565 log_DBG_m(dbg_NORM, "** Medium serial number:" << endl << 00566 "Serial number: " << m_serialNum << endl << 00567 "Manufacturer : " << m_mediumMem->GetManufacturer() << endl << 00568 "Secondary ID : " << int(m_mediumMem->GetSecondaryID()) << endl << 00569 "Checksum : " << int(m_mediumMem->GetChecksum()) ); 00570 } 00571 catch (ivd_Error &ie) { 00572 log_DBG_m(dbg_NORM, 00573 "Can't read medium serial number or manufacturer: " << ie.GetFriendly()); 00574 } 00575 catch (...) { 00576 log_DBG_m(dbg_NORM, 00577 "ERROR: Can't read medium serial number or manufacturer."); 00578 } 00579 }


| void bea_TapeMedium::DetectAITWORM | ( | ) | [private] |
Definition at line 581 of file bea_tapemedium.cpp.
References data_Mode_t::ait, data_ModeAIT_t::aitPage, dbg_NORM, ivd_BaseException::GetFriendly(), data_Mode::GetModeStruct(), scsi_IO::IOCtl(), log_DBG_m, log_FUNC_m, m_scsiIO_p, data_Mode::pg_AITCFG, bea_Medium::SetWORM(), and data_ModeAITConfigPage_t::worm.
Referenced by RefreshTapeInfo().
00581 { 00582 log_FUNC_m(DetectAITWORM); 00583 00584 try { 00585 data_Mode ad(data_Mode::pg_AITCFG); 00586 cdb_ModeSense aitInfo(ad); 00587 m_scsiIO_p->IOCtl(aitInfo); 00588 00589 if (ad.GetModeStruct().ait.aitPage.worm == 1) { 00590 log_DBG_m(dbg_NORM, "AIT WORM tape detected."); 00591 00592 SetWORM(true); 00593 } 00594 } 00595 catch (const ivd_Error &ie) { 00596 log_DBG_m(dbg_NORM, "Can't detect AIT WORM: " << ie.GetFriendly()); 00597 } 00598 catch (...) { 00599 log_DBG_m(dbg_NORM, "ERROR: Can't detect AIT WORM."); 00600 } 00601 }


| void bea_TapeMedium::DetectLTOWORM | ( | ) | [private] |
Definition at line 603 of file bea_tapemedium.cpp.
References dbg_LOW, dbg_NORM, ivd_BaseException::GetFriendly(), scsi_IO::IOCtl(), data_Mode::IsMediumWORM(), log_DBG_m, log_FUNC_m, m_scsiIO_p, data_Mode::pg_DEVCFG, and bea_Medium::SetWORM().
Referenced by RefreshTapeInfo().
00603 { 00604 log_FUNC_m(DetectLTOWORM); 00605 00606 try { 00607 data_Mode devCfg(data_Mode::pg_DEVCFG); 00608 cdb_ModeSense modeSns(devCfg); 00609 00610 m_scsiIO_p->IOCtl(modeSns); 00611 bool ltoWORM(devCfg.IsMediumWORM()); 00612 log_DBG_m(dbg_LOW, "LTO medium type WORM: " << ltoWORM); 00613 SetWORM(ltoWORM); 00614 } 00615 catch (const ivd_Error &ie) { 00616 log_DBG_m(dbg_NORM, "Can't detect LTO WORM: " << ie.GetFriendly()); 00617 } 00618 catch (...) { 00619 log_DBG_m(dbg_NORM, "ERROR: Can't detect LTO WORM."); 00620 } 00621 }


| void bea_TapeMedium::RefreshCompressionState | ( | ) | [private] |
Definition at line 626 of file bea_tapemedium.cpp.
References bea_hsmCompression_c(), cmn_GetEnvVariable(), cmn_StrUpperCase(), dbg_LOW, data_Mode::GetCompressionStatus(), scsi_IO::IOCtl(), log_DBG_m, log_FUNC_m, m_scsiIO_p, data_Mode::pg_COMPRESSION, and data_Mode::SetCompressionStatus().
Referenced by RefreshTapeInfo().
00626 { 00627 log_FUNC_m(RefreshCompressionInfo); 00628 00629 string hsmCompression = cmn_GetEnvVariable(bea_hsmCompression_c); 00630 cmn_StrUpperCase(hsmCompression); 00631 if (hsmCompression != "ON" && hsmCompression != "OFF") { 00632 log_DBG_m(dbg_LOW, "Compression variable not set"); 00633 return; 00634 } 00635 log_DBG_m(dbg_LOW, bea_hsmCompression_c << " = " << hsmCompression << "."); 00636 00637 data_Mode ci(data_Mode::pg_COMPRESSION); 00638 cdb_ModeSense compressInfo(ci); 00639 00640 m_scsiIO_p->IOCtl(compressInfo); 00641 00642 bool compressOldValue = ci.GetCompressionStatus(); 00643 00644 if (hsmCompression.compare("OFF") == 0) { // Turn compression OFF 00645 ci.SetCompressionStatus(false); 00646 } 00647 else { // Turn compression ON 00648 ci.SetCompressionStatus(true); 00649 } 00650 00651 // Set new status only if new value is not equal to old value 00652 if (compressOldValue != ci.GetCompressionStatus()) 00653 { 00654 cdb_ModeSelect compressSel(ci); 00655 m_scsiIO_p->IOCtl(compressSel); 00656 } 00657 }


bea_TapeMedium::log_CLASSID_m [private] |
scsi_IO* const bea_TapeMedium::m_scsiIO_p [private] |
Definition at line 52 of file bea_tapemedium.h.
Referenced by AppendVolume(), ChangeVolume(), DetectAITWORM(), DetectLTOWORM(), Format(), ReadCurrentVolume(), RefreshCompressionState(), and RefreshTapeInfo().
auto_ptr<bea_MediumMemory> bea_TapeMedium::m_mediumMem [private] |
Reimplemented from bea_Medium.
Definition at line 53 of file bea_tapemedium.h.
Referenced by bea_TapeMedium(), Format(), and RefreshMemoryInfo().
1.5.6