summaryrefslogtreecommitdiff
path: root/sys/msdosfs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/msdosfs')
-rw-r--r--sys/msdosfs/denode.h32
-rw-r--r--sys/msdosfs/fat.h16
-rw-r--r--sys/msdosfs/msdosfs_conv.c26
-rw-r--r--sys/msdosfs/msdosfs_denode.c26
-rw-r--r--sys/msdosfs/msdosfs_fat.c147
-rw-r--r--sys/msdosfs/msdosfs_lookup.c20
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c4
-rw-r--r--sys/msdosfs/msdosfs_vnops.c30
-rw-r--r--sys/msdosfs/msdosfsmount.h40
9 files changed, 172 insertions, 169 deletions
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h
index 5f5b68c62df..913f59a3e54 100644
--- a/sys/msdosfs/denode.h
+++ b/sys/msdosfs/denode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: denode.h,v 1.15 2003/09/23 16:51:13 millert Exp $ */
+/* $OpenBSD: denode.h,v 1.16 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: denode.h,v 1.24 1997/10/17 11:23:39 ws Exp $ */
/*-
@@ -103,8 +103,8 @@
* structure (fc_frcn).
*/
struct fatcache {
- u_long fc_frcn; /* file relative cluster number */
- u_long fc_fsrcn; /* filesystem relative cluster number */
+ uint32_t fc_frcn; /* file relative cluster number */
+ uint32_t fc_fsrcn; /* filesystem relative cluster number */
};
/*
@@ -139,12 +139,12 @@ struct denode {
struct denode **de_prev; /* Hash chain back */
struct vnode *de_vnode; /* addr of vnode we are part of */
struct vnode *de_devvp; /* vnode of blk dev we live on */
- u_long de_flag; /* flag bits */
+ uint32_t de_flag; /* flag bits */
dev_t de_dev; /* device where direntry lives */
daddr_t de_lastr;
- u_long de_dirclust; /* cluster of the directory file containing this entry */
- u_long de_diroffset; /* offset of this entry in the directory cluster */
- u_long de_fndoffset; /* offset of found dir entry */
+ uint32_t de_dirclust; /* cluster of the directory file containing this entry */
+ uint32_t de_diroffset; /* offset of this entry in the directory cluster */
+ uint32_t de_fndoffset; /* offset of found dir entry */
int de_fndcnt; /* number of slots before de_fndoffset */
long de_refcnt; /* reference count */
struct msdosfsmount *de_pmp; /* addr of our mount struct */
@@ -158,8 +158,8 @@ struct denode {
u_short de_ADate; /* access date */
u_short de_MTime; /* modification time */
u_short de_MDate; /* modification date */
- u_long de_StartCluster; /* starting cluster of file */
- u_long de_FileSize; /* size of file in bytes */
+ uint32_t de_StartCluster; /* starting cluster of file */
+ uint32_t de_FileSize; /* size of file in bytes */
struct fatcache de_fc[FC_SIZE]; /* fat cache */
};
@@ -245,10 +245,10 @@ struct defid {
u_short defid_len; /* length of structure */
u_short defid_pad; /* force long alignment */
- u_long defid_dirclust; /* cluster this dir entry came from */
- u_long defid_dirofs; /* offset of entry within the cluster */
+ uint32_t defid_dirclust; /* cluster this dir entry came from */
+ uint32_t defid_dirofs; /* offset of entry within the cluster */
#if 0
- u_long defid_gen; /* generation number */
+ uint32_t defid_gen; /* generation number */
#endif
};
@@ -298,14 +298,14 @@ int msdosfs_pathconf(void *);
* Internal service routine prototypes.
*/
int createde(struct denode *, struct denode *, struct denode **, struct componentname *);
-int deextend(struct denode *, u_long, struct ucred *);
-int deget(struct msdosfsmount *, u_long, u_long, struct denode **);
-int detrunc(struct denode *, u_long, int, struct ucred *, struct proc *);
+int deextend(struct denode *, uint32_t, struct ucred *);
+int deget(struct msdosfsmount *, uint32_t, uint32_t, struct denode **);
+int detrunc(struct denode *, uint32_t, int, struct ucred *, struct proc *);
int deupdat(struct denode *, int);
int doscheckpath(struct denode *, struct denode *);
int dosdirempty(struct denode *);
int readde(struct denode *, struct buf **, struct direntry **);
-int readep(struct msdosfsmount *, u_long, u_long, struct buf **, struct direntry **);
+int readep(struct msdosfsmount *, uint32_t, uint32_t, struct buf **, struct direntry **);
void reinsert(struct denode *);
int removede(struct denode *, struct denode *);
int uniqdosname(struct denode *, struct componentname *, u_char *);
diff --git a/sys/msdosfs/fat.h b/sys/msdosfs/fat.h
index 7cb959a8b22..be37e2f96db 100644
--- a/sys/msdosfs/fat.h
+++ b/sys/msdosfs/fat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fat.h,v 1.5 2002/03/14 01:27:09 millert Exp $ */
+/* $OpenBSD: fat.h,v 1.6 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: fat.h,v 1.11 1997/10/17 11:23:49 ws Exp $ */
/*-
@@ -97,13 +97,13 @@
*/
#define DE_CLEAR 1 /* Zero out the blocks allocated */
-int pcbmap(struct denode *, u_long, daddr_t *, u_long *, int *);
-int clusterfree(struct msdosfsmount *, u_long, u_long *);
-int clusteralloc(struct msdosfsmount *, u_long, u_long, u_long, u_long *, u_long *);
-int extendfile(struct denode *, u_long, struct buf **, u_long *, int);
-int fatentry(int, struct msdosfsmount *, u_long, u_long *, u_long);
+int pcbmap(struct denode *, uint32_t, daddr_t *, uint32_t *, int *);
+int clusterfree(struct msdosfsmount *, uint32_t, uint32_t *);
+int clusteralloc(struct msdosfsmount *, uint32_t, uint32_t, uint32_t, uint32_t *, uint32_t *);
+int extendfile(struct denode *, uint32_t, struct buf **, uint32_t *, int);
+int fatentry(int, struct msdosfsmount *, uint32_t, uint32_t *, uint32_t);
void fc_purge(struct denode *, u_int);
-void fc_lookup(struct denode *, u_long, u_long *, u_long *);
+void fc_lookup(struct denode *, uint32_t, uint32_t *, uint32_t *);
int fillinusemap(struct msdosfsmount *);
-int freeclusterchain(struct msdosfsmount *, u_long);
+int freeclusterchain(struct msdosfsmount *, uint32_t);
#endif /* _KERNEL */
diff --git a/sys/msdosfs/msdosfs_conv.c b/sys/msdosfs/msdosfs_conv.c
index dda90835f00..73ae4e1fa30 100644
--- a/sys/msdosfs/msdosfs_conv.c
+++ b/sys/msdosfs/msdosfs_conv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_conv.c,v 1.11 2004/03/31 18:48:15 millert Exp $ */
+/* $OpenBSD: msdosfs_conv.c,v 1.12 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: msdosfs_conv.c,v 1.24 1997/10/17 11:23:54 ws Exp $ */
/*-
@@ -84,8 +84,8 @@ const u_short leapyear[] = {
* Variables used to remember parts of the last time conversion. Maybe we
* can avoid a full conversion.
*/
-u_long lasttime;
-u_long lastday;
+uint32_t lasttime;
+uint32_t lastday;
u_short lastddate;
u_short lastdtime;
@@ -100,11 +100,11 @@ unix2dostime(tsp, ddp, dtp, dhp)
u_int16_t *dtp;
u_int8_t *dhp;
{
- u_long t;
- u_long days;
- u_long inc;
- u_long year;
- u_long month;
+ uint32_t t;
+ uint32_t days;
+ uint32_t inc;
+ uint32_t year;
+ uint32_t month;
const u_short *months;
/*
@@ -168,7 +168,7 @@ unix2dostime(tsp, ddp, dtp, dhp)
#define SECONDSTO1980 (((8 * 365) + (2 * 366)) * (24 * 60 * 60))
u_short lastdosdate;
-u_long lastseconds;
+uint32_t lastseconds;
/*
* Convert from dos' idea of time to unix'. This will probably only be
@@ -182,10 +182,10 @@ dos2unixtime(dd, dt, dh, tsp)
u_int dh;
struct timespec *tsp;
{
- u_long seconds;
- u_long m, month;
- u_long y, year;
- u_long days;
+ uint32_t seconds;
+ uint32_t m, month;
+ uint32_t y, year;
+ uint32_t days;
const u_short *months;
if (dd == 0) {
diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c
index 7348c021b31..153ad8fab6d 100644
--- a/sys/msdosfs/msdosfs_denode.c
+++ b/sys/msdosfs/msdosfs_denode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_denode.c,v 1.24 2002/03/14 01:27:09 millert Exp $ */
+/* $OpenBSD: msdosfs_denode.c,v 1.25 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.23 1997/10/17 11:23:58 ws Exp $ */
/*-
@@ -72,7 +72,7 @@ u_long dehash; /* size of hash table - 1 */
#define DEHASH(dev, dcl, doff) (((dev) + (dcl) + (doff) / sizeof(struct direntry)) \
& dehash)
-static struct denode *msdosfs_hashget(dev_t, u_long, u_long);
+static struct denode *msdosfs_hashget(dev_t, uint32_t, uint32_t);
static int msdosfs_hashins(struct denode *);
static void msdosfs_hashrem(struct denode *);
@@ -88,8 +88,8 @@ msdosfs_init(vfsp)
static struct denode *
msdosfs_hashget(dev, dirclust, diroff)
dev_t dev;
- u_long dirclust;
- u_long diroff;
+ uint32_t dirclust;
+ uint32_t diroff;
{
struct denode *dep;
struct proc *p = curproc; /* XXX */
@@ -173,8 +173,8 @@ msdosfs_hashrem(dep)
int
deget(pmp, dirclust, diroffset, depp)
struct msdosfsmount *pmp; /* so we know the maj/min number */
- u_long dirclust; /* cluster this dir entry came from */
- u_long diroffset; /* index of entry within the cluster */
+ uint32_t dirclust; /* cluster this dir entry came from */
+ uint32_t diroffset; /* index of entry within the cluster */
struct denode **depp; /* returns the addr of the gotten denode */
{
int error;
@@ -317,7 +317,7 @@ retry:
* to find out the length of the directory and plug it into
* the denode structure.
*/
- u_long size;
+ uint32_t size;
nvp->v_type = VDIR;
if (ldep->de_StartCluster != MSDOSFSROOT) {
@@ -374,7 +374,7 @@ deupdat(dep, waitfor)
int
detrunc(dep, length, flags, cred, p)
struct denode *dep;
- u_long length;
+ uint32_t length;
int flags;
struct ucred *cred;
struct proc *p;
@@ -382,8 +382,8 @@ detrunc(dep, length, flags, cred, p)
int error;
int allerror;
int vflags;
- u_long eofentry;
- u_long chaintofree;
+ uint32_t eofentry;
+ uint32_t chaintofree;
daddr_t bn;
int boff;
int isadir = dep->de_Attributes & ATTR_DIRECTORY;
@@ -520,11 +520,11 @@ detrunc(dep, length, flags, cred, p)
int
deextend(dep, length, cred)
struct denode *dep;
- u_long length;
+ uint32_t length;
struct ucred *cred;
{
struct msdosfsmount *pmp = dep->de_pmp;
- u_long count;
+ uint32_t count;
int error;
/*
@@ -661,7 +661,7 @@ msdosfs_inactive(v)
dep, dep->de_refcnt, vp->v_mount->mnt_flag, MNT_RDONLY);
#endif
if (dep->de_refcnt <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
- error = detrunc(dep, (u_long)0, 0, NOCRED, NULL);
+ error = detrunc(dep, (uint32_t)0, 0, NOCRED, NULL);
dep->de_Name[0] = SLOT_DELETED;
}
deupdat(dep, 0);
diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c
index 1975ee49df0..665af7a6ace 100644
--- a/sys/msdosfs/msdosfs_fat.c
+++ b/sys/msdosfs/msdosfs_fat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_fat.c,v 1.14 2003/12/10 07:46:33 itojun Exp $ */
+/* $OpenBSD: msdosfs_fat.c,v 1.15 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: msdosfs_fat.c,v 1.26 1997/10/17 11:24:02 ws Exp $ */
/*-
@@ -83,25 +83,25 @@ int fc_lmdistance[LMMAX]; /* counters for how far off the last
* cluster mapped entry was. */
int fc_largedistance; /* off by more than LMMAX */
-static void fatblock(struct msdosfsmount *, u_long, u_long *, u_long *,
- u_long *);
-void updatefats(struct msdosfsmount *, struct buf *, u_long);
-static __inline void usemap_free(struct msdosfsmount *, u_long);
-static __inline void usemap_alloc(struct msdosfsmount *, u_long);
-static int fatchain(struct msdosfsmount *, u_long, u_long, u_long);
-int chainlength(struct msdosfsmount *, u_long, u_long);
-int chainalloc(struct msdosfsmount *, u_long, u_long, u_long, u_long *,
- u_long *);
+static void fatblock(struct msdosfsmount *, uint32_t, uint32_t *, uint32_t *,
+ uint32_t *);
+void updatefats(struct msdosfsmount *, struct buf *, uint32_t);
+static __inline void usemap_free(struct msdosfsmount *, uint32_t);
+static __inline void usemap_alloc(struct msdosfsmount *, uint32_t);
+static int fatchain(struct msdosfsmount *, uint32_t, uint32_t, uint32_t);
+int chainlength(struct msdosfsmount *, uint32_t, uint32_t);
+int chainalloc(struct msdosfsmount *, uint32_t, uint32_t, uint32_t, uint32_t *,
+ uint32_t *);
static void
fatblock(pmp, ofs, bnp, sizep, bop)
struct msdosfsmount *pmp;
- u_long ofs;
- u_long *bnp;
- u_long *sizep;
- u_long *bop;
+ uint32_t ofs;
+ uint32_t *bnp;
+ uint32_t *sizep;
+ uint32_t *bop;
{
- u_long bn, size;
+ uint32_t bn, size;
bn = ofs / pmp->pm_fatblocksize * pmp->pm_fatblocksec;
size = min(pmp->pm_fatblocksec, pmp->pm_FATsecs - bn)
@@ -137,22 +137,22 @@ fatblock(pmp, ofs, bnp, sizep, bop)
int
pcbmap(dep, findcn, bnp, cnp, sp)
struct denode *dep;
- u_long findcn; /* file relative cluster to get */
+ uint32_t findcn; /* file relative cluster to get */
daddr_t *bnp; /* returned filesys relative blk number */
- u_long *cnp; /* returned cluster number */
+ uint32_t *cnp; /* returned cluster number */
int *sp; /* returned block size */
{
int error;
- u_long i;
- u_long cn;
- u_long prevcn = 0; /* XXX: prevcn could be used uninitialized */
- u_long byteoffset;
- u_long bn;
- u_long bo;
+ uint32_t i;
+ uint32_t cn;
+ uint32_t prevcn = 0; /* XXX: prevcn could be used uninitialized */
+ uint32_t byteoffset;
+ uint32_t bn;
+ uint32_t bo;
struct buf *bp = NULL;
- u_long bp_bn = -1;
+ uint32_t bp_bn = -1;
struct msdosfsmount *pmp = dep->de_pmp;
- u_long bsize;
+ uint32_t bsize;
fc_bmapcalls++;
@@ -175,6 +175,7 @@ pcbmap(dep, findcn, bnp, cnp, sp)
if (de_cn2off(pmp, findcn) >= dep->de_FileSize) {
if (cnp)
*cnp = de_bn2cn(pmp, pmp->pm_rootdirsize);
+ printf("E2BIG 1\n");
return (E2BIG);
}
if (bnp)
@@ -188,6 +189,7 @@ pcbmap(dep, findcn, bnp, cnp, sp)
} else { /* just an empty file */
if (cnp)
*cnp = 0;
+ printf("E2BIG 2\n");
return (E2BIG);
}
}
@@ -273,6 +275,7 @@ hiteof:;
brelse(bp);
/* update last file cluster entry in the fat cache */
fc_setcache(dep, FC_LASTFC, i - 1, prevcn);
+ printf("E2BIG 3\n");
return (E2BIG);
}
@@ -283,12 +286,12 @@ hiteof:;
void
fc_lookup(dep, findcn, frcnp, fsrcnp)
struct denode *dep;
- u_long findcn;
- u_long *frcnp;
- u_long *fsrcnp;
+ uint32_t findcn;
+ uint32_t *frcnp;
+ uint32_t *fsrcnp;
{
int i;
- u_long cn;
+ uint32_t cn;
struct fatcache *closest = 0;
for (i = 0; i < FC_SIZE; i++) {
@@ -336,7 +339,7 @@ void
updatefats(pmp, bp, fatbn)
struct msdosfsmount *pmp;
struct buf *bp;
- u_long fatbn;
+ uint32_t fatbn;
{
int i;
struct buf *bpn;
@@ -349,7 +352,7 @@ updatefats(pmp, bp, fatbn)
* If we have an FSInfo block, update it.
*/
if (pmp->pm_fsinfo) {
- u_long cn = pmp->pm_nxtfree;
+ uint32_t cn = pmp->pm_nxtfree;
if (pmp->pm_freeclustercount
&& (pmp->pm_inusemap[cn / N_INUSEBITS]
@@ -440,7 +443,7 @@ updatefats(pmp, bp, fatbn)
static __inline void
usemap_alloc(pmp, cn)
struct msdosfsmount *pmp;
- u_long cn;
+ uint32_t cn;
{
pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
@@ -450,7 +453,7 @@ usemap_alloc(pmp, cn)
static __inline void
usemap_free(pmp, cn)
struct msdosfsmount *pmp;
- u_long cn;
+ uint32_t cn;
{
pmp->pm_freeclustercount++;
@@ -460,11 +463,11 @@ usemap_free(pmp, cn)
int
clusterfree(pmp, cluster, oldcnp)
struct msdosfsmount *pmp;
- u_long cluster;
- u_long *oldcnp;
+ uint32_t cluster;
+ uint32_t *oldcnp;
{
int error;
- u_long oldcn;
+ uint32_t oldcn;
usemap_free(pmp, cluster);
error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE);
@@ -505,13 +508,13 @@ int
fatentry(function, pmp, cn, oldcontents, newcontents)
int function;
struct msdosfsmount *pmp;
- u_long cn;
- u_long *oldcontents;
- u_long newcontents;
+ uint32_t cn;
+ uint32_t *oldcontents;
+ uint32_t newcontents;
{
int error;
- u_long readcn;
- u_long bn, bo, bsize, byteoffset;
+ uint32_t readcn;
+ uint32_t bn, bo, bsize, byteoffset;
struct buf *bp;
#ifdef MSDOSFS_DEBUG
@@ -611,12 +614,12 @@ fatentry(function, pmp, cn, oldcontents, newcontents)
static int
fatchain(pmp, start, count, fillwith)
struct msdosfsmount *pmp;
- u_long start;
- u_long count;
- u_long fillwith;
+ uint32_t start;
+ uint32_t count;
+ uint32_t fillwith;
{
int error;
- u_long bn, bo, bsize, byteoffset, readcn, newc;
+ uint32_t bn, bo, bsize, byteoffset, readcn, newc;
struct buf *bp;
#ifdef MSDOSFS_DEBUG
@@ -686,12 +689,12 @@ fatchain(pmp, start, count, fillwith)
int
chainlength(pmp, start, count)
struct msdosfsmount *pmp;
- u_long start;
- u_long count;
+ uint32_t start;
+ uint32_t count;
{
- u_long idx, max_idx;
+ uint32_t idx, max_idx;
u_int map;
- u_long len;
+ uint32_t len;
max_idx = pmp->pm_maxcluster / N_INUSEBITS;
idx = start / N_INUSEBITS;
@@ -731,14 +734,14 @@ chainlength(pmp, start, count)
int
chainalloc(pmp, start, count, fillwith, retcluster, got)
struct msdosfsmount *pmp;
- u_long start;
- u_long count;
- u_long fillwith;
- u_long *retcluster;
- u_long *got;
+ uint32_t start;
+ uint32_t count;
+ uint32_t fillwith;
+ uint32_t *retcluster;
+ uint32_t *got;
{
int error;
- u_long cl, n;
+ uint32_t cl, n;
for (cl = start, n = count; n-- > 0;)
usemap_alloc(pmp, cl++);
@@ -769,15 +772,15 @@ chainalloc(pmp, start, count, fillwith, retcluster, got)
int
clusteralloc(pmp, start, count, fillwith, retcluster, got)
struct msdosfsmount *pmp;
- u_long start;
- u_long count;
- u_long fillwith;
- u_long *retcluster;
- u_long *got;
+ uint32_t start;
+ uint32_t count;
+ uint32_t fillwith;
+ uint32_t *retcluster;
+ uint32_t *got;
{
- u_long idx;
- u_long len, newst, foundl, cn, l;
- u_long foundcn = 0; /* XXX: foundcn could be used uninitialized */
+ uint32_t idx;
+ uint32_t len, newst, foundl, cn, l;
+ uint32_t foundcn = 0; /* XXX: foundcn could be used uninitialized */
u_int map;
#ifdef MSDOSFS_DEBUG
@@ -860,12 +863,12 @@ clusteralloc(pmp, start, count, fillwith, retcluster, got)
int
freeclusterchain(pmp, cluster)
struct msdosfsmount *pmp;
- u_long cluster;
+ uint32_t cluster;
{
int error;
struct buf *bp = NULL;
- u_long bn, bo, bsize, byteoffset;
- u_long readcn, lbn = -1;
+ uint32_t bn, bo, bsize, byteoffset;
+ uint32_t readcn, lbn = -1;
while (cluster >= CLUST_FIRST && cluster <= pmp->pm_maxcluster) {
byteoffset = FATOFS(pmp, cluster);
@@ -923,9 +926,9 @@ fillinusemap(pmp)
struct msdosfsmount *pmp;
{
struct buf *bp = NULL;
- u_long cn, readcn;
+ uint32_t cn, readcn;
int error;
- u_long bn, bo, bsize, byteoffset;
+ uint32_t bn, bo, bsize, byteoffset;
/*
* Mark all clusters in use, we mark the free ones in the fat scan
@@ -987,14 +990,14 @@ fillinusemap(pmp)
int
extendfile(dep, count, bpp, ncp, flags)
struct denode *dep;
- u_long count;
+ uint32_t count;
struct buf **bpp;
- u_long *ncp;
+ uint32_t *ncp;
int flags;
{
int error;
- u_long frcn;
- u_long cn, got;
+ uint32_t frcn;
+ uint32_t cn, got;
struct msdosfsmount *pmp = dep->de_pmp;
struct buf *bp;
diff --git a/sys/msdosfs/msdosfs_lookup.c b/sys/msdosfs/msdosfs_lookup.c
index 1778a741972..f1edcd50dc1 100644
--- a/sys/msdosfs/msdosfs_lookup.c
+++ b/sys/msdosfs/msdosfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_lookup.c,v 1.12 2003/01/31 17:37:50 art Exp $ */
+/* $OpenBSD: msdosfs_lookup.c,v 1.13 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: msdosfs_lookup.c,v 1.34 1997/10/18 22:12:27 ws Exp $ */
/*-
@@ -97,12 +97,12 @@ msdosfs_lookup(v)
int slotcount;
int slotoffset = 0;
int frcn;
- u_long cluster;
+ uint32_t cluster;
int blkoff;
int diroff;
int blsize;
int isadir; /* ~0 if found direntry is a directory */
- u_long scn; /* starting cluster number */
+ uint32_t scn; /* starting cluster number */
struct vnode *pdp;
struct denode *dp;
struct denode *tdp;
@@ -572,7 +572,7 @@ createde(dep, ddep, depp, cnp)
struct componentname *cnp;
{
int error;
- u_long dirclust, diroffset;
+ uint32_t dirclust, diroffset;
struct direntry *ndep;
struct msdosfsmount *pmp = ddep->de_pmp;
struct buf *bp;
@@ -697,7 +697,7 @@ dosdirempty(dep)
{
int blsize;
int error;
- u_long cn;
+ uint32_t cn;
daddr_t bn;
struct buf *bp;
struct msdosfsmount *pmp = dep->de_pmp;
@@ -860,14 +860,14 @@ out:;
int
readep(pmp, dirclust, diroffset, bpp, epp)
struct msdosfsmount *pmp;
- u_long dirclust, diroffset;
+ uint32_t dirclust, diroffset;
struct buf **bpp;
struct direntry **epp;
{
int error;
daddr_t bn;
int blsize;
- u_long boff;
+ uint32_t boff;
boff = diroffset & ~pmp->pm_crbomask;
blsize = pmp->pm_bpcluster;
@@ -920,7 +920,7 @@ removede(pdep, dep)
daddr_t bn;
int blsize;
struct msdosfsmount *pmp = pdep->de_pmp;
- u_long offset = pdep->de_fndoffset;
+ uint32_t offset = pdep->de_fndoffset;
#ifdef MSDOSFS_DEBUG
printf("removede(): filename %s, dep %08x, offset %08x\n",
@@ -986,7 +986,7 @@ uniqdosname(dep, cnp, cp)
struct direntry *dentp;
int gen;
int blsize;
- u_long cn;
+ uint32_t cn;
daddr_t bn;
struct buf *bp;
int error;
@@ -1049,7 +1049,7 @@ findwin95(dep)
struct msdosfsmount *pmp = dep->de_pmp;
struct direntry *dentp;
int blsize;
- u_long cn;
+ uint32_t cn;
daddr_t bn;
struct buf *bp;
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 7024ed5cdfe..71e15c4ab9f 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vfsops.c,v 1.32 2003/08/14 07:46:40 mickey Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.33 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */
/*-
@@ -272,7 +272,7 @@ msdosfs_mountfs(devvp, mp, p, argp)
u_int8_t SecPerClust;
int ronly, error;
int bsize = 0, dtype = 0, tmp;
- u_long dirsperblk;
+ uint32_t dirsperblk;
/*
* Disallow multiple mounts of the same device.
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index 59bd652cdaa..ebf38bcac18 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vnops.c,v 1.43 2003/11/13 17:19:40 drahn Exp $ */
+/* $OpenBSD: msdosfs_vnops.c,v 1.44 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */
/*-
@@ -264,8 +264,8 @@ msdosfs_getattr(v)
struct msdosfsmount *pmp = dep->de_pmp;
struct vattr *vap = ap->a_vap;
struct timespec ts;
- u_long dirsperblk = pmp->pm_BytesPerSec / sizeof(struct direntry);
- u_long fileid;
+ uint32_t dirsperblk = pmp->pm_BytesPerSec / sizeof(struct direntry);
+ uint32_t fileid;
TIMEVAL_TO_TIMESPEC(&time, &ts);
DETIMES(dep, &ts, &ts, &ts);
@@ -363,7 +363,7 @@ msdosfs_setattr(v)
return EISDIR;
if (vap->va_size != VNOVAL) {
- error = detrunc(dep, (u_long)vap->va_size, 0, cred, ap->a_p);
+ error = detrunc(dep, (uint32_t)vap->va_size, 0, cred, ap->a_p);
if (error)
return (error);
}
@@ -449,7 +449,7 @@ msdosfs_read(v)
do {
lbn = de_cluster(pmp, uio->uio_offset);
on = uio->uio_offset & pmp->pm_crbomask;
- n = min((u_long) (pmp->pm_bpcluster - on), uio->uio_resid);
+ n = min((uint32_t) (pmp->pm_bpcluster - on), uio->uio_resid);
diff = dep->de_FileSize - uio->uio_offset;
if (diff <= 0)
return (0);
@@ -509,9 +509,9 @@ msdosfs_write(v)
int n;
int croffset;
int resid;
- u_long osize;
+ uint32_t osize;
int error = 0;
- u_long count;
+ uint32_t count;
daddr_t bn, lastcn;
struct buf *bp;
int ioflag = ap->a_ioflag;
@@ -695,7 +695,7 @@ msdosfs_ioctl(v)
#if 0
struct vop_ioctl_args /* {
struct vnode *a_vp;
- u_long a_command;
+ uint32_t a_command;
caddr_t a_data;
int a_fflag;
struct ucred *a_cred;
@@ -870,11 +870,11 @@ msdosfs_rename(v)
struct proc *p = curproc; /* XXX */
register struct denode *ip, *xp, *dp, *zp;
u_char toname[11], oldname[11];
- u_long from_diroffset, to_diroffset;
+ uint32_t from_diroffset, to_diroffset;
u_char to_count;
int doingdirectory = 0, newparent = 0;
int error;
- u_long cn, pcl;
+ uint32_t cn, pcl;
daddr_t bn;
struct msdosfsmount *pmp;
struct direntry *dotdotp;
@@ -1206,7 +1206,7 @@ msdosfs_mkdir(v)
struct denode *pdep = VTODE(ap->a_dvp);
int error;
int bn;
- u_long newcluster, pcl;
+ uint32_t newcluster, pcl;
struct direntry *denp;
struct msdosfsmount *pmp = pdep->de_pmp;
struct buf *bp;
@@ -1363,7 +1363,7 @@ msdosfs_rmdir(v)
/*
* Truncate the directory that is being deleted.
*/
- error = detrunc(ip, (u_long)0, IO_SYNC, cnp->cn_cred, cnp->cn_proc);
+ error = detrunc(ip, (uint32_t)0, IO_SYNC, cnp->cn_cred, cnp->cn_proc);
cache_purge(vp);
out:
if (dvp)
@@ -1411,9 +1411,9 @@ msdosfs_readdir(v)
long on;
long lost;
long count;
- u_long dirsperblk;
- u_long cn;
- u_long fileno;
+ uint32_t dirsperblk;
+ uint32_t cn;
+ uint32_t fileno;
long bias = 0;
daddr_t bn, lbn;
struct buf *bp;
diff --git a/sys/msdosfs/msdosfsmount.h b/sys/msdosfs/msdosfsmount.h
index 1008bf2bd0f..23a82c21837 100644
--- a/sys/msdosfs/msdosfsmount.h
+++ b/sys/msdosfs/msdosfsmount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfsmount.h,v 1.14 2003/04/18 22:12:25 tedu Exp $ */
+/* $OpenBSD: msdosfsmount.h,v 1.15 2004/05/12 21:04:15 tedu Exp $ */
/* $NetBSD: msdosfsmount.h,v 1.16 1997/10/17 11:24:24 ws Exp $ */
/*-
@@ -59,25 +59,25 @@ struct msdosfsmount {
mode_t pm_mask; /* mask to and with file protection bits */
struct vnode *pm_devvp; /* vnode for block device mntd */
struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */
- u_long pm_FATsecs; /* actual number of fat sectors */
- u_long pm_fatblk; /* block # of first FAT */
- u_long pm_rootdirblk; /* block # (cluster # for FAT32) of root directory number */
- u_long pm_rootdirsize; /* size in blocks (not clusters) */
- u_long pm_firstcluster; /* block number of first cluster */
- u_long pm_nmbrofclusters; /* # of clusters in filesystem */
- u_long pm_maxcluster; /* maximum cluster number */
- u_long pm_freeclustercount; /* number of free clusters */
- u_long pm_cnshift; /* shift file offset right this amount to get a cluster number */
- u_long pm_crbomask; /* and a file offset with this mask to get cluster rel offset */
- u_long pm_bnshift; /* shift file offset right this amount to get a block number */
- u_long pm_bpcluster; /* bytes per cluster */
- u_long pm_fmod; /* ~0 if fs is modified, this can rollover to 0 */
- u_long pm_fatblocksize; /* size of fat blocks in bytes */
- u_long pm_fatblocksec; /* size of fat blocks in sectors */
- u_long pm_fatsize; /* size of fat in bytes */
- u_long pm_fatmask; /* mask to use for fat numbers */
- u_long pm_fsinfo; /* fsinfo block number */
- u_long pm_nxtfree; /* next free cluster in fsinfo block */
+ uint32_t pm_FATsecs; /* actual number of fat sectors */
+ uint32_t pm_fatblk; /* block # of first FAT */
+ uint32_t pm_rootdirblk; /* block # (cluster # for FAT32) of root directory number */
+ uint32_t pm_rootdirsize; /* size in blocks (not clusters) */
+ uint32_t pm_firstcluster; /* block number of first cluster */
+ uint32_t pm_nmbrofclusters; /* # of clusters in filesystem */
+ uint32_t pm_maxcluster; /* maximum cluster number */
+ uint32_t pm_freeclustercount; /* number of free clusters */
+ uint32_t pm_cnshift; /* shift file offset right this amount to get a cluster number */
+ uint32_t pm_crbomask; /* and a file offset with this mask to get cluster rel offset */
+ uint32_t pm_bnshift; /* shift file offset right this amount to get a block number */
+ uint32_t pm_bpcluster; /* bytes per cluster */
+ uint32_t pm_fmod; /* ~0 if fs is modified, this can rollover to 0 */
+ uint32_t pm_fatblocksize; /* size of fat blocks in bytes */
+ uint32_t pm_fatblocksec; /* size of fat blocks in sectors */
+ uint32_t pm_fatsize; /* size of fat in bytes */
+ uint32_t pm_fatmask; /* mask to use for fat numbers */
+ uint32_t pm_fsinfo; /* fsinfo block number */
+ uint32_t pm_nxtfree; /* next free cluster in fsinfo block */
u_int pm_fatmult; /* these 2 values are used in fat */
u_int pm_fatdiv; /* offset computation */
u_int pm_curfat; /* current fat for FAT32 (0 otherwise) */