From owner-svn-src-all@FreeBSD.ORG Thu Nov 4 17:49:36 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 BC5A1106564A; Thu, 4 Nov 2010 17:49:36 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 471528FC08; Thu, 4 Nov 2010 17:49:35 +0000 (UTC) Received: by yxl31 with SMTP id 31so1668105yxl.13 for ; Thu, 04 Nov 2010 10:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=qSAwPhemYgoUD0SkwlpBjFngPDREfxz42bIXaLGscCg=; b=rzjvMNEFVvq9/4I7xT3kM8gasAyvfXxuF2nZ8k465AmlP33kxHcr43dS9eK9/MAZcK OPEZkjoBObzqizYhk11HAEgRCfBmJTCdSGg7bptRA1hy3E/T5AaU3eVaM8N4OMPCNjnK E2zPe9qfFjN22SMCu7JbRdFd6pR+qfI4f7yuo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=JJ6XbezopNRr0kUAIsOMAua6PyexDNHd0dNf79TRbqTS+ljX4PYO/pTQz0LhN/OqBz 3ljs1OUplKAKi6F5wu4egg6YRJkP+7U6pKTiUI8iMZlXADwEsenepe5qJVlaRRX7HXrq oKZBF9qRf1AJzhqij/dJkPFKhopDuvCk9fViM= Received: by 10.204.54.16 with SMTP id o16mr903275bkg.196.1288892974453; Thu, 04 Nov 2010 10:49:34 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 4sm196705bki.1.2010.11.04.10.49.31 (version=SSLv3 cipher=RC4-MD5); Thu, 04 Nov 2010 10:49:33 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CD2F224.1040008@FreeBSD.org> Date: Thu, 04 Nov 2010 19:49:24 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Bruce Cran References: <201011041524.oA4FOWd7063812@svn.freebsd.org> In-Reply-To: <201011041524.oA4FOWd7063812@svn.freebsd.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214781 - 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 17:49:36 -0000 Bruce Cran wrote: > Author: brucec > Date: Thu Nov 4 15:24:32 2010 > New Revision: 214781 > URL: http://svn.freebsd.org/changeset/base/214781 > > Log: > Fix standby timer calculation: the timer was being set 30 minutes later > than the user requested. > Also, 21 minutes is encoded as 252 and 22-29 minutes cannot be encoded > so must be rounded up to 30. > > PR: bin/151871 > > Modified: > head/sbin/camcontrol/camcontrol.c > > Modified: head/sbin/camcontrol/camcontrol.c > ============================================================================== > --- head/sbin/camcontrol/camcontrol.c Thu Nov 4 12:33:07 2010 (r214780) > +++ head/sbin/camcontrol/camcontrol.c Thu Nov 4 15:24:32 2010 (r214781) > @@ -4316,10 +4316,17 @@ atapm(struct cam_device *device, int arg > sc = 0; > else if (t <= (240 * 5)) > sc = t / 5; > + else if (t == (252 * 5)) There should be "<=". > + /* 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) + 241; > + sc = t / (30 * 60) + 240; This will round period down. You will get 30 minutes instead of 59. In this case rounding up IMHO more appropriate. I agree that previous rounding up was over aggressive. I would prefer something like: sc = (t - 1) / (30 * 60) + 241; or at least sc = (t + 15 * 60) / (30 * 60) + 240; This will also make previous range unneeded. Range "t <= (240 * 5)" probably also should be corrected to round up or at least closest. -- Alexander Motin