Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_default.c
Show First 20 Lines • Show All 1,494 Lines • ▼ Show 20 Lines | vop_stdstat(struct vop_stat_args *a) | ||||
/* | /* | ||||
* Initialize defaults for new and unusual fields, so that file | * Initialize defaults for new and unusual fields, so that file | ||||
* systems which don't support these fields don't need to know | * systems which don't support these fields don't need to know | ||||
* about them. | * about them. | ||||
*/ | */ | ||||
vap->va_birthtime.tv_sec = -1; | vap->va_birthtime.tv_sec = -1; | ||||
vap->va_birthtime.tv_nsec = 0; | vap->va_birthtime.tv_nsec = 0; | ||||
vap->va_fsid = VNOVAL; | vap->va_fsid = VNOVAL; | ||||
vap->va_gen = 0; | |||||
kib: I believe that it is better to initialize the field with VNOVAL AKA -1.
For instance, UFS… | |||||
Done Inline ActionsI note that quite a few filesystems individually initialize va_gen as 0 in their getattr implementations. Should they be left alone? markj: I note that quite a few filesystems individually initialize va_gen as 0 in their getattr… | |||||
Not Done Inline ActionsHm, UFS interprets 0 as not having i_gen initialized, not VNOVAL. See ffs_vfsops.c:ffs_vgetf(). So now I think that my suggestion is wrong, and VNOVAL is the valid value for va_gen e.g. from UFS. kib: Hm, UFS interprets 0 as not having i_gen initialized, not VNOVAL. See ffs_vfsops.c:ffs_vgetf(). | |||||
vap->va_rdev = NODEV; | vap->va_rdev = NODEV; | ||||
error = VOP_GETATTR(vp, vap, a->a_active_cred); | error = VOP_GETATTR(vp, vap, a->a_active_cred); | ||||
if (error) | if (error) | ||||
goto out; | goto out; | ||||
/* | /* | ||||
* Zero the spare stat fields | * Zero the spare stat fields | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |
I believe that it is better to initialize the field with VNOVAL AKA -1.
For instance, UFS *set*attr compares va_gen with VNOVAL.