]> spindle.queued.net Git - xodist/commitdiff
installer: fill in inst.fth's backup size check master
authorAndres Salomon <dilinger@queued.net>
Tue, 15 May 2012 09:30:32 +0000 (02:30 -0700)
committerAndres Salomon <dilinger@queued.net>
Tue, 15 May 2012 09:30:32 +0000 (02:30 -0700)
If device doesn't support " #blocks" (like, for example, /nandflash),
fall back to calling " size".

Signed-off-by: Andres Salomon <dilinger@queued.net>
inst.fth

index 8c3e6d073e4acc20a718622328d348a17337ffe3..47af32cc0756185a5ecc2811d76025602e09aedb 100644 (file)
--- a/inst.fth
+++ b/inst.fth
@@ -5,17 +5,12 @@
       dup " #blocks" rot $call-method           ( ih #blocks )
       ?dup 0<> if
          \ we're assuming a block size of 512 bytes
-         d# 512 um*                             ( ih #bytes )
-         d# 1,000,000 um/mod                    ( ih rem #MB )
-         rot close-dev swap drop                ( #MB )
+         d# 512 um*                             ( ih bytes.lo bytes.hi )
       else
-\ TODO
-         drop
-         0
-\      dup " block-size" rot $call-method        ( ih  size x )
-\      rot close-dev drop                        ( size.lo )
-\      d# 20 >>                                  ( #MB )
+         dup " size" rot $call-method           ( ih size.lo size.hi )
       then
+      d# 1,000,000 um/mod                       ( ih rem #MB )
+      rot close-dev nip                         ( #MB )
    else
       0                                         ( #MB )
    then
@@ -122,17 +117,6 @@ d# 128 buffer: verifystr
    then
 ;
 
-\ : disk-size  ( devspec$ -- #MB )
-\   open-dev ?dup 0<> if                         ( ih )
-\      dup " size" rot $call-method              ( ih size.lo size.hi )
-\      rot close-dev drop                        ( size.lo )
-\      d# 20 >>                                  ( #MB )
-\      \ fuck your signed 32bit division..    d# 100000 /                               ( #MB ).
-\   else
-\      0                                         ( #MB )
-\   then
-\ ;
-
 : debxo-find-targets  ( -- help0$ 'func0 'icon0 ... helpk$ 'funck 'iconk )
    0 to nr-targets