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

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

?? fat_sys.c

?? fat16文件系統源碼。需要的請下
?? C
?? 第 1 頁 / 共 3 頁
字號:
	chain[0].number = 1;  
	chain[0].cluster.w[1] = cluster;         /* store first cluster */
	cluster++;
	cluster2start++;
	fat_buf_count += 2;

	if (cluster != max_cluster)
	{
  		do                                    /* construct the list */
  		{
			fat_count_sector();
/*
		    if(fat_buf_count == fat_sector_size)
			{
	          //fat_read_sector(fat_ptr_fats+(cluster2start/(fat_sector_size/2)));
			  //phy_read_open(fat_ptr_fats+(cluster2start/(fat_sector_size/2)));
		      phy_read_sector();
			  fat_buf_count = 0;
			  //phy_read_close();
			}
*/    
	        cluster_free = FALSE;
	        tmp_cluster.b[1] = gl_buffer[fat_buf_count];       
	        tmp_cluster.b[0] = gl_buffer[fat_buf_count+1];      
	

	        if (tmp_cluster.w == 0x0000)
	           	cluster_free = TRUE;

    		if (cluster_free)
    		{ /* free cluster: add it to the list */
          		if (chain[index].number == MAX_CL_PER_FRAG) 
          		{
            		index++;
            		chain[index].number = 1;
            		chain[index].cluster.w[1] = cluster;
          		}
          		else
          		{
            		chain[index].number++;
          		}
		  		cluster++;
		  		cluster2start++;
		  		fat_buf_count += 2;
	      		//count=(cluster2start%(fat_sector_size/2))*2;
    		}
    		else
    		{ /* cluster already used */
          		do                                  /* search for next free fragment */
          		{
		            cluster++;
					cluster2start++;
					fat_buf_count += 2;
			        //count=(cluster2start%(fat_sector_size/2))*2;
	
					fat_count_sector();
	
			        tmp_cluster.b[1] = gl_buffer[fat_buf_count];        
			        tmp_cluster.b[0] = gl_buffer[fat_buf_count+1];      
		
			        if (tmp_cluster.w == 0x0000)
					{
			           	cluster_free = TRUE;
					   	break;
					}

          		}
          		while (cluster != max_cluster);

          		if (!cluster_free)
          		{
		            if (chain[index].number == 1)
		            { /* last cluster is the current one */
		              	fat_last_clust_index = index;
		              	chain[fat_last_clust_index].number = 0; /* end of list marker */
		            }
		            else
		            {
		              	fat_last_clust_index = index + 1;
		              	chain[index].number--;
		              	chain[fat_last_clust_index].cluster.w[1] = chain[index].cluster.w[1] + chain[index].number;
		              	chain[fat_last_clust_index].number = 0; /* end of list marker */
		            }
		            return OK;                        /* end of partition reached */
          		}
  
	          	index++;
	          	chain[index].number = 1;
	          	chain[index].cluster.w[1] = cluster;
	          	cluster++;
			  	cluster2start++;
			  	fat_buf_count +=2;
		      	//count=(cluster2start%(fat_sector_size/2))*2;
      		}
	  		nb_cluster++;
  		}
  		while ((index != (nb_frag - 1)) && (cluster < max_cluster) && (nb_cluster < fat_max_cluster_number));
	}	

	fat_last_clust_index = index;
	return OK;
}
#endif //COMPILE_FAT_16

#if COMPILE_FAT_12 == TRUE
byte fat12_set_clusters (fat_st_clust_chain xdata *chain, Byte nb_frag)
{
	Byte     cluster_free;//,flag;
	Byte     fat12_parity;
	Byte    temp;
	Byte    index;
//	Uint16  count;
//word    sector_count; // 2004.2.25 modify
	Uint16  cluster;
	Uint16  max_cluster;
//	Union16 tmp_cluster;
//	Union32 cluster,cluster2start;
//	Union32 tmp_cluster;
//	Union32 max_cluster;	

	Uint16 nb_cluster;
	Uint16 max,min,mid;

    byte start_pos;
	Uint16 pos;
	byte sector_count ;
	byte max_sector;

   	max_cluster = fat_count_of_clusters;
    //max_cluster = fat_max_cluster_number;//2004.3.13 modify

  	index = 0;
  	nb_cluster = 0;
  	cluster_free = FALSE;

    phy_read_open(fat_ptr_fats);
	phy_read_sector();

	fat12_parity=0;    /*if is 0,then clusterNum is even,else is odd */

	max = fat_sector_size/3 - 2;
	min = 0;
	mid = (max - min)>>1 ;
	start_pos = 0;//(3 - (((Uint32)fat_sector_size) * sector_count) % 3)%3;
	pos = mid * 3 + start_pos;	
	max_sector = max_cluster / ((fat_sector_size / 3) << 1) + 1;
	sector_count = 0;

	do
	{
		while((max - min) > 1)
		{
			if((gl_buffer[pos] == 0x00) && (gl_buffer[pos + 1] == 0x00))
			{
				max = mid;
				mid = ((mid - min)>>1) + min;
				pos = mid * 3 + start_pos;			
			}
			else
			{
			    min = mid;
				mid = ((max - mid)>>1) + mid;
				pos = mid * 3 + start_pos;			
			}
		}
	
		if(max == (fat_sector_size/3 - 2))
		{
			phy_read_sector();
			sector_count++;
			min = 0;
            mid = (max - min)>>1 ;
			start_pos = (3 - (((Uint32)fat_sector_size) * sector_count) % 3)%3;
			pos = mid * 3 + start_pos;
		}
		else
		{
		    if(max == 1)
			{
			    if((gl_buffer[pos] == 0x00) && (gl_buffer[pos + 1] == 0x00))
				    max = 0;
			}
			fat_buf_count = start_pos + max * 3 + 2;
			//count += 2;
			temp = gl_buffer[fat_buf_count - 1];
			//cluster = 
			//cluster2start = ((((Uint32)fat_sector_size) * sector_count)/3) * 2 + (min + 1)*2;
			cluster = ((((Uint32)fat_sector_size) * sector_count)/3) * 2 + max*2 -2; //(max-1) * 2 ;//+ (((start_pos%3) == 0)?(0:1));
			if(start_pos%3 != 0)
				cluster += 2;
			cluster_free = TRUE;
			break;
		}
	}while(sector_count < max_sector);

	if((cluster_free==FALSE) || (cluster >= max_cluster))
	{
		return KO;     /* no free cluster found */
	}

	if(fat_buf_count >= fat_sector_size)
	{
		phy_read_sector();
		sector_count++;
		fat_buf_count = fat_buf_count - fat_sector_size;
	}

    /* At least we find one free cluster */
    chain[0].number = 1;
    chain[0].cluster.w[1] = cluster;        /* store the first cluster */
    cluster++;

	if(cluster != max_cluster)
	{
		do                                /* construct the list */
		{
			cluster_free = FALSE;
            if(fat12_parity == 0)
			{
				fat12_parity = 1;

				if(gl_buffer[fat_buf_count++] == 0x00)
				{
					fat_count_sector();
/*
					if(fat_buf_count == fat_sector_size)
					{
						phy_read_sector();
						fat_buf_count = 0;
					}
*/
					temp=gl_buffer[fat_buf_count++];

					if((temp & 0x0f)==0x00)
					{
						cluster_free=TRUE;
					}
				}
				else
				{
					fat_count_sector();
					temp=gl_buffer[fat_buf_count++];
				}
			}
			else
			{
				fat12_parity=0;

				if((temp & 0xf0)==0x00)
				{
					if(gl_buffer[fat_buf_count++]==0x00)
					{
						cluster_free=TRUE;
					}
				}
				else
				{
					fat_buf_count++;
				}
			}
            //2004.2.26 modify
			fat_count_sector();

			if(cluster_free)     /* free cluster: add it to the list */
			{
				if(chain[index].number == MAX_CL_PER_FRAG)
				{
					index++;
					chain[index].number=1;
					chain[index].cluster.w[1]=cluster;
					cluster++;
				}
				else
				{
					chain[index].number++;
					cluster++;
				}
			}
			else               /* cluster already used */
			{
				do             /* search for next free cluster */
				{
					if(fat12_parity==0)
					{
						fat12_parity=1;

						if(gl_buffer[fat_buf_count++]==0x00)
						{
							fat_count_sector();

							temp=gl_buffer[fat_buf_count++];

							//2004.2.26 modify
							fat_count_sector();

							if((temp & 0x0f)==0x00)
							{
								cluster_free=TRUE;
								break;
							}
							else
							{
								cluster++;
								fat_buf_count++;
							}
						}
						else
						{
							fat_count_sector();
							temp=gl_buffer[fat_buf_count++];
							cluster++;
						}
					}
					else
					{
						fat12_parity=0;

						if((temp & 0xf0)==0x00)
						{
							fat_count_sector();

							if(gl_buffer[fat_buf_count++]==0x00)
							{
								cluster_free=TRUE;
								break;
							}
							else
							{
								cluster++;
							}
						}
						else
						{
							fat_buf_count++;
							cluster++;
						}
					}
					fat_count_sector();
				}
				while((cluster+1)!=max_cluster);

			    if (!cluster_free)      /* In this new fragment, we don't find any free cluster */
				{
					if (chain[index].number == 1)
					{   /* last cluster is the current one */
						fat_last_clust_index = index;
						chain[fat_last_clust_index].number = 0; /* end of list marker */
					}
					else
					{
						fat_last_clust_index = index + 1;
						chain[index].number--;
						chain[fat_last_clust_index].cluster.w[1] = chain[index].cluster.w[1] + chain[index].number;
						chain[fat_last_clust_index].number = 0; /* end of list marker */
					}
					return OK;                        /* end of partition reached */
				}
			    cluster++;                          
			    index++;
			    chain[index].number = 1;
			    chain[index].cluster.w[1] = cluster;
			    cluster++;
			}   //else

			nb_cluster++ ;
		}
		while((index != (nb_frag - 1)) && ( (cluster + 1) < max_cluster) && (nb_cluster < fat_max_cluster_number));
    }
	fat_last_clust_index = index;
	return OK;
}
#endif //COMPILE_FAT_12


#if COMPILE_FAT_32 == TRUE
byte fat32_set_clusters (fat_st_clust_chain xdata *chain, Byte nb_frag)
{
	Byte     cluster_free;//,flag;
	Byte    index;
//	Uint16  max_cluster;
	Union32 cluster,cluster2start;
	Union32 tmp_cluster;	
	Uint16 nb_cluster;
	Uint16 max,min;

//   	max_cluster = fat_count_of_clusters;
    //max_cluster = fat_max_cluster_number;//2004.3.13 modify
  	index = 0;
  	nb_cluster = 0;
  	cluster_free = FALSE;

    phy_read_open(fat_ptr_fats);
	phy_read_sector();

	cluster.l = 0;
    cluster2start.l=0;//2;
 
    max = fat_sector_size>>2;
	min = 0;
	fat_buf_count = fat_sector_size>>3;
	do
	{
		while((max - min) > 1)
		{
		   tmp_cluster.b[3] = gl_buffer[fat_buf_count<<2];  
		   tmp_cluster.b[2] = gl_buffer[(fat_buf_count<<2)+1];
		   tmp_cluster.b[1] = gl_buffer[(fat_buf_count<<2)+2];
		   tmp_cluster.b[0] = gl_buffer[(fat_buf_count<<2)+3];
	  
		   if(tmp_cluster.l == 0x00000000)
		   {
		       max = fat_buf_count;
		   	   fat_buf_count = ((fat_buf_count - min) >> 1) + min ;			   
		   }
		   else
		   {
		       min = fat_buf_count;
		   	   fat_buf_count = ((max - fat_buf_count) >> 1) + fat_buf_count;		  
		   }		   
		}
        if(max == 1)
        {
		    tmp_cluster.b[3] = gl_buffer[0];   
		    tmp_cluster.b[2] = gl_buffer[1];
		    tmp_cluster.b[1] = gl_buffer[2];   
		    tmp_cluster.b[0] = gl_buffer[3];

			if(tmp_cluster.l == 0x00000000)
			{
				max = max - 1;
			}
	    }			//min = 
	  		 	 	 
		if(max == (fat_sector_size>>2))
		{
		 	phy_read_sector();
            max = fat_sector_size>>2;
			min = 0;
		    fat_buf_count = fat_sector_size>>3;
			cluster.l += max;
            //cluster2start += n;
		}
	    else
		{
		    fat_buf_count = max<<2;
		    cluster.l += max; //count / 2;
			//cluster2start += count / 2;
			cluster_free = TRUE;
			break;
		}
	}while(cluster.l < fat_count_of_clusters);

	cluster2start.l = cluster.l;
	cluster.l -= 2;	
	
	if(!cluster_free)
	{
		return KO;
	}

	chain[0].number = 1;
    chain[0].cluster.l = cluster.l;         /* store first cluster */
    cluster.l++;
	cluster2start.l++;
	fat_buf_count += 4;

	do
	{
		if(fat_buf_count == fat_sector_size)
		{
			fat_buf_count = 0;
			phy_read_sector();
		}
		cluster_free = FALSE;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区欧美在线观看| 日韩一区二区三区在线| 欧美人与性动xxxx| 欧美一区二区视频网站| 久久久一区二区三区捆绑**| 亚洲三级理论片| 天堂在线一区二区| 国产一本一道久久香蕉| 91丨九色丨蝌蚪富婆spa| 666欧美在线视频| 日本一区二区在线不卡| 一个色综合av| 国产乱子轮精品视频| 99riav一区二区三区| 欧美绝品在线观看成人午夜影视| 久久综合中文字幕| 亚洲成人自拍网| 国产成人在线视频网站| 欧美日韩久久久久久| 久久久久久电影| 亚洲国产一区二区a毛片| 激情综合网最新| 欧洲日韩一区二区三区| 国产三级久久久| 亚洲.国产.中文慕字在线| 成人一级视频在线观看| 欧美一区二区在线播放| 1024成人网色www| 精品系列免费在线观看| 欧美性受xxxx黑人xyx| 国产欧美日韩在线| 久久精品72免费观看| 精品国产乱码久久久久久老虎| 亚洲精品国产视频| 国产精品99久久久久久似苏梦涵| 欧美人体做爰大胆视频| 18成人在线观看| 国产成人久久精品77777最新版本| 欧美精品v日韩精品v韩国精品v| 国产精品三级电影| 久久99精品久久久久久| 欧美肥妇bbw| 一区二区在线免费| 成人sese在线| 久久久久青草大香线综合精品| 视频一区二区中文字幕| 91久久精品一区二区| 国产亚洲综合在线| 老司机午夜精品99久久| 欧美日韩免费在线视频| 亚洲欧洲国产日本综合| 成人激情免费电影网址| 欧美精品一区二| 免费看日韩a级影片| 欧美精品欧美精品系列| 亚洲一区二区高清| 色综合视频一区二区三区高清| 国产精品婷婷午夜在线观看| 国精品**一区二区三区在线蜜桃| 在线播放一区二区三区| 亚洲电影中文字幕在线观看| 色88888久久久久久影院野外| 国产精品国产三级国产有无不卡 | 在线区一区二视频| 亚洲欧洲日产国产综合网| 成人午夜av影视| 国产精品久久毛片a| 国产成人精品三级麻豆| 国产欧美一区二区三区在线看蜜臀| 韩国成人精品a∨在线观看| 欧美成人免费网站| 久久99最新地址| 亚洲精品一区二区三区福利| 国产一区二区三区不卡在线观看| 亚洲精品一线二线三线无人区| 人妖欧美一区二区| 欧美xfplay| 国产黄人亚洲片| 亚洲国产精品传媒在线观看| 成人av资源下载| 日韩毛片高清在线播放| 91看片淫黄大片一级| 一区二区久久久久| 欧美日韩亚洲综合在线 | 日韩精品中午字幕| 狠狠色丁香婷婷综合| 久久综合视频网| 国产盗摄女厕一区二区三区| 中文字幕不卡在线| 一本大道久久a久久精二百| 亚洲综合在线第一页| 7777精品伊人久久久大香线蕉| 毛片不卡一区二区| 国产亚洲视频系列| 91老师片黄在线观看| 午夜视频一区在线观看| 精品日韩一区二区| 国产成人自拍在线| 亚洲一区在线电影| 91精品国产高清一区二区三区 | 久久精品人人做人人综合| 国产不卡高清在线观看视频| 中文字幕中文字幕在线一区| 在线免费视频一区二区| 日本视频在线一区| 亚洲国产精品二十页| 欧美性大战久久久久久久| 午夜国产精品一区| 久久嫩草精品久久久久| 日本福利一区二区| 久久99久久久欧美国产| 国产精品久久久久一区二区三区| 色噜噜偷拍精品综合在线| 日本不卡视频在线观看| 国产午夜亚洲精品午夜鲁丝片| 色综合久久综合网97色综合| 日本成人中文字幕| 最新国产の精品合集bt伙计| 制服丝袜亚洲播放| 成人av在线一区二区三区| 亚洲电影一区二区| 国产三级精品视频| 88在线观看91蜜桃国自产| 国产精品亚洲第一区在线暖暖韩国| 亚洲欧美激情在线| 2017欧美狠狠色| 欧美日韩国产另类一区| 丁香天五香天堂综合| 亚洲一区影音先锋| 中文成人av在线| 日韩一区二区三| 色婷婷狠狠综合| 国产乱理伦片在线观看夜一区| 亚洲欧美偷拍另类a∨色屁股| 日韩欧美国产综合| 色爱区综合激月婷婷| 国产宾馆实践打屁股91| 日韩vs国产vs欧美| 一区二区久久久久| 国产欧美精品一区aⅴ影院| 日韩一区二区三区免费看 | 亚洲午夜视频在线观看| 欧美经典一区二区| 欧美一区二区三区免费大片| 91免费看`日韩一区二区| 国产在线播精品第三| 亚洲国产wwwccc36天堂| 中文字幕精品—区二区四季| 日韩欧美第一区| 欧美亚洲尤物久久| 99久久99久久综合| 狠狠色狠狠色合久久伊人| 婷婷开心激情综合| 亚洲人成影院在线观看| 亚洲国产精品精华液ab| 精品999久久久| 在线不卡一区二区| 欧美中文字幕一区| 99久久伊人精品| 风流少妇一区二区| 精品在线免费观看| 麻豆一区二区三| 日韩1区2区3区| 五月天丁香久久| 亚洲不卡在线观看| 一区二区三区高清在线| 亚洲欧美另类久久久精品2019| 亚洲欧美中日韩| 国产精品女同互慰在线看| 国产欧美一区二区精品性色超碰| 亚洲精品在线一区二区| 精品国产亚洲一区二区三区在线观看 | 日韩欧美国产电影| 欧美精品免费视频| 777午夜精品免费视频| 欧美日韩一区二区三区不卡| 在线观看免费视频综合| 在线观看国产日韩| 色狠狠综合天天综合综合| 一本色道久久综合精品竹菊| 99久久久国产精品| av福利精品导航| 91丨国产丨九色丨pron| 99久久伊人精品| 色婷婷综合久久久中文字幕| 91免费版在线| 欧美视频日韩视频| 欧美日韩国产另类一区| 91麻豆精品国产自产在线| 欧美高清性hdvideosex| 日韩欧美中文字幕一区| 精品美女被调教视频大全网站| 欧美成人一区二区三区在线观看| 精品黑人一区二区三区久久 | 日本高清不卡在线观看| 欧美日韩高清影院| 欧美成人精品3d动漫h| 精品欧美乱码久久久久久1区2区| 欧美精品一区二区三| 国产三级精品视频|