diff options
author | bde <bde@FreeBSD.org> | 1994-12-27 13:59:14 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1994-12-27 13:59:14 +0000 |
commit | 2f6ca0332d7f9cf2f8b936dda045ce966ddab2f2 (patch) | |
tree | a7bb7b9307103f576ad1dde8af64cf7f267b4b8d /sys/gnu | |
parent | 672359307cefb1bf566b37e39d1d221293b5a9a9 (diff) | |
download | FreeBSD-src-2f6ca0332d7f9cf2f8b936dda045ce966ddab2f2.zip FreeBSD-src-2f6ca0332d7f9cf2f8b936dda045ce966ddab2f2.tar.gz |
Use the same current time throughout ITIMES(). I want all current
timestamps for an atomic operation such as rename() on a local file
system to be identical.
Uniformize yet another idempotency ifdef. The comment nesting was
bogus.
Diffstat (limited to 'sys/gnu')
-rw-r--r-- | sys/gnu/ext2fs/inode.h | 22 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/inode.h | 22 |
2 files changed, 30 insertions, 14 deletions
diff --git a/sys/gnu/ext2fs/inode.h b/sys/gnu/ext2fs/inode.h index cda8fb44b..1646792 100644 --- a/sys/gnu/ext2fs/inode.h +++ b/sys/gnu/ext2fs/inode.h @@ -36,11 +36,11 @@ * SUCH DAMAGE. * * @(#)inode.h 8.4 (Berkeley) 1/21/94 - * $Id: inode.h,v 1.2 1994/08/02 07:54:49 davidg Exp $ + * $Id: inode.h,v 1.3 1994/08/21 07:16:15 paul Exp $ */ #ifndef _UFS_UFS_INODE_H_ -#define _UFS_UFS_INODE_H_ +#define _UFS_UFS_INODE_H_ #include <ufs/ufs/dinode.h> @@ -141,17 +141,25 @@ 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.ts_sec = (t1)->tv_sec; \ + (ip)->i_atime.ts_sec \ + = ((t1) == &time ? tv_sec : (t1)->tv_sec); \ if ((ip)->i_flag & IN_UPDATE) { \ - (ip)->i_mtime.ts_sec = (t2)->tv_sec; \ + (ip)->i_mtime.ts_sec \ + = ((t2) == &time ? tv_sec : (t2)->tv_sec); \ (ip)->i_modrev++; \ } \ if ((ip)->i_flag & IN_CHANGE) \ - (ip)->i_ctime.ts_sec = time.tv_sec; \ + (ip)->i_ctime.ts_sec = tv_sec; \ (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \ } \ } @@ -163,6 +171,6 @@ struct ufid { ino_t ufid_ino; /* File number (ino). */ long ufid_gen; /* Generation number. */ }; - -#endif #endif /* KERNEL */ + +#endif /* !_UFS_UFS_INODE_H_ */ diff --git a/sys/gnu/fs/ext2fs/inode.h b/sys/gnu/fs/ext2fs/inode.h index cda8fb44b..1646792 100644 --- a/sys/gnu/fs/ext2fs/inode.h +++ b/sys/gnu/fs/ext2fs/inode.h @@ -36,11 +36,11 @@ * SUCH DAMAGE. * * @(#)inode.h 8.4 (Berkeley) 1/21/94 - * $Id: inode.h,v 1.2 1994/08/02 07:54:49 davidg Exp $ + * $Id: inode.h,v 1.3 1994/08/21 07:16:15 paul Exp $ */ #ifndef _UFS_UFS_INODE_H_ -#define _UFS_UFS_INODE_H_ +#define _UFS_UFS_INODE_H_ #include <ufs/ufs/dinode.h> @@ -141,17 +141,25 @@ 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.ts_sec = (t1)->tv_sec; \ + (ip)->i_atime.ts_sec \ + = ((t1) == &time ? tv_sec : (t1)->tv_sec); \ if ((ip)->i_flag & IN_UPDATE) { \ - (ip)->i_mtime.ts_sec = (t2)->tv_sec; \ + (ip)->i_mtime.ts_sec \ + = ((t2) == &time ? tv_sec : (t2)->tv_sec); \ (ip)->i_modrev++; \ } \ if ((ip)->i_flag & IN_CHANGE) \ - (ip)->i_ctime.ts_sec = time.tv_sec; \ + (ip)->i_ctime.ts_sec = tv_sec; \ (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \ } \ } @@ -163,6 +171,6 @@ struct ufid { ino_t ufid_ino; /* File number (ino). */ long ufid_gen; /* Generation number. */ }; - -#endif #endif /* KERNEL */ + +#endif /* !_UFS_UFS_INODE_H_ */ |