4 #include <afs/sysincludes.h>
5 #include <afsincludes.h>
6 #include <sys/module.h>
7 #include <sys/sysproto.h>
8 #include <sys/syscall.h>
9 #include <sys/sysent.h>
11 extern struct vfsops afs_vfsops;
12 extern struct vnodeopv_desc afs_vnodeop_opv_desc;
13 extern struct mount *afs_globalVFS;
14 static struct vfsconf afs_vfsconf;
16 MALLOC_DEFINE(M_AFS, "afsmisc", "memory used by the AFS filesystem");
18 extern int afs3_syscall();
19 extern int Afs_xsetgroups();
20 extern int afs_xioctl();
22 int afs_module_handler(module_t mod, int what, void *arg) {
23 static sy_call_t *old_handler;
30 printf ("afs cannot be MOD_LOAD'd more than once\n");
34 if (sysent[AFS_SYSCALL].sy_call != nosys &&
35 sysent[AFS_SYSCALL].sy_call != lkmnosys) {
36 printf("AFS_SYSCALL in use. aborting\n");
40 memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
41 strcpy(afs_vfsconf.vfc_name, "AFS");
42 afs_vfsconf.vfc_vfsops=&afs_vfsops;
43 afs_vfsconf.vfc_typenum=-1; /* set by vfs_register */
44 afs_vfsconf.vfc_flags=VFCF_NETWORK;
45 vfs_register(&afs_vfsconf); /* doesn't fail */
46 vfs_add_vnodeops(&afs_vnodeop_opv_desc);
48 sysent[SYS_setgroups].sy_call=Afs_xsetgroups;
49 sysent[SYS_ioctl].sy_call=afs_xioctl;
50 old_handler=sysent[AFS_SYSCALL].sy_call;
51 sysent[AFS_SYSCALL].sy_call=afs3_syscall;
52 sysent[AFS_SYSCALL].sy_narg = 5;
56 #ifndef RXK_LISTENER_ENV
57 /* shutdown is incomplete unless RXK_LISTENER_ENV */
58 printf("afs: I can't be unloaded yet\n");
69 if (vfs_unregister(&afs_vfsconf)) {
73 vfs_rm_vnodeops(&afs_vnodeop_opv_desc);
74 sysent[SYS_ioctl].sy_call = ioctl;
75 sysent[SYS_setgroups].sy_call = setgroups;
76 sysent[AFS_SYSCALL].sy_narg = 0;
77 sysent[AFS_SYSCALL].sy_call = old_handler;
85 static moduledata_t afs_mod = {
90 DECLARE_MODULE(afs, afs_mod, SI_SUB_VFS, SI_ORDER_MIDDLE);