diff --git a/src/afs/FBSD/osi_module.c b/src/afs/FBSD/osi_module.c index 804a6d9dff..9b22d20c61 100644 --- a/src/afs/FBSD/osi_module.c +++ b/src/afs/FBSD/osi_module.c @@ -19,23 +19,32 @@ RCSID #include #include #include -#include 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; @@ -46,12 +55,6 @@ afs_module_handler(module_t mod, int what, void *arg) 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; @@ -63,14 +66,6 @@ afs_module_handler(module_t mod, int what, void *arg) 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: @@ -83,31 +78,13 @@ afs_module_handler(module_t mod, int what, void *arg) 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 diff --git a/src/afs/FBSD/osi_prototypes.h b/src/afs/FBSD/osi_prototypes.h index 8ff1dffdd2..3788f8607b 100644 --- a/src/afs/FBSD/osi_prototypes.h +++ b/src/afs/FBSD/osi_prototypes.h @@ -24,6 +24,8 @@ extern void *osi_fbsd_alloc(size_t size, int dropglobal); 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 diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index 25d6a9a081..18138c50c8 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -10,7 +10,10 @@ RCSID #include #include #include +#include +#include #include +#include struct vcache *afs_globalVp = NULL; struct mount *afs_globalVFS = NULL; @@ -22,10 +25,50 @@ int afs_pbuf_freecnt = -1; #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_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) { - afs_pbuf_freecnt = nswbuf / 2 + 1; return (0); /* nothing to do. ? */ } @@ -228,12 +271,6 @@ afs_sync(struct mount *mp, int waitfor, struct ucred *cred, THREAD_OR_PROC) return 0; } -int -afs_init(struct vfsconf *vfc) -{ - return 0; -} - #ifdef AFS_FBSD60_ENV struct vfsops afs_vfsops = { .vfs_init = afs_init, @@ -242,7 +279,7 @@ struct vfsops afs_vfsops = { .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, }; @@ -263,7 +300,7 @@ struct vfsops afs_vfsops = { vfs_stdcheckexp, vfs_stdvptofh, afs_init, - vfs_stduninit, + afs_uninit, vfs_stdextattrctl, #ifdef AFS_FBSD50_ENV vfs_stdsysctl, diff --git a/src/afs/FBSD/osi_vm.c b/src/afs/FBSD/osi_vm.c index 1b57c767ef..5634658476 100644 --- a/src/afs/FBSD/osi_vm.c +++ b/src/afs/FBSD/osi_vm.c @@ -48,6 +48,10 @@ RCSID * 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) diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index 300e61052d..4f53581af1 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -491,14 +491,16 @@ afs_vop_open(ap) * } */ *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();