398 lines
44 KiB
HTML
Executable File
398 lines
44 KiB
HTML
Executable File
<!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=cF1>Bool</span><span class=cF0> </span><span class=cF5>DrvLock</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv)
|
|
<a name="l2"></a>{</span><span class=cF2>//Make this task have exclusive access to drv & BlkDev.</span><span class=cF0>
|
|
<a name="l3"></a> </span><span class=cF5>DrvChk</span><span class=cF0>(dv);
|
|
<a name="l4"></a> </span><span class=cF5>BlkDevLock</span><span class=cF0>(dv->bd);
|
|
<a name="l5"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&dv->locked_flags,</span><span class=cF3>DVlf_LOCKED</span><span class=cF7>)</span><span class=cF0> || dv->owning_task!=</span><span class=cF5>Fs</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&dv->locked_flags,</span><span class=cF3>DVlf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l7"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l8"></a> dv->owning_task=</span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l9"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l10"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l11"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l12"></a>}
|
|
<a name="l13"></a>
|
|
<a name="l14"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DrvUnlock</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv,</span><span class=cF1>Bool</span><span class=cF0> rst=</span><span class=cF3>FALSE</span><span class=cF0>)
|
|
<a name="l15"></a>{</span><span class=cF2>//Release exclusive lock on access to drv & BlkDev.</span><span class=cF0>
|
|
<a name="l16"></a> </span><span class=cF5>DrvChk</span><span class=cF0>(dv);
|
|
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&dv->locked_flags,</span><span class=cF3>DVlf_LOCKED</span><span class=cF7>)</span><span class=cF0> && dv->owning_task==</span><span class=cF5>Fs</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(dv->bd,rst);
|
|
<a name="l19"></a> dv->owning_task=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l20"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&dv->locked_flags,</span><span class=cF3>DVlf_LOCKED</span><span class=cF0>);
|
|
<a name="l21"></a> </span><span class=cF5>Yield</span><span class=cF0>; </span><span class=cF2>//Prevent deadlock</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l24"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l25"></a>}
|
|
<a name="l26"></a>
|
|
<a name="l27"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrvsRelease</span><span class=cF0>()
|
|
<a name="l28"></a>{</span><span class=cF2>//When task dies, release all owned drvs.</span><span class=cF0>
|
|
<a name="l29"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l30"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv;
|
|
<a name="l31"></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="l32"></a> dv=&</span><span class=cFB>blkdev</span><span class=cF0>.drvs[i];
|
|
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (dv->owning_task==</span><span class=cF5>Fs</span><span class=cF0> && dv->dv_signature==</span><span class=cF3>DRV_SIGNATURE_VAL</span><span class=cF0>)
|
|
<a name="l34"></a> </span><span class=cF5>DrvUnlock</span><span class=cF0>(dv,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l35"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l36"></a>}
|
|
<a name="l37"></a>
|
|
<a name="l38"></a></span><span class=cF9>CDrv</span><span class=cF0> *</span><span class=cF5>DrvMakeFreeSlot</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let)
|
|
<a name="l39"></a>{</span><span class=cF2>//Make a slot free for a new drv, like during </span><a href="/Wb/Adam/ABlkDev/Mount.HC.HTML#l138"><span class=cF4>Mount</span></a><span class=cF2>().</span><span class=cF0>
|
|
<a name="l40"></a></span><span class=cF2>//!!! drv_let is not a </span><a href="/Wb/Kernel/BlkDev/DskDrv.HC.HTML#l252"><span class=cF4>remapped</span></a><span class=cF2> drv.</span><span class=cF0>
|
|
<a name="l41"></a> </span><span class=cF9>I64</span><span class=cF0> i=</span><span class=cF5>Let2Let</span><span class=cF0>(drv_let)-</span><span class=cF6>'A'</span><span class=cF0>;
|
|
<a name="l42"></a> </span><span class=cF9>CDrv</span><span class=cF0> *res;
|
|
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>0<=i<</span><span class=cF3>DRVS_NUM</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l44"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l45"></a> res=&</span><span class=cFB>blkdev</span><span class=cF0>.drvs[i];
|
|
<a name="l46"></a> </span><span class=cF5>MemSet</span><span class=cF0>(res,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDrv</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l47"></a> res->drv_let=</span><span class=cF6>'A'</span><span class=cF0>+i;
|
|
<a name="l48"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l49"></a>}
|
|
<a name="l50"></a>
|
|
<a name="l51"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cF5>DrvNextFreeLet</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> first_drv_let=</span><span class=cF6>'C'</span><span class=cF0>)
|
|
<a name="l52"></a>{</span><span class=cF2>//Locate free slot for new drv, like during </span><a href="/Wb/Adam/ABlkDev/Mount.HC.HTML#l138"><span class=cF4>Mount</span></a><span class=cF2>().</span><span class=cF0>
|
|
<a name="l53"></a></span><span class=cF2>//!!! first_drv_let is not a </span><a href="/Wb/Kernel/BlkDev/DskDrv.HC.HTML#l252"><span class=cF4>remapped</span></a><span class=cF2> drv.</span><span class=cF0>
|
|
<a name="l54"></a> </span><span class=cF9>I64</span><span class=cF0> i=</span><span class=cF5>Let2Let</span><span class=cF0>(first_drv_let)-</span><span class=cF6>'A'</span><span class=cF0>,type=</span><span class=cF5>Let2BlkDevType</span><span class=cF0>(first_drv_let);
|
|
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>0<=i<</span><span class=cF3>DRVS_NUM</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l56"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l57"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>blkdev</span><span class=cF0>.drvs[i].dv_signature!=</span><span class=cF3>DRV_SIGNATURE_VAL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Let2BlkDevType</span><span class=cF7>(</span><span class=cF0>i+</span><span class=cF6>'A'</span><span class=cF7>)</span><span class=cF0>!=type)
|
|
<a name="l60"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l61"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l62"></a> </span><span class=cF1>return</span><span class=cF0> i+</span><span class=cF6>'A'</span><span class=cF0>;
|
|
<a name="l63"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l64"></a> </span><span class=cF1>while</span><span class=cF0> (++i<</span><span class=cF3>DRVS_NUM</span><span class=cF0>);
|
|
<a name="l65"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l66"></a> </span><span class=cF1>return</span><span class=cF0> 0; </span><span class=cF2>//Never gets here.</span><span class=cF0>
|
|
<a name="l67"></a>}
|
|
<a name="l68"></a>
|
|
<a name="l69"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrvDel</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv)
|
|
<a name="l70"></a>{</span><span class=cF2>//Delete drv</span><span class=cF0>
|
|
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (dv->fs_type==</span><span class=cF3>FSt_REDSEA</span><span class=cF0> && dv->next_free)
|
|
<a name="l72"></a> </span><span class=cFD>RedSeaFreeFreeLst</span><span class=cF0>(dv);
|
|
<a name="l73"></a> </span><span class=cF5>Free</span><span class=cF0>(dv->cur_fat_blk);
|
|
<a name="l74"></a> </span><span class=cF5>Free</span><span class=cF0>(dv->fis);
|
|
<a name="l75"></a> </span><span class=cF5>MemSet</span><span class=cF0>(dv,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDrv</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l76"></a>}
|
|
<a name="l77"></a>
|
|
<a name="l78"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>DrvBlkDevDel</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd)
|
|
<a name="l79"></a>{</span><span class=cF2>//Delete drv's of BlkDev</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l81"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv;
|
|
<a name="l82"></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="l83"></a> dv=&</span><span class=cFB>blkdev</span><span class=cF0>.drvs[i];
|
|
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (dv->bd==bd)
|
|
<a name="l85"></a> </span><span class=cF5>DrvDel</span><span class=cF0>(dv);
|
|
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l87"></a>}
|
|
<a name="l88"></a>
|
|
<a name="l89"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>DrvFATBlkAlloc</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv)
|
|
<a name="l90"></a>{
|
|
<a name="l91"></a> </span><span class=cF5>DrvChk</span><span class=cF0>(dv);
|
|
<a name="l92"></a> </span><span class=cF5>Free</span><span class=cF0>(dv->cur_fat_blk);
|
|
<a name="l93"></a> dv->cur_fat_blk=</span><span class=cF5>AMAlloc</span><span class=cF0>(</span><span class=cF3>BLK_SIZE</span><span class=cF0>);
|
|
<a name="l94"></a> dv->cur_fat_blk_num=0;
|
|
<a name="l95"></a> dv->fat_blk_dirty=0;
|
|
<a name="l96"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,dv->cur_fat_blk,dv->fat1,1);
|
|
<a name="l97"></a>}
|
|
<a name="l98"></a>
|
|
<a name="l99"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>DrvFATBlkClean</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv,</span><span class=cF9>I64</span><span class=cF0> fat_sel=3)
|
|
<a name="l100"></a>{
|
|
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>dv->fs_type==</span><span class=cF3>FSt_FAT32</span><span class=cF0> || dv->fs_type==</span><span class=cF3>FSt_REDSEA</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l102"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&dv->fat_blk_dirty,0</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (dv->fat1==dv->fat2) {
|
|
<a name="l104"></a> </span><span class=cF5>BlkWrite</span><span class=cF0>(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
|
<a name="l105"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&dv->fat_blk_dirty,0);
|
|
<a name="l106"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (fat_sel==3 || !fat_sel)
|
|
<a name="l108"></a> </span><span class=cF5>BlkWrite</span><span class=cF0>(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
|
<a name="l109"></a> </span><span class=cF1>if</span><span class=cF0> (fat_sel==3 || fat_sel==1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l110"></a> </span><span class=cF5>BlkWrite</span><span class=cF0>(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
|
<a name="l111"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&dv->fat_blk_dirty,0);
|
|
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l113"></a> }
|
|
<a name="l114"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l115"></a>}
|
|
<a name="l116"></a>
|
|
<a name="l117"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>DrvFATBlkSet</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv,</span><span class=cF9>I64</span><span class=cF0> c,</span><span class=cF9>I64</span><span class=cF0> fat_sel=3)
|
|
<a name="l118"></a>{
|
|
<a name="l119"></a> </span><span class=cF9>I64</span><span class=cF0> fat_blk_num;
|
|
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (c==</span><span class=cF3>INVALID_CLUS</span><span class=cF0>)
|
|
<a name="l121"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l122"></a> </span><span class=cF1>switch</span><span class=cF0> (dv->fs_type) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l123"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l124"></a> fat_blk_num=c>>(</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>-2);
|
|
<a name="l125"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l126"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l127"></a> fat_blk_num=(c-dv->data_area)>>(</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>+3);
|
|
<a name="l128"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l129"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l130"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (fat_blk_num!=dv->cur_fat_blk_num) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l133"></a> </span><span class=cFD>DrvFATBlkClean</span><span class=cF0>(dv,fat_sel);
|
|
<a name="l134"></a> dv->cur_fat_blk_num=fat_blk_num;
|
|
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (fat_sel==3 || !fat_sel)
|
|
<a name="l136"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
|
<a name="l137"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l138"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
|
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l140"></a>}
|
|
<a name="l141"></a>
|
|
<a name="l142"></a></span><span class=cF9>CDrv</span><span class=cF0> *</span><span class=cF5>DrvChk</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv,</span><span class=cF1>Bool</span><span class=cF0> except=</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l143"></a>{</span><span class=cF2>//Check for valid drv. Throw exception.</span><span class=cF0>
|
|
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (!dv || dv->dv_signature!=</span><span class=cF3>DRV_SIGNATURE_VAL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (except)
|
|
<a name="l146"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l147"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l148"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l149"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l150"></a> </span><span class=cF1>return</span><span class=cF0> dv;
|
|
<a name="l151"></a>}
|
|
<a name="l152"></a>
|
|
<a name="l153"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cF5>Drv2Let</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l154"></a>{</span><span class=cF2>//Drv ptr to Drv letter.</span><span class=cF0>
|
|
<a name="l155"></a> </span><span class=cF1>if</span><span class=cF0> (!dv)
|
|
<a name="l156"></a> dv=</span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
|
<a name="l157"></a> </span><span class=cF5>DrvChk</span><span class=cF0>(dv);
|
|
<a name="l158"></a> </span><span class=cF1>return</span><span class=cF0> dv->drv_let;
|
|
<a name="l159"></a>}
|
|
<a name="l160"></a>
|
|
<a name="l161"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cF5>Let2Let</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
|
<a name="l162"></a>{</span><span class=cF2>//Drv letter to Drv letter.</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (!drv_let)
|
|
<a name="l164"></a> drv_let=</span><span class=cF5>Drv2Let</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dv);
|
|
<a name="l165"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (drv_let==</span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l166"></a> drv_let=</span><span class=cFB>blkdev</span><span class=cF0>.boot_drv_let;
|
|
<a name="l167"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (drv_let==</span><span class=cF6>'~'</span><span class=cF0>)
|
|
<a name="l168"></a> drv_let=*</span><span class=cFB>blkdev</span><span class=cF0>.home_dir;
|
|
<a name="l169"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>ToUpper</span><span class=cF0>(drv_let);
|
|
<a name="l170"></a>}
|
|
<a name="l171"></a>
|
|
<a name="l172"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Let2BlkDevType</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let)
|
|
<a name="l173"></a>{</span><span class=cF2>//Drv letter to BlkDev Type. drv_let=0 not allowed. See </span><a href="/Wb/Kernel/KernelA.HH.HTML#l2601"><span class=cF4>BDT_NULL</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l174"></a> drv_let=</span><span class=cF5>Let2Let</span><span class=cF0>(drv_let);
|
|
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0><=drv_let<=</span><span class=cF6>'B'</span><span class=cF0>)
|
|
<a name="l176"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>BDT_RAM</span><span class=cF0>;
|
|
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'C'</span><span class=cF0><=drv_let<=</span><span class=cF6>'L'</span><span class=cF0>)
|
|
<a name="l178"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>BDT_ATA</span><span class=cF0>;
|
|
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'M'</span><span class=cF0><=drv_let<=</span><span class=cF6>'P'</span><span class=cF0>)
|
|
<a name="l180"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>BDT_ISO_FILE_READ</span><span class=cF0>;
|
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'Q'</span><span class=cF0><=drv_let<=</span><span class=cF6>'S'</span><span class=cF0>)
|
|
<a name="l182"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>;
|
|
<a name="l183"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'T'</span><span class=cF0><=drv_let<=</span><span class=cF6>'Z'</span><span class=cF0>)
|
|
<a name="l184"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>BDT_ATAPI</span><span class=cF0>;
|
|
<a name="l185"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>BDT_NULL</span><span class=cF0>;
|
|
<a name="l186"></a>}
|
|
<a name="l187"></a>
|
|
<a name="l188"></a></span><span class=cF9>CDrv</span><span class=cF0> *</span><span class=cF5>Let2Drv</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> except=</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l189"></a>{</span><span class=cF2>//Drv letter to Drv ptr.</span><span class=cF0>
|
|
<a name="l190"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv;
|
|
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (!drv_let)
|
|
<a name="l192"></a> dv=</span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
|
<a name="l193"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l194"></a> drv_let=</span><span class=cF5>Let2Let</span><span class=cF0>(drv_let);
|
|
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF6>'A'</span><span class=cF0><=drv_let<=</span><span class=cF6>'Z'</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (except)
|
|
<a name="l197"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l198"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l199"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l200"></a> }
|
|
<a name="l201"></a> dv=</span><span class=cFB>blkdev</span><span class=cF0>.let_to_drv[drv_let-</span><span class=cF6>'A'</span><span class=cF0>];
|
|
<a name="l202"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l203"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>DrvChk</span><span class=cF0>(dv,except);
|
|
<a name="l204"></a>}
|
|
<a name="l205"></a>
|
|
<a name="l206"></a></span><span class=cF9>CBlkDev</span><span class=cF0> *</span><span class=cF5>DrvIsWritable</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> except=</span><span class=cF3>FALSE</span><span class=cF0>)
|
|
<a name="l207"></a>{</span><span class=cF2>//Is drive writable?</span><span class=cF0>
|
|
<a name="l208"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd;
|
|
<a name="l209"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>bd=</span><span class=cF5>Let2BlkDev</span><span class=cF0>(drv_let,except)</span><span class=cF7>)</span><span class=cF0> || bd->flags & </span><span class=cF3>BDF_READ_ONLY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l210"></a> </span><span class=cF1>if</span><span class=cF0> (except)
|
|
<a name="l211"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drv'</span><span class=cF0>);
|
|
<a name="l212"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l213"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l214"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l215"></a> </span><span class=cF1>return</span><span class=cF0> bd;
|
|
<a name="l216"></a>}
|
|
<a name="l217"></a>
|
|
<a name="l218"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DskCacheInvalidate</span><span class=cF0>(</span><span class=cF9>CDrv</span><span class=cF0> *dv)
|
|
<a name="l219"></a>{</span><span class=cF2>//Needed for removable media. Called by </span><a href="/Wb/Kernel/BlkDev/DskDrv.HC.HTML#l237"><span class=cF4>DskChg</span></a><span class=cF2>().</span><span class=cF0>
|
|
<a name="l220"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
|
<a name="l221"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd=dv->bd;
|
|
<a name="l222"></a> </span><span class=cF5>DrvChk</span><span class=cF0>(dv);
|
|
<a name="l223"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l224"></a> unlock=</span><span class=cF5>DrvLock</span><span class=cF0>(dv);
|
|
<a name="l225"></a> </span><span class=cFD>BlkDevInit</span><span class=cF0>(bd);
|
|
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_READ_CACHE</span><span class=cF0>)
|
|
<a name="l227"></a> </span><span class=cFD>DskCacheInvalidate2</span><span class=cF0>(dv);
|
|
<a name="l228"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type==</span><span class=cF3>BDT_ATAPI</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>bd->flags & </span><span class=cF3>BDF_READ_ONLY_OVERRIDE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l229"></a> </span><span class=cFD>ISOInit</span><span class=cF0>(dv,</span><span class=cF7>(</span><span class=cF0>32767/bd->blk_size+1</span><span class=cF7>)</span><span class=cF0>*bd->blk_size>></span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>);
|
|
<a name="l230"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l231"></a> </span><span class=cF5>DrvUnlock</span><span class=cF0>(dv);
|
|
<a name="l232"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l234"></a> </span><span class=cF5>DrvUnlock</span><span class=cF0>(dv);
|
|
<a name="l235"></a>}
|
|
<a name="l236"></a>
|
|
<a name="l237"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DskChg</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
|
<a name="l238"></a>{</span><span class=cF2>//Change disk. (Needed for removable media.)</span><span class=cF0>
|
|
<a name="l239"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
|
|
<a name="l240"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd=dv->bd;
|
|
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>bd->flags&</span><span class=cF3>BDF_INITIALIZED</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l242"></a> </span><span class=cFD>BlkDevInit</span><span class=cF0>(bd);
|
|
<a name="l243"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (bd->flags&</span><span class=cF3>BDF_REMOVABLE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l244"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type==</span><span class=cF3>BDT_ATAPI</span><span class=cF0>)
|
|
<a name="l245"></a> </span><span class=cFD>ATAInit</span><span class=cF0>(bd); </span><span class=cF2>//TODO: This is a kludge for QEMU?</span><span class=cF0>
|
|
<a name="l246"></a> </span><span class=cF5>DskCacheInvalidate</span><span class=cF0>(dv);
|
|
<a name="l247"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l248"></a> </span><span class=cF5>Drv</span><span class=cF0>(drv_let);
|
|
<a name="l249"></a> </span><span class=cFD>RedSeaFreeFreeLst</span><span class=cF0>(dv);
|
|
<a name="l250"></a>}
|
|
<a name="l251"></a>
|
|
<a name="l252"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DrvMap</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let,</span><span class=cF9>CDrv</span><span class=cF0> *dv)
|
|
<a name="l253"></a>{</span><span class=cF2>//Make drive letter map to another.</span><span class=cF0>
|
|
<a name="l254"></a> drv_let=</span><span class=cF5>Let2Let</span><span class=cF0>(drv_let);
|
|
<a name="l255"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0><=drv_let<=</span><span class=cF6>'Z'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l256"></a> </span><span class=cFB>blkdev</span><span class=cF0>.let_to_drv[drv_let-</span><span class=cF6>'A'</span><span class=cF0>]=dv;
|
|
<a name="l257"></a> dv->drv_let=drv_let;
|
|
<a name="l258"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l259"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l260"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l261"></a>}
|
|
<a name="l262"></a>
|
|
<a name="l263"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Drv</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let)
|
|
<a name="l264"></a>{</span><span class=cF2>//Change drive. You can set drive with </span><a href="/Wb/Kernel/BlkDev/DskDirB.HC.HTML#l9"><span class=cF4>Cd</span></a><span class=cF2>() as well.</span><span class=cF0>
|
|
<a name="l265"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
|
|
<a name="l266"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd;
|
|
<a name="l267"></a> bd=</span><span class=cF5>BlkDevChk</span><span class=cF0>(dv->bd);
|
|
<a name="l268"></a> </span><span class=cF1>if</span><span class=cF0> (dv!=</span><span class=cF5>Fs</span><span class=cF0>->cur_dv) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l269"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_REMOVABLE</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>bd->flags & </span><span class=cF3>BDF_INITIALIZED</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l270"></a> </span><span class=cF5>DskChg</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="l271"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type==</span><span class=cF3>BDT_RAM</span><span class=cF0> ||
|
|
<a name="l272"></a> bd->type==</span><span class=cF3>BDT_ISO_FILE_READ</span><span class=cF0> || bd->type==</span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>)
|
|
<a name="l273"></a> </span><span class=cFD>BlkDevInit</span><span class=cF0>(bd);
|
|
<a name="l274"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l275"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_dv=dv;
|
|
<a name="l276"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
|
<a name="l277"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_dir=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l278"></a> </span><span class=cF1>switch</span><span class=cF0> (dv->fs_type) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l279"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l280"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l281"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l282"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l283"></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="l284"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l285"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l286"></a>}
|
|
<a name="l287"></a>
|
|
<a name="l288"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>DrvSerialNum</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
|
<a name="l289"></a>{</span><span class=cF2>//20 bytes max.</span><span class=cF0>
|
|
<a name="l290"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd=</span><span class=cF5>Let2BlkDev</span><span class=cF0>(drv_let);
|
|
<a name="l291"></a> </span><span class=cF9>U16</span><span class=cF0> *st,*res=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l292"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l293"></a> </span><span class=cF1>if</span><span class=cF0> (bd->dev_id_record) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l294"></a> st=</span><span class=cF5>CAlloc</span><span class=cF0>(20+1);
|
|
<a name="l295"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<10;i++)
|
|
<a name="l296"></a> st[i]=</span><span class=cF5>EndianU16</span><span class=cF0>(bd->dev_id_record[10+i]);
|
|
<a name="l297"></a> res=</span><span class=cF5>MStrUtil</span><span class=cF0>(st,</span><span class=cF3>SUF_REM_LEADING</span><span class=cF0>|</span><span class=cF3>SUF_REM_TRAILING</span><span class=cF0>);
|
|
<a name="l298"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l299"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l300"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l301"></a>}
|
|
<a name="l302"></a>
|
|
<a name="l303"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>DrvModelNum</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
|
<a name="l304"></a>{</span><span class=cF2>//40 bytes max.</span><span class=cF0>
|
|
<a name="l305"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd=</span><span class=cF5>Let2BlkDev</span><span class=cF0>(drv_let);
|
|
<a name="l306"></a> </span><span class=cF9>U16</span><span class=cF0> *st,*res=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l307"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l308"></a> </span><span class=cF1>if</span><span class=cF0> (bd->dev_id_record) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l309"></a> st=</span><span class=cF5>CAlloc</span><span class=cF0>(40+1);
|
|
<a name="l310"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<20;i++)
|
|
<a name="l311"></a> st[i]=</span><span class=cF5>EndianU16</span><span class=cF0>(bd->dev_id_record[27+i]);
|
|
<a name="l312"></a> res=</span><span class=cF5>MStrUtil</span><span class=cF0>(st,</span><span class=cF3>SUF_REM_LEADING</span><span class=cF0>|</span><span class=cF3>SUF_REM_TRAILING</span><span class=cF0>);
|
|
<a name="l313"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l314"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l315"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l316"></a>}
|
|
<a name="l317"></a>
|
|
<a name="l318"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cFD>blkdev_text_attr</span><span class=cF0>[</span><span class=cF3>BDT_TYPES_NUM</span><span class=cF0>]={</span><span class=cF3>BLACK</span><span class=cF0>,</span><span class=cF3>LTCYAN</span><span class=cF0>,</span><span class=cF3>WHITE</span><span class=cF0>,</span><span class=cF3>LTGREEN</span><span class=cF0>,</span><span class=cF3>LTRED</span><span class=cF0>,</span><span class=cF3>LTBLUE</span><span class=cF0>};
|
|
<a name="l319"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cFD>drv_text_attr</span><span class=cF0>[3]={</span><span class=cF3>BLACK</span><span class=cF0>,</span><span class=cF3>BLUE</span><span class=cF0>,</span><span class=cF3>RED</span><span class=cF0>};
|
|
<a name="l320"></a>
|
|
<a name="l321"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cF5>DrvTextAttrGet</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0)
|
|
<a name="l322"></a>{</span><span class=cF2>//Get color of drive.</span><span class=cF0>
|
|
<a name="l323"></a> drv_let=</span><span class=cF5>Let2Let</span><span class=cF0>(drv_let);
|
|
<a name="l324"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0><=drv_let<=</span><span class=cF6>'Z'</span><span class=cF0>)
|
|
<a name="l325"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>blkdev_text_attr</span><span class=cF0>[</span><span class=cF5>Let2BlkDevType</span><span class=cF0>(drv_let)]<<4|
|
|
<a name="l326"></a> </span><span class=cFD>drv_text_attr</span><span class=cF0>[drv_let%</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cFD>drv_text_attr</span><span class=cF0>)];
|
|
<a name="l327"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l328"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>BLACK</span><span class=cF0><<4|</span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l329"></a>}
|
|
<a name="l330"></a>
|
|
<a name="l331"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrvRep</span><span class=cF0>()
|
|
<a name="l332"></a>{</span><span class=cF2>//Drive report.</span><span class=cF0>
|
|
<a name="l333"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv;
|
|
<a name="l334"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd;
|
|
<a name="l335"></a> </span><span class=cF9>I64</span><span class=cF0> ch,i,drv_let,attr;
|
|
<a name="l336"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
|
<a name="l337"></a> </span><span class=cF6>"\nDefined Drives:\n"</span><span class=cF0>;
|
|
<a name="l338"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,dv=</span><span class=cFB>blkdev</span><span class=cF0>.drvs;i<</span><span class=cF3>DRVS_NUM</span><span class=cF0>;i++,dv++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (dv->dv_signature==</span><span class=cF3>DRV_SIGNATURE_VAL</span><span class=cF0>) {
|
|
<a name="l340"></a> bd=dv->bd;
|
|
<a name="l341"></a> drv_let=</span><span class=cF5>Drv2Let</span><span class=cF0>(dv);
|
|
<a name="l342"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&dv->fs_type,</span><span class=cF3>FStf_DISABLE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l343"></a> ch=</span><span class=cF6>'-'</span><span class=cF0>;
|
|
<a name="l344"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (drv_let==</span><span class=cFB>blkdev</span><span class=cF0>.boot_drv_let)
|
|
<a name="l345"></a> ch=</span><span class=cF6>':'</span><span class=cF0>;
|
|
<a name="l346"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l347"></a> ch=</span><span class=cF6>'+'</span><span class=cF0>;
|
|
<a name="l348"></a> attr=</span><span class=cF5>DrvTextAttrGet</span><span class=cF0>(drv_let);
|
|
<a name="l349"></a> </span><span class=cF6>"$FG,%d$$BG,%d$%C %-8Z %-10Z %04X %04X %02X\n"</span><span class=cF0>,
|
|
<a name="l350"></a> attr&15,attr>>4,drv_let,dv->fs_type&</span><span class=cF3>FSG_TYPE_MASK</span><span class=cF0>,</span><span class=cF6>"ST_DRV_TYPES"</span><span class=cF0>,
|
|
<a name="l351"></a> bd->type,</span><span class=cF6>"ST_BLKDEV_TYPES"</span><span class=cF0>,bd->base0,bd->base1,bd->unit;
|
|
<a name="l352"></a> </span><span class=cF1>if</span><span class=cF0> (st=</span><span class=cF5>DrvModelNum</span><span class=cF7>(</span><span class=cF0>drv_let</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l353"></a> </span><span class=cF6>" Model# :%s\n"</span><span class=cF0>,st;
|
|
<a name="l354"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l355"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l356"></a> </span><span class=cF1>if</span><span class=cF0> (st=</span><span class=cF5>DrvSerialNum</span><span class=cF7>(</span><span class=cF0>drv_let</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l357"></a> </span><span class=cF6>" Serial#:%s\n"</span><span class=cF0>,st;
|
|
<a name="l358"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l359"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type==</span><span class=cF3>BDT_ISO_FILE_READ</span><span class=cF0> || bd->type==</span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>)
|
|
<a name="l361"></a> </span><span class=cF6>" File=\"%s\"\n"</span><span class=cF0>,bd->file_dsk_name;
|
|
<a name="l362"></a> </span><span class=cF6>" %016X-%016X\n$FG$$BG$"</span><span class=cF0>,dv->drv_offset,dv->drv_offset+dv->size-1;
|
|
<a name="l363"></a> }
|
|
<a name="l364"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l365"></a> </span><span class=cF6>"Home Dir:\"%s\"\n"</span><span class=cF0>,</span><span class=cFB>blkdev</span><span class=cF0>.home_dir;
|
|
<a name="l366"></a>}
|
|
</span></pre></body>
|
|
</html>
|