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

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

?? dosfsfat.c

?? vxworks操作系統的文件系統部分原代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* dosFsFat.c - DOS file system File Allocation Table Handler *//* Copyright 1987-2002 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01q,10jan02,chn  Renamed some functions to clear up sector/cluster confusion01p,10dec01,jkf  SPR#72039, various fixes from Mr. T. Johnson.01o,12oct01,jkf  adapted debugging code to be more portable. 01n,02oct01,jkf  replaced diab changes lost in 01m.01m,20sep01,jkf  SPR#69031, common code for both AE & 5.x.01l,08oct99,jkf  added ifdef for HP native tools to ignore GNUish debug macro's01k,31aug99,jkf  changes for new CBIO API.01j,31jul99,jkf  T2 merge, tidiness & spelling.01i,21dec98,mjc  fixed bug in fat16Seek(), changed name of <contigEnd>                  field in structure <DOS_FILE_HDL> to <contigEndPlus1>01h,23nov98,mjc  avoided disk access for seek within contiguous file area;01j,23sep98,vld  added FAT mirroring disabling;		 added routine fat16SyncToggle()01f,20sep98,mjc  descriptor structure name changed from DOS_FAT16_DESC                 to MS_FAT_DESC01e,17sep98,vld  added argument "number of FAT copy" to cluster read/write                 routines;cluster writing routines extended with a"raw" data		 write to FAT copies other, then active one;    	    	 routine fat16ClustValueSet() extended to support                 FAT copy initialization;01d,12jul98,mjc  cluster group allocation factor changed from                 constant to global variable fatClugFac.                 Assert header files including was moved                  to be after #ifdef DEBUG statement to allow                 NDEBUG definition  in case when DEBUG is undefined.                 fat16ContigAlloc() algorithm was changed to 1st fit.01c,01jul98,lrn  doc reviewed01b,29jun98,mjc  added FAT32, tested01a,23feb98,mjc  initially written written.*//*DESCRIPTIONThis module is part of dosFsLib and is designed to manage the threedifferent File Allocation Table formats: FAT12, FAT16 and FAT32.These formats are similar thus are implemented in a single modulewithout the ability to scale out one of these formats for systems whichdo not intend to use them.IMPLEMENTATIONThis FAT handler does not keep any part of the File Allocation Table inmemory, depending entirely on the underlying CBIO module, typically theDisk Cache for the ability to access any FAT entry of any size, i.e.byte-wise access to any particular disk sector.INITIALIZATION*//* includes */#include "vxWorks.h"#include "private/dosFsVerP.h"#include "semLib.h"#include "errnoLib.h"#include "logLib.h"#include "string.h"#include "memLib.h"#include "stdlib.h"#include "stdio.h"#include "taskLib.h"#include "private/print64Lib.h"#include "private/dosFsLibP.h"#include "private/dosFsFatP.h"/* macros */#define _TO_STR(z) _TO_TMP(z)#define _TO_TMP(z) #z#undef ERR_MSG#undef DBG_MSG#undef ERR_PRINT#ifdef DEBUG#   undef  LOCAL#   define LOCAL#   define ERR_PRINT	/* include errnoSetOut() */#   define errnoSet( err ) errnoSetOut( __FILE__, __LINE__, #err, (err) )#   define DBG_MSG(lvl, fmt, a1, a2, a3, a4, a5, a6)                       \        { if ((lvl) <= fat16Debug)                                         \            printErr (__FILE__" : "_TO_STR(__LINE__)" : "fmt, a1, a2,      \                      a3, a4, a5, a6); }#   define ERR_MSG(lvl, fmt, a1, a2, a3, a4, a5, a6)			   \        { logMsg (__FILE__" : "_TO_STR(__LINE__)" : "fmt, (int)(a1),       \                  (int)(a2), (int)(a3), (int)(a4), (int)(a5), (int)(a6)); }#else   /* NO DEBUG */#   undef  NDEBUG#   define NDEBUG/* fixme: quick dirty hack for native HP native tools build, HP simulator */#   if (CPU == SIMHPPA)    /* Allow TOOL=hp to build, will cause no effect warnings when TOOL=gnu */#        define DBG_MSG#        define ERR_MSG#   else#        define DBG_MSG(lvl, fmt, a1, a2, a3, a4, a5, a6) {}#        define ERR_MSG(lvl, fmt, a1, a2, a3, a4, a5, a6)                    \             { if ((lvl) <= fat16Debug)                                      \                 logMsg (__FILE__" : "_TO_STR(__LINE__)" : %s : "fmt,        \                 (int)(a1), (int)(a2), (int)(a3), (int)(a4), (int)(a5),      \		 (int)(a6)); }#   endif /* (CPU == SIMHPPA) */#endif /* DEBUG */                                                                             #include "assert.h"/* defines *//* File System Information Sector number */#define FSINFO_SEC_NUM		1/* Offset of free clusters count field in the File System Information Sector */#define FSINFO_SIGN		484#define FSINFO_FREE_CLUSTS	488#define FSINFO_NEXT_FREE        492/* Read FAT entry error code */#define FAT_CBIO_ERR		1/* Mutex semaphore options */#define ALLOC_SEM_OPTIONS	SEM_Q_PRIORITY | SEM_DELETE_SAFE | \				SEM_INVERSION_SAFE#define ENTRY_READ(pFd, copy, entry)		\		pFatDesc->entryRead ((pFd), (copy), (entry))#define ENTRY_WRITE(pFd, copy, entry, value)	\		pFatDesc->entryWrite ((pFd), (copy), (entry), (value))/* typedefs *//* globals */int     fat16Debug = 0;	/* debug level */int	fatClugFac = 10000;	/* cluster allocation group size factor *//* locals */#ifdef ERR_PRINT/******************************************************************************** errnoSetOut - put error message** This routine is called instead errnoSet during debugging.*/LOCAL VOID errnoSetOut(char * pFile, int line, const char * pStr, int errCode )    {    /* If it is not errno clearing or setting to previously stored value      * (in <errnoBuf> variable), print the error information.     */    if( errCode != OK  && strcmp( pStr, "errnoBuf" ) != 0 )        printf( "ERROR from %s : line %d : %s = %p, task %p\n",                pFile, line, pStr, (void *)errCode, (void *)taskIdSelf() );    errno = errCode;    }#endif  /* ERR_PRINT *//********************************************************************************* fat16MirrorSect - mirror FAT sector** This routine copies last modified sector of Primary FAT copy to appropriate * sectors of another FAT copies.** RETURNS: OK or ERROR.*/LOCAL STATUS fat16MirrorSect    (    FAST DOS_FILE_DESC_ID	pFd		/* pointer to file descriptor */    )    {    FAST DOS_VOLUME_DESC_ID	pVolDesc = pFd->pVolDesc;					/* pointer to volume descriptor */    FAST MS_FAT_DESC_ID	pFatDesc = (void *) pVolDesc->pFatDesc;					/* pointer to FAT descriptor */    FAST CBIO_DEV_ID		pCbio = pVolDesc->pCbio;					/* pointer to CBIO device */    FAST uint32_t		srcSecNum = pFd->pFileHdl->fatSector;    FAST uint32_t		dstSecNum;    FAST int			fatNum;		/* FAT copy number */         uint8_t		fsinfoBuf [8];    if (srcSecNum == 0)        return OK;    /* FAT copies synchronization might be disabled */    if ( ! pFatDesc->syncEnabled)    	return OK;    /*      * TBD: mirroring disabled (FAT32)     * ? Maybe it is worth adding callbacks to process CBIO write errors ?     */    for (fatNum = 1, dstSecNum = srcSecNum + pVolDesc->secPerFat;          fatNum < pVolDesc->nFats;          fatNum++, dstSecNum += pVolDesc->secPerFat)        {        if (cbioBlkCopy (pCbio, srcSecNum, dstSecNum, 1) != OK)            return ERROR;        /* ...??? */        }    if (pVolDesc->fatType == FAT32)        {        VX_TO_DISK_32 (pFatDesc->fatEntFreeCnt, &fsinfoBuf[0]);        VX_TO_DISK_32 (pFatDesc->groupAllocStart, &fsinfoBuf[4]);        if (OK != cbioBytesRW (pCbio, FSINFO_SEC_NUM, FSINFO_FREE_CLUSTS, 		(addr_t)fsinfoBuf, sizeof (fsinfoBuf), CBIO_WRITE, NULL))            return ERROR;        }    return OK;    } /* fat16MirrorSect *//********************************************************************************* fat16SyncToggle - toggle FAT copies mirroring.* * This routine enables/disables FAT copes mirroring. When mirroring* is enabled all reserved FAT copes are synchronized with active one.* * RETURNES: N/A.*/LOCAL void fat16SyncToggle    (    DOS_VOLUME_DESC_ID	pVolDesc,    BOOL	syncEnable    )    {    MS_FAT_DESC_ID	pFatDesc = (MS_FAT_DESC_ID)pVolDesc->pFatDesc;    block_t		srcSec, dstSec, secNum;    uint8_t		copyNum;        pFatDesc->syncEnabled = syncEnable;        if (! syncEnable)    	return;        /* synchronize FAT copies */        /* copy by one sector. It permits always one read - multi write */    srcSec = pFatDesc->fatStartSec +             pVolDesc->pFatDesc->activeCopyNum * pVolDesc->secPerFat;    for (secNum = 0; secNum < pVolDesc->secPerFat; secNum ++, srcSec ++ )    	{    	for (dstSec = pFatDesc->fatStartSec + secNum, copyNum = 0;	     copyNum < pVolDesc->nFats;	     dstSec += pVolDesc->secPerFat, copyNum ++ )    	    {    	    if (copyNum == pVolDesc->pFatDesc->activeCopyNum)    	    	continue;    	        	    cbioBlkCopy (pVolDesc->pCbio, srcSec, dstSec, 1);    	    }    	}    } /* fat16SyncToggle() *//********************************************************************************* fat12EntRead - read FAT entry from disk* * This routine reads the file allocation table (FAT) entry from a dosFs* volume.** This routine only reads from the first copy of the FAT on disk, even if* other copies exist.* * RETURNS: Contents of the entry, or FAT_CBIO_ERR if error accessing disk.*/LOCAL uint32_t fat12EntRead    (    FAST DOS_FILE_DESC_ID	pFd,	/* pointer to file descriptor */    FAST uint32_t		copyNum,/* fat copy number */    FAST uint32_t		cluster	/* entry number */    )    {    FAST DOS_VOLUME_DESC_ID	pVolDesc = pFd->pVolDesc;					/* pointer to volume descriptor */    FAST CBIO_DEV_ID		pCbio = pVolDesc->pCbio;					/* pointer to CBIO device */    FAST MS_FAT_DESC_ID	pFatDesc = (void *) pVolDesc->pFatDesc;					/* pointer to FAT descriptor */    FAST uint32_t		fatEntry;/* FAT entry */    FAST uint32_t		fatOff;	/* offset in the FAT */    FAST block_t		secNum;	/* sector number to read/write */    FAST off_t			secOff;	/* offset in the sector */    FAST uint32_t		nBytes;	/* number of bytes */         uint8_t		valBuf [2];					/* buffer for value in the entry */    assert ( copyNum < pVolDesc->nFats);    assert ( (cluster >= DOS_MIN_CLUST) && (cluster < pFatDesc->nFatEnts) );    /* Offset of the entry in the FAT in bytes */    fatOff = cluster + (cluster >> 1);	/* index = cluster * 1.5 */    /* Number of sector containing the entry */    secNum = pFatDesc->fatStartSec + copyNum * pVolDesc->secPerFat +            (fatOff >> pVolDesc->secSizeShift);    /* Offset of the entry in the sector */    secOff = fatOff & (pVolDesc->bytesPerSec - 1);    /* Number of bytes to read */    nBytes = pVolDesc->bytesPerSec - secOff;    if (nBytes > 2)        nBytes = 2;    /* Read entry from disk */    if (cbioBytesRW (pCbio, secNum, secOff, (addr_t)valBuf, nBytes, CBIO_READ, 				&pFd->fatHdl.cbioCookie) != OK)        {        pFd->fatHdl.errCode = FAT_CBIO_ERR;        return FAT_CBIO_ERR;				/* read error */        }    if (nBytes == 1)        if (cbioBytesRW (pCbio, secNum + 1, 0, (addr_t)(&valBuf[1]), 1, 				CBIO_READ, &pFd->fatHdl.cbioCookie) != OK)            {            pFd->fatHdl.errCode = FAT_CBIO_ERR;            return FAT_CBIO_ERR;			/* read error */            }    fatEntry = valBuf [0] | (valBuf [1] << 8);					/* copy word, swapping bytes */    if (cluster & 0x1)				/* if cluster number is ODD */        fatEntry = (fatEntry >> 4) & 0xfff;	/*  keep high order 12 bits */    else					/* if cluster number is EVEN */        fatEntry &= 0xfff;			/*  keep low order 12 bits */    return fatEntry;    } /* fat12EntRead *//********************************************************************************* fat12EntWrite - write FAT entry to disk* * This routine writes the file allocation table (FAT) entry to a dosFs* volume.** This routine reads the file allocation table (FAT) entry for the* specified cluster and returns it to the caller.** If the value to be written is too large to fit in a FAT entry* (12 bits), it is truncated (high order bits are discarded).** This routine only writes to the first copy of the FAT on disk, even if* other copies exist.* * RETURNS: OK, or ERROR if error accessing disk.*/LOCAL STATUS fat12EntWrite    (    FAST DOS_FILE_DESC_ID	pFd,	/* pointer to file descriptor */    FAST uint32_t		copyNum,/* fat copy number */    FAST uint32_t		cluster,/* entry number */    FAST uint32_t		value	/* value to write */    )    {    FAST DOS_VOLUME_DESC_ID	pVolDesc = pFd->pVolDesc;					/* pointer to volume descriptor */    FAST CBIO_DEV_ID		pCbio = pVolDesc->pCbio;					/* pointer to CBIO device */    FAST MS_FAT_DESC_ID	pFatDesc = (void *) pVolDesc->pFatDesc;					/* pointer to FAT descriptor */    FAST uint32_t		fatOff;	/* offset in the FAT */    FAST block_t		secNum;	/* sector number to read/write */    FAST off_t			secOff;	/* offset in the sector */    FAST uint32_t		nBytes;	/* number of bytes */         cookie_t    		cookie;	/* CBIO dev. cookie */         uint8_t		valBuf [2];					/* buffer for value in the entry */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合久久中文字幕综合网| 国产69精品久久777的优势| 精品欧美一区二区久久| 91在线你懂得| 久久97超碰色| 亚洲一区二区三区自拍| 中文字幕久久午夜不卡| 这里只有精品电影| 91色porny在线视频| 国产一区视频网站| 日本中文字幕一区| 尤物av一区二区| 欧美国产一区二区在线观看 | 色综合欧美在线视频区| 久久草av在线| 婷婷丁香激情综合| 亚洲靠逼com| 国产精品美女www爽爽爽| 精品盗摄一区二区三区| 欧美日韩国产综合一区二区| www.欧美.com| 国产成人综合亚洲网站| 狠狠v欧美v日韩v亚洲ⅴ| 日韩在线观看一区二区| 亚洲国产精品一区二区www| 国产精品国产三级国产专播品爱网 | 日韩中文字幕av电影| 亚洲日本青草视频在线怡红院 | 在线看不卡av| 色视频成人在线观看免| 99久久国产免费看| 福利一区福利二区| 国产91精品在线观看| 国产精品综合久久| 国产麻豆精品theporn| 国产永久精品大片wwwapp| 精品一区在线看| 青青草国产成人av片免费| 天天综合日日夜夜精品| 五月激情六月综合| 日韩1区2区3区| 欧美a级一区二区| 久久国产精品99精品国产| 免费精品视频在线| 久久99国产精品麻豆| 国产乱一区二区| 国产黄色成人av| 成人亚洲一区二区一| 高清久久久久久| www.亚洲免费av| 色999日韩国产欧美一区二区| 一本大道久久a久久综合婷婷| 91麻豆精品秘密| 91国在线观看| 欧美精品粉嫩高潮一区二区| 91精品国产麻豆国产自产在线 | 国产亚洲欧美中文| 中文字幕国产一区二区| 国产精品成人免费精品自在线观看| 国产精品国产三级国产三级人妇 | 日韩一区二区三区观看| 欧美不卡在线视频| 亚洲国产成人午夜在线一区| 日韩一区日韩二区| 亚洲在线免费播放| 久久精品国产久精国产| 国产精品18久久久久久vr| 91天堂素人约啪| 欧美日韩一区二区三区高清 | 欧美三级一区二区| 日韩欧美视频一区| 国产亚洲欧洲一区高清在线观看| 国产精品成人网| 视频一区中文字幕| 国产99一区视频免费| 91麻豆精品秘密| 日韩精品在线一区| 国产精品久久久久9999吃药| 亚洲一区二区视频在线| 国产一区二区h| 欧美性受xxxx黑人xyx性爽| 欧美一级理论性理论a| 日本一区二区成人| 亚洲成a人v欧美综合天堂| 国产酒店精品激情| 欧美日韩www| 中文字幕免费一区| 免费成人美女在线观看| 91老师片黄在线观看| 日韩免费在线观看| 夜夜爽夜夜爽精品视频| 久久草av在线| 欧美日韩在线综合| 中文字幕欧美三区| 美女视频一区在线观看| 99riav久久精品riav| 精品国产一区二区三区不卡| 亚洲一区二区三区爽爽爽爽爽| 激情偷乱视频一区二区三区| 91国产免费看| 国产欧美日韩精品在线| 蜜臀av一级做a爰片久久| 色欧美日韩亚洲| 久久久久久97三级| 首页国产欧美久久| 在线观看亚洲成人| 国产精品成人在线观看| 韩国一区二区在线观看| 欧美日韩的一区二区| 亚洲男女一区二区三区| 国产v日产∨综合v精品视频| 日韩欧美123| 日本不卡在线视频| 欧美优质美女网站| 亚洲三级在线免费观看| 成人激情小说网站| 久久综合成人精品亚洲另类欧美| 视频一区二区中文字幕| 91久久香蕉国产日韩欧美9色| 国产精品免费观看视频| 国产在线精品国自产拍免费| 337p亚洲精品色噜噜| 亚洲电影一级黄| 在线观看免费一区| 一区二区三区免费| 色综合色综合色综合色综合色综合| 国产女主播一区| 国产一区久久久| 久久久亚洲精华液精华液精华液| 麻豆一区二区99久久久久| 在线播放91灌醉迷j高跟美女| 亚洲成在人线免费| 欧美人xxxx| 日韩激情一区二区| 8v天堂国产在线一区二区| 午夜精品免费在线| 在线播放中文一区| 免费高清在线视频一区·| 欧美一区二区福利视频| 久久精品国产一区二区三| 精品国精品自拍自在线| 国产一区二区三区在线观看精品| 精品成人a区在线观看| 国产精品一区二区久久不卡| 国产日韩欧美电影| 高清视频一区二区| 亚洲三级电影网站| 欧美系列一区二区| 日韩激情视频网站| 久久久久久久久蜜桃| 成人精品免费视频| 有坂深雪av一区二区精品| 欧美欧美午夜aⅴ在线观看| 蜜臀99久久精品久久久久久软件| 精品国产三级a在线观看| 国产99久久久国产精品| 亚洲视频资源在线| 欧美无乱码久久久免费午夜一区| 奇米影视一区二区三区| 国产日韩精品一区二区三区在线| av一本久道久久综合久久鬼色| 亚洲一区二区三区四区在线观看 | 日本韩国精品一区二区在线观看| 亚洲图片有声小说| 精品av综合导航| 91论坛在线播放| 日韩电影一区二区三区四区| 欧美电影免费观看高清完整版在线| 韩国中文字幕2020精品| 亚洲国产高清在线| 欧美日韩国产首页在线观看| 久久99精品国产.久久久久久| 久久久久久免费| 96av麻豆蜜桃一区二区| 亚洲午夜在线视频| 日韩欧美一级二级三级久久久| 国产激情一区二区三区四区 | 久久亚洲影视婷婷| 成人精品亚洲人成在线| 中文字幕在线不卡视频| 日本韩国一区二区三区视频| 亚洲成人免费视频| 精品国产精品网麻豆系列| 91丨九色丨黑人外教| 日韩电影在线看| 国产日韩欧美精品综合| 精品视频1区2区3区| 视频一区国产视频| 久久久精品国产99久久精品芒果| 97久久精品人人爽人人爽蜜臀| 亚洲午夜一区二区三区| 精品国产一区二区三区不卡| 91视频在线观看免费| 裸体歌舞表演一区二区| 国产精品对白交换视频 | 国产大陆a不卡| 亚洲免费观看高清完整版在线 | 亚洲欧美日韩在线不卡| 欧美一区二区成人6969| 在线视频欧美精品|