2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afsconfig.h>
12 #include <afs/param.h>
17 #include <afs/sysincludes.h>
18 #include <afsincludes.h>
19 #include <sys/module.h>
20 #include <sys/sysproto.h>
21 #include <sys/syscall.h>
22 #include <sys/sysent.h>
24 extern struct vfsops afs_vfsops;
25 extern struct vnodeopv_desc afs_vnodeop_opv_desc;
26 extern struct mount *afs_globalVFS;
27 static struct vfsconf afs_vfsconf;
29 MALLOC_DEFINE(M_AFS, "afsmisc", "memory used by the AFS filesystem");
31 extern int afs3_syscall();
32 extern int Afs_xsetgroups();
33 extern int afs_xioctl();
36 afs_module_handler(module_t mod, int what, void *arg)
38 static sy_call_t *old_handler;
39 static int inited = 0;
45 printf("afs cannot be MOD_LOAD'd more than once\n");
49 if (sysent[AFS_SYSCALL].sy_call != nosys
50 && sysent[AFS_SYSCALL].sy_call != lkmnosys) {
51 printf("AFS_SYSCALL in use. aborting\n");
55 memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
56 strcpy(afs_vfsconf.vfc_name, "AFS");
57 afs_vfsconf.vfc_vfsops = &afs_vfsops;
58 afs_vfsconf.vfc_typenum = -1; /* set by vfs_register */
59 afs_vfsconf.vfc_flags = VFCF_NETWORK;
60 vfs_register(&afs_vfsconf); /* doesn't fail */
61 vfs_add_vnodeops(&afs_vnodeop_opv_desc);
63 sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
64 sysent[SYS_ioctl].sy_call = afs_xioctl;
65 old_handler = sysent[AFS_SYSCALL].sy_call;
66 sysent[AFS_SYSCALL].sy_call = afs3_syscall;
67 sysent[AFS_SYSCALL].sy_narg = 5;
71 #ifndef RXK_LISTENER_ENV
72 /* shutdown is incomplete unless RXK_LISTENER_ENV */
73 printf("afs: I can't be unloaded yet\n");
84 if (vfs_unregister(&afs_vfsconf)) {
88 vfs_rm_vnodeops(&afs_vnodeop_opv_desc);
89 sysent[SYS_ioctl].sy_call = ioctl;
90 sysent[SYS_setgroups].sy_call = setgroups;
91 sysent[AFS_SYSCALL].sy_narg = 0;
92 sysent[AFS_SYSCALL].sy_call = old_handler;
100 static moduledata_t afs_mod = {
106 DECLARE_MODULE(afs, afs_mod, SI_SUB_VFS, SI_ORDER_MIDDLE);