5 #include "afs/sysincludes.h"
6 #include "afsincludes.h"
7 #ifdef AFS_DARWIN80_ENV
8 static vfstable_t afs_vfstable;
9 static struct vfs_fsentry afs_vfsentry;
10 extern struct vnodeopv_desc afs_vnodeop_opv_desc;
11 extern struct vnodeopv_desc afs_dead_vnodeop_opv_desc;
12 static struct vnodeopv_desc *afs_vnodeop_opv_desc_list[2] =
13 { &afs_vnodeop_opv_desc, &afs_dead_vnodeop_opv_desc };
17 #include <miscfs/devfs/devfs.h>
18 #define seltrue eno_select
19 struct cdevsw afs_cdev = NO_CDEVICE;
21 static int afs_cdev_major;
22 extern open_close_fcn_t afs_cdev_nop_openclose;
23 extern ioctl_fcn_t afs_cdev_ioctl;
24 static void *afs_cdev_devfs_handle;
26 #ifdef AFS_DARWIN60_ENV /* not in Kernel.framework anymore !?! */
27 #include <sys/syscall.h>
29 #include "sys/syscall.h"
31 struct vfsconf afs_vfsconf;
33 #include <mach/kmod.h>
35 extern struct vfsops afs_vfsops;
36 extern struct mount *afs_globalVFS;
37 extern int Afs_xsetgroups();
38 extern int afs_xioctl();
39 extern int afs3_syscall();
42 extern int setgroups();
43 extern int maxvfsconf;
45 afs_modload(struct kmod_info *ki, void *data)
48 #ifdef AFS_DARWIN80_ENV
50 afs_global_lock = lck_mtx_alloc_init(openafs_lck_grp, 0);
51 memset(&afs_vfsentry, 0, sizeof(struct vfs_fsentry));
52 strcpy(afs_vfsentry.vfe_fsname, "afs");
53 afs_vfsentry.vfe_vfsops = &afs_vfsops;
54 afs_vfsentry.vfe_vopcnt = 2;
55 afs_vfsentry.vfe_opvdescs = afs_vnodeop_opv_desc_list;
56 afs_vfsentry.vfe_flags = VFS_TBLTHREADSAFE|VFS_TBLNOTYPENUM|VFS_TBL64BITREADY;
57 if (vfs_fsadd(&afs_vfsentry, &afs_vfstable)) {
58 printf("AFS: vfs_fsadd failed. aborting\n");
60 lck_mtx_free(afs_global_lock, openafs_lck_grp);
63 afs_cdev.d_open = &afs_cdev_nop_openclose;
64 afs_cdev.d_close = &afs_cdev_nop_openclose;
65 afs_cdev.d_ioctl = &afs_cdev_ioctl;
66 afs_cdev_major = cdevsw_add(-1, &afs_cdev);
67 if (afs_cdev_major == -1) {
68 printf("AFS: cdevsw_add failed. aborting\n");
69 vfs_fsremove(afs_vfstable);
71 lck_mtx_free(afs_global_lock, openafs_lck_grp);
74 afs_cdev_devfs_handle = devfs_make_node(makedev(afs_cdev_major, 0),
75 DEVFS_CHAR, UID_ROOT, GID_WHEEL,
76 0666, "openafs_ioctl", 0);
78 memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
79 strcpy(afs_vfsconf.vfc_name, "afs");
80 afs_vfsconf.vfc_vfsops = &afs_vfsops;
81 afs_vfsconf.vfc_typenum = maxvfsconf++; /* oddly not VT_AFS */
82 afs_vfsconf.vfc_flags = MNT_NODEV;
83 if (vfsconf_add(&afs_vfsconf)) {
84 printf("AFS: vfsconf_add failed. aborting\n");
87 if (sysent[AFS_SYSCALL].sy_call != nosys) {
88 printf("AFS_SYSCALL in use. aborting\n");
91 sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
93 sysent[SYS_ioctl].sy_call = afs_xioctl;
95 sysent[AFS_SYSCALL].sy_call = afs3_syscall;
96 sysent[AFS_SYSCALL].sy_narg = 5;
97 sysent[AFS_SYSCALL].sy_parallel = 0;
99 sysent[AFS_SYSCALL].sy_funnel = KERNEL_FUNNEL;
106 afs_modunload(struct kmod_info * ki, void *data)
110 #ifdef AFS_DARWIN80_ENV
111 if (vfs_fsremove(afs_vfstable))
113 devfs_remove(afs_cdev_devfs_handle);
114 cdevsw_remove(afs_cdev_major, &afs_cdev);
116 if (vfsconf_del("afs"))
118 /* give up syscall entries for ioctl & setgroups, which we've stolen */
120 sysent[SYS_ioctl].sy_call = ioctl;
122 #ifndef AFS_DARWIN80_ENV
123 sysent[SYS_setgroups].sy_call = setgroups;
125 /* give up the stolen syscall entry */
126 sysent[AFS_SYSCALL].sy_narg = 0;
127 sysent[AFS_SYSCALL].sy_call = nosys;
129 #ifdef AFS_DARWIN80_ENV
131 lck_mtx_free(afs_global_lock, openafs_lck_grp);
136 KMOD_EXPLICIT_DECL(org.openafs.filesystems.afs, VERSION, afs_modload,