geom_dump.c (92108) | geom_dump.c (93248) |
---|---|
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 --- 18 unchanged lines hidden (view full) --- 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 * | 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 --- 18 unchanged lines hidden (view full) --- 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 * $FreeBSD: head/sys/geom/geom_dump.c 92108 2002-03-11 21:42:35Z phk $ | 35 * $FreeBSD: head/sys/geom/geom_dump.c 93248 2002-03-26 21:40:06Z phk $ |
36 */ 37 38 39#include <sys/param.h> 40#include <sys/sbuf.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 28 unchanged lines hidden (view full) --- 72 73static void 74g_confdot_geom(struct sbuf *sb, struct g_geom *gp) 75{ 76 struct g_consumer *cp; 77 struct g_provider *pp; 78 79 sbuf_printf(sb, "z%p [shape=box,label=\"%s\\n%s\\nr#%d\"];\n", | 36 */ 37 38 39#include <sys/param.h> 40#include <sys/sbuf.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 28 unchanged lines hidden (view full) --- 72 73static void 74g_confdot_geom(struct sbuf *sb, struct g_geom *gp) 75{ 76 struct g_consumer *cp; 77 struct g_provider *pp; 78 79 sbuf_printf(sb, "z%p [shape=box,label=\"%s\\n%s\\nr#%d\"];\n", |
80 gp, gp->method->name, gp->name, gp->rank); | 80 gp, gp->class->name, gp->name, gp->rank); |
81 LIST_FOREACH(cp, &gp->consumer, consumer) { 82 g_confdot_consumer(sb, cp); 83 sbuf_printf(sb, "z%p -> z%p;\n", gp, cp); 84 } 85 86 LIST_FOREACH(pp, &gp->provider, provider) { 87 g_confdot_provider(sb, pp); 88 sbuf_printf(sb, "z%p -> z%p;\n", pp, gp); 89 } 90} 91 92static void | 81 LIST_FOREACH(cp, &gp->consumer, consumer) { 82 g_confdot_consumer(sb, cp); 83 sbuf_printf(sb, "z%p -> z%p;\n", gp, cp); 84 } 85 86 LIST_FOREACH(pp, &gp->provider, provider) { 87 g_confdot_provider(sb, pp); 88 sbuf_printf(sb, "z%p -> z%p;\n", pp, gp); 89 } 90} 91 92static void |
93g_confdot_method(struct sbuf *sb, struct g_method *mp) | 93g_confdot_class(struct sbuf *sb, struct g_class *mp) |
94{ 95 struct g_geom *gp; 96 97 LIST_FOREACH(gp, &mp->geom, geom) 98 g_confdot_geom(sb, gp); 99} 100 101struct sbuf * 102g_confdot(void) 103{ | 94{ 95 struct g_geom *gp; 96 97 LIST_FOREACH(gp, &mp->geom, geom) 98 g_confdot_geom(sb, gp); 99} 100 101struct sbuf * 102g_confdot(void) 103{ |
104 struct g_method *mp; | 104 struct g_class *mp; |
105 struct sbuf *sb; 106 107 sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); 108 sbuf_clear(sb); 109 sbuf_printf(sb, "digraph geom {\n"); | 105 struct sbuf *sb; 106 107 sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); 108 sbuf_clear(sb); 109 sbuf_printf(sb, "digraph geom {\n"); |
110 LIST_FOREACH(mp, &g_methods, method) 111 g_confdot_method(sb, mp); | 110 LIST_FOREACH(mp, &g_classs, class) 111 g_confdot_class(sb, mp); |
112 sbuf_printf(sb, "};\n"); 113 sbuf_finish(sb); 114 return (sb); 115} 116 117 118static void 119g_conf_consumer(struct sbuf *sb, struct g_consumer *cp) --- 35 unchanged lines hidden (view full) --- 155static void 156g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 157{ 158 struct g_consumer *cp2; 159 struct g_provider *pp2; 160 161 sbuf_printf(sb, " <geom>\n"); 162 sbuf_printf(sb, " <ref>%p</ref>\n", gp); | 112 sbuf_printf(sb, "};\n"); 113 sbuf_finish(sb); 114 return (sb); 115} 116 117 118static void 119g_conf_consumer(struct sbuf *sb, struct g_consumer *cp) --- 35 unchanged lines hidden (view full) --- 155static void 156g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) 157{ 158 struct g_consumer *cp2; 159 struct g_provider *pp2; 160 161 sbuf_printf(sb, " <geom>\n"); 162 sbuf_printf(sb, " <ref>%p</ref>\n", gp); |
163 sbuf_printf(sb, " <method><ref>%p</ref></method>\n", gp->method); | 163 sbuf_printf(sb, " <class><ref>%p</ref></class>\n", gp->class); |
164 sbuf_printf(sb, " <name>%s</name>\n", gp->name); 165 sbuf_printf(sb, " <rank>%d</rank>\n", gp->rank); 166 if (gp->dumpconf) { 167 sbuf_printf(sb, " <config>\n"); 168 gp->dumpconf(sb, "\t", gp, NULL, NULL); 169 sbuf_printf(sb, " </config>\n"); 170 } 171 LIST_FOREACH(cp2, &gp->consumer, consumer) { --- 6 unchanged lines hidden (view full) --- 178 if (pp != NULL && pp != pp2) 179 continue; 180 g_conf_provider(sb, pp2); 181 } 182 sbuf_printf(sb, " </geom>\n"); 183} 184 185static void | 164 sbuf_printf(sb, " <name>%s</name>\n", gp->name); 165 sbuf_printf(sb, " <rank>%d</rank>\n", gp->rank); 166 if (gp->dumpconf) { 167 sbuf_printf(sb, " <config>\n"); 168 gp->dumpconf(sb, "\t", gp, NULL, NULL); 169 sbuf_printf(sb, " </config>\n"); 170 } 171 LIST_FOREACH(cp2, &gp->consumer, consumer) { --- 6 unchanged lines hidden (view full) --- 178 if (pp != NULL && pp != pp2) 179 continue; 180 g_conf_provider(sb, pp2); 181 } 182 sbuf_printf(sb, " </geom>\n"); 183} 184 185static void |
186g_conf_method(struct sbuf *sb, struct g_method *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) | 186g_conf_class(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) |
187{ 188 struct g_geom *gp2; 189 | 187{ 188 struct g_geom *gp2; 189 |
190 sbuf_printf(sb, " <method>\n"); | 190 sbuf_printf(sb, " <class>\n"); |
191 sbuf_printf(sb, " <ref>%p</ref>\n", mp); 192 sbuf_printf(sb, " <name>%s</name>\n", mp->name); 193 LIST_FOREACH(gp2, &mp->geom, geom) { 194 if (gp != NULL && gp != gp2) 195 continue; 196 g_conf_geom(sb, gp2, pp, cp); 197 } | 191 sbuf_printf(sb, " <ref>%p</ref>\n", mp); 192 sbuf_printf(sb, " <name>%s</name>\n", mp->name); 193 LIST_FOREACH(gp2, &mp->geom, geom) { 194 if (gp != NULL && gp != gp2) 195 continue; 196 g_conf_geom(sb, gp2, pp, cp); 197 } |
198 sbuf_printf(sb, " </method>\n"); | 198 sbuf_printf(sb, " </class>\n"); |
199} 200 201struct sbuf * | 199} 200 201struct sbuf * |
202g_conf_specific(struct g_method *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) | 202g_conf_specific(struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp) |
203{ | 203{ |
204 struct g_method *mp2; | 204 struct g_class *mp2; |
205 struct sbuf *sb; 206 207 sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); 208 sbuf_clear(sb); 209 sbuf_printf(sb, "<mesh>\n"); | 205 struct sbuf *sb; 206 207 sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); 208 sbuf_clear(sb); 209 sbuf_printf(sb, "<mesh>\n"); |
210 LIST_FOREACH(mp2, &g_methods, method) { | 210 LIST_FOREACH(mp2, &g_classs, class) { |
211 if (mp != NULL && mp != mp2) 212 continue; | 211 if (mp != NULL && mp != mp2) 212 continue; |
213 g_conf_method(sb, mp2, gp, pp, cp); | 213 g_conf_class(sb, mp2, gp, pp, cp); |
214 } 215 sbuf_printf(sb, "</mesh>\n"); 216 sbuf_finish(sb); 217 return (sb); 218} 219 220struct sbuf * 221g_conf() --- 54 unchanged lines hidden --- | 214 } 215 sbuf_printf(sb, "</mesh>\n"); 216 sbuf_finish(sb); 217 return (sb); 218} 219 220struct sbuf * 221g_conf() --- 54 unchanged lines hidden --- |