svn commit: r215174 - stable/8/sbin/camcontrol

Bruce Cran brucec at FreeBSD.org
Fri Nov 12 11:36:13 UTC 2010


Author: brucec
Date: Fri Nov 12 11:36:12 2010
New Revision: 215174
URL: http://svn.freebsd.org/changeset/base/215174

Log:
  MFC r214781, r214807:
  
  Improve rounding of standby timer.
  22-29 minutes can't be encoded so must be rounded up to 30.
  
  PR:	bin/151871

Modified:
  stable/8/sbin/camcontrol/camcontrol.c
Directory Properties:
  stable/8/sbin/camcontrol/   (props changed)

Modified: stable/8/sbin/camcontrol/camcontrol.c
==============================================================================
--- stable/8/sbin/camcontrol/camcontrol.c	Fri Nov 12 11:22:59 2010	(r215173)
+++ stable/8/sbin/camcontrol/camcontrol.c	Fri Nov 12 11:36:12 2010	(r215174)
@@ -4302,14 +4302,19 @@ 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;
+		sc = (t + 4) / 5;
+	else if (t <= (252 * 5))
+		/* special encoding for 21 minutes */
+		sc = 252;
 	else if (t <= (11 * 30 * 60))
-		sc = t / (30 * 60) + 241;
+		sc = (t - 1) / (30 * 60) + 241;
 	else
 		sc = 253;
+
 	cam_fill_ataio(&ccb->ataio,
 		      retry_count,
 		      NULL,


More information about the svn-src-all mailing list