Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145781482
D20546.id58337.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D20546.id58337.diff
View Options
Index: share/man/man9/fail.9
===================================================================
--- share/man/man9/fail.9
+++ share/man/man9/fail.9
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2009 Isilon Inc http://www.isilon.com/
+.\" Copyright (c) 2009-2019 Dell EMC Isilon http://www.isilon.com/
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -30,26 +30,32 @@
.Dt FAIL 9
.Os
.Sh NAME
+.Nm DEBUG_FP ,
.Nm KFAIL_POINT_CODE ,
.Nm KFAIL_POINT_CODE_FLAGS ,
.Nm KFAIL_POINT_CODE_COND ,
-.Nm KFAIL_POINT_RETURN ,
-.Nm KFAIL_POINT_RETURN_VOID ,
.Nm KFAIL_POINT_ERROR ,
+.Nm KFAIL_POINT_EVAL ,
+.Nm KFAIL_POINT_DECLARE ,
+.Nm KFAIL_POINT_DEFINE ,
.Nm KFAIL_POINT_GOTO ,
+.Nm KFAIL_POINT_RETURN ,
+.Nm KFAIL_POINT_RETURN_VOID ,
.Nm KFAIL_POINT_SLEEP_CALLBACKS ,
-.Nm fail_point ,
-.Nm DEBUG_FP
+.Nm fail_point
.Nd fail points
.Sh SYNOPSIS
.In sys/fail.h
.Fn KFAIL_POINT_CODE "parent" "name" "code"
.Fn KFAIL_POINT_CODE_FLAGS "parent" "name" "flags" "code"
.Fn KFAIL_POINT_CODE_COND "parent" "name" "cond" "flags" "code"
-.Fn KFAIL_POINT_RETURN "parent" "name"
-.Fn KFAIL_POINT_RETURN_VOID "parent" "name"
.Fn KFAIL_POINT_ERROR "parent" "name" "error_var"
+.Fn KFAIL_POINT_EVAL "name" "code"
+.Fn KFAIL_POINT_DECLARE "name"
+.Fn KFAIL_POINT_DEFINE "parent" "name" "flags"
.Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
+.Fn KFAIL_POINT_RETURN "parent" "name"
+.Fn KFAIL_POINT_RETURN_VOID "parent" "name"
.Fn KFAIL_POINT_SLEEP_CALLBACKS "parent" "name" "pre_func" "pre_arg" "post_func" "post_arg" "code"
.Sh DESCRIPTION
Fail points are used to add code points where errors may be injected
@@ -140,6 +146,22 @@
is the equivalent of
.Sy KFAIL_POINT_CODE(..., { error_var = RETURN_VALUE; goto label;})
.El
+.Pp
+You can also introduce fail points by separating the declaration,
+definition, and evaluation portions.
+.Bl -inset
+.It Fn KFAIL_POINT_DECLARE name
+is used to declare the
+.Sy fail_point
+struct.
+.It Fn KFAIL_POINT_DEFINE parent name flags
+defines and initializes the
+.Sy fail_point
+and sets up its
+.Xr sysctl 9 .
+.It Fn KFAIL_POINT_EVAL name code
+is used at the point that the fail point is executed.
+.El
.Sh SYSCTL VARIABLES
The
.Fn KFAIL_POINT_*
Index: sys/sys/fail.h
===================================================================
--- sys/sys/fail.h
+++ sys/sys/fail.h
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2009 Isilon Inc http://www.isilon.com/
+ * Copyright (c) 2009-2019 Dell EMC Isilon http://www.isilon.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -191,10 +191,12 @@
__END_DECLS
/* Declare a fail_point and its sysctl in a function. */
+#define KFAIL_POINT_DECLARE(name) \
+ extern struct fail_point _FAIL_POINT_NAME(name)
#define _FAIL_POINT_NAME(name) _fail_point_##name
#define _FAIL_POINT_LOCATION() "(" __FILE__ ":" __XSTRING(__LINE__) ")"
-#define _FAIL_POINT_INIT(parent, name, flags) \
- static struct fail_point _FAIL_POINT_NAME(name) = { \
+#define KFAIL_POINT_DEFINE(parent, name, flags) \
+ struct fail_point _FAIL_POINT_NAME(name) = { \
.fp_name = #name, \
.fp_location = _FAIL_POINT_LOCATION(), \
.fp_ref_cnt = 0, \
@@ -213,6 +215,9 @@
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, \
&_FAIL_POINT_NAME(name), 0, \
fail_point_sysctl_status, "A", "");
+
+#define _FAIL_POINT_INIT(parent, name, flags) \
+ static KFAIL_POINT_DEFINE(parent, name, flags)
#define _FAIL_POINT_EVAL(name, cond, code...) \
int RETURN_VALUE; \
\
@@ -222,7 +227,8 @@
code; \
\
}
-
+#define KFAIL_POINT_EVAL(name, code...) \
+ _FAIL_POINT_EVAL(name, true, code)
/**
* Instantiate a failpoint which returns "RETURN_VALUE" from the function
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 25, 10:16 AM (9 m, 7 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28986292
Default Alt Text
D20546.id58337.diff (3 KB)
Attached To
Mode
D20546: Allow fail points to have separate declarations, definitions, and evals
Attached
Detach File
Event Timeline
Log In to Comment