diff options
author | phk <phk@FreeBSD.org> | 2002-10-04 10:15:26 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-10-04 10:15:26 +0000 |
commit | 8891e95872a3b7394d1eb5ea93814e7e50689821 (patch) | |
tree | 3cfcf5ffbb67149d5acd841680d769279a86ed3f /sys/geom | |
parent | 8ce4f690c1d7cfb064c82dadcbff8be9e03a0954 (diff) | |
download | FreeBSD-src-8891e95872a3b7394d1eb5ea93814e7e50689821.zip FreeBSD-src-8891e95872a3b7394d1eb5ea93814e7e50689821.tar.gz |
Implement the "kern.disks" sysctl in GEOM.
This makes "mdconfig -l" work again.
Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_disk.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index e12bc9d..2353924 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -263,7 +263,6 @@ disk_invalidate (struct disk *disk) { } - SYSCTL_INT(_debug_sizeof, OID_AUTO, disklabel, CTLFLAG_RD, 0, sizeof(struct disklabel), "sizeof(struct disklabel)"); @@ -272,3 +271,41 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, diskslices, CTLFLAG_RD, SYSCTL_INT(_debug_sizeof, OID_AUTO, disk, CTLFLAG_RD, 0, sizeof(struct disk), "sizeof(struct disk)"); + +static void +g_kern_disks(void *p) +{ + struct sbuf *sb; + struct g_geom *gp; + char *sp; + + sb = p; + sp = ""; + g_topology_assert(); + LIST_FOREACH(gp, &g_disk_class.geom, geom) { + sbuf_printf(sb, "%s%s", sp, gp->name); + sp = " "; + } + sbuf_finish(sb); + wakeup(sb); +} + +static int +sysctl_disks(SYSCTL_HANDLER_ARGS) +{ + int error; + struct sbuf *sb; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sbuf_clear(sb); + g_call_me(g_kern_disks, sb); + do { + tsleep(sb, PZERO, "kern.disks", hz); + } while(!sbuf_done(sb)); + error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb)); + sbuf_delete(sb); + return error; +} + +SYSCTL_PROC(_kern, OID_AUTO, disks, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NOLOCK, 0, 0, + sysctl_disks, "A", "names of available disks"); |