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 Add some asserts to component init...



details:   https://anonhg.NetBSD.org/src/rev/3c6dc20566a3
branches:  trunk
changeset: 783996:3c6dc20566a3
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Jan 14 16:35:06 2013 +0000

description:
Add some asserts to component initialization.

diffstat:

 sys/rump/librump/rumpkern/rump.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r 181d6fc8b971 -r 3c6dc20566a3 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Mon Jan 14 16:00:49 2013 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Mon Jan 14 16:35:06 2013 +0000
@@ -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 @@
 }
 
 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 @@
 {
 
        KASSERT(type <= RUMP_COMPONENT_MAX);
+       KASSERT(compinited[type]);
        return compcounter[type];
 }
 
@@ -675,7 +678,9 @@
 rump_component_init(enum rump_component_type type)
 {
 
+       KASSERT(!compinited[type]);
        rumpuser_dl_component_init(type, rump_component_init_cb);
+       compinited[type] = 1;
 }
 
 /*



Home | Main Index | Thread Index | Old Index