Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Dec 2010 09:21:40 -0800
From:      mdf@FreeBSD.org
To:        Stefan Farfeleder <stefanf@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r216616 - in head/sys: kern sys
Message-ID:  <AANLkTinE84AM1M0-DjFhNOyKKM2WdEMpsT=60wmL7m=j@mail.gmail.com>
In-Reply-To: <20101221165257.GG2614@mole.fafoe.narf.at>
References:  <201012211629.oBLGTwh4069669@svn.freebsd.org> <20101221165257.GG2614@mole.fafoe.narf.at>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 21, 2010 at 8:52 AM, Stefan Farfeleder <stefanf@freebsd.org> wr=
ote:
> 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:
>> =A0 Move the fail_point_entry definition from fail.h to kern_fail.c, whi=
ch
>> =A0 allows putting the enumeration constants of fail point types with th=
e
>> =A0 text string that matches them.
>
> [snip]
>
>> +enum fail_point_t {
>> + =A0 =A0 FAIL_POINT_OFF, =A0 =A0 =A0 =A0 /**< don't fail */
>> + =A0 =A0 FAIL_POINT_PANIC, =A0 =A0 =A0 /**< panic */
>> + =A0 =A0 FAIL_POINT_RETURN, =A0 =A0 =A0/**< return an errorcode */
>> + =A0 =A0 FAIL_POINT_BREAK, =A0 =A0 =A0 /**< break into the debugger */
>> + =A0 =A0 FAIL_POINT_PRINT, =A0 =A0 =A0 /**< print a message */
>> + =A0 =A0 FAIL_POINT_SLEEP, =A0 =A0 =A0 /**< sleep for some msecs */
>> + =A0 =A0 FAIL_POINT_INVALID, =A0 =A0 /**< placeholder */
>> +};
>> +
>> +static const char *fail_type_strings[] =3D {
>> + =A0 =A0 "off",
>> + =A0 =A0 "panic",
>> + =A0 =A0 "return",
>> + =A0 =A0 "break",
>> + =A0 =A0 "print",
>> + =A0 =A0 "sleep",
>> +};
>
> FWIW, you can also do this in C99:
>
> static const char *fail_type_strings[] =3D {
> =A0 =A0 =A0 =A0[FAIL_POINT_OFF] =3D "off",
> };

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

Thanks,
matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinE84AM1M0-DjFhNOyKKM2WdEMpsT=60wmL7m=j>