forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rcutorture: Abstract torture-test initialization
This commit creates torture_init_begin() and torture_init_end() functions to abstract locking and allow the torture_type and verbose variables in kernel/torture.o to become static. With a bit more abstraction, fullstop_mutex will also become static. Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Josh Triplett <[email protected]>
- Loading branch information
Showing
3 changed files
with
40 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,9 @@ | |
MODULE_LICENSE("GPL"); | ||
MODULE_AUTHOR("Paul E. McKenney <[email protected]>"); | ||
|
||
static char *torture_type; | ||
static bool verbose; | ||
|
||
int fullstop = FULLSTOP_RMMOD; | ||
EXPORT_SYMBOL_GPL(fullstop); | ||
DEFINE_MUTEX(fullstop_mutex); | ||
|
@@ -426,3 +429,27 @@ void torture_shutdown_absorb(const char *title) | |
} | ||
} | ||
EXPORT_SYMBOL_GPL(torture_shutdown_absorb); | ||
|
||
/* | ||
* Initialize torture module. Please note that this is -not- invoked via | ||
* the usual module_init() mechanism, but rather by an explicit call from | ||
* the client torture module. This call must be paired with a later | ||
* torture_init_end(). | ||
*/ | ||
void __init torture_init_begin(char *ttype, bool v) | ||
{ | ||
mutex_lock(&fullstop_mutex); | ||
torture_type = ttype; | ||
verbose = v; | ||
|
||
} | ||
EXPORT_SYMBOL_GPL(torture_init_begin); | ||
|
||
/* | ||
* Tell the torture module that initialization is complete. | ||
*/ | ||
void __init torture_init_end(void) | ||
{ | ||
mutex_unlock(&fullstop_mutex); | ||
} | ||
EXPORT_SYMBOL_GPL(torture_init_end); |