1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef __LINUX_TORTURE_H
24#define __LINUX_TORTURE_H
25
26#include <linux/types.h>
27#include <linux/cache.h>
28#include <linux/spinlock.h>
29#include <linux/threads.h>
30#include <linux/cpumask.h>
31#include <linux/seqlock.h>
32#include <linux/lockdep.h>
33#include <linux/completion.h>
34#include <linux/debugobjects.h>
35#include <linux/bug.h>
36#include <linux/compiler.h>
37
38
39#define torture_param(type, name, init, msg) \
40 static type name = init; \
41 module_param(name, type, 0444); \
42 MODULE_PARM_DESC(name, msg);
43
44#define TORTURE_FLAG "-torture:"
45#define TOROUT_STRING(s) \
46 pr_alert("%s" TORTURE_FLAG s "\n", torture_type)
47#define VERBOSE_TOROUT_STRING(s) \
48 do { if (verbose) pr_alert("%s" TORTURE_FLAG " %s\n", torture_type, s); } while (0)
49#define VERBOSE_TOROUT_ERRSTRING(s) \
50 do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); } while (0)
51
52
53int torture_onoff_init(long ooholdoff, long oointerval);
54char *torture_onoff_stats(char *page);
55bool torture_onoff_failures(void);
56
57
58struct torture_random_state {
59 unsigned long trs_state;
60 long trs_count;
61};
62#define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 }
63unsigned long torture_random(struct torture_random_state *trsp);
64
65
66void torture_shuffle_task_register(struct task_struct *tp);
67int torture_shuffle_init(long shuffint);
68
69
70void torture_shutdown_absorb(const char *title);
71int torture_shutdown_init(int ssecs, void (*cleanup)(void));
72
73
74void stutter_wait(const char *title);
75int torture_stutter_init(int s);
76
77
78bool torture_init_begin(char *ttype, bool v, int *runnable);
79void torture_init_end(void);
80bool torture_cleanup(void);
81bool torture_must_stop(void);
82bool torture_must_stop_irq(void);
83void torture_kthread_stopping(char *title);
84int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m,
85 char *f, struct task_struct **tp);
86void _torture_stop_kthread(char *m, struct task_struct **tp);
87
88#define torture_create_kthread(n, arg, tp) \
89 _torture_create_kthread(n, (arg), #n, "Creating " #n " task", \
90 "Failed to create " #n, &(tp))
91#define torture_stop_kthread(n, tp) \
92 _torture_stop_kthread("Stopping " #n " task", &(tp))
93
94#endif
95