Date: Mon, 13 Mar 2017 11:09:17 +0000 (UTC) From: Scott Long <scottl@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315195 - head/sys/geom Message-ID: <201703131109.v2DB9Hdv004885@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: scottl Date: Mon Mar 13 11:09:17 2017 New Revision: 315195 URL: https://svnweb.freebsd.org/changeset/base/315195 Log: Report disk flags via the sysctl tree Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Mon Mar 13 10:49:36 2017 (r315194) +++ head/sys/geom/geom_disk.c Mon Mar 13 11:09:17 2017 (r315195) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703131109.v2DB9Hdv004885>