diff options
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 23 | ||||
-rw-r--r-- | sys/gnu/ext2fs/ext2_vnops.c | 25 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vnops.c | 25 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 13 | ||||
-rw-r--r-- | sys/sys/vnode.h | 1 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 25 |
6 files changed, 19 insertions, 93 deletions
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 6fa69bd..cd7f536 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -76,23 +76,6 @@ static u_long dehash; /* size of hash table - 1 */ static struct mtx dehash_mtx; static int dehash_init; -union _qcvt { - quad_t qcvt; - long val[2]; -}; -#define SETHIGH(q, h) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_HIGHWORD] = (h); \ - (q) = tmp.qcvt; \ -} -#define SETLOW(q, l) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_LOWWORD] = (l); \ - (q) = tmp.qcvt; \ -} - static struct denode * msdosfs_hashget(struct cdev *dev, u_long dirclust, u_long diroff); static void msdosfs_hashins(struct denode *dep); @@ -222,7 +205,6 @@ deget(pmp, dirclust, diroffset, depp) struct vnode *nvp; struct buf *bp; struct thread *td = curthread; /* XXX */ - struct timeval tv; #ifdef MSDOSFS_DEBUG printf("deget(pmp %p, dirclust %lu, diroffset %lx, depp %p)\n", @@ -389,9 +371,8 @@ deget(pmp, dirclust, diroffset, depp) } } else nvp->v_type = VREG; - getmicrouptime(&tv); - SETHIGH(ldep->de_modrev, tv.tv_sec); - SETLOW(ldep->de_modrev, tv.tv_usec * 4294); + + ldep->de_modrev = init_va_filerev(); ldep->de_devvp = pmp->pm_devvp; VREF(ldep->de_devvp); *depp = ldep; diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c index cf04778..b344173 100644 --- a/sys/gnu/ext2fs/ext2_vnops.c +++ b/sys/gnu/ext2fs/ext2_vnops.c @@ -201,23 +201,6 @@ static struct vnodeopv_desc ext2fs_fifoop_opv_desc = #include <gnu/ext2fs/ext2_readwrite.c> -union _qcvt { - int64_t qcvt; - int32_t val[2]; -}; -#define SETHIGH(q, h) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_HIGHWORD] = (h); \ - (q) = tmp.qcvt; \ -} -#define SETLOW(q, l) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_LOWWORD] = (l); \ - (q) = tmp.qcvt; \ -} - /* * A virgin directory (no blushing please). * Note that the type and namlen fields are reversed relative to ext2. @@ -1741,7 +1724,6 @@ ext2_vinit(mntp, specops, fifoops, vpp) { struct inode *ip; struct vnode *vp; - struct timeval tv; vp = *vpp; ip = VTOI(vp); @@ -1763,12 +1745,7 @@ ext2_vinit(mntp, specops, fifoops, vpp) } if (ip->i_number == ROOTINO) vp->v_vflag |= VV_ROOT; - /* - * Initialize modrev times - */ - getmicrouptime(&tv); - SETHIGH(ip->i_modrev, tv.tv_sec); - SETLOW(ip->i_modrev, tv.tv_usec * 4294); + ip->i_modrev = init_va_filerev(); *vpp = vp; return (0); } diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index cf04778..b344173 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -201,23 +201,6 @@ static struct vnodeopv_desc ext2fs_fifoop_opv_desc = #include <gnu/ext2fs/ext2_readwrite.c> -union _qcvt { - int64_t qcvt; - int32_t val[2]; -}; -#define SETHIGH(q, h) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_HIGHWORD] = (h); \ - (q) = tmp.qcvt; \ -} -#define SETLOW(q, l) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_LOWWORD] = (l); \ - (q) = tmp.qcvt; \ -} - /* * A virgin directory (no blushing please). * Note that the type and namlen fields are reversed relative to ext2. @@ -1741,7 +1724,6 @@ ext2_vinit(mntp, specops, fifoops, vpp) { struct inode *ip; struct vnode *vp; - struct timeval tv; vp = *vpp; ip = VTOI(vp); @@ -1763,12 +1745,7 @@ ext2_vinit(mntp, specops, fifoops, vpp) } if (ip->i_number == ROOTINO) vp->v_vflag |= VV_ROOT; - /* - * Initialize modrev times - */ - getmicrouptime(&tv); - SETHIGH(ip->i_modrev, tv.tv_sec); - SETLOW(ip->i_modrev, tv.tv_usec * 4294); + ip->i_modrev = init_va_filerev(); *vpp = vp; return (0); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ad6d749..fb81c13 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4062,3 +4062,16 @@ sysctl_vfs_ctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_vfs, OID_AUTO, ctl, CTLFLAG_WR, NULL, 0, sysctl_vfs_ctl, "", "Sysctl by fsid"); + +/* + * Function to initialize a va_filerev field sensibly. + * XXX: Wouldn't a random number make a lot more sense ?? + */ +u_quad_t +init_va_filerev(void) +{ + struct bintime bt; + + getbinuptime(&bt); + return (((u_quad_t)bt.sec << 32LL) | (bt.frac >> 32LL)); +} diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 166cd53..51f0581 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -613,6 +613,7 @@ void cvtstat(struct stat *st, struct ostat *ost); void cvtnstat(struct stat *sb, struct nstat *nsb); int getnewvnode(const char *tag, struct mount *mp, vop_t **vops, struct vnode **vpp); +u_quad_t init_va_filerev(void); int lease_check(struct vop_lease_args *ap); int spec_vnoperate(struct vop_generic_args *); int speedup_syncer(void); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 8509bc1..b09f957 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -117,23 +117,6 @@ static int filt_ufsvnode(struct knote *kn, long hint); static void filt_ufsdetach(struct knote *kn); static int ufs_kqfilter(struct vop_kqfilter_args *ap); -union _qcvt { - int64_t qcvt; - int32_t val[2]; -}; -#define SETHIGH(q, h) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_HIGHWORD] = (h); \ - (q) = tmp.qcvt; \ -} -#define SETLOW(q, l) { \ - union _qcvt tmp; \ - tmp.qcvt = (q); \ - tmp.val[_QUAD_LOWWORD] = (l); \ - (q) = tmp.qcvt; \ -} - /* * A virgin directory (no blushing please). */ @@ -2321,7 +2304,6 @@ ufs_vinit(mntp, specops, fifoops, vpp) { struct inode *ip; struct vnode *vp; - struct timeval tv; vp = *vpp; ip = VTOI(vp); @@ -2342,12 +2324,7 @@ ufs_vinit(mntp, specops, fifoops, vpp) ASSERT_VOP_LOCKED(vp, "ufs_vinit"); if (ip->i_number == ROOTINO) vp->v_vflag |= VV_ROOT; - /* - * Initialize modrev times - */ - getmicrouptime(&tv); - SETHIGH(ip->i_modrev, tv.tv_sec); - SETLOW(ip->i_modrev, tv.tv_usec * 4294); + ip->i_modrev = init_va_filerev(); *vpp = vp; return (0); } |