summaryrefslogtreecommitdiffstats
path: root/sys/msdosfs/denode.h
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1994-12-12 12:35:50 +0000
committerbde <bde@FreeBSD.org>1994-12-12 12:35:50 +0000
commite62de5875e5dab92ad9733a6e768297f341993a6 (patch)
tree626f6527e26b0513eec8fb26c3b5465e0455661d /sys/msdosfs/denode.h
parent5e1c91854979f54637a24def6160e2296d5ff499 (diff)
downloadFreeBSD-src-e62de5875e5dab92ad9733a6e768297f341993a6.zip
FreeBSD-src-e62de5875e5dab92ad9733a6e768297f341993a6.tar.gz
Fix numerous timestamp bugs.
DE_UPDATE was confused with DE_MODIFIED in some places (they do have confusing names). Handle them exactly the same as IN_UPDATE and IN_MODIFIED. This fixes chmod() and chown() clobbering the mtime and other bugs. DE_MODIFIED was set but not used. Parenthesize macro args. DE_TIMES() now takes a timeval arg instead of a timespec arg. It was stupid to use a macro for speed and do unused conversions to prepare for the macro. Restore the left shifting of the DOS seconds count by 1. It got lost among the shifts for the bitfields, so DOS seconds counts appeared to range from 0 to 29 seconds (step 1) instead of 0 to 58 seconds (step 2). Actually use the passed-in mtime in deupdat() as documented so that utimes() works. Change `extern __inline's to `static inline's so that msdosfs_fat.o can be linked when it is compiled without -O. Remove faking of directory mtimes to always be the current time. It's more surprising for directory mtimes to change when you read the directories than for them not to change when you write the directories. This should be controlled by a mount-time option if at all.
Diffstat (limited to 'sys/msdosfs/denode.h')
-rw-r--r--sys/msdosfs/denode.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h
index 8df3e4c..dce8fd6 100644
--- a/sys/msdosfs/denode.h
+++ b/sys/msdosfs/denode.h
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: denode.h,v 1.1 1994/09/19 15:41:38 dfr Exp $ */
/* $NetBSD: denode.h,v 1.8 1994/08/21 18:43:49 ws Exp $ */
/*-
@@ -166,8 +166,9 @@ struct denode {
*/
#define DE_LOCKED 0x0001 /* directory entry is locked */
#define DE_WANTED 0x0002 /* someone wants this de */
-#define DE_UPDATE 0x0004 /* file has been modified */
-#define DE_MODIFIED 0x0080 /* denode wants to be written back to disk */
+#define DE_UPDATE 0x0004 /* modification time update request */
+#define DE_MODIFIED 0x0080 /* denode has been modified, but DE_UPDATE
+ * isn't set */
/*
* Transfer directory entries between internal and external form.
@@ -199,18 +200,20 @@ struct denode {
#define DETOV(de) ((de)->de_vnode)
#define DE_UPDAT(dep, t, waitfor) \
- if (dep->de_flag & DE_UPDATE) \
- (void) deupdat(dep, t, waitfor);
+ if ((dep)->de_flag & (DE_MODIFIED | DE_UPDATE)) \
+ (void) deupdat((dep), (t), (waitfor));
#define DE_TIMES(dep, t) \
- if (dep->de_flag & DE_UPDATE) { \
+ if ((dep)->de_flag & DE_UPDATE) { \
+ struct timespec DE_TIMES_ts; \
(dep)->de_flag |= DE_MODIFIED; \
- unix2dostime(t, &dep->de_Date, &dep->de_Time); \
+ TIMEVAL_TO_TIMESPEC((t), &DE_TIMES_ts); \
+ unix2dostime(&DE_TIMES_ts, &(dep)->de_Date, &(dep)->de_Time); \
(dep)->de_flag &= ~DE_UPDATE; \
}
/*
- * This overlays the fid sturcture (see mount.h)
+ * This overlays the fid structure (see mount.h)
*/
struct defid {
u_short defid_len; /* length of structure */
OpenPOWER on IntegriCloud