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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? netbuflib.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* netBufLib.c - network buffer library *//* Copyright 1984 - 2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01r,07may02,kbw  man page edits01q,15oct01,rae  merge from truestack ver 01w, base 01n (SPR #65195 etc.)01p,08feb01,kbw  fixing a man page format problem01o,07feb01,spm  removed unused garbage collection code; updated documentation01n,26aug98,fle  doc : fixed a proc header trouble with netPoolInit01m,25aug98,n_s  M_WAIT will only call _pNetBufCollect 1 time. spr #2210401l,12dec97,kbw  making minor man page fixes01k,11dec97,vin  added netMblkOffsetToBufCopy part of SPR 9563.01j,08dec97,vin  added netMblkChainDup() SPR 9966.01i,05dec97,vin  changed netMblkClFree to netMblkFree in netTupleGet()01h,03dec97,vin  added netTupleGet() SPR 9955, added some unsupported routines 01g,13nov97,vin  code clean up.01f,25oct97,kbw  making minor man page fixes01e,08oct97,vin  corrected clBlkFree()01d,06oct97,vin  fixed a man page.01c,30sep97,vin  changed MSIZE to M_BLK_SZ.01b,19sep97,vin  added cluster Blks, fixed bugs, removed reference count		 pointers.01a,08aug97,vin  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.hINTERNAL	 ------------        |mBlk       |        |manages    |	|clusterBlk |        |           |	|	    |        ------------|\    -------------	              \   |clBlk      |		       \  |manages the|			\ |cluster.   |		         \|clRefCnt=1 |			  ------------|			           \				    \				     \  ------------|				      \|Cluster     |				       |	    |				       |	    |				       |	    |				       |	    |				       |-------------Two mBlks sharing the same cluster:-----------------------------------                                                          -----------|                      |-----------|        | mBlk      |                      | mBlk      |        |           |                      |           |        |           |                      |           |        |           |                      |           |        |           |                      |           |        |-----------\                      /-----------|                     \                    /                          \                  /                       \                /                        \|------------|/                         | clBlk      |                                        |            |                                         |clRefCnt = 2|                                         |            |                                         |            |                                         |------------\                                                       \                                                      |---------------|                                       | cluster       |                                       |               |                                       |               |                                       |---------------|*//* 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 "memPartLib.h"/* Virtual Stack Support */#ifdef VIRTUAL_STACK#include "netinet/vsLib.h"#endif/* defines */#undef 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() */ /* global */VOIDFUNCPTR 		_pNetBufCollect = NULL; /* protocol specific routine *//* extern */IMPORT int ffsMsb ();/* forward declarations */LOCAL STATUS		_poolInit (NET_POOL_ID pNetPool, M_CL_CONFIG *                                   pMclBlkConfig, CL_DESC * pClDescTbl,                                   int clDescTblNumEnt, BOOL fromKheap);LOCAL M_BLK_ID 		_mBlkCarve (NET_POOL_ID pNetPool, int num,                                    char * pool);LOCAL CL_BLK_ID 	_clBlkCarve (int num, char * pool);LOCAL CL_BUF_ID 	_clPoolCarve (CL_POOL_ID pClPool, int num, int clSize,                                      char * pool);LOCAL STATUS 		_memPoolInit (int num, int unitSize, int headerSize,                                      char * memArea);LOCAL void		_mBlkFree (NET_POOL_ID pNetPool, M_BLK_ID pMblk);LOCAL void 		_clBlkFree (CL_BLK_ID pClBlk);LOCAL void 		_clFree (NET_POOL_ID pNetPool, char * pClBuf);LOCAL M_BLK_ID 		_mBlkClFree (NET_POOL_ID pNetPool, M_BLK_ID pMblk);LOCAL M_BLK_ID 		_mBlkGet (NET_POOL_ID pNetPool, int canWait,                                  UCHAR type);LOCAL CL_BLK_ID		_clBlkGet (NET_POOL_ID pNetPool, int canWait);LOCAL char *	 	_clusterGet (NET_POOL_ID pNetPool, CL_POOL_ID pClPool);LOCAL STATUS 		_mClGet (NET_POOL_ID pNetPool, M_BLK_ID pMblk,                                 int bufSize, int canWait, BOOL bestFit);LOCAL CL_POOL_ID 	_clPoolIdGet (NET_POOL_ID pNetPool, int	bufSize,                                      BOOL bestFit);LOCAL POOL_FUNC dfltFuncTbl =		/* default pool function table */    {    _poolInit,    _mBlkFree,    _clBlkFree,    _clFree,    _mBlkClFree,    _mBlkGet,    _clBlkGet,    _clusterGet,    _mClGet,    _clPoolIdGet,    };/* * 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 * 	_pNetPoolFuncTbl = &dfltFuncTbl;/********************************************************************************  * _poolInit - initialize the net pool** This function initializes a net pool** RETURNS: OK or ERROR.** NOMANUAL*/LOCAL STATUS _poolInit    (    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 */    )    {    int 		ix;		/* index variable */    int 		iy; 		/* index variable */    int 		log2Size;	/* cluster size to the base 2 */    CL_DESC * 		pClDesc;	/* pointer to the cluster descriptor */    CL_POOL * 		pClPool; 	/* pointer to the cluster pool */    char * 		memArea;    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 *  (M_BLK_SZ + sizeof(long))) +             (pMclBlkConfig->clBlkNum * CL_BLK_SZ)))            {            errno = S_netBufLib_MEMSIZE_INVALID;            goto poolInitError;            }        /* initialize the memory pool */        if (_memPoolInit (pMclBlkConfig->mBlkNum, M_BLK_SZ, sizeof(void *),                          pMclBlkConfig->memArea                          ) != OK)            {            goto poolInitError;            }        /* carve up the mBlk pool */        pNetPool->pmBlkHead = _mBlkCarve (        				 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 * (M_BLK_SZ +                                                       sizeof(long))));        if (pMclBlkConfig->clBlkNum > 0)            {            /* initialize the memory pool */            if (_memPoolInit (pMclBlkConfig->clBlkNum, CL_BLK_SZ, 0, memArea)                != OK)                goto poolInitError;            pNetPool->pClBlkHead = _clBlkCarve (                                               pMclBlkConfig->clBlkNum,                                               memArea                                               );            if (pNetPool->pClBlkHead == NULL)                goto poolInitError;            }        }    /* initialize clusters */    pNetPool->clMask   = 0;    pNetPool->clLg2Max = 0;    pNetPool->clLg2Min = 0;    for (pClDesc = pClDescTbl, ix = 0 ; (pClDesc != NULL) &&             (pClDesc->clNum > 0) && (ix < clDescTblNumEnt); ix++, pClDesc++)	{	/* range check cluster type */	if ((pClDesc->clSize < CL_SIZE_MIN) || (pClDesc->clSize > CL_SIZE_MAX))            {#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;            }	log2Size 	 = SIZE_TO_LOG2(pClDesc->clSize);	pNetPool->clMask |= CL_LOG2_TO_CL_SIZE(log2Size); /* set the mask */	if ((pNetPool->clLg2Max == 0) && (pNetPool->clLg2Min == 0))	    {	    pNetPool->clLg2Min 	= log2Size;	    pNetPool->clLg2Max 	= log2Size;	    }	pNetPool->clLg2Max  = max(log2Size, pNetPool->clLg2Max);	pNetPool->clLg2Min  = min(log2Size, pNetPool->clLg2Min);        pNetPool->clSizeMax = CL_LOG2_TO_CL_SIZE(pNetPool->clLg2Max);        pNetPool->clSizeMin = CL_LOG2_TO_CL_SIZE(pNetPool->clLg2Min);	if (fromKheap)	    {	    if ((pClPool = (CL_POOL *) KHEAP_ALLOC(sizeof(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 *)pClPool, sizeof (CL_POOL));	    }	else {	    if ((pClPool = (CL_POOL *) calloc (1, sizeof(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;		}	    }        pNetPool->clTbl [CL_LOG2_TO_CL_INDEX(log2Size)] = pClPool;	for (iy = (log2Size - 1);	    ((!(pNetPool->clMask & CL_LOG2_TO_CL_SIZE(iy))) &&	     (CL_LOG2_TO_CL_INDEX(iy) >= CL_INDX_MIN))  ; iy--)	    {	    pNetPool->clTbl [CL_LOG2_TO_CL_INDEX(iy)] = pClPool;	    }	pClPool->clSize	  = pClDesc->clSize;        pClPool->clLg2	  = log2Size;        pClPool->pNetPool = pNetPool; /* initialize the back pointer */        if (pClDesc->memSize < (pClDesc->clNum * (pClDesc->clSize +                                                  sizeof(int))))            {            errno = S_netBufLib_MEMSIZE_INVALID;            goto poolInitError;            }        if (_memPoolInit (pClDesc->clNum, pClDesc->clSize,                          sizeof (void *) , pClDesc->memArea) != OK)            goto poolInitError;        pClPool->pClHead = _clPoolCarve (pClPool, pClDesc->clNum,                                         pClDesc->clSize, pClDesc->memArea);        if (pClPool->pClHead == NULL)            {            goto poolInitError;            }        pClPool->clNum	   = pClDesc->clNum;        pClPool->clNumFree = pClDesc->clNum;	}    return (OK);    poolInitError:    netPoolDelete (pNetPool);    return (ERROR);    }/********************************************************************************* _mBlkCarve - 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 _mBlkCarve    (    NET_POOL_ID		pNetPool,	/* pointer to net pool */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本aⅴ免费视频一区二区三区| 久久久电影一区二区三区| 国产精品国产自产拍高清av王其 | 亚洲男人的天堂网| 色欧美片视频在线观看| 亚洲另类在线一区| 欧美日韩在线播放三区| 日韩国产精品久久久久久亚洲| 91精品国产综合久久香蕉的特点 | 欧美日韩aaa| 麻豆国产一区二区| 国产日韩欧美精品在线| 97精品电影院| 首页国产丝袜综合| 国产亚洲人成网站| 色噜噜偷拍精品综合在线| 天堂蜜桃91精品| 久久久美女毛片| 色婷婷久久久综合中文字幕| 亚洲国产视频一区| 久久久精品国产免费观看同学| 国产mv日韩mv欧美| 亚洲二区视频在线| 久久综合久久久久88| 成人a免费在线看| 日韩电影一二三区| 国产精品护士白丝一区av| 欧美肥妇毛茸茸| 成人午夜免费av| 亚洲va在线va天堂| 国产亚洲精品资源在线26u| 日本精品视频一区二区三区| 蓝色福利精品导航| 亚洲精品视频免费看| 欧美一级在线视频| a美女胸又www黄视频久久| 日韩精品一二三区| 亚洲色图视频网| 欧美va日韩va| 精品视频资源站| 99re视频这里只有精品| 久久精品国产免费看久久精品| 亚洲视频每日更新| 久久精品欧美日韩精品| 欧美一区二区三区思思人| 97精品久久久午夜一区二区三区 | 欧美日韩在线播放三区| eeuss影院一区二区三区| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲欧美韩国综合色| 久久久不卡影院| 日韩三级视频中文字幕| 欧美自拍丝袜亚洲| 国产91精品一区二区麻豆网站 | 91九色02白丝porn| 国产成人午夜精品5599| 久久精品久久综合| 亚洲电影你懂得| 亚洲激情校园春色| 国产精品伦理一区二区| 精品福利一二区| 欧美一级久久久久久久大片| 日本道色综合久久| 91在线观看成人| 成人app网站| 波多野结衣中文字幕一区 | 看电影不卡的网站| 日本系列欧美系列| 天天色图综合网| 亚洲va天堂va国产va久| 亚洲一区二三区| 亚洲综合色丁香婷婷六月图片| 亚洲男人电影天堂| 亚洲在线视频网站| 亚洲精品v日韩精品| 亚洲精选一二三| 最新热久久免费视频| 中文字幕色av一区二区三区| 欧美国产亚洲另类动漫| 国产日韩欧美亚洲| 中文字幕在线观看一区二区| 国产精品电影一区二区| 国产精品久久久久久久久果冻传媒 | www欧美成人18+| 久久综合av免费| 久久久国产精品不卡| 欧美国产日本视频| 亚洲欧洲在线观看av| 亚洲特级片在线| 一区二区三区加勒比av| 亚洲国产婷婷综合在线精品| 天堂av在线一区| 激情国产一区二区| 成人午夜av在线| 91麻豆产精品久久久久久| 欧美日韩一本到| 欧美成人性战久久| 欧美激情一区二区三区蜜桃视频| 亚洲欧洲av一区二区三区久久| 亚洲日本电影在线| 日韩不卡一区二区三区| 国产精品中文欧美| av电影天堂一区二区在线| 欧美综合视频在线观看| 日韩欧美三级在线| 国产精品久久久久久久午夜片 | 亚洲 欧美综合在线网络| 免播放器亚洲一区| 成人禁用看黄a在线| 欧美日韩在线三级| 精品国精品自拍自在线| 中文字幕一区二区三区在线观看| 亚洲精品久久久蜜桃| 男女男精品视频网| av中文一区二区三区| 3d动漫精品啪啪一区二区竹菊| 久久这里只有精品视频网| 亚洲人妖av一区二区| 欧美bbbbb| 91麻豆视频网站| 日韩精品中文字幕一区二区三区 | 色一情一伦一子一伦一区| 欧美一二三区精品| 国产精品国产精品国产专区不片| 亚洲一区二区三区在线播放| 国产麻豆精品一区二区| 91黄色免费网站| 久久久国产精品麻豆| 水蜜桃久久夜色精品一区的特点| 国产精品一区二区在线观看不卡| 在线观看www91| 欧美韩国日本综合| 老司机免费视频一区二区| 欧美性色黄大片| 国产精品国产三级国产普通话99| 日韩中文字幕麻豆| 波多野结衣视频一区| 欧美va亚洲va国产综合| 亚洲第一电影网| 99久久99久久精品免费看蜜桃| 91 com成人网| 一区二区三区久久| av一区二区三区四区| 久久久精品国产免费观看同学| 日韩av在线发布| 欧美日韩情趣电影| 亚洲精品va在线观看| 波多野结衣亚洲一区| 欧美激情一区二区三区蜜桃视频 | 日韩在线卡一卡二| 色88888久久久久久影院野外 | 1区2区3区欧美| 国产a久久麻豆| 欧美一区二区播放| 日韩电影在线一区二区| 欧美羞羞免费网站| 一区二区三区美女| 欧洲av一区二区嗯嗯嗯啊| 中文字幕一区二区三区四区不卡 | 成年人国产精品| 国产日产欧美一区二区三区| 精品一区二区三区蜜桃| 成人美女视频在线观看18| 久久精品一区蜜桃臀影院| 国产自产视频一区二区三区| 欧美不卡在线视频| 老色鬼精品视频在线观看播放| 欧美一区二区三区小说| 美女在线观看视频一区二区| 欧美一区二区三级| 麻豆成人av在线| 精品国产亚洲一区二区三区在线观看| 午夜精品免费在线| 日韩丝袜情趣美女图片| 精品亚洲成a人| 久久久激情视频| 成+人+亚洲+综合天堂| 国产精品久久久久久久久快鸭| 99精品偷自拍| 亚洲一区二区3| 91精品国产丝袜白色高跟鞋| 免费在线看成人av| 久久久久久亚洲综合| 大尺度一区二区| 亚洲欧美另类小说视频| 欧美日韩视频在线观看一区二区三区| 亚洲h精品动漫在线观看| 91精品国产高清一区二区三区蜜臀| 日本不卡一二三区黄网| 久久九九99视频| 色综合久久综合| 日韩精品成人一区二区三区| 欧美不卡激情三级在线观看| 国产成人综合视频| 一二三四社区欧美黄| 日韩欧美高清一区| 成人国产免费视频| 婷婷综合另类小说色区| 国产色91在线| 欧美日韩一二三区|