summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-25 08:56:15 -0200
committerRenato Botelho <renato@netgate.com>2016-01-25 08:56:15 -0200
commiteb84e0723f3b4bc5e40024f66fe21c14b09e9ec4 (patch)
treefec6b99d018e13f1fccbe31478aaf29a28a55642 /sys/geom/geom_disk.c
parentc50df8e1b90c4f9b8bbffa592477c129854776ce (diff)
parent94b1bbbd44bd88b6db1c00d795cdf7675b3ae254 (diff)
downloadFreeBSD-src-eb84e0723f3b4bc5e40024f66fe21c14b09e9ec4.zip
FreeBSD-src-eb84e0723f3b4bc5e40024f66fe21c14b09e9ec4.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r--sys/geom/geom_disk.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index 1a879f7..5d7965e 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -581,6 +581,23 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g
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();
OpenPOWER on IntegriCloud