2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-12-11 11:10:58 +00:00
< meta name = "generator" content = "ZealOS V1.07" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
2021-10-08 07:06:11 +01:00
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
2021-07-03 05:07:57 +01:00
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-07-03 05:07:57 +01:00
< a name = "l1" > < / a > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cF5 > BlkDevLock< / span > < span class = cF0 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd)
< a name = "l2" > < / a > {< / span > < span class = cF2 > //Make this task have exclusive access to BlkDev.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l3" > < / a > < / span > < span class = cF5 > BlkDevCheck< / span > < span class = cF0 > (bd);
2021-07-03 05:07:57 +01:00
< a name = "l4" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l5" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (bd-> lock_fwding)
< a name = "l6" > < / a > bd = bd-> lock_fwding; < / span > < span class = cF2 > //If two blkdevs on same controller, use just one lock< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l7" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l8" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > & bd-> locked_flags, < / span > < span class = cF3 > BDlf_LOCKED< / span > < span class = cF7 > )< / span > < span class = cF0 > || bd-> owning_task != < / span > < span class = cF5 > Fs< / span > < span class = cF0 > )
< a name = "l9" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l10" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > LBts< / span > < span class = cF7 > (< / span > < span class = cF0 > & bd-> locked_flags, < / span > < span class = cF3 > BDlf_LOCKED< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l11" > < / a > < / span > < span class = cF5 > Yield< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l12" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l13" > < / a > bd-> owning_task = < / span > < span class = cF5 > Fs< / span > < span class = cF0 > ;
< a name = "l14" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l15" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l16" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l17" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l18" > < / a > }
< a name = "l19" > < / a >
< a name = "l20" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cF5 > BlkDevUnlock< / span > < span class = cF0 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd, < / span > < span class = cF1 > Bool< / span > < span class = cF0 > reset=< / span > < span class = cF3 > FALSE< / span > < span class = cF0 > )
< a name = "l21" > < / a > {< / span > < span class = cF2 > //Release exclusive lock on access to BlkDev.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l22" > < / a > < / span > < span class = cF5 > BlkDevCheck< / span > < span class = cF0 > (bd);
2021-07-03 05:07:57 +01:00
< a name = "l23" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l24" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (bd-> lock_fwding)
< a name = "l25" > < / a > bd = bd-> lock_fwding; < / span > < span class = cF2 > //If two blkdevs on same controller, use just one lock< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l26" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l27" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > & bd-> locked_flags, < / span > < span class = cF3 > BDlf_LOCKED< / span > < span class = cF7 > )< / span > < span class = cF0 > & & bd-> owning_task == < / span > < span class = cF5 > Fs< / span > < span class = cF0 > )
< a name = "l28" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l29" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (reset)
< a name = "l30" > < / a > bd-> flags & = ~(< / span > < span class = cF3 > BDF_INITIALIZED< / span > < span class = cF0 > | < / span > < span class = cF3 > BDF_INIT_IN_PROGRESS< / span > < span class = cF0 > );
< a name = "l31" > < / a > bd-> owning_task = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l32" > < / a > < / span > < span class = cF5 > LBtr< / span > < span class = cF0 > (& bd-> locked_flags, < / span > < span class = cF3 > BDlf_LOCKED< / span > < span class = cF0 > );
< a name = "l33" > < / a > < / span > < span class = cF5 > Yield< / span > < span class = cF0 > ; < / span > < span class = cF2 > //Prevent deadlock< / span > < span class = cF0 >
< a name = "l34" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / 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 > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l37" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l38" > < / a > }
< a name = "l39" > < / a >
< a name = "l40" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cFD > BlkDevInit< / span > < span class = cF0 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd)
< a name = "l41" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l42" > < / a > < / span > < span class = cF9 > CDirEntry< / span > < span class = cF0 > de;
< a name = "l43" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > buf[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ];
< a name = "l44" > < / a > < / span > < span class = cF9 > CDrive< / span > < span class = cF0 > *drive = < / span > < span class = cF5 > Letter2Drive< / span > < span class = cF0 > (bd-> first_drive_let);
< a name = "l45" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > res = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l46" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l47" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF5 > LBts< / 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 = "l48" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l49" > < / a > bd-> flags |= < / span > < span class = cF3 > BDF_INIT_IN_PROGRESS< / span > < span class = cF0 > ;
< a name = "l50" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (bd-> type)
< a name = "l51" > < / a > {
< a name = "l52" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_RAM< / span > < span class = cF0 > :
< a name = "l53" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!bd-> RAM_disk)
< a name = "l54" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
2021-07-06 21:15:26 +01:00
< a name = "l55" > < / a > bd-> RAM_disk = < / span > < span class = cF5 > SysMAlloc< / span > < span class = cF0 > (< / span > < span class = cF7 > (< / span > < span class = cF0 > bd-> max_blk + < / span > < span class = cFE > 1< / span > < span class = cF7 > )< / span > < span class = cF0 > < < < / span > < span class = cF3 > BLK_SIZE_BITS< / span > < span class = cF0 > );
2021-07-04 23:11:34 +01:00
< a name = "l56" > < / a > bd-> max_blk = < / span > < span class = cF5 > MSize< / span > < span class = cF0 > (bd-> RAM_disk) > > < / span > < span class = cF3 > BLK_SIZE_BITS< / span > < span class = cF0 > - < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l57" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l58" > < / a > drive-> fs_type = < / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > ;
< a name = "l59" > < / a > drive-> size = bd-> max_blk + < / span > < span class = cFE > 1< / span > < span class = cF0 > - bd-> drv_offset;
< a name = "l60" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFD > RedSeaValidate< / span > < span class = cF7 > (< / span > < span class = cF0 > bd-> first_drive_let< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l61" > < / a > < / span > < span class = cFD > RedSeaInit< / span > < span class = cF0 > (drive);
< a name = "l62" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l63" > < / a > < / span > < span class = cFD > RedSeaFormat< / span > < span class = cF0 > (bd-> first_drive_let);
< a name = "l64" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l65" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l66" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l67" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ISO_FILE_READ< / span > < span class = cF0 > :
< a name = "l68" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > FileFind< / span > < span class = cF7 > (< / span > < span class = cF0 > bd-> file_disk_name, & de, < / span > < span class = cF3 > FUF_JUST_FILES< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l69" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l70" > < / a > bd-> max_blk = de.size > > < / span > < span class = cF3 > BLK_SIZE_BITS< / span > < span class = cF0 > - < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l71" > < / a > < / span > < span class = cF1 > try< / span > < span class = cF0 >
< a name = "l72" > < / a > bd-> file_disk = < / span > < span class = cF5 > FOpen< / span > < span class = cF0 > (bd-> file_disk_name, < / span > < span class = cF6 > " rc" < / span > < span class = cF0 > , bd-> max_blk + < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l73" > < / a > < / span > < span class = cF1 > catch< / span > < span class = cF0 >
< a name = "l74" > < / a > {
< a name = "l75" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> except_ch == < / span > < span class = cF6 > 'File'< / span > < span class = cF0 > )
< a name = "l76" > < / a > < / span > < span class = cF5 > PrintErr< / span > < span class = cF0 > (< / span > < span class = cF6 > " Not Contiguous. Move file to filename.ISO.C.\n" < / span > < span class = cF0 > );
< a name = "l77" > < / a > < / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> catch_except = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l78" > < / a > }
< a name = "l79" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (bd-> file_disk)
< a name = "l80" > < / a > {
< a name = "l81" > < / a > drive-> fs_type = < / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > ;
< a name = "l82" > < / a > drive-> size = bd-> max_blk + < / span > < span class = cFE > 1< / span > < span class = cF0 > - bd-> drv_offset;
< a name = "l83" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFD > RedSeaValidate< / span > < span class = cF7 > (< / span > < span class = cF0 > bd-> first_drive_let< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l84" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l85" > < / a > < / span > < span class = cFD > RedSeaInit< / span > < span class = cF0 > (drive);
< a name = "l86" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l87" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l88" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l89" > < / a > < / span > < span class = cF5 > PrintErr< / span > < span class = cF0 > (< / span > < span class = cF6 > " Not RedSea\n" < / span > < span class = cF0 > );
< a name = "l90" > < / a > }
< a name = "l91" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l92" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l93" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l94" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ISO_FILE_WRITE< / span > < span class = cF0 > :
< a name = "l95" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!bd-> file_disk_name)
< a name = "l96" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l97" > < / a > < / span > < span class = cF5 > StrPrint< / span > < span class = cF0 > (buf, < / span > < span class = cF6 > " %C:/Drive%C.ISO.C" < / span > < span class = cF0 > , < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .boot_drive_let, bd-> first_drive_let);
2021-07-06 21:15:26 +01:00
< a name = "l98" > < / a > bd-> file_disk_name = < / span > < span class = cF5 > SysStrNew< / span > < span class = cF0 > (buf);
2021-07-04 23:11:34 +01:00
< a name = "l99" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l100" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (bd-> max_blk < < / span > < span class = cFE > 7< / span > < span class = cF0 > )
< a name = "l101" > < / a > bd-> max_blk = < / span > < span class = cFE > 7< / span > < span class = cF0 > ;
< a name = "l102" > < / a > bd-> file_disk = < / span > < span class = cF5 > FOpen< / span > < span class = cF0 > (bd-> file_disk_name, < / span > < span class = cF6 > " wc" < / span > < span class = cF0 > , bd-> max_blk + < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l103" > < / a > drive-> fs_type = < / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > ;
< a name = "l104" > < / a > drive-> size = bd-> max_blk + < / span > < span class = cFE > 1< / span > < span class = cF0 > - bd-> drv_offset;
< a name = "l105" > < / a > < / span > < span class = cFD > RedSeaFormat< / span > < span class = cF0 > (bd-> first_drive_let);
< a name = "l106" > < / a > < / span > < span class = cF5 > CallExtStr< / span > < span class = cF0 > (< / span > < span class = cF6 > " RedSeaISO9660" < / span > < span class = cF0 > , bd-> file_disk_name, bd-> first_drive_let);
< a name = "l107" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l108" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l109" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l110" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > :
< a name = "l111" > < / a > bd-> max_reads = < / span > < span class = cFE > 128< / span > < span class = cF0 > ;
< a name = "l112" > < / a > bd-> max_writes = < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l113" > < / a > res = < / span > < span class = cFD > AHCIAtaInit< / span > < span class = cF0 > (bd);
< a name = "l114" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l115" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l116" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > :
2021-07-03 05:07:57 +01:00
< a name = "l117" > < / a > < / span > < span class = cF2 > //0xFFFF*4 is too big for Terry's taste< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l118" > < / a > bd-> max_reads = < / span > < span class = cFE > 0x800< / span > < span class = cF0 > * < / span > < span class = cFE > 4< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l119" > < / a > < / span > < span class = cF2 > //max of maybe a quarter of disk cache< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l120" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (bd-> max_reads > < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .cache_size / < / span > < span class = cF3 > BLK_SIZE< / span > < span class = cF0 > / < / span > < span class = cFE > 4< / span > < span class = cF0 > )
< a name = "l121" > < / a > bd-> max_reads = < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .cache_size / < / span > < span class = cF3 > BLK_SIZE< / span > < span class = cF0 > / < / span > < span class = cFE > 4< / span > < span class = cF0 > & ~< / span > < span class = cFE > 3< / span > < span class = cF0 > ;
< a name = "l122" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (bd-> max_reads < < / span > < span class = cFE > 128< / span > < span class = cF0 > )
< a name = "l123" > < / a > bd-> max_reads = < / span > < span class = cFE > 128< / span > < span class = cF0 > ;
< a name = "l124" > < / a > bd-> max_writes = < / span > < span class = cFE > 0xFFFF< / span > < span class = cF0 > * < / span > < span class = cFE > 4< / span > < span class = cF0 > ;
< a name = "l125" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (res = < / span > < span class = cFD > AHCIAtaInit< / span > < span class = cF7 > (< / span > < span class = cF0 > bd< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l126" > < / a > drive-> size = bd-> max_blk + < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l127" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l128" > < / a > }
< a name = "l129" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (res & & bd-> flags & < / span > < span class = cF3 > BDF_READ_CACHE< / span > < span class = cF0 > )
< a name = "l130" > < / a > < / span > < span class = cF5 > DiskCacheInvalidate< / span > < span class = cF0 > (drive);
< a name = "l131" > < / a > bd-> flags & = ~< / span > < span class = cF3 > BDF_INIT_IN_PROGRESS< / span > < span class = cF0 > ;
< a name = "l132" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l133" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l134" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l135" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l136" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l137" > < / a > }
< a name = "l138" > < / a >
< a name = "l139" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > BlkDevsRelease< / span > < span class = cF0 > ()
< a name = "l140" > < / a > {< / span > < span class = cF2 > //When task dies, release all owned BlkDevs.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l141" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i;
< a name = "l142" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd;
2021-07-03 05:07:57 +01:00
< a name = "l143" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l144" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < < / span > < span class = cF3 > BLKDEVS_NUM< / span > < span class = cF0 > ; i++)
< a name = "l145" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l146" > < / a > bd = & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .blkdevs[i];
< a name = "l147" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (bd-> owning_task == < / span > < span class = cF5 > Fs< / span > < span class = cF0 > & & bd-> bd_signature == < / span > < span class = cF3 > BD_SIGNATURE_VAL< / span > < span class = cF0 > )
< a name = "l148" > < / a > < / span > < span class = cF5 > BlkDevUnlock< / span > < span class = cF0 > (bd, < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > );
< a name = "l149" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l150" > < / a > }
< a name = "l151" > < / a >
< a name = "l152" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *< / span > < span class = cF5 > BlkDevNextFreeSlot< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > first_drive_let, < / span > < span class = cF9 > I64< / span > < span class = cF0 > type)
2021-12-11 11:10:58 +00:00
< a name = "l153" > < / a > {< / span > < span class = cF2 > //Locate free slot for new BlkDev, like during < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/BlkDev/Mount.ZC.html#l311" > < span class = cF4 > Mount< / span > < / a > < span class = cF2 > ().< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l154" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l155" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *res;
2021-07-03 05:07:57 +01:00
< a name = "l156" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l157" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Letter2BlkDevType< / span > < span class = cF7 > (< / span > < span class = cF0 > first_drive_let< / span > < span class = cF7 > )< / span > < span class = cF0 > != type)
< a name = "l158" > < / a > < / span > < span class = cF5 > throw< / span > < span class = cF0 > (< / span > < span class = cF6 > 'BlkDev'< / span > < span class = cF0 > );
< a name = "l159" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l160" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l161" > < / a > res = & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .blkdevs[i];
< a name = "l162" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (res-> bd_signature != < / span > < span class = cF3 > BD_SIGNATURE_VAL< / span > < span class = cF0 > )
< a name = "l163" > < / a > {
< a name = "l164" > < / a > < / span > < span class = cF5 > MemSet< / span > < span class = cF0 > (res, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l165" > < / a > res-> first_drive_let = first_drive_let;
< a name = "l166" > < / a > res-> type = type;
< a name = "l167" > < / a > res-> flags = < / span > < span class = cF3 > BDF_READ_CACHE< / span > < span class = cF0 > ;
< a name = "l168" > < / a > res-> blk_size = < / span > < span class = cF3 > BLK_SIZE< / span > < span class = cF0 > ;
< a name = "l169" > < / a > res-> max_blk = < / span > < span class = cFE > 0xEFFFFFFF< / span > < span class = cF0 > ;
< a name = "l170" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (type)
< a name = "l171" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l172" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_RAM< / span > < span class = cF0 > :
< a name = "l173" > < / a > res-> flags & = ~< / span > < span class = cF3 > BDF_READ_CACHE< / span > < span class = cF0 > ;
< a name = "l174" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l175" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l176" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ISO_FILE_READ< / span > < span class = cF0 > :
< a name = "l177" > < / a > res-> flags |= < / span > < span class = cF3 > BDF_READ_ONLY< / span > < span class = cF0 > ;
< a name = "l178" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l179" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l180" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > :
< a name = "l181" > < / a > res-> flags |= < / span > < span class = cF3 > BDF_REMOVABLE< / span > < span class = cF0 > |< / span > < span class = cF3 > BDF_READ_ONLY< / span > < span class = cF0 > ;
< a name = "l182" > < / a > res-> blk_size = < / span > < span class = cF3 > DVD_BLK_SIZE< / span > < span class = cF0 > ;
< a name = "l183" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l184" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l185" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
< a name = "l186" > < / a > }
< a name = "l187" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l188" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (++i < < / span > < span class = cF3 > BLKDEVS_NUM< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l189" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l190" > < / a > < / span > < span class = cF5 > throw< / span > < span class = cF0 > (< / span > < span class = cF6 > 'BlkDev'< / span > < span class = cF0 > );
< a name = "l191" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ; < / span > < span class = cF2 > //never gets here< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l192" > < / a > }
< a name = "l193" > < / a >
< a name = "l194" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > BlkDevDel< / span > < span class = cF0 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd)
< a name = "l195" > < / a > {< / span > < span class = cF2 > //Delete BlkDev< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l196" > < / a > < / span > < span class = cFD > DriveBlkDevDel< / span > < span class = cF0 > (bd);
< a name = "l197" > < / a > < / span > < span class = cF5 > FClose< / span > < span class = cF0 > (bd-> file_disk);
< a name = "l198" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (bd-> file_disk_name);
< a name = "l199" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (bd-> dev_id_record);
< a name = "l200" > < / a > < / span > < span class = cF5 > MemSet< / span > < span class = cF0 > (bd, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF7 > )< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l201" > < / a > }
< a name = "l202" > < / a >
< a name = "l203" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *< / span > < span class = cF5 > BlkDevCheck< / span > < span class = cF0 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd, < / span > < span class = cF1 > Bool< / span > < span class = cF0 > except=< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > )
< a name = "l204" > < / a > {< / span > < span class = cF2 > //Check for valid BlkDev. Throw exception.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l205" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!bd || bd-> bd_signature != < / span > < span class = cF3 > BD_SIGNATURE_VAL< / span > < span class = cF0 > || !< / span > < span class = cF7 > (< / span > < span class = cF3 > BDT_NULL< / span > < span class = cF0 > < bd-> type < < / span > < span class = cF3 > BDT_TYPES_NUM< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l206" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l207" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (except)
< a name = "l208" > < / a > < / span > < span class = cF5 > throw< / span > < span class = cF0 > (< / span > < span class = cF6 > 'BlkDev'< / span > < span class = cF0 > );
< a name = "l209" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l210" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l211" > < / a > < / span > < span class = cF7 > }< / 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 > bd;
2021-07-03 05:07:57 +01:00
< a name = "l214" > < / a > }
< a name = "l215" > < / a >
< a name = "l216" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *< / span > < span class = cF5 > Letter2BlkDev< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > drv_let=< / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF1 > Bool< / span > < span class = cF0 > except=< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > )
Rename abs_addres to abs_address.
Update documentation/comments to rename addr, fun, var, stmt, blk, desc, reg, seg, ptr, dup, clus, val, and bttn, to address, function, variable, statement, block, description, register, segment, pointer, duplicate, cluster, value, and button, respectively.
2021-10-07 02:35:32 +01:00
< a name = "l217" > < / a > {< / span > < span class = cF2 > //Drive letter to BlkDev pointer.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l218" > < / a > < / span > < span class = cF9 > CDrive< / span > < span class = cF0 > *drive;
2021-07-03 05:07:57 +01:00
< a name = "l219" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l220" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (drive = < / span > < span class = cF5 > Letter2Drive< / span > < span class = cF7 > (< / span > < span class = cF0 > drv_let, except< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l221" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF5 > BlkDevCheck< / span > < span class = cF0 > (drive-> bd, except);
< a name = "l222" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l223" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l224" > < / a > }
2021-12-04 10:03:02 +00:00
< a name = "l225" > < / a >
< a name = "l226" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > BlkDevRep< / span > < span class = cF0 > ()
< a name = "l227" > < / a > { < / span > < span class = cF2 > // Block Device Report.< / span > < span class = cF0 >
< a name = "l228" > < / a > < / span > < span class = cF2 > // blkdev.blkdevs[i].< / span > < span class = cF0 >
< a name = "l229" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i;
< a name = "l230" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *b = < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .blkdevs;
< a name = "l231" > < / a >
< a name = "l232" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < < / span > < span class = cF3 > BLKDEVS_NUM< / span > < span class = cF0 > ; i++)
< a name = "l233" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l234" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (b[i].bd_signature == < / span > < span class = cF3 > BD_SIGNATURE_VAL< / span > < span class = cF0 > )
< a name = "l235" > < / a > {
< a name = "l236" > < / a > < / span > < span class = cF6 > " \nBlock Device #%d:\n" < / span > < span class = cF0 > , i;
< a name = "l237" > < / a > < / span > < span class = cF6 > " \tBlock Device Type:\t%Z\n" < / span > < span class = cF0 > , b[i].type, < / span > < span class = cF6 > " ST_BLKDEV_TYPES" < / span > < span class = cF0 > ;
< a name = "l238" > < / a > < / span > < span class = cF6 > " \tFirst Drive Letter:\t%C\n" < / span > < span class = cF0 > , b[i].first_drive_let;
< a name = "l239" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (b[i].ahci_port)
< a name = "l240" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l241" > < / a > < / span > < span class = cF6 > " \tAHCI Port number:\t%d\n" < / span > < span class = cF0 > , b[i].port_num;
< a name = "l242" > < / a > < / span > < span class = cF6 > " \tAHCI Port address:\t0x%X\n" < / span > < span class = cF0 > , b[i].ahci_port;
< a name = "l243" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l244" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (b[i].RAM_disk)
< a name = "l245" > < / a > < / span > < span class = cF6 > " \tRAM disk address:\t0x%X\n" < / span > < span class = cF0 > , b[i].RAM_disk;
< a name = "l246" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (b[i].file_disk_name)
< a name = "l247" > < / a > < / span > < span class = cF6 > " \tFile:\t\t\t\t%s\n" < / span > < span class = cF0 > , b[i].file_disk_name;
< a name = "l248" > < / a > < / span > < span class = cF6 > " \tBlock Size:\t\t\t%d\n" < / span > < span class = cF0 > , b[i].blk_size;
< a name = "l249" > < / a > < / span > < span class = cF6 > " \tDrive Max Block:\t0x%X\n" < / span > < span class = cF0 > , b[i].max_blk;
< a name = "l250" > < / a > }
< a name = "l251" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l252" > < / a > < / span > < span class = cF6 > " \n" < / span > < span class = cF0 > ;
< a name = "l253" > < / a > }
2021-07-03 05:07:57 +01:00
< / span > < / pre > < / body >
< / html >