本文整理汇总了C++中RT_FROM_MEMBER函数的典型用法代码示例。如果您正苦于以下问题:C++ RT_FROM_MEMBER函数的具体用法?C++ RT_FROM_MEMBER怎么用?C++ RT_FROM_MEMBER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RT_FROM_MEMBER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DECLCALLBACK
/**
* @callback_method_impl{FNRTSTRSPACECALLBACK, Finds the first missing.}
*/
static DECLCALLBACK(int) rtManifestEntryFindMissing2(PRTSTRSPACECORE pStr, void *pvUser)
{
PRTMANIFESTEQUALS pEquals = (PRTMANIFESTEQUALS)pvUser;
PRTMANIFESTENTRY pEntry = RT_FROM_MEMBER(pStr, RTMANIFESTENTRY, StrCore);
/*
* Already visited?
*/
if (pEntry->fVisited)
return 0;
/*
* Ignore this entry?
*/
char const * const *ppsz = pEquals->papszIgnoreEntries;
if (ppsz)
{
while (*ppsz)
{
if (!strcmp(*ppsz, pEntry->StrCore.pszString))
return 0;
ppsz++;
}
}
/*
* Gotcha!
*/
RTStrPrintf(pEquals->pszError, pEquals->cbError, "'%s' was not found in the 1st manifest", pEntry->StrCore.pszString);
return VERR_NOT_EQUAL;
}
示例2: VMMR3DECL
/**
* Query an address space by process ID.
*
* @returns Retained address space handle if found, NIL_RTDBGAS if not.
*
* @param pVM Pointer to the VM.
* @param ProcId The process ID.
*/
VMMR3DECL(RTDBGAS) DBGFR3AsQueryByPid(PVM pVM, RTPROCESS ProcId)
{
/*
* Validate the input.
*/
VM_ASSERT_VALID_EXT_RETURN(pVM, NIL_RTDBGAS);
AssertReturn(ProcId != NIL_RTPROCESS, NIL_RTDBGAS);
/*
* Look it up in the PID tree and retain the result.
*/
RTDBGAS hDbgAs = NIL_RTDBGAS;
DBGF_AS_DB_LOCK_READ(pVM);
PAVLU32NODECORE pNode = RTAvlU32Get(&pVM->dbgf.s.AsPidTree, ProcId);
if (pNode)
{
PDBGFASDBNODE pDbNode = RT_FROM_MEMBER(pNode, DBGFASDBNODE, PidCore);
hDbgAs = (RTDBGAS)pDbNode->HandleCore.Key;
uint32_t cRefs = RTDbgAsRetain(hDbgAs);
if (RT_UNLIKELY(cRefs == UINT32_MAX))
hDbgAs = NIL_RTDBGAS;
}
DBGF_AS_DB_UNLOCK_READ(pVM);
return hDbgAs;
}
示例3: DECLHIDDEN
/**
* OS specific free function.
*/
DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
{
pHdr->u32Magic += 1;
if (pHdr->fFlags & RTMEMHDR_FLAG_KMALLOC)
kfree(pHdr);
#ifdef RTMEMALLOC_EXEC_HEAP
else if (pHdr->fFlags & RTMEMHDR_FLAG_EXEC_HEAP)
{
RTSpinlockAcquire(g_HeapExecSpinlock);
RTHeapSimpleFree(g_HeapExec, pHdr);
RTSpinlockRelease(g_HeapExecSpinlock);
}
#endif
#ifdef RTMEMALLOC_EXEC_VM_AREA
else if (pHdr->fFlags & RTMEMHDR_FLAG_EXEC_VM_AREA)
{
PRTMEMLNXHDREX pHdrEx = RT_FROM_MEMBER(pHdr, RTMEMLNXHDREX, Hdr);
size_t iPage = pHdrEx->pVmArea->nr_pages;
struct page **papPages = pHdrEx->pVmArea->pages;
void *pvMapping = pHdrEx->pVmArea->addr;
vunmap(pvMapping);
while (iPage-- > 0)
__free_page(papPages[iPage]);
kfree(papPages);
}
#endif
else
vfree(pHdr);
}
示例4: DECLCALLBACK
/**
* @interface_method_impl(PDMINVRAM,pfnStoreNvramValue)
*/
DECLCALLBACK(int) drvNvram_pfnStoreNvramValue(PPDMINVRAM pInterface,
int idxVariable,
RTUUID *pVendorUuid,
const char *pcszVariableName,
size_t cbVariableName,
uint8_t *pu8Value,
size_t cbValue)
{
int rc = VINF_SUCCESS;
char szExtraDataKey[256];
char szExtraDataValue[1024];
LogFlowFunc(("ENTER: pVendorUuid:%RTuuid, pcszVariableName:%s, cbVariableName:%d, pu8Value:%.*Rhxs, cbValue:%d\n",
pVendorUuid,
pcszVariableName,
cbVariableName,
cbValue,
pu8Value,
cbValue));
PNVRAM pThis = RT_FROM_MEMBER(pInterface, NVRAM, INvram);
if (!pThis->fPermanentSave)
{
LogFlowFuncLeaveRC(rc);
return rc;
}
bool fFlushVariable = (!pu8Value);
RT_ZERO(szExtraDataKey);
RT_ZERO(szExtraDataValue);
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableName", idxVariable);
if (!fFlushVariable)
RTStrPrintf(szExtraDataValue, 1024, "%s", pcszVariableName);
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
RT_ZERO(szExtraDataKey);
RT_ZERO(szExtraDataValue);
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VendorGuid", idxVariable);
if (!fFlushVariable)
RTUuidToStr(pVendorUuid, szExtraDataValue, 1024);
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
RT_ZERO(szExtraDataKey);
RT_ZERO(szExtraDataValue);
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableValueLength", idxVariable);
if (!fFlushVariable)
RTStrPrintf(szExtraDataValue, 1024, "%d", cbValue);
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
RT_ZERO(szExtraDataKey);
RT_ZERO(szExtraDataValue);
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableValue", idxVariable);
size_t cbActualSize;
if (pu8Value)
rc = RTBase64Encode(pu8Value, cbValue, szExtraDataValue, 1024, &cbActualSize);
AssertRCReturn(rc, rc);
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
LogFlowFuncLeaveRC(rc);
return rc;
}
示例5: DECLCALLBACK
/**
* @interface_method_impl{PDMIBASE, pfnQueryInterface}
*/
static DECLCALLBACK(void *) gimdevR3QueryInterface(PPDMIBASE pInterface, const char *pszIID)
{
PGIMDEV pThis = RT_FROM_MEMBER(pInterface, GIMDEV, IDbgBase);
PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->IDbgBase);
PDMIBASE_RETURN_INTERFACE(pszIID, PDMISTREAM, &pThis->IDbgStreamPort);
return NULL;
}
示例6: DECLCALLBACK
/**
* @interface_method_impl{PDMINETWORKDOWN,pfnReceiveGso}
*/
static DECLCALLBACK(int) drvR3NetShaperDown_ReceiveGso(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb, PCPDMNETWORKGSO pGso)
{
PDRVNETSHAPER pThis = RT_FROM_MEMBER(pInterface, DRVNETSHAPER, INetworkDown);
if (pThis->pIAboveNet->pfnReceiveGso)
return pThis->pIAboveNet->pfnReceiveGso(pThis->pIAboveNet, pvBuf, cb, pGso);
return VERR_NOT_SUPPORTED;
}
示例7: PDMBOTHCBDECL
/**
* @interface_method_impl{PDMINETWORKUP,pfnAllocBuf}
*/
PDMBOTHCBDECL(int) drvNetShaperUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin,
PCPDMNETWORKGSO pGso, PPPDMSCATTERGATHER ppSgBuf)
{
PDRVNETSHAPER pThis = RT_FROM_MEMBER(pInterface, DRVNETSHAPER, CTX_SUFF(INetworkUp));
if (RT_UNLIKELY(!pThis->CTX_SUFF(pIBelowNet)))
return VERR_NET_DOWN;
//LogFlow(("drvNetShaperUp_AllocBuf: cb=%d\n", cbMin));
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesRequested, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsRequested);
#ifdef IN_RING3
if (!PDMR3NsAllocateBandwidth(&pThis->Filter, cbMin))
{
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesDenied, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsDenied);
return VERR_TRY_AGAIN;
}
#endif
#ifdef IN_RING0
if (!PDMR0NsAllocateBandwidth(&pThis->Filter, cbMin))
{
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesDenied, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsDenied);
return VERR_TRY_AGAIN;
}
#endif
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesGranted, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsGranted);
//LogFlow(("drvNetShaperUp_AllocBuf: got cb=%d\n", cbMin));
return pThis->CTX_SUFF(pIBelowNet)->pfnAllocBuf(pThis->CTX_SUFF(pIBelowNet), cbMin, pGso, ppSgBuf);
}
示例8: DECLCALLBACK
/**
* @interface_method_impl{PDMIBASE,pfnQueryInterface}
*/
static DECLCALLBACK(void *) ps2mQueryInterface(PPDMIBASE pInterface, const char *pszIID)
{
PPS2M pThis = RT_FROM_MEMBER(pInterface, PS2M, Mouse.IBase);
PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->Mouse.IBase);
PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUSEPORT, &pThis->Mouse.IPort);
return NULL;
}
示例9: PDMBOTHCBDECL
/**
* @interface_method_impl{PDMINETWORKUP,pfnBeginXmit}
*/
PDMBOTHCBDECL(int) drvDedicatedNicUp_BeginXmit(PPDMINETWORKUP pInterface, bool fOnWorkerThread)
{
PDRVDEDICATEDNIC pThis = RT_FROM_MEMBER(pInterface, DRVDEDICATEDNIC, CTX_SUFF(INetworkUp));
int rc = PDMCritSectTryEnter(&pThis->XmitLock);
if (RT_SUCCESS(rc))
ASMAtomicUoWriteBool(&pThis->fXmitOnXmitThread, fOnWorkerThread);
return rc;
}
示例10: DECLCALLBACK
/**
* @interface_method_impl{DBGFINFOHLP,pfnPrintf}
*/
static DECLCALLBACK(void) dbgcHlpGetDbgfOutputHlp_Printf(PCDBGFINFOHLP pHlp, const char *pszFormat, ...)
{
PDBGC pDbgc = RT_FROM_MEMBER(pHlp, DBGC, DbgfOutputHlp);
va_list va;
va_start(va, pszFormat);
pDbgc->CmdHlp.pfnPrintfV(&pDbgc->CmdHlp, NULL, pszFormat, va);
va_end(va);
}
示例11: DECLCALLBACK
/**
* @interface_method_impl{PDMIKEYBOARDCONNECTOR,pfnSetActive}
*/
DECLCALLBACK(void) Keyboard::i_keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive)
{
PDRVMAINKEYBOARD pDrv = RT_FROM_MEMBER(pInterface, DRVMAINKEYBOARD, IConnector);
if (fActive)
pDrv->u32DevCaps |= KEYBOARD_DEVCAP_ENABLED;
else
pDrv->u32DevCaps &= ~KEYBOARD_DEVCAP_ENABLED;
}
示例12: DECLCALLBACK
/**
* @callback_method_impl{FNRTSTRSPACECALLBACK, Prepare equals operation.}
*/
static DECLCALLBACK(int) rtManifestEntryClearVisited(PRTSTRSPACECORE pStr, void *pvUser)
{
PRTMANIFESTENTRY pEntry = RT_FROM_MEMBER(pStr, RTMANIFESTENTRY, StrCore);
RTStrSpaceEnumerate(&pEntry->Attributes, rtManifestAttributeClearVisited, NULL);
pEntry->fVisited = false;
NOREF(pvUser);
return 0;
}
示例13: DECLCALLBACK
DECLCALLBACK(int) vmmdevSetCredentialsJudgementResult(PPDMIVMMDEVCONNECTOR pInterface, uint32_t u32Flags)
{
PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
if (pDrv->pVMMDev)
return pDrv->pVMMDev->SetCredentialsJudgementResult (u32Flags);
return VERR_GENERAL_FAILURE;
}
示例14: DECLCALLBACK
/** Destroy a symbol node. */
static DECLCALLBACK(int) rtDbgModContainer_DestroyTreeNode(PAVLRUINTPTRNODECORE pNode, void *pvUser)
{
PRTDBGMODCTNSYMBOL pSym = RT_FROM_MEMBER(pNode, RTDBGMODCTNSYMBOL, AddrCore);
RTStrCacheRelease(g_hDbgModStrCache, pSym->NameCore.pszString);
pSym->NameCore.pszString = NULL;
RTMemFree(pSym);
NOREF(pvUser);
return 0;
}
示例15: RTDECL
RTDECL(uint32_t) RTCrCertCtxRetain(PCRTCRCERTCTX pCertCtx)
{
AssertPtrReturn(pCertCtx, UINT32_MAX);
PRTCRCERTCTXINT pThis = RT_FROM_MEMBER(pCertCtx, RTCRCERTCTXINT, Public);
AssertReturn(pThis->u32Magic == RTCRCERTCTXINT_MAGIC, UINT32_MAX);
uint32_t cRet = ASMAtomicIncU32(&pThis->cRefs);
Assert(cRet < 64);
return cRet;
}