diff options
author | phk <phk@FreeBSD.org> | 2003-06-04 17:51:10 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-06-04 17:51:10 +0000 |
commit | 1ee949187cbb2b2a4f2b295521f8053df90e6fca (patch) | |
tree | 77643bd173fde7d9fb2d93b9643962a6abee12d1 /sys/geom | |
parent | 6d070a0d03ff430cf241032ab01cdf4d14113287 (diff) | |
download | FreeBSD-src-1ee949187cbb2b2a4f2b295521f8053df90e6fca.zip FreeBSD-src-1ee949187cbb2b2a4f2b295521f8053df90e6fca.tar.gz |
Add a KASSERT to prevent the same GEOM class from being processed loaded
twice.
Enforce that classes should have different names while we are here.
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_subr.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 51702d2..00bdfcb 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -84,6 +84,12 @@ g_load_class(void *arg, int flag) mp = hh->mp; g_free(hh); g_trace(G_T_TOPOLOGY, "g_load_class(%s)", mp->name); + LIST_FOREACH(mp2, &g_classes, class) { + KASSERT(mp2 != mp, + ("The GEOM class %s already loaded", mp2->name)); + KASSERT(strcmp(mp2->name, mp->name) != 0, + ("A GEOM class named %s is already loaded", mp2->name)); + } if (mp->init != NULL) mp->init(mp); |