summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-03-26 20:54:05 +0000
committerphk <phk@FreeBSD.org>1998-03-26 20:54:05 +0000
commit00475b662ad28e7f09931eb67a642ba1ee36db99 (patch)
tree12dd2aed1e3b8ecf5eb4152bf06ffa8c3ede0d7e /sys/ufs
parentff4953fbcc9f747429234d5971a802bb653e451a (diff)
downloadFreeBSD-src-00475b662ad28e7f09931eb67a642ba1ee36db99.zip
FreeBSD-src-00475b662ad28e7f09931eb67a642ba1ee36db99.tar.gz
Add two new functions, get{micro|nano}time.
They are atomic, but return in essence what is in the "time" variable. gettime() is now a macro front for getmicrotime(). Various patches to use the two new functions instead of the various hacks used in their absence. Some puntuation and grammer patches from Bruce. A couple of XXX comments.
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_inode.c3
-rw-r--r--sys/ufs/ufs/inode.h25
-rw-r--r--sys/ufs/ufs/ufs_vnops.c31
3 files changed, 29 insertions, 30 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 02ce546..3fd93dd 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95
- * $Id: ffs_inode.c,v 1.37 1998/03/16 01:55:43 dyson Exp $
+ * $Id: ffs_inode.c,v 1.38 1998/03/19 22:49:42 dyson Exp $
*/
#include "opt_quota.h"
@@ -102,6 +102,7 @@ ffs_update(vp, access, modify, waitfor)
*
* XXX there should be a function or macro for reading the time
* (e.g., some machines may require splclock()).
+ * XXX there are: they're called get{micro|nano}time
*/
tv_sec = time.tv_sec;
if (ip->i_flag & IN_ACCESS)
diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h
index 4bd1cf5..c787e1e 100644
--- a/sys/ufs/ufs/inode.h
+++ b/sys/ufs/ufs/inode.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)inode.h 8.9 (Berkeley) 5/14/95
- * $Id: inode.h,v 1.20 1998/01/30 11:34:02 phk Exp $
+ * $Id: inode.h,v 1.21 1998/03/08 09:59:21 julian Exp $
*/
#ifndef _UFS_UFS_INODE_H_
@@ -143,29 +143,6 @@ struct indir {
#define VTOI(vp) ((struct inode *)(vp)->v_data)
#define ITOV(ip) ((ip)->i_vnode)
-/*
- * XXX this is too long to be a macro, and isn't used in any time-critical
- * place; in fact it is only used in ufs_vnops.c so it shouldn't be in a
- * header file.
- */
-#define ITIMES(ip, t1, t2) { \
- long tv_sec = time.tv_sec; \
- if ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) { \
- (ip)->i_flag |= IN_MODIFIED; \
- if ((ip)->i_flag & IN_ACCESS) \
- (ip)->i_atime \
- = ((t1) == &time ? tv_sec : (t1)->tv_sec); \
- if ((ip)->i_flag & IN_UPDATE) { \
- (ip)->i_mtime \
- = ((t2) == &time ? tv_sec : (t2)->tv_sec); \
- (ip)->i_modrev++; \
- } \
- if ((ip)->i_flag & IN_CHANGE) \
- (ip)->i_ctime = tv_sec; \
- (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \
- } \
-}
-
/* Determine if soft dependencies are being done */
#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & MNT_SOFTDEP)
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 82a7cc3..b922ba7 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
- * $Id: ufs_vnops.c,v 1.78 1998/02/09 06:11:14 eivind Exp $
+ * $Id: ufs_vnops.c,v 1.79 1998/03/08 09:59:44 julian Exp $
*/
#include "opt_quota.h"
@@ -123,6 +123,27 @@ union _qcvt {
}
/*
+ * XXX this is too long to be a macro, and isn't used in any time-critical
+ * place;
+ */
+#define ITIMES(ip) { \
+ struct timeval tv; \
+ getmicrotime(&tv); \
+ if ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) { \
+ (ip)->i_flag |= IN_MODIFIED; \
+ if ((ip)->i_flag & IN_ACCESS) \
+ (ip)->i_atime = tv.tv_sec; \
+ if ((ip)->i_flag & IN_UPDATE) { \
+ (ip)->i_mtime = tv.tv_sec; \
+ (ip)->i_modrev++; \
+ } \
+ if ((ip)->i_flag & IN_CHANGE) \
+ (ip)->i_ctime = tv.tv_sec; \
+ (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \
+ } \
+}
+
+/*
* A virgin directory (no blushing please).
*/
static struct dirtemplate mastertemplate = {
@@ -246,7 +267,7 @@ ufs_close(ap)
simple_lock(&vp->v_interlock);
if (vp->v_usecount > 1)
- ITIMES(ip, &time, &time);
+ ITIMES(ip);
simple_unlock(&vp->v_interlock);
return (0);
}
@@ -349,7 +370,7 @@ ufs_getattr(ap)
register struct inode *ip = VTOI(vp);
register struct vattr *vap = ap->a_vap;
- ITIMES(ip, &time, &time);
+ ITIMES(ip);
/*
* Copy from inode table
*/
@@ -1807,7 +1828,7 @@ ufsspec_close(ap)
simple_lock(&vp->v_interlock);
if (ap->a_vp->v_usecount > 1)
- ITIMES(ip, &time, &time);
+ ITIMES(ip);
simple_unlock(&vp->v_interlock);
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap));
}
@@ -1871,7 +1892,7 @@ ufsfifo_close(ap)
simple_lock(&vp->v_interlock);
if (ap->a_vp->v_usecount > 1)
- ITIMES(ip, &time, &time);
+ ITIMES(ip);
simple_unlock(&vp->v_interlock);
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap));
}
OpenPOWER on IntegriCloud