duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit ffaf8ea28d2920037d65a47d6aa62309c50f9861
parent a64a07b066c3b3c8fa8b6b1464be29623067c5c9
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sat, 13 Aug 2022 06:36:26 -0400

fs/fat: remove last references to global "FATFS" bind

Diffstat:
Mfs/fs/fatlo.fs | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/fs/fs/fatlo.fs b/fs/fs/fatlo.fs @@ -240,12 +240,6 @@ create _FATFS \ 1+ is for the extra byte for FAT12 cross-sector exception _FATFS structbind FAT FATFS -: readFATvolume ( drv -- ) dup >r _FATFS ! - 0 FATFS :buf( r@ Drive :sec@ - FATFS :buf( FATFS :hdr( FAT HDRSZ move - FATFS secsz r> Drive secsz = not if - abort" Drive sector size not matching drive!" then ; - create _FATCursors _FATFS , 0 , _FATCursors structbind FATCursors cursors @@ -258,11 +252,19 @@ create _EmptyCursor _FATFS , 1 ( flags ) , 0 ( cluster ) , -1 ( clusteridx ) , 0 ( pos ) , 0 ( size ) , 0 ( entryoff ) , +0 value _self \ This is the "low" part. Complete open is finalized in fs/fat -: FATFS:open ( id self -- hdl ) - drop FATFS :getdirentry _EmptyCursor cursors :findfreecursor dup >r +: FATFS:open ( id self -- hdl ) to _self + _self FAT :getdirentry _EmptyCursor cursors :findfreecursor dup >r ( dirent 'empty hdl ) FATFile SZ move ( dirent ) \ write the rest - dup FATFS :buf( - FATFS bufsec FATFS secsz * + ( dirent doffset ) r@ to FATFile entryoff - DirEntry filesize r@ to FATFile size ( ) r> ; + dup _self FAT :buf( - _self FAT bufsec _self FAT secsz * + ( dirent doffset ) + r@ to FATFile entryoff DirEntry filesize r@ to FATFile size ( ) r> ; current _FATFS 8 + ! + +: readFATvolume ( drv -- ) dup >r _FATFS ! + 0 _FATFS FAT :buf( r@ Drive :sec@ + _FATFS FAT :buf( _FATFS FAT :hdr( FAT HDRSZ move + _FATFS FAT secsz r> Drive secsz = not if + abort" Drive sector size not matching drive!" then ; +