本文整理汇总了C++中os_free_mem函数的典型用法代码示例。如果您正苦于以下问题:C++ os_free_mem函数的具体用法?C++ os_free_mem怎么用?C++ os_free_mem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了os_free_mem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: APPeerDlsTearDownAction
/*
========================================================================
Routine Description:
Handle peer DLS Tear down action frame.
Arguments:
pAd points to our adapter
*pElem action frame
Return Value:
None
Note:
========================================================================
*/
VOID APPeerDlsTearDownAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *pElem)
{
PMAC_TABLE_ENTRY pDAEntry, pSAEntry;
UCHAR DA[MAC_ADDR_LEN], SA[MAC_ADDR_LEN];
UINT16 ReasonCode;
PUCHAR pOutBuffer = NULL;
PFRAME_802_11 Fr;
UINT32 FrameLen = 0;
/* frame sanity check */
if (! PeerDlsTearDownSanity(pAd, pElem->Msg, pElem->MsgLen,
DA, SA, &ReasonCode))
{
return;
}
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE,
("DLS - PeerDlsTearDownAction() from %02x:%02x:%02x:%02x:%02x:%02x\n",
SA[0], SA[1], SA[2], SA[3], SA[4], SA[5]));
pSAEntry = MacTableLookup(pAd, SA);
if (!pSAEntry)
return;
pDAEntry = MacTableLookup(pAd, DA);
if (!pDAEntry)
{
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("Destination station does not exist!\n"));
return;
}
pSAEntry->bDlsInit = FALSE;
/* forward Tear-down to real destination */
Fr = (PFRAME_802_11)pElem->Msg;
os_alloc_mem(pAd, (UCHAR **)&pOutBuffer, MAX_LEN_OF_MLME_BUFFER);
if (pOutBuffer == NULL)
return; /* fatal error, no available memory */
NdisMoveMemory(Fr->Hdr.Addr1, DA, MAC_ADDR_LEN);
NdisMoveMemory(Fr->Hdr.Addr2, pAd->ApCfg.MBSSID[pSAEntry->apidx].wdev.bssid, MAC_ADDR_LEN);
NdisMoveMemory(Fr->Hdr.Addr3, SA, MAC_ADDR_LEN);
NdisMoveMemory(pOutBuffer, pElem->Msg, pElem->MsgLen);
FrameLen = pElem->MsgLen;
/* transmit the tear down frame */
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
os_free_mem(NULL, pOutBuffer);
}
示例2: ChannelInfoDestroy
void ChannelInfoDestroy(
IN PRTMP_ADAPTER pAd)
{
if (pAd->pChannelInfo)
{
os_free_mem(NULL, pAd->pChannelInfo);
pAd->pChannelInfo = NULL;
}
return;
}
示例3: AutoChBssTableDestroy
void AutoChBssTableDestroy(
IN PRTMP_ADAPTER pAd)
{
if (pAd->pBssInfoTab)
{
os_free_mem(NULL, pAd->pBssInfoTab);
pAd->pBssInfoTab = NULL;
}
return;
}
示例4: MultipathPoolExit
VOID MultipathPoolExit(
IN PRTMP_ADAPTER pAd)
{
NdisFreeSpinLock(&pAd->MeshTab.MultipathTabLock);
if (pAd->MeshTab.pMultipathEntryPool)
/* kfree(pAd->MeshTab.pMultipathEntryPool); */
os_free_mem(NULL, pAd->MeshTab.pMultipathEntryPool);
pAd->MeshTab.pMultipathEntryPool = NULL;
return;
}
示例5: BMPktSigTabExit
VOID BMPktSigTabExit(
IN PRTMP_ADAPTER pAd)
{
NdisFreeSpinLock(&pAd->MeshTab.MeshBMPktTabLock);
if (pAd->MeshTab.pBMPktSigTab)
/* kfree(pAd->MeshTab.pBMPktSigTab); */
os_free_mem(NULL, pAd->MeshTab.pBMPktSigTab);
pAd->MeshTab.pBMPktSigTab = NULL;
return;
}
示例6: Set_NfcPasswdToken_Proc
INT Set_NfcPasswdToken_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg)
{
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
PWSC_CTRL pWscCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].WscControl;
PUCHAR pBuf = NULL;
USHORT BufLen = 0;
UCHAR action = 1, type = TYPE_PASSWORD;
UCHAR val=0;
BOOLEAN bHandover=FALSE;
/*
Action: b¡¦<7:6>: 0x00 ¡V Request, 0x01 ¡V Notify
b¡¦<5:0>: 0x00 ¡V Get, 0x01 - Set
*/
val = (UCHAR)simple_strtol(arg, 0, 10);
if (val == 1) /* Password Token */
{
bHandover = FALSE;
type = TYPE_PASSWORD;
}
else if (val == 2) /* Handover Select */
{
bHandover = TRUE;
type = TYPE_PASSWDHO_S;
}
else if (val == 3) /* Handover Request */
{
bHandover = TRUE;
type = TYPE_PASSWDHO_R;
}
os_alloc_mem(pAd, (UCHAR **)&pBuf, (NFC_WSC_TLV_SIZE*sizeof(UCHAR)));
if (pBuf == NULL)
{
return FALSE;
}
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: NfcBuildOOBDevPasswdTLV value(=%d) type(=%d)\n", __FUNCTION__,val, type));
NfcBuildOOBDevPasswdTLV(pAd, pWscCtrl, type, pBuf, &BufLen);
if (pBuf && (BufLen != 0))
{
pWscCtrl->bTriggerByNFC = TRUE;
if (type ==TYPE_PASSWORD)
pWscCtrl->NfcModel = MODEL_PASSWORD_TOKEN;
else
pWscCtrl->NfcModel = MODEL_HANDOVER;
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s: NfcBuildOOBDevPasswdTLV NfcModel(=%d)\n", __FUNCTION__,pWscCtrl->NfcModel));
NfcCommand(pAd, action, type, BufLen, pBuf);
os_free_mem(NULL, pBuf);
}
return TRUE;
}
示例7: parse_option_string
static void parse_option_string(nv_stack_t *sp)
{
unsigned int i;
nv_parm_t *entry;
char *option_string = NULL;
char *ptr, *token;
char *name, *value;
NvU32 data;
if (NVreg_RegistryDwords != NULL)
{
if ((option_string = remove_spaces(NVreg_RegistryDwords)) == NULL)
{
return;
}
ptr = option_string;
while ((token = strsep(&ptr, ";")) != NULL)
{
if (!(name = strsep(&token, "=")) || !strlen(name))
{
continue;
}
if (!(value = strsep(&token, "=")) || !strlen(value))
{
continue;
}
if (strsep(&token, "=") != NULL)
{
continue;
}
data = (NvU32)simple_strtoul(value, NULL, 0);
for (i = 0; (entry = &nv_parms[i])->name != NULL; i++)
{
if (strcmp(entry->name, name) == 0)
break;
}
if (!entry->name)
rm_write_registry_dword(sp, NULL, "NVreg", name, data);
else
*entry->data = data;
}
os_free_mem(option_string);
}
}
示例8: RTMP_CFG80211_RemoveVifEntry
void RTMP_CFG80211_RemoveVifEntry(void *pAdSrc, PNET_DEV pNewNetDev)
{
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdSrc;
PLIST_ENTRY pListEntry = NULL;
pListEntry = (PLIST_ENTRY)RTMP_CFG80211_FindVifEntry_ByMac(pAd, pNewNetDev);
if (pListEntry) {
delEntryList(&pAd->cfg80211_ctrl.Cfg80211VifDevSet.vifDevList, pListEntry);
os_free_mem(pListEntry);
} else {
DBGPRINT(RT_DEBUG_ERROR, ("Error in RTMP_CFG80211_RemoveVifEntry.\n"));
}
}
示例9: function
/*
========================================================================
Routine Description:
The pseudo-random function(PRF) that hashes various inputs to
derive a pseudo-random value. To add liveness to the pseudo-random
value, a nonce should be one of the inputs.
It is used to generate PTK, GTK or some specific random value.
Arguments:
UCHAR *key, - the key material for HMAC_SHA1 use
INT key_len - the length of key
UCHAR *prefix - a prefix label
INT prefix_len - the length of the label
UCHAR *data - a specific data with variable length
INT data_len - the length of a specific data
INT len - the output lenght
Return Value:
UCHAR *output - the calculated result
Note:
802.11i-2004 Annex H.3
========================================================================
*/
VOID PRF(
IN UCHAR *key,
IN INT key_len,
IN UCHAR *prefix,
IN INT prefix_len,
IN UCHAR *data,
IN INT data_len,
OUT UCHAR *output,
IN INT len)
{
INT i;
UCHAR *input;
INT currentindex = 0;
INT total_len;
// Allocate memory for input
os_alloc_mem(NULL, (PUCHAR *)&input, 1024);
if (input == NULL)
{
DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n"));
return;
}
// Generate concatenation input
NdisMoveMemory(input, prefix, prefix_len);
// Concatenate a single octet containing 0
input[prefix_len] = 0;
// Concatenate specific data
NdisMoveMemory(&input[prefix_len + 1], data, data_len);
total_len = prefix_len + 1 + data_len;
// Concatenate a single octet containing 0
// This octet shall be update later
input[total_len] = 0;
total_len++;
// Iterate to calculate the result by hmac-sha-1
// Then concatenate to last result
for (i = 0; i < (len + 19) / 20; i++)
{
HMAC_SHA1(input, total_len, key, key_len, &output[currentindex]);
currentindex += 20;
// update the last octet
input[total_len - 1]++;
}
os_free_mem(NULL, input);
}
示例10: testmod_init
static int testmod_init(void)
{
PSTRING src = NULL;
RTMP_OS_FD srcf;
RTMP_OS_FS_INFO osFSInfo;
INT retval = NDIS_STATUS_FAILURE;
PSTRING buffer;
os_alloc_mem(NULL, (UCHAR **)&buffer, MAX_INI_BUFFER_SIZE);
if(buffer == NULL)
return NDIS_STATUS_FAILURE;
memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
src = STA_PROFILE_PATH;
if (src && *src)
{
// it must call set_fs() before read, otherwise it get errCode=-14( address error)
RtmpOSFSInfoChange(&osFSInfo, TRUE);
srcf = RtmpOSFileOpen(src, O_RDONLY, 0);
if (IS_FILE_OPEN_ERR(srcf))
{
DBGPRINT(RT_DEBUG_ERROR, ("Open file \"%s\" failed!\n", src));
}
else
{
retval =RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE);
if (retval > 0)
{
// RTMPSetProfileParameters(pAd, buffer);
DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\": buffer = %s !\n", src, buffer));
retval = NDIS_STATUS_SUCCESS;
}
else
DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval));
retval = RtmpOSFileClose(srcf);
if ( retval != 0)
{
retval = NDIS_STATUS_FAILURE;
DBGPRINT(RT_DEBUG_ERROR, ("Close file \"%s\" failed(errCode=%d)!\n", src, retval));
}
}
RtmpOSFSInfoChange(&osFSInfo, FALSE);
}
os_free_mem(NULL, buffer);
return (retval);
}
示例11: MultiCastFilterTableReset
/*
==========================================================================
Description:
This routine reset the entire IGMP table.
==========================================================================
*/
VOID MultiCastFilterTableReset(
IN PMULTICAST_FILTER_TABLE *ppMulticastFilterTable)
{
if(*ppMulticastFilterTable == NULL)
{
DBGPRINT(RT_DEBUG_ERROR, ("%s Multicase filter table is not ready.\n", __FUNCTION__));
return;
}
NdisFreeSpinLock(&((*ppMulticastFilterTable)->FreeMemberPoolTabLock));
NdisFreeSpinLock(&((*ppMulticastFilterTable)->MulticastFilterTabLock));
os_free_mem(NULL, *ppMulticastFilterTable);
*ppMulticastFilterTable = NULL;
}
示例12: SET_NETDEV_DEV
/*
========================================================================
Routine Description:
Register MAC80211 Module.
Arguments:
pAdCB - WLAN control block pointer
pDev - Generic device interface
pNetDev - Network device
Return Value:
NONE
Note:
pDev != pNetDev
#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
Can not use pNetDev to replace pDev; Or kernel panic.
========================================================================
*/
BOOLEAN CFG80211_Register(
IN VOID *pAd,
IN struct device *pDev,
IN struct net_device *pNetDev)
{
CFG80211_CB *pCfg80211_CB = NULL;
CFG80211_BAND BandInfo;
/* allocate MAC80211 structure */
os_alloc_mem(NULL, (UCHAR **)&pCfg80211_CB, sizeof(CFG80211_CB));
if (pCfg80211_CB == NULL)
{
DBGPRINT(RT_DEBUG_ERROR, ("80211> Allocate MAC80211 CB fail!\n"));
return FALSE;
} /* End of if */
/* allocate wireless device */
RTMP_DRIVER_80211_BANDINFO_GET(pAd, &BandInfo);
pCfg80211_CB->pCfg80211_Wdev = \
CFG80211_WdevAlloc(pCfg80211_CB, &BandInfo, pAd, pDev);
if (pCfg80211_CB->pCfg80211_Wdev == NULL)
{
DBGPRINT(RT_DEBUG_ERROR, ("80211> Allocate Wdev fail!\n"));
os_free_mem(NULL, pCfg80211_CB);
return FALSE;
} /* End of if */
/* bind wireless device with net device */
#ifdef CONFIG_STA_SUPPORT
/* default we are station mode */
pCfg80211_CB->pCfg80211_Wdev->iftype = NL80211_IFTYPE_STATION;
#endif /* CONFIG_STA_SUPPORT */
pNetDev->ieee80211_ptr = pCfg80211_CB->pCfg80211_Wdev;
SET_NETDEV_DEV(pNetDev, wiphy_dev(pCfg80211_CB->pCfg80211_Wdev->wiphy));
pCfg80211_CB->pCfg80211_Wdev->netdev = pNetDev;
#ifdef RFKILL_HW_SUPPORT
wiphy_rfkill_start_polling(pCfg80211_CB->pCfg80211_Wdev->wiphy);
#endif /* RFKILL_HW_SUPPORT */
RTMP_DRIVER_80211_CB_SET(pAd, pCfg80211_CB);
CFG80211DBG(RT_DEBUG_ERROR, ("80211> CFG80211_Register\n"));
return TRUE;
} /* End of CFG80211_Register */
示例13: RTMP_AllocateFragPacketBuffer
struct cmd_msg *AndesAllocCmdMsg(RTMP_ADAPTER *ad, unsigned int length)
{
struct cmd_msg *msg = NULL;
RTMP_CHIP_CAP *cap = &ad->chipCap;
struct MCU_CTRL *ctl = &ad->MCUCtrl;
PNDIS_PACKET net_pkt = NULL;
INT32 AllocateSize = cap->cmd_header_len + length + cap->cmd_padding_len;
#ifdef RTMP_SDIO_SUPPORT
if (AllocateSize >= ad->BlockSize)
AllocateSize = (AllocateSize + ((-AllocateSize) & (ad->BlockSize - 1)));
#endif
net_pkt = RTMP_AllocateFragPacketBuffer(ad, AllocateSize);
if (!net_pkt) {
DBGPRINT(RT_DEBUG_ERROR, ("can not allocate net_pkt\n"));
goto error0;
}
if ((ctl->Stage == FW_NO_INIT) || (ctl->Stage == FW_DOWNLOAD) || (ctl->Stage == ROM_PATCH_DOWNLOAD))
OS_PKT_RESERVE(net_pkt, cap->cmd_header_len);
else if (ctl->Stage == FW_RUN_TIME)
OS_PKT_RESERVE(net_pkt, sizeof(FW_TXD *));
os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(*msg));
if (!msg) {
DBGPRINT(RT_DEBUG_ERROR, ("can not allocate cmd msg\n"));
goto error1;
}
CMD_MSG_CB(net_pkt)->msg = msg;
memset(msg, 0x00, sizeof(*msg));
msg->priv = (void *)ad;
msg->net_pkt = net_pkt;
ctl->alloc_cmd_msg++;
return msg;
os_free_mem(NULL, msg);
error1:
RTMPFreeNdisPacket(ad, net_pkt);
error0:
return NULL;
}
示例14: CFG80211_SendMgmtFrame
INT CFG80211_SendMgmtFrame(RTMP_ADAPTER *pAd, VOID *pData, ULONG Data)
{
if (pData != NULL)
{
#ifdef CONFIG_AP_SUPPORT
struct ieee80211_mgmt *mgmt;
#endif /* CONFIG_AP_SUPPORT */
{
PCFG80211_CTRL pCfg80211_ctrl = &pAd->cfg80211_ctrl;
pCfg80211_ctrl->TxStatusInUsed = TRUE;
pCfg80211_ctrl->TxStatusSeq = pAd->Sequence;
if (pCfg80211_ctrl->pTxStatusBuf != NULL)
{
os_free_mem(NULL, pCfg80211_ctrl->pTxStatusBuf);
pCfg80211_ctrl->pTxStatusBuf = NULL;
}
os_alloc_mem(NULL, (UCHAR **)&pCfg80211_ctrl->pTxStatusBuf, Data);
if (pCfg80211_ctrl->pTxStatusBuf != NULL)
{
NdisCopyMemory(pCfg80211_ctrl->pTxStatusBuf, pData, Data);
pCfg80211_ctrl->TxStatusBufLen = Data;
}
else
{
pCfg80211_ctrl->TxStatusBufLen = 0;
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("CFG_TX_STATUS: MEM ALLOC ERROR\n"));
return NDIS_STATUS_FAILURE;
}
CFG80211_CheckActionFrameType(pAd, "TX", pData, Data);
#ifdef CONFIG_AP_SUPPORT
mgmt = (struct ieee80211_mgmt *)pData;
if (ieee80211_is_probe_resp(mgmt->frame_control))
{
INT offset = sizeof(HEADER_802_11) + 12;
CFG80211_SyncPacketWmmIe(pAd, pData + offset , Data - offset);
}
#endif /* CONFIG_AP_SUPPORT */
MiniportMMRequest(pAd, 0, pData, Data);
}
}
return 0;
}
示例15: PeerAuthRspAtSeq4Action
/*
==========================================================================
Description:
IRQL = DISPATCH_LEVEL
==========================================================================
*/
VOID PeerAuthRspAtSeq4Action(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem)
{
UCHAR Addr2[MAC_ADDR_LEN];
USHORT Alg, Seq, Status;
/* CHAR ChlgText[CIPHER_TEXT_LEN]; */
CHAR *ChlgText = NULL;
BOOLEAN TimerCancelled;
/* allocate memory */
os_alloc_mem(NULL, (UCHAR **) & ChlgText, CIPHER_TEXT_LEN);
if (ChlgText == NULL) {
DBGPRINT(RT_DEBUG_ERROR,
("%s: ChlgText Allocate memory fail!!!\n",
__FUNCTION__));
return;
}
if (PeerAuthSanity
(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status,
ChlgText)) {
if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 4) {
DBGPRINT(RT_DEBUG_TRACE,
("AUTH - Receive AUTH_RSP seq#4 to me\n"));
RTMPCancelTimer(&pAd->MlmeAux.AuthTimer,
&TimerCancelled);
if (Status != MLME_SUCCESS) {
pAd->StaCfg.AuthFailReason = Status;
COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2);
RTMPSendWirelessEvent(pAd, IW_SHARED_WEP_FAIL,
NULL, BSS0, 0);
}
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF,
2, &Status, 0);
}
} else {
DBGPRINT(RT_DEBUG_TRACE,
("AUTH - PeerAuthRspAtSeq4Action() sanity check fail\n"));
}
if (ChlgText != NULL)
os_free_mem(NULL, ChlgText);
}