Public Types | Public Member Functions | Private Attributes

data_Log Class Reference
[SCSI Library]

Log data class. More...

#include <data.h>

Inheritance diagram for data_Log:
Inheritance graph
[legend]
Collaboration diagram for data_Log:
Collaboration graph
[legend]

List of all members.

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_tGetLogStruct () 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_tGetMICNoteMap () 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_tGetMICNote () const
void SetMICNote (const char *a_note, UInt16_t a_size)

Private Attributes

 log_CLASSID_m
data_Log_t m_log

Detailed Description

Log data class.

Used with LOG SENSE and LOG SELECT commands.

Author:
Luka Renko

Definition at line 204 of file data.h.


Member Enumeration Documentation

Enumerator:
pg_PAGES 

All supported pages.

pg_TAPECAP 

For tape drive (remaining tape capacity).

pg_MICFIXED 

For tape drive (Sony MIC fixed length data).

pg_MICVARIABLE 

For tape drive (Sony MIC variable length data).

Definition at line 206 of file data.h.

                 {
        pg_PAGES        = 0x00,
        pg_TAPECAP      = 0x31,
        pg_MICFIXED     = 0x3D,
        pg_MICVARIABLE  = 0x3E
    } Page_t;

Enumerator:
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 217 of file data.h.

                 {
        pc_CURTHRESH    = 0,
        pc_CURCUMUL     = 1,
        pc_DEFTHRESH    = 2,
        pg_DEFCUMUL     = 3
    } PageCtrl_t;


Constructor & Destructor Documentation

data_Log::data_Log ( Page_t  a_page,
UInt16_t  a_param = 0x00 
)

Definition at line 49 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.

                                                  {
    memset (&m_log, 0, sizeof(m_log));

    m_log.hdr.page = a_page;
    
    switch (a_page) {
        case pg_MICFIXED:
        {
            scsi_Wrapper16 codeW(m_log.micFixed.param.paramCode);
            codeW = hton(a_param);
            break;
        }
        case pg_MICVARIABLE:
        {
            scsi_Wrapper16 codeW(m_log.micVar.param.paramCode);
            codeW = hton(a_param);
            break;
        }
        default:
            break;
    }
    
}

Here is the call graph for this function:

data_Log::~data_Log (  )  [virtual]

Definition at line 73 of file data_log.cpp.

                    {
    // Empty
}


Member Function Documentation

const data_Log_t & data_Log::GetLogStruct (  )  const

Definition at line 101 of file data_log.cpp.

References m_log.

Referenced by cdb_LogSense::GetBufferPointer(), and cdb_LogSelect::GetBufferPointer().

                                               {
    return m_log;
}

Here is the caller graph for this function:

UInt16_t data_Log::GetMICAvailSize (  )  const

Definition at line 198 of file data_log.cpp.

References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_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().

                                         {
    log_FUNC_m(GetMICAvailSize);
    
    if ((Page_t)m_log.hdr.page != pg_MICFIXED) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_MICFIXED expected");
    }
    scsi_Wrapper16 paramW(m_log.micFixed.param.paramCode);
    if (ntoh(paramW) != mic_AVAILABLE_d) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "mic_AVAILABLE_d expected");
    }
    
    scsi_Wrapper16 availW(m_log.micFixed.param.memAvail);
    return ntoh(availW);
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt8_t data_Log::GetMICChecksum (  )  const
UInt8_t data_Log::GetMICManufacturer (  )  const
const UInt8_t * data_Log::GetMICNote (  )  const

Definition at line 300 of file data_log.cpp.

References data_LogMICVar_t::data, data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_m, m_log, data_Log_t::micVar, data_LogHdr_t::page, and pg_MICVARIABLE.

Referenced by Micnote(), ParseMICMediumNote(), ParseMICVolNote(), and bea_MicMemory::Read().

                                          {
    log_FUNC_m(GetMICNote);

    if ((Page_t)m_log.hdr.page != pg_MICVARIABLE) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_MICVARIABLE expected");
    }

    return (&(m_log.micVar.data[0]));
}

Here is the caller graph for this function:

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 286 of file data_log.cpp.

References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_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().

                                          {
    log_FUNC_m(GetMICNoteLength);

    if ((Page_t)m_log.hdr.page != pg_MICVARIABLE) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_MICVARIABLE expected");
    }

    scsi_Wrapper16 lenW(m_log.micVar.param.paramLen);
    
    return ntoh(lenW);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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 230 of file data_log.cpp.

References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_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().

                                             {
    log_FUNC_m(GetMICNoteMap);

    if ((Page_t)m_log.hdr.page != pg_MICFIXED) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_MICFIXED expected");
    }

    return (&(m_log.micFixed.param.noteMap[0]));
}

Here is the caller graph for this function:

UInt16_t data_Log::GetMICNoteSize (  )  const

Returns the size of the user note.

Only valid if fixed page was requested/set.

Definition at line 217 of file data_log.cpp.

References data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_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().

                                        {
    log_FUNC_m(GetMICNoteSize);
    
    if ((Page_t)m_log.hdr.page != pg_MICFIXED) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_MICFIXED expected");
    }

    scsi_Wrapper16 sizeW(m_log.micFixed.param.volNoteSize);
    return ntoh(sizeW);
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt8_t data_Log::GetMICSecondaryID (  )  const
string data_Log::GetMICSerialNumber (  )  const
data_Log::Page_t data_Log::GetPage (  )  const

Definition at line 77 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().

                                       {
    return (Page_t)(m_log.hdr.page);
}

Here is the caller graph for this function:

UInt32_t data_Log::GetParam (  )  const

Definition at line 81 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().

                                  {
    switch (GetPage()) {
        case pg_MICFIXED:
        {
            scsi_Wrapper16 codeW(m_log.micFixed.param.paramCode);
            return hton(codeW);
            break;
        }
        case pg_MICVARIABLE:
        {
            scsi_Wrapper16 codeW(m_log.micVar.param.paramCode);
            return hton(codeW);
            break;
        }
        default:
            return 0;
            break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt32_t data_Log::GetRemainingPartCap ( UInt8_t  a_partNo  )  const

Definition at line 156 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().

                                                             {

    log_FUNC_m(GetRemainingPartCap);

    if ((Page_t)m_log.hdr.page != pg_TAPECAP) {
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_TAPECAP expected");
    }

    UInt16_t code = (2 * a_partNo) + (1 - (a_partNo % 2));

    UInt16_t numParam = ntoh(m_log.hdr.pageLen)/sizeof(data_LogPartCapacity_t);

    for (UInt16_t i=0; i < numParam; ++i) {
        scsi_Wrapper16 codeW(m_log.tapecap.partcap[i].paramCode);
        if (ntoh(codeW) == code) {
            scsi_Wrapper32 capW(m_log.tapecap.partcap[i].capacity);
            return ntoh(capW);
        }
    }

    log_DBG_m(dbg_NORM, "Remaining partition capacity " << a_partNo << 
                        " not found in Log Sense data");
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt32_t data_Log::GetSize (  )  const

Definition at line 105 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().

                                 {
    switch (m_log.hdr.page) {
        case pg_PAGES:
            return sizeof(m_log.hdr) + sizeof(m_log.suppPages);
            break;
        case pg_TAPECAP:
            return sizeof(m_log.hdr) + sizeof(m_log.tapecap);
            break;
        case pg_MICFIXED:
            return sizeof(m_log.hdr) + sizeof(m_log.micFixed);
            break;
        case pg_MICVARIABLE:
        {
            scsi_Wrapper16 lenW(m_log.micVar.param.paramLen);
            
            return ( sizeof(m_log.hdr) + sizeof(m_log.micVar.param) + ntoh(lenW) );
            break;
        }
        default:
            return 0;
            break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

data_PageSet data_Log::GetSupportedPages (  )  const

Definition at line 182 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.

                                               {
    log_FUNC_m(GetSupportedPages);
    
    data_PageSet pages;
    
    if ((Page_t)m_log.hdr.page != pg_PAGES) {
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_PAGES expected");
    }

    for (int i = 0; i < m_log.hdr.pageLen; i++) {
        pages.insert(m_log.suppPages.pages[i]);
    }
    return pages;
}

UInt32_t data_Log::GetTotalPartCap ( UInt8_t  a_partNo  )  const

Definition at line 130 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().

                                                         {

    log_FUNC_m(GetTotalPartCap);

    if ((Page_t)m_log.hdr.page != pg_TAPECAP) {
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_TAPECAP expected");
    }

    UInt16_t code = (2 * a_partNo) + (1 - (a_partNo % 2)) + 2;

    UInt16_t numParam = ntoh(m_log.hdr.pageLen)/sizeof(data_LogPartCapacity_t);

    for (UInt16_t i=0; i < numParam; ++i) {
        scsi_Wrapper16 codeW(m_log.tapecap.partcap[i].paramCode);
        if (ntoh(codeW) == code) {
            scsi_Wrapper32 capW(m_log.tapecap.partcap[i].capacity);
            return ntoh(capW);
        }
    }

    log_DBG_m(dbg_NORM, "Max partition capacity " << a_partNo <<
                        " not found in Log Sense data");
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void data_Log::SetMICNote ( const char *  a_note,
UInt16_t  a_size 
)

Definition at line 312 of file data_log.cpp.

References data_LogMICVar_t::data, data_LogMICVarParam_t::ds, data_Log_t::hdr, ie_INVALID_ARG, log_FUNC_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().

                                                             {
    log_FUNC_m(SetMICNote);

    if ((Page_t)m_log.hdr.page != pg_MICVARIABLE) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "pg_MICVARIABLE expected");
    }

    if (a_size > mic_MAXNOTESIZE_d) {
        log_MARKLINE_m;
        throw ivd_InternalError(
            ie_INVALID_ARG, "a_size > mic_MAXNOTESIZE_d");
    }

    //
    // The overall data size must be aligned to the integer
    // multiple of the Log Page Header size (== 4).
    //
    /*
    const UInt8_t   alignTo = 4;
    UInt16_t alignment =
        alignTo - (sizeof(m_log.hdr) + sizeof(m_log.micVar.param) + a_size)%alignTo;
    UInt16_t alignedSize = a_size + alignment;

    memcpy(m_log.micVar.data, a_note, a_size);
    m_log.micVar.param.lp = 1;
    m_log.micVar.param.ds = 1;
    m_log.micVar.param.paramLen = hton(alignedSize);

    UInt16_t pageSize = sizeof(m_log.micVar.param) + alignedSize;
    m_log.hdr.pageLen = hton(pageSize);
    */

    memcpy(m_log.micVar.data, a_note, a_size);
    m_log.micVar.param.lp = 1;
    m_log.micVar.param.ds = 1;

    UpdateMICNoteSize(a_size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void data_Log::UpdateMICNoteSize ( UInt16_t  a_size  ) 

Definition at line 353 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().

                                                {
    log_FUNC_A_m(UpdateMICNoteSize, "size: " << a_size);

    scsi_Wrapper16 sizeW(m_log.micVar.param.paramLen);
    sizeW = hton(a_size);
    UInt16_t pageSize = sizeof(m_log.micVar.param) + a_size;
    m_log.hdr.pageLen = hton(pageSize);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from scsi_Data.

Definition at line 268 of file data.h.


The documentation for this class was generated from the following files: