Date: Tue, 26 Oct 2010 14:38:10 -0400 From: John Baldwin <jhb@freebsd.org> To: Garrett Cooper <yanegomi@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] mfiutil(8) - capture errors and percolate up to caller Message-ID: <201010261438.10387.jhb@freebsd.org> In-Reply-To: <AANLkTikJ80npsEthOvnYy3w7Fdi8yqa_2ibbTrds9k3X@mail.gmail.com> References: <AANLkTikJ80npsEthOvnYy3w7Fdi8yqa_2ibbTrds9k3X@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <sys/param.h> should replace <sys/types.h> (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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010261438.10387.jhb>
