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

Stefan Farfeleder stefanf at FreeBSD.org
Tue Dec 21 17:09:11 UTC 2010


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",
};

Cheers,
Stefan


More information about the svn-src-head mailing list