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
This commit is contained in:
parent
89f4551e95
commit
d518e53936
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=106101
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -159,6 +159,23 @@ g_init(void)
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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, "");
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user