Changeset 2873


Ignore:
Timestamp:
Feb 23, 2012, 3:20:16 AM (4 years ago)
Author:
quozl
Message:

OLPC fs-verify - add fs-verify-quick for abort on first mismatch, report accidental use of zd file, and rethrow exception after cleanup to allow caller to see it.

File:
1 edited

Legend:

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

    r2869 r2873  
    11\ Boot script for post-audit testing
    22[ifndef] fs-verify
     3false value fs-verify-quick?
    34vocabulary fs-verify-commands
    45also fs-verify-commands definitions
    56
     7false value data?
    68: zblocks:  ( "eblock-size" "#eblocks" ... -- )
     9   data? 0= " Not a zsp file" ?nand-abort
    710   get-hex# to /nand-block
    811   get-hex# to #image-eblocks
     
    1215
    1316: zblocks-end:  ( -- )
     17   false to data?
    1418;
    1519
    1620\ This could be a no-op ...
    1721: data:  ( "filename" -- )
     22   true to data?
    1823   safe-parse-word fn-buf place
    1924   " ${DN}${PN}\${CN}${FN}" expand$  image-name-buf place
     
    3237;
    3338
     39: ?mismatch
     40   cr
     41   fs-verify-quick? " One block mismatch, remainder not checked" ?nand-abort
     42;
     43
    3444: zblock: ( "eblock#" "comprlen" "hashname" "hash-of-128KiB" -- )
    3545   get-hex#                              ( eblock# )
     
    4555
    4656   verify-hash                           ( eblock# okay? )
    47    swap .d  if  (cr  else  cr  then
     57   swap .d  if  (cr  else  ?mismatch  then
    4858;
    4959
     
    6272   t-hms(
    6373   also fs-verify-commands
    64    ['] include-file catch  ?dup  if               ( x error )
    65       nip .error
    66    then
     74   ['] include-file catch                         ( 0 | x error# )
    6775   previous
    6876   show-done
    6977   close-nand-ihs
    7078   )t-hms
     79   throw                                          ( )
    7180;
    7281
    73 : fs-verify  ( "devspec" -- )
     82: fs-verify  ( "fs.zsp" -- )  \ test blocks
     83   false to fs-verify-quick?
     84   safe-parse-word $fs-verify
     85;
     86
     87: fs-verify-quick  ( "fs.zsp" -- )  \ test blocks until a mismatch
     88   true to fs-verify-quick?
    7489   safe-parse-word $fs-verify
    7590;
Note: See TracChangeset for help on using the changeset viewer.