#include <data.h>


Used with LOG SENSE and LOG SELECT commands.
Definition at line 190 of file data.h.
Public Types | |
| enum | Page_t { pg_PAGES = 0x00, pg_TAPECAP = 0x31, pg_MICFIXED = 0x3D, pg_MICVARIABLE = 0x3E } |
| enum | PageCtrl_t { pc_CURTHRESH = 0, pc_CURCUMUL = 1, pc_DEFTHRESH = 2, pg_DEFCUMUL = 3 } |
Public Member Functions | |
| data_Log (Page_t a_page, UInt16_t a_param=0x00) | |
| virtual | ~data_Log () |
| data_PageSet | GetSupportedPages () const |
| Page_t | GetPage () const |
| UInt32_t | GetParam () const |
| const data_Log_t & | GetLogStruct () const |
| UInt32_t | GetSize () const |
| UInt32_t | GetTotalPartCap (UInt8_t a_partNo) const |
| UInt32_t | GetRemainingPartCap (UInt8_t a_partNo) const |
| string | GetMICSerialNumber () const |
| UInt8_t | GetMICManufacturer () const |
| UInt8_t | GetMICSecondaryID () const |
| UInt8_t | GetMICChecksum () const |
| UInt16_t | GetMICAvailSize () const |
| UInt16_t | GetMICNoteSize () const |
| Returns the size of the user note. | |
| const UInt8_t * | GetMICNoteMap () const |
| Returns the map of user partition notes Only valid if fixed page was requested/set. | |
| UInt16_t | GetMICNoteLength () const |
| Returns the size of the read variable parameter. | |
| void | UpdateMICNoteSize (UInt16_t a_size) |
| const UInt8_t * | GetMICNote () const |
| void | SetMICNote (const char *a_note, UInt16_t a_size) |
Private Attributes | |
| log_CLASSID_m | |
| data_Log_t | m_log |
| enum data_Log::Page_t |
Definition at line 192 of file data.h.
00192 { 00194 pg_PAGES = 0x00, 00196 pg_TAPECAP = 0x31, 00198 pg_MICFIXED = 0x3D, 00200 pg_MICVARIABLE = 0x3E 00201 } Page_t;
| enum data_Log::PageCtrl_t |
| pc_CURTHRESH | Current threshold values (00b). |
| pc_CURCUMUL | Current cumulative values (01b). |
| pc_DEFTHRESH | Default threshold values (10b). |
| pg_DEFCUMUL | Default cumulative values (11b). |
Definition at line 203 of file data.h.
00203 { 00205 pc_CURTHRESH = 0, 00207 pc_CURCUMUL = 1, 00209 pc_DEFTHRESH = 2, 00211 pg_DEFCUMUL = 3 00212 } PageCtrl_t;
Definition at line 35 of file data_log.cpp.
References data_Log_t::hdr, hton(), m_log, data_Log_t::micFixed, data_Log_t::micVar, data_LogHdr_t::page, data_LogMICVar_t::param, data_LogMICFixed_t::param, data_LogMICVarParam_t::paramCode, data_LogMICFixedParam_t::paramCode, pg_MICFIXED, and pg_MICVARIABLE.
00035 { 00036 memset (&m_log, 0, sizeof(m_log)); 00037 00038 m_log.hdr.page = a_page; 00039 00040 switch (a_page) { 00041 case pg_MICFIXED: 00042 { 00043 scsi_Wrapper16 codeW(m_log.micFixed.param.paramCode); 00044 codeW = hton(a_param); 00045 break; 00046 } 00047 case pg_MICVARIABLE: 00048 { 00049 scsi_Wrapper16 codeW(m_log.micVar.param.paramCode); 00050 codeW = hton(a_param); 00051 break; 00052 } 00053 default: 00054 break; 00055 } 00056 00057 }

| data_Log::~data_Log | ( | ) | [virtual] |
| data_PageSet data_Log::GetSupportedPages | ( | ) | const |
Definition at line 168 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, m_log, data_LogHdr_t::page, data_LogHdr_t::pageLen, data_LogPages_t::pages, pg_PAGES, and data_Log_t::suppPages.
00168 { 00169 log_FUNC_m(GetSupportedPages); 00170 00171 data_PageSet pages; 00172 00173 if ((Page_t)m_log.hdr.page != pg_PAGES) { 00174 throw ivd_InternalError( 00175 ie_INVALID_ARG, "pg_PAGES expected"); 00176 } 00177 00178 for (int i = 0; i < m_log.hdr.pageLen; i++) { 00179 pages.insert(m_log.suppPages.pages[i]); 00180 } 00181 return pages; 00182 }
| data_Log::Page_t data_Log::GetPage | ( | ) | const |
Definition at line 63 of file data_log.cpp.
References data_Log_t::hdr, m_log, and data_LogHdr_t::page.
Referenced by cdb_LogSense::cdb_LogSense(), and GetParam().

| UInt32_t data_Log::GetParam | ( | ) | const |
Definition at line 67 of file data_log.cpp.
References GetPage(), hton(), m_log, data_Log_t::micFixed, data_Log_t::micVar, data_LogMICVar_t::param, data_LogMICFixed_t::param, data_LogMICVarParam_t::paramCode, data_LogMICFixedParam_t::paramCode, pg_MICFIXED, and pg_MICVARIABLE.
Referenced by cdb_LogSense::cdb_LogSense().
00067 { 00068 switch (GetPage()) { 00069 case pg_MICFIXED: 00070 { 00071 scsi_Wrapper16 codeW(m_log.micFixed.param.paramCode); 00072 return hton(codeW); 00073 break; 00074 } 00075 case pg_MICVARIABLE: 00076 { 00077 scsi_Wrapper16 codeW(m_log.micVar.param.paramCode); 00078 return hton(codeW); 00079 break; 00080 } 00081 default: 00082 return 0; 00083 break; 00084 } 00085 }


| const data_Log_t & data_Log::GetLogStruct | ( | ) | const |
Definition at line 87 of file data_log.cpp.
References m_log.
Referenced by cdb_LogSense::GetBufferPointer(), and cdb_LogSelect::GetBufferPointer().
00087 { 00088 return m_log; 00089 }

| UInt32_t data_Log::GetSize | ( | ) | const |
Definition at line 91 of file data_log.cpp.
References data_Log_t::hdr, m_log, data_Log_t::micFixed, data_Log_t::micVar, ntoh(), data_LogHdr_t::page, data_LogMICVar_t::param, data_LogMICVarParam_t::paramLen, pg_MICFIXED, pg_MICVARIABLE, pg_PAGES, pg_TAPECAP, data_Log_t::suppPages, and data_Log_t::tapecap.
Referenced by cdb_LogSense::GetBufferSize(), and cdb_LogSelect::GetBufferSize().
00091 { 00092 switch (m_log.hdr.page) { 00093 case pg_PAGES: 00094 return sizeof(m_log.hdr) + sizeof(m_log.suppPages); 00095 break; 00096 case pg_TAPECAP: 00097 return sizeof(m_log.hdr) + sizeof(m_log.tapecap); 00098 break; 00099 case pg_MICFIXED: 00100 return sizeof(m_log.hdr) + sizeof(m_log.micFixed); 00101 break; 00102 case pg_MICVARIABLE: 00103 { 00104 scsi_Wrapper16 lenW(m_log.micVar.param.paramLen); 00105 00106 return ( sizeof(m_log.hdr) + sizeof(m_log.micVar.param) + ntoh(lenW) ); 00107 break; 00108 } 00109 default: 00110 return 0; 00111 break; 00112 } 00113 }


Definition at line 116 of file data_log.cpp.
References data_LogPartCapacity_t::capacity, dbg_NORM, data_Log_t::hdr, ie_INVALID_ARG, log_DBG_m, log_FUNC_m, m_log, ntoh(), data_LogHdr_t::page, data_LogHdr_t::pageLen, data_LogPartCapacity_t::paramCode, data_LogTapeCapacity_t::partcap, pg_TAPECAP, and data_Log_t::tapecap.
Referenced by Ci(), GetCapacityInfo(), and bea_TapeVolume::ReadEstimSizes().
00116 { 00117 00118 log_FUNC_m(GetTotalPartCap); 00119 00120 if ((Page_t)m_log.hdr.page != pg_TAPECAP) { 00121 throw ivd_InternalError( 00122 ie_INVALID_ARG, "pg_TAPECAP expected"); 00123 } 00124 00125 UInt16_t code = (2 * a_partNo) + (1 - (a_partNo % 2)) + 2; 00126 00127 UInt16_t numParam = ntoh(m_log.hdr.pageLen)/sizeof(data_LogPartCapacity_t); 00128 00129 for (UInt16_t i=0; i < numParam; ++i) { 00130 scsi_Wrapper16 codeW(m_log.tapecap.partcap[i].paramCode); 00131 if (ntoh(codeW) == code) { 00132 scsi_Wrapper32 capW(m_log.tapecap.partcap[i].capacity); 00133 return ntoh(capW); 00134 } 00135 } 00136 00137 log_DBG_m(dbg_NORM, "Max partition capacity " << a_partNo << 00138 " not found in Log Sense data"); 00139 return 0; 00140 }


Definition at line 142 of file data_log.cpp.
References data_LogPartCapacity_t::capacity, dbg_NORM, data_Log_t::hdr, ie_INVALID_ARG, log_DBG_m, log_FUNC_m, m_log, ntoh(), data_LogHdr_t::page, data_LogHdr_t::pageLen, data_LogPartCapacity_t::paramCode, data_LogTapeCapacity_t::partcap, pg_TAPECAP, and data_Log_t::tapecap.
Referenced by Ci(), GetCapacityInfo(), and bea_TapeVolume::ReadEstimSizes().
00142 { 00143 00144 log_FUNC_m(GetRemainingPartCap); 00145 00146 if ((Page_t)m_log.hdr.page != pg_TAPECAP) { 00147 throw ivd_InternalError( 00148 ie_INVALID_ARG, "pg_TAPECAP expected"); 00149 } 00150 00151 UInt16_t code = (2 * a_partNo) + (1 - (a_partNo % 2)); 00152 00153 UInt16_t numParam = ntoh(m_log.hdr.pageLen)/sizeof(data_LogPartCapacity_t); 00154 00155 for (UInt16_t i=0; i < numParam; ++i) { 00156 scsi_Wrapper16 codeW(m_log.tapecap.partcap[i].paramCode); 00157 if (ntoh(codeW) == code) { 00158 scsi_Wrapper32 capW(m_log.tapecap.partcap[i].capacity); 00159 return ntoh(capW); 00160 } 00161 } 00162 00163 log_DBG_m(dbg_NORM, "Remaining partition capacity " << a_partNo << 00164 " not found in Log Sense data"); 00165 return 0; 00166 }


| string data_Log::GetMICSerialNumber | ( | ) | const |
Definition at line 228 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, m_log, data_LogMICFixedParam_t::medID, data_Log_t::micFixed, data_LogHdr_t::page, data_LogMICFixed_t::param, pg_MICFIXED, and data_LogMICMedID_t::serialNumber.
Referenced by bea_MicMemory::GetSerialNumber(), and Micserial().
00228 { 00229 if ((Page_t)m_log.hdr.page != pg_MICFIXED) { 00230 log_FUNC_m(GetMICSerialNumber); 00231 throw ivd_InternalError( 00232 ie_INVALID_ARG, "pg_MICFIXED expected"); 00233 } 00234 00235 return string( 00236 reinterpret_cast<const char*>(&(m_log.micFixed.param.medID.serialNumber)), 00237 sizeof(m_log.micFixed.param.medID.serialNumber)); 00238 }

| UInt8_t data_Log::GetMICManufacturer | ( | ) | const |
Definition at line 240 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, m_log, data_LogMICMedID_t::manufacturer, data_LogMICFixedParam_t::medID, data_Log_t::micFixed, data_LogHdr_t::page, data_LogMICFixed_t::param, and pg_MICFIXED.
Referenced by bea_MicMemory::GetManufacturer(), and Micserial().
00240 { 00241 if ((Page_t)m_log.hdr.page != pg_MICFIXED) { 00242 log_FUNC_m(GetMICManufacturer); 00243 throw ivd_InternalError( 00244 ie_INVALID_ARG, "pg_MICFIXED expected"); 00245 } 00246 00247 return m_log.micFixed.param.medID.manufacturer; 00248 }

| UInt8_t data_Log::GetMICSecondaryID | ( | ) | const |
Definition at line 250 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, m_log, data_LogMICFixedParam_t::medID, data_Log_t::micFixed, data_LogHdr_t::page, data_LogMICFixed_t::param, pg_MICFIXED, and data_LogMICMedID_t::secondaryID.
Referenced by bea_MicMemory::GetSecondaryID(), and Micserial().
00250 { 00251 if ((Page_t)m_log.hdr.page != pg_MICFIXED) { 00252 log_FUNC_m(GetMICSecondaryID); 00253 throw ivd_InternalError( 00254 ie_INVALID_ARG, "pg_MICFIXED expected"); 00255 } 00256 00257 return m_log.micFixed.param.medID.secondaryID; 00258 }

| UInt8_t data_Log::GetMICChecksum | ( | ) | const |
Definition at line 260 of file data_log.cpp.
References data_LogMICMedID_t::checksum, data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, m_log, data_LogMICFixedParam_t::medID, data_Log_t::micFixed, data_LogHdr_t::page, data_LogMICFixed_t::param, and pg_MICFIXED.
Referenced by bea_MicMemory::GetChecksum(), and Micserial().
00260 { 00261 if ((Page_t)m_log.hdr.page != pg_MICFIXED) { 00262 log_FUNC_m(GetMICChecksum); 00263 throw ivd_InternalError( 00264 ie_INVALID_ARG, "pg_MICFIXED expected"); 00265 } 00266 00267 return m_log.micFixed.param.medID.checksum; 00268 }

| UInt16_t data_Log::GetMICAvailSize | ( | ) | const |
Definition at line 184 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, log_MARKLINE_m, m_log, data_LogMICFixedParam_t::memAvail, mic_AVAILABLE_d, data_Log_t::micFixed, ntoh(), data_LogHdr_t::page, data_LogMICFixed_t::param, data_LogMICFixedParam_t::paramCode, and pg_MICFIXED.
Referenced by bea_MicMemory::GetAvailable(), and Micfree().
00184 { 00185 log_FUNC_m(GetMICAvailSize); 00186 00187 if ((Page_t)m_log.hdr.page != pg_MICFIXED) { 00188 log_MARKLINE_m; 00189 throw ivd_InternalError( 00190 ie_INVALID_ARG, "pg_MICFIXED expected"); 00191 } 00192 scsi_Wrapper16 paramW(m_log.micFixed.param.paramCode); 00193 if (ntoh(paramW) != mic_AVAILABLE_d) { 00194 log_MARKLINE_m; 00195 throw ivd_InternalError( 00196 ie_INVALID_ARG, "mic_AVAILABLE_d expected"); 00197 } 00198 00199 scsi_Wrapper16 availW(m_log.micFixed.param.memAvail); 00200 return ntoh(availW); 00201 }


| UInt16_t data_Log::GetMICNoteSize | ( | ) | const |
Returns the size of the user note.
Only valid if fixed page was requested/set.
Definition at line 203 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, log_MARKLINE_m, m_log, data_Log_t::micFixed, ntoh(), data_LogHdr_t::page, data_LogMICFixed_t::param, pg_MICFIXED, and data_LogMICFixedParam_t::volNoteSize.
Referenced by bea_MicMemory::GetSize(), and Micnotesize().
00203 { 00204 log_FUNC_m(GetMICNoteSize); 00205 00206 if ((Page_t)m_log.hdr.page != pg_MICFIXED) { 00207 log_MARKLINE_m; 00208 throw ivd_InternalError( 00209 ie_INVALID_ARG, "pg_MICFIXED expected"); 00210 } 00211 00212 scsi_Wrapper16 sizeW(m_log.micFixed.param.volNoteSize); 00213 return ntoh(sizeW); 00214 }


| const UInt8_t * data_Log::GetMICNoteMap | ( | ) | const |
Returns the map of user partition notes Only valid if fixed page was requested/set.
Definition at line 216 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, log_MARKLINE_m, m_log, data_Log_t::micFixed, data_LogMICFixedParam_t::noteMap, data_LogHdr_t::page, data_LogMICFixed_t::param, and pg_MICFIXED.
Referenced by Micnotemap().
00216 { 00217 log_FUNC_m(GetMICNoteMap); 00218 00219 if ((Page_t)m_log.hdr.page != pg_MICFIXED) { 00220 log_MARKLINE_m; 00221 throw ivd_InternalError( 00222 ie_INVALID_ARG, "pg_MICFIXED expected"); 00223 } 00224 00225 return (&(m_log.micFixed.param.noteMap[0])); 00226 }

| UInt16_t data_Log::GetMICNoteLength | ( | ) | const |
Returns the size of the read variable parameter.
Only valid if variable page was requested/set.
Definition at line 272 of file data_log.cpp.
References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, log_MARKLINE_m, m_log, data_Log_t::micVar, ntoh(), data_LogHdr_t::page, data_LogMICVar_t::param, data_LogMICVarParam_t::paramLen, and pg_MICVARIABLE.
Referenced by Micnote(), Micnotelen(), ParseMICMediumNote(), ParseMICVolNote(), and bea_MicMemory::Read().
00272 { 00273 log_FUNC_m(GetMICNoteLength); 00274 00275 if ((Page_t)m_log.hdr.page != pg_MICVARIABLE) { 00276 log_MARKLINE_m; 00277 throw ivd_InternalError( 00278 ie_INVALID_ARG, "pg_MICVARIABLE expected"); 00279 } 00280 00281 scsi_Wrapper16 lenW(m_log.micVar.param.paramLen); 00282 00283 return ntoh(lenW); 00284 }


| void data_Log::UpdateMICNoteSize | ( | UInt16_t | a_size | ) |
Definition at line 339 of file data_log.cpp.
References data_Log_t::hdr, hton(), log_FUNC_A_m, m_log, data_Log_t::micVar, data_LogHdr_t::pageLen, data_LogMICVar_t::param, and data_LogMICVarParam_t::paramLen.
Referenced by Micnote(), ParseMICMediumNote(), ParseMICVolNote(), bea_MicMemory::Read(), and SetMICNote().
00339 { 00340 log_FUNC_A_m(UpdateMICNoteSize, "size: " << a_size); 00341 00342 scsi_Wrapper16 sizeW(m_log.micVar.param.paramLen); 00343 sizeW = hton(a_size); 00344 UInt16_t pageSize = sizeof(m_log.micVar.param) + a_size; 00345 m_log.hdr.pageLen = hton(pageSize); 00346 }


| const UInt8_t * data_Log::GetMICNote | ( | ) | const |
Definition at line 286 of file data_log.cpp.
References data_LogMICVar_t::data, data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, log_MARKLINE_m, m_log, data_Log_t::micVar, data_LogHdr_t::page, and pg_MICVARIABLE.
Referenced by Micnote(), ParseMICMediumNote(), ParseMICVolNote(), and bea_MicMemory::Read().
00286 { 00287 log_FUNC_m(GetMICNote); 00288 00289 if ((Page_t)m_log.hdr.page != pg_MICVARIABLE) { 00290 log_MARKLINE_m; 00291 throw ivd_InternalError( 00292 ie_INVALID_ARG, "pg_MICVARIABLE expected"); 00293 } 00294 00295 return (&(m_log.micVar.data[0])); 00296 }

| void data_Log::SetMICNote | ( | const char * | a_note, | |
| UInt16_t | a_size | |||
| ) |
Definition at line 298 of file data_log.cpp.
References data_LogMICVar_t::data, data_LogMICVarParam_t::ds, data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, log_MARKLINE_m, data_LogMICVarParam_t::lp, m_log, mic_MAXNOTESIZE_d, data_Log_t::micVar, data_LogHdr_t::page, data_LogMICVar_t::param, pg_MICVARIABLE, and UpdateMICNoteSize().
Referenced by main(), Micwritenote(), and bea_MicMemory::Write().
00298 { 00299 log_FUNC_m(SetMICNote); 00300 00301 if ((Page_t)m_log.hdr.page != pg_MICVARIABLE) { 00302 log_MARKLINE_m; 00303 throw ivd_InternalError( 00304 ie_INVALID_ARG, "pg_MICVARIABLE expected"); 00305 } 00306 00307 if (a_size > mic_MAXNOTESIZE_d) { 00308 log_MARKLINE_m; 00309 throw ivd_InternalError( 00310 ie_INVALID_ARG, "a_size > mic_MAXNOTESIZE_d"); 00311 } 00312 00313 // 00314 // The overall data size must be aligned to the integer 00315 // multiple of the Log Page Header size (== 4). 00316 // 00317 /* 00318 const UInt8_t alignTo = 4; 00319 UInt16_t alignment = 00320 alignTo - (sizeof(m_log.hdr) + sizeof(m_log.micVar.param) + a_size)%alignTo; 00321 UInt16_t alignedSize = a_size + alignment; 00322 00323 memcpy(m_log.micVar.data, a_note, a_size); 00324 m_log.micVar.param.lp = 1; 00325 m_log.micVar.param.ds = 1; 00326 m_log.micVar.param.paramLen = hton(alignedSize); 00327 00328 UInt16_t pageSize = sizeof(m_log.micVar.param) + alignedSize; 00329 m_log.hdr.pageLen = hton(pageSize); 00330 */ 00331 00332 memcpy(m_log.micVar.data, a_note, a_size); 00333 m_log.micVar.param.lp = 1; 00334 m_log.micVar.param.ds = 1; 00335 00336 UpdateMICNoteSize(a_size); 00337 }


data_Log::log_CLASSID_m [private] |
data_Log_t data_Log::m_log [private] |
Definition at line 256 of file data.h.
Referenced by data_Log(), GetLogStruct(), GetMICAvailSize(), GetMICChecksum(), GetMICManufacturer(), GetMICNote(), GetMICNoteLength(), GetMICNoteMap(), GetMICNoteSize(), GetMICSecondaryID(), GetMICSerialNumber(), GetPage(), GetParam(), GetRemainingPartCap(), GetSize(), GetSupportedPages(), GetTotalPartCap(), SetMICNote(), and UpdateMICNoteSize().
1.5.6