Subject: Re: CVS commit: src/sys/ufs
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Charles M. Hannum <abuse@spamalicious.com>
List: source-changes
Date: 12/20/2004 06:57:54
On Monday 20 December 2004 05:49, YAMAMOTO Takashi wrote:
> > > > Remove some unnecessary (int32_t) casts that would cause us to screw
> > > > up the top bit in block addresses.
> > > >
> > > > Also, change some daddr_t->int32_t casts (mostly as arguments to
> > > > ufs_rw32(), where they would get promoted anyway) to u_int32_t.
> > >
> > > i don't think these changes are correct.
> > > at least lfs depends on signed daddr_t.
> >
> > How could that possibly matter?  daddr_t is 64 bits.  Any u_int32_t would
> > get promoted as is.  As far as I'm aware, neither FFS nor LFS put
> > negative block numbers *on disk*.
>
> lfs uses special block number, UNWRITTEN (== -2).
> although they shouldn't go to disk, you can find them in
> in-core inodes/indirect blocks.

I still don't see why it would matter, then.  At the point these routines are 
called, having such a block number present would at best cause us to try to 
read a non-existant portion of the disk.  It would indicate a bug elsewhere.

That said, we really need to clean this stuff up and make it unsigned clean.