Subject: Re: ADOSFS reading corrupted data
To: None <port-amiga@netbsd.org>
From: Ilpo Ruotsalainen <lonewolf@iki.fi>
List: port-amiga
Date: 12/21/2002 07:50:58
On Fri Dec 20 2002 at 04:48:54 +0200, Ilpo Ruotsalainen wrote:
> I tried to install NetBSD/amiga from 1.6 release CD image on my A1200
> and ended up having same problems as described in PR 16021. After some
> debugging it turned out that adosfs is reading corrupted data after
> block boundary: on a FS with 1024 byte blocks the 1025th byte is read
> wrong, on a FS with 4096 byte blocks the 4097th byte is read wrong.
> 
> Currently trying to figure out where things go wrong but as I lack
> reasonable ways to transfer kernels to my amiga it'll probably take a
> while, so if anyone can help in debugging this or already knows the
> solution please let me know.

And the attached patch is the fix (works for me, YMMV but please someone
test it before I commit it ;).

The bug was in the fact that adosfs scaled the block numbers one way in
adosfs_read() and other way in adosfs_bmap(), which ended up with bad
results when UBC called adosfs_bmap() and didn't scale the blocks like
adosfs_read() did. Also mmap() on adosfs was broken because of the same
'feature' in adosfs_bmap().

-- 
Ilpo Ruotsalainen - <lonewolf@iki.fi> - http://www.iki.fi/lonewolf/