From owner-svn-src-all@freebsd.org Mon Mar 13 11:09:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5CF2C32980; Mon, 13 Mar 2017 11:09:18 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9556B10EC; Mon, 13 Mar 2017 11:09:18 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2DB9Hkb004886; Mon, 13 Mar 2017 11:09:17 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2DB9Hdv004885; Mon, 13 Mar 2017 11:09:17 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201703131109.v2DB9Hdv004885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 13 Mar 2017 11:09:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315195 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Mar 2017 11:09:18 -0000 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;