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

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

?? endnetbuflib.c

?? ixp425 bsp for vxworks
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* endNetBufLib.c - network buffer library *//* Copyright 1984 - 2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01c,20nov03,m_h  initialize pClBlk to NULL01b,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一区二区三区免费野_久草精品视频
国产精品婷婷午夜在线观看| 亚洲成人午夜电影| 亚洲一区二区av电影| 日韩精品亚洲一区二区三区免费| 国产成人综合网| 欧美精品丝袜久久久中文字幕| 国产清纯白嫩初高生在线观看91| 亚洲国产精品影院| 成人av综合在线| 欧美精品一区视频| 日韩福利电影在线| 色久优优欧美色久优优| 中文字幕乱码一区二区免费| 奇米精品一区二区三区在线观看一| av亚洲精华国产精华精华| 精品国产1区二区| 全国精品久久少妇| 欧美猛男超大videosgay| 亚洲黄色尤物视频| 不卡一区中文字幕| 国产精品午夜电影| 国产精品一级在线| 26uuu国产在线精品一区二区| 日韩avvvv在线播放| 欧美日韩国产另类不卡| 亚洲精品日产精品乱码不卡| 99久久国产免费看| 成人免费在线视频| fc2成人免费人成在线观看播放| 国产欧美日韩亚州综合| 国产成人午夜片在线观看高清观看| 26uuu精品一区二区在线观看| 久久国产三级精品| 欧美精品一区二区蜜臀亚洲| 激情深爱一区二区| 久久夜色精品一区| 国产福利91精品一区| 国产精品午夜电影| 91老司机福利 在线| 亚洲欧美日韩在线不卡| 在线观看欧美黄色| 免费在线观看一区二区三区| 欧美大片在线观看| 国产福利91精品一区二区三区| 国产欧美日韩三区| 91麻豆文化传媒在线观看| 一区二区三区中文在线观看| 欧美日韩一区小说| 免费在线看成人av| 国产丝袜欧美中文另类| 91色乱码一区二区三区| 亚洲妇女屁股眼交7| 欧美一区二区播放| 高清国产一区二区三区| 亚洲天堂精品视频| 欧美男生操女生| 国产成人av资源| 亚洲日本一区二区| 欧美喷潮久久久xxxxx| 国产乱理伦片在线观看夜一区| 中文字幕+乱码+中文字幕一区| 色爱区综合激月婷婷| 麻豆精品国产91久久久久久| 中文字幕在线视频一区| 欧美日韩在线播放一区| 国产风韵犹存在线视精品| 亚洲另类在线制服丝袜| 精品美女在线观看| 91免费国产在线| 精品亚洲国产成人av制服丝袜 | 亚洲综合色视频| 日韩欧美国产麻豆| 色综合咪咪久久| 久热成人在线视频| 一区二区理论电影在线观看| 久久综合久久99| 色老综合老女人久久久| 国产精品一区二区不卡| 香蕉av福利精品导航| 国产精品久久久久永久免费观看 | 色综合久久中文综合久久97| 日韩制服丝袜av| 一区二区三区四区国产精品| 国产色婷婷亚洲99精品小说| 欧美一级艳片视频免费观看| 97se亚洲国产综合自在线| 激情欧美一区二区三区在线观看| 亚洲电影一级黄| 国产女人aaa级久久久级 | 日韩美女视频一区| 精品国产91九色蝌蚪| 欧美日韩国产综合久久 | 成人理论电影网| 99re视频精品| 国产一区在线精品| 日韩影院免费视频| 亚洲电影一级黄| 亚洲一区在线电影| 一区二区三区国产精华| 亚洲人成精品久久久久| 国产精品日韩成人| 中文字幕国产一区二区| 久久欧美一区二区| 久久久久久久电影| 精品福利av导航| 久久视频一区二区| 2022国产精品视频| 亚洲精品在线观| 久久综合色8888| 久久久久久**毛片大全| 久久久久亚洲综合| 国产亚洲美州欧州综合国| 2024国产精品| 国产精品视频一区二区三区不卡| 国产区在线观看成人精品| 日本一区二区三区电影| 中文字幕第一区第二区| 中文字幕中文字幕一区二区| 亚洲欧洲精品一区二区精品久久久| 日本一区二区三级电影在线观看| 国产目拍亚洲精品99久久精品| 欧美高清在线一区二区| 中文字幕一区二区三区不卡| 亚洲欧洲av色图| 亚洲国产精品影院| 伦理电影国产精品| 国产精品自在欧美一区| 成人午夜电影小说| 色综合久久久久网| 欧美久久一二三四区| 日韩欧美不卡一区| 久久久99免费| 亚洲人一二三区| 日韩va亚洲va欧美va久久| 久久精品99久久久| 国产不卡在线播放| 在线观看亚洲成人| 欧美一二三四在线| 国产精品理论在线观看| 亚洲国产精品人人做人人爽| 日韩av午夜在线观看| 国产成人av电影免费在线观看| 91美女片黄在线观看91美女| 日韩一区二区免费电影| 日本一区二区视频在线观看| 亚洲综合丁香婷婷六月香| 九色综合国产一区二区三区| 成人激情视频网站| 91精品国产色综合久久不卡蜜臀 | 99re热视频这里只精品| 欧美中文字幕一区二区三区 | 亚洲精品一区二区三区在线观看 | 555夜色666亚洲国产免| 久久免费美女视频| 亚洲激情校园春色| 国产精品一二三| 欧美日韩国产小视频在线观看| 久久天堂av综合合色蜜桃网| 亚洲电影一区二区三区| 国产精品自产自拍| 欧美日韩精品一区二区天天拍小说| 国产日产精品一区| 日本伊人色综合网| 91麻豆精品视频| 久久久精品欧美丰满| 日日骚欧美日韩| 91丨porny丨首页| 国产日韩精品一区二区三区| 日韩高清一区在线| 色就色 综合激情| 国产精品国产a| 国产一区二区中文字幕| 日韩一级成人av| 五月天亚洲婷婷| 一本色道久久综合精品竹菊| 国产校园另类小说区| 人妖欧美一区二区| 在线综合视频播放| 亚洲资源中文字幕| 日本韩国欧美三级| 1024成人网| eeuss鲁一区二区三区| 中文字幕欧美日韩一区| 国产一区二区美女| 26uuu亚洲| 韩国欧美国产1区| 日韩精品自拍偷拍| 奇米777欧美一区二区| 欧美伦理影视网| 视频一区二区中文字幕| 欧美日韩一二区| 天堂午夜影视日韩欧美一区二区| 在线观看视频一区| 亚洲一区二区精品久久av| 91久久精品一区二区二区| 亚洲天堂免费看| 日本精品视频一区二区| 亚洲一二三四在线| 欧美麻豆精品久久久久久| 亚洲bt欧美bt精品|