476 lines
48 KiB
Plaintext
476 lines
48 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="generator" content="TempleOS V5.03">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<link rel="stylesheet" href="/style/templeos.css">
|
||
|
<script src="/script/templeos.js"></script>
|
||
|
<style type="text/css">
|
||
|
.cF0{color:#000000;background-color:#ffffff;}
|
||
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
||
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
||
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
||
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
||
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||
|
.cF8{color:#555555;background-color:#ffffff;}
|
||
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
||
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
||
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
||
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
||
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
||
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="content">
|
||
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Info;File/Cmd Line (Typically);Cmd Line (Typically)"</span><span class=cF0>
|
||
|
<a name="l2"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>ChkDskConfirm</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> *_fix,</span><span class=cF1>Bool</span><span class=cF0> *_confirm)
|
||
|
<a name="l3"></a>{
|
||
|
<a name="l4"></a> </span><span class=cF1>if</span><span class=cF0> (*_fix && *_confirm) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l5"></a> </span><span class=cF6>"Fix "</span><span class=cF0>;
|
||
|
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>YorN</span><span class=cF0>)
|
||
|
<a name="l7"></a> *_fix=</span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l8"></a> *_confirm=</span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l9"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l10"></a> </span><span class=cF1>return</span><span class=cF0> *_fix;
|
||
|
<a name="l11"></a>}
|
||
|
<a name="l12"></a>
|
||
|
<a name="l13"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaChkDskLst</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv,</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1,
|
||
|
<a name="l14"></a> </span><span class=cF1>U8</span><span class=cF0> *bits,</span><span class=cF1>U8</span><span class=cF0> *bits2,</span><span class=cF9>I64</span><span class=cF0> size,</span><span class=cF9>I64</span><span class=cF0> bpc)
|
||
|
<a name="l15"></a>{
|
||
|
<a name="l16"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde2;
|
||
|
<a name="l17"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,errs=0;
|
||
|
<a name="l18"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l19"></a> tmpde2=tmpde1->next;
|
||
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1->attr & </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0> && tmpde1->sub)
|
||
|
<a name="l21"></a> errs+=</span><span class=cF5>RedSeaChkDskLst</span><span class=cF0>(dv,tmpde1->sub,bits,bits2,size,bpc);
|
||
|
<a name="l22"></a> j=(tmpde1->size+bpc-1)/bpc;
|
||
|
<a name="l23"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<j;i++) {
|
||
|
<a name="l24"></a> </span><span class=cF1>if</span><span class=cF0> (i+tmpde1->clus-dv->data_area>size) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l25"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Invalid Clus:%s Clus:%X\n"</span><span class=cF0>,tmpde1->full_name,
|
||
|
<a name="l26"></a> i+tmpde1->clus);
|
||
|
<a name="l27"></a> errs++;
|
||
|
<a name="l28"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>bits,i+tmpde1->clus-dv->data_area</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l31"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Dbl Alloc:%s Clus:%X\n"</span><span class=cF0>,tmpde1->full_name,
|
||
|
<a name="l32"></a> i+tmpde1->clus);
|
||
|
<a name="l33"></a> errs++;
|
||
|
<a name="l34"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>LBtr</span><span class=cF7>(</span><span class=cF0>bits2,i+tmpde1->clus-dv->data_area</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l36"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"UnAlloc:%s Clus:%X\n"</span><span class=cF0>,tmpde1->full_name,
|
||
|
<a name="l37"></a> i+tmpde1->clus);
|
||
|
<a name="l38"></a> errs++;
|
||
|
<a name="l39"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l40"></a> }
|
||
|
<a name="l41"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
|
||
|
<a name="l42"></a> tmpde1=tmpde2;
|
||
|
<a name="l43"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l44"></a> </span><span class=cF1>return</span><span class=cF0> errs;
|
||
|
<a name="l45"></a>}
|
||
|
<a name="l46"></a>
|
||
|
<a name="l47"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaChkDsk</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let,</span><span class=cF1>Bool</span><span class=cF0> *_fix,</span><span class=cF1>Bool</span><span class=cF0> *_confirm)
|
||
|
<a name="l48"></a>{
|
||
|
<a name="l49"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,bpc,size,errs=0;
|
||
|
<a name="l50"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let),*old_dv=</span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
||
|
<a name="l51"></a> </span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"%c:/*"</span><span class=cF0>,</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>dv</span><span class=cF7>)</span><span class=cF0>),
|
||
|
<a name="l52"></a> *old_dir=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir),
|
||
|
<a name="l53"></a> *bits,*bits2;
|
||
|
<a name="l54"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *ptr,*ptr2;
|
||
|
<a name="l55"></a>
|
||
|
<a name="l56"></a> </span><span class=cF5>Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l57"></a> </span><span class=cF6>"Scanning...\n"</span><span class=cF0>;
|
||
|
<a name="l58"></a> size=(dv->size-</span><span class=cF7>(</span><span class=cF0>dv->data_area-dv->drv_offset</span><span class=cF7>)</span><span class=cF0>)/dv->spc;
|
||
|
<a name="l59"></a> bpc=dv->spc<<</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
||
|
<a name="l60"></a> bits=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>size+7</span><span class=cF7>)</span><span class=cF0>>>3);
|
||
|
<a name="l61"></a> bits2=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>size+7</span><span class=cF7>)</span><span class=cF0>>>3+</span><span class=cF3>BLK_SIZE</span><span class=cF0>);
|
||
|
<a name="l62"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,bits2,dv->fat1,</span><span class=cF7>(</span><span class=cF0>(size+7)>>3+</span><span class=cF3>BLK_SIZE</span><span class=cF0>-1</span><span class=cF7>)</span><span class=cF0>>></span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>);
|
||
|
<a name="l63"></a>
|
||
|
<a name="l64"></a> </span><span class=cF2>//Get Root Dir size</span><span class=cF0>
|
||
|
<a name="l65"></a> ptr2=</span><span class=cF5>MAlloc</span><span class=cF0>(bpc);
|
||
|
<a name="l66"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,ptr2,dv->root_clus,1);
|
||
|
<a name="l67"></a> ptr=ptr2(</span><span class=cF1>U8</span><span class=cF0> *)-</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CDirEntry</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF0>);
|
||
|
<a name="l68"></a> j=(ptr->size+bpc-1)/bpc;
|
||
|
<a name="l69"></a> </span><span class=cF5>Free</span><span class=cF0>(ptr2);
|
||
|
<a name="l70"></a>
|
||
|
<a name="l71"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<j;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (i+dv->root_clus-dv->data_area>size) {
|
||
|
<a name="l73"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Invalid Clus: RootDir Clus:%X\n"</span><span class=cF0>,i+dv->root_clus);
|
||
|
<a name="l74"></a> errs++;
|
||
|
<a name="l75"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l76"></a> }
|
||
|
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>bits,i+dv->root_clus-dv->data_area</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l78"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Dbl Alloc: RootDir Clus:%X\n"</span><span class=cF0>,i+dv->root_clus);
|
||
|
<a name="l79"></a> errs++;
|
||
|
<a name="l80"></a> }
|
||
|
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>LBtr</span><span class=cF7>(</span><span class=cF0>bits2,i+dv->root_clus-dv->data_area</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l82"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"UnAlloc: RootDir Clus:%X\n"</span><span class=cF0>,i+dv->root_clus);
|
||
|
<a name="l83"></a> errs++;
|
||
|
<a name="l84"></a> }
|
||
|
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l86"></a>
|
||
|
<a name="l87"></a> errs+=</span><span class=cF5>RedSeaChkDskLst</span><span class=cF0>(dv,</span><span class=cF5>FilesFind</span><span class=cF7>(</span><span class=cF0>files_find_mask,</span><span class=cF3>FUF_RECURSE</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l88"></a> bits,bits2,size,bpc);
|
||
|
<a name="l89"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i<size;i++)
|
||
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>bits2,i</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l91"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Shouldn't Alloc Clus:%0X\n"</span><span class=cF0>,i+dv->data_area);
|
||
|
<a name="l92"></a> errs++;
|
||
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ChkDskConfirm</span><span class=cF7>(</span><span class=cF0>_fix,_confirm</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l94"></a> </span><span class=cF5>RedSeaFreeClus</span><span class=cF0>(dv,i+dv->data_area,1);
|
||
|
<a name="l95"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l96"></a>
|
||
|
<a name="l97"></a> </span><span class=cF5>Free</span><span class=cF0>(files_find_mask);
|
||
|
<a name="l98"></a> </span><span class=cF5>Free</span><span class=cF0>(bits);
|
||
|
<a name="l99"></a> </span><span class=cF5>Free</span><span class=cF0>(bits2);
|
||
|
<a name="l100"></a> </span><span class=cF5>Drv</span><span class=cF0>(</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>old_dv</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l101"></a> </span><span class=cF5>Cd</span><span class=cF0>(old_dir);
|
||
|
<a name="l102"></a> </span><span class=cF5>Free</span><span class=cF0>(old_dir);
|
||
|
<a name="l103"></a> </span><span class=cF1>return</span><span class=cF0> errs;
|
||
|
<a name="l104"></a>}
|
||
|
<a name="l105"></a>
|
||
|
<a name="l106"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>FAT32ChkDskLst</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv,</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1,
|
||
|
<a name="l107"></a> </span><span class=cF1>U8</span><span class=cF0> *bits,</span><span class=cF9>U32</span><span class=cF0> *bits2,</span><span class=cF9>I64</span><span class=cF0> size,</span><span class=cF9>I64</span><span class=cF0> bpc)
|
||
|
<a name="l108"></a>{
|
||
|
<a name="l109"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde2;
|
||
|
<a name="l110"></a> </span><span class=cF9>I64</span><span class=cF0> i,c,errs=0;
|
||
|
<a name="l111"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l112"></a> tmpde2=tmpde1->next;
|
||
|
<a name="l113"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1->attr & </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0> && tmpde1->sub)
|
||
|
<a name="l114"></a> errs+=</span><span class=cF5>FAT32ChkDskLst</span><span class=cF0>(dv,tmpde1->sub,bits,bits2,size,bpc);
|
||
|
<a name="l115"></a> i=0;
|
||
|
<a name="l116"></a> c=tmpde1->clus;
|
||
|
<a name="l117"></a> </span><span class=cF1>while</span><span class=cF0> (0<c<0x0FFFFFF8) {
|
||
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (c>size) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l119"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Invalid Clus:%s Clus:%X\n"</span><span class=cF0>,tmpde1->full_name,c);
|
||
|
<a name="l120"></a> errs++;
|
||
|
<a name="l121"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l122"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>bits,c</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l124"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Dbl Alloc:%s Clus:%X\n"</span><span class=cF0>,tmpde1->full_name,c);
|
||
|
<a name="l125"></a> errs++;
|
||
|
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (!bits2[c]) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l128"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"UnAlloc:%s Clus:%X\n"</span><span class=cF0>,tmpde1->full_name,c);
|
||
|
<a name="l129"></a> errs++;
|
||
|
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l131"></a> bits2[c]=0;
|
||
|
<a name="l132"></a> c=</span><span class=cF5>ClusNumNext</span><span class=cF0>(dv,c);
|
||
|
<a name="l133"></a> i++;
|
||
|
<a name="l134"></a> }
|
||
|
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpde1->attr & </span><span class=cF3>RS_ATTR_DIR</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l136"></a> i*=bpc;
|
||
|
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1->size>i) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l138"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Alloced File Too Short:%s\n"</span><span class=cF0>,tmpde1->full_name);
|
||
|
<a name="l139"></a> errs++;
|
||
|
<a name="l140"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (i>tmpde1->size+bpc-1) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l142"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Alloced File Too Long:%s\n"</span><span class=cF0>,tmpde1->full_name);
|
||
|
<a name="l143"></a> errs++;
|
||
|
<a name="l144"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l145"></a> }
|
||
|
<a name="l146"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
|
||
|
<a name="l147"></a> tmpde1=tmpde2;
|
||
|
<a name="l148"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l149"></a> </span><span class=cF1>return</span><span class=cF0> errs;
|
||
|
<a name="l150"></a>}
|
||
|
<a name="l151"></a>
|
||
|
<a name="l152"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>FAT32ChkDsk</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let,</span><span class=cF1>Bool</span><span class=cF0> *_fix,</span><span class=cF1>Bool</span><span class=cF0> *_confirm)
|
||
|
<a name="l153"></a>{
|
||
|
<a name="l154"></a> </span><span class=cF9>I64</span><span class=cF0> i,bpc,size,c,errs=0;
|
||
|
<a name="l155"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let),*old_dv=</span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
||
|
<a name="l156"></a> </span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"%c:/*"</span><span class=cF0>,</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>dv</span><span class=cF7>)</span><span class=cF0>),
|
||
|
<a name="l157"></a> *old_dir=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir),
|
||
|
<a name="l158"></a> *bits;
|
||
|
<a name="l159"></a> </span><span class=cF9>U32</span><span class=cF0> *bits2;
|
||
|
<a name="l160"></a> </span><span class=cF5>Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l161"></a> </span><span class=cF6>"Scanning...\n"</span><span class=cF0>;
|
||
|
<a name="l162"></a> size=(dv->size-</span><span class=cF7>(</span><span class=cF0>dv->data_area-dv->drv_offset</span><span class=cF7>)</span><span class=cF0>)/dv->spc;
|
||
|
<a name="l163"></a> bpc=dv->spc<<</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
||
|
<a name="l164"></a> bits=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>size+7</span><span class=cF7>)</span><span class=cF0>>>3);
|
||
|
<a name="l165"></a> bits2=</span><span class=cF5>CAlloc</span><span class=cF0>(size*4+</span><span class=cF3>BLK_SIZE</span><span class=cF0>);
|
||
|
<a name="l166"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,bits2,dv->fat1,</span><span class=cF7>(</span><span class=cF0>size*4+</span><span class=cF3>BLK_SIZE</span><span class=cF0>-1</span><span class=cF7>)</span><span class=cF0>>></span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>);
|
||
|
<a name="l167"></a>
|
||
|
<a name="l168"></a> c=dv->root_clus;
|
||
|
<a name="l169"></a> </span><span class=cF1>while</span><span class=cF0> (0<c<0x0FFFFFF8) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (c>size) {
|
||
|
<a name="l171"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Invalid Clus: RootDir Clus:%X\n"</span><span class=cF0>,c);
|
||
|
<a name="l172"></a> errs++;
|
||
|
<a name="l173"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l174"></a> }
|
||
|
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>bits,c</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l176"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Dbl Alloc: RootDir Clus:%X\n"</span><span class=cF0>,c);
|
||
|
<a name="l177"></a> errs++;
|
||
|
<a name="l178"></a> }
|
||
|
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (!bits2[c]) {
|
||
|
<a name="l180"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"UnAlloc: RootDir Clus:%X\n"</span><span class=cF0>,c);
|
||
|
<a name="l181"></a> errs++;
|
||
|
<a name="l182"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l183"></a> bits2[c]=0;
|
||
|
<a name="l184"></a> c=</span><span class=cF5>ClusNumNext</span><span class=cF0>(dv,c);
|
||
|
<a name="l185"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l186"></a>
|
||
|
<a name="l187"></a> errs+=</span><span class=cF5>FAT32ChkDskLst</span><span class=cF0>(dv,</span><span class=cF5>FilesFind</span><span class=cF7>(</span><span class=cF0>files_find_mask,</span><span class=cF3>FUF_RECURSE</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l188"></a> bits,bits2,size,bpc);
|
||
|
<a name="l189"></a>
|
||
|
<a name="l190"></a> bits2[1]=0; </span><span class=cF2>//See </span><a href="/Wb/Kernel/BlkDev/FileSysFAT.HC.HTML#l48"><span class=cF4>FAT32Fmt</span></a><span class=cF2>()</span><span class=cF0>
|
||
|
<a name="l191"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i<size;i++)
|
||
|
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (bits2[i]) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l193"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Shouldn't Alloc Clus:%0X\n"</span><span class=cF0>,i);
|
||
|
<a name="l194"></a> errs++;
|
||
|
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ChkDskConfirm</span><span class=cF7>(</span><span class=cF0>_fix,_confirm</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l196"></a> </span><span class=cF5>FAT32FreeClus</span><span class=cF0>(dv,i);
|
||
|
<a name="l197"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l198"></a> </span><span class=cF5>Free</span><span class=cF0>(files_find_mask);
|
||
|
<a name="l199"></a> </span><span class=cF5>Free</span><span class=cF0>(bits);
|
||
|
<a name="l200"></a> </span><span class=cF5>Free</span><span class=cF0>(bits2);
|
||
|
<a name="l201"></a> </span><span class=cF5>Drv</span><span class=cF0>(</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>old_dv</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l202"></a> </span><span class=cF5>Cd</span><span class=cF0>(old_dir);
|
||
|
<a name="l203"></a> </span><span class=cF5>Free</span><span class=cF0>(old_dir);
|
||
|
<a name="l204"></a> </span><span class=cF1>return</span><span class=cF0> errs;
|
||
|
<a name="l205"></a>}
|
||
|
<a name="l206"></a>
|
||
|
<a name="l207"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DskChk</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0,</span><span class=cF1>Bool</span><span class=cF0> fix=</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> confirm=</span><span class=cF3>TRUE</span><span class=cF0>)
|
||
|
<a name="l208"></a>{</span><span class=cF2>//Check disk for allocation errors and, optionally, fix.</span><span class=cF0>
|
||
|
<a name="l209"></a></span><span class=cF2>//You probably want to reformat and reinstall.</span><span class=cF0>
|
||
|
<a name="l210"></a> </span><span class=cF9>I64</span><span class=cF0> errs=0;
|
||
|
<a name="l211"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l212"></a> </span><span class=cF1>switch</span><span class=cF0> (dv->fs_type) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l213"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
||
|
<a name="l214"></a> errs=</span><span class=cF5>RedSeaChkDsk</span><span class=cF0>(drv_let,&fix,&confirm);
|
||
|
<a name="l215"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l216"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
||
|
<a name="l217"></a> errs=</span><span class=cF5>FAT32ChkDsk</span><span class=cF0>(drv_let,&fix,&confirm);
|
||
|
<a name="l218"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l219"></a> </span><span class=cF1>default</span><span class=cF0>:
|
||
|
<a name="l220"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
||
|
<a name="l221"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (errs) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l223"></a> </span><span class=cF1>if</span><span class=cF0> (fix)
|
||
|
<a name="l224"></a> </span><span class=cF6>"It might be a little better. "</span><span class=cF0>;
|
||
|
<a name="l225"></a> </span><span class=cF6>"Copy files to another partition or CD/DVD, "</span><span class=cF0>
|
||
|
<a name="l226"></a> </span><span class=cF6>"reformat, and copy back. "</span><span class=cF0>
|
||
|
<a name="l227"></a> </span><span class=cF6>"Or, copy from a back-up.\n"</span><span class=cF0>;
|
||
|
<a name="l228"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l229"></a> </span><span class=cF1>return</span><span class=cF0> errs;
|
||
|
<a name="l230"></a>}
|
||
|
<a name="l231"></a>
|
||
|
<a name="l232"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RedSeaDrvView</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
||
|
<a name="l233"></a>{
|
||
|
<a name="l234"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l235"></a> </span><span class=cF9>I64</span><span class=cF0> lohi,c1,i,x,y,l=(</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-3*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)*(</span><span class=cF3>GR_WIDTH</span><span class=cF0>-</span><span class=cF3>FONT_WIDTH</span><span class=cF0><<1),
|
||
|
<a name="l236"></a> s=dv->size+dv->drv_offset-dv->data_area;
|
||
|
<a name="l237"></a> </span><span class=cF1>U8</span><span class=cF0> *bitmap;
|
||
|
<a name="l238"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
|
||
|
<a name="l239"></a>
|
||
|
<a name="l240"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
||
|
<a name="l241"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
||
|
<a name="l242"></a> </span><span class=cF5>WinBorder</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
|
||
|
<a name="l243"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
||
|
<a name="l244"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
||
|
<a name="l245"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
||
|
<a name="l246"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l247"></a> i=(</span><span class=cF7>(</span><span class=cF0>s+7</span><span class=cF7>)</span><span class=cF0>>>3+</span><span class=cF3>BLK_SIZE</span><span class=cF0>-1)>></span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
||
|
<a name="l248"></a> bitmap=</span><span class=cF5>MAlloc</span><span class=cF0>(i<<</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>);
|
||
|
<a name="l249"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,bitmap,dv->fat1,i);
|
||
|
<a name="l250"></a> i=0;
|
||
|
<a name="l251"></a> </span><span class=cF1>for</span><span class=cF0> (y=0;y<</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-3*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;y++) {
|
||
|
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ScanKey</span><span class=cF0>)
|
||
|
<a name="l253"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l254"></a> </span><span class=cF1>for</span><span class=cF0> (x=0;x<</span><span class=cF3>GR_WIDTH</span><span class=cF0>-</span><span class=cF3>FONT_WIDTH</span><span class=cF0><<1;x++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l255"></a> lohi=i*s;
|
||
|
<a name="l256"></a> c1=lohi/l;
|
||
|
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>bitmap,c1</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l258"></a> dc->color=</span><span class=cF3>ROP_XOR</span><span class=cF0>+</span><span class=cF3>BLUE</span><span class=cF0>^</span><span class=cF3>TRANSPARENT</span><span class=cF0>;
|
||
|
<a name="l259"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l260"></a> dc->color=</span><span class=cF3>ROP_XOR</span><span class=cF0>+</span><span class=cF3>WHITE</span><span class=cF0>^</span><span class=cF3>TRANSPARENT</span><span class=cF0>;
|
||
|
<a name="l261"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,x,y);
|
||
|
<a name="l262"></a> i++;
|
||
|
<a name="l263"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l264"></a> }
|
||
|
<a name="l265"></a> </span><span class=cF5>Free</span><span class=cF0>(bitmap);
|
||
|
<a name="l266"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
||
|
<a name="l267"></a> </span><span class=cF5>DrvUnlock</span><span class=cF0>(dv);
|
||
|
<a name="l268"></a> </span><span class=cF5>GetChar</span><span class=cF0>;
|
||
|
<a name="l269"></a>
|
||
|
<a name="l270"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
||
|
<a name="l271"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
||
|
<a name="l272"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
||
|
<a name="l273"></a>}
|
||
|
<a name="l274"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FAT32DrvView</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
||
|
<a name="l275"></a>{
|
||
|
<a name="l276"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l277"></a> </span><span class=cF9>I64</span><span class=cF0> lohi,c1,i,x,y,l=(</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-3*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)*(</span><span class=cF3>GR_WIDTH</span><span class=cF0>-</span><span class=cF3>FONT_WIDTH</span><span class=cF0><<1),
|
||
|
<a name="l278"></a> s=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset);
|
||
|
<a name="l279"></a> </span><span class=cF9>U32</span><span class=cF0> *bitmap;
|
||
|
<a name="l280"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
|
||
|
<a name="l281"></a>
|
||
|
<a name="l282"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
||
|
<a name="l283"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
||
|
<a name="l284"></a> </span><span class=cF5>WinBorder</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
|
||
|
<a name="l285"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
||
|
<a name="l286"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
||
|
<a name="l287"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
||
|
<a name="l288"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l289"></a> i=(s*4+</span><span class=cF3>BLK_SIZE</span><span class=cF0>-1)>></span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
||
|
<a name="l290"></a> bitmap=</span><span class=cF5>MAlloc</span><span class=cF0>(i<<</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>);
|
||
|
<a name="l291"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,bitmap,dv->fat1,i);
|
||
|
<a name="l292"></a> i=0;
|
||
|
<a name="l293"></a> </span><span class=cF1>for</span><span class=cF0> (y=0;y<</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-3*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;y++) {
|
||
|
<a name="l294"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ScanKey</span><span class=cF0>)
|
||
|
<a name="l295"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l296"></a> </span><span class=cF1>for</span><span class=cF0> (x=0;x<</span><span class=cF3>GR_WIDTH</span><span class=cF0>-</span><span class=cF3>FONT_WIDTH</span><span class=cF0><<1;x++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l297"></a> lohi=i*s;
|
||
|
<a name="l298"></a> c1=lohi/l;
|
||
|
<a name="l299"></a> </span><span class=cF1>if</span><span class=cF0> (bitmap[c1])
|
||
|
<a name="l300"></a> dc->color=</span><span class=cF3>ROP_XOR</span><span class=cF0>+</span><span class=cF3>BLUE</span><span class=cF0>^</span><span class=cF3>TRANSPARENT</span><span class=cF0>;
|
||
|
<a name="l301"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l302"></a> dc->color=</span><span class=cF3>ROP_XOR</span><span class=cF0>+</span><span class=cF3>WHITE</span><span class=cF0>^</span><span class=cF3>TRANSPARENT</span><span class=cF0>;
|
||
|
<a name="l303"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,x,y);
|
||
|
<a name="l304"></a> i++;
|
||
|
<a name="l305"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l306"></a> }
|
||
|
<a name="l307"></a> </span><span class=cF5>Free</span><span class=cF0>(bitmap);
|
||
|
<a name="l308"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
||
|
<a name="l309"></a> </span><span class=cF5>DrvUnlock</span><span class=cF0>(dv);
|
||
|
<a name="l310"></a> </span><span class=cF5>GetChar</span><span class=cF0>;
|
||
|
<a name="l311"></a>
|
||
|
<a name="l312"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
||
|
<a name="l313"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
||
|
<a name="l314"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
||
|
<a name="l315"></a>}
|
||
|
<a name="l316"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrvView</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
||
|
<a name="l317"></a>{</span><span class=cF2>//Drive view. Graph the allocation map's fragmentation.</span><span class=cF0>
|
||
|
<a name="l318"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let),*old_dv=</span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
||
|
<a name="l319"></a> </span><span class=cF5>Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l320"></a> </span><span class=cF1>switch</span><span class=cF0> (dv->fs_type) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l321"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
||
|
<a name="l322"></a> </span><span class=cF5>RedSeaDrvView</span><span class=cF0>(drv_let);
|
||
|
<a name="l323"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l324"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
||
|
<a name="l325"></a> </span><span class=cF5>FAT32DrvView</span><span class=cF0>(drv_let);
|
||
|
<a name="l326"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l327"></a> </span><span class=cF1>default</span><span class=cF0>:
|
||
|
<a name="l328"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
||
|
<a name="l329"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l330"></a> </span><span class=cF5>Drv</span><span class=cF0>(</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>old_dv</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l331"></a>}
|
||
|
<a name="l332"></a>
|
||
|
<a name="l333"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DskView</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
||
|
<a name="l334"></a>{</span><span class=cF2>//Disk view. Pie chart of partition sizes.</span><span class=cF0>
|
||
|
<a name="l335"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,attr,
|
||
|
<a name="l336"></a> h=</span><span class=cF5>Fs</span><span class=cF0>->pix_width,
|
||
|
<a name="l337"></a> v=</span><span class=cF5>Fs</span><span class=cF0>->pix_height,
|
||
|
<a name="l338"></a> radius;
|
||
|
<a name="l339"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv;
|
||
|
<a name="l340"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd=</span><span class=cF5>Let2BlkDev</span><span class=cF0>(drv_let);
|
||
|
<a name="l341"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
|
||
|
<a name="l342"></a> </span><span class=cF1>F64</span><span class=cF0> sect_start,sect_end;
|
||
|
<a name="l343"></a>
|
||
|
<a name="l344"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
||
|
<a name="l345"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
||
|
<a name="l346"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
||
|
<a name="l347"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
||
|
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (h<v)
|
||
|
<a name="l349"></a> radius=0.4*h;
|
||
|
<a name="l350"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l351"></a> radius=0.4*v;
|
||
|
<a name="l352"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
||
|
<a name="l353"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,h>>1,v>>1,radius);
|
||
|
<a name="l354"></a>
|
||
|
<a name="l355"></a> j=1;
|
||
|
<a name="l356"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cF3>DRVS_NUM</span><span class=cF0>;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l357"></a> dv=&</span><span class=cFB>blkdev</span><span class=cF0>.drvs[i];
|
||
|
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (bd==dv->bd && dv->fs_type) {
|
||
|
<a name="l359"></a> sect_start=-(dv->drv_offset*2*</span><span class=cF3>pi</span><span class=cF0>/</span><span class=cF7>(</span><span class=cF0>bd->max_blk+1</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l360"></a> sect_end =-(</span><span class=cF7>(</span><span class=cF0>dv->drv_offset+dv->size</span><span class=cF7>)</span><span class=cF0>*2*</span><span class=cF3>pi</span><span class=cF0>/</span><span class=cF7>(</span><span class=cF0>bd->max_blk+1</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l361"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
||
|
<a name="l362"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,h>>1,v>>1,
|
||
|
<a name="l363"></a> h>>1+radius*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>sect_start</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l364"></a> v>>1+radius*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>sect_start</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l365"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,h>>1,v>>1,
|
||
|
<a name="l366"></a> h>>1+radius*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>sect_end</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l367"></a> v>>1+radius*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>sect_end</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l368"></a>
|
||
|
<a name="l369"></a> attr=</span><span class=cF5>DrvTextAttrGet</span><span class=cF0>(</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>dv</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l370"></a> dc->color=attr&15;
|
||
|
<a name="l371"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,v-</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>*j,</span><span class=cF6>"%C %-8Z"</span><span class=cF0>,</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>dv</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l372"></a> dv->fs_type,</span><span class=cF6>"ST_DRV_TYPES"</span><span class=cF0>);
|
||
|
<a name="l373"></a> dc->color.c1=attr>>4;
|
||
|
<a name="l374"></a> dc->color|=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
|
||
|
<a name="l375"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc,
|
||
|
<a name="l376"></a> h>>1+</span><span class=cF7>(</span><span class=cF0>radius-4</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>(sect_start+sect_end)/2</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l377"></a> v>>1+</span><span class=cF7>(</span><span class=cF0>radius-4</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>(sect_start+sect_end)/2</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>);
|
||
|
<a name="l378"></a> j++;
|
||
|
<a name="l379"></a> }
|
||
|
<a name="l380"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l381"></a>
|
||
|
<a name="l382"></a> </span><span class=cF5>GetChar</span><span class=cF0>(,</span><span class=cF3>FALSE</span><span class=cF0>);
|
||
|
<a name="l383"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
||
|
<a name="l384"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
||
|
<a name="l385"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
||
|
<a name="l386"></a>}
|
||
|
<a name="l387"></a>
|
||
|
<a name="l388"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaUnusedDrvSpace</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
||
|
<a name="l389"></a>{
|
||
|
<a name="l390"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l391"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,i,l;
|
||
|
<a name="l392"></a> </span><span class=cF1>U8</span><span class=cF0> *bitmap;
|
||
|
<a name="l393"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l394"></a> l=dv->size+dv->drv_offset-dv->data_area;
|
||
|
<a name="l395"></a> i=(</span><span class=cF7>(</span><span class=cF0>l+7</span><span class=cF7>)</span><span class=cF0>>>3+</span><span class=cF3>BLK_SIZE</span><span class=cF0>-1)>></span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
||
|
<a name="l396"></a> bitmap=</span><span class=cF5>MAlloc</span><span class=cF0>(i<<</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>);
|
||
|
<a name="l397"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,bitmap,dv->fat1,i);
|
||
|
<a name="l398"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<l;i++)
|
||
|
<a name="l399"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>bitmap,i</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l400"></a> res++;
|
||
|
<a name="l401"></a> </span><span class=cF5>Free</span><span class=cF0>(bitmap);
|
||
|
<a name="l402"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
||
|
<a name="l403"></a> </span><span class=cF5>DrvUnlock</span><span class=cF0>(dv);
|
||
|
<a name="l404"></a> </span><span class=cF1>return</span><span class=cF0> res*</span><span class=cF3>BLK_SIZE</span><span class=cF0>*dv->spc;
|
||
|
<a name="l405"></a>}
|
||
|
<a name="l406"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>FAT32UnusedDrvSpace</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
||
|
<a name="l407"></a>{
|
||
|
<a name="l408"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l409"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,i,l;
|
||
|
<a name="l410"></a> </span><span class=cF9>U32</span><span class=cF0> *bitmap;
|
||
|
<a name="l411"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l412"></a> l=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset);
|
||
|
<a name="l413"></a> i=(l*4+</span><span class=cF3>BLK_SIZE</span><span class=cF0>-1)>></span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
||
|
<a name="l414"></a> bitmap=</span><span class=cF5>MAlloc</span><span class=cF0>(i<<</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>);
|
||
|
<a name="l415"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,bitmap,dv->fat1,i);
|
||
|
<a name="l416"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<l;i++)
|
||
|
<a name="l417"></a> </span><span class=cF1>if</span><span class=cF0> (!bitmap[i])
|
||
|
<a name="l418"></a> res++;
|
||
|
<a name="l419"></a> </span><span class=cF5>Free</span><span class=cF0>(bitmap);
|
||
|
<a name="l420"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
||
|
<a name="l421"></a> </span><span class=cF5>DrvUnlock</span><span class=cF0>(dv);
|
||
|
<a name="l422"></a> </span><span class=cF1>return</span><span class=cF0> res*</span><span class=cF3>BLK_SIZE</span><span class=cF0>*dv->spc;
|
||
|
<a name="l423"></a>}
|
||
|
<a name="l424"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DrvUnused</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
||
|
<a name="l425"></a>{</span><span class=cF2>//Returns unused size in bytes.</span><span class=cF0>
|
||
|
<a name="l426"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let),*old_dv=</span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
||
|
<a name="l427"></a> </span><span class=cF1>U8</span><span class=cF0> *old_dir=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
||
|
<a name="l428"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
|
||
|
<a name="l429"></a> </span><span class=cF5>Drv</span><span class=cF0>(drv_let);
|
||
|
<a name="l430"></a> </span><span class=cF1>switch</span><span class=cF0> (dv->fs_type) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l431"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
||
|
<a name="l432"></a> res=</span><span class=cF5>RedSeaUnusedDrvSpace</span><span class=cF0>(drv_let);
|
||
|
<a name="l433"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l434"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
||
|
<a name="l435"></a> res=</span><span class=cF5>FAT32UnusedDrvSpace</span><span class=cF0>(drv_let);
|
||
|
<a name="l436"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l437"></a> </span><span class=cF1>default</span><span class=cF0>:
|
||
|
<a name="l438"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
||
|
<a name="l439"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l440"></a> </span><span class=cF5>Drv</span><span class=cF0>(</span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF0>old_dv</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l441"></a> </span><span class=cF5>Cd</span><span class=cF0>(old_dir);
|
||
|
<a name="l442"></a> </span><span class=cF5>Free</span><span class=cF0>(old_dir);
|
||
|
<a name="l443"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l444"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|