summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2010-03-19 11:11:34 +0000
committerkib <kib@FreeBSD.org>2010-03-19 11:11:34 +0000
commit1e468766f793b1d67f829ef69c185caff4c1b34b (patch)
tree3790551ac968c4b4f34298c60b77b0a45c5c52ae
parent06319cba031100f85cac9068d9e4bd85dc27bbd6 (diff)
downloadFreeBSD-src-1e468766f793b1d67f829ef69c185caff4c1b34b.zip
FreeBSD-src-1e468766f793b1d67f829ef69c185caff4c1b34b.tar.gz
Convert aio syscall registration to SYSCALL_INIT_HELPER.
Reviewed by: jhb MFC after: 2 weeks
-rw-r--r--sys/kern/vfs_aio.c92
1 files changed, 59 insertions, 33 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 25328d6..e05106a 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -334,7 +334,7 @@ static TAILQ_HEAD(,aiocblist) aio_jobs; /* (c) Async job list */
static struct unrhdr *aiod_unr;
void aio_init_aioinfo(struct proc *p);
-static void aio_onceonly(void);
+static int aio_onceonly(void);
static int aio_free_entry(struct aiocblist *aiocbe);
static void aio_process(struct aiocblist *aiocbe);
static int aio_newproc(int *);
@@ -419,18 +419,47 @@ static moduledata_t aio_mod = {
NULL
};
-SYSCALL_MODULE_HELPER(aio_cancel);
-SYSCALL_MODULE_HELPER(aio_error);
-SYSCALL_MODULE_HELPER(aio_fsync);
-SYSCALL_MODULE_HELPER(aio_read);
-SYSCALL_MODULE_HELPER(aio_return);
-SYSCALL_MODULE_HELPER(aio_suspend);
-SYSCALL_MODULE_HELPER(aio_waitcomplete);
-SYSCALL_MODULE_HELPER(aio_write);
-SYSCALL_MODULE_HELPER(lio_listio);
-SYSCALL_MODULE_HELPER(oaio_read);
-SYSCALL_MODULE_HELPER(oaio_write);
-SYSCALL_MODULE_HELPER(olio_listio);
+static struct syscall_helper_data aio_syscalls[] = {
+ SYSCALL_INIT_HELPER(aio_cancel),
+ SYSCALL_INIT_HELPER(aio_error),
+ SYSCALL_INIT_HELPER(aio_fsync),
+ SYSCALL_INIT_HELPER(aio_read),
+ SYSCALL_INIT_HELPER(aio_return),
+ SYSCALL_INIT_HELPER(aio_suspend),
+ SYSCALL_INIT_HELPER(aio_waitcomplete),
+ SYSCALL_INIT_HELPER(aio_write),
+ SYSCALL_INIT_HELPER(lio_listio),
+ SYSCALL_INIT_HELPER(oaio_read),
+ SYSCALL_INIT_HELPER(oaio_write),
+ SYSCALL_INIT_HELPER(olio_listio),
+ SYSCALL_INIT_LAST
+};
+
+#ifdef COMPAT_FREEBSD32
+#include <sys/mount.h>
+#include <sys/socket.h>
+#include <compat/freebsd32/freebsd32.h>
+#include <compat/freebsd32/freebsd32_proto.h>
+#include <compat/freebsd32/freebsd32_signal.h>
+#include <compat/freebsd32/freebsd32_syscall.h>
+#include <compat/freebsd32/freebsd32_util.h>
+
+static struct syscall_helper_data aio32_syscalls[] = {
+ SYSCALL32_INIT_HELPER(freebsd32_aio_return),
+ SYSCALL32_INIT_HELPER(freebsd32_aio_suspend),
+ SYSCALL32_INIT_HELPER(freebsd32_aio_cancel),
+ SYSCALL32_INIT_HELPER(freebsd32_aio_error),
+ SYSCALL32_INIT_HELPER(freebsd32_aio_fsync),
+ SYSCALL32_INIT_HELPER(freebsd32_aio_read),
+ SYSCALL32_INIT_HELPER(freebsd32_aio_write),
+ SYSCALL32_INIT_HELPER(freebsd32_aio_waitcomplete),
+ SYSCALL32_INIT_HELPER(freebsd32_lio_listio),
+ SYSCALL32_INIT_HELPER(freebsd32_oaio_read),
+ SYSCALL32_INIT_HELPER(freebsd32_oaio_write),
+ SYSCALL32_INIT_HELPER(freebsd32_olio_listio),
+ SYSCALL_INIT_LAST
+};
+#endif
DECLARE_MODULE(aio, aio_mod,
SI_SUB_VFS, SI_ORDER_ANY);
@@ -439,9 +468,10 @@ MODULE_VERSION(aio, 1);
/*
* Startup initialization
*/
-static void
+static int
aio_onceonly(void)
{
+ int error;
/* XXX: should probably just use so->callback */
aio_swake = &aio_swake_cb;
@@ -474,6 +504,16 @@ aio_onceonly(void)
p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX);
p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE);
p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0);
+
+ error = syscall_helper_register(aio_syscalls);
+ if (error)
+ return (error);
+#ifdef COMPAT_FREEBSD32
+ error = syscall32_helper_register(aio32_syscalls);
+ if (error)
+ return (error);
+#endif
+ return (0);
}
/*
@@ -495,6 +535,11 @@ aio_unload(void)
if (!unloadable)
return (EOPNOTSUPP);
+#ifdef COMPAT_FREEBSD32
+ syscall32_helper_unregister(aio32_syscalls);
+#endif
+ syscall_helper_unregister(aio_syscalls);
+
error = kqueue_del_filteropts(EVFILT_AIO);
if (error)
return error;
@@ -2533,13 +2578,6 @@ filt_lio(struct knote *kn, long hint)
}
#ifdef COMPAT_FREEBSD32
-#include <sys/mount.h>
-#include <sys/socket.h>
-#include <compat/freebsd32/freebsd32.h>
-#include <compat/freebsd32/freebsd32_proto.h>
-#include <compat/freebsd32/freebsd32_signal.h>
-#include <compat/freebsd32/freebsd32_syscall.h>
-#include <compat/freebsd32/freebsd32_util.h>
struct __aiocb_private32 {
int32_t status;
@@ -2948,16 +2986,4 @@ freebsd32_lio_listio(struct thread *td, struct freebsd32_lio_listio_args *uap)
return (error);
}
-SYSCALL32_MODULE_HELPER(freebsd32_aio_return);
-SYSCALL32_MODULE_HELPER(freebsd32_aio_suspend);
-SYSCALL32_MODULE_HELPER(freebsd32_aio_cancel);
-SYSCALL32_MODULE_HELPER(freebsd32_aio_error);
-SYSCALL32_MODULE_HELPER(freebsd32_aio_fsync);
-SYSCALL32_MODULE_HELPER(freebsd32_aio_read);
-SYSCALL32_MODULE_HELPER(freebsd32_aio_write);
-SYSCALL32_MODULE_HELPER(freebsd32_aio_waitcomplete);
-SYSCALL32_MODULE_HELPER(freebsd32_lio_listio);
-SYSCALL32_MODULE_HELPER(freebsd32_oaio_read);
-SYSCALL32_MODULE_HELPER(freebsd32_oaio_write);
-SYSCALL32_MODULE_HELPER(freebsd32_olio_listio);
#endif
OpenPOWER on IntegriCloud