Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Nov 2010 09:58:39 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Garrett Cooper <yanegomi@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: [PATCH] mptutil(8) - capture errors and percolate up to caller
Message-ID:  <201011080958.39156.jhb@freebsd.org>
In-Reply-To: <AANLkTinK_gPuqke7UAusJVV6apK0w=gU3sHjBsjhd00r@mail.gmail.com>
References:  <AANLkTinK_gPuqke7UAusJVV6apK0w=gU3sHjBsjhd00r@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday, November 06, 2010 4:13:23 am Garrett Cooper wrote:
>     Similar to r214396, this patch deals with properly capturing error
> and passing it up to the caller in mptutil just in case the errno
> value gets stomped on by warn*(3); this patch deals with an improper
> use of warn(3), and also some malloc(3) errors, as well as shrink down
> some static buffers to fit the data being output.
>     If someone could review and help me commit this patch it would be
> much appreciated; all I could do is run negative tests on my local box
> and minor positive tests on my vmware fusion instance because it
> doesn't fully emulate a fully working mpt(4) device (the vmware
> instance consistently crashed with a warning about the mpt
> controller's unimplemented features after I poked at it enough).
>     I'll submit another patch to fix up style(9) in this app if requested.
> Thanks!

The explicit 'return (ENOMEM)' calls are fine as-is.  I do not think they need 
changing.

Having static char arrays of '15' rather than '16' is probably pointless.  The 
stack is already at least 4-byte aligned on all the architectures we support, 
so a 15-byte char array will actually be 16 bytes.  It was chose to be a good
enough value, not an exact fit.  An exact fit is not important here.

Moving the 'buf' in mpt_raid_level() is a style bug.  It should stay where it 
is.  Same with 'buf' in mpt_volstate() and mpt_pdstate().

IOC_STATUS_SUCCESS() returns a boolean, it is appropriate to test it with ! 
rather than == 0.  It is also easier for a person to read the code that way.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011080958.39156.jhb>