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

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

?? ramdiskcbio.c

?? vxworks的完整的源代碼
?? C
字號:
/* ramDiskCbio.c - RAM Disk Cached Block Driver *//* Copyright 1998-2002 Wind River Systems, Inc. *//*modification history--------------------01j,12dec01,jkf  fixing diab build warnings01i,09dec01,jkf  SPR#71637, fix for SPR#68387 caused ready changed bugs.01h,30jul01,jkf  SPR#69031, common code for both AE & 5.x.01g,14jun01,jyo  SPR#67729: Updating blkSubDev, cbioSubDev, isDriver in                 ramDiskDevCreate().01f,19apr00,dat  doc fixes01e,29feb00,jkf  T3 changes01d,31aug99,jkf  CBIO API changes01c,31jul99,jkf  T2 merge, tidiness & spelling.01b,07jun98,lrn  re-integration, doc01a,15jan98,lrn  written, preliminary*//*DESCRIPTIONThis module implements a RAM-disk driver with a CBIO interfacewhich can be directly utilized by dosFsLib without the use of the Disk Cache module dcacheCbio.  This results in anultra-compact RAM footprint.  This module is implemented using the CBIO API (see cbioLib())This module is delivered in source as a functional example of a basic CBIO module.CAVEATThis module may be used for SRAM or other non-volatile RAM cards to store a file system, but that configuration will be susceptibleto data corruption in events of system failure which are not normallyobserved with magnetic disks, i.e. using this driver with an SRAM cardcan not guard against interruptions in midst of updating a particularsector, resulting in that sector become internally inconsistent.SEE ALSOdosFsLib, cbioLib*//* includes */#include "vxWorks.h"#include "stdlib.h"#include "semLib.h"#include "ioLib.h"#include "string.h"#include "errno.h"#include "assert.h"#include "private/dosFsVerP.h"#include "private/cbioLibP.h" /* only CBIO modules may include this file */#include "ramDiskCbio.h"/* Implementation dependent fields */#define	cbioBlkShift	cbioPriv0extern void logMsg( const char *fmt, ... );LOCAL STATUS ramDiskBlkRW    (    CBIO_DEV_ID		dev,    block_t		startBlock,    block_t		numBlocks,    addr_t		buffer,    CBIO_RW		rw,    cookie_t		*pCookie    );LOCAL STATUS ramDiskBytesRW    (    CBIO_DEV_ID 	dev,    block_t		startBlock,    off_t		offset,    addr_t		buffer,    size_t		nBytes,    CBIO_RW		rw,    cookie_t		*pCookie    );LOCAL STATUS ramDiskBlkCopy    (    CBIO_DEV_ID 	dev,    block_t		srcBlock,    block_t		dstBlock,    block_t		numBlocks    );LOCAL STATUS ramDiskIoctl    (    CBIO_DEV_ID	dev,    UINT32	command,    addr_t	arg    );/* CBIO_FUNCS, one per cbio driver */LOCAL CBIO_FUNCS cbioFuncs = {(FUNCPTR) ramDiskBlkRW,			      (FUNCPTR) ramDiskBytesRW,			      (FUNCPTR) ramDiskBlkCopy,			      (FUNCPTR) ramDiskIoctl};int ramDiskDebug = 0;#define	INFO_MSG	logMsg#define	DEBUG_MSG	if(ramDiskDebug) logMsg/********************************************************************************* ramDiskBlkRW - Read/Write blocks* * This routine transfers between a user buffer and the lower layer hardware* It is optimized for block transfers.  ** dev - the CBIO handle of the device being accessed (from creation routine)* * startBlock - the starting block of the transfer operation* * numBlocks - the total number of blocks to transfer* * buffer - address of the memory buffer used for the transfer* * rw - indicates the direction of transfer up or down (READ/WRITE)* * *pCookie - pointer to cookie used by upper layer such as dosFsLib(),* it should be preserved.** RETURNS OK or ERROR and may otherwise set errno.**/LOCAL STATUS ramDiskBlkRW    (    CBIO_DEV_ID		dev,    block_t		startBlock,    block_t		numBlocks,    addr_t		buffer,    CBIO_RW		rw,    cookie_t		*pCookie    )    {    CBIO_DEV *	pDev = (void *) dev ;    caddr_t 	pStart;    size_t 	nBytes ;    if( TRUE == CBIO_READYCHANGED (dev) )	{	errno = S_ioLib_DISK_NOT_PRESENT ;	return ERROR;	}    if( (startBlock) > pDev->cbioParams.nBlocks ||    	(startBlock+numBlocks) > pDev->cbioParams.nBlocks )	return ERROR;    startBlock += pDev->cbioParams.blockOffset;    pStart = pDev->cbioMemBase + ( startBlock << pDev->cbioBlkShift ) ;    nBytes = numBlocks << pDev->cbioBlkShift ;    DEBUG_MSG("ramDiskBlkRW: blk %d # %d -> addr %x, %x bytes\n",	startBlock, numBlocks, pStart, nBytes );    if( semTake( pDev->cbioMutex, WAIT_FOREVER) == ERROR )	return ERROR;    switch( rw )	{	case CBIO_READ:	    bcopy( pStart, buffer, nBytes );	    break;	case CBIO_WRITE:	    bcopy( buffer, pStart,  nBytes );	    break;	}    semGive(pDev->cbioMutex);    return OK;    }/********************************************************************************* ramDiskBytesRW - Read/Write bytes** This routine transfers between a user buffer and the lower layer hardware* It is optimized for byte transfers.  ** dev - the CBIO handle of the device being accessed (from creation routine)* * startBlock - the starting block of the transfer operation* * offset - offset in bytes from the beginning of the starting block* * buffer - address of the memory buffer used for the transfer* * nBytes - number of bytes to transfer* * rw - indicates the direction of transfer up or down (READ/WRITE)* * *pCookie - pointer to cookie used by upper layer such as dosFsLib(),* it should be preserved.* * RETURNS OK or ERROR and may otherwise set errno.*/LOCAL STATUS ramDiskBytesRW    (    CBIO_DEV_ID 	dev,    block_t		startBlock,    off_t		offset,    addr_t		buffer,    size_t		nBytes,    CBIO_RW		rw,    cookie_t		*pCookie    )    {    CBIO_DEV * 	pDev = dev ;    caddr_t 	pStart;    if( TRUE == CBIO_READYCHANGED (dev) )	{	errno = S_ioLib_DISK_NOT_PRESENT ;	return ERROR;	}    if( startBlock >= pDev->cbioParams.nBlocks )	return ERROR;    /* verify that all bytes are within one block range */    if (((offset + nBytes) > pDev->cbioParams.bytesPerBlk ) ||	(offset <0) || (nBytes <=0))	return ERROR;    /* calculate actual memory address of data */    startBlock += pDev->cbioParams.blockOffset;    pStart = pDev->cbioMemBase + ( startBlock << pDev->cbioBlkShift ) ;    pStart += offset ;    DEBUG_MSG("ramDiskBytesRW: blk %d + %d # %d bytes -> addr %x, %x bytes\n",	startBlock, offset, nBytes, pStart, nBytes );    if( semTake( pDev->cbioMutex, WAIT_FOREVER) == ERROR )	return ERROR;    switch( rw )	{	case CBIO_READ:	    bcopy( pStart, buffer, nBytes );	    break;	case CBIO_WRITE:	    bcopy( buffer, pStart,  nBytes );	    break;	}    semGive(pDev->cbioMutex);    return OK;    }/********************************************************************************* ramDiskBlkCopy - Copy sectors * * This routine makes copies of one or more blocks on the lower layer hardware.* It is optimized for block copies on the subordinate layer.  * * dev - the CBIO handle of the device being accessed (from creation routine)* * srcBlock - source start block of the copy* * dstBlock - destination start block of the copy* * num_block - number of blocks to copy** RETURNS OK or ERROR and may otherwise set errno.*/LOCAL STATUS ramDiskBlkCopy    (    CBIO_DEV_ID 	dev,    block_t		srcBlock,    block_t		dstBlock,    block_t		numBlocks    )    {    CBIO_DEV	*pDev = (void *) dev ;    caddr_t pSrc, pDst;    size_t nBytes ;    if( TRUE == CBIO_READYCHANGED (dev) )	{	errno = S_ioLib_DISK_NOT_PRESENT ;	return ERROR;	}    if( (srcBlock) > pDev->cbioParams.nBlocks ||        (dstBlock) > pDev->cbioParams.nBlocks )	return ERROR;    if( (srcBlock+numBlocks) > pDev->cbioParams.nBlocks ||        (dstBlock+numBlocks) > pDev->cbioParams.nBlocks )	return ERROR;    srcBlock += pDev->cbioParams.blockOffset;    dstBlock += pDev->cbioParams.blockOffset;    pSrc = pDev->cbioMemBase + ( srcBlock << pDev->cbioBlkShift ) ;    pDst = pDev->cbioMemBase + ( dstBlock << pDev->cbioBlkShift ) ;    nBytes = numBlocks << pDev->cbioBlkShift ;    DEBUG_MSG("ramDiskBlkCopy: blk %d to %d # %d -> addr %x,to %x %x bytes\n",	srcBlock, dstBlock, numBlocks, pSrc, pDst, nBytes );    if( semTake( pDev->cbioMutex, WAIT_FOREVER) == ERROR )	return ERROR;    /* Do the actual copying */    bcopy( pSrc, pDst, nBytes );    semGive(pDev->cbioMutex);    return OK;    }/********************************************************************************* ramDiskIoctl - Misc control operations * * This performs the requested ioctl() operation.* * CBIO modules can expect the following ioctl() codes from cbioLib.h:* CBIO_RESET - reset the CBIO device and the lower layer* CBIO_STATUS_CHK - check device status of CBIO device and lower layer* CBIO_DEVICE_LOCK - Prevent disk removal * CBIO_DEVICE_UNLOCK - Allow disk removal* CBIO_DEVICE_EJECT - Unmount and eject device* CBIO_CACHE_FLUSH - Flush any dirty cached data* CBIO_CACHE_INVAL - Flush & Invalidate all cached data* CBIO_CACHE_NEWBLK - Allocate scratch block** dev - the CBIO handle of the device being accessed (from creation routine)* * command - ioctl() command being issued* * arg - specific to the particular ioctl() function requested or un-used.** RETURNS OK or ERROR and may otherwise set errno.*/LOCAL STATUS ramDiskIoctl    (    CBIO_DEV_ID	dev,    UINT32	command,    addr_t	arg    )    {    switch ( command )	{	case CBIO_RESET :		/* HELP is this really okay for a driver to do? */		CBIO_READYCHANGED (dev) = FALSE; 		return (OK);	case CBIO_STATUS_CHK : /* These are no-ops for the RAM Disk : */	case CBIO_DEVICE_LOCK :	case CBIO_DEVICE_UNLOCK :	case CBIO_DEVICE_EJECT :	case CBIO_CACHE_FLUSH :	case CBIO_CACHE_INVAL :	    if( TRUE == CBIO_READYCHANGED (dev) )		{		errno = S_ioLib_DISK_NOT_PRESENT ;		return ERROR;		}	    return OK;	case CBIO_CACHE_NEWBLK:	    if( TRUE == CBIO_READYCHANGED (dev) )		{		errno = S_ioLib_DISK_NOT_PRESENT ;		return ERROR;		}	    else		{		/* zero out the new block */		caddr_t pBlk ;		block_t blk = (long) arg ;		int nBytes = 1 << dev->cbioBlkShift ;		if( blk >= dev->cbioParams.nBlocks )		    return ERROR;		blk += dev->cbioParams.blockOffset ;		pBlk = dev->cbioMemBase + ( blk << dev->cbioBlkShift ) ;		bzero( pBlk, nBytes );		return OK;		}	default:	    errno = EINVAL;	    return (ERROR);	}    }/********************************************************************************* shiftCalc - calculate how many shift bits** How many shifts <n< are needed such that <mask> == 1 << <N>* This is very useful for replacing multiplication with shifts,* where it is known a priori that the multiplier is 2^k.** RETURNS: Number of shifts.*/LOCAL int shiftCalc    (    u_long mask    )    {    int i;    for (i=0; i<32; i++)	{	if (mask & 1)	    break ;	mask = mask >> 1 ;	}    return( i );    }/********************************************************************************* ramDiskDevCreate - Initialize a RAM Disk device** This function creates a compact RAM-Disk device that can be directly* utilized by dosFsLib, without the intermediate disk cache.* It can be used for non-volatile RAM as well as volatile RAM disks.** The RAM size is specified in terms of total number of blocks in the* device and the block size in bytes. The minimal block size is 32 bytes.* If <pRamAddr> is NULL, space will be allocated from the default memory* pool.** RETURNS: a CBIO handle that can be directly used by dosFsDevCreate()* or NULL if the requested amount of RAM is not available.** CAVEAT: When used with NV-RAM, this module can not eliminate mid-block* write interruption, which may cause file system corruption not* existent in common disk drives.** SEE ALSO: dosFsDevCreate().*/CBIO_DEV_ID ramDiskDevCreate    (    char  *pRamAddr,     /* where it is in memory (0 = malloc)     */    int   bytesPerBlk,   /* number of bytes per block              */    int   blksPerTrack,  /* number of blocks per track             */    int   nBlocks,       /* number of blocks on this device        */    int   blkOffset      /* no. of blks to skip at start of device */    )    {    CBIO_DEV_ID pDev = NULL ;    size_t	diskSize;    char	shift;    /* Fill in defaults for args with 0 value */    if( bytesPerBlk == 0)	bytesPerBlk = 64 ;    if( nBlocks == 0)	nBlocks = 2048 ;    if( blksPerTrack == 0)	blksPerTrack = 16 ;    /* first check that bytesPerBlk is 2^n */    shift = shiftCalc( bytesPerBlk );    if( bytesPerBlk != ( 1 << shift ) )	{	errno = EINVAL;	return( NULL );	}    /* calculate memory pool size in bytes */    diskSize = nBlocks << shift ;    cbioLibInit();	/* just in case */    /* Create CBIO device - generic (cbioDevCreate, cbioLib.c) */    pDev = (CBIO_DEV_ID) cbioDevCreate ( pRamAddr, diskSize );    if( pDev == NULL )	return( NULL );    /* If we got here, then generic device is allocated */    pDev->cbioDesc	= "RAM Disk Driver";    pDev->cbioParams.cbioRemovable	= FALSE ;    CBIO_READYCHANGED (pDev)     	= FALSE ;    pDev->cbioParams.nBlocks		= nBlocks ;    pDev->cbioParams.bytesPerBlk	= bytesPerBlk ;    pDev->cbioParams.blocksPerTrack	= blksPerTrack ;    pDev->cbioParams.nHeads		= 1 ;    pDev->cbioParams.blockOffset		= blkOffset ;    pDev->cbioMode		= O_RDWR ;    pDev->cbioParams.lastErrBlk	= NONE ;    pDev->cbioParams.lastErrno	= 0 ;    pDev->cbioBlkShift		= shift ;    /* cbioFuncs is staticly allocated in each driver. */    pDev->pFuncs = &cbioFuncs;    /*      * SPR#67729: Fill in the members blksubDev, cbioSubDev and isDriver      * appropriately      */    pDev->blkSubDev = NULL;  /* This layer does not have a BLKDEV below it */    pDev->cbioSubDev = pDev; /* Stores a pointer to itself   */                             /* since this is the last layer */    pDev->isDriver = TRUE;   /* For ramDiskCbio we are the lowest layer */    DEBUG_MSG("ramDiskDevCreate: dev %x, size %x\n", pDev, diskSize );    /* return device handle */    return( pDev );    }/********************************************************************************* ramDiskShow - show current parameters of the RAM disk device** This function is not implemented.* * NOMANUAL*/STATUS ramDiskShow( CBIO_DEV_ID dev, int verb )    {    return OK;    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91在线视频观看| 欧美精品在线一区二区三区| 亚洲r级在线视频| 久久久午夜精品理论片中文字幕| 99久久久久免费精品国产 | 综合电影一区二区三区 | 欧美韩日一区二区三区| 欧美色图片你懂的| 成人成人成人在线视频| 久久99精品一区二区三区三区| 亚洲欧美日韩一区| 国产午夜亚洲精品羞羞网站| 日韩一区二区三区在线视频| 色综合天天综合狠狠| 国产高清久久久久| 精品一区二区三区免费播放| 亚洲 欧美综合在线网络| 亚洲欧美一区二区视频| 国产欧美一区二区精品忘忧草| 欧美一区二区在线看| 在线免费观看不卡av| 2019国产精品| 日韩一区二区视频| 欧美日韩免费观看一区二区三区| 播五月开心婷婷综合| 国产精品香蕉一区二区三区| 奇米影视在线99精品| 日韩激情一二三区| 亚洲电影欧美电影有声小说| 亚洲欧美一区二区三区极速播放 | 91网页版在线| 91视视频在线观看入口直接观看www| 国产精品一区二区三区网站| 久久99最新地址| 精品系列免费在线观看| 美国毛片一区二区三区| 欧美aaaaa成人免费观看视频| 日韩av一区二| 日产国产欧美视频一区精品| 无吗不卡中文字幕| 亚洲网友自拍偷拍| 亚洲午夜免费视频| 亚洲国产精品一区二区久久| 亚洲成av人在线观看| 亚洲国产日韩在线一区模特 | 国产福利一区在线| 国产白丝网站精品污在线入口| 国产精品影音先锋| 成人在线视频一区二区| 高清国产午夜精品久久久久久| 成人在线视频一区| 成人精品小蝌蚪| 成人精品小蝌蚪| 91久久香蕉国产日韩欧美9色| 91国偷自产一区二区三区成为亚洲经典 | 国产午夜精品久久久久久免费视| 久久久久久久久久电影| 中文字幕一区二区5566日韩| 亚洲欧洲综合另类在线| 午夜视频一区二区三区| 奇米精品一区二区三区四区 | 一区二区日韩av| 亚洲成人福利片| 九九视频精品免费| 大胆欧美人体老妇| 欧美性色欧美a在线播放| 欧美一区二区三区性视频| 久久女同精品一区二区| 亚洲欧洲综合另类| 偷拍与自拍一区| 国产成人免费在线观看| 色视频欧美一区二区三区| 欧美电影一区二区| 2020国产成人综合网| 亚洲欧美色综合| 蜜桃视频一区二区三区在线观看| 精品无人区卡一卡二卡三乱码免费卡| 成人网在线免费视频| 欧美色中文字幕| 精品成人佐山爱一区二区| 久久久国产精品午夜一区ai换脸| 99久久精品国产导航| 欧美色中文字幕| 日韩久久一区二区| 亚洲日本免费电影| 日本aⅴ亚洲精品中文乱码| 视频在线观看一区| 亚洲一线二线三线视频| 久久国产精品色婷婷| 国产91丝袜在线观看| 7777精品伊人久久久大香线蕉| 亚洲欧洲日产国码二区| 国产精品99久久久久久久女警 | 亚洲国产精品影院| 色婷婷av一区二区三区gif | 国产精品三级av在线播放| 蜜桃免费网站一区二区三区| 欧美精选午夜久久久乱码6080| 亚洲综合视频网| 欧美日韩一区二区在线视频| 一二三四区精品视频| 99精品欧美一区二区蜜桃免费| 综合亚洲深深色噜噜狠狠网站| 成人性生交大合| 国产精品国产三级国产普通话99| 91碰在线视频| 亚洲国产一区二区视频| 精品久久免费看| 成人三级伦理片| 亚洲国产一区二区三区青草影视| 欧美日韩在线三级| 国产美女视频91| 国产精品成人免费精品自在线观看| 国产成人亚洲综合色影视| ...av二区三区久久精品| 在线综合亚洲欧美在线视频| 美腿丝袜亚洲三区| 欧美一级欧美三级在线观看| 亚洲一区影音先锋| 日韩一区二区视频在线观看| 美女爽到高潮91| 国产精品网站导航| 成人激情免费电影网址| 国产一区二区调教| 婷婷成人激情在线网| 久久精子c满五个校花| 欧美精品一区二区三区蜜桃| 日韩欧美美女一区二区三区| 欧美日韩精品久久久| 欧美日韩国产一级片| 日韩一级成人av| 精品噜噜噜噜久久久久久久久试看| 777奇米四色成人影色区| 日韩视频免费观看高清在线视频| 日韩视频不卡中文| 欧美精品一区男女天堂| 精品国精品国产| 久久久久久免费毛片精品| 中文文精品字幕一区二区| 欧美精品亚洲二区| 91精品欧美福利在线观看| 欧美午夜宅男影院| 在线不卡中文字幕播放| 欧美一区二区高清| 精品视频一区二区三区免费| 成人免费av在线| youjizz久久| 9色porny自拍视频一区二区| 91蜜桃传媒精品久久久一区二区| 99re成人精品视频| 色狠狠av一区二区三区| 欧美日韩一区二区在线观看视频| 91国内精品野花午夜精品| 欧美午夜在线一二页| 亚洲国产高清aⅴ视频| 色综合久久九月婷婷色综合| 欧美午夜精品免费| 欧美高清在线视频| 一区二区久久久久| 一区二区高清在线| 亚洲精品视频一区二区| 日韩国产精品久久| 成人福利电影精品一区二区在线观看 | 国产精品一二三在| 91在线小视频| 欧美成人在线直播| 无码av中文一区二区三区桃花岛| 日韩精品色哟哟| 欧美少妇一区二区| 亚洲精品成人精品456| av一区二区三区在线| 国产欧美日韩另类一区| 国产一区美女在线| 久久这里只有精品首页| 日本成人中文字幕在线视频| 欧美性欧美巨大黑白大战| 久久嫩草精品久久久精品一| 日韩成人免费在线| 欧美老女人在线| 午夜精品福利久久久| 欧美在线视频你懂得| 亚洲六月丁香色婷婷综合久久 | 久久久综合激的五月天| 亚洲免费观看视频| 国产成人aaa| 欧美mv日韩mv亚洲| 老司机一区二区| 欧美视频一区在线观看| 国产精品国产三级国产有无不卡 | 久久夜色精品国产欧美乱极品| 一区二区三区欧美在线观看| 国产sm精品调教视频网站| 精品国产乱码久久久久久蜜臀| 亚洲在线中文字幕| 色噜噜夜夜夜综合网| **网站欧美大片在线观看| 成人激情视频网站| 亚洲人成网站影音先锋播放| 成人av影院在线| 亚洲欧美日韩国产另类专区|