From febe109a8674b7860935c3059ba0303b01dee9bd Mon Sep 17 00:00:00 2001
From: dt
Date: Sat, 21 Nov 1998 00:20:24 +0000
Subject: Support NT VFAT lower case flags.
PR: 8383
(Mostly) Submitted by: Carl Mascott
---
sys/fs/msdosfs/denode.h | 6 ++++--
sys/fs/msdosfs/direntry.h | 6 ++++--
sys/fs/msdosfs/msdosfs_conv.c | 8 ++++----
sys/fs/msdosfs/msdosfs_denode.c | 3 ++-
sys/fs/msdosfs/msdosfs_vnops.c | 8 ++++++--
5 files changed, 20 insertions(+), 11 deletions(-)
(limited to 'sys/fs')
diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h
index 16220e5..2a1a8ba 100644
--- a/sys/fs/msdosfs/denode.h
+++ b/sys/fs/msdosfs/denode.h
@@ -1,4 +1,4 @@
-/* $Id: denode.h,v 1.15 1998/02/18 09:28:26 jkh Exp $ */
+/* $Id: denode.h,v 1.16 1998/05/17 18:00:42 bde Exp $ */
/* $NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $ */
/*-
@@ -150,6 +150,7 @@ struct denode {
struct msdosfsmount *de_pmp; /* addr of our mount struct */
u_char de_Name[12]; /* name, from DOS directory entry */
u_char de_Attributes; /* attributes, from directory entry */
+ u_char de_LowerCase; /* NT VFAT lower case flags */
u_char de_CHun; /* Hundredth of second of CTime*/
u_short de_CTime; /* creation time */
u_short de_CDate; /* creation date */
@@ -182,6 +183,7 @@ struct denode {
#define DE_INTERNALIZE(dep, dp) \
(bcopy((dp)->deName, (dep)->de_Name, 11), \
(dep)->de_Attributes = (dp)->deAttributes, \
+ (dep)->de_LowerCase = (dp)->deLowerCase, \
(dep)->de_CHun = (dp)->deCHundredth, \
(dep)->de_CTime = getushort((dp)->deCTime), \
(dep)->de_CDate = getushort((dp)->deCDate), \
@@ -196,8 +198,8 @@ struct denode {
putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)
#define DE_EXTERNALIZE(dp, dep) \
(bcopy((dep)->de_Name, (dp)->deName, 11), \
- bzero((dp)->deReserved, 10), \
(dp)->deAttributes = (dep)->de_Attributes, \
+ (dp)->deLowerCase = (dep)->de_LowerCase, \
(dp)->deCHundredth = (dep)->de_CHun, \
putushort((dp)->deCTime, (dep)->de_CTime), \
putushort((dp)->deCDate, (dep)->de_CDate), \
diff --git a/sys/fs/msdosfs/direntry.h b/sys/fs/msdosfs/direntry.h
index c0db68c..796fe78 100644
--- a/sys/fs/msdosfs/direntry.h
+++ b/sys/fs/msdosfs/direntry.h
@@ -1,4 +1,4 @@
-/* $Id: direntry.h,v 1.11 1998/02/24 14:13:08 ache Exp $ */
+/* $Id: direntry.h,v 1.12 1998/02/26 06:45:42 msmith Exp $ */
/* $NetBSD: direntry.h,v 1.14 1997/11/17 15:36:32 ws Exp $ */
/*-
@@ -65,7 +65,9 @@ struct direntry {
#define ATTR_VOLUME 0x08 /* entry is a volume label */
#define ATTR_DIRECTORY 0x10 /* entry is a directory name */
#define ATTR_ARCHIVE 0x20 /* file is new or modified */
- u_int8_t deReserved[1]; /* reserved */
+ u_int8_t deLowerCase; /* NT VFAT lower case flags */
+#define LCASE_BASE 0x08 /* filename base in lower case */
+#define LCASE_EXT 0x10 /* filename extension in lower case */
u_int8_t deCHundredth; /* hundredth of seconds in CTime */
u_int8_t deCTime[2]; /* create time */
u_int8_t deCDate[2]; /* create date */
diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c
index 6c39544..2c792eb 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.26 1998/04/15 17:46:37 bde Exp $ */
+/* $Id: msdosfs_conv.c,v 1.27 1998/05/17 21:18:08 dt Exp $ */
/* $NetBSD: msdosfs_conv.c,v 1.25 1997/11/17 15:36:40 ws Exp $ */
/*-
@@ -418,7 +418,7 @@ dos2unixfn(dn, un, lower, d2u_loaded, d2u, ul_loaded, ul)
else
c = d2u_loaded && (*dn & 0x80) ? d2u[*dn & 0x7f] :
dos2unix[*dn];
- *un++ = lower ? (ul_loaded && (c & 0x80) ?
+ *un++ = (lower & LCASE_BASE) ? (ul_loaded && (c & 0x80) ?
ul[c & 0x7f] : u2l[c]) : c;
dn++;
@@ -429,7 +429,7 @@ dos2unixfn(dn, un, lower, d2u_loaded, d2u, ul_loaded, ul)
c = d2u_loaded && (*dn & 0x80) ? d2u[*dn & 0x7f] :
dos2unix[*dn];
dn++;
- *un++ = lower ? (ul_loaded && (c & 0x80) ?
+ *un++ = (lower & LCASE_BASE) ? (ul_loaded && (c & 0x80) ?
ul[c & 0x7f] : u2l[c]) : c;
thislong++;
}
@@ -446,7 +446,7 @@ dos2unixfn(dn, un, lower, d2u_loaded, d2u, ul_loaded, ul)
c = d2u_loaded && (*dn & 0x80) ? d2u[*dn & 0x7f] :
dos2unix[*dn];
dn++;
- *un++ = lower ? (ul_loaded && (c & 0x80) ?
+ *un++ = (lower & LCASE_EXT) ? (ul_loaded && (c & 0x80) ?
ul[c & 0x7f] : u2l[c]) : c;
thislong++;
}
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c
index 3c10763..cbbecb3 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.40 1998/10/29 09:29:17 peter Exp $ */
+/* $Id: msdosfs_denode.c,v 1.41 1998/11/10 09:16:29 peter Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */
/*-
@@ -291,6 +291,7 @@ deget(pmp, dirclust, diroffset, depp)
nvp->v_flag |= VROOT; /* should be further down XXX */
ldep->de_Attributes = ATTR_DIRECTORY;
+ ldep->de_LowerCase = 0;
if (FAT32(pmp))
ldep->de_StartCluster = pmp->pm_rootdirblk;
/* de_FileSize will be filled in further down */
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index f68e1bb..d95a7a4 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.76 1998/09/13 15:39:01 dt Exp $ */
+/* $Id: msdosfs_vnops.c,v 1.77 1998/10/31 15:31:24 peter Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */
/*-
@@ -174,6 +174,7 @@ msdosfs_create(ap)
ndirent.de_Attributes = (ap->a_vap->va_mode & VWRITE) ?
ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY;
+ ndirent.de_LowerCase = 0;
ndirent.de_StartCluster = 0;
ndirent.de_FileSize = 0;
ndirent.de_dev = pdep->de_dev;
@@ -1402,6 +1403,7 @@ msdosfs_mkdir(ap)
goto bad;
ndirent.de_Attributes = ATTR_DIRECTORY;
+ ndirent.de_LowerCase = 0;
ndirent.de_StartCluster = newcluster;
ndirent.de_FileSize = 0;
ndirent.de_dev = pdep->de_dev;
@@ -1714,7 +1716,9 @@ msdosfs_readdir(ap)
if (chksum != winChksum(dentp->deName))
dirbuf.d_namlen = dos2unixfn(dentp->deName,
(u_char *)dirbuf.d_name,
- pmp->pm_flags & MSDOSFSMNT_SHORTNAME,
+ dentp->deLowerCase |
+ ((pmp->pm_flags & MSDOSFSMNT_SHORTNAME) ?
+ (LCASE_BASE | LCASE_EXT) : 0),
pmp->pm_flags & MSDOSFSMNT_U2WTABLE,
pmp->pm_d2u,
pmp->pm_flags & MSDOSFSMNT_ULTABLE,
--
cgit v1.1