Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Make handle_modctl_load() usable from compat/netbsd32.
details: https://anonhg.NetBSD.org/src/rev/a9eb189677ff
branches: trunk
changeset: 338952:a9eb189677ff
user: martin <martin%NetBSD.org@localhost>
date: Fri Jun 19 14:23:59 2015 +0000
description:
Make handle_modctl_load() usable from compat/netbsd32.
diffstat:
sys/kern/sys_module.c | 28 +++++++++++++++-------------
sys/sys/module.h | 8 +++++++-
2 files changed, 22 insertions(+), 14 deletions(-)
diffs (107 lines):
diff -r 327a5af001d6 -r a9eb189677ff sys/kern/sys_module.c
--- a/sys/kern/sys_module.c Fri Jun 19 12:27:02 2015 +0000
+++ b/sys/kern/sys_module.c Fri Jun 19 14:23:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_module.c,v 1.17 2014/07/10 21:13:52 christos Exp $ */
+/* $NetBSD: sys_module.c,v 1.18 2015/06/19 14:23:59 martin Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.17 2014/07/10 21:13:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.18 2015/06/19 14:23:59 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -51,8 +51,9 @@
*/
#define MAXPROPSLEN 4096
-static int
-handle_modctl_load(modctl_load_t *ml)
+int
+handle_modctl_load(const char *ml_filename, int ml_flags, const char *ml_props,
+ size_t ml_propslen)
{
char *path;
char *props;
@@ -60,22 +61,22 @@
prop_dictionary_t dict;
size_t propslen = 0;
- if ((ml->ml_props != NULL && ml->ml_propslen == 0) ||
- (ml->ml_props == NULL && ml->ml_propslen > 0)) {
+ if ((ml_props != NULL && ml_propslen == 0) ||
+ (ml_props == NULL && ml_propslen > 0)) {
return EINVAL;
}
path = PNBUF_GET();
- error = copyinstr(ml->ml_filename, path, MAXPATHLEN, NULL);
+ error = copyinstr(ml_filename, path, MAXPATHLEN, NULL);
if (error != 0)
goto out1;
- if (ml->ml_props != NULL) {
- if (ml->ml_propslen > MAXPROPSLEN) {
+ if (ml_props != NULL) {
+ if (ml_propslen > MAXPROPSLEN) {
error = ENOMEM;
goto out1;
}
- propslen = ml->ml_propslen + 1;
+ propslen = ml_propslen + 1;
props = kmem_alloc(propslen, KM_SLEEP);
if (props == NULL) {
@@ -83,7 +84,7 @@
goto out1;
}
- error = copyinstr(ml->ml_props, props, propslen, NULL);
+ error = copyinstr(ml_props, props, propslen, NULL);
if (error != 0)
goto out2;
@@ -97,7 +98,7 @@
props = NULL;
}
- error = module_load(path, ml->ml_flags, dict, MODULE_CLASS_ANY);
+ error = module_load(path, ml_flags, dict, MODULE_CLASS_ANY);
if (dict != NULL) {
prop_object_release(dict);
@@ -142,7 +143,8 @@
error = copyin(arg, &ml, sizeof(ml));
if (error != 0)
break;
- error = handle_modctl_load(&ml);
+ error = handle_modctl_load(ml.ml_filename, ml.ml_flags,
+ ml.ml_props, ml.ml_propslen);
break;
case MODCTL_UNLOAD:
diff -r 327a5af001d6 -r a9eb189677ff sys/sys/module.h
--- a/sys/sys/module.h Fri Jun 19 12:27:02 2015 +0000
+++ b/sys/sys/module.h Fri Jun 19 14:23:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: module.h,v 1.36 2015/03/07 03:19:06 christos Exp $ */
+/* $NetBSD: module.h,v 1.37 2015/06/19 14:23:59 martin Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -228,4 +228,10 @@
int modctl(int, void *);
+#ifdef _KERNEL
+/* attention: pointers passed are userland pointers!,
+ see modctl_load_t */
+int handle_modctl_load(const char *, int, const char *, size_t);
+#endif
+
#endif /* !_SYS_MODULE_H_ */
Home |
Main Index |
Thread Index |
Old Index