aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1994-12-12 12:35:50 +0000
committerBruce Evans <bde@FreeBSD.org>1994-12-12 12:35:50 +0000
commit63e4f22a2aa1b879d9226536fc0eee7071e8b9a2 (patch)
tree626f6527e26b0513eec8fb26c3b5465e0455661d /sys
parent20989d2d64c0fba8b2a261cbe124da80e4778054 (diff)
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.
Notes
Notes: svn path=/head/; revision=5083
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/msdosfs/denode.h19
-rw-r--r--sys/fs/msdosfs/msdosfs_conv.c4
-rw-r--r--sys/fs/msdosfs/msdosfs_denode.c30
-rw-r--r--sys/fs/msdosfs/msdosfs_fat.c6
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c4
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c24
-rw-r--r--sys/msdosfs/denode.h19
-rw-r--r--sys/msdosfs/msdosfs_conv.c4
-rw-r--r--sys/msdosfs/msdosfs_denode.c30
-rw-r--r--sys/msdosfs/msdosfs_fat.c6
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c4
-rw-r--r--sys/msdosfs/msdosfs_vnops.c24
12 files changed, 92 insertions, 82 deletions
diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h
index 8df3e4cfba64..dce8fd68633c 100644
--- a/sys/fs/msdosfs/denode.h
+++ b/sys/fs/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 */
diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c
index 035eb0552aa4..81c153623a2f 100644
--- a/sys/fs/msdosfs/msdosfs_conv.c
+++ b/sys/fs/msdosfs/msdosfs_conv.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_conv.c,v 1.1 1994/09/19 15:41:40 dfr Exp $ */
+/* $Id: msdosfs_conv.c,v 1.2 1994/09/27 20:42:42 phk Exp $ */
/* $NetBSD: msdosfs_conv.c,v 1.6.2.1 1994/08/30 02:27:57 cgd Exp $ */
/*
@@ -146,7 +146,7 @@ dos2unixtime(dd, dt, tsp)
u_long days;
u_short *months;
- seconds = ((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT)
+ seconds = (((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT) << 1)
+ ((dt & DT_MINUTES_MASK) >> DT_MINUTES_SHIFT) * 60
+ ((dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT) * 3600;
/*
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c
index 0a62d84cead9..b9720c07734c 100644
--- a/sys/fs/msdosfs/msdosfs_denode.c
+++ b/sys/fs/msdosfs/msdosfs_denode.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_denode.c,v 1.3 1994/10/06 21:06:51 davidg Exp $ */
+/* $Id: msdosfs_denode.c,v 1.4 1994/10/10 07:57:32 phk Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */
/*-
@@ -318,7 +318,6 @@ deupdat(dep, tp, waitfor)
int error;
struct buf *bp;
struct direntry *dirp;
- struct timespec ts;
struct vnode *vp = DETOV(dep);
#ifdef MSDOSFS_DEBUG
@@ -326,13 +325,15 @@ deupdat(dep, tp, waitfor)
#endif
/*
- * If the update bit is off, or this denode is from a readonly
- * filesystem, or this denode is for a directory, or the denode
- * represents an open but unlinked file then don't do anything. DOS
- * directory entries that describe a directory do not ever get
- * updated. This is the way dos treats them.
+ * If the denode-modified and update-mtime bits are off,
+ * or this denode is from a readonly filesystem,
+ * or this denode is for a directory,
+ * or the denode represents an open but unlinked file,
+ * then don't do anything. DOS directory
+ * entries that describe a directory do not ever get
+ * updated. This is the way DOS treats them.
*/
- if ((dep->de_flag & DE_UPDATE) == 0 ||
+ if ((dep->de_flag & (DE_MODIFIED | DE_UPDATE)) == 0 ||
vp->v_mount->mnt_flag & MNT_RDONLY ||
dep->de_Attributes & ATTR_DIRECTORY ||
dep->de_refcnt <= 0)
@@ -347,11 +348,16 @@ deupdat(dep, tp, waitfor)
return error;
/*
- * Put the passed in time into the directory entry.
+ * If the mtime is to be updated, put the passed in time into the
+ * directory entry.
*/
- TIMEVAL_TO_TIMESPEC(&time, &ts);
- unix2dostime(&ts, &dep->de_Date, &dep->de_Time);
- dep->de_flag &= ~DE_UPDATE;
+ if (dep->de_flag & DE_UPDATE)
+ unix2dostime(tp, &dep->de_Date, &dep->de_Time);
+
+ /*
+ * The mtime is now up to date. The denode will be unmodifed soon.
+ */
+ dep->de_flag &= ~(DE_MODIFIED | DE_UPDATE);
/*
* Copy the directory entry out of the denode into the cluster it
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c
index 2e3829600e3d..742325d8b96a 100644
--- a/sys/fs/msdosfs/msdosfs_fat.c
+++ b/sys/fs/msdosfs/msdosfs_fat.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_fat.c,v 1.2 1994/09/27 20:42:46 phk Exp $ */
+/* $Id: msdosfs_fat.c,v 1.3 1994/10/10 07:57:33 phk Exp $ */
/* $NetBSD: msdosfs_fat.c,v 1.12 1994/08/21 18:44:04 ws Exp $ */
/*-
@@ -361,7 +361,7 @@ updatefats(pmp, bp, fatbn)
* Where n is even. m = n + (n >> 2)
*
*/
-extern __inline void
+static inline void
usemap_alloc(pmp, cn)
struct msdosfsmount *pmp;
u_long cn;
@@ -371,7 +371,7 @@ usemap_alloc(pmp, cn)
pmp->pm_freeclustercount--;
}
-extern __inline void
+static inline void
usemap_free(pmp, cn)
struct msdosfsmount *pmp;
u_long cn;
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 8f270762aac8..4a765b98359b 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.4 1994/09/27 20:42:54 phk Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.5 1994/10/02 17:48:21 phk Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.19 1994/08/21 18:44:10 ws Exp $ */
/*-
@@ -634,7 +634,7 @@ loop:
if (VOP_ISLOCKED(vp)) /* file is busy */
continue;
dep = VTODE(vp);
- if ((dep->de_flag & DE_UPDATE) == 0 &&
+ if ((dep->de_flag & (DE_MODIFIED | DE_UPDATE)) == 0 &&
vp->v_dirtyblkhd.lh_first == NULL)
continue;
if (vget(vp, 1)) /* not there anymore? */
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 1203caee0fba..35c96f525b23 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vnops.c,v 1.8 1994/11/01 21:14:45 jkh Exp $ */
+/* $Id: msdosfs_vnops.c,v 1.9 1994/11/29 23:39:15 ache Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
/*-
@@ -197,12 +197,9 @@ msdosfs_close(ap)
{
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
- struct timespec ts;
- if (vp->v_usecount > 1 && !(dep->de_flag & DE_LOCKED)) {
- TIMEVAL_TO_TIMESPEC(&time, &ts);
- DE_TIMES(dep, &ts);
- }
+ if (vp->v_usecount > 1 && !(dep->de_flag & DE_LOCKED))
+ DE_TIMES(dep, &time);
return 0;
}
@@ -296,10 +293,8 @@ msdosfs_getattr(ap)
u_int cn;
struct denode *dep = VTODE(ap->a_vp);
struct vattr *vap = ap->a_vap;
- struct timespec ts;
- TIMEVAL_TO_TIMESPEC(&time, &ts);
- DE_TIMES(dep, &ts);
+ DE_TIMES(dep, &time);
vap->va_fsid = dep->de_dev;
/*
* The following computation of the fileid must be the same as that
@@ -327,10 +322,12 @@ msdosfs_getattr(ap)
vap->va_size = dep->de_FileSize;
dos2unixtime(dep->de_Date, dep->de_Time, &vap->va_atime);
vap->va_mtime = vap->va_atime;
+#if 0
#ifndef MSDOSFS_NODIRMOD
if (vap->va_mode & S_IFDIR)
TIMEVAL_TO_TIMESPEC(&time, &vap->va_mtime);
#endif
+#endif
vap->va_ctime = vap->va_atime;
vap->va_flags = dep->de_flag;
vap->va_gen = 0;
@@ -406,7 +403,7 @@ msdosfs_setattr(ap)
dep->de_Attributes &= ~ATTR_READONLY;
else
dep->de_Attributes |= ATTR_READONLY;
- dep->de_flag |= DE_UPDATE;
+ dep->de_flag |= DE_MODIFIED;
}
if (vap->va_flags != VNOVAL) {
@@ -419,7 +416,7 @@ msdosfs_setattr(ap)
dep->de_flag &= 0xffff0000;
dep->de_flag |= (vap->va_flags & 0xffff);
}
- dep->de_flag |= DE_UPDATE;
+ dep->de_flag |= DE_MODIFIED;
}
return error;
}
@@ -545,7 +542,6 @@ msdosfs_write(ap)
struct ucred *cred = ap->a_cred;
struct timespec ts;
- TIMEVAL_TO_TIMESPEC(&time, &ts);
#ifdef MSDOSFS_DEBUG
printf("msdosfs_write(vp %08x, uio %08x, ioflag %08x, cred %08x\n",
vp, uio, ioflag, cred);
@@ -728,6 +724,7 @@ errexit:
error = 0;
}
} else {
+ TIMEVAL_TO_TIMESPEC(&time, &ts);
error = deupdat(dep, &ts, 1);
}
return error;
@@ -794,8 +791,6 @@ msdosfs_fsync(ap)
struct buf *nbp;
int s;
- TIMEVAL_TO_TIMESPEC(&time, &ts);
-
/*
* Flush all dirty buffers associated with a vnode.
*/
@@ -824,6 +819,7 @@ loop:
}
#endif
splx(s);
+ TIMEVAL_TO_TIMESPEC(&time, &ts);
return deupdat(VTODE(vp), &ts, wait);
}
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h
index 8df3e4cfba64..dce8fd68633c 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 */
diff --git a/sys/msdosfs/msdosfs_conv.c b/sys/msdosfs/msdosfs_conv.c
index 035eb0552aa4..81c153623a2f 100644
--- a/sys/msdosfs/msdosfs_conv.c
+++ b/sys/msdosfs/msdosfs_conv.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_conv.c,v 1.1 1994/09/19 15:41:40 dfr Exp $ */
+/* $Id: msdosfs_conv.c,v 1.2 1994/09/27 20:42:42 phk Exp $ */
/* $NetBSD: msdosfs_conv.c,v 1.6.2.1 1994/08/30 02:27:57 cgd Exp $ */
/*
@@ -146,7 +146,7 @@ dos2unixtime(dd, dt, tsp)
u_long days;
u_short *months;
- seconds = ((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT)
+ seconds = (((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT) << 1)
+ ((dt & DT_MINUTES_MASK) >> DT_MINUTES_SHIFT) * 60
+ ((dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT) * 3600;
/*
diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c
index 0a62d84cead9..b9720c07734c 100644
--- a/sys/msdosfs/msdosfs_denode.c
+++ b/sys/msdosfs/msdosfs_denode.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_denode.c,v 1.3 1994/10/06 21:06:51 davidg Exp $ */
+/* $Id: msdosfs_denode.c,v 1.4 1994/10/10 07:57:32 phk Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */
/*-
@@ -318,7 +318,6 @@ deupdat(dep, tp, waitfor)
int error;
struct buf *bp;
struct direntry *dirp;
- struct timespec ts;
struct vnode *vp = DETOV(dep);
#ifdef MSDOSFS_DEBUG
@@ -326,13 +325,15 @@ deupdat(dep, tp, waitfor)
#endif
/*
- * If the update bit is off, or this denode is from a readonly
- * filesystem, or this denode is for a directory, or the denode
- * represents an open but unlinked file then don't do anything. DOS
- * directory entries that describe a directory do not ever get
- * updated. This is the way dos treats them.
+ * If the denode-modified and update-mtime bits are off,
+ * or this denode is from a readonly filesystem,
+ * or this denode is for a directory,
+ * or the denode represents an open but unlinked file,
+ * then don't do anything. DOS directory
+ * entries that describe a directory do not ever get
+ * updated. This is the way DOS treats them.
*/
- if ((dep->de_flag & DE_UPDATE) == 0 ||
+ if ((dep->de_flag & (DE_MODIFIED | DE_UPDATE)) == 0 ||
vp->v_mount->mnt_flag & MNT_RDONLY ||
dep->de_Attributes & ATTR_DIRECTORY ||
dep->de_refcnt <= 0)
@@ -347,11 +348,16 @@ deupdat(dep, tp, waitfor)
return error;
/*
- * Put the passed in time into the directory entry.
+ * If the mtime is to be updated, put the passed in time into the
+ * directory entry.
*/
- TIMEVAL_TO_TIMESPEC(&time, &ts);
- unix2dostime(&ts, &dep->de_Date, &dep->de_Time);
- dep->de_flag &= ~DE_UPDATE;
+ if (dep->de_flag & DE_UPDATE)
+ unix2dostime(tp, &dep->de_Date, &dep->de_Time);
+
+ /*
+ * The mtime is now up to date. The denode will be unmodifed soon.
+ */
+ dep->de_flag &= ~(DE_MODIFIED | DE_UPDATE);
/*
* Copy the directory entry out of the denode into the cluster it
diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c
index 2e3829600e3d..742325d8b96a 100644
--- a/sys/msdosfs/msdosfs_fat.c
+++ b/sys/msdosfs/msdosfs_fat.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_fat.c,v 1.2 1994/09/27 20:42:46 phk Exp $ */
+/* $Id: msdosfs_fat.c,v 1.3 1994/10/10 07:57:33 phk Exp $ */
/* $NetBSD: msdosfs_fat.c,v 1.12 1994/08/21 18:44:04 ws Exp $ */
/*-
@@ -361,7 +361,7 @@ updatefats(pmp, bp, fatbn)
* Where n is even. m = n + (n >> 2)
*
*/
-extern __inline void
+static inline void
usemap_alloc(pmp, cn)
struct msdosfsmount *pmp;
u_long cn;
@@ -371,7 +371,7 @@ usemap_alloc(pmp, cn)
pmp->pm_freeclustercount--;
}
-extern __inline void
+static inline void
usemap_free(pmp, cn)
struct msdosfsmount *pmp;
u_long cn;
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 8f270762aac8..4a765b98359b 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.4 1994/09/27 20:42:54 phk Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.5 1994/10/02 17:48:21 phk Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.19 1994/08/21 18:44:10 ws Exp $ */
/*-
@@ -634,7 +634,7 @@ loop:
if (VOP_ISLOCKED(vp)) /* file is busy */
continue;
dep = VTODE(vp);
- if ((dep->de_flag & DE_UPDATE) == 0 &&
+ if ((dep->de_flag & (DE_MODIFIED | DE_UPDATE)) == 0 &&
vp->v_dirtyblkhd.lh_first == NULL)
continue;
if (vget(vp, 1)) /* not there anymore? */
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index 1203caee0fba..35c96f525b23 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vnops.c,v 1.8 1994/11/01 21:14:45 jkh Exp $ */
+/* $Id: msdosfs_vnops.c,v 1.9 1994/11/29 23:39:15 ache Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
/*-
@@ -197,12 +197,9 @@ msdosfs_close(ap)
{
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
- struct timespec ts;
- if (vp->v_usecount > 1 && !(dep->de_flag & DE_LOCKED)) {
- TIMEVAL_TO_TIMESPEC(&time, &ts);
- DE_TIMES(dep, &ts);
- }
+ if (vp->v_usecount > 1 && !(dep->de_flag & DE_LOCKED))
+ DE_TIMES(dep, &time);
return 0;
}
@@ -296,10 +293,8 @@ msdosfs_getattr(ap)
u_int cn;
struct denode *dep = VTODE(ap->a_vp);
struct vattr *vap = ap->a_vap;
- struct timespec ts;
- TIMEVAL_TO_TIMESPEC(&time, &ts);
- DE_TIMES(dep, &ts);
+ DE_TIMES(dep, &time);
vap->va_fsid = dep->de_dev;
/*
* The following computation of the fileid must be the same as that
@@ -327,10 +322,12 @@ msdosfs_getattr(ap)
vap->va_size = dep->de_FileSize;
dos2unixtime(dep->de_Date, dep->de_Time, &vap->va_atime);
vap->va_mtime = vap->va_atime;
+#if 0
#ifndef MSDOSFS_NODIRMOD
if (vap->va_mode & S_IFDIR)
TIMEVAL_TO_TIMESPEC(&time, &vap->va_mtime);
#endif
+#endif
vap->va_ctime = vap->va_atime;
vap->va_flags = dep->de_flag;
vap->va_gen = 0;
@@ -406,7 +403,7 @@ msdosfs_setattr(ap)
dep->de_Attributes &= ~ATTR_READONLY;
else
dep->de_Attributes |= ATTR_READONLY;
- dep->de_flag |= DE_UPDATE;
+ dep->de_flag |= DE_MODIFIED;
}
if (vap->va_flags != VNOVAL) {
@@ -419,7 +416,7 @@ msdosfs_setattr(ap)
dep->de_flag &= 0xffff0000;
dep->de_flag |= (vap->va_flags & 0xffff);
}
- dep->de_flag |= DE_UPDATE;
+ dep->de_flag |= DE_MODIFIED;
}
return error;
}
@@ -545,7 +542,6 @@ msdosfs_write(ap)
struct ucred *cred = ap->a_cred;
struct timespec ts;
- TIMEVAL_TO_TIMESPEC(&time, &ts);
#ifdef MSDOSFS_DEBUG
printf("msdosfs_write(vp %08x, uio %08x, ioflag %08x, cred %08x\n",
vp, uio, ioflag, cred);
@@ -728,6 +724,7 @@ errexit:
error = 0;
}
} else {
+ TIMEVAL_TO_TIMESPEC(&time, &ts);
error = deupdat(dep, &ts, 1);
}
return error;
@@ -794,8 +791,6 @@ msdosfs_fsync(ap)
struct buf *nbp;
int s;
- TIMEVAL_TO_TIMESPEC(&time, &ts);
-
/*
* Flush all dirty buffers associated with a vnode.
*/
@@ -824,6 +819,7 @@ loop:
}
#endif
splx(s);
+ TIMEVAL_TO_TIMESPEC(&time, &ts);
return deupdat(VTODE(vp), &ts, wait);
}