g_stripe.c (889c5dc22b77f90ca23f626646739724bf814c57) | g_stripe.c (1d723f1d518b79fdea655f82e5419ae4888ad78c) |
---|---|
1/*- 2 * Copyright (c) 2003 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1114 unchanged lines hidden (view full) --- 1123 1124static void 1125g_stripe_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, 1126 struct g_consumer *cp, struct g_provider *pp) 1127{ 1128 struct g_stripe_softc *sc; 1129 1130 sc = gp->softc; | 1/*- 2 * Copyright (c) 2003 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1114 unchanged lines hidden (view full) --- 1123 1124static void 1125g_stripe_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, 1126 struct g_consumer *cp, struct g_provider *pp) 1127{ 1128 struct g_stripe_softc *sc; 1129 1130 sc = gp->softc; |
1131 if (sc == NULL || pp == NULL) | 1131 if (sc == NULL) |
1132 return; | 1132 return; |
1133 sbuf_printf(sb, "%s<id>%u</id>\n", indent, (u_int)sc->sc_id); 1134 sbuf_printf(sb, "%s<stripesize>%u</stripesize>\n", indent, 1135 (u_int)sc->sc_stripesize); 1136 switch (sc->sc_type) { 1137 case G_STRIPE_TYPE_AUTOMATIC: 1138 sbuf_printf(sb, "%s<type>%s</type>\n", indent, "automatic"); 1139 break; 1140 case G_STRIPE_TYPE_MANUAL: 1141 sbuf_printf(sb, "%s<type>%s</type>\n", indent, "manual"); 1142 break; 1143 default: 1144 sbuf_printf(sb, "%s<type>%s</type>\n", indent, "unknown"); 1145 break; | 1133 if (pp != NULL) { 1134 /* Nothing here. */ 1135 } else if (cp != NULL) { 1136 /* Nothing here. */ 1137 } else { 1138 sbuf_printf(sb, "%s<ID>%u</ID>\n", indent, (u_int)sc->sc_id); 1139 sbuf_printf(sb, "%s<Stripesize>%u</Stripesize>\n", indent, 1140 (u_int)sc->sc_stripesize); 1141 sbuf_printf(sb, "%s<Type>", indent); 1142 switch (sc->sc_type) { 1143 case G_STRIPE_TYPE_AUTOMATIC: 1144 sbuf_printf(sb, "AUTOMATIC"); 1145 break; 1146 case G_STRIPE_TYPE_MANUAL: 1147 sbuf_printf(sb, "MANUAL"); 1148 break; 1149 default: 1150 sbuf_printf(sb, "UNKNOWN"); 1151 break; 1152 } 1153 sbuf_printf(sb, "</Type>\n"); 1154 sbuf_printf(sb, "%s<Status>Total=%u, Online=%u</Status>\n", 1155 indent, sc->sc_ndisks, g_stripe_nvalid(sc)); 1156 sbuf_printf(sb, "%s<State>", indent); 1157 if (sc->sc_provider != NULL && sc->sc_provider->error == 0) 1158 sbuf_printf(sb, "UP"); 1159 else 1160 sbuf_printf(sb, "DOWN"); 1161 sbuf_printf(sb, "</State>\n"); |
1146 } | 1162 } |
1147 sbuf_printf(sb, "%s<providers>", indent); 1148 LIST_FOREACH(cp, &gp->consumer, consumer) { 1149 if (cp->provider == NULL) 1150 continue; 1151 sbuf_printf(sb, "%s", cp->provider->name); 1152 if (LIST_NEXT(cp, consumer) != NULL) 1153 sbuf_printf(sb, " "); 1154 } 1155 sbuf_printf(sb, "</providers>\n"); 1156 sbuf_printf(sb, "%s<status>total=%u, online=%u</status>\n", indent, 1157 sc->sc_ndisks, g_stripe_nvalid(sc)); 1158 if (pp->error == 0) 1159 sbuf_printf(sb, "%s<state>UP</state>\n", indent); 1160 else 1161 sbuf_printf(sb, "%s<state>DOWN</state>\n", indent); | |
1162} 1163 1164DECLARE_GEOM_CLASS(g_stripe_class, g_stripe); | 1163} 1164 1165DECLARE_GEOM_CLASS(g_stripe_class, g_stripe); |