From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 26 18:38:41 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AD3C106564A for ; Tue, 26 Oct 2010 18:38:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E13C88FC08 for ; Tue, 26 Oct 2010 18:38:40 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 8301446B2C; Tue, 26 Oct 2010 14:38:40 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AB60F8A009; Tue, 26 Oct 2010 14:38:39 -0400 (EDT) From: John Baldwin To: Garrett Cooper Date: Tue, 26 Oct 2010 14:38:10 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201010261438.10387.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 26 Oct 2010 14:38:39 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] mfiutil(8) - capture errors and percolate up to caller X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 18:38:41 -0000 On Tuesday, October 26, 2010 2:09:53 pm Garrett Cooper wrote: > Because a number of places in the mfiutil(8) code immediately call > warn(3) after an error to an API occurred, and because warn(3) employs > printf, et all (multiple times) in libc, there's an off-chance that > the errno value can get stomped on by the warn(3) calls, which could > lead to confusing results from anyone depending on the value being > returned from the mfiutil APIs. Thus, the attached patch I'm providing > fixes those cases, as well as converts an existing internal API > (display_pending_firmware) to an non-void return mechanism. I also > made a few stack variable alignment changes to match style(9) as well > as got rid of the ad hoc powerof2 call in favor of the value in > sys/param.h. > I've run a small number of unit tests on my desktop at home with > my mfi(4) card, but will test out other failing cases with equipment I > have access to at work. Just a few nits: 1) The include of should replace (there's a note about these two headers in style(9), FYI). 2) patrol_get_props() should return 'error' on failure rather than 'errno'. 3) mfi_get_time() failing isn't fatal. The code already handles this case by not printing out a 'next run time' if at is zero. I think you can remove the check for at == 0. If all the other commands work and just that command fails I don't think it should be fatal. -- John Baldwin