亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日本一道高清亚洲日美韩| 亚洲成av人片一区二区| 国产精品久久777777| 亚洲欧洲成人av每日更新| 亚洲精品日日夜夜| 极品销魂美女一区二区三区| 国产精品一区一区三区| 日本高清成人免费播放| 日韩一区二区三区精品视频 | 一区二区激情视频| 免费观看在线综合色| 91黄色在线观看| 久久综合九色综合97婷婷| 亚洲精品乱码久久久久久久久| 日韩色视频在线观看| 丁香五精品蜜臀久久久久99网站| 一本在线高清不卡dvd| www国产成人免费观看视频 深夜成人网| 日韩一区有码在线| 风间由美一区二区三区在线观看| 欧美日韩在线免费视频| 亚洲少妇30p| 福利一区二区在线观看| 国产欧美日本一区二区三区| 日韩电影在线免费| 制服丝袜成人动漫| 免费在线欧美视频| 91在线一区二区三区| 99久久国产综合色|国产精品| 日本精品裸体写真集在线观看 | 在线观看日韩电影| 日韩成人免费在线| 欧美猛男男办公室激情| 亚洲精品日韩一| 欧美日韩中字一区| 亚州成人在线电影| 欧美刺激午夜性久久久久久久| 亚洲一二三区在线观看| 欧美久久久久久久久| 偷拍亚洲欧洲综合| 欧美大片一区二区| 国产aⅴ精品一区二区三区色成熟| 国产日本一区二区| 欧美性色欧美a在线播放| 亚洲视频免费在线观看| 色噜噜狠狠一区二区三区果冻| 亚洲精品写真福利| 欧美一区二区女人| 国模套图日韩精品一区二区| 久久九九久精品国产免费直播| k8久久久一区二区三区| 午夜久久久久久久久久一区二区| 欧美精品v日韩精品v韩国精品v| 日韩在线一二三区| 精品福利一区二区三区| 91麻豆成人久久精品二区三区| 亚洲成人免费视| 国产精品无人区| 精品蜜桃在线看| 色吊一区二区三区 | 中文字幕在线观看不卡| 777奇米成人网| 欧美亚一区二区| 粉嫩欧美一区二区三区高清影视| 亚洲国产一区二区a毛片| 日本一区二区三区在线不卡| 日韩免费观看2025年上映的电影| 91福利视频在线| 色天使久久综合网天天| 成人在线综合网| 国产乱色国产精品免费视频| 蓝色福利精品导航| 久久国产精品99久久久久久老狼| 日本成人在线网站| 日韩精品久久久久久| 亚洲国产一区二区a毛片| 亚洲国产中文字幕| 亚洲成人激情自拍| 麻豆视频一区二区| 国产一区在线精品| 国产精品小仙女| 91原创在线视频| 男人的天堂久久精品| 婷婷中文字幕一区三区| 麻豆精品精品国产自在97香蕉| 亚洲国产成人av网| 日韩国产在线观看一区| 丝袜美腿亚洲一区| 久久99精品国产.久久久久久 | 色88888久久久久久影院按摩| 91捆绑美女网站| 8v天堂国产在线一区二区| 欧美久久久久久久久| 日韩精品一区二区三区中文精品| 26uuu另类欧美亚洲曰本| 综合色中文字幕| 日本人妖一区二区| 波波电影院一区二区三区| 欧美日韩一区小说| 国产亚洲婷婷免费| 视频在线观看91| 99视频超级精品| 久久先锋影音av鲁色资源网| 亚洲精品欧美二区三区中文字幕| 另类小说色综合网站| 97精品国产97久久久久久久久久久久 | 91高清视频在线| 中文一区二区在线观看| 亚洲综合无码一区二区| 美女视频黄免费的久久| 91视频在线观看| 777a∨成人精品桃花网| 26uuu精品一区二区在线观看| 国产精品妹子av| 亚欧色一区w666天堂| 韩国av一区二区三区在线观看| 色av成人天堂桃色av| 欧美激情一区不卡| 成人激情小说网站| 国产欧美日本一区视频| 久久aⅴ国产欧美74aaa| 日韩欧美国产午夜精品| 午夜精品视频在线观看| 欧美视频在线不卡| 亚洲综合色在线| 91猫先生在线| 中文乱码免费一区二区| 91亚洲大成网污www| 中文字幕国产一区二区| 黑人巨大精品欧美一区| 国产午夜亚洲精品不卡| 成人性色生活片| 中文字幕人成不卡一区| 国产福利一区二区三区视频| 26uuu国产在线精品一区二区| 韩国欧美国产1区| 亚洲日本中文字幕区| 欧美日韩一区二区欧美激情| 另类小说色综合网站| 国产精品欧美一级免费| 不卡的av电影在线观看| 亚洲电影在线播放| 久久日一线二线三线suv| 色88888久久久久久影院按摩| 秋霞电影一区二区| 亚洲婷婷在线视频| 久久久久久久久久久黄色| 99re视频精品| 另类小说图片综合网| 亚洲欧洲日韩在线| 3d动漫精品啪啪| 国产精品一区二区在线观看不卡| √…a在线天堂一区| 精品视频色一区| 日本欧美肥老太交大片| 日韩欧美电影在线| 色欧美88888久久久久久影院| 国产在线看一区| 日本vs亚洲vs韩国一区三区二区 | 不卡一区二区中文字幕| 精品影视av免费| 日本不卡中文字幕| 亚洲欧美日韩国产综合| 中文字幕免费不卡| 国产亚洲美州欧州综合国| 3d成人h动漫网站入口| 欧美老人xxxx18| 日韩欧美一级在线播放| 日韩一二在线观看| 日韩手机在线导航| 中文字幕一区二区三区不卡| 欧美日韩专区在线| 99在线热播精品免费| av不卡在线观看| 国产精品亚洲а∨天堂免在线| 奇米影视在线99精品| 奇米777欧美一区二区| 日本视频在线一区| 亚洲成人资源网| 免费成人你懂的| 国产精品中文字幕欧美| 成人久久视频在线观看| 91香蕉视频mp4| 欧美一区二区三区公司| 久久婷婷久久一区二区三区| 亚洲女与黑人做爰| 日本午夜精品视频在线观看 | 成人高清免费观看| 色悠悠亚洲一区二区| 欧美日韩国产免费| 中文字幕巨乱亚洲| 亚洲精品国久久99热| 国产老肥熟一区二区三区| 欧美性生交片4| 久久精品欧美一区二区三区不卡| 国产精品看片你懂得| 亚洲精品国产无天堂网2021| 国产成人午夜电影网| 欧美一区二区三区爱爱| 国产蜜臀av在线一区二区三区|