birthtime initialization
Jaakko Heinonen
jh at saunalahti.fi
Thu Sep 11 14:03:54 UTC 2008
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
More information about the freebsd-fs
mailing list