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

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

?? mbuflib.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* mbufLib.c - BSD mbuf interface library *//* Copyright 1984 - 2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01i,15oct01,rae  merge from truestack ver 01l, base 01h01h,25aug98,n_s  corrected error handling of buffer allocate calls. spr #2210401g,19sep97,vin  added clBlk specific code, changed pointers to refcounts		 of clusters to refcounts since refcount has been moved to                 clBlk01f,12aug97,vin	 changed mBlkGet to take _pNetDpool01e,22nov96,vin  added cluster support replaced m_get(..) with mBlkGet(..).01d,29aug96,vin  made the code use only m_get.01c,06jun96,vin  made compatible with BSD4.4 mbufs.01b,13nov95,dzb  changed to validate mbufId.type off MBUF_VALID (SPR #4066).01a,08nov94,dzb  written.*//*DESCRIPTIONThis library contains routines to create, build, manipulate, anddelete BSD mbufs.  It serves as a back-end to the zbuf API providedby zbufLib.Note: The user should protect mbufs before calling these routines.  For many      operations, it may be appropriate to guard with the spl semaphore.NOMANUAL*//* includes */#include "vxWorks.h"#include "zbufLib.h"#include "mbufLib.h"#include "errnoLib.h"#include "intLib.h"#include "stdlib.h"#include "memPartLib.h"#ifdef VIRTUAL_STACK#include "netinet/vsLib.h"#endif/* globals */MBUF_ID			_mbufIdHead = NULL;	/* Head ID of free chain *//* locals */LOCAL BOOL		mbufInit = FALSE;	/* library initialized ? */LOCAL MBUF_DESC		mbufDescHead = NULL;	/* Head of free desc list *//* declare mbuf interface function table */LOCAL ZBUF_FUNC		mbufFunc =    {    (FUNCPTR) _mbufCreate,    (FUNCPTR) _mbufDelete,    (FUNCPTR) _mbufInsert,    (FUNCPTR) _mbufInsertBuf,    (FUNCPTR) _mbufInsertCopy,    (FUNCPTR) _mbufExtractCopy,    (FUNCPTR) _mbufCut,    (FUNCPTR) _mbufSplit,    (FUNCPTR) _mbufDup,    (FUNCPTR) _mbufLength,    (FUNCPTR) _mbufSegFind,    (FUNCPTR) _mbufSegNext,    (FUNCPTR) _mbufSegPrev,    (FUNCPTR) _mbufSegData,    (FUNCPTR) _mbufSegLength    };/* static function declarations */LOCAL void		_mbufBufFree (MBUF_DESC mbufDesc, VOIDFUNCPTR freeRtn,                            int freeArg);LOCAL MBUF_SEG *	_mbufSegFindPrev (MBUF_ID mbufId, MBUF_SEG mbufSeg,		            int *pOffset);/********************************************************************************* _mbufLibInit - initialize the BSD mbuf interface library** This routine initializes the BSD mbuf interface library and publishes* the mbufLib API to the caller.  Lists of free ID structures and* free mbuf cluster descriptors are allocated in this routine.** The mbufLib API func table "mbufFunc" is published to the caller upon* completion of initialization.  Typically, this func table is used by* the zbuf facility to call mbuf routines within this library to perform* buffering operations.  Even though the zbuf interface defines the ZBUF_FUNC* struct, it doesn't necessarily mean that zbufs must be present.  This* library may be used even if zbufs have been scaled out of the system.** RETURNS:* A pointer to a func table containing the mbufLib API,* or NULL if the mbuf interface could not be initialized.** NOMANUAL*/void * _mbufLibInit (void)    {    int			ix;			/* counter for list init */    if (mbufInit == TRUE)			/* already initialized ? */        return ((void *) &mbufFunc);    if ((_mbufIdHead = (MBUF_ID) KHEAP_ALLOC((sizeof (struct mbufId) *	MBUF_ID_INC))) == NULL)			/* alloc space for ID list */        return (NULL);    if ((mbufDescHead = (MBUF_DESC) KHEAP_ALLOC((sizeof (struct mbufDesc) *	MBUF_DESC_INC))) == NULL)		/* alloc space for desc list */	{	KHEAP_FREE((char *)_mbufIdHead);        return (NULL);	}	    /* divide up into an sll of free mbuf ID's, _mbufIdHead as the head */    for (ix = 0; ix < (MBUF_ID_INC - 1); ix++)        _mbufIdHead[ix].mbufIdNext = &_mbufIdHead[ix + 1];    _mbufIdHead[ix].mbufIdNext = NULL;    /* divide up into an sll of free buf desc, mbufDescHead as the head */    for (ix = 0; ix < (MBUF_DESC_INC - 1); ix++)        mbufDescHead[ix].mbufDescNext = &mbufDescHead[ix + 1];    mbufDescHead[ix].mbufDescNext = NULL;    mbufInit = TRUE;				/* init successful */    return ((void *) &mbufFunc);		/* return mbuf func table */    }/********************************************************************************* _mbufCreate - create an empty mbuf ID** This routine creates an mbuf ID, which remains empty (i.e., does not* contain any mbufs) until mbufs are added by the mbuf insertion routines.* Operations performed on mbufs require an mbuf ID, which is returned by* this routine.** RETURNS:* An mbuf ID, or NULL if an mbuf ID could not be created.** SEE ALSO: _mbufCreate** NOMANUAL*/MBUF_ID _mbufCreate (void)    {    MBUF_ID		mbufId;			/* obtained mbuf ID */    int			ix;			/* counter for list init */    int			lockKey = intLock ();	/* int lock cookie */    if ((mbufId = _mbufIdHead) != NULL)		/* free list empty ? */        {        _mbufIdHead = mbufId->mbufIdNext;	/* pop first ID off list */        intUnlock (lockKey);        mbufId->type = MBUF_VALID;		/* init new ID type */        mbufId->mbufHead = NULL;		/* init new ID head */        }    else					/* list is empty */	{        intUnlock (lockKey);        if ((mbufId = (MBUF_ID) KHEAP_ALLOC((sizeof (struct mbufId) *            MBUF_ID_INC))) != NULL)		/* alloc more IDs */            {            for (ix = 0; ix < (MBUF_ID_INC - 1); ix++)	/* into an sll */                mbufId[ix].mbufIdNext = &mbufId[ix + 1];            lockKey = intLock ();            mbufId[ix].mbufIdNext = _mbufIdHead;            _mbufIdHead = mbufId->mbufIdNext;	/* hook head onto new list */            intUnlock (lockKey);            mbufId->type = MBUF_VALID;		/* init new ID type */            mbufId->mbufHead = NULL;		/* init new ID head */            }        }    return (mbufId);				/* return new ID */    }/********************************************************************************* _mbufDelete - delete an mbuf ID and free any associated mbufs** This routine will free any mbufs associated with <mbufId>, then* delete the mbuf ID itself.  <mbufId> should not be used after this* routine executes successfully.** RETURNS:* OK, or ERROR if the mbuf ID could not be deleted.** SEE ALSO: _mbufCreate** NOMANUAL*/STATUS _mbufDelete    (    MBUF_ID		mbufId		/* mbuf ID to free */    )    {    /* already free ? */        if (mbufId == NULL || mbufId->type != MBUF_VALID)			{	errno = S_mbufLib_ID_INVALID;		/* invalid if already free */	return (ERROR);	}    MBUF_ID_DELETE(mbufId);			/* delete mbuf ID */    return (OK);				/* return OK, always */    }/********************************************************************************* _mbufInsert - insert an mbuf chain into another mbuf chain** This routine inserts all <mbufId2> mbufs into <mbufId1> at the* specified byte location** The location of insertion is specified by <mbufSeg> and <offset>.  Note* that insertion within a chain occurs before the byte location specified* by <mbufSeg> and <offset>.  Additionally, note that <mbufSeg> and <offset>* must be "NULL" and "0", respectively, when inserting into an empty mbuf ID.** After all the <mbufId2> mbufs are inserted into <mbufId1>, the mbuf ID* <mbufId2> is deleted.  <mbufId2> should not be used after this routine* executes successfully.** RETURNS:* The mbuf pointer associated with the first inserted mbuf,* or NULL if the operation failed.** NOMANUAL*/MBUF_SEG _mbufInsert    (    MBUF_ID		mbufId1,	/* mbuf ID to insert <mbufId2> into */    MBUF_SEG		mbufSeg,	/* mbuf base for <offset> */    int			offset,		/* relative byte offset */    MBUF_ID		mbufId2		/* mbuf ID to insert into <mbufId1> */    )    {    MBUF_ID		mbufIdNew;		/* dummy ID for dup operation */    MBUF_SEG *		pMbufPrev;		/* mbuf prev to insert */    MBUF_SEG		mbufEnd;		/* last Id2 mbuf */    int			maxLen = MBUF_END;	/* offset for last Id2 byte */    /* find the mbuf ptr previous to the point of insertion */    if ((pMbufPrev = _mbufSegFindPrev (mbufId1, mbufSeg, &offset)) == NULL)        return (NULL);    if ((mbufEnd = _mbufSegFind (mbufId2, NULL, &maxLen)) == NULL)	return (NULL);				/* find end mbuf of Id2 */    if (offset == 0)				/* if prepend... */	{	mbufEnd->m_next = *pMbufPrev;	*pMbufPrev = mbufId2->mbufHead;        }    else					/* else insert... */        {	mbufSeg = *pMbufPrev;			/* find insertion mbuf */        if ((mbufIdNew = _mbufDup (mbufId1, mbufSeg, offset,            mbufSeg->m_len - offset)) == NULL)            return (NULL);			/* dup later portion */        mbufSeg->m_len = offset;		/* shorten to first portion */        mbufIdNew->mbufHead->m_next = mbufSeg->m_next;        mbufEnd->m_next = mbufIdNew->mbufHead;	/* insert Id2 */        mbufSeg->m_next = mbufId2->mbufHead;        MBUF_ID_DELETE_EMPTY(mbufIdNew);	/* delete dup ID */	}    mbufEnd = mbufId2->mbufHead;		/* save head for return */    if (mbufId2->type == MBUF_VALID)	{        MBUF_ID_DELETE_EMPTY(mbufId2);		/* delete ref to Id2 */	}    return (mbufEnd);				/* return inserted mbuf */    }/********************************************************************************* _mbufInsertBuf - create a cluster from a buffer and insert into an mbuf chain** This routine creates an mbuf cluster from the user buffer <buf> and* inserts it at the specified byte location in <mbufId>.** The location of insertion is specified by <mbufSeg> and <offset>.  Note* that insertion within a chain occurs before the byte location specified* by <mbufSeg> and <offset>.  Additionally, note that <mbufSeg> and <offset>* must be "NULL" and "0", respectively, when inserting into an empty mbuf ID.** The user provided free routine <freeRtn> will be called when the mbuf* cluster created from <buf> is not being referenced by any more mbufs.* If <freeRtn> is NULL, the mbuf will function normally, except that the* user will not be notified when no more mbufs reference cluster containing* <buf>.  <freeRtn> will be called from the context of the task that last* references the cluster.  <freeRtn> should be declared as follows:* .CS*       void freeRtn*           (*           caddr_t     buf,    /@ pointer to user buffer @/*           int         freeArg /@ user provided argument to free routine @/*           )* .CE** RETURNS:* The mbuf pointer associated with the inserted mbuf cluster,* or NULL if the operation failed.** NOMANUAL*/MBUF_SEG _mbufInsertBuf    (    MBUF_ID		mbufId,		/* mbuf	ID which buffer is inserted */    MBUF_SEG		mbufSeg,	/* mbuf base for <offset> */    int			offset,		/* relative byte offset */    caddr_t		buf,		/* user buffer for mbuf cluster */    int			len,		/* number of bytes to insert */    VOIDFUNCPTR		freeRtn,	/* user free routine */    int			freeArg		/* argument to free routine */    )    {    MBUF_ID		mbufIdNew;		/* mbuf ID containing <buf> */    MBUF_DESC 		mbufDesc;		/* desc for <buf> cluster */    MBUF_SEG		mbufNew;		/* mbuf for <buf> cluster */    CL_BLK_ID		pClBlk;			/* pointer to cluster blk */    int			lockKey;		/* int lock cookie */    int			ix;			/* counter for list init */    if (len <= 0)				/* have to insert some bytes */        {	errno = S_mbufLib_LENGTH_INVALID;	return (NULL);	}    MBUF_ID_CREATE (mbufIdNew);			/* create new mbuf ID for buf */    if (mbufIdNew == NULL)	return (NULL);    lockKey = intLock ();    if ((mbufDesc = mbufDescHead) != NULL)	/* free list empty ? */        {        mbufDescHead = mbufDesc->mbufDescNext;	/* pop first desc off list */        intUnlock (lockKey);	}    else					/* list is empty */	{        intUnlock (lockKey);	if ((mbufDesc = (MBUF_DESC) KHEAP_ALLOC((sizeof (struct mbufDesc) *	    MBUF_DESC_INC))) != NULL)		/* alloc more desc's */            {            for (ix = 0; ix < (MBUF_DESC_INC - 1); ix++)                mbufDesc[ix].mbufDescNext = &mbufDesc[ix + 1];            lockKey = intLock ();            mbufDesc[ix].mbufDescNext = mbufDescHead;            mbufDescHead = mbufDesc->mbufDescNext;/* hook head onto new list */            intUnlock (lockKey);	    }        }    if (mbufDesc == NULL)			/* able to get a new desc ? */	{        MBUF_ID_DELETE_EMPTY(mbufIdNew);	return (NULL);	}    mbufDesc->buf = buf;    /* get mbuf for cluster */        if ( (mbufNew = mBlkGet (_pNetDpool, M_WAIT, MT_DATA)) == NULL)        {	/* release on fail */	lockKey = intLock ();	mbufDescHead = mbufDesc;	intUnlock (lockKey);	MBUF_ID_DELETE_EMPTY (mbufIdNew);			return (NULL);	}    pClBlk = clBlkGet (_pNetDpool, M_WAIT);         if (pClBlk == NULL)			/* out of cl Blks */        {        m_free (mbufNew);	lockKey = intLock ();	mbufDescHead = mbufDesc;	intUnlock (lockKey);	MBUF_ID_DELETE_EMPTY (mbufIdNew);			return (NULL);        }    mbufNew->pClBlk		= pClBlk;    /* build <buf> into an mbuf cluster */    mbufNew->m_data		= buf;    mbufNew->m_len		= len;    mbufNew->m_flags		|= M_EXT;    mbufNew->m_extBuf		= buf;    mbufNew->m_extSize		= len;    mbufNew->m_extFreeRtn	= (FUNCPTR) _mbufBufFree;    mbufNew->m_extRefCnt	= 1;    mbufNew->m_extArg1		= (int) mbufDesc;    mbufNew->m_extArg2		= (int) freeRtn;    mbufNew->m_extArg3		= freeArg;    mbufIdNew->mbufHead = mbufNew;		/* put cluster into new ID */    /* insert the new mbuf ID with <buf> into <mbufId> */    if ((mbufSeg = _mbufInsert (mbufId, mbufSeg, offset, mbufIdNew)) == NULL)	{        mbufNew->m_extArg2 = (int)NULL;		/* don't call freeRtn on fail */        MBUF_ID_DELETE(mbufIdNew);	}    return (mbufSeg);				/* return inserted mbuf */    }/********************************************************************************* _mbufBufFree - free a user cluster buffer** This routine is called when a cluster buffer is deleted, and no other* mbuf clusters share the buffer space.  This routine calls the user free* routine connected in _mbufInsertBuf(), then pushes the buffer decsriptor* back onto the desc free list.** RETURNS:* N/A** NOMANUAL*/LOCAL void _mbufBufFree    (    MBUF_DESC		mbufDesc,	/* desc of mbuf to free */    VOIDFUNCPTR		freeRtn,	/* user free routine */    int			freeArg		/* argument to free routine */    )    {    int			lockKey;		/* int lock cookie */    if (freeRtn != NULL)			/* call free rtn if present */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡一区二区在线| 欧美在线观看视频一区二区 | 精品免费国产一区二区三区四区| 欧美亚洲综合色| 欧美亚洲一区二区三区四区| 色8久久人人97超碰香蕉987| 91成人网在线| 在线综合视频播放| 欧美大片免费久久精品三p| ww亚洲ww在线观看国产| 亚洲国产精品ⅴa在线观看| 亚洲摸摸操操av| 爽好久久久欧美精品| 性做久久久久久免费观看| 麻豆精品国产91久久久久久| 国产成人在线免费观看| 色综合一区二区| 精品1区2区在线观看| 国产精品高清亚洲| 男男gaygay亚洲| 不卡影院免费观看| 欧美不卡123| 亚洲一二三区不卡| 国产成人免费av在线| 911精品国产一区二区在线| 久久亚洲精华国产精华液| 国产精品久久久久久久岛一牛影视 | 欧美国产日韩在线观看| 亚洲高清免费观看| 国产91精品欧美| 日韩色在线观看| 亚洲高清在线视频| 91色porny| 中文字幕不卡在线观看| 精品在线视频一区| 在线综合亚洲欧美在线视频| 亚洲欧美成aⅴ人在线观看| 国产ts人妖一区二区| 精品久久久网站| 麻豆国产一区二区| 精品国产污污免费网站入口| 日韩中文字幕区一区有砖一区| 色综合久久六月婷婷中文字幕| 国产精品色婷婷| 成人免费毛片高清视频| 在线成人免费视频| 久久伊人蜜桃av一区二区| 一区二区三区中文免费| 91在线国内视频| 日韩欧美视频在线| 大美女一区二区三区| 国产精品麻豆视频| 日本不卡123| jvid福利写真一区二区三区| 欧美电影免费观看高清完整版 | 亚洲精品一区二区精华| 中文字幕一区视频| 捆绑紧缚一区二区三区视频 | 欧美色图激情小说| 欧美激情在线观看视频免费| 奇米一区二区三区av| 99视频在线精品| 欧美精品一区二区三区蜜桃| 国产专区欧美精品| 欧美大片在线观看| 免费观看久久久4p| 91精品国产欧美一区二区成人| 一区二区三区在线看| 欧美日韩国产美女| 午夜久久久久久电影| 欧美日韩在线直播| 亚洲一区二区av在线| 色综合视频在线观看| 日本va欧美va瓶| 日韩三级免费观看| 奇米影视一区二区三区| 欧美一区欧美二区| 美女视频免费一区| 日韩一区在线播放| 91国在线观看| 亚洲bt欧美bt精品| 日韩视频在线一区二区| 国产精品911| 蜜臀av一区二区在线观看 | 成人午夜av在线| 国产精品毛片a∨一区二区三区| 成人在线视频首页| 日本vs亚洲vs韩国一区三区| 欧美成人高清电影在线| 国产精品91一区二区| 亚洲精选视频在线| 91精品福利在线一区二区三区| 色偷偷久久一区二区三区| 亚洲成人av一区二区| 日韩女优av电影在线观看| 成人毛片在线观看| 午夜国产不卡在线观看视频| 亚洲另类在线视频| 日韩欧美久久一区| 色婷婷av一区二区三区gif| 日韩激情av在线| 国产欧美视频在线观看| 久久久久久久国产精品影院| 欧美丝袜自拍制服另类| 国模套图日韩精品一区二区 | 久久成人av少妇免费| 亚洲欧美经典视频| 亚洲综合男人的天堂| 久久亚洲影视婷婷| 九色|91porny| 日韩一区二区免费在线观看| 久久精品国产一区二区| 一级特黄大欧美久久久| 日韩免费电影一区| 欧美日韩国产大片| 欧洲一区二区av| av电影在线观看一区| 国产成人在线网站| 色94色欧美sute亚洲线路二| 国产精品1区2区3区在线观看| 天天影视色香欲综合网老头| 国产欧美精品日韩区二区麻豆天美| 在线精品视频一区二区三四| 99久久久精品| 99久久伊人网影院| 成人一区在线看| 久久精品国产免费| 成人精品视频一区二区三区 | 亚洲影视在线播放| 亚洲综合在线第一页| 亚洲免费色视频| 中文字幕一区二| 美女爽到高潮91| 国产精品亚洲人在线观看| 国产一区视频导航| av在线一区二区| 精品成人佐山爱一区二区| 日韩亚洲欧美在线观看| 精品av久久707| 日韩理论片网站| 国产综合色产在线精品| 国产精一品亚洲二区在线视频| 国内偷窥港台综合视频在线播放| 国产在线播放一区三区四| 欧美三区在线视频| 欧美电影免费观看高清完整版在 | 欧美一卡二卡在线观看| 精品国产乱码久久久久久老虎| 日本一区二区三区久久久久久久久不| 亚洲小说春色综合另类电影| 日韩av中文在线观看| 丁香另类激情小说| 欧美美女黄视频| 欧美xxx久久| 成人欧美一区二区三区1314| 中文字幕一区二区三区在线观看| 一区二区三区不卡视频在线观看| 日韩成人一区二区| 欧美日韩免费视频| 亚洲国产精品成人综合| 亚洲成人自拍一区| 高清shemale亚洲人妖| 国产欧美日韩在线观看| 亚洲v中文字幕| 99精品一区二区| 亚洲精品一区二区三区在线观看| 亚洲精品久久久久久国产精华液| 美国十次了思思久久精品导航| 丁香桃色午夜亚洲一区二区三区| 欧美视频一区二区在线观看| 国产精品美女久久久久av爽李琼| 成人晚上爱看视频| 久久天堂av综合合色蜜桃网| 天天综合天天综合色| 欧美乱妇23p| 亚洲成人激情综合网| 国产成人免费在线观看不卡| 欧美mv日韩mv亚洲| 成人av在线观| 91精品久久久久久久99蜜桃| 亚洲激情欧美激情| 色悠悠久久综合| 亚洲综合色自拍一区| 欧美v国产在线一区二区三区| 天天综合网 天天综合色| 一区二区日韩av| 蜜桃av一区二区三区| 国产亚洲一区字幕| 国产成人在线网站| 国产精品女主播av| 国产 欧美在线| 日本不卡一区二区三区高清视频| 欧美日韩成人高清| 另类欧美日韩国产在线| 精品1区2区在线观看| 欧美日韩日本视频| 精品一区二区三区在线视频| 中文久久乱码一区二区| 欧美一级夜夜爽| 国精品**一区二区三区在线蜜桃|