Date: Thu, 21 Jan 2016 03:05:03 +0000 (UTC) From: Ravi Pokala <rpokala@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r294483 - stable/10/sys/geom Message-ID: <201601210305.u0L353GX038645@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rpokala Date: Thu Jan 21 03:05:03 2016 New Revision: 294483 URL: https://svnweb.freebsd.org/changeset/base/294483 Log: MFC r294042: Add rotationrate to geom disk dumpconf Parse and report the nominal rotation rate reported by the drive. Approved by: jhb Modified: stable/10/sys/geom/geom_disk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/geom_disk.c ============================================================================== --- stable/10/sys/geom/geom_disk.c Thu Jan 21 02:20:38 2016 (r294482) +++ stable/10/sys/geom/geom_disk.c Thu Jan 21 03:05:03 2016 (r294483) @@ -581,6 +581,23 @@ g_disk_dumpconf(struct sbuf *sb, const c indent, dp->d_fwheads); sbuf_printf(sb, "%s<fwsectors>%u</fwsectors>\n", indent, dp->d_fwsectors); + + /* + * "rotationrate" is a little complicated, because the value + * returned by the drive might not be the RPM; 0 and 1 are + * special cases, and there's also a valid range. + */ + sbuf_printf(sb, "%s<rotationrate>", indent); + if (dp->d_rotation_rate == 0) /* Old drives don't */ + sbuf_printf(sb, "unknown"); /* report RPM. */ + else if (dp->d_rotation_rate == 1) /* Since 0 is used */ + sbuf_printf(sb, "0"); /* above, SSDs use 1. */ + else if ((dp->d_rotation_rate >= 0x041) && + (dp->d_rotation_rate <= 0xfffe)) + sbuf_printf(sb, "%u", dp->d_rotation_rate); + else + sbuf_printf(sb, "invalid"); + sbuf_printf(sb, "</rotationrate>\n"); if (dp->d_getattr != NULL) { buf = g_malloc(DISK_IDENT_SIZE, M_WAITOK); bp = g_alloc_bio();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601210305.u0L353GX038645>