diff options
author | dt <dt@FreeBSD.org> | 1999-01-02 13:26:29 +0000 |
---|---|---|
committer | dt <dt@FreeBSD.org> | 1999-01-02 13:26:29 +0000 |
commit | eed83909759d2418fc4377866f473adba42a4e83 (patch) | |
tree | f93272d72f9811240608092ce460751bba387a2d /sys/msdosfs | |
parent | 734d13314e6e9f235abcba66a420f81b29606173 (diff) | |
download | FreeBSD-src-eed83909759d2418fc4377866f473adba42a4e83.zip FreeBSD-src-eed83909759d2418fc4377866f473adba42a4e83.tar.gz |
Ensure that deHighClust in direntry always initialized.
Noticed by: Carl Mascott <cmascott@world.std.com>
Don't write access time of a file more than once per day. (Its precision is
1 day anyway). Don't try to write access and creation time in nonwin95 case.
Suggested by: bde (long time ago).
Diffstat (limited to 'sys/msdosfs')
-rw-r--r-- | sys/msdosfs/denode.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h index 2a1a8ba..ba2ef8c 100644 --- a/sys/msdosfs/denode.h +++ b/sys/msdosfs/denode.h @@ -1,4 +1,4 @@ -/* $Id: denode.h,v 1.16 1998/05/17 18:00:42 bde Exp $ */ +/* $Id: denode.h,v 1.17 1998/11/21 00:20:24 dt Exp $ */ /* $NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $ */ /*- @@ -194,8 +194,6 @@ struct denode { (dep)->de_FileSize = getulong((dp)->deFileSize), \ (FAT32((dep)->de_pmp) ? DE_INTERNALIZE32((dep), (dp)) : 0)) -#define DE_EXTERNALIZE32(dp, dep) \ - putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16) #define DE_EXTERNALIZE(dp, dep) \ (bcopy((dep)->de_Name, (dp)->deName, 11), \ (dp)->deAttributes = (dep)->de_Attributes, \ @@ -209,7 +207,7 @@ struct denode { putushort((dp)->deStartCluster, (dep)->de_StartCluster), \ putulong((dp)->deFileSize, \ ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ - (FAT32((dep)->de_pmp) ? DE_EXTERNALIZE32((dp), (dep)) : 0)) + putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) #define de_forw de_chain[0] #define de_back de_chain[1] @@ -219,21 +217,33 @@ struct denode { #define VTODE(vp) ((struct denode *)(vp)->v_data) #define DETOV(de) ((de)->de_vnode) -#define DETIMES(dep, acc, mod, cre) \ - if ((dep)->de_flag & (DE_UPDATE | DE_CREATE | DE_ACCESS)) { \ - (dep)->de_flag |= DE_MODIFIED; \ - if ((dep)->de_flag & DE_UPDATE) { \ - unix2dostime((mod), &(dep)->de_MDate, &(dep)->de_MTime, NULL); \ - (dep)->de_Attributes |= ATTR_ARCHIVE; \ - } \ - if (!((dep)->de_pmp->pm_flags & MSDOSFSMNT_NOWIN95)) { \ - if ((dep)->de_flag & DE_ACCESS) \ - unix2dostime((acc), &(dep)->de_ADate, NULL, NULL); \ - if ((dep)->de_flag & DE_CREATE) \ - unix2dostime((cre), &(dep)->de_CDate, &(dep)->de_CTime, &(dep)->de_CHun); \ - } \ - (dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS); \ - } +#define DETIMES(dep, acc, mod, cre) do { \ + if ((dep)->de_flag & DE_UPDATE) { \ + (dep)->de_flag |= DE_MODIFIED; \ + unix2dostime((mod), &(dep)->de_MDate, &(dep)->de_MTime, \ + NULL); \ + (dep)->de_Attributes |= ATTR_ARCHIVE; \ + } \ + if ((dep)->de_pmp->pm_flags & MSDOSFSMNT_NOWIN95) { \ + (dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS); \ + break; \ + } \ + if ((dep)->de_flag & DE_ACCESS) { \ + u_int16_t adate; \ + \ + unix2dostime((acc), &adate, NULL, NULL); \ + if (adate != (dep)->de_ADate) { \ + (dep)->de_flag |= DE_MODIFIED; \ + (dep)->de_ADate = adate; \ + } \ + } \ + if ((dep)->de_flag & DE_CREATE) { \ + unix2dostime((cre), &(dep)->de_CDate, &(dep)->de_CTime, \ + &(dep)->de_CHun); \ + (dep)->de_flag |= DE_MODIFIED; \ + } \ + (dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS); \ +} while (0); /* * This overlays the fid structure (see mount.h) |