Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jan 2011 09:27:45 -0800
From:      mdf@FreeBSD.org
To:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   Re: svn commit: r217269 - in stable/8/sys: kern sys
Message-ID:  <AANLkTik3J%2Bk_T%2Bx6f6m=ZA=9mz0GoVqqGchJE2-oXO7s@mail.gmail.com>
In-Reply-To: <201101111726.p0BHQbwq027532@svn.freebsd.org>
References:  <201101111726.p0BHQbwq027532@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Gah!  Forgot to mention this is a MFC of r216616.

On Tue, Jan 11, 2011 at 9:26 AM, Matthew D Fleming <mdf@freebsd.org> wrote:
> Author: mdf
> Date: Tue Jan 11 17:26:36 2011
> New Revision: 217269
> URL: http://svn.freebsd.org/changeset/base/217269
>
> Log:
> =A0Move the fail_point_entry definition from fail.h to kern_fail.c, which
> =A0allows putting the enumeration constants of fail point types with the
> =A0text string that matches them.
>
> Modified:
> =A0stable/8/sys/kern/kern_fail.c
> =A0stable/8/sys/sys/fail.h
> Directory Properties:
> =A0stable/8/sys/ =A0 (props changed)
> =A0stable/8/sys/amd64/include/xen/ =A0 (props changed)
> =A0stable/8/sys/cddl/contrib/opensolaris/ =A0 (props changed)
> =A0stable/8/sys/contrib/dev/acpica/ =A0 (props changed)
> =A0stable/8/sys/contrib/pf/ =A0 (props changed)
>
> Modified: stable/8/sys/kern/kern_fail.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- stable/8/sys/kern/kern_fail.c =A0 =A0 =A0 Tue Jan 11 17:16:50 2011 =
=A0 =A0 =A0 =A0(r217268)
> +++ stable/8/sys/kern/kern_fail.c =A0 =A0 =A0 Tue Jan 11 17:26:36 2011 =
=A0 =A0 =A0 =A0(r217269)
> @@ -76,6 +76,43 @@ MTX_SYSINIT(g_fp_mtx, &g_fp_mtx, "fail p
> =A0#define FP_LOCK() =A0 =A0 =A0mtx_lock(&g_fp_mtx)
> =A0#define FP_UNLOCK() =A0 =A0mtx_unlock(&g_fp_mtx)
>
> +/**
> + * Failpoint types.
> + * Don't change these without changing fail_type_strings in fail.c.
> + * @ingroup failpoint_private
> + */
> +enum fail_point_t {
> + =A0 =A0 =A0 FAIL_POINT_OFF, =A0 =A0 =A0 =A0 /**< don't fail */
> + =A0 =A0 =A0 FAIL_POINT_PANIC, =A0 =A0 =A0 /**< panic */
> + =A0 =A0 =A0 FAIL_POINT_RETURN, =A0 =A0 =A0/**< return an errorcode */
> + =A0 =A0 =A0 FAIL_POINT_BREAK, =A0 =A0 =A0 /**< break into the debugger =
*/
> + =A0 =A0 =A0 FAIL_POINT_PRINT, =A0 =A0 =A0 /**< print a message */
> + =A0 =A0 =A0 FAIL_POINT_SLEEP, =A0 =A0 =A0 /**< sleep for some msecs */
> + =A0 =A0 =A0 FAIL_POINT_INVALID, =A0 =A0 /**< placeholder */
> +};
> +
> +static const char *fail_type_strings[] =3D {
> + =A0 =A0 =A0 "off",
> + =A0 =A0 =A0 "panic",
> + =A0 =A0 =A0 "return",
> + =A0 =A0 =A0 "break",
> + =A0 =A0 =A0 "print",
> + =A0 =A0 =A0 "sleep",
> +};
> +
> +/**
> + * Internal structure tracking a single term of a complete failpoint.
> + * @ingroup failpoint_private
> + */
> +struct fail_point_entry {
> + =A0 =A0 =A0 enum fail_point_t fe_type; =A0 =A0 =A0/**< type of entry */
> + =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 fe_arg; =A0 =A0 =A0 =A0 /**< ar=
gument to type (e.g. return value) */
> + =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 fe_prob; =A0 =A0 =A0 =A0/**< li=
kelihood of firing in millionths */
> + =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 fe_count; =A0 =A0 =A0 /**< numb=
er of times to fire, 0 means always */
> +
> + =A0 =A0 =A0 TAILQ_ENTRY(fail_point_entry) fe_entries; /**< next entry i=
n fail point */
> +};
> +
> =A0static inline void
> =A0fail_point_sleep(struct fail_point *fp, struct fail_point_entry *ent,
> =A0 =A0 int msecs, enum fail_point_return_code *pret)
> @@ -102,15 +139,6 @@ enum {
> =A0 =A0 =A0 =A0PROB_DIGITS =3D 6, =A0 =A0 =A0 =A0/* number of zero's in a=
bove number */
> =A0};
>
> -static const char *fail_type_strings[] =3D {
> - =A0 =A0 =A0 "off",
> - =A0 =A0 =A0 "panic",
> - =A0 =A0 =A0 "return",
> - =A0 =A0 =A0 "break",
> - =A0 =A0 =A0 "print",
> - =A0 =A0 =A0 "sleep",
> -};
> -
> =A0static char *parse_fail_point(struct fail_point_entries *, char *);
> =A0static char *parse_term(struct fail_point_entries *, char *);
> =A0static char *parse_number(int *out_units, int *out_decimal, char *);
>
> Modified: stable/8/sys/sys/fail.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- stable/8/sys/sys/fail.h =A0 =A0 Tue Jan 11 17:16:50 2011 =A0 =A0 =A0 =
=A0(r217268)
> +++ stable/8/sys/sys/fail.h =A0 =A0 Tue Jan 11 17:26:36 2011 =A0 =A0 =A0 =
=A0(r217269)
> @@ -39,22 +39,6 @@
> =A0#include <sys/queue.h>
> =A0#include <sys/sysctl.h>
>
> -
> -/**
> - * Failpoint types.
> - * Don't change these without changing fail_type_strings in fail.c.
> - * @ingroup failpoint_private
> - */
> -enum fail_point_t {
> - =A0 =A0 =A0 FAIL_POINT_OFF, =A0 =A0 =A0 =A0 /**< don't fail */
> - =A0 =A0 =A0 FAIL_POINT_PANIC, =A0 =A0 =A0 /**< panic */
> - =A0 =A0 =A0 FAIL_POINT_RETURN, =A0 =A0 =A0/**< return an errorcode */
> - =A0 =A0 =A0 FAIL_POINT_BREAK, =A0 =A0 =A0 /**< break into the debugger =
*/
> - =A0 =A0 =A0 FAIL_POINT_PRINT, =A0 =A0 =A0 /**< print a message */
> - =A0 =A0 =A0 FAIL_POINT_SLEEP, =A0 =A0 =A0 /**< sleep for some msecs */
> - =A0 =A0 =A0 FAIL_POINT_INVALID, =A0 =A0 /**< placeholder */
> -};
> -
> =A0/**
> =A0* Failpoint return codes, used internally.
> =A0* @ingroup failpoint_private
> @@ -65,6 +49,7 @@ enum fail_point_return_code {
> =A0 =A0 =A0 =A0FAIL_POINT_RC_QUEUED, =A0 =A0 =A0 =A0 =A0 /**< sleep_fn wi=
ll be called */
> =A0};
>
> +struct fail_point_entry;
> =A0TAILQ_HEAD(fail_point_entries, fail_point_entry);
> =A0/**
> =A0* Internal failpoint structure, tracking all the current details of th=
e
> @@ -84,18 +69,7 @@ struct fail_point {
>
> =A0#define =A0 =A0 =A0 =A0FAIL_POINT_DYNAMIC_NAME 0x01 =A0 =A0/**< Must f=
ree name on destroy */
>
> -/**
> - * Internal structure tracking a single term of a complete failpoint.
> - * @ingroup failpoint_private
> - */
> -struct fail_point_entry {
> - =A0 =A0 =A0 enum fail_point_t fe_type; =A0 =A0 =A0/**< type of entry */
> - =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 fe_arg; =A0 =A0 =A0 =A0 /**< ar=
gument to type (e.g. return value) */
> - =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 fe_prob; =A0 =A0 =A0 =A0/**< li=
kelihood of firing in millionths */
> - =A0 =A0 =A0 int =A0 =A0 =A0 =A0 =A0 =A0 fe_count; =A0 =A0 =A0 /**< numb=
er of times to fire, 0 means always */
> -
> - =A0 =A0 =A0 TAILQ_ENTRY(fail_point_entry) fe_entries; /**< next entry i=
n fail point */
> -};
> +__BEGIN_DECLS
>
> =A0/* Private failpoint eval function -- use fail_point_eval() instead. *=
/
> =A0enum fail_point_return_code fail_point_eval_nontrivial(struct fail_poi=
nt *,
> @@ -152,6 +126,8 @@ fail_point_eval(struct fail_point *fp, i
> =A0 =A0 =A0 =A0return (fail_point_eval_nontrivial(fp, ret));
> =A0}
>
> +__END_DECLS
> +
> =A0/* Declare a fail_point and its sysctl in a function. */
> =A0#define _FAIL_POINT_NAME(name) _fail_point_##name
> =A0#define _STRINGIFY_HELPER(x) #x
> @@ -233,7 +209,7 @@ fail_point_eval(struct fail_point *fp, i
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NULL, NULL, =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0SYSCTL_OID(parent, OID_AUTO, name, =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 CTLTYPE_STRING | CTLFLAG_RW=
, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 CTLTYPE_STRING | CTLFLAG_RW=
 | CTLFLAG_MPSAFE, =A0 \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&_FAIL_POINT_NAME(name), 0=
, fail_point_sysctl, =A0\
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"A", ""); =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\
> @@ -254,7 +230,7 @@ int fail_point_sysctl(SYSCTL_HANDLER_ARG
>
> =A0/* The fail point sysctl tree. */
> =A0SYSCTL_DECL(_debug_fail_point);
> +#define =A0 =A0 =A0 =A0DEBUG_FP =A0 =A0 =A0 =A0_debug_fail_point
> =A0#endif
> -#define DEBUG_FP _debug_fail_point
>
> =A0#endif /* _SYS_FAIL_H_ */
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik3J%2Bk_T%2Bx6f6m=ZA=9mz0GoVqqGchJE2-oXO7s>