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>
16 #include <afs/sysincludes.h>
17 #include <afsincludes.h>
18 #include <sys/module.h>
19 #include <sys/sysproto.h>
20 #include <sys/syscall.h>
21 #include <sys/sysent.h>
23 extern struct vfsops afs_vfsops;
24 extern struct vnodeopv_desc afs_vnodeop_opv_desc;
25 extern struct mount *afs_globalVFS;
26 static struct vfsconf afs_vfsconf;
28 MALLOC_DEFINE(M_AFS, "afsmisc", "memory used by the AFS filesystem");
30 extern int afs3_syscall();
31 extern int Afs_xsetgroups();
32 extern int afs_xioctl();
35 afs_module_handler(module_t mod, int what, void *arg)
37 static sy_call_t *old_handler;
38 static int inited = 0;
44 printf("afs cannot be MOD_LOAD'd more than once\n");
48 if (sysent[AFS_SYSCALL].sy_call != nosys &&
49 sysent[AFS_SYSCALL].sy_call != lkmnosys) {
50 printf("AFS_SYSCALL in use. aborting\n");
54 memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
55 strcpy(afs_vfsconf.vfc_name, "AFS");
56 afs_vfsconf.vfc_vfsops = &afs_vfsops;
57 afs_vfsconf.vfc_typenum = -1; /* set by vfs_register */
58 afs_vfsconf.vfc_flags = VFCF_NETWORK;
59 vfs_register(&afs_vfsconf); /* doesn't fail */
60 vfs_add_vnodeops(&afs_vnodeop_opv_desc);
62 sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
63 sysent[SYS_ioctl].sy_call = afs_xioctl;
64 old_handler = sysent[AFS_SYSCALL].sy_call;
65 sysent[AFS_SYSCALL].sy_call = afs3_syscall;
66 sysent[AFS_SYSCALL].sy_narg = 5;
70 #ifndef RXK_LISTENER_ENV
71 /* shutdown is incomplete unless RXK_LISTENER_ENV */
72 printf("afs: I can't be unloaded yet\n");
83 if (vfs_unregister(&afs_vfsconf)) {
87 vfs_rm_vnodeops(&afs_vnodeop_opv_desc);
88 sysent[SYS_ioctl].sy_call = ioctl;
89 sysent[SYS_setgroups].sy_call = setgroups;
90 sysent[AFS_SYSCALL].sy_narg = 0;
91 sysent[AFS_SYSCALL].sy_call = old_handler;
99 static moduledata_t afs_mod = {
104 DECLARE_MODULE(afs, afs_mod, SI_SUB_VFS, SI_ORDER_MIDDLE);