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

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

?? mbuflib.c

?? vxwork源代碼
?? 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一区二区三区免费野_久草精品视频
欧美亚洲动漫另类| 91精品国产综合久久福利| av综合在线播放| 欧美日韩国产另类一区| 中文一区二区完整视频在线观看| 亚洲午夜精品17c| 成人国产精品免费观看视频| 91精选在线观看| 一区二区三区免费看视频| 韩国精品久久久| 精品视频1区2区3区| 亚洲欧洲日产国码二区| 精品一区二区综合| 555夜色666亚洲国产免| 夜夜嗨av一区二区三区四季av | 五月综合激情网| 成人开心网精品视频| 精品国产三级a在线观看| 天天影视色香欲综合网老头| 色呦呦国产精品| 中文字幕一区在线观看视频| 国产精品亚洲午夜一区二区三区| 日韩一级在线观看| 日本不卡一区二区| 宅男在线国产精品| 日韩中文字幕91| 欧美三级资源在线| 亚洲一区中文日韩| 色综合网色综合| 亚洲精品国产无套在线观| 97超碰欧美中文字幕| 国产人成一区二区三区影院| 国产精品69久久久久水密桃| 国产欧美日韩一区二区三区在线观看| 另类欧美日韩国产在线| 久久综合久久综合久久| 图片区小说区区亚洲影院| 在线观看91av| 麻豆视频一区二区| 亚洲精品一区二区三区四区高清| 久久99精品国产91久久来源| 久久综合一区二区| 丁香另类激情小说| 亚洲欧美经典视频| 欧美一a一片一级一片| 天天色综合成人网| 精品sm在线观看| 成人a级免费电影| 亚洲精品精品亚洲| 欧美一区二区三区四区视频| 日本不卡高清视频| 久久综合丝袜日本网| 99精品国产视频| 亚欧色一区w666天堂| 欧美va亚洲va| 成人福利视频在线看| 亚洲一区二区不卡免费| 制服丝袜国产精品| 国产福利精品一区二区| 亚洲视频1区2区| 欧美人与禽zozo性伦| 国产原创一区二区三区| 综合亚洲深深色噜噜狠狠网站| 欧美日韩激情在线| 国模套图日韩精品一区二区| 欧美韩国日本综合| 欧美日韩一卡二卡三卡| 狠狠色丁香婷婷综合| 中文字幕亚洲精品在线观看| 欧美夫妻性生活| 成人app软件下载大全免费| 亚洲图片欧美综合| 国产亚洲精品bt天堂精选| 在线精品视频一区二区三四 | 一区二区三区四区av| 欧美一区二区精品在线| 成人午夜视频免费看| 日韩精品一级二级 | 精品少妇一区二区三区在线视频| 豆国产96在线|亚洲| 亚洲一区二区三区自拍| 亚洲精品一区二区三区精华液| 91啦中文在线观看| 美女久久久精品| 亚洲美女淫视频| 国产丝袜美腿一区二区三区| 欧美老人xxxx18| 91原创在线视频| 国产一区二区三区| 日韩精品一卡二卡三卡四卡无卡| 亚洲乱码国产乱码精品精98午夜| 久久久激情视频| 欧美一区二区在线视频| 色综合久久88色综合天天免费| 国模套图日韩精品一区二区| 日韩一区精品视频| 亚洲国产精品视频| 国产精品污污网站在线观看| 精品国产人成亚洲区| 久久九九久久九九| 欧美一区二区视频在线观看2020 | 日韩中文字幕亚洲一区二区va在线| 亚洲人成影院在线观看| 亚洲国产精品激情在线观看| 精品理论电影在线观看 | 欧美撒尿777hd撒尿| 99久久99久久精品国产片果冻 | 欧美日韩国产一区二区三区地区| 91丨九色porny丨蝌蚪| 国产ts人妖一区二区| 国产一区二区在线观看视频| 久久国产成人午夜av影院| 日韩不卡一区二区| 日韩av中文字幕一区二区三区| 午夜电影网亚洲视频| 日日夜夜免费精品视频| 日韩高清不卡在线| 日韩成人免费电影| 美腿丝袜亚洲综合| 久久国产欧美日韩精品| 黑人巨大精品欧美一区| 国产精品18久久久久久久网站| 国产一区二区三区在线观看精品| 久久国产免费看| 国产精品一区二区三区99| 韩日欧美一区二区三区| 成人深夜在线观看| 91麻豆福利精品推荐| 欧美在线啊v一区| 在线播放91灌醉迷j高跟美女| 91精品国产综合久久精品图片| 9191久久久久久久久久久| 精品国产污网站| 中文字幕中文字幕中文字幕亚洲无线| 国产精品久久久久影院| 亚洲激情图片一区| 亚洲成人免费av| 免费xxxx性欧美18vr| 国产精品夜夜爽| 色婷婷av一区| 欧美一级欧美三级| 亚洲国产成人自拍| 亚洲国产欧美日韩另类综合| 美女精品自拍一二三四| av电影在线观看一区| 欧美久久久久久蜜桃| 26uuu国产一区二区三区| 综合电影一区二区三区| 亚洲午夜日本在线观看| 看电影不卡的网站| 91伊人久久大香线蕉| 3d成人动漫网站| 欧美国产97人人爽人人喊| 亚洲在线观看免费视频| 激情文学综合网| 在线中文字幕不卡| 精品电影一区二区| 亚洲精品高清视频在线观看| 激情五月播播久久久精品| 欧美日韩一区三区| 欧美激情一区不卡| 午夜欧美电影在线观看| 国产成人av影院| 欧美剧在线免费观看网站| 日本一区二区三区dvd视频在线| 亚洲一卡二卡三卡四卡无卡久久| 国产精品综合一区二区| 欧美三级乱人伦电影| 国产精品国产自产拍高清av王其| 青青草一区二区三区| 一本久道久久综合中文字幕 | 亚洲欧美日韩在线| 蜜臀av性久久久久av蜜臀妖精| 99久久久精品免费观看国产蜜| 日韩欧美一二区| 亚洲已满18点击进入久久| 国产成人精品一区二区三区四区| 欧美精品三级日韩久久| 欧美国产精品劲爆| 亚洲一区二区3| 99久久精品国产一区二区三区| xnxx国产精品| 日日摸夜夜添夜夜添国产精品 | 国产成人av一区二区三区在线观看| 欧美狂野另类xxxxoooo| 亚洲男人天堂av网| av电影天堂一区二区在线观看| 精品成人a区在线观看| 麻豆成人免费电影| 日韩一区国产二区欧美三区| 亚洲成人av福利| 欧美日韩一区成人| 午夜精品久久久久久| 欧美性猛交一区二区三区精品| 亚洲精品免费视频| 色呦呦国产精品| 一区二区三区中文字幕| 91官网在线免费观看| 一区二区三区中文字幕| 在线观看不卡视频|