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

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

?? nfsdrv.c

?? vxworks操作系統源代碼_對于在vxworks環境下開發軟件的人員非常有用
?? C
?? 第 1 頁 / 共 4 頁
字號:
		nCacheRead = nfsFileRead (nfsFd->nfsDev->host,					  &nfsFd->fileHandle,					  nfsFd->fileCurByte, nfsCacheSize,					  nfsFd->cacheBuf, &nfsFd->fileAttr);		if (nCacheRead < 0)		    {		    semGive (nfsFd->nfsFdSem);		    return (ERROR);		    }		nfsFd->cacheCurByte = nfsFd->cacheBuf;	/* update cache ptrs */		nfsFd->cacheBytesLeft = nCacheRead;		nfsFd->cacheValid = TRUE;		/* cache is valid */		}	    /* read as many bytes as possible from what's left in the cache,	     * up to the amount requested	     */	    if (nfsFd->cacheBytesLeft > 0)		{		if (maxBytes - readCount < nfsFd->cacheBytesLeft)		    nRead = maxBytes - readCount;		else		    nRead = nfsFd->cacheBytesLeft;		/* copy bytes into user's buffer */		bcopy (nfsFd->cacheCurByte, (char *) ((int) buf + readCount),		       nRead);		/* update file pointer */		status = nfsSeek (nfsFd, (int) nfsFd->fileCurByte + nRead);		/* how many bytes have we read so far? */		readCount += nRead;		}	    else		break;		/* we've hit the end of the file */	    } /* while */	} /* else */    semGive (nfsFd->nfsFdSem);    return (status == ERROR ? ERROR : readCount);    }/********************************************************************************* nfsWrite - write bytes to remote file** nfsWrite copies the specified number of bytes from the buffer* to the nfs file.  Bytes are written starting at the current file pointer.* The file pointer is updated to point immediately after the last* character that was written.** A cache is used for keeping nfs network reads and writes down to a minimum.* If all goes well, the entire buffer is written to the cache and/or actual* file.** Called only by the I/O system.** SIDE EFFECTS: moves file pointer** RETURNS:*    Number of bytes written (error if != nBytes)*    ERROR if nBytes < 0, or nfs write is not successful*/LOCAL int nfsWrite    (    FAST NFS_FD *nfsFd, /* open file descriptor */    char *buf,          /* buffer being written from */    FAST int nBytes     /* number of bytes to write to file */    )    {    FAST unsigned int nWrite;	/* number of bytes to write */    FAST unsigned int newPos;	/* new position of file pointer */    unsigned int cacheMargin;	/* margin left in cache for writing */    int		nCacheRead;	/* number of bytes read into cache */    FAST char	*pBuf = buf;	/* ptr to spot in user's buffer */    FAST int	writeCount = 0;	/* number of bytes written so far */    /* check for valid number of bytes */    if (nBytes < 0)	{	errnoSet (S_nfsDrv_INVALID_NUMBER_OF_BYTES);	return (ERROR);	}    /* if file opened for O_RDONLY, don't write */    if (nfsFd->mode == O_RDONLY)	{	errnoSet (S_nfsDrv_READ_ONLY_CANNOT_WRITE);	return (ERROR);	}    semTake (nfsFd->nfsFdSem, WAIT_FOREVER);    /* do the write, until entire buffer has been written out */    if (nfsCacheSize == 0)	{	writeCount = nfsFileWrite (nfsFd->nfsDev->host, &nfsFd->fileHandle,			       nfsFd->fileCurByte, (unsigned) nBytes, buf,			       &nfsFd->fileAttr);	if (writeCount == ERROR)	    {	    semGive (nfsFd->nfsFdSem);	    return (ERROR);	    }	/* where will the new file pointer be? */	newPos = nfsFd->fileCurByte + writeCount;	/* update the file pointer.  */	if (nfsSeek (nfsFd, (int) newPos) == ERROR)	    {	    semGive (nfsFd->nfsFdSem);	    return (ERROR);	    }	}    else	{	while (writeCount < nBytes)	    {	    /* fill cache before writing to it, keep cache in sync w/file */	    if (!nfsFd->cacheValid)		{		if ((nBytes - writeCount) < nfsCacheSize)		    {		    nCacheRead = nfsFileRead (nfsFd->nfsDev->host,					      &nfsFd->fileHandle,					      nfsFd->fileCurByte,					      nfsCacheSize, nfsFd->cacheBuf,					      &nfsFd->fileAttr);		    if (nCacheRead < 0)			{			semGive (nfsFd->nfsFdSem);			return (ERROR);			}		    nfsFd->cacheBytesLeft = nCacheRead;		    }		else		    {		    nfsFd->cacheBytesLeft = nfsCacheSize;		    }		/* update cache pointers */		nfsFd->cacheCurByte = nfsFd->cacheBuf;		nfsFd->cacheDirty = FALSE;		nfsFd->cacheValid = TRUE;		}	    /* margin allowable for writing */	    cacheMargin = (unsigned) nfsFd->cacheBuf + nfsCacheSize			  - (unsigned) nfsFd->cacheCurByte;	    if (nBytes - writeCount < cacheMargin)		nWrite = nBytes - writeCount;	    else		nWrite = cacheMargin;	    /* copy the bytes into the cache */	    bcopy (pBuf, nfsFd->cacheCurByte, (int) nWrite);	    if (nWrite > nfsFd->cacheBytesLeft)		nfsFd->cacheBytesLeft = nWrite;	    /* cache has been written in, it is soiled */	    nfsFd->cacheDirty = TRUE;	    /* what's the new position of the file pointer? */	    newPos = nfsFd->fileCurByte + nWrite;	    /* if the new file pointer reaches past the end of the file,	     * the file has grown, update the size of the file	     */	    if (newPos > nfsFd->fileAttr.size)		nfsFd->fileAttr.size = newPos;	    /* update the file pointer.	     * any cache flushes will occur during the seek.	     */	    if (nfsSeek (nfsFd, (int) newPos) == ERROR)		{		semGive (nfsFd->nfsFdSem);		return (ERROR);		}	    writeCount += nWrite;	    pBuf += nWrite;	    } /* while entire buffer has not been written */	} /* else */    semGive (nfsFd->nfsFdSem);    return (writeCount);    }/********************************************************************************* nfsIoctl - do device specific control function** Called only by the I/O system.** RETURNS: whatever the called function returns*/LOCAL int nfsIoctl    (    FAST NFS_FD *nfsFd, /* open nfs file descriptor */    FAST int function,  /* function code */    FAST int arg        /* argument for function */    )    {    FAST struct stat *pStat;    int status = OK;    switch (function)	{	case FIOSYNC:	    semTake (nfsFd->nfsFdSem, WAIT_FOREVER);	    if (nfsFd->cacheDirty)		status = nfsCacheFlush (nfsFd);	    semGive (nfsFd->nfsFdSem);	    break;	case FIOSEEK:	    status = nfsSeek (nfsFd, arg);	    break;	case FIOWHERE:    	    status = nfsFd->fileCurByte;	    break;	case FIONREAD:    	    *((int *) arg) = nfsFd->fileAttr.size - nfsFd->fileCurByte;	    break;	case FIOREADDIR:	    /* read a directory entry */	    status = nfsDirReadOne (nfsFd->nfsDev->host, &nfsFd->fileHandle,				    (DIR *) arg);	    break;	case FIOFSTATGET:	    /* get status of a file */	    pStat = (struct stat *) arg;	    /* get file attributes returned in pStat */	    nfsFileAttrGet (&nfsFd->fileAttr, pStat);	    pStat->st_dev         = (ULONG) nfsFd->nfsDev;	    break;        case FIOFSTATFSGET:            status = nfsFsAttrGet(nfsFd->nfsDev->host, &nfsFd->fileHandle,                                  (struct statfs *)arg);            break;	case FIOGETFL:	    *((int *) arg) = nfsFd->mode;	    break;	    	default:	    errnoSet (S_ioLib_UNKNOWN_REQUEST);	    status = ERROR;	    break;	}    return (status);    }/********************************************************************************* nfsSeek - change file's current character position** This routine moves the file pointer by the offset to a new position.* If the new position moves the file pointer out of the range of what's* in the cache and the cache is dirty (i.e. the cache has been written* in), then the cache is written out to the nfs file and the cache is* marked as invalid.  If the new position is beyond EOF, then an empty* area is created that will read as zeros.** Called only by the I/O system.** RETURNS: OK | ERROR*/LOCAL int nfsSeek    (    FAST NFS_FD *nfsFd,    FAST int newPos    )    {    FAST int interval;    if (newPos < 0)	return (ERROR);    if (newPos == nfsFd->fileCurByte)	return (OK);    semTake (nfsFd->nfsFdSem, WAIT_FOREVER);    if (nfsFd->cacheValid)	/* if cache is valid, update cache pointer */	{	/* how far will file pointer be moved? */	interval = newPos - nfsFd->fileCurByte;	/* if the new pointer precedes what's in the cache,	 * OR if the new ptr points past what's in the cache,	 * OR if the new ptr points past the end of the valid cache bytes,	 * THEN the cache is no longer valid.	 *	 * NOTE:  The cache is still valid if the new pointer points	 * IMMEDIATELY after the valid bytes in the cache, but still	 * hasn't reached the end of the cache buffer.  The cache can	 * still be written to and should not be flushed until it is full	 * or the file is closed (a similar technique is used in some states	 * during drought conditions).	 */	if (((interval < 0) && (nfsFd->cacheCurByte + interval <				nfsFd->cacheBuf))	    || ((interval > 0) && (interval > nfsFd->cacheBytesLeft))	    || ((nfsFd->cacheBuf + nfsCacheSize) <= (nfsFd->cacheCurByte +						    interval)))	    {	    /* if the new cache pointer goes out of range of the cache,	     * mark the cache as invalid, and flush if necessary.	     */	    if (nfsFd->cacheDirty)		if (nfsCacheFlush (nfsFd) == ERROR)		    {		    semGive (nfsFd->nfsFdSem);		    return (ERROR);		    }	    nfsFd->cacheValid = FALSE;	    nfsFd->cacheBytesLeft = 0;	    nfsFd->cacheCurByte = nfsFd->cacheBuf;	    nfsFd->cacheDirty = FALSE;	    }	else	    {	    /* if the new position stays within range of the cache,	     * update the cache pointers.	     */	    nfsFd->cacheCurByte += interval;	    nfsFd->cacheBytesLeft -= interval;	    }	}    nfsFd->fileCurByte = newPos;    semGive (nfsFd->nfsFdSem);    return (OK);    }/********************************************************************************* nfsCacheFlush - flush the cache to the remote NFS file** Called only by the I/O system.** RETURNS: number of bytes written or ERROR*/LOCAL int nfsCacheFlush    (    FAST NFS_FD *nfsFd    )    {    int nWrite;		/* how many bytes are written with nfs? */    unsigned int offset;/* offset in the file where cache gets written */    unsigned int count;	/* number of bytes to write with nfs */    unsigned int dist;	/* distance between beginning of cache and current file			 * pointer (number of bytes) */    if (!nfsFd->cacheValid)	{	errnoSet (S_nfsDrv_FATAL_ERR_FLUSH_INVALID_CACHE);	return (ERROR);	}    dist   = nfsFd->cacheCurByte - nfsFd->cacheBuf;    offset = nfsFd->fileCurByte - dist;    count  = dist + nfsFd->cacheBytesLeft;    nWrite = nfsFileWrite (nfsFd->nfsDev->host, &nfsFd->fileHandle,			   offset, count, nfsFd->cacheBuf, &nfsFd->fileAttr);    return (nWrite);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国精品免费视频| 成人精品视频网站| 岛国一区二区在线观看| 欧美日韩国产精选| 亚洲欧美成aⅴ人在线观看| 久久国产视频网| 欧美日韩午夜在线视频| 国产精品久久久久久户外露出| 蜜臀av一级做a爰片久久| 色香蕉久久蜜桃| 久久久久久久久久久久久久久99 | 91精品国产91久久久久久一区二区 | 成人高清av在线| 日韩一级片网站| 亚洲国产wwwccc36天堂| 91老司机福利 在线| 欧美国产乱子伦 | 国产免费成人在线视频| 久久精品国产亚洲一区二区三区| 欧美日韩高清在线| 亚洲一区二区av在线| 一道本成人在线| 亚洲蜜桃精久久久久久久| 99久久夜色精品国产网站| 精品久久国产老人久久综合| 欧美乱妇23p| 久久在线免费观看| 久久精工是国产品牌吗| 日韩免费电影一区| 久久精品国产999大香线蕉| 欧美一卡二卡三卡四卡| 麻豆免费精品视频| 久久综合色天天久久综合图片| 奇米在线7777在线精品| 日韩西西人体444www| 理论片日本一区| 日韩久久久精品| 国产一区二区三区av电影 | 国产激情视频一区二区三区欧美 | 久久亚洲欧美国产精品乐播| 国产在线国偷精品产拍免费yy | aa级大片欧美| 日韩欧美激情四射| 狠狠色丁香婷婷综合久久片| 2020国产精品| 成人精品高清在线| 亚洲日本韩国一区| 欧美日韩一区 二区 三区 久久精品 | 亚洲一区二区三区四区五区中文| 欧美三级乱人伦电影| 日精品一区二区| 久久久美女毛片| av亚洲精华国产精华| 亚洲午夜一二三区视频| 日韩一区二区精品| 大尺度一区二区| 一区二区三区视频在线看| 欧美一三区三区四区免费在线看| 韩国av一区二区三区四区| 中文字幕av不卡| 欧美午夜精品久久久| 裸体一区二区三区| 国产不卡一区视频| 97久久超碰国产精品电影| 欧美精品一区二区久久久| 丁香六月综合激情| 一区二区三区中文字幕在线观看| 欧美猛男gaygay网站| 国产精品123| 亚洲一区二区视频| 久久综合色综合88| 欧美影视一区在线| 国产a精品视频| 亚洲成av人在线观看| 国产精品三级电影| 欧美一区二区三区在| gogo大胆日本视频一区| 蜜臀久久99精品久久久久久9| 国产精品欧美一区二区三区| 欧美在线999| 国产成人免费9x9x人网站视频| 偷拍一区二区三区| 亚洲人成网站影音先锋播放| 精品日韩99亚洲| 欧美视频一区在线观看| 国产激情一区二区三区桃花岛亚洲| 亚洲第一主播视频| 亚洲男人电影天堂| 日本一区二区免费在线| 日韩欧美一区二区免费| 在线亚洲免费视频| 一本到一区二区三区| 成人做爰69片免费看网站| 久草在线在线精品观看| 亚洲成人资源在线| 亚洲一区二区三区四区五区黄| 国产精品久久久一区麻豆最新章节| 精品国产自在久精品国产| 欧美精品aⅴ在线视频| 在线看一区二区| 色网站国产精品| 99久久亚洲一区二区三区青草| 国产乱色国产精品免费视频| 麻豆精品在线看| 热久久久久久久| 婷婷久久综合九色国产成人| 亚洲午夜激情网页| 亚洲曰韩产成在线| 亚洲在线视频网站| 亚洲高清视频在线| 婷婷一区二区三区| 全部av―极品视觉盛宴亚洲| 亚洲国产综合人成综合网站| 亚洲三级在线观看| 在线视频国内自拍亚洲视频| 色哟哟国产精品| 在线观看亚洲一区| 欧美日韩一区高清| 欧美日韩一区二区三区四区| 精品视频一区 二区 三区| 欧美高清视频一二三区| 日韩一区二区三| 国产亚洲综合性久久久影院| 国产欧美视频在线观看| 亚洲国产精品高清| 亚洲精品美国一| 亚洲一区二区三区四区在线免费观看 | 成人教育av在线| 99国产精品久| 欧美性生活影院| 欧美一区二区在线视频| 精品国产一二三区| 国产精品欧美一级免费| 亚洲一区二区av在线| 日韩电影在线免费| 国产成人精品影视| 91久久精品一区二区三| 欧美高清视频www夜色资源网| 日韩欧美在线影院| 亚洲国产精品成人综合色在线婷婷| 亚洲婷婷综合久久一本伊一区| 亚洲综合激情网| 久久9热精品视频| 99久久精品国产毛片| 制服丝袜在线91| 中文字幕av不卡| 天天做天天摸天天爽国产一区| 国产在线播放一区二区三区| 91免费在线看| 久久嫩草精品久久久精品一| 亚洲精品伦理在线| 激情图区综合网| 色综合视频在线观看| 日韩欧美国产电影| 亚洲免费大片在线观看| 久久精品国产免费看久久精品| 99精品视频一区二区三区| 欧美一区二区免费| 亚洲欧美日韩成人高清在线一区| 美女高潮久久久| 在线看不卡av| 中文字幕乱码久久午夜不卡| 日日摸夜夜添夜夜添国产精品| 成av人片一区二区| 精品伦理精品一区| 亚洲va欧美va人人爽| 成人av在线资源| 久久在线观看免费| 日韩欧美第一区| 日本美女一区二区| 国产成人午夜精品5599| 狠狠色丁香久久婷婷综合_中 | 狠狠色综合日日| 在线亚洲欧美专区二区| 中文字幕免费不卡| 国产一区在线不卡| 日韩免费观看2025年上映的电影| 亚洲欧美激情视频在线观看一区二区三区 | 91理论电影在线观看| 亚洲国产精品黑人久久久| 久久精品999| 日韩欧美不卡在线观看视频| 亚洲国产精品久久一线不卡| 91在线视频观看| 国产精品久久夜| 成人免费看黄yyy456| 国产女人18毛片水真多成人如厕 | 香港成人在线视频| 欧美伊人久久久久久午夜久久久久| 国产精品电影院| 不卡视频在线看| 亚洲色图另类专区| 成人夜色视频网站在线观看| 国产日本一区二区| 国产高清在线精品| 国产精品久久夜| youjizz久久| 亚洲色图在线视频| 色欧美88888久久久久久影院| 亚洲男人的天堂一区二区|