summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-29 10:47:03 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-29 10:47:03 +0000
commit08069edeccb656d903ad80fea7f38f7e72e6172d (patch)
treedd0c3f88ac84a1d4046a686cb2d3e95917ebabe5
parente0ebb2a241212ffac2e99d36a352ae3c80c88216 (diff)
From NetBSD: merge with 960217
-rw-r--r--sys/msdosfs/denode.h82
-rw-r--r--sys/msdosfs/fat.h8
-rw-r--r--sys/msdosfs/msdosfs_conv.c16
-rw-r--r--sys/msdosfs/msdosfs_denode.c59
-rw-r--r--sys/msdosfs/msdosfs_fat.c63
-rw-r--r--sys/msdosfs/msdosfs_lookup.c93
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c80
-rw-r--r--sys/msdosfs/msdosfs_vnops.c370
-rw-r--r--sys/msdosfs/msdosfsmount.h17
9 files changed, 476 insertions, 312 deletions
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h
index 75c331cae6b..bfa46e5ee65 100644
--- a/sys/msdosfs/denode.h
+++ b/sys/msdosfs/denode.h
@@ -1,4 +1,5 @@
-/* $NetBSD: denode.h,v 1.19 1995/11/29 15:08:32 ws Exp $ */
+/* $OpenBSD: denode.h,v 1.3 1996/02/29 10:46:45 niklas Exp $ */
+/* $NetBSD: denode.h,v 1.20 1996/02/09 19:13:39 christos Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@@ -245,53 +246,55 @@ struct defid {
u_long defid_dirclust; /* cluster this dir entry came from */
u_long defid_dirofs; /* offset of entry within the cluster */
-
- /* u_long defid_gen; /* generation number */
+#if 0
+ u_long defid_gen; /* generation number */
+#endif
};
/*
* Prototypes for MSDOSFS vnode operations
*/
-int msdosfs_lookup __P((struct vop_lookup_args *));
-int msdosfs_create __P((struct vop_create_args *));
-int msdosfs_mknod __P((struct vop_mknod_args *));
-int msdosfs_open __P((struct vop_open_args *));
-int msdosfs_close __P((struct vop_close_args *));
-int msdosfs_access __P((struct vop_access_args *));
-int msdosfs_getattr __P((struct vop_getattr_args *));
-int msdosfs_setattr __P((struct vop_setattr_args *));
-int msdosfs_read __P((struct vop_read_args *));
-int msdosfs_write __P((struct vop_write_args *));
+int msdosfs_lookup __P((void *));
+int msdosfs_create __P((void *));
+int msdosfs_mknod __P((void *));
+int msdosfs_open __P((void *));
+int msdosfs_close __P((void *));
+int msdosfs_access __P((void *));
+int msdosfs_getattr __P((void *));
+int msdosfs_setattr __P((void *));
+int msdosfs_read __P((void *));
+int msdosfs_write __P((void *));
#ifdef NFSSERVER
-int lease_check __P((struct vop_lease_args *));
+int lease_check __P((void *));
#define msdosfs_lease_check lease_check
#else
-#define msdosfs_lease_check ((int (*) __P((struct vop_lease_args *)))nullop)
+#define msdosfs_lease_check nullop
#endif
-int msdosfs_ioctl __P((struct vop_ioctl_args *));
-int msdosfs_select __P((struct vop_select_args *));
-int msdosfs_mmap __P((struct vop_mmap_args *));
-int msdosfs_fsync __P((struct vop_fsync_args *));
-int msdosfs_seek __P((struct vop_seek_args *));
-int msdosfs_remove __P((struct vop_remove_args *));
-int msdosfs_link __P((struct vop_link_args *));
-int msdosfs_rename __P((struct vop_rename_args *));
-int msdosfs_mkdir __P((struct vop_mkdir_args *));
-int msdosfs_rmdir __P((struct vop_rmdir_args *));
-int msdosfs_symlink __P((struct vop_symlink_args *));
-int msdosfs_readdir __P((struct vop_readdir_args *));
-int msdosfs_readlink __P((struct vop_readlink_args *));
-int msdosfs_abortop __P((struct vop_abortop_args *));
-int msdosfs_inactive __P((struct vop_inactive_args *));
-int msdosfs_reclaim __P((struct vop_reclaim_args *));
-int msdosfs_lock __P((struct vop_lock_args *));
-int msdosfs_unlock __P((struct vop_unlock_args *));
-int msdosfs_bmap __P((struct vop_bmap_args *));
-int msdosfs_strategy __P((struct vop_strategy_args *));
-int msdosfs_print __P((struct vop_print_args *));
-int msdosfs_islocked __P((struct vop_islocked_args *));
-int msdosfs_advlock __P((struct vop_advlock_args *));
-int msdosfs_reallocblks __P((struct vop_reallocblks_args *));
+int msdosfs_ioctl __P((void *));
+int msdosfs_select __P((void *));
+int msdosfs_mmap __P((void *));
+int msdosfs_fsync __P((void *));
+int msdosfs_seek __P((void *));
+int msdosfs_remove __P((void *));
+int msdosfs_link __P((void *));
+int msdosfs_rename __P((void *));
+int msdosfs_mkdir __P((void *));
+int msdosfs_rmdir __P((void *));
+int msdosfs_symlink __P((void *));
+int msdosfs_readdir __P((void *));
+int msdosfs_readlink __P((void *));
+int msdosfs_abortop __P((void *));
+int msdosfs_inactive __P((void *));
+int msdosfs_reclaim __P((void *));
+int msdosfs_lock __P((void *));
+int msdosfs_unlock __P((void *));
+int msdosfs_bmap __P((void *));
+int msdosfs_strategy __P((void *));
+int msdosfs_print __P((void *));
+int msdosfs_islocked __P((void *));
+int msdosfs_advlock __P((void *));
+int msdosfs_reallocblks __P((void *));
+int msdosfs_pathconf __P((void *));
/*
* Internal service routine prototypes.
@@ -308,4 +311,5 @@ int readep __P((struct msdosfsmount *, u_long, u_long, struct buf **, struct dir
void reinsert __P((struct denode *));
int removede __P((struct denode *, struct denode *));
int uniqdosname __P((struct denode *, struct componentname *, u_char *));
+int findwin95 __P((struct denode *));
#endif /* _KERNEL */
diff --git a/sys/msdosfs/fat.h b/sys/msdosfs/fat.h
index 78a58b62e4e..48ac2671701 100644
--- a/sys/msdosfs/fat.h
+++ b/sys/msdosfs/fat.h
@@ -1,4 +1,5 @@
-/* $NetBSD: fat.h,v 1.9 1996/01/19 14:28:05 leo Exp $ */
+/* $OpenBSD: fat.h,v 1.3 1996/02/29 10:46:47 niklas Exp $ */
+/* $NetBSD: fat.h,v 1.10 1996/02/11 22:48:14 ws Exp $ */
/*-
* Copyright (C) 1994 Wolfgang Solfrank.
@@ -67,8 +68,9 @@
* MSDOSFS:
* Return true if filesystem uses 12 bit fats. Microsoft Programmer's
* Reference says if the maximum cluster number in a filesystem is greater
- * than 4086 then we've got a 16 bit fat filesystem. While mounting, the
- * result of this test is stored in pm_fatentrysize.
+ * than 4078 ((CLUST_RSRVS - CLUST_FIRST) & FAT12_MASK) then we've got a
+ * 16 bit fat filesystem. While mounting, the result of this test is stored
+ * in pm_fatentrysize.
* GEMDOS-flavour (atari):
* If the filesystem is on floppy we've got a 12 bit fat filesystem, otherwise
* 16 bit. We check the d_type field in the disklabel struct while mounting
diff --git a/sys/msdosfs/msdosfs_conv.c b/sys/msdosfs/msdosfs_conv.c
index 697c3b07672..5bb808139ae 100644
--- a/sys/msdosfs/msdosfs_conv.c
+++ b/sys/msdosfs/msdosfs_conv.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: msdosfs_conv.c,v 1.3 1996/02/21 07:41:05 mickey Exp $ */
+/* $OpenBSD: msdosfs_conv.c,v 1.4 1996/02/29 10:46:49 niklas Exp $ */
+/* $NetBSD: msdosfs_conv.c,v 1.17 1996/02/09 19:13:42 christos Exp $ */
/*-
* Copyright (C) 1995 Wolfgang Solfrank.
@@ -51,6 +52,7 @@
* System include files.
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/time.h>
#include <sys/kernel.h> /* defines tz */
#include <sys/dirent.h>
@@ -121,7 +123,7 @@ unix2dostime(tsp, ddp, dtp)
/* +- daylight savings time correction */ ;
if (lasttime != t) {
lasttime = t;
- lastdtime = (((t % 60) >> 1) << DT_2SECONDS_SHIFT)
+ lastdtime = (((t / 2) % 30) << DT_2SECONDS_SHIFT)
+ (((t / 60) % 60) << DT_MINUTES_SHIFT)
+ (((t / 3600) % 24) << DT_HOURS_SHIFT);
@@ -187,7 +189,15 @@ dos2unixtime(dd, dt, tsp)
u_long days;
u_short *months;
- seconds = ((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT)
+ if (dd == 0) {
+ /*
+ * Uninitialized field, return the epoch.
+ */
+ tsp->tv_sec = 0;
+ tsp->tv_nsec = 0;
+ return;
+ }
+ seconds = ((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT) * 2
+ ((dt & DT_MINUTES_MASK) >> DT_MINUTES_SHIFT) * 60
+ ((dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT) * 3600;
/*
diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c
index df9e833f16e..555285dd9c4 100644
--- a/sys/msdosfs/msdosfs_denode.c
+++ b/sys/msdosfs/msdosfs_denode.c
@@ -1,4 +1,5 @@
-/* $NetBSD: msdosfs_denode.c,v 1.18 1995/11/29 15:08:38 ws Exp $ */
+/* $OpenBSD: msdosfs_denode.c,v 1.3 1996/02/29 10:46:51 niklas Exp $ */
+/* $NetBSD: msdosfs_denode.c,v 1.19 1996/02/09 19:13:43 christos Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@@ -56,6 +57,9 @@
#include <sys/vnode.h>
#include <sys/kernel.h> /* defines "time" */
#include <sys/dirent.h>
+#include <sys/namei.h>
+
+#include <vm/vm.h>
#include <msdosfs/bpb.h>
#include <msdosfs/msdosfsmount.h>
@@ -68,10 +72,13 @@ u_long dehash; /* size of hash table - 1 */
#define DEHASH(dev, dcl, doff) (((dev) + (dcl) + (doff) / sizeof(struct direntry)) \
& dehash)
-int
+static struct denode *msdosfs_hashget __P((dev_t, u_long, u_long));
+static void msdosfs_hashins __P((struct denode *));
+static void msdosfs_hashrem __P((struct denode *));
+
+void
msdosfs_init()
{
-
dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash);
}
@@ -112,7 +119,7 @@ msdosfs_hashins(dep)
struct denode **depp, *deq;
depp = &dehashtbl[DEHASH(dep->de_dev, dep->de_dirclust, dep->de_diroffset)];
- if (deq = *depp)
+ if ((deq = *depp) != NULL)
deq->de_prev = &dep->de_next;
dep->de_next = deq;
dep->de_prev = depp;
@@ -125,7 +132,7 @@ msdosfs_hashrem(dep)
{
struct denode *deq;
- if (deq = dep->de_next)
+ if ((deq = dep->de_next) != NULL)
deq->de_prev = dep->de_prev;
*dep->de_prev = deq;
#ifdef DIAGNOSTIC
@@ -154,7 +161,7 @@ deget(pmp, dirclust, diroffset, depp)
struct denode **depp; /* returns the addr of the gotten denode */
{
int error;
- extern int (**msdosfs_vnodeop_p)();
+ extern int (**msdosfs_vnodeop_p) __P((void *));
struct direntry *direntptr;
struct denode *ldep;
struct vnode *nvp;
@@ -177,7 +184,8 @@ deget(pmp, dirclust, diroffset, depp)
* entry that represented the file happens to be reused while the
* deleted file is still open.
*/
- if (ldep = msdosfs_hashget(pmp->pm_dev, dirclust, diroffset)) {
+ ldep = msdosfs_hashget(pmp->pm_dev, dirclust, diroffset);
+ if (ldep) {
*depp = ldep;
return (0);
}
@@ -187,7 +195,9 @@ deget(pmp, dirclust, diroffset, depp)
* copy it from the passed disk buffer.
*/
/* getnewvnode() does a VREF() on the vnode */
- if (error = getnewvnode(VT_MSDOSFS, pmp->pm_mountp, msdosfs_vnodeop_p, &nvp)) {
+ error = getnewvnode(VT_MSDOSFS, pmp->pm_mountp,
+ msdosfs_vnodeop_p, &nvp);
+ if (error) {
*depp = 0;
return (error);
}
@@ -240,7 +250,8 @@ deget(pmp, dirclust, diroffset, depp)
ldep->de_MDate = ldep->de_CDate;
/* leave the other fields as garbage */
} else {
- if (error = readep(pmp, dirclust, diroffset, &bp, &direntptr))
+ error = readep(pmp, dirclust, diroffset, &bp, &direntptr);
+ if (error)
return (error);
DE_INTERNALIZE(ldep, direntptr);
brelse(bp);
@@ -320,7 +331,7 @@ deupdat(dep, waitfor)
* Read in the cluster containing the directory entry we want to
* update.
*/
- if (error = readde(dep, &bp, &dirp))
+ if ((error = readde(dep, &bp, &dirp)) != 0)
return (error);
/*
@@ -401,7 +412,9 @@ detrunc(dep, length, flags, cred, p)
dep->de_StartCluster = 0;
eofentry = ~0;
} else {
- if (error = pcbmap(dep, de_clcount(pmp, length) - 1, 0, &eofentry, 0)) {
+ error = pcbmap(dep, de_clcount(pmp, length) - 1, 0,
+ &eofentry, 0);
+ if (error) {
#ifdef MSDOSFS_DEBUG
printf("detrunc(): pcbmap fails %d\n", error);
#endif
@@ -464,8 +477,9 @@ detrunc(dep, length, flags, cred, p)
* now.
*/
if (eofentry != ~0) {
- if (error = fatentry(FAT_GET_AND_SET, pmp, eofentry,
- &chaintofree, CLUST_EOFE)) {
+ error = fatentry(FAT_GET_AND_SET, pmp, eofentry,
+ &chaintofree, CLUST_EOFE);
+ if (error) {
#ifdef MSDOSFS_DEBUG
printf("detrunc(): fatentry errors %d\n", error);
#endif
@@ -520,7 +534,8 @@ deextend(dep, length, cred)
if (count > 0) {
if (count > pmp->pm_freeclustercount)
return (ENOSPC);
- if (error = extendfile(dep, count, NULL, NULL, DE_CLEAR)) {
+ error = extendfile(dep, count, NULL, NULL, DE_CLEAR);
+ if (error) {
/* truncate the added clusters away again */
(void) detrunc(dep, dep->de_FileSize, 0, cred, NULL);
return (error);
@@ -540,8 +555,6 @@ void
reinsert(dep)
struct denode *dep;
{
- struct denode **depp, *deq;
-
/*
* Fix up the denode cache. If the denode is for a directory,
* there is nothing to do since the hash is based on the starting
@@ -557,11 +570,12 @@ reinsert(dep)
}
int
-msdosfs_reclaim(ap)
+msdosfs_reclaim(v)
+ void *v;
+{
struct vop_reclaim_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
extern int prtactive;
@@ -594,11 +608,12 @@ msdosfs_reclaim(ap)
}
int
-msdosfs_inactive(ap)
+msdosfs_inactive(v)
+ void *v;
+{
struct vop_inactive_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
int error;
diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c
index 3b2bdbce7d1..cae9ea9ae2b 100644
--- a/sys/msdosfs/msdosfs_fat.c
+++ b/sys/msdosfs/msdosfs_fat.c
@@ -1,4 +1,5 @@
-/* $NetBSD: msdosfs_fat.c,v 1.21 1995/11/05 18:47:53 ws Exp $ */
+/* $OpenBSD: msdosfs_fat.c,v 1.3 1996/02/29 10:46:53 niklas Exp $ */
+/* $NetBSD: msdosfs_fat.c,v 1.22 1996/02/09 19:13:45 christos Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@@ -85,6 +86,16 @@ int fc_largedistance; /* off by more than LMMAX */
/* Byte offset in FAT on filesystem pmp, cluster cn */
#define FATOFS(pmp, cn) (FAT12(pmp) ? (cn) * 3 / 2 : (cn) * 2)
+static void fatblock __P((struct msdosfsmount *, u_long, u_long *, u_long *,
+ u_long *));
+void updatefats __P((struct msdosfsmount *, struct buf *, u_long));
+static __inline void usemap_free __P((struct msdosfsmount *, u_long));
+static __inline void usemap_alloc __P((struct msdosfsmount *, u_long));
+static int fatchain __P((struct msdosfsmount *, u_long, u_long, u_long));
+int chainlength __P((struct msdosfsmount *, u_long, u_long));
+int chainalloc __P((struct msdosfsmount *, u_long, u_long, u_long, u_long *,
+ u_long *));
+
static void
fatblock(pmp, ofs, bnp, sizep, bop)
struct msdosfsmount *pmp;
@@ -136,7 +147,7 @@ pcbmap(dep, findcn, bnp, cnp, sp)
int error;
u_long i;
u_long cn;
- u_long prevcn;
+ u_long prevcn = 0; /* XXX: prevcn could be used unititialized */
u_long byteoffset;
u_long bn;
u_long bo;
@@ -213,8 +224,8 @@ pcbmap(dep, findcn, bnp, cnp, sp)
if (bn != bp_bn) {
if (bp)
brelse(bp);
- if (error = bread(pmp->pm_devvp, bn, bsize, NOCRED,
- &bp)) {
+ error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (error);
}
@@ -403,7 +414,8 @@ clusterfree(pmp, cluster, oldcnp)
int error;
u_long oldcn;
- if (error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE))
+ error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE);
+ if (error)
return (error);
/*
* If the cluster was successfully marked free, then update
@@ -480,7 +492,7 @@ fatentry(function, pmp, cn, oldcontents, newcontents)
byteoffset = FATOFS(pmp, cn);
fatblock(pmp, byteoffset, &bn, &bsize, &bo);
- if (error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp)) {
+ if ((error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp)) != 0) {
brelse(bp);
return (error);
}
@@ -551,7 +563,8 @@ fatchain(pmp, start, count, fillwith)
while (count > 0) {
byteoffset = FATOFS(pmp, start);
fatblock(pmp, byteoffset, &bn, &bsize, &bo);
- if (error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (error);
}
@@ -616,7 +629,7 @@ chainlength(pmp, start, count)
while (++idx <= max_idx) {
if (len >= count)
break;
- if (map = pmp->pm_inusemap[idx]) {
+ if ((map = pmp->pm_inusemap[idx]) != NULL) {
len += ffs(map) - 1;
break;
}
@@ -647,7 +660,7 @@ chainalloc(pmp, start, count, fillwith, retcluster, got)
{
int error;
- if (error = fatchain(pmp, start, count, fillwith))
+ if ((error = fatchain(pmp, start, count, fillwith)) != 0)
return (error);
#ifdef MSDOSFS_DEBUG
printf("clusteralloc(): allocated cluster chain at %d (%d clusters)\n",
@@ -683,7 +696,8 @@ clusteralloc(pmp, start, count, fillwith, retcluster, got)
u_long *got;
{
u_long idx;
- u_long len, newst, foundcn, foundl, cn, l;
+ u_long len, newst, foundl, cn, l;
+ u_long foundcn = 0; /* XXX: foundcn could be used unititialized */
u_int map;
#ifdef MSDOSFS_DEBUG
@@ -779,7 +793,8 @@ freeclusterchain(pmp, cluster)
if (lbn != bn) {
if (bp)
updatefats(pmp, bp, lbn);
- if (error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (error);
}
@@ -846,7 +861,8 @@ fillinusemap(pmp)
if (bp)
brelse(bp);
fatblock(pmp, byteoffset, &bn, &bsize, NULL);
- if (error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (error);
}
@@ -918,18 +934,20 @@ extendfile(dep, count, bpp, ncp, flags)
while (count > 0) {
/*
- * Allocate a new cluster chain and cat onto the end of the file.
- * If the file is empty we make de_StartCluster point to the new
- * block. Note that de_StartCluster being 0 is sufficient to be
- * sure the file is empty since we exclude attempts to extend the
- * root directory above, and the root dir is the only file with a
- * startcluster of 0 that has blocks allocated (sort of).
+ * Allocate a new cluster chain and cat onto the end of the
+ * file. * If the file is empty we make de_StartCluster point
+ * to the new block. Note that de_StartCluster being 0 is
+ * sufficient to be sure the file is empty since we exclude
+ * attempts to extend the root directory above, and the root
+ * dir is the only file with a startcluster of 0 that has
+ * blocks allocated (sort of).
*/
if (dep->de_StartCluster == 0)
cn = 0;
else
cn = dep->de_fc[FC_LASTFC].fc_fsrcn + 1;
- if (error = clusteralloc(pmp, cn, count, CLUST_EOFE, &cn, &got))
+ error = clusteralloc(pmp, cn, count, CLUST_EOFE, &cn, &got);
+ if (error)
return (error);
count -= got;
@@ -947,9 +965,10 @@ extendfile(dep, count, bpp, ncp, flags)
dep->de_StartCluster = cn;
frcn = 0;
} else {
- if (error = fatentry(FAT_SET, pmp,
- dep->de_fc[FC_LASTFC].fc_fsrcn,
- 0, cn)) {
+ error = fatentry(FAT_SET, pmp,
+ dep->de_fc[FC_LASTFC].fc_fsrcn,
+ 0, cn);
+ if (error) {
clusterfree(pmp, cn, NULL);
return (error);
}
diff --git a/sys/msdosfs/msdosfs_lookup.c b/sys/msdosfs/msdosfs_lookup.c
index cb6d7607a0b..91d2fa813f0 100644
--- a/sys/msdosfs/msdosfs_lookup.c
+++ b/sys/msdosfs/msdosfs_lookup.c
@@ -1,4 +1,5 @@
-/* $NetBSD: msdosfs_lookup.c,v 1.24 1995/11/30 19:00:57 ws Exp $ */
+/* $OpenBSD: msdosfs_lookup.c,v 1.3 1996/02/29 10:46:55 niklas Exp $ */
+/* $NetBSD: msdosfs_lookup.c,v 1.25 1996/02/09 19:13:47 christos Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@@ -48,6 +49,7 @@
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/buf.h>
#include <sys/vnode.h>
@@ -76,13 +78,14 @@
* memory denode's will be in synch.
*/
int
-msdosfs_lookup(ap)
+msdosfs_lookup(v)
+ void *v;
+{
struct vop_lookup_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *vdp = ap->a_dvp;
struct vnode **vpp = ap->a_vpp;
struct componentname *cnp = ap->a_cnp;
@@ -91,7 +94,7 @@ msdosfs_lookup(ap)
int lockparent;
int wantparent;
int slotcount;
- int slotoffset;
+ int slotoffset = 0;
int frcn;
u_long cluster;
int blkoff;
@@ -130,7 +133,7 @@ msdosfs_lookup(ap)
*/
if ((dp->de_Attributes & ATTR_DIRECTORY) == 0)
return (ENOTDIR);
- if (error = VOP_ACCESS(vdp, VEXEC, cnp->cn_cred, cnp->cn_proc))
+ if ((error = VOP_ACCESS(vdp, VEXEC, cnp->cn_cred, cnp->cn_proc)) != 0)
return (error);
/*
@@ -140,7 +143,7 @@ msdosfs_lookup(ap)
* check the name cache to see if the directory/name pair
* we are looking for is known already.
*/
- if (error = cache_lookup(vdp, vpp, cnp)) {
+ if ((error = cache_lookup(vdp, vpp, cnp)) != 0) {
int vpid;
if (error == ENOENT)
@@ -183,7 +186,7 @@ msdosfs_lookup(ap)
if (lockparent && pdp != vdp && (flags & ISLASTCN))
VOP_UNLOCK(pdp);
}
- if (error = VOP_LOCK(pdp))
+ if ((error = VOP_LOCK(pdp)) != 0)
return (error);
vdp = pdp;
dp = VTODE(vdp);
@@ -253,12 +256,13 @@ msdosfs_lookup(ap)
*/
diroff = 0;
for (frcn = 0;; frcn++) {
- if (error = pcbmap(dp, frcn, &bn, &cluster, &blsize)) {
+ if ((error = pcbmap(dp, frcn, &bn, &cluster, &blsize)) != 0) {
if (error == E2BIG)
break;
return (error);
}
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (error);
}
@@ -385,7 +389,8 @@ notfound:;
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
- if (error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc);
+ if (error)
return (error);
/*
* Return an indication of where the new directory
@@ -462,7 +467,8 @@ foundroot:;
/*
* Write access to directory required to delete files.
*/
- if (error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc);
+ if (error)
return (error);
/*
@@ -474,7 +480,7 @@ foundroot:;
*vpp = vdp;
return (0);
}
- if (error = deget(pmp, cluster, blkoff, &tdp))
+ if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0)
return (error);
*vpp = DETOV(tdp);
if (!lockparent)
@@ -490,7 +496,8 @@ foundroot:;
*/
if (nameiop == RENAME && wantparent &&
(flags & ISLASTCN)) {
- if (error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc);
+ if (error)
return (error);
/*
@@ -500,7 +507,7 @@ foundroot:;
if (dp->de_StartCluster == scn && isadir)
return (EISDIR);
- if (error = deget(pmp, cluster, blkoff, &tdp))
+ if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0)
return (error);
*vpp = DETOV(tdp);
cnp->cn_flags |= SAVENAME;
@@ -531,7 +538,7 @@ foundroot:;
pdp = vdp;
if (flags & ISDOTDOT) {
VOP_UNLOCK(pdp); /* race to get the inode */
- if (error = deget(pmp, cluster, blkoff, &tdp)) {
+ if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0) {
VOP_LOCK(pdp);
return (error);
}
@@ -545,7 +552,7 @@ foundroot:;
VREF(vdp); /* we want ourself, ie "." */
*vpp = vdp;
} else {
- if (error = deget(pmp, cluster, blkoff, &tdp))
+ if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0)
return (error);
if (!lockparent || !(flags & ISLASTCN))
VOP_UNLOCK(pdp);
@@ -599,7 +606,7 @@ createde(dep, ddep, depp, cnp)
diroffset = ddep->de_fndoffset + sizeof(struct direntry)
- ddep->de_FileSize;
dirclust = de_clcount(pmp, diroffset);
- if (error = extendfile(ddep, dirclust, 0, 0, DE_CLEAR))
+ if ((error = extendfile(ddep, dirclust, 0, 0, DE_CLEAR)) != 0)
return error;
/*
* Update the size of the directory
@@ -612,13 +619,14 @@ createde(dep, ddep, depp, cnp)
* entry in. Then write it to disk. NOTE: DOS directories
* do not get smaller as clusters are emptied.
*/
- if (error = pcbmap(ddep, de_cluster(pmp, ddep->de_fndoffset),
- &bn, &dirclust, &blsize))
+ error = pcbmap(ddep, de_cluster(pmp, ddep->de_fndoffset),
+ &bn, &dirclust, &blsize);
+ if (error)
return error;
diroffset = ddep->de_fndoffset;
if (dirclust != MSDOSFSROOT)
diroffset &= pmp->pm_crbomask;
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
+ if ((error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) != 0) {
brelse(bp);
return error;
}
@@ -637,16 +645,20 @@ createde(dep, ddep, depp, cnp)
while (--ddep->de_fndcnt >= 0) {
if (!(ddep->de_fndoffset & pmp->pm_crbomask)) {
- if (error = bwrite(bp))
+ if ((error = bwrite(bp)) != 0)
return error;
ddep->de_fndoffset -= sizeof(struct direntry);
- if (error = pcbmap(ddep,
- de_cluster(pmp, ddep->de_fndoffset),
- &bn, 0, &blsize))
+ error = pcbmap(ddep,
+ de_cluster(pmp,
+ ddep->de_fndoffset),
+ &bn, 0, &blsize);
+ if (error)
return error;
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, blsize,
+ NOCRED, &bp);
+ if (error) {
brelse(bp);
return error;
}
@@ -660,7 +672,7 @@ createde(dep, ddep, depp, cnp)
}
}
- if (error = bwrite(bp))
+ if ((error = bwrite(bp)) != 0)
return error;
/*
@@ -702,12 +714,13 @@ dosdirempty(dep)
* we hit end of file.
*/
for (cn = 0;; cn++) {
- if (error = pcbmap(dep, cn, &bn, 0, &blsize)) {
+ if ((error = pcbmap(dep, cn, &bn, 0, &blsize)) != 0) {
if (error == E2BIG)
return (1); /* it's empty */
return (0);
}
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (0);
}
@@ -791,8 +804,9 @@ doscheckpath(source, target)
}
pmp = dep->de_pmp;
scn = dep->de_StartCluster;
- if (error = bread(pmp->pm_devvp, cntobn(pmp, scn),
- pmp->pm_bpcluster, NOCRED, &bp))
+ error = bread(pmp->pm_devvp, cntobn(pmp, scn),
+ pmp->pm_bpcluster, NOCRED, &bp);
+ if (error)
break;
ep = (struct direntry *) bp->b_data + 1;
@@ -812,7 +826,7 @@ doscheckpath(source, target)
brelse(bp);
bp = NULL;
/* NOTE: deget() clears dep on error */
- if (error = deget(pmp, scn, 0, &dep))
+ if ((error = deget(pmp, scn, 0, &dep)) != 0)
break;
}
out:;
@@ -848,7 +862,7 @@ readep(pmp, dirclust, diroffset, bpp, epp)
&& de_blk(pmp, diroffset + blsize) > pmp->pm_rootdirsize)
blsize = de_bn2off(pmp, pmp->pm_rootdirsize) & pmp->pm_crbomask;
bn = detobn(pmp, dirclust, diroffset);
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, bpp)) {
+ if ((error = bread(pmp->pm_devvp, bn, blsize, NOCRED, bpp)) != 0) {
brelse(*bpp);
*bpp = NULL;
return (error);
@@ -902,9 +916,11 @@ removede(pdep, dep)
dep->de_refcnt--;
do {
- if (error = pcbmap(pdep, de_cluster(pmp, offset), &bn, 0, &blsize))
+ error = pcbmap(pdep, de_cluster(pmp, offset), &bn, 0, &blsize);
+ if (error);
return error;
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return error;
}
@@ -923,7 +939,7 @@ removede(pdep, dep)
|| ep->deAttributes != ATTR_WIN95)
break;
}
- if (error = bwrite(bp))
+ if ((error = bwrite(bp)) != 0)
return error;
} while (!(pmp->pm_flags & MSDOSFSMNT_NOWIN95)
&& offset
@@ -960,12 +976,13 @@ uniqdosname(dep, cnp, cp)
* Now look for a dir entry with this exact name
*/
for (cn = error = 0; !error; cn++) {
- if (error = pcbmap(dep, cn, &bn, 0, &blsize)) {
+ if ((error = pcbmap(dep, cn, &bn, 0, &blsize)) != 0) {
if (error == E2BIG) /* EOF reached and not found */
return 0;
return error;
}
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return error;
}
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 4f5ad67abf8..213f37c42ca 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,5 @@
-/* $NetBSD: msdosfs_vfsops.c,v 1.38 1996/01/21 16:35:29 fvdl Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.4 1996/02/29 10:46:57 niklas Exp $ */
+/* $NetBSD: msdosfs_vfsops.c,v 1.40 1996/02/11 22:48:16 ws Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@@ -69,6 +70,22 @@
#include <msdosfs/msdosfsmount.h>
#include <msdosfs/fat.h>
+int msdosfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *,
+ struct proc *));
+int msdosfs_start __P((struct mount *, int, struct proc *));
+int msdosfs_unmount __P((struct mount *, int, struct proc *));
+int msdosfs_root __P((struct mount *, struct vnode **));
+int msdosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
+int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
+int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
+int msdosfs_vget __P((struct mount *, ino_t, struct vnode **));
+int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+ struct vnode **, int *, struct ucred **));
+int msdosfs_vptofh __P((struct vnode *, struct fid *));
+
+int msdosfs_mountfs __P((struct vnode *, struct mount *, struct proc *,
+ struct msdosfs_args *));
+
/*
* 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
@@ -84,12 +101,14 @@ msdosfs_mount(mp, path, data, ndp, p)
{
struct vnode *devvp; /* vnode for blk device to mount */
struct msdosfs_args args; /* will hold data from mount request */
- struct msdosfsmount *pmp; /* msdosfs specific mount control block */
+ /* msdosfs specific mount control block */
+ struct msdosfsmount *pmp = NULL;
size_t size;
int error, flags;
mode_t accessmode;
- if (error = copyin(data, (caddr_t)&args, sizeof(struct msdosfs_args)))
+ error = copyin(data, (caddr_t)&args, sizeof(struct msdosfs_args));
+ if (error)
return (error);
/*
* If updating, check whether changing from read-only to
@@ -120,8 +139,9 @@ msdosfs_mount(mp, path, data, ndp, p)
if (p->p_ucred->cr_uid != 0) {
devvp = pmp->pm_devvp;
VOP_LOCK(devvp);
- if (error = VOP_ACCESS(devvp, VREAD | VWRITE,
- p->p_ucred, p)) {
+ error = VOP_ACCESS(devvp, VREAD | VWRITE,
+ p->p_ucred, p);
+ if (error) {
VOP_UNLOCK(devvp);
return (error);
}
@@ -149,7 +169,7 @@ msdosfs_mount(mp, path, data, ndp, p)
* and verify that it refers to a sensible block device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
- if (error = namei(ndp))
+ if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@@ -170,7 +190,8 @@ msdosfs_mount(mp, path, data, ndp, p)
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
VOP_LOCK(devvp);
- if (error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p)) {
+ error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p);
+ if (error) {
vput(devvp);
return (error);
}
@@ -208,7 +229,7 @@ msdosfs_mount(mp, path, data, ndp, p)
/*
* Try to divine whether to support Win'95 long filenames
*/
- if (error = msdosfs_root(mp, &rootvp)) {
+ if ((error = msdosfs_root(mp, &rootvp)) != 0) {
msdosfs_unmount(mp, MNT_FORCE, p);
return (error);
}
@@ -245,7 +266,7 @@ msdosfs_mountfs(devvp, mp, p, argp)
extern struct vnode *rootvp;
u_int8_t SecPerClust;
int ronly, error;
- int bsize, dtype, tmp;
+ int bsize = 0, dtype = 0, tmp;
/*
* Disallow multiple mounts of the same device.
@@ -253,15 +274,16 @@ msdosfs_mountfs(devvp, mp, p, argp)
* (except for root, which might share swap device for miniroot).
* Flush out any old buffers remaining from a previous use.
*/
- if (error = vfs_mountedon(devvp))
+ if ((error = vfs_mountedon(devvp)) != 0)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
- if (error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0))
+ if ((error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0)) != 0)
return (error);
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
- if (error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p))
+ error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p);
+ if (error)
return (error);
bp = NULL; /* both used in error_exit */
@@ -278,8 +300,9 @@ msdosfs_mountfs(devvp, mp, p, argp)
* that the size of a disk block will always be 512 bytes.
* Let's check it...
*/
- if (error = VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart,
- FREAD, NOCRED, p))
+ error = VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart,
+ FREAD, NOCRED, p);
+ if (error)
goto error_exit;
tmp = dpart.part->p_fstype;
dtype = dpart.disklab->d_type;
@@ -294,7 +317,7 @@ msdosfs_mountfs(devvp, mp, p, argp)
* Read the boot sector of the filesystem, and then check the
* boot signature. If not a dos boot sector then error out.
*/
- if (error = bread(devvp, 0, 512, NOCRED, &bp))
+ if ((error = bread(devvp, 0, 512, NOCRED, &bp)) != 0)
goto error_exit;
bp->b_flags |= B_AGE;
bsp = (union bootsector *)bp->b_data;
@@ -396,21 +419,24 @@ msdosfs_mountfs(devvp, mp, p, argp)
&& ((pmp->pm_Heads == 1) || (pmp->pm_Heads == 2))))
)
pmp->pm_fatentrysize = 12;
- else pmp->pm_fatentrysize = 16;
- }
- else {
- if (pmp->pm_maxcluster <= 4086)
+ else
+ pmp->pm_fatentrysize = 16;
+ } else {
+ if (pmp->pm_maxcluster
+ <= ((CLUST_RSRVS - CLUST_FIRST) & FAT12_MASK))
/*
* This will usually be a floppy disk. This size makes
* sure that one fat entry will not be split across
* multiple blocks.
*/
pmp->pm_fatentrysize = 12;
- else pmp->pm_fatentrysize = 16;
+ else
+ pmp->pm_fatentrysize = 16;
}
- if(FAT12(pmp))
+ if (FAT12(pmp))
pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
- else pmp->pm_fatblocksize = MAXBSIZE;
+ else
+ pmp->pm_fatblocksize = MAXBSIZE;
pmp->pm_fatblocksec = pmp->pm_fatblocksize / pmp->pm_BytesPerSec;
pmp->pm_bnshift = ffs(pmp->pm_BytesPerSec) - 1;
@@ -456,7 +482,7 @@ msdosfs_mountfs(devvp, mp, p, argp)
/*
* Have the inuse map filled in.
*/
- if (error = fillinusemap(pmp))
+ if ((error = fillinusemap(pmp)) != 0)
goto error_exit;
/*
@@ -532,7 +558,7 @@ msdosfs_unmount(mp, mntflags, p)
flags |= FORCECLOSE;
#ifdef QUOTA
#endif
- if (error = vflush(mp, NULLVP, flags))
+ if ((error = vflush(mp, NULLVP, flags)) != 0)
return (error);
pmp = VFSTOMSDOSFS(mp);
pmp->pm_devvp->v_specflags &= ~SI_MOUNTEDON;
@@ -572,7 +598,7 @@ msdosfs_root(mp, vpp)
printf("msdosfs_root(); mp %08x, pmp %08x, ndep %08x, vp %08x\n",
mp, pmp, ndep, DETOV(ndep));
#endif
- if (error = deget(pmp, MSDOSFSROOT, MSDOSFSROOT_OFS, &ndep))
+ if ((error = deget(pmp, MSDOSFSROOT, MSDOSFSROOT_OFS, &ndep)) != 0)
return (error);
*vpp = DETOV(ndep);
return (0);
@@ -667,14 +693,14 @@ loop:
continue;
if (vget(vp, 1))
goto loop;
- if (error = VOP_FSYNC(vp, cred, waitfor, p))
+ if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0)
allerror = error;
vput(vp);
}
/*
* Force stale file system control information to be flushed.
*/
- if (error = VOP_FSYNC(pmp->pm_devvp, cred, waitfor, p))
+ if ((error = VOP_FSYNC(pmp->pm_devvp, cred, waitfor, p)) != 0)
allerror = error;
#ifdef QUOTA
#endif
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index 98f3a1e34ef..f3d2523038f 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -1,4 +1,5 @@
-/* $NetBSD: msdosfs_vnops.c,v 1.43 1995/12/01 07:26:58 mycroft Exp $ */
+/* $OpenBSD: msdosfs_vnops.c,v 1.3 1996/02/29 10:46:59 niklas Exp $ */
+/* $NetBSD: msdosfs_vnops.c,v 1.46 1996/02/09 19:13:53 christos Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@@ -58,11 +59,14 @@
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/vnode.h>
+#include <sys/signalvar.h>
#include <miscfs/specfs/specdev.h> /* XXX */ /* defines v_rdev */
#include <sys/malloc.h>
#include <sys/dir.h> /* defines dirent structure */
#include <sys/lockf.h>
+#include <vm/vm.h>
+
#include <msdosfs/bpb.h>
#include <msdosfs/direntry.h>
#include <msdosfs/denode.h>
@@ -94,14 +98,15 @@
* only if the SAVESTART bit in cn_flags is clear on success.
*/
int
-msdosfs_create(ap)
+msdosfs_create(v)
+ void *v;
+{
struct vop_create_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
- } */ *ap;
-{
+ } */ *ap = v;
struct componentname *cnp = ap->a_cnp;
struct denode ndirent;
struct denode *dep;
@@ -134,7 +139,7 @@ msdosfs_create(ap)
panic("msdosfs_create: no name");
#endif
bzero(&ndirent, sizeof(ndirent));
- if (error = uniqdosname(pdep, cnp, ndirent.de_Name))
+ if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0)
goto bad;
ndirent.de_Attributes = (ap->a_vap->va_mode & VWRITE) ?
@@ -146,7 +151,7 @@ msdosfs_create(ap)
ndirent.de_pmp = pdep->de_pmp;
ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
DE_TIMES(&ndirent);
- if (error = createde(&ndirent, pdep, &dep, cnp))
+ if ((error = createde(&ndirent, pdep, &dep, cnp)) != 0)
goto bad;
if ((cnp->cn_flags & SAVESTART) == 0)
FREE(cnp->cn_pnbuf, M_NAMEI);
@@ -161,15 +166,15 @@ bad:
}
int
-msdosfs_mknod(ap)
+msdosfs_mknod(v)
+ void *v;
+{
struct vop_mknod_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
- } */ *ap;
-{
- int error;
+ } */ *ap = v;
switch (ap->a_vap->va_type) {
case VDIR:
@@ -189,27 +194,31 @@ msdosfs_mknod(ap)
}
int
-msdosfs_open(ap)
+msdosfs_open(v)
+ void *v;
+{
+#if 0
struct vop_open_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
} */ *ap;
-{
+#endif
return (0);
}
int
-msdosfs_close(ap)
+msdosfs_close(v)
+ void *v;
+{
struct vop_close_args /* {
struct vnode *a_vp;
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
@@ -219,14 +228,15 @@ msdosfs_close(ap)
}
int
-msdosfs_access(ap)
+msdosfs_access(v)
+ void *v;
+{
struct vop_access_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
struct denode *dep = VTODE(ap->a_vp);
struct msdosfsmount *pmp = dep->de_pmp;
mode_t dosmode;
@@ -241,14 +251,15 @@ msdosfs_access(ap)
}
int
-msdosfs_getattr(ap)
+msdosfs_getattr(v)
+ void *v;
+{
struct vop_getattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
u_int cn;
struct denode *dep = VTODE(ap->a_vp);
struct vattr *vap = ap->a_vap;
@@ -300,14 +311,15 @@ msdosfs_getattr(ap)
}
int
-msdosfs_setattr(ap)
+msdosfs_setattr(v)
+ void *v;
+{
struct vop_setattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
int error = 0;
struct denode *dep = VTODE(ap->a_vp);
struct vattr *vap = ap->a_vap;
@@ -340,19 +352,20 @@ msdosfs_setattr(ap)
return EISDIR;
if (vap->va_size != VNOVAL) {
- if (error = detrunc(dep, (u_long)vap->va_size, 0, cred, ap->a_p))
+ error = detrunc(dep, (u_long)vap->va_size, 0, cred, ap->a_p);
+ if (error)
return (error);
}
- if (vap->va_atime.ts_sec != VNOVAL || vap->va_mtime.ts_sec != VNOVAL) {
+ if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
if (cred->cr_uid != dep->de_pmp->pm_uid &&
(error = suser(cred, &ap->a_p->p_acflag)) &&
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
(error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_p))))
return (error);
if (!(dep->de_pmp->pm_flags & MSDOSFSMNT_NOWIN95)
- && vap->va_atime.ts_sec != VNOVAL)
+ && vap->va_atime.tv_sec != VNOVAL)
unix2dostime(&vap->va_atime, &dep->de_ADate, &dep->de_ATime);
- if (vap->va_mtime.ts_sec != VNOVAL)
+ if (vap->va_mtime.tv_sec != VNOVAL)
unix2dostime(&vap->va_mtime, &dep->de_MDate, &dep->de_MTime);
dep->de_Attributes |= ATTR_ARCHIVE;
dep->de_flag |= DE_MODIFIED;
@@ -390,14 +403,15 @@ msdosfs_setattr(ap)
}
int
-msdosfs_read(ap)
+msdosfs_read(v)
+ void *v;
+{
struct vop_read_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
int error = 0;
int diff;
int blsize;
@@ -472,19 +486,20 @@ msdosfs_read(ap)
* Write data to a file or directory.
*/
int
-msdosfs_write(ap)
+msdosfs_write(v)
+ void *v;
+{
struct vop_write_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
int n;
int croffset;
int resid;
u_long osize;
- int error;
+ int error = 0;
u_long count;
daddr_t bn, lastcn;
struct buf *bp;
@@ -539,7 +554,7 @@ msdosfs_write(ap)
* with zeroed blocks.
*/
if (uio->uio_offset > dep->de_FileSize) {
- if (error = deextend(dep, uio->uio_offset, cred))
+ if ((error = deextend(dep, uio->uio_offset, cred)) != 0)
return (error);
}
@@ -585,9 +600,10 @@ msdosfs_write(ap)
* for the fat table. (see msdosfs_strategy)
*/
if (bp->b_blkno == bp->b_lblkno) {
- if (error = pcbmap(dep,
- de_bn2cn(pmp, bp->b_lblkno),
- &bp->b_blkno, 0, 0))
+ error = pcbmap(dep,
+ de_bn2cn(pmp, bp->b_lblkno),
+ &bp->b_blkno, 0, 0);
+ if (error)
bp->b_blkno = -1;
}
if (bp->b_blkno == -1) {
@@ -600,7 +616,9 @@ msdosfs_write(ap)
/*
* The block we need to write into exists, so read it in.
*/
- if (error = bread(thisvp, bn, pmp->pm_bpcluster, NOCRED, &bp)) {
+ error = bread(thisvp, bn, pmp->pm_bpcluster,
+ NOCRED, &bp);
+ if (error) {
brelse(bp);
break;
}
@@ -660,7 +678,10 @@ errexit:
}
int
-msdosfs_ioctl(ap)
+msdosfs_ioctl(v)
+ void *v;
+{
+#if 0
struct vop_ioctl_args /* {
struct vnode *a_vp;
u_long a_command;
@@ -669,13 +690,16 @@ msdosfs_ioctl(ap)
struct ucred *a_cred;
struct proc *a_p;
} */ *ap;
-{
+#endif
return (ENOTTY);
}
int
-msdosfs_select(ap)
+msdosfs_select(v)
+ void *v;
+{
+#if 0
struct vop_select_args /* {
struct vnode *a_vp;
int a_which;
@@ -683,20 +707,23 @@ msdosfs_select(ap)
struct ucred *a_cred;
struct proc *a_p;
} */ *ap;
-{
+#endif
return (1); /* DOS filesystems never block? */
}
int
-msdosfs_mmap(ap)
+msdosfs_mmap(v)
+ void *v;
+{
+#if 0
struct vop_mmap_args /* {
struct vnode *a_vp;
int a_fflags;
struct ucred *a_cred;
struct proc *a_p;
} */ *ap;
-{
+#endif
return (EINVAL);
}
@@ -708,14 +735,15 @@ msdosfs_mmap(ap)
* could just do a sync if they try an fsync on a directory file.
*/
int
-msdosfs_fsync(ap)
+msdosfs_fsync(v)
+ void *v;
+{
struct vop_fsync_args /* {
struct vnode *a_vp;
struct ucred *a_cred;
int a_waitfor;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *vp = ap->a_vp;
vflushbuf(vp, ap->a_waitfor == MNT_WAIT);
@@ -727,26 +755,30 @@ msdosfs_fsync(ap)
* So nothing to do here.
*/
int
-msdosfs_seek(ap)
+msdosfs_seek(v)
+ void *v;
+{
+#if 0
struct vop_seek_args /* {
struct vnode *a_vp;
off_t a_oldoff;
off_t a_newoff;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
+#endif
return (0);
}
int
-msdosfs_remove(ap)
+msdosfs_remove(v)
+ void *v;
+{
struct vop_remove_args /* {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
struct denode *dep = VTODE(ap->a_vp);
struct denode *ddep = VTODE(ap->a_dvp);
int error;
@@ -770,16 +802,17 @@ msdosfs_remove(ap)
* have to free it before we return the error.
*/
int
-msdosfs_link(ap)
+msdosfs_link(v)
+ void *v;
+{
struct vop_link_args /* {
+ struct vnode *a_dvp;
struct vnode *a_vp;
- struct vnode *a_tdvp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
- VOP_ABORTOP(ap->a_vp, ap->a_cnp);
- vput(ap->a_vp);
+ VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
+ vput(ap->a_dvp);
return (EOPNOTSUPP);
}
@@ -837,7 +870,9 @@ msdosfs_link(ap)
* for each rename done.
*/
int
-msdosfs_rename(ap)
+msdosfs_rename(v)
+ void *v;
+{
struct vop_rename_args /* {
struct vnode *a_fdvp;
struct vnode *a_fvp;
@@ -845,8 +880,7 @@ msdosfs_rename(ap)
struct vnode *a_tdvp;
struct vnode *a_tvp;
struct componentname *a_tcnp;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *tvp = ap->a_tvp;
register struct vnode *tdvp = ap->a_tdvp;
struct vnode *fvp = ap->a_fvp;
@@ -863,7 +897,6 @@ msdosfs_rename(ap)
daddr_t bn;
struct msdosfsmount *pmp;
struct direntry *dotdotp;
- struct direntry *ep;
struct buf *bp;
pmp = VFSTOMSDOSFS(fdvp->v_mount);
@@ -898,11 +931,11 @@ abortit:
* into the denode and directory entry for the destination
* file/directory.
*/
- if (error = uniqdosname(VTODE(tdvp), tcnp, toname))
+ if ((error = uniqdosname(VTODE(tdvp), tcnp, toname)) != 0)
goto abortit;
/* */
- if (error = VOP_LOCK(fvp))
+ if ((error = VOP_LOCK(fvp)) != 0)
goto abortit;
dp = VTODE(fdvp);
ip = VTODE(fvp);
@@ -964,11 +997,11 @@ abortit:
* doscheckpath() vput()'s dp,
* so we have to do a relookup afterwards
*/
- if (error = doscheckpath(ip, dp))
+ if ((error = doscheckpath(ip, dp)) != 0)
goto out;
if ((tcnp->cn_flags & SAVESTART) == 0)
panic("msdosfs_rename: lost to startdir");
- if (error = relookup(tdvp, &tvp, tcnp))
+ if ((error = relookup(tdvp, &tvp, tcnp)) != 0)
goto out;
dp = VTODE(tdvp);
xp = tvp ? VTODE(tvp) : NULL;
@@ -994,7 +1027,7 @@ abortit:
error = EISDIR;
goto bad;
}
- if (error = removede(dp, xp))
+ if ((error = removede(dp, xp)) != 0)
goto bad;
vput(tvp);
xp = NULL;
@@ -1059,7 +1092,8 @@ abortit:
bcopy(toname, ip->de_Name, 11); /* update denode */
dp->de_fndoffset = to_diroffset;
dp->de_fndcnt = to_count;
- if (error = createde(ip, dp, (struct denode **)0, tcnp)) {
+ error = createde(ip, dp, (struct denode **)0, tcnp);
+ if (error) {
bcopy(oldname, ip->de_Name, 11);
if (newparent)
VOP_UNLOCK(fdvp);
@@ -1068,7 +1102,7 @@ abortit:
}
ip->de_refcnt++;
zp->de_fndoffset = from_diroffset;
- if (error = removede(zp, ip)) {
+ if ((error = removede(zp, ip)) != 0) {
/* XXX should really panic here, fs is corrupt */
if (newparent)
VOP_UNLOCK(fdvp);
@@ -1076,8 +1110,9 @@ abortit:
goto bad;
}
if (!doingdirectory) {
- if (error = pcbmap(dp, de_cluster(pmp, to_diroffset), 0,
- &ip->de_dirclust, 0)) {
+ error = pcbmap(dp, de_cluster(pmp, to_diroffset), 0,
+ &ip->de_dirclust, 0);
+ if (error) {
/* XXX should really panic here, fs is corrupt */
if (newparent)
VOP_UNLOCK(fdvp);
@@ -1103,8 +1138,9 @@ abortit:
panic("msdosfs_rename: updating .. in root directory?\n");
} else
bn = cntobn(pmp, cn);
- if (error = bread(pmp->pm_devvp, bn, pmp->pm_bpcluster, NOCRED,
- &bp)) {
+ error = bread(pmp->pm_devvp, bn, pmp->pm_bpcluster,
+ NOCRED, &bp);
+ if (error) {
/* XXX should really panic here, fs is corrupt */
brelse(bp);
VOP_UNLOCK(fvp);
@@ -1112,7 +1148,7 @@ abortit:
}
dotdotp = (struct direntry *)bp->b_data + 1;
putushort(dotdotp->deStartCluster, dp->de_StartCluster);
- if (error = bwrite(bp)) {
+ if ((error = bwrite(bp)) != 0) {
/* XXX should really panic here, fs is corrupt */
VOP_UNLOCK(fvp);
goto bad;
@@ -1136,29 +1172,36 @@ struct {
struct direntry dot;
struct direntry dotdot;
} dosdirtemplate = {
- ". ", " ", /* the . entry */
- ATTR_DIRECTORY, /* file attribute */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* resevered */
- 210, 4, 210, 4, /* time and date */
- 0, 0, /* startcluster */
- 0, 0, 0, 0, /* filesize */
- ".. ", " ", /* the .. entry */
- ATTR_DIRECTORY, /* file attribute */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* resevered */
- 210, 4, 210, 4, /* time and date */
- 0, 0, /* startcluster */
- 0, 0, 0, 0, /* filesize */
+ { ". ", " ", /* the . entry */
+ ATTR_DIRECTORY, /* file attribute */
+ { 0, 0 }, /* reserved */
+ { 0, 0 }, { 0, 0 }, /* create time & date */
+ { 0, 0 }, { 0, 0 }, /* access time & date */
+ { 210, 4 }, { 210, 4 }, /* modify time & date */
+ { 0, 0 }, /* startcluster */
+ { 0, 0, 0, 0 } /* filesize */
+ },
+ { ".. ", " ", /* the .. entry */
+ ATTR_DIRECTORY, /* file attribute */
+ { 0, 0 }, /* reserved */
+ { 0, 0 }, { 0, 0 }, /* create time & date */
+ { 0, 0 }, { 0, 0 }, /* access time & date */
+ { 210, 4 }, { 210, 4 }, /* modify time & date */
+ { 0, 0 }, /* startcluster */
+ { 0, 0, 0, 0 } /* filesize */
+ }
};
int
-msdosfs_mkdir(ap)
+msdosfs_mkdir(v)
+ void *v;
+{
struct vop_mkdir_args /* {
struct vnode *a_dvp;
struvt vnode **a_vpp;
struvt componentname *a_cnp;
struct vattr *a_vap;
- } */ *ap;
-{
+ } */ *ap = v;
struct componentname *cnp = ap->a_cnp;
struct denode ndirent;
struct denode *dep;
@@ -1184,7 +1227,8 @@ msdosfs_mkdir(ap)
/*
* Allocate a cluster to hold the about to be created directory.
*/
- if (error = clusteralloc(pmp, 0, 1, CLUST_EOFE, &newcluster, NULL))
+ error = clusteralloc(pmp, 0, 1, CLUST_EOFE, &newcluster, NULL);
+ if (error)
goto bad2;
bzero(&ndirent, sizeof(ndirent));
@@ -1219,7 +1263,7 @@ msdosfs_mkdir(ap)
putushort(denp[1].deATime, ndirent.de_ATime);
putushort(denp[1].deMDate, ndirent.de_MDate);
putushort(denp[1].deMTime, ndirent.de_MTime);
- if (error = bwrite(bp))
+ if ((error = bwrite(bp)) != 0)
goto bad;
/*
@@ -1231,7 +1275,7 @@ msdosfs_mkdir(ap)
if ((cnp->cn_flags & HASBUF) == 0)
panic("msdosfs_mkdir: no name");
#endif
- if (error = uniqdosname(pdep, cnp, ndirent.de_Name))
+ if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0)
goto bad;
ndirent.de_Attributes = ATTR_DIRECTORY;
@@ -1239,7 +1283,7 @@ msdosfs_mkdir(ap)
ndirent.de_FileSize = 0;
ndirent.de_dev = pdep->de_dev;
ndirent.de_devvp = pdep->de_devvp;
- if (error = createde(&ndirent, pdep, &dep, cnp))
+ if ((error = createde(&ndirent, pdep, &dep, cnp)) != 0)
goto bad;
if ((cnp->cn_flags & SAVESTART) == 0)
FREE(cnp->cn_pnbuf, M_NAMEI);
@@ -1256,13 +1300,14 @@ bad2:
}
int
-msdosfs_rmdir(ap)
+msdosfs_rmdir(v)
+ void *v;
+{
struct vop_rmdir_args /* {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct vnode *dvp = ap->a_dvp;
register struct componentname *cnp = ap->a_cnp;
@@ -1299,7 +1344,7 @@ msdosfs_rmdir(ap)
* up access and eventually msdosfs_reclaim() will be called which
* will remove it from the denode cache.
*/
- if (error = removede(dp, ip))
+ if ((error = removede(dp, ip)) != 0)
goto out;
/*
* This is where we decrement the link count in the parent
@@ -1325,25 +1370,26 @@ out:
* DOS filesystems don't know what symlinks are.
*/
int
-msdosfs_symlink(ap)
+msdosfs_symlink(v)
+ void *v;
+{
struct vop_symlink_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
char *a_target;
- } */ *ap;
-{
- register struct vnode *dvp = ap->a_dvp;
- register struct componentname *cnp = ap->a_cnp;
+ } */ *ap = v;
- FREE(cnp->cn_pnbuf, M_NAMEI);
- vput(dvp);
- return (EINVAL);
+ VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
+ vput(ap->a_dvp);
+ return (EOPNOTSUPP);
}
int
-msdosfs_readdir(ap)
+msdosfs_readdir(v)
+ void *v;
+{
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
@@ -1351,8 +1397,7 @@ msdosfs_readdir(ap)
int *a_eofflag;
u_long *a_cookies;
int a_ncookies;
- } */ *ap;
-{
+ } */ *ap = v;
int error = 0;
int diff;
long n;
@@ -1369,7 +1414,6 @@ msdosfs_readdir(ap)
struct msdosfsmount *pmp = dep->de_pmp;
struct direntry *dentp;
struct dirent dirbuf;
- int i = 0;
struct uio *uio = ap->a_uio;
u_long *cookies;
int ncookies;
@@ -1442,7 +1486,9 @@ msdosfs_readdir(ap)
dirbuf.d_reclen = DIRSIZ(&dirbuf);
if (uio->uio_resid < dirbuf.d_reclen)
goto out;
- if (error = uiomove(&dirbuf, dirbuf.d_reclen, uio))
+ error = uiomove((caddr_t) &dirbuf,
+ dirbuf.d_reclen, uio);
+ if (error)
goto out;
offset += sizeof(struct direntry);
if (cookies) {
@@ -1462,9 +1508,10 @@ msdosfs_readdir(ap)
if (diff <= 0)
break;
n = min(n, diff);
- if (error = pcbmap(dep, lbn, &bn, &cn, &blsize))
+ if ((error = pcbmap(dep, lbn, &bn, &cn, &blsize)) != 0)
break;
- if (error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
+ error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp);
+ if (error) {
brelse(bp);
return (error);
}
@@ -1548,7 +1595,9 @@ msdosfs_readdir(ap)
brelse(bp);
goto out;
}
- if (error = uiomove(&dirbuf, dirbuf.d_reclen, uio)) {
+ error = uiomove((caddr_t) &dirbuf,
+ dirbuf.d_reclen, uio);
+ if (error) {
brelse(bp);
goto out;
}
@@ -1577,24 +1626,28 @@ out:
* DOS filesystems don't know what symlinks are.
*/
int
-msdosfs_readlink(ap)
+msdosfs_readlink(v)
+ void *v;
+{
+#if 0
struct vop_readlink_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
} */ *ap;
-{
+#endif
return (EINVAL);
}
int
-msdosfs_abortop(ap)
+msdosfs_abortop(v)
+ void *v;
+{
struct vop_abortop_args /* {
struct vnode *a_dvp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
@@ -1602,11 +1655,12 @@ msdosfs_abortop(ap)
}
int
-msdosfs_lock(ap)
+msdosfs_lock(v)
+ void *v;
+{
struct vop_lock_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct denode *dep;
struct proc *p = curproc; /* XXX */
@@ -1648,11 +1702,12 @@ start:
}
int
-msdosfs_unlock(ap)
+msdosfs_unlock(v)
+ void *v;
+{
struct vop_unlock_args /* {
struct vnode *vp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct denode *dep = VTODE(ap->a_vp);
struct proc *p = curproc; /* XXX */
@@ -1676,11 +1731,12 @@ msdosfs_unlock(ap)
}
int
-msdosfs_islocked(ap)
+msdosfs_islocked(v)
+ void *v;
+{
struct vop_islocked_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
if (VTODE(ap->a_vp)->de_flag & DE_LOCKED)
return (1);
@@ -1695,15 +1751,16 @@ msdosfs_islocked(ap)
* bnp - address of where to return the filesystem relative block number
*/
int
-msdosfs_bmap(ap)
+msdosfs_bmap(v)
+ void *v;
+{
struct vop_bmap_args /* {
struct vnode *a_vp;
daddr_t a_bn;
struct vnode **a_vpp;
daddr_t *a_bnp;
int *a_runp;
- } */ *ap;
-{
+ } */ *ap = v;
struct denode *dep = VTODE(ap->a_vp);
struct msdosfsmount *pmp = dep->de_pmp;
@@ -1721,23 +1778,27 @@ msdosfs_bmap(ap)
}
int
-msdosfs_reallocblks(ap)
+msdosfs_reallocblks(v)
+ void *v;
+{
+#if 0
struct vop_reallocblks_args /* {
struct vnode *a_vp;
struct cluster_save *a_buflist;
- } */ *ap;
-{
+ } */ *ap = v;
+#endif
/* Currently no support for clustering */ /* XXX */
return (ENOSPC);
}
int
-msdosfs_strategy(ap)
+msdosfs_strategy(v)
+ void *v;
+{
struct vop_strategy_args /* {
struct buf *a_bp;
- } */ *ap;
-{
+ } */ *ap = v;
struct buf *bp = ap->a_bp;
struct denode *dep = VTODE(bp->b_vp);
struct vnode *vp;
@@ -1752,8 +1813,9 @@ msdosfs_strategy(ap)
* don't allow files with holes, so we shouldn't ever see this.
*/
if (bp->b_blkno == bp->b_lblkno) {
- if (error = pcbmap(dep, de_bn2cn(dep->de_pmp, bp->b_lblkno),
- &bp->b_blkno, 0, 0))
+ error = pcbmap(dep, de_bn2cn(dep->de_pmp, bp->b_lblkno),
+ &bp->b_blkno, 0, 0);
+ if (error)
bp->b_blkno = -1;
if (bp->b_blkno == -1)
clrbuf(bp);
@@ -1775,11 +1837,12 @@ msdosfs_strategy(ap)
}
int
-msdosfs_print(ap)
+msdosfs_print(v)
+ void *v;
+{
struct vop_print_args /* {
struct vnode *vp;
- } */ *ap;
-{
+ } */ *ap = v;
struct denode *dep = VTODE(ap->a_vp);
printf("tag VT_MSDOSFS, startcluster %d, dircluster %d, diroffset %d ",
@@ -1795,18 +1858,20 @@ msdosfs_print(ap)
printf("\n");
}
#endif
+ return (0);
}
int
-msdosfs_advlock(ap)
+msdosfs_advlock(v)
+ void *v;
+{
struct vop_advlock_args /* {
struct vnode *a_vp;
caddr_t a_id;
int a_op;
struct flock *a_fl;
int a_flags;
- } */ *ap;
-{
+ } */ *ap = v;
register struct denode *dep = VTODE(ap->a_vp);
return (lf_advlock(&dep->de_lockf, dep->de_FileSize, ap->a_id, ap->a_op,
@@ -1814,13 +1879,14 @@ msdosfs_advlock(ap)
}
int
-msdosfs_pathconf(ap)
+msdosfs_pathconf(v)
+ void *v;
+{
struct vop_pathconf_args /* {
struct vnode *a_vp;
int a_name;
register_t *a_retval;
- } */ *ap;
-{
+ } */ *ap = v;
struct msdosfsmount *pmp = VTODE(ap->a_vp)->de_pmp;
switch (ap->a_name) {
@@ -1846,7 +1912,7 @@ msdosfs_pathconf(ap)
}
/* Global vfs data structures for msdosfs */
-int (**msdosfs_vnodeop_p)();
+int (**msdosfs_vnodeop_p) __P((void *));
struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = {
{ &vop_default_desc, vn_default_error },
{ &vop_lookup_desc, msdosfs_lookup }, /* lookup */
@@ -1886,7 +1952,7 @@ struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = {
{ &vop_advlock_desc, msdosfs_advlock }, /* advlock */
{ &vop_reallocblks_desc, msdosfs_reallocblks }, /* reallocblks */
{ &vop_bwrite_desc, vn_bwrite },
- { (struct vnodeop_desc *)NULL, (int (*)())NULL }
+ { (struct vnodeop_desc *)NULL, (int (*) __P((void *)))NULL }
};
struct vnodeopv_desc msdosfs_vnodeop_opv_desc =
{ &msdosfs_vnodeop_p, msdosfs_vnodeop_entries };
diff --git a/sys/msdosfs/msdosfsmount.h b/sys/msdosfs/msdosfsmount.h
index fbe00aa6170..60720387479 100644
--- a/sys/msdosfs/msdosfsmount.h
+++ b/sys/msdosfs/msdosfsmount.h
@@ -1,4 +1,5 @@
-/* $NetBSD: msdosfsmount.h,v 1.13 1996/01/19 14:28:31 leo Exp $ */
+/* $OpenBSD: msdosfsmount.h,v 1.4 1996/02/29 10:47:02 niklas Exp $ */
+/* $NetBSD: msdosfsmount.h,v 1.14 1996/02/09 19:13:56 christos Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@@ -82,10 +83,14 @@ struct msdosfsmount {
/*
* Mount point flags:
*/
-/*#define MSDOSFSMNT_SHORTNAME 1 /* Defined in <sys/mount.h> */
-/*#define MSDOSFSMNT_LONGNAME 2 */
-/*#define MSDOSFSMNT_NOWIN95 4 */
-/*#define MSDOSFSMNT_GEMDOSFS 8 */
+#if 0
+ /* Defined in <sys/mount.h> */
+#define MSDOSFSMNT_SHORTNAME 1
+#define MSDOSFSMNT_LONGNAME 2
+#define MSDOSFSMNT_NOWIN95 4
+#define MSDOSFSMNT_GEMDOSFS 8
+#endif
+
/* All flags above: */
#define MSDOSFSMNT_MNTOPT \
(MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95 \
@@ -194,4 +199,4 @@ int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **));
int msdosfs_vptofh __P((struct vnode *, struct fid *));
-int msdosfs_init __P(());
+void msdosfs_init __P((void));