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

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

?? nfsdrv.c

?? Tornado平臺下
?? 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一区二区三区免费野_久草精品视频
国产精品少妇自拍| 亚洲成人午夜电影| 国产精品亚洲视频| 日韩丝袜情趣美女图片| 爽好久久久欧美精品| 欧美日韩在线电影| 一区二区激情小说| 91久久久免费一区二区| 伊人一区二区三区| 在线视频国内一区二区| 亚洲精品综合在线| 日本久久电影网| 一区二区三区四区不卡视频| 色婷婷久久久久swag精品 | 国产精品欧美综合在线| 国产在线精品视频| 久久久精品国产免大香伊| 狠狠狠色丁香婷婷综合激情| 久久亚区不卡日本| 国产又黄又大久久| 国产视频一区二区三区在线观看| 国产精品99久久久久久有的能看| 久久蜜桃av一区精品变态类天堂| 国产精品88av| 国产精品久久三区| 91一区在线观看| 亚洲精品一二三区| 欧美日韩中文另类| 青青草国产成人av片免费| 欧美电视剧在线观看完整版| 蜜桃精品视频在线| 国产婷婷色一区二区三区四区 | 日韩欧美一二三区| 激情五月激情综合网| 国产欧美精品一区二区色综合 | 久久精品国产第一区二区三区 | 欧美日韩一卡二卡| 美女网站一区二区| 久久久精品黄色| 91色porny在线视频| 亚洲国产精品久久久久婷婷884| 在线不卡a资源高清| 国内外成人在线视频| 国产精品美女久久久久久久网站| 一本色道久久综合狠狠躁的推荐| 亚洲午夜在线电影| 日韩欧美国产高清| 成人免费看视频| 亚洲午夜精品17c| 精品粉嫩aⅴ一区二区三区四区| 丁香婷婷综合激情五月色| 亚洲乱码国产乱码精品精98午夜 | 麻豆视频观看网址久久| 欧美成va人片在线观看| 国产黄色精品网站| 亚洲老司机在线| 精品免费视频一区二区| 成人av电影在线观看| 亚洲成人激情社区| 久久久亚洲综合| 色嗨嗨av一区二区三区| 麻豆国产精品视频| 亚洲欧美在线观看| 91精品国产欧美一区二区18| 国产91丝袜在线18| 午夜久久久久久久久| 精品亚洲aⅴ乱码一区二区三区| 国产欧美中文在线| 欧美日韩一级视频| 国产99精品国产| 午夜久久电影网| 亚洲国产高清在线观看视频| 欧美色倩网站大全免费| 国产精品996| 日本一道高清亚洲日美韩| 国产欧美一区二区精品性色超碰| 欧美日韩中文字幕一区二区| 国产成人免费9x9x人网站视频| 亚洲国产美国国产综合一区二区| 精品粉嫩aⅴ一区二区三区四区| 色久优优欧美色久优优| 激情伊人五月天久久综合| 一区二区三区精密机械公司| 久久精子c满五个校花| 欧美丰满高潮xxxx喷水动漫| 成人久久18免费网站麻豆| 日韩精品乱码av一区二区| 亚洲色图在线视频| 久久久久久久免费视频了| 欧美日韩二区三区| 成人av电影在线播放| 麻豆中文一区二区| 亚洲一区二区三区中文字幕在线| 国产欧美一区视频| 欧美大肚乱孕交hd孕妇| 欧美视频一区二区三区四区 | 成人性生交大片免费看在线播放| 五月天欧美精品| 亚洲精品美腿丝袜| 国产色产综合产在线视频| 欧美一级日韩免费不卡| 欧美中文字幕久久| 不卡在线观看av| 韩国欧美国产1区| 五月天视频一区| 亚洲国产日日夜夜| 日韩一区日韩二区| 中文字幕巨乱亚洲| 久久综合九色综合欧美98| 91精品国产91久久久久久一区二区| 一本色道久久加勒比精品| 成人黄色软件下载| 国产精品69毛片高清亚洲| 久久99热这里只有精品| 日韩国产欧美在线播放| 亚洲一区二区精品3399| 亚洲欧美日韩国产中文在线| 中文一区一区三区高中清不卡| 精品久久久久久亚洲综合网 | 日本一区二区动态图| 亚洲精品一区二区三区蜜桃下载 | 亚洲成年人影院| 一区二区三区电影在线播| 最新久久zyz资源站| 欧美国产精品一区| 国产日产精品1区| 国产亚洲欧美在线| 久久只精品国产| 久久久久国产精品麻豆| 欧美电影免费观看高清完整版在线 | 欧美卡1卡2卡| 欧美视频在线不卡| 欧美日韩成人综合| 欧美日韩精品一区二区在线播放| 欧美亚洲国产一区二区三区 | 91精品国产综合久久久久久久 | 青青草国产成人av片免费| 日韩成人一级片| 日本美女一区二区三区视频| 日韩精品每日更新| 麻豆中文一区二区| 精品一区二区三区日韩| 激情六月婷婷久久| 国产一区二区中文字幕| 国产精品一区二区在线观看网站| 国产a视频精品免费观看| 成人福利视频在线看| 96av麻豆蜜桃一区二区| 日本高清不卡一区| 欧美日韩国产乱码电影| 日韩精品中文字幕在线不卡尤物 | 欧美精品vⅰdeose4hd| 7878成人国产在线观看| 欧美成人午夜电影| 久久精品欧美日韩精品| 亚洲欧美综合在线精品| 夜夜精品视频一区二区| 日韩国产精品久久久久久亚洲| 美女一区二区三区在线观看| 国产精品白丝jk黑袜喷水| 97精品国产露脸对白| 欧美三级韩国三级日本一级| 91精品国产色综合久久| 国产亚洲美州欧州综合国| 成人免费在线观看入口| 午夜视频一区在线观看| 紧缚捆绑精品一区二区| 91在线云播放| 欧美二区三区91| 久久精品一区二区三区不卡| 亚洲人成人一区二区在线观看 | 亚洲色图丝袜美腿| 亚洲永久免费视频| 久久国产剧场电影| www.一区二区| 制服丝袜亚洲色图| 国产欧美精品一区aⅴ影院| 一区二区三区成人| 免费亚洲电影在线| 成人免费看黄yyy456| 欧美天天综合网| 久久久久国产精品免费免费搜索| 亚洲精品一卡二卡| 狠狠色丁香婷婷综合| 一本色道久久综合亚洲精品按摩| 3d成人动漫网站| 中文字幕一区三区| 午夜精品一区二区三区三上悠亚| 国产乱人伦精品一区二区在线观看| 色欧美乱欧美15图片| 日韩免费看的电影| 亚洲色图视频网站| 国产在线一区二区| 欧美图区在线视频| 国产午夜亚洲精品不卡| 亚洲成在线观看| 成人动漫av在线| 欧美成人精品1314www| 亚洲精品欧美二区三区中文字幕| 久久99精品久久久久久动态图 |