PR4393: additional fixes of format strings for unsigned parameters
PR4394: be more consistent with other MSDOSFS_DEBUG messages PR4395: fix generation numbers as in the PR, and fix short name for e.g. x.aaaa PR4396: easier fix then given in the PR All PRs by Rick Byers. Thanks Rick for pointing these out
This commit is contained in:
parent
8ad67291ce
commit
4e4c231c15
@ -1,18 +1,18 @@
|
||||
/* $NetBSD: bootsect.h,v 1.8 1997/10/17 11:23:29 ws Exp $ */
|
||||
/* $NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
/* $NetBSD: bpb.h,v 1.6 1997/10/17 11:23:35 ws Exp $ */
|
||||
/* $NetBSD: bpb.h,v 1.7 1997/11/17 15:36:24 ws Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: denode.h,v 1.24 1997/10/17 11:23:39 ws Exp $ */
|
||||
/* $NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: direntry.h,v 1.13 1997/10/17 11:23:45 ws Exp $ */
|
||||
/* $NetBSD: direntry.h,v 1.14 1997/11/17 15:36:32 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fat.h,v 1.11 1997/10/17 11:23:49 ws Exp $ */
|
||||
/* $NetBSD: fat.h,v 1.12 1997/11/17 15:36:36 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_conv.c,v 1.24 1997/10/17 11:23:54 ws Exp $ */
|
||||
/* $NetBSD: msdosfs_conv.c,v 1.25 1997/11/17 15:36:40 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
@ -373,7 +373,7 @@ dos2unixfn(dn, un, lower)
|
||||
c = dos2unix[*dn];
|
||||
*un++ = lower ? u2l[c] : c;
|
||||
dn++;
|
||||
|
||||
|
||||
/*
|
||||
* Copy the name portion into the unix filename string.
|
||||
*/
|
||||
@ -383,7 +383,7 @@ dos2unixfn(dn, un, lower)
|
||||
thislong++;
|
||||
}
|
||||
dn += 8 - i;
|
||||
|
||||
|
||||
/*
|
||||
* Now, if there is an extension then put in a period and copy in
|
||||
* the extension.
|
||||
@ -424,7 +424,7 @@ unix2dosfn(un, dn, unlen, gen)
|
||||
int conv = 1;
|
||||
const u_char *cp, *dp, *dp1;
|
||||
u_char gentext[6], *wcp;
|
||||
|
||||
|
||||
/*
|
||||
* Fill the dos filename string with blanks. These are DOS's pad
|
||||
* characters.
|
||||
@ -432,7 +432,7 @@ unix2dosfn(un, dn, unlen, gen)
|
||||
for (i = 0; i < 11; i++)
|
||||
dn[i] = ' ';
|
||||
dn[11] = 0;
|
||||
|
||||
|
||||
/*
|
||||
* The filenames "." and ".." are handled specially, since they
|
||||
* don't follow dos filename rules.
|
||||
@ -455,7 +455,7 @@ unix2dosfn(un, dn, unlen, gen)
|
||||
break;
|
||||
if (i < 0)
|
||||
return 0;
|
||||
|
||||
|
||||
/*
|
||||
* Now find the extension
|
||||
* Note: dot as first char doesn't start extension
|
||||
@ -477,7 +477,7 @@ unix2dosfn(un, dn, unlen, gen)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Now convert it
|
||||
*/
|
||||
@ -523,14 +523,14 @@ unix2dosfn(un, dn, unlen, gen)
|
||||
*/
|
||||
if (!j)
|
||||
dn[0] = '_';
|
||||
|
||||
|
||||
/*
|
||||
* The first character cannot be E5,
|
||||
* because that means a deleted entry
|
||||
*/
|
||||
if (dn[0] == 0xe5)
|
||||
dn[0] = SLOT_E5;
|
||||
|
||||
|
||||
/*
|
||||
* If there wasn't any char dropped,
|
||||
* there is no place for generation numbers
|
||||
@ -540,7 +540,7 @@ unix2dosfn(un, dn, unlen, gen)
|
||||
return 0;
|
||||
return conv;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Now insert the generation number into the filename part
|
||||
*/
|
||||
@ -549,11 +549,12 @@ unix2dosfn(un, dn, unlen, gen)
|
||||
if (gen)
|
||||
return 0;
|
||||
for (i = 8; dn[--i] == ' ';);
|
||||
i++;
|
||||
if (gentext + sizeof(gentext) - wcp + 1 > 8 - i)
|
||||
i = 8 - (gentext + sizeof(gentext) - wcp + 1);
|
||||
dn[i++] = '~';
|
||||
while (wcp < gentext + sizeof(gentext))
|
||||
dn[i] = *wcp++;
|
||||
dn[i++] = *wcp++;
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ -581,7 +582,7 @@ unix2winfn(un, unlen, wep, cnt, chksum)
|
||||
|
||||
un += (cnt - 1) * WIN_CHARS;
|
||||
unlen -= (cnt - 1) * WIN_CHARS;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize winentry to some useful default
|
||||
*/
|
||||
@ -591,7 +592,7 @@ unix2winfn(un, unlen, wep, cnt, chksum)
|
||||
wep->weReserved1 = 0;
|
||||
wep->weChksum = chksum;
|
||||
wep->weReserved2 = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Now convert the filename parts
|
||||
*/
|
||||
@ -637,7 +638,7 @@ winChkName(un, unlen, wep, chksum)
|
||||
{
|
||||
u_int8_t *cp;
|
||||
int i;
|
||||
|
||||
|
||||
/*
|
||||
* First compare checksums
|
||||
*/
|
||||
@ -647,15 +648,17 @@ winChkName(un, unlen, wep, chksum)
|
||||
chksum = -1;
|
||||
if (chksum == -1)
|
||||
return -1;
|
||||
|
||||
|
||||
/*
|
||||
* Offset of this entry
|
||||
*/
|
||||
i = ((wep->weCnt&WIN_CNT) - 1) * WIN_CHARS;
|
||||
un += i;
|
||||
if ((unlen -= i) <= 0)
|
||||
return -1;
|
||||
un += i;
|
||||
|
||||
if ((wep->weCnt&WIN_LAST) && unlen > WIN_CHARS)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Compare the name parts
|
||||
*/
|
||||
@ -706,7 +709,7 @@ win2unixfn(wep, dp, chksum)
|
||||
if ((wep->weCnt&WIN_CNT) > howmany(WIN_MAXLEN, WIN_CHARS)
|
||||
|| !(wep->weCnt&WIN_CNT))
|
||||
return -1;
|
||||
|
||||
|
||||
/*
|
||||
* First compare checksums
|
||||
*/
|
||||
@ -720,13 +723,13 @@ win2unixfn(wep, dp, chksum)
|
||||
chksum = -1;
|
||||
if (chksum == -1)
|
||||
return -1;
|
||||
|
||||
|
||||
/*
|
||||
* Offset of this entry
|
||||
*/
|
||||
i = ((wep->weCnt&WIN_CNT) - 1) * WIN_CHARS;
|
||||
np = (u_int8_t *)dp->d_name + i;
|
||||
|
||||
|
||||
/*
|
||||
* Convert the name parts
|
||||
*/
|
||||
@ -805,7 +808,7 @@ winChksum(name)
|
||||
{
|
||||
int i;
|
||||
u_int8_t s;
|
||||
|
||||
|
||||
for (s = 0, i = 11; --i >= 0; s += *name++)
|
||||
s = (s << 7)|(s >> 1);
|
||||
return s;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_denode.c,v 1.24 1997/11/16 21:47:27 christos Exp $ */
|
||||
/* $NetBSD: msdosfs_denode.c,v 1.25 1997/11/17 15:36:45 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
@ -88,7 +88,7 @@ msdosfs_hashget(dev, dirclust, diroff)
|
||||
u_long diroff;
|
||||
{
|
||||
struct denode *dep;
|
||||
|
||||
|
||||
for (;;)
|
||||
for (dep = dehashtbl[DEHASH(dev, dirclust, diroff)];;
|
||||
dep = dep->de_next) {
|
||||
@ -116,7 +116,7 @@ msdosfs_hashins(dep)
|
||||
struct denode *dep;
|
||||
{
|
||||
struct denode **depp, *deq;
|
||||
|
||||
|
||||
depp = &dehashtbl[DEHASH(dep->de_dev, dep->de_dirclust, dep->de_diroffset)];
|
||||
if ((deq = *depp) != NULL)
|
||||
deq->de_prev = &dep->de_next;
|
||||
@ -141,15 +141,15 @@ msdosfs_hashrem(dep)
|
||||
}
|
||||
|
||||
/*
|
||||
* If deget() succeeds it returns with the gotten denode locked().
|
||||
* If deget() succeeds it returns with the gotten denode locked().
|
||||
*
|
||||
* pmp - address of msdosfsmount structure of the filesystem containing
|
||||
* the denode of interest. The pm_dev field and the address of
|
||||
* the msdosfsmount structure are used.
|
||||
* the msdosfsmount structure are used.
|
||||
* dirclust - which cluster bp contains, if dirclust is 0 (root directory)
|
||||
* diroffset is relative to the beginning of the root directory,
|
||||
* otherwise it is cluster relative.
|
||||
* diroffset - offset past begin of cluster of denode we want
|
||||
* otherwise it is cluster relative.
|
||||
* diroffset - offset past begin of cluster of denode we want
|
||||
* depp - returns the address of the gotten denode.
|
||||
*/
|
||||
int
|
||||
@ -167,7 +167,7 @@ deget(pmp, dirclust, diroffset, depp)
|
||||
struct buf *bp;
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("deget(pmp %p, dirclust %ld, diroffset %lx, depp %p)\n",
|
||||
printf("deget(pmp %p, dirclust %lu, diroffset %lx, depp %p)\n",
|
||||
pmp, dirclust, diroffset, depp);
|
||||
#endif
|
||||
|
||||
@ -183,7 +183,7 @@ deget(pmp, dirclust, diroffset, depp)
|
||||
* the directory entry to compute the hash value. For subdir use
|
||||
* address of "." entry. For root dir (if not FAT32) use cluster
|
||||
* MSDOSFSROOT, offset MSDOSFSROOT_OFS
|
||||
*
|
||||
*
|
||||
* NOTE: The check for de_refcnt > 0 below insures the denode being
|
||||
* examined does not represent an unlinked but still open file.
|
||||
* These files are not to be accessible even when the directory
|
||||
@ -338,7 +338,7 @@ detrunc(dep, length, flags, cred, p)
|
||||
struct msdosfsmount *pmp = dep->de_pmp;
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("detrunc(): file %s, length %ld, flags %d\n", dep->de_Name, length, flags);
|
||||
printf("detrunc(): file %s, length %lu, flags %x\n", dep->de_Name, length, flags);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -430,7 +430,7 @@ detrunc(dep, length, flags, cred, p)
|
||||
vinvalbuf(DETOV(dep), vflags, cred, p, 0, 0);
|
||||
allerror = deupdat(dep, 1);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("detrunc(): allerror %d, eofentry %ld\n",
|
||||
printf("detrunc(): allerror %d, eofentry %lu\n",
|
||||
allerror, eofentry);
|
||||
#endif
|
||||
|
||||
@ -473,7 +473,7 @@ deextend(dep, length, cred)
|
||||
struct msdosfsmount *pmp = dep->de_pmp;
|
||||
u_long count;
|
||||
int error;
|
||||
|
||||
|
||||
/*
|
||||
* The root of a DOS filesystem cannot be extended.
|
||||
*/
|
||||
@ -488,7 +488,7 @@ deextend(dep, length, cred)
|
||||
|
||||
if (length <= dep->de_FileSize)
|
||||
panic("deextend: file too large");
|
||||
|
||||
|
||||
/*
|
||||
* Compute the number of clusters to allocate.
|
||||
*/
|
||||
@ -503,7 +503,7 @@ deextend(dep, length, cred)
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dep->de_FileSize = length;
|
||||
dep->de_flag |= DE_UPDATE|DE_MODIFIED;
|
||||
return (deupdat(dep, 1));
|
||||
@ -541,7 +541,7 @@ msdosfs_reclaim(v)
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct denode *dep = VTODE(vp);
|
||||
extern int prtactive;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_reclaim(): dep %p, file %s, refcnt %ld\n",
|
||||
dep, dep->de_Name, dep->de_refcnt);
|
||||
@ -580,7 +580,7 @@ msdosfs_inactive(v)
|
||||
struct denode *dep = VTODE(vp);
|
||||
int error;
|
||||
extern int prtactive;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_inactive(): dep %p, de_Name[0] %x\n", dep, dep->de_Name[0]);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_fat.c,v 1.27 1997/11/16 21:47:29 christos Exp $ */
|
||||
/* $NetBSD: msdosfs_fat.c,v 1.28 1997/11/17 15:36:49 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
@ -336,7 +336,7 @@ updatefats(pmp, bp, fatbn)
|
||||
struct buf *bpn;
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("updatefats(pmp %p, bp %p, fatbn %ld)\n",
|
||||
printf("updatefats(pmp %p, bp %p, fatbn %lu)\n",
|
||||
pmp, bp, fatbn);
|
||||
#endif
|
||||
|
||||
@ -415,22 +415,22 @@ updatefats(pmp, bp, fatbn)
|
||||
|
||||
/*
|
||||
* Updating entries in 12 bit fats is a pain in the butt.
|
||||
*
|
||||
*
|
||||
* The following picture shows where nibbles go when moving from a 12 bit
|
||||
* cluster number into the appropriate bytes in the FAT.
|
||||
*
|
||||
*
|
||||
* byte m byte m+1 byte m+2
|
||||
* +----+----+ +----+----+ +----+----+
|
||||
* | 0 1 | | 2 3 | | 4 5 | FAT bytes
|
||||
* +----+----+ +----+----+ +----+----+
|
||||
*
|
||||
*
|
||||
* +----+----+----+ +----+----+----+
|
||||
* | 3 0 1 | | 4 5 2 |
|
||||
* +----+----+----+ +----+----+----+
|
||||
* cluster n cluster n+1
|
||||
*
|
||||
*
|
||||
* Where n is even. m = n + (n >> 2)
|
||||
*
|
||||
*
|
||||
*/
|
||||
static __inline void
|
||||
usemap_alloc(pmp, cn)
|
||||
@ -488,10 +488,10 @@ clusterfree(pmp, cluster, oldcnp)
|
||||
* cluster'th entry if this is a get function
|
||||
* newcontents - the new value to be written into the cluster'th element of
|
||||
* the fat if this is a set function.
|
||||
*
|
||||
*
|
||||
* This function can also be used to free a cluster by setting the fat entry
|
||||
* for a cluster to 0.
|
||||
*
|
||||
*
|
||||
* All copies of the fat are updated if this is a set function. NOTE: If
|
||||
* fatentry() marks a cluster as free it does not update the inusemap in
|
||||
* the msdosfsmount structure. This is left to the caller.
|
||||
@ -510,7 +510,7 @@ fatentry(function, pmp, cn, oldcontents, newcontents)
|
||||
struct buf *bp;
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("fatentry(func %d, pmp %p, clust %ld, oldcon %p, newcon %ld)\n",
|
||||
printf("fatentry(func %d, pmp %p, clust %lu, oldcon %p, newcon %lx)\n",
|
||||
function, pmp, cn, oldcontents, newcontents);
|
||||
#endif
|
||||
|
||||
@ -545,7 +545,7 @@ fatentry(function, pmp, cn, oldcontents, newcontents)
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
||||
if (function & FAT_GET) {
|
||||
if (FAT32(pmp))
|
||||
readcn = getulong(&bp->b_data[bo]);
|
||||
@ -613,9 +613,9 @@ fatchain(pmp, start, count, fillwith)
|
||||
int error;
|
||||
u_long bn, bo, bsize, byteoffset, readcn, newc;
|
||||
struct buf *bp;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("fatchain(pmp %p, start %ld, count %ld, fillwith %ld)\n",
|
||||
printf("fatchain(pmp %p, start %lu, count %lu, fillwith %lx)\n",
|
||||
pmp, start, count, fillwith);
|
||||
#endif
|
||||
/*
|
||||
@ -623,7 +623,7 @@ fatchain(pmp, start, count, fillwith)
|
||||
*/
|
||||
if (start < CLUST_FIRST || start + count - 1 > pmp->pm_maxcluster)
|
||||
return (EINVAL);
|
||||
|
||||
|
||||
while (count > 0) {
|
||||
byteoffset = FATOFS(pmp, start);
|
||||
fatblock(pmp, byteoffset, &bn, &bsize, &bo);
|
||||
@ -687,7 +687,7 @@ chainlength(pmp, start, count)
|
||||
u_long idx, max_idx;
|
||||
u_int map;
|
||||
u_long len;
|
||||
|
||||
|
||||
max_idx = pmp->pm_maxcluster / N_INUSEBITS;
|
||||
idx = start / N_INUSEBITS;
|
||||
start %= N_INUSEBITS;
|
||||
@ -740,7 +740,7 @@ chainalloc(pmp, start, count, fillwith, retcluster, got)
|
||||
if ((error = fatchain(pmp, start, count, fillwith)) != 0)
|
||||
return (error);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("clusteralloc(): allocated cluster chain at %ld (%ld clusters)\n",
|
||||
printf("clusteralloc(): allocated cluster chain at %lu (%lu clusters)\n",
|
||||
start, count);
|
||||
#endif
|
||||
if (retcluster)
|
||||
@ -774,9 +774,9 @@ clusteralloc(pmp, start, count, fillwith, retcluster, got)
|
||||
u_long len, newst, foundl, cn, l;
|
||||
u_long foundcn = 0; /* XXX: foundcn could be used unititialized */
|
||||
u_int map;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("clusteralloc(): find %ld clusters\n",count);
|
||||
printf("clusteralloc(): find %lu clusters\n",count);
|
||||
#endif
|
||||
if (start) {
|
||||
if ((len = chainlength(pmp, start, count)) >= count)
|
||||
@ -786,19 +786,19 @@ clusteralloc(pmp, start, count, fillwith, retcluster, got)
|
||||
* This is a new file, initialize start
|
||||
*/
|
||||
struct timeval tv;
|
||||
|
||||
|
||||
microtime(&tv);
|
||||
start = (tv.tv_usec >> 10) | tv.tv_usec;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Start at a (pseudo) random place to maximize cluster runs
|
||||
* under multiple writers.
|
||||
*/
|
||||
newst = (start * 1103515245 + 12345) % (pmp->pm_maxcluster + 1);
|
||||
foundl = 0;
|
||||
|
||||
|
||||
for (cn = newst; cn <= pmp->pm_maxcluster;) {
|
||||
idx = cn / N_INUSEBITS;
|
||||
map = pmp->pm_inusemap[idx];
|
||||
@ -992,7 +992,7 @@ extendfile(dep, count, bpp, ncp, flags)
|
||||
u_long cn, got;
|
||||
struct msdosfsmount *pmp = dep->de_pmp;
|
||||
struct buf *bp;
|
||||
|
||||
|
||||
/*
|
||||
* Don't try to extend the root directory
|
||||
*/
|
||||
@ -1033,9 +1033,9 @@ extendfile(dep, count, bpp, ncp, flags)
|
||||
error = clusteralloc(pmp, cn, count, CLUST_EOFE, &cn, &got);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
||||
count -= got;
|
||||
|
||||
|
||||
/*
|
||||
* Give them the filesystem relative cluster number if they want
|
||||
* it.
|
||||
@ -1044,7 +1044,7 @@ extendfile(dep, count, bpp, ncp, flags)
|
||||
*ncp = cn;
|
||||
ncp = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (dep->de_StartCluster == 0) {
|
||||
dep->de_StartCluster = cn;
|
||||
frcn = 0;
|
||||
@ -1058,13 +1058,13 @@ extendfile(dep, count, bpp, ncp, flags)
|
||||
}
|
||||
frcn = dep->de_fc[FC_LASTFC].fc_frcn + 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the "last cluster of the file" entry in the denode's fat
|
||||
* cache.
|
||||
*/
|
||||
fc_setcache(dep, FC_LASTFC, frcn + got - 1, cn + got - 1);
|
||||
|
||||
|
||||
if (flags & DE_CLEAR) {
|
||||
while (got-- > 0) {
|
||||
/*
|
||||
@ -1095,6 +1095,6 @@ extendfile(dep, count, bpp, ncp, flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_lookup.c,v 1.36 1997/11/16 21:47:32 christos Exp $ */
|
||||
/* $NetBSD: msdosfs_lookup.c,v 1.37 1997/11/17 15:36:54 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
@ -113,7 +113,7 @@ msdosfs_lookup(v)
|
||||
int wincnt = 1;
|
||||
int chksum = -1;
|
||||
int olddos = 1;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_lookup(): looking for %s\n", cnp->cn_nameptr);
|
||||
#endif
|
||||
@ -237,7 +237,7 @@ msdosfs_lookup(v)
|
||||
if ((nameiop == CREATE || nameiop == RENAME) &&
|
||||
(flags & ISLASTCN))
|
||||
slotcount = 0;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_lookup(): dos version of filename %s, length %ld\n",
|
||||
dosfilename, cnp->cn_namelen);
|
||||
@ -285,7 +285,7 @@ msdosfs_lookup(v)
|
||||
* Drop memory of previous long matches
|
||||
*/
|
||||
chksum = -1;
|
||||
|
||||
|
||||
if (slotcount < wincnt) {
|
||||
slotcount++;
|
||||
slotoffset = diroff;
|
||||
@ -301,7 +301,7 @@ msdosfs_lookup(v)
|
||||
*/
|
||||
if (slotcount < wincnt)
|
||||
slotcount = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Check for Win95 long filename entry
|
||||
*/
|
||||
@ -315,7 +315,7 @@ msdosfs_lookup(v)
|
||||
chksum);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ignore volume labels (anywhere, not just
|
||||
* the root directory).
|
||||
@ -344,7 +344,7 @@ msdosfs_lookup(v)
|
||||
*/
|
||||
dp->de_fndoffset = diroff;
|
||||
dp->de_fndcnt = 0; /* unused anyway */
|
||||
|
||||
|
||||
goto found;
|
||||
}
|
||||
} /* for (blkoff = 0; .... */
|
||||
@ -371,7 +371,7 @@ notfound:;
|
||||
}
|
||||
if (wincnt > slotcount)
|
||||
slotoffset += sizeof(struct direntry) * (wincnt - slotcount);
|
||||
|
||||
|
||||
/*
|
||||
* If we get here we didn't find the entry we were looking for. But
|
||||
* that's ok if we are creating or renaming and are at the end of
|
||||
@ -457,7 +457,7 @@ found:;
|
||||
* in a deadlock.
|
||||
*/
|
||||
brelse(bp);
|
||||
|
||||
|
||||
foundroot:;
|
||||
/*
|
||||
* If we entered at foundroot, then we are looking for the . or ..
|
||||
@ -608,7 +608,7 @@ createde(dep, ddep, depp, cnp)
|
||||
struct buf *bp;
|
||||
daddr_t bn;
|
||||
int blsize;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("createde(dep %p, ddep %p, depp %p, cnp %p)\n",
|
||||
dep, ddep, depp, cnp);
|
||||
@ -636,7 +636,7 @@ createde(dep, ddep, depp, cnp)
|
||||
*/
|
||||
ddep->de_FileSize += de_cn2off(pmp, dirclust);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We just read in the cluster with space. Copy the new directory
|
||||
* entry in. Then write it to disk. NOTE: DOS directories
|
||||
@ -654,7 +654,7 @@ createde(dep, ddep, depp, cnp)
|
||||
return error;
|
||||
}
|
||||
ndep = bptoep(pmp, bp, ddep->de_fndoffset);
|
||||
|
||||
|
||||
DE_EXTERNALIZE(ndep, dep);
|
||||
|
||||
/*
|
||||
@ -665,7 +665,7 @@ createde(dep, ddep, depp, cnp)
|
||||
const u_char *un = (const u_char *)cnp->cn_nameptr;
|
||||
int unlen = cnp->cn_namelen;
|
||||
int cnt = 1;
|
||||
|
||||
|
||||
while (--ddep->de_fndcnt >= 0) {
|
||||
if (!(ddep->de_fndoffset & pmp->pm_crbomask)) {
|
||||
if ((error = bwrite(bp)) != 0)
|
||||
@ -694,7 +694,7 @@ createde(dep, ddep, depp, cnp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((error = bwrite(bp)) != 0)
|
||||
return error;
|
||||
|
||||
@ -713,7 +713,7 @@ createde(dep, ddep, depp, cnp)
|
||||
}
|
||||
return deget(pmp, dirclust, diroffset, depp);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -951,7 +951,7 @@ removede(pdep, dep)
|
||||
int blsize;
|
||||
struct msdosfsmount *pmp = pdep->de_pmp;
|
||||
u_long offset = pdep->de_fndoffset;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("removede(): filename %s, dep %p, offset %08lx\n",
|
||||
dep->de_Name, dep, offset);
|
||||
@ -1028,7 +1028,7 @@ uniqdosname(dep, cnp, cp)
|
||||
if (!unix2dosfn((const u_char *)cnp->cn_nameptr, cp,
|
||||
cnp->cn_namelen, gen))
|
||||
return gen == 1 ? EINVAL : EEXIST;
|
||||
|
||||
|
||||
/*
|
||||
* Now look for a dir entry with this exact name
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_vfsops.c,v 1.50 1997/11/16 21:50:10 christos Exp $ */
|
||||
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
@ -126,13 +126,13 @@ update_mp(mp, argp)
|
||||
*/
|
||||
if (pmp->pm_flags & MSDOSFSMNT_GEMDOSFS)
|
||||
pmp->pm_flags |= MSDOSFSMNT_NOWIN95;
|
||||
|
||||
|
||||
if (pmp->pm_flags & MSDOSFSMNT_NOWIN95)
|
||||
pmp->pm_flags |= MSDOSFSMNT_SHORTNAME;
|
||||
else if (!(pmp->pm_flags &
|
||||
(MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) {
|
||||
struct vnode *rootvp;
|
||||
|
||||
|
||||
/*
|
||||
* Try to divine whether to support Win'95 long filenames
|
||||
*/
|
||||
@ -211,9 +211,9 @@ msdosfs_mountroot()
|
||||
}
|
||||
|
||||
/*
|
||||
* mp - path - addr in user space of mount point (ie /usr or whatever)
|
||||
* mp - path - addr in user space of mount point (ie /usr or whatever)
|
||||
* data - addr in user space of mount params including the name of the block
|
||||
* special file to treat as a filesystem.
|
||||
* special file to treat as a filesystem.
|
||||
*/
|
||||
int
|
||||
msdosfs_mount(mp, path, data, ndp, p)
|
||||
@ -321,9 +321,12 @@ msdosfs_mount(mp, path, data, ndp, p)
|
||||
}
|
||||
VOP_UNLOCK(devvp);
|
||||
}
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0)
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
error = msdosfs_mountfs(devvp, mp, p, &args);
|
||||
else {
|
||||
#ifdef MSDOSFS_DEBUG /* only needed for the printf below */
|
||||
pmp = VFSTOMSDOSFS(mp);
|
||||
#endif
|
||||
} else {
|
||||
if (devvp != pmp->pm_devvp)
|
||||
error = EINVAL; /* needs translation */
|
||||
else
|
||||
@ -345,7 +348,7 @@ msdosfs_mount(mp, path, data, ndp, p)
|
||||
&size);
|
||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_mount(): mp %p, pmp %p\n", mp, pmp);
|
||||
printf("msdosfs_mount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
@ -642,7 +645,7 @@ msdosfs_mountfs(devvp, mp, p, argp)
|
||||
brelse(bp);
|
||||
bp = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check and validate (or perhaps invalidate?) the fsinfo structure? XXX
|
||||
*/
|
||||
@ -746,24 +749,26 @@ msdosfs_unmount(mp, mntflags, p)
|
||||
pmp = VFSTOMSDOSFS(mp);
|
||||
pmp->pm_devvp->v_specflags &= ~SI_MOUNTEDON;
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_umount(): just before calling VOP_CLOSE()\n");
|
||||
printf("flag %08lx, usecount %d, writecount %d, holdcnt %ld\n",
|
||||
pmp->pm_devvp->v_flag, pmp->pm_devvp->v_usecount,
|
||||
pmp->pm_devvp->v_writecount, pmp->pm_devvp->v_holdcnt);
|
||||
printf("lastr %d, id %ld, mount %p, op %p\n",
|
||||
pmp->pm_devvp->v_lastr, pmp->pm_devvp->v_id,
|
||||
pmp->pm_devvp->v_mount, pmp->pm_devvp->v_op);
|
||||
/* printf("freef %08x, freeb %08x, mountf %08x, mountb %08x\n",
|
||||
pmp->pm_devvp->v_freef, pmp->pm_devvp->v_freeb,
|
||||
pmp->pm_devvp->v_mountf, pmp->pm_devvp->v_mountb); */
|
||||
printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n",
|
||||
pmp->pm_devvp->v_cleanblkhd.lh_first,
|
||||
pmp->pm_devvp->v_dirtyblkhd.lh_first,
|
||||
pmp->pm_devvp->v_numoutput, pmp->pm_devvp->v_type);
|
||||
printf("union %p, tag %d, data[0] %08x, data[1] %08x\n",
|
||||
pmp->pm_devvp->v_socket, pmp->pm_devvp->v_tag,
|
||||
((unsigned int*)pmp->pm_devvp->v_data)[0],
|
||||
((unsigned int*)pmp->pm_devvp->v_data)[1] );
|
||||
{
|
||||
struct vnode *vp = pmp->pm_devvp;
|
||||
|
||||
printf("msdosfs_umount(): just before calling VOP_CLOSE()\n");
|
||||
printf("flag %08lx, usecount %d, writecount %d, holdcnt %ld\n",
|
||||
vp->v_flag, vp->v_usecount, vp->v_writecount, vp->v_holdcnt);
|
||||
printf("lastr %d, id %lu, mount %p, op %p\n",
|
||||
vp->v_lastr, vp->v_id, vp->v_mount, vp->v_op);
|
||||
printf("freef %p, freeb %p, mount %p\n",
|
||||
vp->v_freelist.tqe_next, vp->v_freelist.tqe_prev,
|
||||
vp->v_mount);
|
||||
printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n",
|
||||
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,
|
||||
((u_int *)vp->v_data)[0],
|
||||
((u_int *)vp->v_data)[1]);
|
||||
}
|
||||
#endif
|
||||
error = VOP_CLOSE(pmp->pm_devvp,
|
||||
pmp->pm_flags & MSDOSFSMNT_RONLY ? FREAD : FREAD|FWRITE, NOCRED, p);
|
||||
@ -784,12 +789,11 @@ msdosfs_root(mp, vpp)
|
||||
struct denode *ndep;
|
||||
int error;
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_root(); mp %p, pmp %p\n", mp, pmp);
|
||||
#endif
|
||||
if ((error = deget(pmp, MSDOSFSROOT, MSDOSFSROOT_OFS, &ndep)) != 0)
|
||||
return (error);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_root(); mp %p, pmp %p, ndep %p, vp %p\n",
|
||||
mp, pmp, ndep, DETOV(ndep));
|
||||
#endif
|
||||
*vpp = DETOV(ndep);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.65 1997/11/16 21:47:38 christos Exp $ */
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.66 1997/11/17 15:37:02 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
/*
|
||||
* Some general notes:
|
||||
*
|
||||
*
|
||||
* In the ufs filesystem the inodes, superblocks, and indirect blocks are
|
||||
* read/written using the vnode for the filesystem. Blocks that represent
|
||||
* the contents of a file are read/written using the vnode for the file
|
||||
@ -143,7 +143,7 @@ msdosfs_create(v)
|
||||
bzero(&ndirent, sizeof(ndirent));
|
||||
if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0)
|
||||
goto bad;
|
||||
|
||||
|
||||
ndirent.de_Attributes = (ap->a_vap->va_mode & S_IWUSR) ?
|
||||
ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY;
|
||||
ndirent.de_StartCluster = 0;
|
||||
@ -178,7 +178,7 @@ msdosfs_mknod(v)
|
||||
struct componentname *a_cnp;
|
||||
struct vattr *a_vap;
|
||||
} */ *ap = v;
|
||||
|
||||
|
||||
switch (ap->a_vap->va_type) {
|
||||
case VDIR:
|
||||
return (msdosfs_mkdir((struct vop_mkdir_args *)ap));
|
||||
@ -336,7 +336,7 @@ msdosfs_setattr(v)
|
||||
struct msdosfsmount *pmp = dep->de_pmp;
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct ucred *cred = ap->a_cred;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_setattr(): vp %p, vap %p, cred %p, p %p\n",
|
||||
ap->a_vp, vap, cred, ap->a_p);
|
||||
@ -371,7 +371,7 @@ msdosfs_setattr(v)
|
||||
if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
|
||||
if (cred->cr_uid != pmp->pm_uid &&
|
||||
(error = suser(cred, &ap->a_p->p_acflag)) &&
|
||||
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
|
||||
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
|
||||
(error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_p))))
|
||||
return (error);
|
||||
if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 &&
|
||||
@ -523,11 +523,11 @@ msdosfs_write(v)
|
||||
struct denode *dep = VTODE(vp);
|
||||
struct msdosfsmount *pmp = dep->de_pmp;
|
||||
struct ucred *cred = ap->a_cred;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_write(vp %p, uio %p, ioflag %08x, cred %p\n",
|
||||
printf("msdosfs_write(vp %p, uio %p, ioflag %x, cred %p\n",
|
||||
vp, uio, ioflag, cred);
|
||||
printf("msdosfs_write(): diroff %ld, dirclust %ld, startcluster %ld\n",
|
||||
printf("msdosfs_write(): diroff %lu, dirclust %lu, startcluster %lu\n",
|
||||
dep->de_diroffset, dep->de_dirclust, dep->de_StartCluster);
|
||||
#endif
|
||||
|
||||
@ -589,13 +589,13 @@ msdosfs_write(v)
|
||||
lastcn = dep->de_fc[FC_LASTFC].fc_frcn;
|
||||
} else
|
||||
lastcn = de_clcount(pmp, osize) - 1;
|
||||
|
||||
|
||||
do {
|
||||
if (de_cluster(pmp, uio->uio_offset) > lastcn) {
|
||||
error = ENOSPC;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bn = de_blk(pmp, uio->uio_offset);
|
||||
if ((uio->uio_offset & pmp->pm_crbomask) == 0
|
||||
&& (de_blk(pmp, uio->uio_offset + uio->uio_resid) > de_blk(pmp, uio->uio_offset)
|
||||
@ -765,7 +765,7 @@ msdosfs_update(v)
|
||||
|
||||
/*
|
||||
* Flush the blocks of a file to disk.
|
||||
*
|
||||
*
|
||||
* This function is worthless for vnodes that represent directories. Maybe we
|
||||
* could just do a sync if they try an fsync on a directory file.
|
||||
*/
|
||||
@ -822,9 +822,9 @@ msdosfs_link(v)
|
||||
* Renames on files require moving the denode to a new hash queue since the
|
||||
* denode's location is used to compute which hash queue to put the file
|
||||
* in. Unless it is a rename in place. For example "mv a b".
|
||||
*
|
||||
*
|
||||
* What follows is the basic algorithm:
|
||||
*
|
||||
*
|
||||
* if (file move) {
|
||||
* if (dest file exists) {
|
||||
* remove dest file
|
||||
@ -856,13 +856,13 @@ msdosfs_link(v)
|
||||
* clear old directory entry for moved directory
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*
|
||||
* On entry:
|
||||
* source's parent directory is unlocked
|
||||
* source file or directory is unlocked
|
||||
* destination's parent directory is locked
|
||||
* destination file or directory is locked if it exists
|
||||
*
|
||||
*
|
||||
* On exit:
|
||||
* all denodes should be released
|
||||
*
|
||||
@ -983,7 +983,7 @@ abortit:
|
||||
* directory heirarchy above the target, as this would
|
||||
* orphan everything below the source directory. Also
|
||||
* the user must have write permission in the source so
|
||||
* as to be able to change "..". We must repeat the call
|
||||
* as to be able to change "..". We must repeat the call
|
||||
* to namei, as the parent directory is unlocked by the
|
||||
* call to doscheckpath().
|
||||
*/
|
||||
@ -1138,7 +1138,7 @@ abortit:
|
||||
if (newparent)
|
||||
VOP_UNLOCK(fdvp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If we moved a directory to a new parent directory, then we must
|
||||
* fixup the ".." entry in the moved directory.
|
||||
@ -1251,7 +1251,7 @@ msdosfs_mkdir(v)
|
||||
ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
|
||||
TIMEVAL_TO_TIMESPEC(&time, &ts);
|
||||
DETIMES(&ndirent, &ts, &ts, &ts);
|
||||
|
||||
|
||||
/*
|
||||
* Now fill the cluster with the "." and ".." entries. And write
|
||||
* the cluster to disk. This way it is there for the parent
|
||||
@ -1299,7 +1299,7 @@ msdosfs_mkdir(v)
|
||||
#endif
|
||||
if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0)
|
||||
goto bad;
|
||||
|
||||
|
||||
ndirent.de_Attributes = ATTR_DIRECTORY;
|
||||
ndirent.de_StartCluster = newcluster;
|
||||
ndirent.de_FileSize = 0;
|
||||
@ -1442,7 +1442,7 @@ msdosfs_readdir(v)
|
||||
int ncookies;
|
||||
off_t offset;
|
||||
int chksum = -1;
|
||||
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_readdir(): vp %p, uio %p, cred %p, eofflagp %p\n",
|
||||
ap->a_vp, uio, ap->a_cred, ap->a_eofflag);
|
||||
@ -1461,7 +1461,7 @@ msdosfs_readdir(v)
|
||||
* To be safe, initialize dirbuf
|
||||
*/
|
||||
bzero(dirbuf.d_name, sizeof(dirbuf.d_name));
|
||||
|
||||
|
||||
/*
|
||||
* If the user buffer is smaller than the size of one dos directory
|
||||
* entry or the file offset is not a multiple of the size of a
|
||||
@ -1556,7 +1556,7 @@ msdosfs_readdir(v)
|
||||
(char *)dentp < bp->b_data + on + n;
|
||||
dentp++, offset += sizeof(struct direntry)) {
|
||||
#if 0
|
||||
|
||||
|
||||
printf("rd: dentp %08x prev %08x crnt %08x deName %02x attr %02x\n",
|
||||
dentp, prev, crnt, dentp->deName[0], dentp->deAttributes);
|
||||
#endif
|
||||
@ -1574,7 +1574,7 @@ msdosfs_readdir(v)
|
||||
chksum = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle Win95 long directory entries
|
||||
*/
|
||||
@ -1584,7 +1584,7 @@ msdosfs_readdir(v)
|
||||
chksum = win2unixfn((struct winentry *)dentp, &dirbuf, chksum);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Skip volume labels
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfsmount.h,v 1.16 1997/10/17 11:24:24 ws Exp $ */
|
||||
/* $NetBSD: msdosfsmount.h,v 1.17 1997/11/17 15:37:07 ws Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -33,17 +33,17 @@
|
||||
*/
|
||||
/*
|
||||
* Written by Paul Popelka (paulp@uts.amdahl.com)
|
||||
*
|
||||
*
|
||||
* You can do anything you want with this software, just don't say you wrote
|
||||
* it, and don't remove this notice.
|
||||
*
|
||||
*
|
||||
* This software is provided "as is".
|
||||
*
|
||||
*
|
||||
* The author supplies this software to be publicly redistributed on the
|
||||
* understanding that the author is not responsible for the correct
|
||||
* functioning of this software in any circumstances and is not liable for
|
||||
* any damages caused by this software.
|
||||
*
|
||||
*
|
||||
* October 1992
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user