Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Dec 2010 17:52:57 +0100
From:      Stefan Farfeleder <stefanf@FreeBSD.org>
To:        Matthew D Fleming <mdf@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:  <20101221165257.GG2614@mole.fafoe.narf.at>
In-Reply-To: <201012211629.oBLGTwh4069669@svn.freebsd.org>
References:  <201012211629.oBLGTwh4069669@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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