diff options
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r-- | sys/geom/geom_disk.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 5be9043..2c6b00b 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -412,23 +412,32 @@ g_disk_start(struct bio *bp) break; else if (g_handleattr_str(bp, "GEOM::ident", dp->d_ident)) break; - else if (g_handleattr(bp, "GEOM::hba_vendor", - &dp->d_hba_vendor, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_vendor", + dp->d_hba_vendor)) break; - else if (g_handleattr(bp, "GEOM::hba_device", - &dp->d_hba_device, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_device", + dp->d_hba_device)) break; - else if (g_handleattr(bp, "GEOM::hba_subvendor", - &dp->d_hba_subvendor, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_subvendor", + dp->d_hba_subvendor)) break; - else if (g_handleattr(bp, "GEOM::hba_subdevice", - &dp->d_hba_subdevice, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_subdevice", + dp->d_hba_subdevice)) break; else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) g_disk_kerneldump(bp, dp); else if (!strcmp(bp->bio_attribute, "GEOM::setstate")) g_disk_setstate(bp, sc); - else + else if (!strcmp(bp->bio_attribute, "GEOM::rotation_rate")) { + uint64_t v; + + if ((dp->d_flags & DISKFLAG_LACKS_ROTRATE) == 0) + v = dp->d_rotation_rate; + else + v = 0; /* rate unknown */ + g_handleattr_uint16_t(bp, "GEOM::rotation_rate", v); + break; + } else error = ENOIOCTL; break; case BIO_FLUSH: @@ -694,6 +703,8 @@ disk_create(struct disk *dp, int version) dp->d_name, dp->d_unit); return; } + if (version < DISK_VERSION_04) + dp->d_flags |= DISKFLAG_LACKS_ROTRATE; KASSERT(dp->d_strategy != NULL, ("disk_create need d_strategy")); KASSERT(dp->d_name != NULL, ("disk_create need d_name")); KASSERT(*dp->d_name != 0, ("disk_create need d_name")); |