Changeset 3202


Ignore:
Timestamp:
Aug 20, 2012, 11:44:00 AM (20 months ago)
Author:
quozl
Message:

OLPC - fs-update, sanity-check file size if the zdata file contains a size: header line, abort if invalid, ignore if missing, #12055

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpu/x86/pc/olpc/via/fsupdate.fth

    r3099 r3202  
    77   safe-parse-word 
    88   push-hex $number pop-base  " Bad number" ?nand-abort 
     9; 
     10 
     11: get-dhex#  ( -- d ) 
     12   0 safe-parse-word 
     13   push-hex $dnumber pop-base  " Bad number" ?nand-abort 
    914; 
    1015 
     
    146151; 
    147152 
     1530 2value file-bytes 
     154: size:  ( "bytes" -- ) 
     155   get-dhex#                              ( d.size ) 
     156   file-bytes d<>                         ( invalid? ) 
     157   " Inconsistent size of zdata file" ?nand-abort 
     158; 
     159 
    148160: erase-all  ( -- ) 
    149161   #image-eblocks show-writing 
     
    260272   r/o open-file                       ( fd error? ) 
    261273   " Can't open file" ?nand-abort      ( fd ) 
     274   dup file-size                       ( fd [size.d] error? ) 
     275   " Can't size file" ?nand-abort      ( fd size.d ) 
     276   [ also nand-commands ] to file-bytes [ previous ] 
    262277 
    263278   linefeed over force-line-delimiter  ( fd ) 
Note: See TracChangeset for help on using the changeset viewer.