diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
| commit | 76b5366091f76c9bc73570149ef5055648fc2c39 (patch) | |
| tree | 590d020e0f2a5bea6e09d66d951a674443b21d67 /sys/msdosfs | |
| parent | 4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff) | |
Diffstat (limited to 'sys/msdosfs')
| -rw-r--r-- | sys/msdosfs/denode.h | 52 | ||||
| -rw-r--r-- | sys/msdosfs/direntry.h | 6 | ||||
| -rw-r--r-- | sys/msdosfs/msdosfs_conv.c | 8 | ||||
| -rw-r--r-- | sys/msdosfs/msdosfs_denode.c | 22 | ||||
| -rw-r--r-- | sys/msdosfs/msdosfs_lookup.c | 16 | ||||
| -rw-r--r-- | sys/msdosfs/msdosfs_vfsops.c | 15 | ||||
| -rw-r--r-- | sys/msdosfs/msdosfs_vnops.c | 20 |
7 files changed, 60 insertions, 79 deletions
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h index ba2ef8c65dab1..16220e54f4ef2 100644 --- a/sys/msdosfs/denode.h +++ b/sys/msdosfs/denode.h @@ -1,4 +1,4 @@ -/* $Id: denode.h,v 1.17 1998/11/21 00:20:24 dt Exp $ */ +/* $Id: denode.h,v 1.15 1998/02/18 09:28:26 jkh Exp $ */ /* $NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $ */ /*- @@ -150,7 +150,6 @@ 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 */ @@ -183,7 +182,6 @@ 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), \ @@ -194,10 +192,12 @@ 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), \ + 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), \ @@ -207,7 +207,7 @@ struct denode { putushort((dp)->deStartCluster, (dep)->de_StartCluster), \ putulong((dp)->deFileSize, \ ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ - putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) + (FAT32((dep)->de_pmp) ? DE_EXTERNALIZE32((dp), (dep)) : 0)) #define de_forw de_chain[0] #define de_back de_chain[1] @@ -217,33 +217,21 @@ struct denode { #define VTODE(vp) ((struct denode *)(vp)->v_data) #define DETOV(de) ((de)->de_vnode) -#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); +#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); \ + } /* * This overlays the fid structure (see mount.h) diff --git a/sys/msdosfs/direntry.h b/sys/msdosfs/direntry.h index 796fe78131c8e..c0db68c469333 100644 --- a/sys/msdosfs/direntry.h +++ b/sys/msdosfs/direntry.h @@ -1,4 +1,4 @@ -/* $Id: direntry.h,v 1.12 1998/02/26 06:45:42 msmith Exp $ */ +/* $Id: direntry.h,v 1.11 1998/02/24 14:13:08 ache Exp $ */ /* $NetBSD: direntry.h,v 1.14 1997/11/17 15:36:32 ws Exp $ */ /*- @@ -65,9 +65,7 @@ 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 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 deReserved[1]; /* reserved */ 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/msdosfs/msdosfs_conv.c b/sys/msdosfs/msdosfs_conv.c index 2c792ebf89bbb..6c39544cc5ae1 100644 --- a/sys/msdosfs/msdosfs_conv.c +++ b/sys/msdosfs/msdosfs_conv.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_conv.c,v 1.27 1998/05/17 21:18:08 dt Exp $ */ +/* $Id: msdosfs_conv.c,v 1.26 1998/04/15 17:46:37 bde 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 & LCASE_BASE) ? (ul_loaded && (c & 0x80) ? + *un++ = lower ? (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 & LCASE_BASE) ? (ul_loaded && (c & 0x80) ? + *un++ = lower ? (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 & LCASE_EXT) ? (ul_loaded && (c & 0x80) ? + *un++ = lower ? (ul_loaded && (c & 0x80) ? ul[c & 0x7f] : u2l[c]) : c; thislong++; } diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index 74be5c4695a55..63b878ab5a818 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.43 1998/12/07 21:58:34 archie Exp $ */ +/* $Id: msdosfs_denode.c,v 1.38 1998/05/17 18:09:28 bde Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ /*- @@ -50,7 +50,6 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/kernel.h> #include <sys/mount.h> #include <sys/malloc.h> #include <sys/proc.h> @@ -72,9 +71,7 @@ static struct denode **dehashtbl; static u_long dehash; /* size of hash table - 1 */ #define DEHASH(dev, dcl, doff) (dehashtbl[((dev) + (dcl) + (doff) / \ sizeof(struct direntry)) & dehash]) -#ifndef NULL_SIMPLELOCKS static struct simplelock dehash_slock; -#endif union _qcvt { quad_t qcvt; @@ -293,7 +290,6 @@ 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 */ @@ -412,6 +408,7 @@ detrunc(dep, length, flags, cred, p) { int error; int allerror; + int vflags; u_long eofentry; u_long chaintofree; daddr_t bn; @@ -419,6 +416,7 @@ detrunc(dep, length, flags, cred, p) int isadir = dep->de_Attributes & ATTR_DIRECTORY; struct buf *bp; struct msdosfsmount *pmp = dep->de_pmp; + struct timespec ts; #ifdef MSDOSFS_DEBUG printf("detrunc(): file %s, length %lu, flags %x\n", dep->de_Name, length, flags); @@ -509,14 +507,10 @@ detrunc(dep, length, flags, cred, p) dep->de_FileSize = length; if (!isadir) dep->de_flag |= DE_UPDATE|DE_MODIFIED; - allerror = vtruncbuf(DETOV(dep), cred, p, length, pmp->pm_bpcluster); -#ifdef MSDOSFS_DEBUG - if (allerror) - printf("detrunc(): vtruncbuf error %d\n", allerror); -#endif - error = deupdat(dep, 1); - if (error && (allerror == 0)) - allerror = error; + vflags = (length > 0 ? V_SAVE : 0) | V_SAVEMETA; + vinvalbuf(DETOV(dep), vflags, cred, p, 0, 0); + vnode_pager_setsize(DETOV(dep), length); + allerror = deupdat(dep, 1); #ifdef MSDOSFS_DEBUG printf("detrunc(): allerror %d, eofentry %lu\n", allerror, eofentry); @@ -561,6 +555,7 @@ deextend(dep, length, cred) struct msdosfsmount *pmp = dep->de_pmp; u_long count; int error; + struct timespec ts; /* * The root of a DOS filesystem cannot be extended. @@ -666,6 +661,7 @@ msdosfs_inactive(ap) struct denode *dep = VTODE(vp); struct proc *p = ap->a_p; int error = 0; + struct timespec ts; #ifdef MSDOSFS_DEBUG printf("msdosfs_inactive(): dep %p, de_Name[0] %x\n", dep, dep->de_Name[0]); diff --git a/sys/msdosfs/msdosfs_lookup.c b/sys/msdosfs/msdosfs_lookup.c index 87de1f23eba37..4827201100b72 100644 --- a/sys/msdosfs/msdosfs_lookup.c +++ b/sys/msdosfs/msdosfs_lookup.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_lookup.c,v 1.27 1998/12/07 21:58:35 archie Exp $ */ +/* $Id: msdosfs_lookup.c,v 1.25 1998/05/18 10:24:26 dt Exp $ */ /* $NetBSD: msdosfs_lookup.c,v 1.37 1997/11/17 15:36:54 ws Exp $ */ /*- @@ -61,6 +61,9 @@ #include <msdosfs/msdosfsmount.h> #include <msdosfs/fat.h> +static int markdeleted __P((struct msdosfsmount *pmp, u_long dirclust, + u_long diroffset)); + /* * When we search a directory the blocks containing directory entries are * read and examined. The directory entries contain information that would @@ -106,6 +109,7 @@ msdosfs_lookup(ap) struct msdosfsmount *pmp; struct buf *bp = 0; struct direntry *dep = NULL; + struct ucred *cred = cnp->cn_cred; u_char dosfilename[12]; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; @@ -1040,22 +1044,21 @@ findwin95(dep) { struct msdosfsmount *pmp = dep->de_pmp; struct direntry *dentp; - int blsize, win95; + int blsize; u_long cn; daddr_t bn; struct buf *bp; - win95 = 1; /* * Read through the directory looking for Win'95 entries * Note: Error currently handled just as EOF XXX */ for (cn = 0;; cn++) { if (pcbmap(dep, cn, &bn, 0, &blsize)) - return (win95); + return 0; if (bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) { brelse(bp); - return (win95); + return 0; } for (dentp = (struct direntry *)bp->b_data; (char *)dentp < bp->b_data + blsize; @@ -1065,7 +1068,7 @@ findwin95(dep) * Last used entry and not found */ brelse(bp); - return (win95); + return 0; } if (dentp->deName[0] == SLOT_DELETED) { /* @@ -1078,7 +1081,6 @@ findwin95(dep) brelse(bp); return 1; } - win95 = 0; } brelse(bp); } diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index b3a63b55d6135..42798d765e7b2 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_vfsops.c,v 1.38 1998/10/31 15:31:24 peter Exp $ */ +/* $Id: msdosfs_vfsops.c,v 1.35 1998/05/06 05:29:38 msmith Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ /*- @@ -50,7 +50,6 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/conf.h> #include <sys/namei.h> #include <sys/proc.h> #include <sys/kernel.h> @@ -298,8 +297,7 @@ msdosfs_mount(mp, path, data, ndp, p) vrele(devvp); return (ENOTBLK); } - if (major(devvp->v_rdev) >= nblkdev || - bdevsw[major(devvp->v_rdev)] == NULL) { + if (major(devvp->v_rdev) >= nblkdev) { vrele(devvp); return (ENXIO); } @@ -365,7 +363,6 @@ mountmsdosfs(devvp, mp, p, argp) dev_t dev = devvp->v_rdev; #ifndef __FreeBSD__ struct partinfo dpart; - int bsize = 0, dtype = 0, tmp; #endif union bootsector *bsp; struct byte_bpb33 *b33; @@ -373,6 +370,7 @@ mountmsdosfs(devvp, mp, p, argp) struct byte_bpb710 *b710; u_int8_t SecPerClust; int ronly, error; + int bsize = 0, dtype = 0, tmp; /* * Disallow multiple mounts of the same device. @@ -797,8 +795,8 @@ msdosfs_unmount(mp, mntflags, p) vp->v_freelist.tqe_next, vp->v_freelist.tqe_prev, vp->v_mount); printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n", - TAILQ_FIRST(&vp->v_cleanblkhd), - TAILQ_FIRST(&vp->v_dirtyblkhd), + vp->v_cleanblkhd.lh_first, + vp->v_dirtyblkhd.lh_first, vp->v_numoutput, vp->v_type); printf("union %p, tag %d, data[0] %08x, data[1] %08x\n", vp->v_socket, vp->v_tag, @@ -913,7 +911,8 @@ loop: if (vp->v_type == VNON || (dep->de_flag & (DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0 && - (TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY)) { + (vp->v_dirtyblkhd.lh_first == NULL || + waitfor == MNT_LAZY)) { simple_unlock(&vp->v_interlock); continue; } diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index aad4e6ba9f1ed..c8923601b85a0 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_vnops.c,v 1.79 1998/11/29 22:38:57 dt Exp $ */ +/* $Id: msdosfs_vnops.c,v 1.75 1998/07/11 07:45:50 bde Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -174,7 +174,6 @@ 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; @@ -329,6 +328,7 @@ msdosfs_getattr(ap) struct proc *a_p; } */ *ap; { + u_int cn; struct denode *dep = VTODE(ap->a_vp); struct msdosfsmount *pmp = dep->de_pmp; struct vattr *vap = ap->a_vap; @@ -609,10 +609,10 @@ msdosfs_read(ap) return (error); } error = uiomove(bp->b_data + on, (int) n, uio); + if (!isadir) + dep->de_flag |= DE_ACCESS; brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n != 0); - if (!isadir && !(vp->v_mount->mnt_flag & MNT_NOATIME)) - dep->de_flag |= DE_ACCESS; return (error); } @@ -835,8 +835,8 @@ msdosfs_fsync(ap) */ loop: s = splbio(); - for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { - nbp = TAILQ_NEXT(bp, b_vnbufs); + for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) { + nbp = bp->b_vnbufs.le_next; if ((bp->b_flags & B_BUSY)) continue; if ((bp->b_flags & B_DELWRI) == 0) @@ -852,7 +852,7 @@ loop: (void) tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "msdosfsn", 0); } #ifdef DIAGNOSTIC - if (!TAILQ_EMPTY(&vp->v_dirtyblkhd)) { + if (vp->v_dirtyblkhd.lh_first) { vprint("msdosfs_fsync: dirty", vp); goto loop; } @@ -1402,7 +1402,6 @@ 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; @@ -1715,9 +1714,7 @@ msdosfs_readdir(ap) if (chksum != winChksum(dentp->deName)) dirbuf.d_namlen = dos2unixfn(dentp->deName, (u_char *)dirbuf.d_name, - dentp->deLowerCase | - ((pmp->pm_flags & MSDOSFSMNT_SHORTNAME) ? - (LCASE_BASE | LCASE_EXT) : 0), + pmp->pm_flags & MSDOSFSMNT_SHORTNAME, pmp->pm_flags & MSDOSFSMNT_U2WTABLE, pmp->pm_d2u, pmp->pm_flags & MSDOSFSMNT_ULTABLE, @@ -1797,6 +1794,7 @@ msdosfs_bmap(ap) } */ *ap; { struct denode *dep = VTODE(ap->a_vp); + struct msdosfsmount *pmp = dep->de_pmp; if (ap->a_vpp != NULL) *ap->a_vpp = dep->de_devvp; |
