From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 11 18:01:55 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD261065672; Tue, 11 Jan 2011 18:01:55 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 348D28FC19; Tue, 11 Jan 2011 18:01:54 +0000 (UTC) Received: by iyb26 with SMTP id 26so19760404iyb.13 for ; Tue, 11 Jan 2011 10:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=3UiSuzecPfwLpj2LGWB2MbL/DyspOx4K51+9wIVb8mI=; b=piuKhXA7QGn4+s5/pW0nGZuwxErKo/7lChBDjKdQPv0W9KFMgubLUBGjNHwgpVBH3A rY7zlDpG3xv/v14QIY02QPa8XT8baKciQWei+bQynRZ0DmBP101o8rdpWpuB8Iljdw/4 jlZ4vjOThWmXHhO+IWxC3dvR7YZi6hiR5JfkU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=Rj627ctAG2HYauP2OXQLL7M6KVAa56HEwaiZ94g7u9qTfZlyYJma7sGgPd5EynAVDD Qqbx/T2dCvoBu4Lc6PCi2hBLcvr8XUdpPnfeGsn+w9+bITpeFXUIRzmRUgEp6vX9lgp7 wrAEugitzQ9jngAyudSZFWCnkmaXIoqtIh+ms= MIME-Version: 1.0 Received: by 10.231.161.15 with SMTP id p15mr30641506ibx.104.1294766866084; Tue, 11 Jan 2011 09:27:46 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.231.160.147 with HTTP; Tue, 11 Jan 2011 09:27:45 -0800 (PST) In-Reply-To: <201101111726.p0BHQbwq027532@svn.freebsd.org> References: <201101111726.p0BHQbwq027532@svn.freebsd.org> Date: Tue, 11 Jan 2011 09:27:45 -0800 X-Google-Sender-Auth: 9SF-3ogzFZAtlkH_3WxMhZLz7HE Message-ID: 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 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r217269 - in stable/8/sys: kern sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jan 2011 18:01:55 -0000 Gah! Forgot to mention this is a MFC of r216616. On Tue, Jan 11, 2011 at 9:26 AM, Matthew D Fleming 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 > =A0#include > > - > -/** > - * 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_ */ >