diff options
author | phk <phk@FreeBSD.org> | 2002-11-20 18:10:42 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-11-20 18:10:42 +0000 |
commit | 65d6c06a91ce5decaab46a4a3db74cace4e37cb8 (patch) | |
tree | 7efbab39e03dc63ddf92d9bb30fa37a73a9b9316 /sys/geom/geom_dump.c | |
parent | 15c7fa3d74fa4a5283696af6542fbd049951118e (diff) | |
download | FreeBSD-src-65d6c06a91ce5decaab46a4a3db74cace4e37cb8.zip FreeBSD-src-65d6c06a91ce5decaab46a4a3db74cace4e37cb8.tar.gz |
Do not call the dumpconf method unless there is one.
Compare pointers with NULL.
Partially submitted by: Christian Carstensen <cc@gate5.de>
Approved by: re
Diffstat (limited to 'sys/geom/geom_dump.c')
-rw-r--r-- | sys/geom/geom_dump.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/geom/geom_dump.c b/sys/geom/geom_dump.c index 7e4ce37..95a9ffd 100644 --- a/sys/geom/geom_dump.c +++ b/sys/geom/geom_dump.c @@ -126,7 +126,8 @@ g_conftxt_geom(struct sbuf *sb, struct g_geom *gp, int level) LIST_FOREACH(pp, &gp->provider, provider) { sbuf_printf(sb, "%d %s %s %ju %u", level, gp->class->name, pp->name, (uintmax_t)pp->mediasize, pp->sectorsize); - gp->dumpconf(sb, NULL, gp, NULL, pp); + if (gp->dumpconf != NULL) + gp->dumpconf(sb, NULL, gp, NULL, pp); sbuf_printf(sb, "\n"); LIST_FOREACH(cp, &pp->consumers, consumers) g_conftxt_geom(sb, cp->geom, level + 1); @@ -170,7 +171,7 @@ g_conf_consumer(struct sbuf *sb, struct g_consumer *cp) sbuf_printf(sb, "\t <provider ref=\"%p\"/>\n", cp->provider); sbuf_printf(sb, "\t <mode>r%dw%de%d</mode>\n", cp->acr, cp->acw, cp->ace); - if (cp->geom->dumpconf) { + if (cp->geom->dumpconf != NULL) { sbuf_printf(sb, "\t <config>\n"); cp->geom->dumpconf(sb, "\t ", cp->geom, cp, NULL); sbuf_printf(sb, "\t </config>\n"); @@ -190,7 +191,7 @@ g_conf_provider(struct sbuf *sb, struct g_provider *pp) sbuf_printf(sb, "\t <mediasize>%jd</mediasize>\n", (intmax_t)pp->mediasize); sbuf_printf(sb, "\t <sectorsize>%u</sectorsize>\n", pp->sectorsize); - if (pp->geom->dumpconf) { + if (pp->geom->dumpconf != NULL) { sbuf_printf(sb, "\t <config>\n"); pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp); sbuf_printf(sb, "\t </config>\n"); @@ -209,7 +210,7 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_ sbuf_printf(sb, " <class ref=\"%p\"/>\n", gp->class); sbuf_printf(sb, " <name>%s</name>\n", gp->name); sbuf_printf(sb, " <rank>%d</rank>\n", gp->rank); - if (gp->dumpconf) { + if (gp->dumpconf != NULL) { sbuf_printf(sb, " <config>\n"); gp->dumpconf(sb, "\t", gp, NULL, NULL); sbuf_printf(sb, " </config>\n"); |