Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern enqueue loaded modules and prevent...
details: https://anonhg.NetBSD.org/src/rev/a961d8a60298
branches: trunk
changeset: 748790:a961d8a60298
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Nov 05 14:10:53 2009 +0000
description:
enqueue loaded modules and prevent duplicates
diffstat:
sys/rump/librump/rumpkern/rump.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diffs (57 lines):
diff -r 96246ffaf6f9 -r a961d8a60298 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c Thu Nov 05 14:09:14 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump.c Thu Nov 05 14:10:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.c,v 1.133 2009/11/04 13:32:39 pooka Exp $ */
+/* $NetBSD: rump.c,v 1.134 2009/11/05 14:10:53 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.133 2009/11/04 13:32:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.134 2009/11/05 14:10:53 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -574,18 +574,35 @@
return retid;
}
+#define ERROUT(err) do { rv = err; goto out; } while (/*CONSTCOND*/0)
int
rump_module_init(struct modinfo *mi, prop_dictionary_t props)
{
+ struct module *mod;
int rv;
+ /* module_dummy */
+ if (mi->mi_name == NULL)
+ return EINVAL;
+
+ mutex_enter(&module_lock);
+ if (module_lookup(mi->mi_name))
+ ERROUT(EEXIST);
+
if (!module_compatible(mi->mi_version, __NetBSD_Version__))
- return EPROGMISMATCH;
+ ERROUT(EPROGMISMATCH);
rv = mi->mi_modcmd(MODULE_CMD_INIT, props);
- if (rv == 0 && mi->mi_class == MODULE_CLASS_SECMODEL)
- secmodel_register();
+ if (rv == 0) {
+ mod = kmem_zalloc(sizeof(*mod), KM_SLEEP);
+ mod->mod_info = mi;
+ module_enqueue(mod);
+ if (mi->mi_class == MODULE_CLASS_SECMODEL)
+ secmodel_register();
+ }
+ out:
+ mutex_exit(&module_lock);
return rv;
}
Home |
Main Index |
Thread Index |
Old Index