Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Nov 2010 20:31:12 +0000 (UTC)
From:      Bruce Cran <brucec@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214807 - head/sbin/camcontrol
Message-ID:  <201011042031.oA4KVCYW072258@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011042031.oA4KVCYW072258>