Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Sep 2008 17:03:50 +0300
From:      Jaakko Heinonen <jh@saunalahti.fi>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: birthtime initialization
Message-ID:  <20080911140349.GA2221@a91-153-122-179.elisa-laajakaista.fi>
In-Reply-To: <20080909204354.Q3089@besplex.bde.org>
References:  <200806020800.m528038T072838@freefall.freebsd.org> <20080722075718.GA1881@a91-153-120-204.elisa-laajakaista.fi> <20080722215249.K17453@delplex.bde.org> <20080723103424.GA1856@a91-153-120-204.elisa-laajakaista.fi> <20080724000618.Q16961@besplex.bde.org> <20080725072314.GA807@a91-153-120-204.elisa-laajakaista.fi> <20080725192315.D27178@delplex.bde.org> <20080903160736.GA12587@a91-153-122-179.elisa-laajakaista.fi> <20080909204354.Q3089@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2008-09-09, Bruce Evans wrote:
> > @@ -703,6 +703,17 @@ vn_stat(vp, sb, active_cred, file_cred,

> > +	vap->va_rdev = VNOVAL;
> 
> Shouldn't this be NODEV?  NODEV is ((dev_t)-1) and VNOVAL is plain (-1),
> so their values are identical after assignment to va_rdev...

Yes, it's probably better to use NODEV here...

> > -	sb->st_rdev = vap->va_rdev;
> > +	if (vap->va_rdev == VNOVAL)
> > +		sb->st_rdev = NODEV;
> > +	else
> > +		sb->st_rdev = vap->va_rdev;

...and leave out this change.

> ... this change seems to have no effect on machines with 32-bit 2's complement
> ints and to be wrong on other machines.  Assignment of VNOVAL to va_rdev
> changes its value from -1 to 0xFFFFFFFFU, so it can only compare equal
> to VNOVAL if int has the same size as dev_t or there is stronger magic.
> When the comparision is fixed to compare with the assigned value
> (dev_t)VNOVAL == (dev_t)(-1) == NODEV, it is clear that the change has
> no effect.

Some file systems seem to have vap->va_rdev != VNOVAL comparisons in
VOP_SETATTR().

Thanks.
-- 
Jaakko



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080911140349.GA2221>