summaryrefslogtreecommitdiffstats
path: root/sys/fs/coda/coda_vfsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/coda/coda_vfsops.c')
-rw-r--r--sys/fs/coda/coda_vfsops.c281
1 files changed, 58 insertions, 223 deletions
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
index d44533a..6486168 100644
--- a/sys/fs/coda/coda_vfsops.c
+++ b/sys/fs/coda/coda_vfsops.c
@@ -1,33 +1,35 @@
/*
-
- Coda: an Experimental Distributed File System
- Release 3.1
-
- Copyright (c) 1987-1998 Carnegie Mellon University
- All Rights Reserved
-
-Permission to use, copy, modify and distribute this software and its
-documentation is hereby granted, provided that both the copyright
-notice and this permission notice appear in all copies of the
-software, derivative works or modified versions, and any portions
-thereof, and that both notices appear in supporting documentation, and
-that credit is given to Carnegie Mellon University in all documents
-and publicity pertaining to direct or indirect use of this code or its
-derivatives.
-
-CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
-SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
-FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
-DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
-RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
-ANY DERIVATIVE WORK.
-
-Carnegie Mellon encourages users of this software to return any
-improvements or extensions that they make, and to grant Carnegie
-Mellon the rights to redistribute these changes without encumbrance.
-*/
-
-/* $Header: /afs/cs/project/coda-src/cvs/coda/kernel-src/vfs/freebsd/cfs/cfs_vfsops.c,v 1.11 1998/08/28 18:12:22 rvb Exp $ */
+ *
+ * Coda: an Experimental Distributed File System
+ * Release 3.1
+ *
+ * Copyright (c) 1987-1998 Carnegie Mellon University
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation, and
+ * that credit is given to Carnegie Mellon University in all documents
+ * and publicity pertaining to direct or indirect use of this code or its
+ * derivatives.
+ *
+ * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
+ * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
+ * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
+ * DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
+ * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
+ * ANY DERIVATIVE WORK.
+ *
+ * Carnegie Mellon encourages users of this software to return any
+ * improvements or extensions that they make, and to grant Carnegie
+ * Mellon the rights to redistribute these changes without encumbrance.
+ *
+ * @(#) src/sys/cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
+ * $Id: $
+ *
+ */
/*
* Mach Operating System
@@ -45,6 +47,9 @@ Mellon the rights to redistribute these changes without encumbrance.
/*
* HISTORY
* $Log: cfs_vfsops.c,v $
+ * Revision 1.1.1.1 1998/08/29 21:14:52 rvb
+ * Very Preliminary Coda
+ *
* Revision 1.11 1998/08/28 18:12:22 rvb
* Now it also works on FreeBSD -current. This code will be
* committed to the FreeBSD -current and NetBSD -current
@@ -173,11 +178,12 @@ Mellon the rights to redistribute these changes without encumbrance.
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/namei.h>
#include <sys/mount.h>
-#include <sys/proc.h>
#include <sys/select.h>
#include <cfs/coda.h>
@@ -186,25 +192,14 @@ Mellon the rights to redistribute these changes without encumbrance.
#include <cfs/cfs_venus.h>
#include <cfs/cfs_subr.h>
#include <cfs/coda_opstats.h>
-/* for VN_RDEV */
+
#include <miscfs/specfs/specdev.h>
-#ifdef __FreeBSD__
-#ifdef __FreeBSD_version
MALLOC_DEFINE(M_CFS, "CFS storage", "Various Coda Structures");
-#endif
-#endif
int cfsdebug = 0;
-
int cfs_vfsop_print_entry = 0;
-#ifdef __GNUC__
-#define ENTRY \
- if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
-#else
-#define ENTRY
-#endif
-
+#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
struct vnode *cfs_ctlvp;
struct cfs_mntinfo cfs_mnttbl[NVCFS]; /* indexed by minor device number */
@@ -220,65 +215,7 @@ struct cfs_op_stats cfs_vfsopstats[CFS_VFSOPS_SIZE];
extern int cfsnc_initialized; /* Set if cache has been initialized */
extern int vc_nb_open __P((dev_t, int, int, struct proc *));
-#ifdef __NetBSD__
-extern struct cdevsw cdevsw[]; /* For sanity check in cfs_mount */
-#endif
-/* NetBSD interface to statfs */
-
-#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 5)
-extern struct vnodeopv_desc cfs_vnodeop_opv_desc;
-
-struct vnodeopv_desc *cfs_vnodeopv_descs[] = {
- &cfs_vnodeop_opv_desc,
- NULL,
-};
-
-struct vfsops cfs_vfsops = {
- MOUNT_CFS,
- cfs_mount,
- cfs_start,
- cfs_unmount,
- cfs_root,
- cfs_quotactl,
- cfs_nb_statfs,
- cfs_sync,
- cfs_vget,
- (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **,
- int *, struct ucred **))
- eopnotsupp,
- (int (*) (struct vnode *, struct fid *)) eopnotsupp,
- cfs_init,
-#if (NetBSD1_3 >= 7)
- cfs_sysctl,
-#endif
- (int (*)(void)) eopnotsupp,
- cfs_vnodeopv_descs,
- 0
-};
-#elif defined(__NetBSD__)
-struct vfsops cfs_vfsops = {
- MOUNT_CFS,
- cfs_mount,
- cfs_start,
- cfs_unmount,
- cfs_root,
- cfs_quotactl,
- cfs_nb_statfs,
- cfs_sync,
- cfs_vget,
- (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **,
- int *, struct ucred **))
- eopnotsupp,
- (int (*) (struct vnode *, struct fid *)) eopnotsupp,
- cfs_init,
-#ifdef NetBSD1_3
- (int (*)(void)) eopnotsupp,
-#endif
- 0
-};
-#elif defined(__FreeBSD__)
-#ifdef __FreeBSD_version
struct vfsops cfs_vfsops = {
cfs_mount,
cfs_start,
@@ -295,29 +232,7 @@ struct vfsops cfs_vfsops = {
cfs_init,
};
-#else
-struct vfsops cfs_vfsops = {
- cfs_mount,
- cfs_start,
- cfs_unmount,
- cfs_root,
- cfs_quotactl,
- cfs_nb_statfs,
- cfs_sync,
- cfs_vget,
- (int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **,
- int *, struct ucred **))
- eopnotsupp,
- (int (*) (struct vnode *, struct fid *)) eopnotsupp,
- cfs_init,
-};
-
-#endif
-
-
-#include <sys/kernel.h>
VFS_SET(cfs_vfsops, cfs, MOUNT_CFS, VFCF_NETWORK);
-#endif
int
cfs_vfsopstats_init(void)
@@ -335,7 +250,6 @@ cfs_vfsopstats_init(void)
return 0;
}
-
/*
* cfs mount vfsop
* Set up mount info record and attach it to vfs struct.
@@ -344,13 +258,8 @@ cfs_vfsopstats_init(void)
int
cfs_mount(vfsp, path, data, ndp, p)
struct mount *vfsp; /* Allocated and initialized by mount(2) */
-#ifdef NetBSD1_3
- const char *path; /* path covered: ignored by the fs-layer */
- void *data; /* Need to define a data type for this in netbsd? */
-#else
char *path; /* path covered: ignored by the fs-layer */
caddr_t data; /* Need to define a data type for this in netbsd? */
-#endif
struct nameidata *ndp; /* Clobber this to lookup the device name */
struct proc *p; /* The ever-famous proc pointer */
{
@@ -399,11 +308,7 @@ cfs_mount(vfsp, path, data, ndp, p)
/*
* See if the device table matches our expectations.
*/
-#ifdef __NetBSD__
- if (cdevsw[major(dev)].d_open != vc_nb_open)
-#elif defined(__FreeBSD__)
if (cdevsw[major(dev)]->d_open != vc_nb_open)
-#endif
{
MARK_INT_FAIL(CFS_MOUNT_STATS);
return(ENXIO);
@@ -426,19 +331,8 @@ cfs_mount(vfsp, path, data, ndp, p)
/* No initialization (here) of mi_vcomm! */
vfsp->mnt_data = (qaddr_t)mi;
-#ifdef __NetBSD__
- vfsp->mnt_stat.f_fsid.val[0] = 0;
- vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CFS);
-#elif defined(__FreeBSD__) && defined(__FreeBSD_version)
-
vfs_getnewfsid (vfsp);
-#elif defined(__FreeBSD__)
- /* Seems a bit overkill, since usualy /coda is the only mount point
- * for cfs.
- */
- getnewfsid (vfsp, MOUNT_CFS);
-#endif
mi->mi_vfsp = vfsp;
/*
@@ -471,13 +365,12 @@ cfs_mount(vfsp, path, data, ndp, p)
/* set filesystem block size */
vfsp->mnt_stat.f_bsize = 8192; /* XXX -JJK */
-#ifdef __FreeBSD__
+
/* Set f_iosize. XXX -- inamura@isl.ntt.co.jp.
For vnode_pager_haspage() references. The value should be obtained
from underlying UFS. */
/* Checked UFS. iosize is set as 8192 */
vfsp->mnt_stat.f_iosize = 8192;
-#endif
/* error is currently guaranteed to be zero, but in case some
code changes... */
@@ -526,27 +419,10 @@ cfs_unmount(vfsp, mntflags, p)
#endif
vrele(mi->mi_rootvp);
-#ifdef NetBSD1_3
- active = cfs_kill(vfsp, NOT_DOWNCALL);
-
-#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7)
- if (1)
-#else
- if ((error = vfs_busy(mi->mi_vfsp)) == 0)
-#endif
- {
- error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE);
- printf("cfs_unmount: active = %d, vflush active %d\n", active, error);
- error = 0;
- } else {
- printf("cfs_unmount: busy\n");
- }
-#else /* FreeBSD I guess */
active = cfs_kill(vfsp, NOT_DOWNCALL);
error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE);
printf("cfs_unmount: active = %d, vflush active %d\n", active, error);
error = 0;
-#endif
/* I'm going to take this out to allow lookups to go through. I'm
* not sure it's important anyway. -- DCS 2/2/94
*/
@@ -591,8 +467,12 @@ cfs_root(vfsp, vpp)
{ /* Found valid root. */
*vpp = mi->mi_rootvp;
/* On Mach, this is vref. On NetBSD, VOP_LOCK */
+#if 1
vref(*vpp);
- VOP_X_LOCK(*vpp, LK_EXCLUSIVE);
+ vn_lock(*vpp, LK_EXCLUSIVE, p);
+#else
+ vget(*vpp, LK_EXCLUSIVE, p);
+#endif
MARK_INT_SAT(CFS_ROOT_STATS);
return(0);
}
@@ -610,8 +490,13 @@ cfs_root(vfsp, vpp)
cfs_save(VTOC(mi->mi_rootvp));
*vpp = mi->mi_rootvp;
+#if 1
vref(*vpp);
- VOP_X_LOCK(*vpp, LK_EXCLUSIVE);
+ vn_lock(*vpp, LK_EXCLUSIVE, p);
+#else
+ vget(*vpp, LK_EXCLUSIVE, p);
+#endif
+
MARK_INT_SAT(CFS_ROOT_STATS);
goto exit;
} else if (error == ENODEV) {
@@ -625,8 +510,13 @@ cfs_root(vfsp, vpp)
* will fail.
*/
*vpp = mi->mi_rootvp;
+#if 1
vref(*vpp);
- VOP_X_LOCK(*vpp, LK_EXCLUSIVE);
+ vn_lock(*vpp, LK_EXCLUSIVE, p);
+#else
+ vget(*vpp, LK_EXCLUSIVE, p);
+#endif
+
MARK_INT_FAIL(CFS_ROOT_STATS);
error = 0;
goto exit;
@@ -636,6 +526,7 @@ cfs_root(vfsp, vpp)
goto exit;
}
+
exit:
return(error);
}
@@ -674,11 +565,7 @@ cfs_nb_statfs(vfsp, sbp, p)
#define NB_SFS_SIZ 0x895440
*/
/* Note: Normal fs's have a bsize of 0x400 == 1024 */
-#ifdef __NetBSD__
- sbp->f_type = 0;
-#elif defined(__FreeBSD__)
sbp->f_type = MOUNT_CFS;
-#endif
sbp->f_bsize = 8192; /* XXX */
sbp->f_iosize = 8192; /* XXX */
#define NB_SFS_SIZ 0x8AB75D
@@ -688,9 +575,6 @@ cfs_nb_statfs(vfsp, sbp, p)
sbp->f_files = NB_SFS_SIZ;
sbp->f_ffree = NB_SFS_SIZ;
bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t));
-#ifdef __NetBSD__
- strncpy(sbp->f_fstypename, MOUNT_CFS, MFSNAMELEN-1);
-#endif
strcpy(sbp->f_mntonname, "/coda");
strcpy(sbp->f_mntfromname, "CFS");
/* MARK_INT_SAT(CFS_STATFS_STATS); */
@@ -780,57 +664,12 @@ cfs_vptofh(vnp, fidp)
return (EOPNOTSUPP);
}
-#ifdef __NetBSD__
-void
-cfs_init(void)
-{
- ENTRY;
-}
-#elif defined(__FreeBSD__)
-#ifdef __FreeBSD_version
int
cfs_init(struct vfsconf *vfsp)
{
ENTRY;
return 0;
}
-#else
-int
-cfs_init(void)
-{
- ENTRY;
- return 0;
-}
-#endif
-#endif
-
-#if defined(__NetBSD__) && defined(NetBSD1_3) && (NetBSD1_3 >= 7)
-int
-cfs_sysctl(name, namelen, oldp, oldlp, newp, newl, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlp;
- void *newp;
- size_t newl;
- struct proc *p;
-{
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
-/*
- case FFS_CLUSTERREAD:
- return (sysctl_int(oldp, oldlp, newp, newl, &doclusterread));
- */
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-#endif
/*
* To allow for greater ease of use, some vnodes may be orphaned when
@@ -873,11 +712,7 @@ struct mount *devtomp(dev)
for (mp = mountlist.cqh_first; mp != (void*)&mountlist; mp = nmp) {
nmp = mp->mnt_list.cqe_next;
- if (
-#ifdef __NetBSD__
- (!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) &&
-#endif
- ((VFSTOUFS(mp))->um_dev == (dev_t) dev)) {
+ if (((VFSTOUFS(mp))->um_dev == (dev_t) dev)) {
/* mount corresponds to UFS and the device matches one we want */
return(mp);
}
OpenPOWER on IntegriCloud