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

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

?? 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 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区中文在线观看| 国产精品网站一区| 久久尤物电影视频在线观看| 亚洲人成伊人成综合网小说| 精品一区二区三区免费| 欧洲色大大久久| 国产日产欧美一区| 午夜久久福利影院| 99精品一区二区| 国产日韩在线不卡| 久久99久久久久| 欧美少妇bbb| 一区二区三区四区激情| 国产凹凸在线观看一区二区| 欧美大片一区二区三区| 亚洲综合色婷婷| 99久久免费精品| 国产欧美一区二区精品忘忧草| 日本午夜一本久久久综合| 91久久人澡人人添人人爽欧美 | 欧美在线免费播放| 国产精品福利一区二区三区| 国产福利一区二区三区视频在线| 国产女人18水真多18精品一级做| 久久精品国产澳门| 欧美一级二级三级乱码| 亚洲成av人综合在线观看| 91麻豆自制传媒国产之光| 国产精品久久影院| 9i在线看片成人免费| 国产欧美一区二区精品性色| 国产一二精品视频| 国产亚洲精品精华液| 国产寡妇亲子伦一区二区| 久久久国产精华| 成人污视频在线观看| 国产精品视频观看| 99国产精品国产精品久久| 亚洲图片欧美激情| 色系网站成人免费| 亚洲一区在线视频观看| 欧美午夜精品一区二区三区 | 99国产精品视频免费观看| 国产精品久久久久久久久图文区 | 精品奇米国产一区二区三区| 麻豆国产精品视频| 精品国产成人在线影院| 国产老妇另类xxxxx| 欧美激情综合在线| 91色视频在线| 日韩av在线免费观看不卡| 日韩美女主播在线视频一区二区三区 | 日韩高清中文字幕一区| 欧美一区二区三区免费| 国内精品伊人久久久久av一坑| 久久久777精品电影网影网 | 欧美浪妇xxxx高跟鞋交| 久久97超碰国产精品超碰| 久久久影视传媒| 色婷婷综合久色| 三级在线观看一区二区| 久久久另类综合| 91国内精品野花午夜精品| 蜜桃一区二区三区四区| 日本一区二区三区高清不卡| 在线免费亚洲电影| 久久av中文字幕片| 国产精品久久久久久久蜜臀| 在线观看亚洲成人| 国产乱码精品一品二品| 国产精品成人在线观看| 欧美精品日韩一本| 成人一区二区三区| 午夜精品一区二区三区电影天堂| 精品福利在线导航| 色综合网站在线| 久久国内精品自在自线400部| 国产精品久久久久毛片软件| 91精品国产高清一区二区三区| 高清不卡在线观看| 奇米色一区二区三区四区| 中文av字幕一区| 欧美一级黄色录像| 色综合久久综合中文综合网| 精品一区二区免费视频| 一区二区三区中文在线观看| 欧美高清一级片在线观看| 国产精品理论片在线观看| 欧美日韩在线直播| 成人动漫视频在线| 国产精品一级二级三级| 无码av免费一区二区三区试看| 亚洲欧洲精品一区二区三区| 久久久久久电影| 91麻豆精品国产91久久久久| 色乱码一区二区三区88| 成人综合婷婷国产精品久久| 狠狠色综合日日| 日韩成人一级大片| 亚洲成人高清在线| 亚洲男人的天堂网| 国产精品理论片| 国产精品每日更新| 久久久精品2019中文字幕之3| 欧美一区二区三区思思人| 欧美日韩成人一区二区| 欧美午夜理伦三级在线观看| 色国产精品一区在线观看| a级精品国产片在线观看| 国产成人激情av| 国产综合色视频| 精品一区二区综合| 麻豆精品国产91久久久久久| 奇米综合一区二区三区精品视频| 亚洲大片免费看| 午夜精品成人在线视频| 午夜精品福利一区二区蜜股av| 亚洲大片免费看| 日韩电影在线一区二区三区| 午夜久久电影网| 性感美女久久精品| 亚洲成在线观看| 日韩主播视频在线| 九色综合狠狠综合久久| 精品无码三级在线观看视频| 精品影院一区二区久久久| 成人性生交大片免费看在线播放| 国产电影一区二区三区| 国产成人免费在线观看不卡| 波多野结衣精品在线| 91麻豆6部合集magnet| 欧美三片在线视频观看 | 国产91精品一区二区麻豆网站| 国产a视频精品免费观看| 99视频精品全部免费在线| 色综合一个色综合亚洲| 在线不卡欧美精品一区二区三区| 欧美一区二区人人喊爽| 欧美精品一区二区蜜臀亚洲| 国产精品久久看| 亚洲一区二区三区中文字幕| 日韩va亚洲va欧美va久久| 久草精品在线观看| 成人精品小蝌蚪| 一道本成人在线| 日韩精品一区二区三区视频| 精品久久久久久久久久久久久久久 | 成年人午夜久久久| 日韩午夜激情电影| 最新久久zyz资源站| 午夜精品aaa| 粉嫩13p一区二区三区| 在线亚洲精品福利网址导航| 在线不卡中文字幕| 中文字幕欧美区| 五月天亚洲婷婷| 国内精品伊人久久久久av影院 | 一区二区三区日韩在线观看| 日本成人在线不卡视频| eeuss影院一区二区三区| 欧美一区二区久久| 国产精品国产三级国产三级人妇| 亚洲成人一二三| 99久久国产免费看| 日韩欧美三级在线| 一区二区三区在线免费播放| 久久国产夜色精品鲁鲁99| 91久久一区二区| 中文在线资源观看网站视频免费不卡| 天堂久久久久va久久久久| 成人国产亚洲欧美成人综合网| 日韩一区二区三区四区| 亚洲精品视频自拍| 国产麻豆视频一区二区| 欧美片在线播放| 亚洲欧洲av在线| 国产成人啪免费观看软件| 日韩欧美中文一区二区| 午夜精品福利在线| 色妞www精品视频| 国产精品久久夜| 成人白浆超碰人人人人| 26uuu色噜噜精品一区| 日本人妖一区二区| 欧美精品aⅴ在线视频| 亚洲精品国产无套在线观| 国产v综合v亚洲欧| 久久精品日产第一区二区三区高清版 | 国产91精品露脸国语对白| 国产精品无圣光一区二区| 午夜精品国产更新| 欧美精品第一页| 一区二区三区av电影| 色婷婷久久久亚洲一区二区三区| 国产欧美日本一区二区三区| 国产综合色产在线精品| 日韩美女一区二区三区四区| 麻豆成人免费电影| 日韩欧美国产精品一区| 韩国视频一区二区|