diff options
author | phk <phk@FreeBSD.org> | 2002-10-28 22:43:54 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-10-28 22:43:54 +0000 |
commit | 36b357552e8bf68a082895a618ce8fc14d7b21a8 (patch) | |
tree | 8613cc57c380af3393265fdf5313b0a510ee0433 /sys | |
parent | bddb286f465cd924b05f4d045c8154af4cd9238f (diff) | |
download | FreeBSD-src-36b357552e8bf68a082895a618ce8fc14d7b21a8.zip FreeBSD-src-36b357552e8bf68a082895a618ce8fc14d7b21a8.tar.gz |
Add the remaning part of the new libdisk interaction.
WARNING: This is not a published interface, it is a stopgap measure for
WARNING: libdisk so we can get 5.0-R out of the door.
Sponsored by: DARPA & NAI Labs
Diffstat (limited to 'sys')
-rw-r--r-- | sys/geom/geom_disk.c | 5 | ||||
-rw-r--r-- | sys/geom/geom_dump.c | 44 | ||||
-rw-r--r-- | sys/geom/geom_int.h | 1 | ||||
-rw-r--r-- | sys/geom/geom_kern.c | 25 | ||||
-rw-r--r-- | sys/geom/geom_slice.c | 6 |
5 files changed, 79 insertions, 2 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index b919cd4..0379fab 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -208,6 +208,11 @@ g_disk_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_consu struct disk *dp; dp = gp->softc; + if (indent == NULL) { + sbuf_printf(sb, " hd %u", dp->d_fwheads); + sbuf_printf(sb, " sc %u", dp->d_fwsectors); + return; + } if (pp != NULL) { sbuf_printf(sb, "%s<fwheads>%u</fwheads>\n", indent, dp->d_fwheads); diff --git a/sys/geom/geom_dump.c b/sys/geom/geom_dump.c index 3827229..756e8ca 100644 --- a/sys/geom/geom_dump.c +++ b/sys/geom/geom_dump.c @@ -116,6 +116,50 @@ g_confdot(void *p) wakeup(p); } +static void +g_conftxt_geom(struct sbuf *sb, struct g_geom *gp, int level) +{ + struct g_provider *pp; + struct g_consumer *cp; + + 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); + sbuf_printf(sb, "\n"); + LIST_FOREACH(cp, &pp->consumers, consumers) + g_conftxt_geom(sb, cp->geom, level + 1); + } +} + +static void +g_conftxt_class(struct sbuf *sb, struct g_class *mp) +{ + struct g_geom *gp; + + LIST_FOREACH(gp, &mp->geom, geom) + g_conftxt_geom(sb, gp, 0); +} + +void +g_conftxt(void *p) +{ + struct g_class *mp; + struct sbuf *sb; + + sb = p; + g_topology_assert(); + LIST_FOREACH(mp, &g_classes, class) + if (!strcmp(mp->name, "DISK")) + break; + if (mp != NULL) + g_conftxt_class(sb, mp); + else + printf("no DISK\n"); + sbuf_finish(sb); + wakeup(p); +} + static void g_conf_consumer(struct sbuf *sb, struct g_consumer *cp) diff --git a/sys/geom/geom_int.h b/sys/geom/geom_int.h index 8f30098..3224a2d 100644 --- a/sys/geom/geom_int.h +++ b/sys/geom/geom_int.h @@ -73,6 +73,7 @@ struct g_event { void g_confxml(void *); void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp); void g_confdot(void *); +void g_conftxt(void *); /* geom_event.c */ diff --git a/sys/geom/geom_kern.c b/sys/geom/geom_kern.c index 5901316..1031fd4 100644 --- a/sys/geom/geom_kern.c +++ b/sys/geom/geom_kern.c @@ -160,6 +160,23 @@ g_init(void) } static int +sysctl_kern_geom_conftxt(SYSCTL_HANDLER_ARGS) +{ + int error; + struct sbuf *sb; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sbuf_clear(sb); + g_call_me(g_conftxt, sb); + do { + tsleep(sb, PZERO, "g_dot", hz); + } while(!sbuf_done(sb)); + error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + return error; +} + +static int sysctl_kern_geom_confdot(SYSCTL_HANDLER_ARGS) { int error; @@ -197,11 +214,15 @@ SYSCTL_NODE(_kern, OID_AUTO, geom, CTLFLAG_RW, 0, "GEOMetry management"); SYSCTL_PROC(_kern_geom, OID_AUTO, confxml, CTLTYPE_STRING|CTLFLAG_RD, 0, 0, sysctl_kern_geom_confxml, "A", - "Dump the GEOM config"); + "Dump the GEOM config in XML"); SYSCTL_PROC(_kern_geom, OID_AUTO, confdot, CTLTYPE_STRING|CTLFLAG_RD, 0, 0, sysctl_kern_geom_confdot, "A", - "Dump the GEOM config"); + "Dump the GEOM config in dot"); + +SYSCTL_PROC(_kern_geom, OID_AUTO, conftxt, CTLTYPE_STRING|CTLFLAG_RD, + 0, 0, sysctl_kern_geom_conftxt, "A", + "Dump the GEOM config in txt"); SYSCTL_INT(_kern_geom, OID_AUTO, debugflags, CTLFLAG_RW, &g_debugflags, 0, ""); diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index cc67cb9..033713a 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -206,6 +206,12 @@ g_slice_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_cons struct g_slicer *gsp; gsp = gp->softc; + if (indent == NULL) { + sbuf_printf(sb, " i %u", pp->index); + sbuf_printf(sb, " o %ju", + (uintmax_t)gsp->slices[pp->index].offset); + return; + } if (gp != NULL && (pp == NULL && cp == NULL)) { sbuf_printf(sb, "%s<frontstuff>%ju</frontstuff>\n", indent, (intmax_t)gsp->frontstuff); |