darwin module prototype and cleanup

tidy up the osi_module and osi_misc prototyping, and the error checking
and returns at module load time. side effect: also use the afs3_syscall
prototype for the BSDs.

Change-Id: I373f44f3b5999dc05ba23f09c74149aaf237edcc
Reviewed-on: http://gerrit.openafs.org/1056
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Derrick Brashear 2010-01-03 19:01:47 -05:00 committed by Derrick Brashear
parent 8f689aec14
commit fcce9a4727
6 changed files with 28 additions and 25 deletions

View File

@ -202,8 +202,6 @@ afs_cdev_nop_openclose(dev_t dev, int flags, int devtype,struct proc *p)
return 0;
}
extern int afs3_syscall(struct proc *p, void *data, unsigned int *retval);
int
afs_cdev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p) {
unsigned int retval=0;

View File

@ -1,9 +1,10 @@
#include <afsconfig.h>
#include "afs/param.h"
#include "afs/sysincludes.h"
#include "afsincludes.h"
#define MYBUNDLEID "org.openafs.filesystems.afs"
#ifdef AFS_DARWIN80_ENV
static vfstable_t afs_vfstable;
static struct vfs_fsentry afs_vfsentry;
@ -12,7 +13,6 @@ extern struct vnodeopv_desc afs_dead_vnodeop_opv_desc;
static struct vnodeopv_desc *afs_vnodeop_opv_desc_list[2] =
{ &afs_vnodeop_opv_desc, &afs_dead_vnodeop_opv_desc };
#include <sys/conf.h>
#include <miscfs/devfs/devfs.h>
#define seltrue eno_select
@ -35,8 +35,6 @@ struct vfsconf afs_vfsconf;
extern struct vfsops afs_vfsops;
extern struct mount *afs_globalVFS;
extern int Afs_xsetgroups();
extern int afs_xioctl();
extern int afs3_syscall();
extern int ioctl();
extern int setgroups();
@ -56,9 +54,7 @@ afs_modload(struct kmod_info *ki, void *data)
afs_vfsentry.vfe_flags = VFS_TBLTHREADSAFE|VFS_TBLNOTYPENUM|VFS_TBL64BITREADY;
if (vfs_fsadd(&afs_vfsentry, &afs_vfstable)) {
printf("AFS: vfs_fsadd failed. aborting\n");
MUTEX_FINISH();
lck_mtx_free(afs_global_lock, openafs_lck_grp);
return KERN_FAILURE;
goto fsadd_out;
}
afs_cdev.d_open = &afs_cdev_nop_openclose;
afs_cdev.d_close = &afs_cdev_nop_openclose;
@ -66,14 +62,21 @@ afs_modload(struct kmod_info *ki, void *data)
afs_cdev_major = cdevsw_add(-1, &afs_cdev);
if (afs_cdev_major == -1) {
printf("AFS: cdevsw_add failed. aborting\n");
vfs_fsremove(afs_vfstable);
MUTEX_FINISH();
lck_mtx_free(afs_global_lock, openafs_lck_grp);
return KERN_FAILURE;
goto cdevsw_out;
}
afs_cdev_devfs_handle = devfs_make_node(makedev(afs_cdev_major, 0),
DEVFS_CHAR, UID_ROOT, GID_WHEEL,
0666, "openafs_ioctl", 0);
if (!afs_cdev_devfs_handle) {
printf("AFS: devfs_make_node failed. aborting\n");
cdevsw_remove(afs_cdev_major, &afs_cdev);
cdevsw_out:
vfs_fsremove(afs_vfstable);
fsadd_out:
MUTEX_FINISH();
lck_mtx_free(afs_global_lock, openafs_lck_grp);
return KERN_FAILURE;
}
#else
memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
strcpy(afs_vfsconf.vfc_name, "afs");
@ -89,9 +92,6 @@ afs_modload(struct kmod_info *ki, void *data)
return KERN_FAILURE;
}
sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
#if 0
sysent[SYS_ioctl].sy_call = afs_xioctl;
#endif
sysent[AFS_SYSCALL].sy_call = afs3_syscall;
sysent[AFS_SYSCALL].sy_narg = 5;
sysent[AFS_SYSCALL].sy_parallel = 0;
@ -116,12 +116,7 @@ afs_modunload(struct kmod_info * ki, void *data)
if (vfsconf_del("afs"))
return KERN_FAILURE;
/* give up syscall entries for ioctl & setgroups, which we've stolen */
#if 0
sysent[SYS_ioctl].sy_call = ioctl;
#endif
#ifndef AFS_DARWIN80_ENV
sysent[SYS_setgroups].sy_call = setgroups;
#endif
/* give up the stolen syscall entry */
sysent[AFS_SYSCALL].sy_narg = 0;
sysent[AFS_SYSCALL].sy_call = nosys;
@ -133,5 +128,5 @@ afs_modunload(struct kmod_info * ki, void *data)
return KERN_SUCCESS;
}
KMOD_EXPLICIT_DECL(org.openafs.filesystems.afs, VERSION, afs_modload,
KMOD_EXPLICIT_DECL(MYBUNDLEID, VERSION, afs_modload,
afs_modunload)

View File

@ -23,7 +23,6 @@ int afs_pbuf_freecnt = -1;
#define THREAD_OR_PROC struct proc *p
#endif
extern int afs3_syscall();
extern int Afs_xsetgroups();
extern int afs_xioctl();

View File

@ -482,7 +482,7 @@ afs_configure(cfg_op_t op, caddr_t indata, size_t indata_size,
int
mp_Afs_init(void)
{
extern int Afs_xsetgroups(), afs_xioctl(), afs3_syscall();
extern int Afs_xsetgroups(), afs_xioctl();
AFS_GLOCK();
sysent[AFS_SYSCALL].sy_call = afs3_syscall;

View File

@ -108,7 +108,7 @@ NONINFRINGEMENT.
/* from /usr/src/sys/kern/vfs_subr.c */
extern void insmntque(struct vnode *, struct mount *);
extern int sys_lkmnosys(), afs3_syscall(), afs_xioctl(), Afs_xsetgroups();
extern int sys_lkmnosys(), afs_xioctl(), Afs_xsetgroups();
static int lkmid = -1;
static int afs_badcall(struct proc *p, void *xx, register_t * yy);

View File

@ -879,6 +879,17 @@ extern int copyin_afs_ioctl(user_addr_t cmarg, struct afs_ioctl *dst);
#else
extern int copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst);
#endif
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
#ifdef AFS_DARWIN100_ENV
extern int afs3_syscall(afs_proc_t *p, void *args, unsigned int *retval);
#elif defined(AFS_FBSD50_ENV)
extern int afs3_syscall(struct thread *p, void *args, long *retval);
#else
extern int afs3_syscall(afs_proc_t *p, void *args, long *retval);
#endif
#endif
#ifdef UKERNEL
extern int Afs_syscall(void);
#endif