svn commit: r216616 - in head/sys: kern sys

mdf at FreeBSD.org mdf at FreeBSD.org
Tue Dec 21 17:21:42 UTC 2010


On Tue, Dec 21, 2010 at 8:52 AM, Stefan Farfeleder <stefanf at freebsd.org> wrote:
> On Tue, Dec 21, 2010 at 04:29:58PM +0000, Matthew D Fleming wrote:
>> Author: mdf
>> Date: Tue Dec 21 16:29:58 2010
>> New Revision: 216616
>> URL: http://svn.freebsd.org/changeset/base/216616
>>
>> Log:
>>   Move the fail_point_entry definition from fail.h to kern_fail.c, which
>>   allows putting the enumeration constants of fail point types with the
>>   text string that matches them.
>
> [snip]
>
>> +enum fail_point_t {
>> +     FAIL_POINT_OFF,         /**< don't fail */
>> +     FAIL_POINT_PANIC,       /**< panic */
>> +     FAIL_POINT_RETURN,      /**< return an errorcode */
>> +     FAIL_POINT_BREAK,       /**< break into the debugger */
>> +     FAIL_POINT_PRINT,       /**< print a message */
>> +     FAIL_POINT_SLEEP,       /**< sleep for some msecs */
>> +     FAIL_POINT_INVALID,     /**< placeholder */
>> +};
>> +
>> +static const char *fail_type_strings[] = {
>> +     "off",
>> +     "panic",
>> +     "return",
>> +     "break",
>> +     "print",
>> +     "sleep",
>> +};
>
> FWIW, you can also do this in C99:
>
> static const char *fail_type_strings[] = {
>        [FAIL_POINT_OFF] = "off",
> };

True.  In this case I also wanted to get the stuff out of the header
that was really private.

Thanks,
matthew


More information about the svn-src-all mailing list