/*
+ * OpenBSD specific assistance routines & VFS ops
+ * Original NetBSD version for Transarc afs by John Kohl <jtk@MIT.EDU>
+ * OpenBSD version by Jim Rees <rees@umich.edu>
+ *
+ * $Id$
+ */
+
+/*
+copyright 2002
+the regents of the university of michigan
+all rights reserved
+
+permission is granted to use, copy, create derivative works
+and redistribute this software and such derivative works
+for any purpose, so long as the name of the university of
+michigan is not used in any advertising or publicity
+pertaining to the use or distribution of this software
+without specific, written prior authorization. if the
+above copyright notice or any other identification of the
+university of michigan is included in any copy of any
+portion of this software, then the disclaimer below must
+also be included.
+
+this software is provided as is, without representation
+from the university of michigan as to its fitness for any
+purpose, and without warranty by the university of
+michigan of any kind, either express or implied, including
+without limitation the implied warranties of
+merchantability and fitness for a particular purpose. the
+regents of the university of michigan shall not be liable
+for any damages, including special, indirect, incidental, or
+consequential damages, with respect to any claim arising
+out of or in connection with the use of the software, even
+if it has been or is hereafter advised of the possibility of
+such damages.
+*/
+
+/*
Copyright 1995 Massachusetts Institute of Technology. All Rights
Reserved.
*/
/*
- * OpenBSD specific assistance routines & VFS ops
- * Original NetBSD version for Transarc afs by John Kohl <jtk@MIT.EDU>
- * OpenBSD version by Jim Rees <rees@umich.edu>
- *
- * $Id$
- */
-
-/*
* Some code cribbed from ffs_vfsops and other NetBSD sources, which
* are marked:
*/
#include <sys/syscall.h>
#include <sys/syscallargs.h>
+/* from /usr/src/sys/kern/vfs_subr.c */
+extern void insmntque(struct vnode *, struct mount *);
+
#define NBSD_DONTFOLLOW_LINK 0
#define NBSD_FOLLOW_LINK 1
+
static int lkmid = -1;
static int afs_badcall(struct proc *p, void *xx, register_t *yy);
return error;
}
-#if 0
-int
-afs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw op,
- int flags, struct AFS_UCRED *cred)
-{
- uiop->uio_rw = op;
- if (op == UIO_READ)
- return VOP_READ(vp, uiop, flags, cred);
- if (op == UIO_WRITE)
- return VOP_WRITE(vp, uiop, flags, cred);
-#ifdef DIAGNOSTIC
- panic("afs_rdwr mode");
-#endif
- return EINVAL;
-}
-#endif
-
int
afs_quotactl()
{
return EBUSY;
}
- AFS_GLOCK();
AFS_STATCNT(afs_mount);
#ifdef AFS_DISCON_ENV
mp->osi_vfs_fsid.val[0] = AFS_VFSMAGIC; /* magic */
mp->osi_vfs_fsid.val[1] = (int) AFS_VFSFSID;
- AFS_GUNLOCK();
-
(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN-1, &size);
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
vflush(afsp, NULLVP, 0); /* don't support forced */
afsp->mnt_data = NULL;
-#ifdef AFS_GLOBAL_SUNLOCK
- mutex_enter(&afs_global_lock);
-#endif
+ AFS_GLOCK();
afs_globalVFS = 0;
afs_cold_shutdown = 1;
afs_shutdown(); /* XXX */
-#ifdef AFS_GLOBAL_SUNLOCK
- mutex_exit(&afs_global_lock);
-#endif
+ AFS_GUNLOCK();
/* give up syscall entries for ioctl & setgroups, which we've stolen */
sysent[SYS_ioctl].sy_call = sys_ioctl;
AFS_STATCNT(afs_root);
-#ifdef AFS_GLOBAL_SUNLOCK
- mutex_enter(&afs_global_lock);
-#endif
+ AFS_GLOCK();
if (!(code = afs_InitReq(&treq, osi_curcred())) &&
!(code = afs_CheckInit())) {
tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
if (tvp) {
-printf("tvp %x %d\n", tvp, AFSTOV(tvp)->v_usecount);
/* There is really no reason to over-hold this bugger--it's held
by the root filesystem reference. */
if (afs_globalVp != tvp) {
+#ifdef AFS_DONT_OVERHOLD_GLOBALVP
if (afs_globalVp)
-printf("afs_globalVp %x %d\n", afs_globalVp, AFSTOV(afs_globalVp)->v_usecount);
-/* AFS_RELE(AFSTOV(afs_globalVp));*/
+ AFS_RELE(AFSTOV(afs_globalVp));
+#endif
afs_globalVp = tvp;
AFS_HOLD(AFSTOV(afs_globalVp));
}
} else
code = ENOENT;
}
-#ifdef AFS_GLOBAL_SUNLOCK
- mutex_exit(&afs_global_lock);
-#endif
+ AFS_GUNLOCK();
if (!code)
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curproc); /* return it locked */
afs_statfs(struct osi_vfs *afsp, struct statfs *abp)
{
AFS_STATCNT(afs_statfs);
-#ifdef AFS_GLOBAL_SUNLOCK
- mutex_enter(&afs_global_lock);
-#endif
abp->f_bsize = afsp->osi_vfs_bsize;
- /* Fake a high number below to satisfy programs that use the ustat (for AIX), or statfs (for the rest) call to make sure that there's enough space in the device partition before storing something there (like ed(1)) */
- abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files = abp->f_ffree = 9000000; /* XXX */
+
+ /*
+ * Fake a high number below to satisfy programs that use the ustat (for
+ * * AIX), or statfs (for the rest) call to make sure that there's
+ * enough * space in the device partition before storing something there
+ * (like * ed(1))
+ */
+ abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files = abp->f_ffree = 9000000;
abp->f_fsid.val[0] = AFS_VFSMAGIC; /* magic */
abp->f_fsid.val[1] = (int) AFS_VFSFSID;
-#ifdef AFS_GLOBAL_SUNLOCK
- mutex_exit(&afs_global_lock);
-#endif
return 0;
}