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

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

?? dir.c

?? filesystem for at91sam9263ek,編輯器為keil for arm mdk
?? C
字號:
/*****************************************************************************\*              efs - General purpose Embedded Filesystem library              **          --------------------- -----------------------------------          **                                                                             ** Filename : dir.c                                                            ** Description : The functions of dir.c are part of fs.c, they deal with all   **               the directory specific stuff.                                 **                                                                             ** This program is free software; you can redistribute it and/or               ** modify it under the terms of the GNU General Public License                 ** as published by the Free Software Foundation; version 2                     ** of the License.                                                             *                                                                              ** This program is distributed in the hope that it will be useful,             ** but WITHOUT ANY WARRANTY; without even the implied warranty of              ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               ** GNU General Public License for more details.                                **                                                                             ** As a special exception, if other files instantiate templates or             ** use macros or inline functions from this file, or you compile this          ** file and link it with other works to produce a work based on this file,     ** this file does not by itself cause the resulting work to be covered         ** by the GNU General Public License. However the source code for this         ** file must still be made available in accordance with section (3) of         ** the GNU General Public License.                                             **                                                                             ** This exception does not invalidate any other reasons why a work based       ** on this file might be covered by the GNU General Public License.            **                                                                             **                                                    (c)2006 Lennart Yseboodt **                                                    (c)2006 Michael De Nil   *\*****************************************************************************//*****************************************************************************/#include "dir.h"/*****************************************************************************//* ****************************************************************************   * void dir_getFileStructure(FileSystem *fs,FileRecord *filerec,FileLocation *loc) * Description: This function stores the filerecord located at loc in filerec. * It fetches the required sector for this. * Return value: void*/void dir_getFileStructure(FileSystem *fs,FileRecord *filerec,FileLocation *loc){	euint8 *buf;	buf=part_getSect(fs->part,loc->Sector,IOM_MODE_READONLY);	*filerec=*(((FileRecord*)buf)+loc->Offset);	part_relSect(fs->part,buf);}	/*****************************************************************************//* ****************************************************************************   * void dir_createDirectoryEntry(FileSystem *fs,FileRecord *filerec,FileLocation *loc) * Description: This function writes the filerecord stored in filerec to disc at * location loc.  * Return value: void*/void dir_createDirectoryEntry(FileSystem *fs,FileRecord *filerec,FileLocation *loc){	euint8 *buf;		buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE);	memCpy(filerec,buf+(loc->Offset*sizeof(*filerec)),sizeof(*filerec));	part_relSect(fs->part,buf);}/*****************************************************************************//* ****************************************************************************   * void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilename) * Description: This function fills in a filerecord with safe default values, and * a given fatfilename. If your system has a means of knowing time, here is an  * excellent place to apply it to the filerecord.   * Return value: void*/void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilename){	memCpy(fatfilename,filerec->FileName,11);	filerec->Attribute=0x00;	filerec->NTReserved=0x00;	filerec->MilliSecTimeStamp=0x00;	filerec->CreatedTime=time_getTime();	filerec->CreatedDate=time_getDate(); 	filerec->AccessDate=filerec->CreatedDate;	filerec->FirstClusterHigh=0x0000;	filerec->WriteTime=filerec->CreatedTime;	filerec->WriteDate=filerec->CreatedDate;	filerec->FirstClusterLow=0x0000;	filerec->FileSize=0x00000000;}/*****************************************************************************//* ****************************************************************************   * void dir_setFirstCluster(File *file,euint32 cluster_addr) * Description: This function requires modification to release it from * depending on the file object. * Return value:*/void dir_setFirstCluster(FileSystem *fs,FileLocation *loc,euint32 cluster_addr){	euint8 *buf; 	 	buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE);	(((FileRecord*)buf)+loc->Offset)->FirstClusterHigh=cluster_addr>>16;	(((FileRecord*)buf)+loc->Offset)->FirstClusterLow=cluster_addr&0xFFFF;		part_relSect(fs->part,buf);}/*****************************************************************************//* ****************************************************************************   * void dir_setFileSize(FileSystem *fs, FileLocation *loc,euint32 numbytes) * Description: This function changes the filesize recorded at loc->Sector * to 'numbytes'. * Return value: void*/void dir_setFileSize(FileSystem *fs, FileLocation *loc,euint32 numbytes){	euint8 *buf;		buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE);	(((FileRecord*)buf)+loc->Offset)->FileSize=numbytes;	part_relSect(fs->part,buf);}/*****************************************************************************//* ****************************************************************************   * esint8 dir_updateDirectoryEntry(FileSystem *fs,FileRecord *entry,FileLocation *loc)) * This function changes the entire entity stores at loc to the data recorded * in entry. This is for custom updates to the directoryentry. * Return value: 0 on success, -1 on failure*/esint8 dir_updateDirectoryEntry(FileSystem *fs,FileRecord *entry,FileLocation *loc){	euint8 *buf;		buf = part_getSect(fs->part,loc->Sector,IOM_MODE_READWRITE);	memCpy(entry,buf+(loc->Offset*sizeof(*entry)),sizeof(*entry));	part_relSect(fs->part,buf);	return(0);}/* ****************************************************************************   * euint32 dir_findFileinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc) * This function searches for a given fatfilename in the buffer provided. * It will iterate through the 16 direntry's in the buffer and searches * for the fatfilename. If found, it will store the offset and attribute * entry of the directoryrecord in the loc structure. * If loc is 0, then it's members are not touched. * Return value: This function returns 0 when it cannot find the file, * if it can find the file it will return the first cluster number.*/euint32 dir_findFileinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc){	FileRecord fileEntry;	euint8 c;		for(c=0; c<16; c++)	{		fileEntry = *(((FileRecord*)buf) + c);		/* Check if the entry is for short filenames */		if( !( (fileEntry.Attribute & 0x0F) == 0x0F ) )		{			if( strMatch((eint8*)fileEntry.FileName,fatname,11) == 0 )			{				/* The entry has been found, return the location in the dir */				if(loc)loc->Offset = c;				if(loc)loc->attrib = fileEntry.Attribute;				if((((euint32 )fileEntry.FirstClusterHigh)<<16)+ fileEntry.FirstClusterLow==0){					return(1); /* Lie about cluster, 0 means not found! */				}else{					return							(							(((euint32 )fileEntry.FirstClusterHigh)<<16)							+ fileEntry.FirstClusterLow							);				}			}		}	}	return(0);}/* ****************************************************************************   * euint32 dir_findFreeEntryinBuf(euint8* buf, FileLocation *loc) * This function searches for a free entry in a given sector 'buf'. * It will put the offset into the loc->Offset field, given that loc is not 0. * Return value: 1 when it found a free spot, 0 if it hasn't.*/euint32 dir_findFreeEntryinBuf(euint8* buf, FileLocation *loc){	FileRecord fileEntry;	euint8 c;		for(c=0;c<16;c++){		fileEntry = *(((FileRecord*)buf) + c);		if( !( (fileEntry.Attribute & 0x0F) == 0x0F ) ){			if(fileEntry.FileName[0] == 0x00 ||			   fileEntry.FileName[0] == 0xE5 ){				if(loc)loc->Offset=c;				return(1);			}		}	}	return(0);}/* ****************************************************************************   * euint32  dir_findinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc) * Description: This function searches for a given fatfilename in a buffer. * Return value: Returns 0 on not found, and the firstcluster when the name is found.*/euint32  dir_findinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc, euint8 mode){	switch(mode){		case DIRFIND_FILE:			return(dir_findFileinBuf(buf,fatname,loc));			break;		case DIRFIND_FREE:			return(dir_findFreeEntryinBuf(buf,loc));			break;		default:			return(0);			break;	}	return(0);}/*****************************************************************************//* ****************************************************************************   * euint32 dir_findinCluster(FileSystem *fs,euint32 cluster,eint8 *fatname, FileLocation *loc, euint8 mode) * This function will search for an existing (fatname) or free directory entry * in a full cluster. * Return value: 0 on failure, firstcluster on finding file, and 1 on finding free spot.*/euint32 dir_findinCluster(FileSystem *fs,euint32 cluster,eint8 *fatname, FileLocation *loc, euint8 mode){	euint8 c,*buf=0;	euint32 fclus;		for(c=0;c<fs->volumeId.SectorsPerCluster;c++){        printf("probleme\n\r");printf("cluster=0x%X", cluster);		buf = part_getSect(fs->part,fs_clusterToSector(fs,cluster)+c,IOM_MODE_READONLY);		if((fclus=dir_findinBuf(buf,fatname,loc,mode))){			if(loc)loc->Sector=fs_clusterToSector(fs,cluster)+c;			part_relSect(fs->part,buf);			return(fclus);		}		part_relSect(fs->part,buf); /* Thanks Mike ;) */	}	return(0);}/* ****************************************************************************   * euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileLocation *loc, euint8 mode) * This function will search for an existing (fatname) or free directory entry * in a directory, following the clusterchains. * Return value: 0 on failure, firstcluster on finding file, and 1 on finding free spot.*/euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileLocation *loc, euint8 mode){	euint32 c=0,cluster;	ClusterChain Cache;		Cache.DiscCluster = Cache.FirstCluster = firstcluster;	Cache.LogicCluster = Cache.LastCluster = Cache.Linear = 0;		if(firstcluster <= 1){		return(dir_findinRootArea(fs,fatname,loc,mode));		}		while(!fat_LogicToDiscCluster(fs,&Cache,c++)){		if((cluster=dir_findinCluster(fs,Cache.DiscCluster,fatname,loc,mode))){			return(cluster);		}	}	return(0);}/* ****************************************************************************   * euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileLocation *loc, euint8 mode) * This function will search for an existing (fatname) or free directory entry * in the rootdirectory-area of a FAT12/FAT16 filesystem. * Return value: 0 on failure, firstcluster on finding file, and 1 on finding free spot.*/euint32 dir_findinRootArea(FileSystem *fs,eint8* fatname, FileLocation *loc, euint8 mode){	euint32 c,fclus;	euint8 *buf=0;		if((fs->type != FAT12) && (fs->type != FAT16))return(0);		for(c=fs->FirstSectorRootDir;c<(fs->FirstSectorRootDir+fs->volumeId.RootEntryCount/32);c++){		buf = part_getSect(fs->part,c,IOM_MODE_READONLY);		if((fclus=dir_findinBuf(buf,fatname,loc,mode))){			if(loc)loc->Sector=c;			part_relSect(fs->part,buf);			return(fclus);		}			part_relSect(fs->part,buf);		}	part_relSect(fs->part,buf);	return(0);}/* ****************************************************************************   * esint8 dir_getFatFileName(eint8* filename, eint8* fatfilename) * This function will take a full directory path, and strip off all leading * dirs and characters, leaving you with the MS-DOS notation of the actual filename. * Return value: 1 on success, 0 on not being able to produca a filename*/esint8 dir_getFatFileName(eint8* filename, eint8* fatfilename){	eint8 ffnamec[11],*next,nn=0;		memClr(ffnamec,11); memClr(fatfilename,11);	next = filename;		if(*filename=='/')next++;		while((next=file_normalToFatName(next,ffnamec))){		memCpy(ffnamec,fatfilename,11);			nn++;	}	if(nn)return(1);	return(0);}/* ****************************************************************************   * esint8 dir_addCluster(FileSystem *fs,euint32 firstCluster) * This function extends a directory by 1 cluster + optional the number of * clusters you want pre-allocated. It will also delete the contents of that * cluster. (or clusters) * Return value: 0 on success, -1 on fail*/esint8 dir_addCluster(FileSystem *fs,euint32 firstCluster){	euint32 lastc,logicalc;	ClusterChain cache;			fs_initClusterChain(fs,&cache,firstCluster);	if(fat_allocClusterChain(fs,&cache,1)){		return(-1);	}	lastc = fs_getLastCluster(fs,&cache);	if(CLUSTER_PREALLOC_DIRECTORY){		if(fat_allocClusterChain(fs,&cache,CLUSTER_PREALLOC_DIRECTORY)){			return(-1);		}		logicalc = fat_DiscToLogicCluster(fs,firstCluster,lastc);		while(!fat_LogicToDiscCluster(fs,&cache,++logicalc)){			fs_clearCluster(fs,cache.DiscCluster);		}	}else{			fs_clearCluster(fs,lastc);	}	return(0);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
26uuu亚洲| 亚洲午夜免费电影| 亚洲精品高清在线| 奇米亚洲午夜久久精品| 99精品视频一区二区| 欧美一级电影网站| 亚洲国产欧美在线| 国产成人自拍在线| 日韩欧美中文一区| 亚洲一区中文日韩| av综合在线播放| 欧美国产一区在线| 麻豆精品一区二区| 欧美日韩国产区一| 一区二区三区四区不卡视频| 国产成a人亚洲| 久久亚洲免费视频| 久久精品72免费观看| 欧美美女一区二区在线观看| 一区在线播放视频| caoporn国产一区二区| 国产午夜精品一区二区 | 亚洲激情图片一区| 成人一区二区三区中文字幕| 精品国产一区二区三区久久久蜜月 | 一本大道综合伊人精品热热 | 不卡一区在线观看| 日韩欧美亚洲国产另类| 亚洲福利视频三区| 欧美伦理电影网| 亚洲超碰97人人做人人爱| 91香蕉视频黄| 亚洲欧美另类图片小说| a4yy欧美一区二区三区| 中文字幕日韩精品一区| 成人在线视频一区二区| 国产亚洲制服色| 不卡一区中文字幕| 亚洲情趣在线观看| 在线观看精品一区| 亚洲综合视频在线观看| 色综合久久66| 亚洲国产乱码最新视频 | 在线一区二区观看| 亚洲免费在线电影| 欧美日韩一区二区在线观看| 亚洲第一av色| 日韩欧美在线123| 精品一区二区三区香蕉蜜桃| 精品国产乱码久久久久久老虎| 精品在线观看免费| 欧美激情综合在线| 一本大道av伊人久久综合| 性久久久久久久| 精品国产免费久久| 99久久久国产精品| 偷拍自拍另类欧美| 久久综合久久99| 91在线码无精品| 日本欧美一区二区| 日本一区二区视频在线观看| 99精品视频在线观看| 婷婷一区二区三区| 国产欧美日韩视频在线观看| 91极品美女在线| 麻豆精品蜜桃视频网站| 久久精品欧美日韩精品| 91国内精品野花午夜精品| 日本欧美韩国一区三区| 国产精品免费av| 欧美三级中文字幕在线观看| 国产资源在线一区| 一区二区三区四区五区视频在线观看| 日韩一级二级三级| 91在线看国产| 国产一区二区三区美女| 亚洲在线观看免费视频| 久久亚洲精精品中文字幕早川悠里| 色欲综合视频天天天| 精品一区二区av| 亚洲一区免费在线观看| 国产日本欧洲亚洲| 日韩精品专区在线| 色婷婷av一区二区三区gif | 成人av综合在线| 免费欧美日韩国产三级电影| 国产免费成人在线视频| 日韩一级片网址| 欧美视频中文字幕| 99久久777色| 国产成人久久精品77777最新版本| 亚洲一区二区影院| 亚洲欧美综合色| 久久精品水蜜桃av综合天堂| 欧美放荡的少妇| 色综合久久天天| 波多野结衣中文一区| 狠狠色丁香久久婷婷综合_中| 亚洲一区免费在线观看| 亚洲视频小说图片| 国产精品私房写真福利视频| 日韩精品一区二区三区中文不卡| 91福利在线免费观看| 成人深夜福利app| 国产福利视频一区二区三区| 蜜臀av亚洲一区中文字幕| 亚洲成人久久影院| 亚洲免费观看在线视频| 亚洲欧洲成人精品av97| 国产精品成人免费在线| 久久婷婷色综合| 久久久久久久久久久久久女国产乱 | 亚洲成人激情自拍| 亚洲综合丁香婷婷六月香| 综合久久久久久久| 国产精品传媒在线| 亚洲色图制服诱惑| 亚洲女爱视频在线| 亚洲欧美日韩国产成人精品影院| 综合精品久久久| 伊人一区二区三区| 亚洲欧美日韩系列| 亚洲成人精品影院| 五月天一区二区三区| 美女视频第一区二区三区免费观看网站 | 中文字幕av一区二区三区| 中文在线一区二区| 亚洲图片激情小说| 一区二区三区 在线观看视频| 亚洲成人你懂的| 麻豆成人av在线| 国产电影一区二区三区| 成人av在线观| 欧美日韩一级片网站| 制服丝袜亚洲精品中文字幕| 欧美成人三级电影在线| 国产日韩精品一区二区三区在线| 国产精品久99| 亚洲一二三区在线观看| 久久国产精品72免费观看| 国产剧情一区在线| 色猫猫国产区一区二在线视频| 欧美日韩免费在线视频| 精品美女一区二区| 中文字幕一区视频| 日韩经典一区二区| 成人在线视频首页| 欧美一区二区三区在线视频| 精品国产乱码久久久久久浪潮| 中文字幕亚洲在| 午夜av区久久| 粉嫩欧美一区二区三区高清影视| 色婷婷亚洲一区二区三区| 日韩女优av电影在线观看| 中文字幕的久久| 日韩成人免费电影| av激情亚洲男人天堂| 欧美日韩高清在线| 亚洲国产成人午夜在线一区| 午夜电影网一区| 99久久精品一区| 国产亚洲欧美中文| 日本成人在线电影网| 成人av电影免费观看| 91精品久久久久久蜜臀| 亚洲人吸女人奶水| 国产成人综合网| 这里只有精品电影| 亚洲综合清纯丝袜自拍| 成人激情综合网站| 精品欧美一区二区久久| 亚洲6080在线| 91视频精品在这里| 国产午夜精品在线观看| 久久精品国产精品亚洲精品| 欧美综合久久久| 国产精品久久三| 国产呦精品一区二区三区网站| 欧美美女一区二区| 亚洲最新在线观看| 色婷婷综合在线| 国产精品久久久久久久久果冻传媒 | 波多野结衣中文字幕一区二区三区 | 久久99最新地址| 欧美日韩国产美女| 亚洲综合色噜噜狠狠| 91麻豆国产自产在线观看| 国产午夜亚洲精品不卡| 国内精品视频一区二区三区八戒| 欧美日韩国产一级| 亚洲国产综合91精品麻豆| 99精品久久久久久| 国产精品天干天干在线综合| 国产裸体歌舞团一区二区| 欧美tickling挠脚心丨vk| 青青草一区二区三区| 欧美日韩国产123区| 日韩福利视频导航| 日韩欧美www| 黑人巨大精品欧美黑白配亚洲|