Make mfiutil(8) more robust

Garrett Cooper yanegomi at gmail.com
Mon Oct 4 03:32:02 UTC 2010


On Sun, Oct 3, 2010 at 8:30 PM, Garrett Cooper <yanegomi at gmail.com> wrote:
>    As discussed offlist with some of the Yahoo! FreeBSD folks,
> mfiutil catches errors, but doesn't communicate it back up to the
> executing process. Examples follow...
>    Before:
>
> $ ./mfiutil show adapter
> mfiutil: mfi_open: Permission denied
> $ echo $?
> 0
>
>    (I would expect it to exit with a non-zero exit code)
>    After:
>
> $ ./mfiutil show adapter
> mfiutil: mfi_open: Permission denied
> $ echo $?
> 1
>
>    (Much better!)
>
> $ sudo ./mfiutil show adapter
> mfi0 Adapter:
>    Product Name: MegaRAID SAS 8704ELP
>   Serial Number: P391734409
>        Firmware: 11.0.1-0026
>     RAID Levels: JBOD, RAID0, RAID1, RAID5, RAID6, RAID10, RAID50
>  Battery Backup: present
>           NVRAM: 32K
>  Onboard Memory: 128M
>  Minimum Stripe: 8K
>  Maximum Stripe: 1M
> $ echo $?
> 0
>
>    (Looks good too!)
>
>    After (mptutil):
>
> $ ../mptutil/mptutil show adapter
> mptutil: mpt_open: No such file or directory
> $ echo $?
> 1
>
>    (Well, I don't have a mpt(4) card, so...)
>
>    This trivial patch fixes this code to report valid errors in the
> handlers. I've added code to catch errors with mptutil as well as the
> logic is basically the same, and it functions as expected in the
> negative case; I don't have the hardware to test the mptutil command
> in the positive case though to ensure that functions as expected.
> Thanks!

    Adding hackers@ for visibility with mptutil.
Thanks,
-Garrett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mptutil-capture-handler-errors.diff
Type: application/octet-stream
Size: 451 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20101004/76dbef5a/mptutil-capture-handler-errors.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mfiutil-capture-handler-errors.diff
Type: application/octet-stream
Size: 451 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20101004/76dbef5a/mfiutil-capture-handler-errors.obj


More information about the freebsd-hackers mailing list