diff options
author | Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> | 2014-05-22 13:44:38 +0530 |
---|---|---|
committer | Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> | 2014-06-13 12:33:54 +0530 |
commit | 4034b51fa0d0fd06209a3545a2789eae417e892f (patch) | |
tree | 6c88de77778b45fe83924754d953122181d2bd0d /slof | |
parent | ac72005f77cca728013e48affbcc21a38c2e9ee4 (diff) | |
download | SLOF-4034b51fa0d0fd06209a3545a2789eae417e892f.zip SLOF-4034b51fa0d0fd06209a3545a2789eae417e892f.tar.gz SLOF-4034b51fa0d0fd06209a3545a2789eae417e892f.tar.bz2 |
fat16: fix read and remove debug messages
* fat16 code had old debug prints, get rid of that
* yaboot tried reading a file beyond the size of file, fix read
routine to override and read only till the file-size
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Diffstat (limited to 'slof')
-rw-r--r-- | slof/fs/packages/fat-files.fs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/slof/fs/packages/fat-files.fs b/slof/fs/packages/fat-files.fs index 76d9f51..0cec366 100644 --- a/slof/fs/packages/fat-files.fs +++ b/slof/fs/packages/fat-files.fs @@ -111,11 +111,11 @@ CREATE dos-name b allot next-cluster @ read-cluster REPEAT false ELSE true THEN ; : find-path ( dir-cluster name len -- cluster file-len true | false ) dup 0= IF 3drop false ." empty name " EXIT THEN - over c@ [char] \ = IF 1 /string ." slash " RECURSE EXIT THEN + over c@ [char] \ = IF 1 /string RECURSE EXIT THEN [char] \ split 2>r find-file 0= IF 2r> 2drop false ." not found " EXIT THEN r@ 0<> <> IF 2drop 2r> 2drop false ." no dir<->file match " EXIT THEN - r@ 0<> IF drop 2r> ." more... " RECURSE EXIT THEN - 2r> 2drop true ." got it " ; + r@ 0<> IF drop 2r> RECURSE EXIT THEN + 2r> 2drop true ; : do-super ( -- ) 0 200 read-data @@ -145,7 +145,7 @@ CREATE dos-name b allot #root-entries @ 20 * bytes/sector @ // - sectors/cluster @ / dup #clusters ! dup ff5 < IF drop c ELSE fff5 < IF 10 ELSE 20 THEN THEN fat-type ! -cr ." FAT" base @ decimal fat-type @ . base ! + base @ decimal base ! \ Starting offset of first fat. #reserved-sectors @ bytes/sector @ * fat-offset ! @@ -175,6 +175,7 @@ INSTANCE VARIABLE pos-in-data r@ pos-in-data +! r@ current-pos +! pos-in-data @ #data @ = IF next-cluster @ ?dup IF read-cluster 0 pos-in-data ! THEN THEN r> ; : read ( adr len -- actual ) + file-len @ min \ len cannot be greater than file size dup >r BEGIN dup WHILE 2dup read dup 0= ABORT" fat-files: read failed" /string ( tuck - >r + r> ) REPEAT 2drop r> ; : load ( adr -- len ) |