1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 9 * DARPA CHATS research program. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. The names of the authors may not be used to endorse or promote 20 * products derived from this software without specific prior written 21 * permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 36#include <sys/cdefs.h>
| 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 9 * DARPA CHATS research program. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. The names of the authors may not be used to endorse or promote 20 * products derived from this software without specific prior written 21 * permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 36#include <sys/cdefs.h>
|
37__FBSDID("$FreeBSD: head/sys/geom/geom_dump.c 222603 2011-06-02 12:49:45Z ae $");
| 37__FBSDID("$FreeBSD: head/sys/geom/geom_dump.c 249507 2013-04-15 15:55:40Z ivoras $");
|
38 39#include <sys/param.h> 40#include <sys/sbuf.h> 41#include <sys/systm.h> 42#include <sys/malloc.h> 43#include <machine/stdarg.h> 44 45#include <geom/geom.h> 46#include <geom/geom_int.h>
| 38 39#include <sys/param.h> 40#include <sys/sbuf.h> 41#include <sys/systm.h> 42#include <sys/malloc.h> 43#include <machine/stdarg.h> 44 45#include <geom/geom.h> 46#include <geom/geom_int.h>
|
| 47#include <geom/geom_disk.h>
|
47 48 49static void 50g_confdot_consumer(struct sbuf *sb, struct g_consumer *cp) 51{ 52 53 sbuf_printf(sb, "z%p [label=\"r%dw%de%d\"];\n", 54 cp, cp->acr, cp->acw, cp->ace); 55 if (cp->provider) 56 sbuf_printf(sb, "z%p -> z%p;\n", cp, cp->provider); 57} 58 59static void 60g_confdot_provider(struct sbuf *sb, struct g_provider *pp) 61{ 62 63 sbuf_printf(sb, "z%p [shape=hexagon,label=\"%s\\nr%dw%de%d\\nerr#%d\"];\n", 64 pp, pp->name, pp->acr, pp->acw, pp->ace, pp->error); 65} 66 67static void 68g_confdot_geom(struct sbuf *sb, struct g_geom *gp) 69{ 70 struct g_consumer *cp; 71 struct g_provider *pp; 72 73 sbuf_printf(sb, "z%p [shape=box,label=\"%s\\n%s\\nr#%d\"];\n", 74 gp, gp->class->name, gp->name, gp->rank); 75 LIST_FOREACH(cp, &gp->consumer, consumer) { 76 g_confdot_consumer(sb, cp); 77 sbuf_printf(sb, "z%p -> z%p;\n", gp, cp); 78 } 79 80 LIST_FOREACH(pp, &gp->provider, provider) { 81 g_confdot_provider(sb, pp); 82 sbuf_printf(sb, "z%p -> z%p;\n", pp, gp); 83 } 84} 85 86static void 87g_confdot_class(struct sbuf *sb, struct g_class *mp) 88{ 89 struct g_geom *gp; 90 91 LIST_FOREACH(gp, &mp->geom, geom) 92 g_confdot_geom(sb, gp); 93} 94 95void 96g_confdot(void *p, int flag ) 97{ 98 struct g_class *mp; 99 struct sbuf *sb; 100 101 KASSERT(flag != EV_CANCEL, ("g_confdot was cancelled")); 102 sb = p; 103 g_topology_assert(); 104 sbuf_printf(sb, "digraph geom {\n"); 105 LIST_FOREACH(mp, &g_classes, class) 106 g_confdot_class(sb, mp); 107 sbuf_printf(sb, "};\n"); 108 sbuf_finish(sb); 109} 110 111static void 112g_conftxt_geom(struct sbuf *sb, struct g_geom *gp, int level) 113{ 114 struct g_provider *pp; 115 struct g_consumer *cp; 116 117 if (gp->flags & G_GEOM_WITHER) 118 return; 119 LIST_FOREACH(pp, &gp->provider, provider) { 120 sbuf_printf(sb, "%d %s %s %ju %u", level, gp->class->name, 121 pp->name, (uintmax_t)pp->mediasize, pp->sectorsize); 122 if (gp->dumpconf != NULL) 123 gp->dumpconf(sb, NULL, gp, NULL, pp); 124 sbuf_printf(sb, "\n"); 125 LIST_FOREACH(cp, &pp->consumers, consumers) 126 g_conftxt_geom(sb, cp->geom, level + 1); 127 } 128} 129 130static void 131g_conftxt_class(struct sbuf *sb, struct g_class *mp) 132{ 133 struct g_geom *gp; 134 135 LIST_FOREACH(gp, &mp->geom, geom) 136 g_conftxt_geom(sb, gp, 0); 137} 138 139void 140g_conftxt(void *p, int flag) 141{ 142 struct g_class *mp; 143 struct sbuf *sb; 144 145 KASSERT(flag != EV_CANCEL, ("g_conftxt was cancelled")); 146 sb = p; 147 g_topology_assert(); 148 LIST_FOREACH(mp, &g_classes, class) {
| 48 49 50static void 51g_confdot_consumer(struct sbuf *sb, struct g_consumer *cp) 52{ 53 54 sbuf_printf(sb, "z%p [label=\"r%dw%de%d\"];\n", 55 cp, cp->acr, cp->acw, cp->ace); 56 if (cp->provider) 57 sbuf_printf(sb, "z%p -> z%p;\n", cp, cp->provider); 58} 59 60static void 61g_confdot_provider(struct sbuf *sb, struct g_provider *pp) 62{ 63 64 sbuf_printf(sb, "z%p [shape=hexagon,label=\"%s\\nr%dw%de%d\\nerr#%d\"];\n", 65 pp, pp->name, pp->acr, pp->acw, pp->ace, pp->error); 66} 67 68static void 69g_confdot_geom(struct sbuf *sb, struct g_geom *gp) 70{ 71 struct g_consumer *cp; 72 struct g_provider *pp; 73 74 sbuf_printf(sb, "z%p [shape=box,label=\"%s\\n%s\\nr#%d\"];\n", 75 gp, gp->class->name, gp->name, gp->rank); 76 LIST_FOREACH(cp, &gp->consumer, consumer) { 77 g_confdot_consumer(sb, cp); 78 sbuf_printf(sb, "z%p -> z%p;\n", gp, cp); 79 } 80 81 LIST_FOREACH(pp, &gp->provider, provider) { 82 g_confdot_provider(sb, pp); 83 sbuf_printf(sb, "z%p -> z%p;\n", pp, gp); 84 } 85} 86 87static void 88g_confdot_class(struct sbuf *sb, struct g_class *mp) 89{ 90 struct g_geom *gp; 91 92 LIST_FOREACH(gp, &mp->geom, geom) 93 g_confdot_geom(sb, gp); 94} 95 96void 97g_confdot(void *p, int flag ) 98{ 99 struct g_class *mp; 100 struct sbuf *sb; 101 102 KASSERT(flag != EV_CANCEL, ("g_confdot was cancelled")); 103 sb = p; 104 g_topology_assert(); 105 sbuf_printf(sb, "digraph geom {\n"); 106 LIST_FOREACH(mp, &g_classes, class) 107 g_confdot_class(sb, mp); 108 sbuf_printf(sb, "};\n"); 109 sbuf_finish(sb); 110} 111 112static void 113g_conftxt_geom(struct sbuf *sb, struct g_geom *gp, int level) 114{ 115 struct g_provider *pp; 116 struct g_consumer *cp; 117 118 if (gp->flags & G_GEOM_WITHER) 119 return; 120 LIST_FOREACH(pp, &gp->provider, provider) { 121 sbuf_printf(sb, "%d %s %s %ju %u", level, gp->class->name, 122 pp->name, (uintmax_t)pp->mediasize, pp->sectorsize); 123 if (gp->dumpconf != NULL) 124 gp->dumpconf(sb, NULL, gp, NULL, pp); 125 sbuf_printf(sb, "\n"); 126 LIST_FOREACH(cp, &pp->consumers, consumers) 127 g_conftxt_geom(sb, cp->geom, level + 1); 128 } 129} 130 131static void 132g_conftxt_class(struct sbuf *sb, struct g_class *mp) 133{ 134 struct g_geom *gp; 135 136 LIST_FOREACH(gp, &mp->geom, geom) 137 g_conftxt_geom(sb, gp, 0); 138} 139 140void 141g_conftxt(void *p, int flag) 142{ 143 struct g_class *mp; 144 struct sbuf *sb; 145 146 KASSERT(flag != EV_CANCEL, ("g_conftxt was cancelled")); 147 sb = p; 148 g_topology_assert(); 149 LIST_FOREACH(mp, &g_classes, class) {
|
149 if (!strcmp(mp->name, "DISK") || !strcmp(mp->name, "MD"))
| 150 if (!strcmp(mp->name, G_DISK_CLASS_NAME) || !strcmp(mp->name, "MD"))
|
150 g_conftxt_class(sb, mp); 151 } 152 sbuf_finish(sb); 153} 154 155 156static void 157g_conf_print_escaped(struct sbuf *sb, const char *fmt, const char *str) 158{ 159 struct sbuf *s; 160 const u_char *c; 161 162 s = sbuf_new_auto(); 163 164 for (c = str; *c != '\0'; c++) { 165 if (*c == '&' || *c == '<' || *c == '>' || 166 *c == '\'' || *c == '"' || *c > 0x7e) 167 sbuf_printf(s, "&#x%X;", *c); 168 else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) 169 sbuf_putc(s, *c); 170 else 171 sbuf_putc(s, '?'); 172 } 173 sbuf_finish(s); 174 sbuf_printf(sb, fmt, sbuf_data(s)); 175 sbuf_delete(s); 176} 177 178static void 179g_conf_consumer(struct sbuf *sb, struct g_consumer *cp) 180{ 181 182 sbuf_printf(sb, "\t<consumer id=\"%p\">\n", cp); 183 sbuf_printf(sb, "\t <geom ref=\"%p\"/>\n", cp->geom); 184 if (cp->provider != NULL) 185 sbuf_printf(sb, "\t <provider ref=\"%p\"/>\n", cp->provider); 186 sbuf_printf(sb, "\t <mode>r%dw%de%d</mode>\n", 187 cp->acr, cp->acw, cp->ace); 188 if (cp->geom->flags & G_GEOM_WITHER) 189 ; 190 else if (cp->geom->dumpconf != NULL) { 191 sbuf_printf(sb, "\t <config>\n"); 192 cp->geom->dumpconf(sb, "\t ", cp->geom, cp, NULL); 193 sbuf_printf(sb, "\t </config>\n"); 194 } 195 sbuf_printf(sb, "\t</consumer>\n"); 196} 197 198static void 199g_conf_provider(struct sbuf *sb, struct g_provider *pp) 200{ 201 202 sbuf_printf(sb, "\t<provider id=\"%p\">\n", pp); 203 sbuf_printf(sb, "\t <geom ref=\"%p\"/>\n", pp->geom); 204 sbuf_printf(sb, "\t <mode>r%dw%de%d</mode>\n", 205 pp->acr, pp->acw, pp->ace); 206 g_conf_print_escaped(sb, "\t <name>%s</name>\n", pp->name); 207 sbuf_printf(sb, "\t <mediasize>%jd</mediasize>\n", 208 (intmax_t)pp->mediasize); 209 sbuf_printf(sb, "\t <sectorsize>%u</sectorsize>\n", pp->sectorsize); 210 sbuf_printf(sb, "\t <stripesize>%u</stripesize>\n", pp->stripesize); 211 sbuf_printf(sb, "\t <stripeoffset>%u</stripeoffset>\n", pp->stripeoffset); 212 if (pp->geom->flags & G_GEOM_WITHER) 213 ; 214 else if (pp->geom->dumpconf != NULL) { 215 sbuf_printf(sb, "\t <config>\n"); 216 pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp); 217 sbuf_printf(sb, "\t </config>\n"); 218 } 219 sbuf_printf(sb, "\t</provider>\n"); 220} 221 222 223static void 224g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 225{ 226 struct g_consumer *cp2; 227 struct g_provider *pp2; 228 229 sbuf_printf(sb, " <geom id=\"%p\">\n", gp); 230 sbuf_printf(sb, " <class ref=\"%p\"/>\n", gp->class); 231 g_conf_print_escaped(sb, " <name>%s</name>\n", gp->name); 232 sbuf_printf(sb, " <rank>%d</rank>\n", gp->rank); 233 if (gp->flags & G_GEOM_WITHER) 234 sbuf_printf(sb, " <wither/>\n"); 235 else if (gp->dumpconf != NULL) { 236 sbuf_printf(sb, " <config>\n"); 237 gp->dumpconf(sb, "\t", gp, NULL, NULL); 238 sbuf_printf(sb, " </config>\n"); 239 } 240 LIST_FOREACH(cp2, &gp->consumer, consumer) { 241 if (cp != NULL && cp != cp2) 242 continue; 243 g_conf_consumer(sb, cp2); 244 } 245 246 LIST_FOREACH(pp2, &gp->provider, provider) { 247 if (pp != NULL && pp != pp2) 248 continue; 249 g_conf_provider(sb, pp2); 250 } 251 sbuf_printf(sb, " </geom>\n"); 252} 253 254static void 255g_conf_class(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 256{ 257 struct g_geom *gp2; 258 259 sbuf_printf(sb, " <class id=\"%p\">\n", mp); 260 g_conf_print_escaped(sb, " <name>%s</name>\n", mp->name); 261 LIST_FOREACH(gp2, &mp->geom, geom) { 262 if (gp != NULL && gp != gp2) 263 continue; 264 g_conf_geom(sb, gp2, pp, cp); 265 } 266 sbuf_printf(sb, " </class>\n"); 267} 268 269void 270g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 271{ 272 struct g_class *mp2; 273 274 g_topology_assert(); 275 sbuf_printf(sb, "<mesh>\n"); 276 LIST_FOREACH(mp2, &g_classes, class) { 277 if (mp != NULL && mp != mp2) 278 continue; 279 g_conf_class(sb, mp2, gp, pp, cp); 280 } 281 sbuf_printf(sb, "</mesh>\n"); 282 sbuf_finish(sb); 283} 284 285void 286g_confxml(void *p, int flag) 287{ 288 289 KASSERT(flag != EV_CANCEL, ("g_confxml was cancelled")); 290 g_topology_assert(); 291 g_conf_specific(p, NULL, NULL, NULL, NULL); 292} 293 294void 295g_trace(int level, const char *fmt, ...) 296{ 297 va_list ap; 298 299 if (!(g_debugflags & level)) 300 return; 301 va_start(ap, fmt); 302 vprintf(fmt, ap); 303 va_end(ap); 304 printf("\n"); 305}
| 151 g_conftxt_class(sb, mp); 152 } 153 sbuf_finish(sb); 154} 155 156 157static void 158g_conf_print_escaped(struct sbuf *sb, const char *fmt, const char *str) 159{ 160 struct sbuf *s; 161 const u_char *c; 162 163 s = sbuf_new_auto(); 164 165 for (c = str; *c != '\0'; c++) { 166 if (*c == '&' || *c == '<' || *c == '>' || 167 *c == '\'' || *c == '"' || *c > 0x7e) 168 sbuf_printf(s, "&#x%X;", *c); 169 else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) 170 sbuf_putc(s, *c); 171 else 172 sbuf_putc(s, '?'); 173 } 174 sbuf_finish(s); 175 sbuf_printf(sb, fmt, sbuf_data(s)); 176 sbuf_delete(s); 177} 178 179static void 180g_conf_consumer(struct sbuf *sb, struct g_consumer *cp) 181{ 182 183 sbuf_printf(sb, "\t<consumer id=\"%p\">\n", cp); 184 sbuf_printf(sb, "\t <geom ref=\"%p\"/>\n", cp->geom); 185 if (cp->provider != NULL) 186 sbuf_printf(sb, "\t <provider ref=\"%p\"/>\n", cp->provider); 187 sbuf_printf(sb, "\t <mode>r%dw%de%d</mode>\n", 188 cp->acr, cp->acw, cp->ace); 189 if (cp->geom->flags & G_GEOM_WITHER) 190 ; 191 else if (cp->geom->dumpconf != NULL) { 192 sbuf_printf(sb, "\t <config>\n"); 193 cp->geom->dumpconf(sb, "\t ", cp->geom, cp, NULL); 194 sbuf_printf(sb, "\t </config>\n"); 195 } 196 sbuf_printf(sb, "\t</consumer>\n"); 197} 198 199static void 200g_conf_provider(struct sbuf *sb, struct g_provider *pp) 201{ 202 203 sbuf_printf(sb, "\t<provider id=\"%p\">\n", pp); 204 sbuf_printf(sb, "\t <geom ref=\"%p\"/>\n", pp->geom); 205 sbuf_printf(sb, "\t <mode>r%dw%de%d</mode>\n", 206 pp->acr, pp->acw, pp->ace); 207 g_conf_print_escaped(sb, "\t <name>%s</name>\n", pp->name); 208 sbuf_printf(sb, "\t <mediasize>%jd</mediasize>\n", 209 (intmax_t)pp->mediasize); 210 sbuf_printf(sb, "\t <sectorsize>%u</sectorsize>\n", pp->sectorsize); 211 sbuf_printf(sb, "\t <stripesize>%u</stripesize>\n", pp->stripesize); 212 sbuf_printf(sb, "\t <stripeoffset>%u</stripeoffset>\n", pp->stripeoffset); 213 if (pp->geom->flags & G_GEOM_WITHER) 214 ; 215 else if (pp->geom->dumpconf != NULL) { 216 sbuf_printf(sb, "\t <config>\n"); 217 pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp); 218 sbuf_printf(sb, "\t </config>\n"); 219 } 220 sbuf_printf(sb, "\t</provider>\n"); 221} 222 223 224static void 225g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 226{ 227 struct g_consumer *cp2; 228 struct g_provider *pp2; 229 230 sbuf_printf(sb, " <geom id=\"%p\">\n", gp); 231 sbuf_printf(sb, " <class ref=\"%p\"/>\n", gp->class); 232 g_conf_print_escaped(sb, " <name>%s</name>\n", gp->name); 233 sbuf_printf(sb, " <rank>%d</rank>\n", gp->rank); 234 if (gp->flags & G_GEOM_WITHER) 235 sbuf_printf(sb, " <wither/>\n"); 236 else if (gp->dumpconf != NULL) { 237 sbuf_printf(sb, " <config>\n"); 238 gp->dumpconf(sb, "\t", gp, NULL, NULL); 239 sbuf_printf(sb, " </config>\n"); 240 } 241 LIST_FOREACH(cp2, &gp->consumer, consumer) { 242 if (cp != NULL && cp != cp2) 243 continue; 244 g_conf_consumer(sb, cp2); 245 } 246 247 LIST_FOREACH(pp2, &gp->provider, provider) { 248 if (pp != NULL && pp != pp2) 249 continue; 250 g_conf_provider(sb, pp2); 251 } 252 sbuf_printf(sb, " </geom>\n"); 253} 254 255static void 256g_conf_class(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 257{ 258 struct g_geom *gp2; 259 260 sbuf_printf(sb, " <class id=\"%p\">\n", mp); 261 g_conf_print_escaped(sb, " <name>%s</name>\n", mp->name); 262 LIST_FOREACH(gp2, &mp->geom, geom) { 263 if (gp != NULL && gp != gp2) 264 continue; 265 g_conf_geom(sb, gp2, pp, cp); 266 } 267 sbuf_printf(sb, " </class>\n"); 268} 269 270void 271g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 272{ 273 struct g_class *mp2; 274 275 g_topology_assert(); 276 sbuf_printf(sb, "<mesh>\n"); 277 LIST_FOREACH(mp2, &g_classes, class) { 278 if (mp != NULL && mp != mp2) 279 continue; 280 g_conf_class(sb, mp2, gp, pp, cp); 281 } 282 sbuf_printf(sb, "</mesh>\n"); 283 sbuf_finish(sb); 284} 285 286void 287g_confxml(void *p, int flag) 288{ 289 290 KASSERT(flag != EV_CANCEL, ("g_confxml was cancelled")); 291 g_topology_assert(); 292 g_conf_specific(p, NULL, NULL, NULL, NULL); 293} 294 295void 296g_trace(int level, const char *fmt, ...) 297{ 298 va_list ap; 299 300 if (!(g_debugflags & level)) 301 return; 302 va_start(ap, fmt); 303 vprintf(fmt, ap); 304 va_end(ap); 305 printf("\n"); 306}
|