diff options
author | Scott Long <scottl@FreeBSD.org> | 2017-03-13 11:09:17 +0000 |
---|---|---|
committer | Scott Long <scottl@FreeBSD.org> | 2017-03-13 11:09:17 +0000 |
commit | d8474e52e3d96075274dcb0feff9a6a35f5c56fe (patch) | |
tree | 0635eac9dd22618c8aee9ac579c1ae0afb20c5dd /sys/geom | |
parent | 250a8e2720e8ca1b041e28067274c22e4193d4c3 (diff) | |
download | src-d8474e52e3d96075274dcb0feff9a6a35f5c56fe.tar.gz src-d8474e52e3d96075274dcb0feff9a6a35f5c56fe.zip |
Report disk flags via the sysctl tree
Notes
Notes:
svn path=/head/; revision=315195
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_disk.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 9a52ad1a3586..9bd74d4d253b 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -77,6 +77,8 @@ static g_ioctl_t g_disk_ioctl; static g_dumpconf_t g_disk_dumpconf; static g_provgone_t g_disk_providergone; +static int g_disk_sysctl_flags(SYSCTL_HANDLER_ARGS); + static struct g_class g_disk_class = { .name = G_DISK_CLASS_NAME, .version = G_VERSION, @@ -725,6 +727,10 @@ g_disk_create(void *arg, int flag) SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "led", CTLFLAG_RWTUN, sc->led, sizeof(sc->led), "LED name"); + SYSCTL_ADD_PROC(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "flags", + CTLTYPE_STRING | CTLFLAG_RD, dp, 0, g_disk_sysctl_flags, + "A", "Report disk flags"); } pp->private = sc; dp->d_geom = gp; @@ -995,6 +1001,30 @@ g_kern_disks(void *p, int flag __unused) } static int +g_disk_sysctl_flags(SYSCTL_HANDLER_ARGS) +{ + struct disk *dp; + struct sbuf *sb; + int error; + + sb = sbuf_new_auto(); + dp = (struct disk *)arg1; + sbuf_printf(sb, "%b", dp->d_flags, + "\20" + "\2OPEN" + "\3CANDELETE" + "\4CANFLUSHCACHE" + "\5UNMAPPEDBIO" + "\6DIRECTCOMPLETION" + "\10CANZONE"); + + sbuf_finish(sb); + error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + return (error); +} + +static int sysctl_disks(SYSCTL_HANDLER_ARGS) { int error; |