Module Name: src
Committed By: pooka
Date: Mon Jan 14 16:35:06 UTC 2013
Modified Files:
src/sys/rump/librump/rumpkern: rump.c
Log Message:
Add some asserts to component initialization.
To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/rump/librump/rumpkern/rump.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.247 src/sys/rump/librump/rumpkern/rump.c:1.248
--- src/sys/rump/librump/rumpkern/rump.c:1.247 Tue Oct 9 13:35:50 2012
+++ src/sys/rump/librump/rumpkern/rump.c Mon Jan 14 16:35:06 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.c,v 1.247 2012/10/09 13:35:50 pooka Exp $ */
+/* $NetBSD: rump.c,v 1.248 2013/01/14 16:35:06 pooka Exp $ */
/*
* Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.247 2012/10/09 13:35:50 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.248 2013/01/14 16:35:06 pooka Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@@ -651,12 +651,14 @@ rump_cred_put(kauth_cred_t cred)
}
static int compcounter[RUMP_COMPONENT_MAX];
+static int compinited[RUMP_COMPONENT_MAX];
static void
rump_component_init_cb(struct rump_component *rc, int type)
{
KASSERT(type < RUMP_COMPONENT_MAX);
+
if (rc->rc_type == type) {
rc->rc_init();
compcounter[type]++;
@@ -668,6 +670,7 @@ rump_component_count(enum rump_component
{
KASSERT(type <= RUMP_COMPONENT_MAX);
+ KASSERT(compinited[type]);
return compcounter[type];
}
@@ -675,7 +678,9 @@ void
rump_component_init(enum rump_component_type type)
{
+ KASSERT(!compinited[type]);
rumpuser_dl_component_init(type, rump_component_init_cb);
+ compinited[type] = 1;
}
/*