#include <sys/module.h>
#include <sys/sysproto.h>
#include <sys/syscall.h>
-#include <sys/sysent.h>
extern struct vfsops afs_vfsops;
extern struct vnodeopv_desc afs_vnodeop_opv_desc;
extern struct mount *afs_globalVFS;
-static struct vfsconf afs_vfsconf;
MALLOC_DEFINE(M_AFS, "afsmisc", "memory used by the AFS filesystem");
-extern int afs3_syscall();
-extern int Afs_xsetgroups();
-extern int afs_xioctl();
+#ifdef AFS_FBSD60_ENV
+VFS_SET(afs_vfsops, afs, VFCF_NETWORK);
+#else
+int afs_module_handler(module_t mod, int what, void *arg);
+
+static struct vfsconf afs_vfsconf;
+static moduledata_t afs_mod = {
+ "afs",
+ afs_module_handler,
+ &afs_mod
+};
+DECLARE_MODULE(afs, afs_mod, SI_SUB_VFS, SI_ORDER_MIDDLE);
+#endif
+
+#ifndef AFS_FBSD60_ENV
int
afs_module_handler(module_t mod, int what, void *arg)
{
- static sy_call_t *old_handler;
static int inited = 0;
int error = 0;
error = EBUSY;
break;
}
- if (sysent[AFS_SYSCALL].sy_call != nosys
- && sysent[AFS_SYSCALL].sy_call != lkmnosys) {
- printf("AFS_SYSCALL in use. aborting\n");
- error = EBUSY;
- break;
- }
memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
#ifdef AFS_FBSD53_ENV
afs_vfsconf.vfc_version = VFS_VERSION;
if ((error = vfs_register(&afs_vfsconf)) != 0)
break;
vfs_add_vnodeops(&afs_vnodeop_opv_desc);
- osi_Init();
-#if 0
- sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
- sysent[SYS_ioctl].sy_call = afs_xioctl;
-#endif
- old_handler = sysent[AFS_SYSCALL].sy_call;
- sysent[AFS_SYSCALL].sy_call = afs3_syscall;
- sysent[AFS_SYSCALL].sy_narg = 5;
inited = 1;
break;
case MOD_UNLOAD:
error = 0;
break;
}
- if (afs_globalVFS) {
- error = EBUSY;
- break;
- }
if ((error = vfs_unregister(&afs_vfsconf)) != 0) {
break;
}
vfs_rm_vnodeops(&afs_vnodeop_opv_desc);
-#if 0
- sysent[SYS_ioctl].sy_call = ioctl;
- sysent[SYS_setgroups].sy_call = setgroups;
-#endif
- sysent[AFS_SYSCALL].sy_narg = 0;
- sysent[AFS_SYSCALL].sy_call = old_handler;
break;
}
return (error);
}
-
-
-static moduledata_t afs_mod = {
- "afs",
- afs_module_handler,
- &afs_mod
-};
-
-DECLARE_MODULE(afs, afs_mod, SI_SUB_VFS, SI_ORDER_MIDDLE);
+#endif
extern void osi_fbsd_free(void *p);
/* osi_vfsops.c */
+int afs_init(struct vfsconf *vfc);
+int afs_uninit(struct vfsconf *vfc);
#ifdef AFS_FBSD50_ENV
extern int afs_statfs(struct mount *mp, struct statfs *abp, struct thread *th);
#else
#include <sys/malloc.h>
#include <sys/namei.h>
#include <sys/conf.h>
+#include <sys/module.h>
+#include <sys/sysproto.h>
#include <sys/syscall.h>
+#include <sys/sysent.h>
struct vcache *afs_globalVp = NULL;
struct mount *afs_globalVFS = NULL;
#define THREAD_OR_PROC struct proc *p
#endif
+extern int afs3_syscall();
+extern int Afs_xsetgroups();
+extern int afs_xioctl();
+
+static sy_call_t *old_handler;
+
+
int
-afs_start(struct mount *mp, int flags, THREAD_OR_PROC)
+afs_init(struct vfsconf *vfc)
{
+ if (sysent[AFS_SYSCALL].sy_call != nosys
+ && sysent[AFS_SYSCALL].sy_call != lkmnosys) {
+ printf("AFS_SYSCALL in use. aborting\n");
+ return EBUSY;
+ }
+ osi_Init();
afs_pbuf_freecnt = nswbuf / 2 + 1;
+#if 0
+ sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
+ sysent[SYS_ioctl].sy_call = afs_xioctl;
+#endif
+ old_handler = sysent[AFS_SYSCALL].sy_call;
+ sysent[AFS_SYSCALL].sy_call = afs3_syscall;
+ sysent[AFS_SYSCALL].sy_narg = 5;
+ return 0;
+}
+
+int
+afs_uninit(struct vfsconf *vfc)
+{
+ if (afs_globalVFS)
+ return EBUSY;
+#if 0
+ sysent[SYS_ioctl].sy_call = ioctl;
+ sysent[SYS_setgroups].sy_call = setgroups;
+#endif
+ sysent[AFS_SYSCALL].sy_narg = 0;
+ sysent[AFS_SYSCALL].sy_call = old_handler;
+ return 0;
+}
+
+int
+afs_start(struct mount *mp, int flags, THREAD_OR_PROC)
+{
return (0); /* nothing to do. ? */
}
return 0;
}
-int
-afs_init(struct vfsconf *vfc)
-{
- return 0;
-}
-
#ifdef AFS_FBSD60_ENV
struct vfsops afs_vfsops = {
.vfs_init = afs_init,
.vfs_root = afs_root,
.vfs_statfs = afs_statfs,
.vfs_sync = afs_sync,
- .vfs_uninit = vfs_stduninit,
+ .vfs_uninit = afs_uninit,
.vfs_unmount = afs_unmount,
.vfs_sysctl = vfs_stdsysctl,
};
vfs_stdcheckexp,
vfs_stdvptofh,
afs_init,
- vfs_stduninit,
+ afs_uninit,
vfs_stdextattrctl,
#ifdef AFS_FBSD50_ENV
vfs_stdsysctl,
* rather than an explicit lock.
*/
+#ifdef AFS_FBSD60_ENV
+#define VOP_GETVOBJECT(vp, objp) (*(objp) = (vp)->v_object)
+#endif
+
#ifdef AFS_FBSD50_ENV
#define lock_vnode(v) vn_lock((v), LK_EXCLUSIVE | LK_RETRY, curthread)
#define unlock_vnode(v) VOP_UNLOCK((v), 0, curthread)
* } */ *ap;
{
int error;
- int bad;
struct vcache *vc = VTOAFS(ap->a_vp);
- bad = 0;
+
AFS_GLOCK();
error = afs_open(&vc, ap->a_mode, ap->a_cred);
#ifdef DIAGNOSTIC
if (AFSTOV(vc) != ap->a_vp)
panic("AFS open changed vnode!");
#endif
+#ifdef AFS_FBSD60_ENV
+ vnode_create_vobject(ap->a_vp, vc->m.Length, ap->a_td);
+#endif
osi_FlushPages(vc, ap->a_cred);
AFS_GUNLOCK();
return error;