svn commit: r214807 - head/sbin/camcontrol
Bruce Cran
brucec at FreeBSD.org
Thu Nov 4 20:31:13 UTC 2010
Author: brucec
Date: Thu Nov 4 20:31:12 2010
New Revision: 214807
URL: http://svn.freebsd.org/changeset/base/214807
Log:
r214781 caused the timer value to be rounded down, so that if the user asked
for 59 minutes 30 was sent to the drive. The timer value is now always
rounded up.
Reported by: mav
Modified:
head/sbin/camcontrol/camcontrol.c
Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c Thu Nov 4 20:22:44 2010 (r214806)
+++ head/sbin/camcontrol/camcontrol.c Thu Nov 4 20:31:12 2010 (r214807)
@@ -4312,18 +4312,16 @@ atapm(struct cam_device *device, int arg
cmd = ATA_SLEEP;
t = -1;
}
+
if (t < 0)
sc = 0;
else if (t <= (240 * 5))
- sc = t / 5;
- else if (t == (252 * 5))
+ sc = (t + 4) / 5;
+ else if (t <= (252 * 5))
/* special encoding for 21 minutes */
sc = 252;
- else if (t < (30 * 60))
- /* no encoding exists for 22-29 minutes, so set to 30 mins */
- sc = 241;
else if (t <= (11 * 30 * 60))
- sc = t / (30 * 60) + 240;
+ sc = (t - 1) / (30 * 60) + 241;
else
sc = 253;
More information about the svn-src-all
mailing list