예제 #1
0
파일: sq.cpp 프로젝트: 10jul/tnvme
SQ::~SQ()
{
    // Cleanup duties for this Q's buffer
    if (GetIsContig()) {
        // Contiguous memory is alloc'd and owned by the kernel
        KernelAPI::munmap(mContigBuf, GetQSize());
    }
}
예제 #2
0
파일: cq.cpp 프로젝트: Kurusamy/tnvme
CQ::~CQ()
{
    try {
        // Cleanup duties for this Q's buffer
        if (GetIsContig()) {
            // Contiguous memory is alloc'd and owned by the kernel
            KernelAPI::munmap(mContigBuf, GetQSize());
        }
    } catch (...) {
        ;   // Destructors should never throw. If the object is deleted B4
            // it is Init'd() properly, it could throw, so catch and ignore
    }
}
예제 #3
0
파일: sq.cpp 프로젝트: 10jul/tnvme
union SE
SQ::PeekSE(uint16_t indexPtr)
{
    union SE *dataPtr;

    if (GetIsContig())
        dataPtr = (union SE *)mContigBuf;
    else
        dataPtr = (union SE *)mDiscontigBuf->GetBuffer();

    for (uint32_t i = 0; i < GetNumEntries(); i++, dataPtr++) {
        if (i == indexPtr)
            return *dataPtr;
    }

    throw FrmwkEx(HERE, "Unable to locate index within Q");
}
예제 #4
0
파일: cq.cpp 프로젝트: Kurusamy/tnvme
union CE
CQ::PeekCE(uint16_t indexPtr)
{
    union CE *dataPtr;

    if (GetIsContig())
        dataPtr = (union CE *)mContigBuf;
    else
        dataPtr = (union CE *)mDiscontigBuf->GetBuffer();

    for (int i = 0; i < GetNumEntries(); i++, dataPtr++) {
        if (i == indexPtr)
            return *dataPtr;
    }

    LOG_DBG("Unable to locate index within Q");
    throw exception();
}