summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_subr.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-01-23 21:02:49 +0000
committerphk <phk@FreeBSD.org>2004-01-23 21:02:49 +0000
commit67d83922288af8f8de614c65bfc3661494fc8e98 (patch)
tree6f8da246f1e1398ceb408c0b3b53bcb48b3a8dd5 /sys/geom/geom_subr.c
parent718d82cd61f270ab6f5586658e3d6204b35e4f64 (diff)
downloadFreeBSD-src-67d83922288af8f8de614c65bfc3661494fc8e98.zip
FreeBSD-src-67d83922288af8f8de614c65bfc3661494fc8e98.tar.gz
Add KASSERTS.
Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>
Diffstat (limited to 'sys/geom/geom_subr.c')
-rw-r--r--sys/geom/geom_subr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c
index e6e9090..734c0a6 100644
--- a/sys/geom/geom_subr.c
+++ b/sys/geom/geom_subr.c
@@ -85,6 +85,8 @@ g_load_class(void *arg, int flag)
mp = hh->mp;
g_free(hh);
g_trace(G_T_TOPOLOGY, "g_load_class(%s)", mp->name);
+ KASSERT(mp->name != NULL && *mp->name != '\0',
+ ("GEOM class has no name"));
LIST_FOREACH(mp2, &g_classes, class) {
KASSERT(mp2 != mp,
("The GEOM class %s already loaded", mp2->name));
@@ -291,6 +293,9 @@ g_new_consumer(struct g_geom *gp)
struct g_consumer *cp;
g_topology_assert();
+ KASSERT(!(gp->flags & G_GEOM_WITHER),
+ ("g_new_consumer on WITHERing geom(%s) (class %s)",
+ gp->name, gp->class->name));
KASSERT(gp->orphan != NULL,
("g_new_consumer on geom(%s) (class %s) without orphan",
gp->name, gp->class->name));
@@ -368,6 +373,12 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...)
va_list ap;
g_topology_assert();
+ KASSERT(gp->start != NULL,
+ ("new provider on geom(%s) without ->start (class:%s)",
+ gp->class->name, gp->class->name));
+ KASSERT(!(gp->flags & G_GEOM_WITHER),
+ ("new provider on WITHERing geom(%s) (class:%s)",
+ gp->class->name, gp->class->name));
sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND);
va_start(ap, fmt);
sbuf_vprintf(sb, fmt, ap);
OpenPOWER on IntegriCloud