From 4a04a3b0074cff6df372ea64435cdfaa51dd6835 Mon Sep 17 00:00:00 2001 From: pjd Date: Wed, 26 May 2004 11:36:27 +0000 Subject: Dump some more informations: - device state - list of used providers - total number of disks - number of disks online Prodded by: Alex Deiter --- sys/geom/concat/g_concat.c | 45 +++++++++++++++++++++++++++---------------- sys/geom/stripe/g_stripe.c | 48 ++++++++++++++++++++++++++++------------------ 2 files changed, 57 insertions(+), 36 deletions(-) (limited to 'sys') diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c index 43c99de..768e2cb 100644 --- a/sys/geom/concat/g_concat.c +++ b/sys/geom/concat/g_concat.c @@ -804,26 +804,37 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, { struct g_concat_softc *sc; + g_topology_assert(); sc = gp->softc; - if (sc == NULL) + if (sc == NULL || pp == NULL) return; - if (pp == NULL && cp == NULL) { - sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_id); - switch (sc->sc_type) { - case G_CONCAT_TYPE_AUTOMATIC: - sbuf_printf(sb, "%s%s\n", indent, - "automatic"); - break; - case G_CONCAT_TYPE_MANUAL: - sbuf_printf(sb, "%s%s\n", indent, - "manual"); - break; - default: - sbuf_printf(sb, "%s%s\n", indent, - "unknown"); - break; - } + sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_id); + switch (sc->sc_type) { + case G_CONCAT_TYPE_AUTOMATIC: + sbuf_printf(sb, "%s%s\n", indent, "automatic"); + break; + case G_CONCAT_TYPE_MANUAL: + sbuf_printf(sb, "%s%s\n", indent, "manual"); + break; + default: + sbuf_printf(sb, "%s%s\n", indent, "unknown"); + break; } + sbuf_printf(sb, "%s", indent); + LIST_FOREACH(cp, &gp->consumer, consumer) { + if (cp->provider == NULL) + continue; + sbuf_printf(sb, "%s", cp->provider->name); + if (LIST_NEXT(cp, consumer) != NULL) + sbuf_printf(sb, " "); + } + sbuf_printf(sb, "\n"); + sbuf_printf(sb, "%stotal=%u, online=%u\n", indent, + sc->sc_ndisks, g_concat_nvalid(sc)); + if (pp->error == 0) + sbuf_printf(sb, "%sUP\n", indent); + else + sbuf_printf(sb, "%sDOWN\n", indent); } DECLARE_GEOM_CLASS(g_concat_class, g_concat); diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c index 3b596b0..1d87a49 100644 --- a/sys/geom/stripe/g_stripe.c +++ b/sys/geom/stripe/g_stripe.c @@ -874,27 +874,37 @@ g_stripe_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_stripe_softc *sc; sc = gp->softc; - if (sc == NULL) + if (sc == NULL || pp == NULL) return; - if (gp != NULL) { - sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_id); - sbuf_printf(sb, "%s%u\n", indent, - (u_int)sc->sc_stripesize); - switch (sc->sc_type) { - case G_STRIPE_TYPE_AUTOMATIC: - sbuf_printf(sb, "%s%s\n", indent, - "automatic"); - break; - case G_STRIPE_TYPE_MANUAL: - sbuf_printf(sb, "%s%s\n", indent, - "manual"); - break; - default: - sbuf_printf(sb, "%s%s\n", indent, - "unknown"); - break; - } + sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_id); + sbuf_printf(sb, "%s%u\n", indent, + (u_int)sc->sc_stripesize); + switch (sc->sc_type) { + case G_STRIPE_TYPE_AUTOMATIC: + sbuf_printf(sb, "%s%s\n", indent, "automatic"); + break; + case G_STRIPE_TYPE_MANUAL: + sbuf_printf(sb, "%s%s\n", indent, "manual"); + break; + default: + sbuf_printf(sb, "%s%s\n", indent, "unknown"); + break; } + sbuf_printf(sb, "%s", indent); + LIST_FOREACH(cp, &gp->consumer, consumer) { + if (cp->provider == NULL) + continue; + sbuf_printf(sb, "%s", cp->provider->name); + if (LIST_NEXT(cp, consumer) != NULL) + sbuf_printf(sb, " "); + } + sbuf_printf(sb, "\n"); + sbuf_printf(sb, "%stotal=%u, online=%u\n", indent, + sc->sc_ndisks, g_stripe_nvalid(sc)); + if (pp->error == 0) + sbuf_printf(sb, "%sUP\n", indent); + else + sbuf_printf(sb, "%sDOWN\n", indent); } DECLARE_GEOM_CLASS(g_stripe_class, g_stripe); -- cgit v1.1