From owner-svn-src-all@FreeBSD.ORG Thu Nov 4 20:31:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDE4F1065674; Thu, 4 Nov 2010 20:31:12 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC8838FC15; Thu, 4 Nov 2010 20:31:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA4KVC3X072260; Thu, 4 Nov 2010 20:31:12 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4KVCYW072258; Thu, 4 Nov 2010 20:31:12 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011042031.oA4KVCYW072258@svn.freebsd.org> From: Bruce Cran Date: Thu, 4 Nov 2010 20:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214807 - head/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2010 20:31:13 -0000 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;