[OpenBIOS] r672 - ofw/fs/jffs2
svn at openbios.org
svn at openbios.org
Wed Oct 10 02:18:33 CEST 2007
Author: wmb
Date: 2007-10-10 02:18:33 +0200 (Wed, 10 Oct 2007)
New Revision: 672
Modified:
ofw/fs/jffs2/jffs2.fth
Log:
JFFS2 reader - When a page read occurs, don't abort and don't discard
previously-read good pages within that erase block.
Modified: ofw/fs/jffs2/jffs2.fth
===================================================================
--- ofw/fs/jffs2/jffs2.fth 2007-10-10 00:15:02 UTC (rev 671)
+++ ofw/fs/jffs2/jffs2.fth 2007-10-10 00:18:33 UTC (rev 672)
@@ -118,21 +118,29 @@
: page>eblock ( page# -- eblock# ) pages/eblock / ;
-1 ( instance ) value have-eblock# \ For avoiding redundant reads
-: read-pages ( page# #pages -- error? )
+: (read-pages) ( page# #pages -- #read )
\ Partial reads invalidate the cache
dup pages/eblock <> if -1 to have-eblock# then ( page# #pages )
- tuck block-buf -rot " read-blocks" $call-parent ( #pages #read )
- <>
+ block-buf -rot " read-blocks" $call-parent ( #read )
;
+: read-pages ( page# #pages -- error? ) tuck (read-pages) <> ;
: read-eblock ( eblock# -- )
- dup have-eblock# <> if ( eblock# )
- to have-eblock# ( )
- have-eblock# eblock>page pages/eblock read-pages
- abort" jffs2: bad read"
- else
- drop
- then ( )
+ dup have-eblock# <> if ( eblock# )
+ to have-eblock# ( )
+ have-eblock# eblock>page pages/eblock (read-pages) ( npages )
+ dup pages/eblock <> if ( npages )
+ ." JFFS2: bad read - eblock# " have-eblock# .x ." page " dup .x cr
+ /page * ( block-offset )
+ dup block-buf + ( block-offset adr )
+ /eblock rot - ( adr erase-length )
+ h# ff fill ( )
+ else ( npages )
+ drop ( )
+ then ( )
+ else ( eblock# )
+ drop ( )
+ then ( )
;
0 ( instance ) value sumsize
More information about the OpenBIOS
mailing list