Author: wmb Date: Fri Apr 16 05:22:16 2010 New Revision: 1788 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1788
Log: FAT filesystem driver - fixed a problem with free cluster tracking in the case where the number of free clusters is set to "don't know".
Modified: ofw/fs/fatfs/bpb.fth ofw/fs/fatfs/device.fth ofw/fs/fatfs/fat.fth
Modified: ofw/fs/fatfs/bpb.fth ============================================================================== --- ofw/fs/fatfs/bpb.fth Fri Apr 16 05:20:30 2010 (r1787) +++ ofw/fs/fatfs/bpb.fth Fri Apr 16 05:22:16 2010 (r1788) @@ -91,8 +91,12 @@ d# 16 constant fat16 d# 32 constant fat32
-: fs-#free+ ( -- ) fs_#freeclusters dup lel@ 1+ swap lel! true fsinfos-dirty c! ; -: fs-#free- ( -- ) fs_#freeclusters dup lel@ 1- swap lel! true fsinfos-dirty c! ; +: +fs-#free ( incr -- ) + fs_#freeclusters dup lel@ ( incr adr n ) + dup h# ffffffff = if 3drop exit then ( incr adr n ) + rot + swap lel! + true fsinfos-dirty c! +; : fs-free#! ( cluster# -- ) fs_freecluster# lel! true fsinfos-dirty c! ;
Modified: ofw/fs/fatfs/device.fth ============================================================================== --- ofw/fs/fatfs/device.fth Fri Apr 16 05:20:30 2010 (r1787) +++ ofw/fs/fatfs/device.fth Fri Apr 16 05:22:16 2010 (r1788) @@ -108,7 +108,7 @@ alloc-fssector 1 fssector @ read-sectors if free-fssector - "CaR ". ." File system inforation sector" + "CaR ". ." File system information sector" abort then not-fsinfo? if free-fssector then
Modified: ofw/fs/fatfs/fat.fth ============================================================================== --- ofw/fs/fatfs/fat.fth Fri Apr 16 05:20:30 2010 (r1787) +++ ofw/fs/fatfs/fat.fth Fri Apr 16 05:22:16 2010 (r1788) @@ -196,7 +196,7 @@ drop fs_freecluster# lel@ ( hint' ) then ( hint ) (allocate-cluster) ( false | cluster# true ) - dup if over fs-free#! fs-#free- then ( false | cluster# true ) + dup if over fs-free#! -1 +fs-#free then ( false | cluster# true ) else ( hint ) drop false ( false ) then ( false | cluster# true ) @@ -209,10 +209,10 @@ : deallocate-clusters ( first-cl# -- ) begin dup 0<> over fat-end? 0= and - while ( cluster# ) - dup cluster@ ( cluster# next-cluster# ) - 0 rot cluster! ( next-cluster# ) - fsinfo @ if fs-#free+ then ( next-cluster# ) + while ( cluster# ) + dup cluster@ ( cluster# next-cluster# ) + 0 rot cluster! ( next-cluster# ) + fsinfo @ if 1 +fs-#free then ( next-cluster# ) repeat drop ?flush-fat-cache