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
49 memset(&afs_vfsentry, 0, sizeof(struct vfs_fsentry));
50 strcpy(afs_vfsentry.vfe_fsname, "afs");
51 afs_vfsentry.vfe_vfsops = &afs_vfsops;
52 afs_vfsentry.vfe_vopcnt = 2;
53 afs_vfsentry.vfe_opvdescs = afs_vnodeop_opv_desc_list;
54 /* We may be 64bit ready too (VFS_TBL64BITREADY) */
55 afs_vfsentry.vfe_flags = VFS_TBLTHREADSAFE|VFS_TBLNOTYPENUM;
56 if (vfs_fsadd(&afs_vfsentry, &afs_vfstable)) {
57 printf("AFS: vfs_fsadd failed. aborting\n");
60 afs_cdev.d_open = &afs_cdev_nop_openclose;
61 afs_cdev.d_close = &afs_cdev_nop_openclose;
62 afs_cdev.d_ioctl = &afs_cdev_ioctl;
63 afs_cdev_major = cdevsw_add(-1, &afs_cdev);
64 if (afs_cdev_major == -1) {
65 printf("AFS: cdevsw_add failed. aborting\n");
66 vfs_fsremove(afs_vfstable);
69 afs_cdev_devfs_handle = devfs_make_node(makedev(afs_cdev_major, 0),
70 DEVFS_CHAR, UID_ROOT, GID_WHEEL,
71 0666, "openafs_ioctl", 0);
73 memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
74 strcpy(afs_vfsconf.vfc_name, "afs");
75 afs_vfsconf.vfc_vfsops = &afs_vfsops;
76 afs_vfsconf.vfc_typenum = maxvfsconf++; /* oddly not VT_AFS */
77 afs_vfsconf.vfc_flags = MNT_NODEV;
78 if (vfsconf_add(&afs_vfsconf)) {
79 printf("AFS: vfsconf_add failed. aborting\n");
82 if (sysent[AFS_SYSCALL].sy_call != nosys) {
83 printf("AFS_SYSCALL in use. aborting\n");
86 sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
88 sysent[SYS_ioctl].sy_call = afs_xioctl;
90 sysent[AFS_SYSCALL].sy_call = afs3_syscall;
91 sysent[AFS_SYSCALL].sy_narg = 5;
92 sysent[AFS_SYSCALL].sy_parallel = 0;
94 sysent[AFS_SYSCALL].sy_funnel = KERNEL_FUNNEL;
97 #ifdef AFS_DARWIN80_ENV
99 afs_global_lock = lck_mtx_alloc_init(openafs_lck_grp, 0);
105 afs_modunload(struct kmod_info * ki, void *data)
109 #ifdef AFS_DARWIN80_ENV
110 if (vfs_fsremove(afs_vfstable))
112 devfs_remove(afs_cdev_devfs_handle);
113 cdevsw_remove(afs_cdev_major, &afs_cdev);
115 if (vfsconf_del("afs"))
117 /* give up syscall entries for ioctl & setgroups, which we've stolen */
119 sysent[SYS_ioctl].sy_call = ioctl;
121 #ifndef AFS_DARWIN80_ENV
122 sysent[SYS_setgroups].sy_call = setgroups;
124 /* give up the stolen syscall entry */
125 sysent[AFS_SYSCALL].sy_narg = 0;
126 sysent[AFS_SYSCALL].sy_call = nosys;
128 #ifdef AFS_DARWIN80_ENV
130 lck_mtx_free(afs_global_lock, openafs_lck_grp);
135 KMOD_EXPLICIT_DECL(org.openafs.filesystems.afs, VERSION, afs_modload,