亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? endnetbuflib.c

?? INTEL IXP425的VXWORKS BSP
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* endNetBufLib.c - network buffer library *//* Copyright 1984 - 2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01b,27mar03,rcs  removed sizeof(long) from endMemPoolInit() for cluster pool.                 SPR# 8734301a,23jan03,rcs  written.*//*DESCRIPTIONThis library contains routines that you can use to organize and maintaina memory pool that consists of pools of `mBlk' structures, pools of `clBlk'structures, and pools of clusters.  The `mBlk' and `clBlk' structuresare used to manage the clusters.  The clusters are containers for the datadescribed by the `mBlk' and `clBlk' structures.These structures and the various routines of this library constitute abuffering API that has been designed to meet the needs both of network protocols and network device drivers. The `mBlk' structure is the primary vehicle for passing data betweena network driver and a protocol.  However, the `mBlk' structure mustfirst be properly joined with a `clBlk' structure that was previouslyjoined with a cluster.  Thus, the actual vehicle for passing data isnot merely an `mBlk' structure but an `mBlk'-`clBlk'-clusterconstruct. To use this feature, include the following component:INCLUDE_NETWRS_NETBUFLIBINCLUDE FILES: netBufLib.h*//* includes */#include "vxWorks.h"#include "stdlib.h"#include "intLib.h"#include "string.h"#include "semaphore.h"#include "memLib.h"#include "errnoLib.h"#include "netBufLib.h"#include "private/semLibP.h"#include "netinet/if_ether.h"#include "memPartLib.h"#include "endLib.h"/* Virtual Stack Support */#ifdef VIRTUAL_STACK#include "netinet/vsLib.h"#endif/* defines */#define NETBUF_DEBUG#ifdef NETBUF_DEBUG#include "logLib.h"#endif /* NETBUF_DEBUG */#define FROM_KHEAP      1   /* let _poolInit() use KHEAP_ALLOC */#define FROM_HOMEPDHEAP 0   /* let _poolInit() use calloc() */ #define END_CLUSTER_SIZE 1536#define END_CLUSTER_LOG (ffsMsb((END_CLUSTER_SIZE)) - 1)#define END_CLUSTER_MASK (1 << (END_CLUSTER_LOG))typedef struct end_cl_pool    {    CL_POOL      clPool;    UINT32 *     clFreeArray;      } END_CL_POOL; /* global */IMPORT VOIDFUNCPTR	_pNetBufCollect; /* protocol specific routine */CL_BUF_ID               lastClHead;CL_POOL_ID              pEndPoolId;/* extern */IMPORT int ffsMsb ();/* forward declarations */LOCAL STATUS            _endPoolInit (NET_POOL_ID pNetPool, M_CL_CONFIG *                                      pMclBlkConfig, CL_DESC * pClDescTbl,                                      int clDescTblNumEnt, BOOL fromKheap);LOCAL M_BLK_ID 		_endMBlkCarve (NET_POOL_ID pNetPool, int num,                                       char * pool);LOCAL CL_BLK_ID 	_endClBlkCarve (int num, char * pool);LOCAL CL_BUF_ID 	_endClPoolCarve (CL_POOL_ID pClPool, int num,                                          int clSize, char * pool);LOCAL STATUS 		_endMemPoolInit (int num, int unitSize, int headerSize,                                      char * memArea);LOCAL void		_endMBlkFree (NET_POOL_ID pNetPool, M_BLK_ID pMblk);LOCAL void 		_endClBlkFree (CL_BLK_ID pClBlk);LOCAL void 		_endClFree (NET_POOL_ID pNetPool, char * pClBuf);LOCAL M_BLK_ID 		_endMBlkClFree (NET_POOL_ID pNetPool, M_BLK_ID pMblk);LOCAL M_BLK_ID 		_endMBlkGet (NET_POOL_ID pNetPool, int canWait,                                  UCHAR type);LOCAL CL_BLK_ID		_endClBlkGet (NET_POOL_ID pNetPool, int canWait);LOCAL char *	 	_endClusterGet (NET_POOL_ID pNetPool, CL_POOL_ID pClPool);LOCAL STATUS 		_endMClGet (NET_POOL_ID pNetPool, M_BLK_ID pMblk,                                 int bufSize, int canWait, BOOL bestFit);LOCAL CL_POOL_ID 	_endClPoolIdGet (NET_POOL_ID pNetPool, int	bufSize,                                      BOOL bestFit);LOCAL POOL_FUNC dfltFuncTbl =		/* default pool function table */    {    _endPoolInit,    _endMBlkFree,    _endClBlkFree,    _endClFree,    _endMBlkClFree,    _endMBlkGet,    _endClBlkGet,    _endClusterGet,    _endMClGet,    _endClPoolIdGet,    };/* * this is a global pointer to a function table provided as a back door * for users who want to use a different allocation scheme for defaults * By initializing this _pNetPoolFuncTbl at runtime before initialization of * the network stack, one can change the default function table.  The system * pools use the default function table. */   POOL_FUNC * 	_pEndNetPoolFuncTbl = &dfltFuncTbl;/********************************************************************************  * _endPoolInit - initialize the net pool** This function initializes a net pool** RETURNS: OK or ERROR.** NOMANUAL*/LOCAL STATUS _endPoolInit    (    NET_POOL_ID		pNetPool,	/* pointer to a net pool */    M_CL_CONFIG *	pMclBlkConfig,	/* pointer to mBlk,clBlk config */    CL_DESC *		pClDescTbl,	/* pointer to cluster desc table */    int			clDescTblNumEnt, /* number of cluster desc entries */    BOOL                fromKheap       /* 1:KHEAP_ALLOC  0:malloc/calloc */    )    {    CL_DESC * 		pClDesc;	/* pointer to the cluster descriptor */    char * 		memArea;    END_CL_POOL *       pEndClPool;    bzero ((char *) pNetPool->clTbl, sizeof (pNetPool->clTbl));    if (fromKheap)	{	if ((pNetPool->pPoolStat = (M_STAT *) KHEAP_ALLOC(sizeof (M_STAT))) ==             NULL)	    return (ERROR);	bzero ((char *)pNetPool->pPoolStat, sizeof (M_STAT));	}    else {	if ((pNetPool->pPoolStat = (M_STAT *) calloc (1, sizeof (M_STAT))) ==             NULL)	    return (ERROR);        }    pNetPool->pmBlkHead = NULL;    if (pMclBlkConfig != NULL)	/* if mbuf config is specified */        {        if (pMclBlkConfig->memSize <            (((pMclBlkConfig->mBlkNum + 1) *  MBLK_SIZE) +             ((pMclBlkConfig->clBlkNum + 1) * CLBLK_SIZE)))            {            errno = S_netBufLib_MEMSIZE_INVALID;            goto poolInitError;            }        /* initialize the memory pool */        if (_endMemPoolInit (pMclBlkConfig->mBlkNum, M_BLK_SZ, sizeof(void *),                          pMclBlkConfig->memArea                          ) != OK)            {            goto poolInitError;            }        /* carve up the mBlk pool */        pNetPool->pmBlkHead = _endMBlkCarve (        				 pNetPool,                                         pMclBlkConfig->mBlkNum,                                         pMclBlkConfig->memArea                                         );        /* increment free mBlks  and number of mBlks */        pNetPool->mBlkCnt		      = pMclBlkConfig->mBlkNum;        pNetPool->mBlkFree		      = pMclBlkConfig->mBlkNum;        pNetPool->pPoolStat->mTypes [MT_FREE] = pMclBlkConfig->mBlkNum;        pNetPool->pPoolStat->mNum 	      = pMclBlkConfig->mBlkNum;        memArea = (char * )((int)pMclBlkConfig->memArea +                           (pMclBlkConfig->mBlkNum * MBLK_SIZE) + sizeof(long));        if (pMclBlkConfig->clBlkNum > 0)            {            /* initialize the memory pool */            if (_endMemPoolInit (pMclBlkConfig->clBlkNum,CLBLK_SIZE,0,memArea)                != OK)                goto poolInitError;            pNetPool->pClBlkHead = _endClBlkCarve (                                               pMclBlkConfig->clBlkNum,                                               memArea                                               );            if (pNetPool->pClBlkHead == NULL)                goto poolInitError;            }        }    pClDesc = pClDescTbl;    pNetPool->clMask   = 0;    pNetPool->clLg2Max = 0;    pNetPool->clLg2Min = 0;    /* range check cluster type */    if (pClDesc->clSize < END_CLUSTER_SIZE)        {#ifdef NETBUF_DEBUG        logMsg ("poolInit -- Invalid cluster type\n", 0, 0, 0, 0, 0, 0);#endif /* NETBUF_DEBUG */        errno = S_netBufLib_CLSIZE_INVALID;        goto poolInitError;        }    if (fromKheap)        {        if ((pNetPool->clTbl[0] =             (CL_POOL *)KHEAP_ALLOC(sizeof(END_CL_POOL))) == NULL)	    {#ifdef NETBUF_DEBUG	    logMsg ("poolInit -- cluster pool allocation\n", 0, 0, 0, 0, 0, 0);#endif /* NETBUF_DEBUG */	    errno = S_netBufLib_NO_SYSTEM_MEMORY;	    goto poolInitError;	    }        bzero ((char *)pNetPool->clTbl[0], sizeof (END_CL_POOL));        }    else         {	if ((pNetPool->clTbl[0] = (CL_POOL *)calloc(1,sizeof(END_CL_POOL))) ==             NULL)	{#ifdef NETBUF_DEBUG	logMsg ("poolInit -- cluster pool allocation\n", 0, 0, 0, 0, 0, 0);#endif /* NETBUF_DEBUG */	errno = S_netBufLib_NO_SYSTEM_MEMORY;	goto poolInitError;	}    }    pEndClPool = (END_CL_POOL *)pNetPool->clTbl[0];    if ((pEndClPool->clFreeArray = (UINT32 *) malloc((sizeof(UINT32 *) *                                                      (pClDesc->clNum + 1))))                                                      == NULL)        {        errno = S_netBufLib_NO_SYSTEM_MEMORY;                 goto poolInitError;        }    pNetPool->clTbl[0]->clSize = pClDesc->clSize;    pNetPool->clTbl[0]->pNetPool = pNetPool;    if (pClDesc->memSize < (pClDesc->clNum * pClDesc->clSize))        {        errno = S_netBufLib_MEMSIZE_INVALID;        goto poolInitError;        }    if (_endMemPoolInit (pClDesc->clNum, pClDesc->clSize,                         0 , pClDesc->memArea) != OK)        {        goto poolInitError;        }    pNetPool->clTbl[0]->pClHead = _endClPoolCarve (pNetPool->clTbl[0],                                                   pClDesc->clNum,                                                  pClDesc->clSize,                                                   (char *)pClDesc->memArea);    if (pNetPool->clTbl[0]->pClHead == NULL)        {        goto poolInitError;        }    pNetPool->clTbl[0]->clNum     = pClDesc->clNum;    pNetPool->clTbl[0]->clNumFree = pClDesc->clNum;    return (OK);    poolInitError:    netPoolDelete (pNetPool);    return (ERROR);    }/********************************************************************************* _endMBlkCarve - carve up the mBlk pool.** This function carves the the mBlks from a pre allocated pool.** RETURNS: M_BLK_ID or NULL.** NOMANUAL*/LOCAL M_BLK_ID _endMBlkCarve    (    NET_POOL_ID		pNetPool,	/* pointer to net pool */    int 		num,		/* number of units to allocate */    char *		pool		/* pre allocated memory area */    )    {    M_BLK_ID		pMblk = NULL;    int 		ix;    int			size;		/* size of each unit */    M_BLK_ID *		ppMblk;    size = MBLK_SIZE;	/* accomodate for netPoolId */    ppMblk = &pMblk;    for (ix = 0; ix < num; ++ix)	{	*ppMblk 		 = (M_BLK_ID) (pool + sizeof (void *));        *((NET_POOL_ID *)(pool)) = pNetPool;	(*ppMblk)->mBlkHdr.mType = MT_FREE;        ppMblk 			 = &((*ppMblk)->mBlkHdr.mNext);	pool 			 += size;	}        return (pMblk);    }/********************************************************************************* _endClBlkCarve - carve up the clBlk pool.** This function carves the the clBlks from a pre allocated pool.** RETURNS: CL_BLK_ID or NULL.** NOMANUAL*/LOCAL CL_BLK_ID _endClBlkCarve    (    int 		num,		/* number of units to allocate */    char *		pool		/* pre allocated memory area */    )    {    CL_BLK_ID		pClBlk = NULL;    int 		ix;    CL_BLK_ID *		ppClBlk;    ppClBlk = &pClBlk;    for (ix = 0; ix < num; ++ix)	{	*ppClBlk = (CL_BLK_ID) (pool);        ppClBlk  = &((*ppClBlk)->clNode.pClBlkNext);	pool 	 += CLBLK_SIZE;	}    return (pClBlk);    }/********************************************************************************* _endClPoolCarve - carve up the cluster pool** This function carves the clusters from a pre allocated pool.* Each cluster maintains an 4 byte header info.  This header info contains* a place to hold the pointer to the cluster pool.* This header info is prepended to the cluster buffer* and is hidden from the user.  The header info is used at the time of* freeing the cluster.  This function returns the pointer the cluster buffer* chain.** RETURNS: CL_BUF_ID or NULL.** NOMANUAL*/LOCAL CL_BUF_ID _endClPoolCarve    (    CL_POOL_ID		pClPool,	/* pointer to the cluster pool */    int 		num,		/* number of units to allocate */    int			clSize,		/* cluster size */    char *		pool		/* pre allocated memory area */    )    {    CL_BUF_ID		pClBuf = NULL; 	/* pointer to cluster buffer */    FAST int 		ix;		/* counter */    CL_BUF_ID *		ppClBuf;	/* ptr to ptr to cluster buffer */    CL_BUF_ID           pClLast;	/* ptr for last cluster buffer */    END_CL_POOL *       pEndClPool;    pEndClPool = (END_CL_POOL *) pClPool;    ppClBuf = &pClBuf;    for (ix = 0; ix < num; ix++)	{            pEndClPool->clFreeArray[ix + 1] = (UINT32)ppClBuf;          pEndClPool->clFreeArray[0] = ix;  	*ppClBuf		 = (CL_BUF_ID) (pool);        *((CL_POOL_ID *) (pool)) = pClPool;        ppClBuf 		 = &((*ppClBuf)->pClNext);                if (ix == (num - 1))            {            pClLast = (CL_BUF_ID)pool;            pClLast->pClNext = NULL;            }	pool 			 += clSize;	}    return (pClBuf);    }/********************************************************************************* _endMemPoolInit - initialize the memory** This function initialized the memory passed to it.** RETURNS: OK or ERROR.** NOMANUAL*/LOCAL STATUS _endMemPoolInit    (

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美v亚洲v综合ⅴ国产v| 欧美一级黄色录像| 日本欧美一区二区三区乱码 | 国内精品自线一区二区三区视频| 欧美日韩一区成人| 九九在线精品视频| 丝袜美腿亚洲综合| 亚洲欧洲av色图| 欧美tickle裸体挠脚心vk| 国产成人免费视频精品含羞草妖精| 国产精品九色蝌蚪自拍| 91在线观看下载| 欧美精品一二三四| 日本高清不卡在线观看| 婷婷六月综合亚洲| 国产精品日韩成人| 欧美日韩免费一区二区三区| 成人综合在线视频| 亚洲午夜精品17c| 久久精品视频一区| 88在线观看91蜜桃国自产| 91国产丝袜在线播放| 成人精品免费网站| 日本亚洲欧美天堂免费| 美日韩一区二区三区| 国产1区2区3区精品美女| 99久久久国产精品| 欧美日本国产一区| 欧美激情一区二区三区| 亚洲一区二区精品视频| 国产综合色视频| 欧美性欧美巨大黑白大战| 色天天综合色天天久久| 在线视频你懂得一区二区三区| 欧美一级在线免费| 亚洲视频电影在线| 久久丁香综合五月国产三级网站| 不卡影院免费观看| 日韩视频一区在线观看| 亚洲欧洲综合另类| 国产精品中文字幕一区二区三区| 欧美性感一区二区三区| 中文字幕va一区二区三区| 一二三区精品福利视频| 国产成人av福利| 欧美一激情一区二区三区| 国产精品不卡视频| 国产精品白丝jk黑袜喷水| 91精品国产综合久久香蕉的特点| 亚洲欧洲韩国日本视频| 极品美女销魂一区二区三区| 欧美性一区二区| 亚洲欧洲综合另类在线 | 国产日产欧美一区| 日韩影院免费视频| 欧美在线观看视频一区二区三区| 国产欧美一区二区精品仙草咪| 青娱乐精品视频| 欧美剧情片在线观看| 一区二区三区电影在线播| 成人综合日日夜夜| 久久久久久99久久久精品网站| 日本aⅴ免费视频一区二区三区| 欧美三级韩国三级日本一级| 国产精品久久久爽爽爽麻豆色哟哟 | 亚洲三级理论片| 成人免费精品视频| 国产色产综合色产在线视频| 久久99九九99精品| 欧美成人高清电影在线| 麻豆精品一区二区av白丝在线| 欧美麻豆精品久久久久久| 亚洲午夜在线电影| 欧美日韩国产另类不卡| 亚洲国产aⅴ天堂久久| 欧美综合视频在线观看| 亚洲精品午夜久久久| www.日韩在线| 亚洲另类春色国产| 欧美色欧美亚洲另类二区| 亚洲国产精品视频| 777亚洲妇女| 国产一区999| 国产精品三级av| 色噜噜狠狠成人中文综合| 亚洲欧美另类小说视频| 欧美性色黄大片| 免费三级欧美电影| 久久精品视频网| 99v久久综合狠狠综合久久| 亚洲一区欧美一区| 在线综合亚洲欧美在线视频| 国内精品在线播放| 中文幕一区二区三区久久蜜桃| zzijzzij亚洲日本少妇熟睡| 亚洲一区二区视频在线观看| 91.com在线观看| 成人午夜视频在线| 一区二区在线看| 国产丝袜美腿一区二区三区| 国产91精品入口| 亚洲成人三级小说| 日韩三级在线观看| 成人免费视频一区| 亚洲一区二区综合| 欧美一级淫片007| 国产成人精品一区二区三区网站观看| 国产免费久久精品| 97精品国产露脸对白| 性久久久久久久| 国产欧美中文在线| 7777女厕盗摄久久久| 国产丶欧美丶日本不卡视频| 亚洲品质自拍视频| 欧美精品一区二区三区久久久| 国产不卡视频一区二区三区| 亚洲三级免费电影| 久久看人人爽人人| 欧美久久久一区| 91丨九色丨黑人外教| 久久99精品一区二区三区三区| 亚洲综合成人在线| 中文字幕精品三区| 91精品在线免费观看| 成人永久看片免费视频天堂| 亚洲婷婷综合色高清在线| 精品国产91乱码一区二区三区| 欧美中文字幕一二三区视频| 成人激情视频网站| 国产一区二区导航在线播放| 午夜欧美一区二区三区在线播放| 国产精品久久免费看| 久久精品一区二区三区四区| 在线电影一区二区三区| 色呦呦国产精品| gogogo免费视频观看亚洲一| 免费在线观看日韩欧美| 亚洲chinese男男1069| 一区二区高清视频在线观看| 日本一区二区三区久久久久久久久不| 欧美日本国产一区| 欧美日韩一区在线| 97精品久久久久中文字幕| 成人免费高清在线| 国产suv精品一区二区883| 国产精品自拍三区| 国产黄人亚洲片| 国内成+人亚洲+欧美+综合在线| 理论电影国产精品| 毛片不卡一区二区| 国模大尺度一区二区三区| 麻豆一区二区99久久久久| 青青青伊人色综合久久| 免费在线观看视频一区| 久久国内精品自在自线400部| 免费在线观看精品| 国产一区二区三区美女| 在线91免费看| 日韩欧美视频一区| 久久综合五月天婷婷伊人| 久久综合五月天婷婷伊人| 国产网站一区二区三区| 中文字幕av在线一区二区三区| 国产精品国产三级国产aⅴ中文| 国产精品久久久久久久久免费相片| 国产精品天干天干在观线| 一区二区三区中文在线| 午夜视频一区在线观看| 精品一区二区三区的国产在线播放 | 三级欧美韩日大片在线看| 青青草97国产精品免费观看 | 午夜影院久久久| 久久精品国产999大香线蕉| 激情欧美日韩一区二区| 成人中文字幕电影| 欧美视频一区二区三区| 日韩欧美一级二级三级久久久| 国产婷婷色一区二区三区在线| 亚洲女与黑人做爰| 蜜桃视频一区二区三区 | 日韩中文字幕一区二区三区| 久久不见久久见免费视频7| 成人福利电影精品一区二区在线观看| 不卡一卡二卡三乱码免费网站| 精品视频免费看| 国产视频一区二区在线| 午夜视频在线观看一区二区三区| 精品亚洲porn| 国产免费成人在线视频| 亚洲午夜一区二区| 成人自拍视频在线观看| 在线不卡免费欧美| 国产精品毛片大码女人| 日韩成人精品视频| 一本一道综合狠狠老| 国产亚洲精品超碰| 日韩在线一区二区| 欧美最新大片在线看| 国产日韩欧美激情| 久久国产剧场电影|