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

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

?? dir.c

?? efs文件系統源代碼
?? C
字號:
/*****************************************************************************\*                     EFSL - Embedded Filesystems Library                     **                     -----------------------------------                     **                                                                             ** Filename : dir.c                                                            ** Release  : 0.3 - devel                                                      ** 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++){		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);	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一区二区三区免费野_久草精品视频
午夜精品福利在线| 欧美一二三区在线观看| 亚洲欧美色图小说| 99精品视频在线观看免费| 中文字幕乱码亚洲精品一区| 国产成人亚洲综合色影视| 国产婷婷一区二区| 色老头久久综合| 三级精品在线观看| 久久天堂av综合合色蜜桃网| 风间由美一区二区三区在线观看 | 欧美日韩1区2区| 伦理电影国产精品| 国产女人水真多18毛片18精品视频| 国产99久久久久| 亚洲精选一二三| 精品福利一区二区三区免费视频| 国产欧美视频一区二区三区| 国产a久久麻豆| 精品一区二区影视| 国产精品传媒在线| 一本高清dvd不卡在线观看| 一区二区三区电影在线播| 99在线视频精品| 亚洲黄色录像片| 欧美疯狂性受xxxxx喷水图片| 日韩在线播放一区二区| 亚洲男同性视频| 欧美xxxx在线观看| 精品视频1区2区| 99r精品视频| 国产suv一区二区三区88区| 亚洲123区在线观看| 国产精品高清亚洲| 久久综合狠狠综合| 欧美一三区三区四区免费在线看 | 香蕉久久夜色精品国产使用方法 | 日韩欧美国产一二三区| 国产综合一区二区| 亚洲成人激情自拍| 亚洲一二三专区| 日韩av在线发布| 国产精品一区二区在线播放| 美腿丝袜亚洲综合| 首页国产欧美日韩丝袜| 日本一区二区三区在线观看| 99re在线视频这里只有精品| 日韩av一级片| 久久奇米777| www.激情成人| 精品亚洲欧美一区| 国产一区二区视频在线| 五月天婷婷综合| 亚洲精品免费电影| 日韩欧美电影一二三| 国产在线播放一区二区三区| 亚洲午夜精品网| 中文字幕在线不卡一区| 在线亚洲免费视频| 美国十次了思思久久精品导航| 欧美va亚洲va| 国产人成一区二区三区影院| 91黄视频在线| 欧美午夜在线观看| 色婷婷精品久久二区二区蜜臀av| 蜜臀精品一区二区三区在线观看 | 综合色天天鬼久久鬼色| 精品一区二区三区欧美| 亚洲精品成人少妇| 久久久久青草大香线综合精品| 国产精品久久毛片a| 亚洲国产精品影院| 国产成人免费视频| 精品少妇一区二区三区| 久久综合九色欧美综合狠狠| 91丨九色丨国产丨porny| 国产不卡视频一区二区三区| 亚洲成人手机在线| 中文字幕日韩精品一区| 亚洲黄色在线视频| 亚洲另类在线制服丝袜| 日本欧美在线观看| 91视频一区二区三区| 日韩精品中文字幕一区 | 国产精品1区2区| 日韩亚洲欧美高清| 亚洲一区电影777| 色婷婷综合久久久中文字幕| 国产夜色精品一区二区av| 久久99热这里只有精品| 欧美日韩第一区日日骚| 亚洲精品videosex极品| 99国产精品久| 亚洲欧洲成人av每日更新| 国产酒店精品激情| 国产欧美精品一区二区色综合 | 日韩福利视频导航| 亚洲天堂a在线| 日韩精品一区第一页| 国产精品萝li| 不卡一区在线观看| 精品精品欲导航| 中文字幕亚洲在| 国产不卡高清在线观看视频| 欧美激情综合五月色丁香| 精品一区二区精品| 欧美电影影音先锋| 精品成人私密视频| 亚洲欧美一区二区久久 | 欧美性猛片aaaaaaa做受| 亚洲国产精品av| 日本欧美在线看| 日韩欧美中文字幕精品| 视频在线在亚洲| 久久综合久久久久88| 成人精品鲁一区一区二区| 亚洲免费色视频| 一本大道久久a久久精二百 | 在线播放/欧美激情| 国产伦理精品不卡| 亚洲一区二区三区四区不卡| 日韩欧美国产三级电影视频| 懂色av一区二区三区免费看| 亚洲亚洲精品在线观看| 久久久无码精品亚洲日韩按摩| 一本一本久久a久久精品综合麻豆| 亚洲少妇30p| 久久久精品日韩欧美| 欧美日韩一级视频| 成人黄色国产精品网站大全在线免费观看 | 欧美精品v国产精品v日韩精品 | 免费精品99久久国产综合精品| 国产亚洲一区二区三区| 欧美精品久久天天躁| av在线不卡网| 国产精品99久久久久久宅男| 视频在线观看一区| 国产精品情趣视频| 精品99一区二区三区| 国产成人精品免费| 国产一区二区三区蝌蚪| 青青青爽久久午夜综合久久午夜| 最新国产成人在线观看| 国产精品区一区二区三| 国产精品色婷婷| 国产欧美一区二区精品性色 | 日韩福利电影在线| 麻豆精品视频在线| 67194成人在线观看| 色网综合在线观看| 在线看国产日韩| 欧美无砖专区一中文字| 在线精品视频一区二区三四| 91香蕉视频在线| 欧美系列日韩一区| 欧美一区永久视频免费观看| 欧美一区二区精品| 精品国产1区2区3区| 国产精品人人做人人爽人人添| 国产精品国产三级国产| 一区二区三区加勒比av| 性做久久久久久久久| 日本强好片久久久久久aaa| 精品一区二区国语对白| 岛国一区二区在线观看| 91九色最新地址| 日韩视频一区二区三区在线播放| 久久青草欧美一区二区三区| 亚洲免费高清视频在线| 麻豆91在线看| 91色九色蝌蚪| 日韩欧美电影一二三| 亚洲免费在线播放| 国产一区二区三区高清播放| 91精彩视频在线观看| 久久蜜桃av一区二区天堂| 亚洲精品日韩综合观看成人91| 久久国产剧场电影| 欧美在线免费观看视频| 久久久久亚洲综合| 九九在线精品视频| 欧美美女一区二区在线观看| 国产精品乱码一区二区三区软件 | 国产乱码精品一区二区三| 欧美亚洲图片小说| 亚洲色图视频免费播放| 国产电影一区二区三区| 欧美一区二区三区视频免费播放 | 久久超碰97人人做人人爱| 欧美色国产精品| 亚洲成人动漫av| 欧美人妇做爰xxxⅹ性高电影| 自拍偷拍亚洲激情| 成人av电影在线网| 中文字幕亚洲一区二区av在线| 成人免费视频app| 中文字幕色av一区二区三区| 成人av免费在线| 亚洲精品免费在线| 欧美在线影院一区二区|