Commit | Line | Data |
---|---|---|
e09e518e GM |
1 | #include <glib.h> |
2 | #include "fsm_locking_sm.h" | |
3 | struct lockclass{ | |
4 | struct lockclassContext _fsm; | |
5 | int cpu; //one class per CPU | |
6 | GArray *local_stack; //stack containing held (per CPU) locks | |
7 | }; | |
8 | ||
9 | struct lockstruct{ | |
10 | guint32 lock_add; | |
11 | guint32 ret_add; | |
12 | ||
13 | int taken_irqs_off; | |
14 | long taken_irqs_off_ts_sec,taken_irqs_off_ts_ns; | |
15 | ||
16 | int taken_irqs_on; | |
17 | long taken_irqs_on_ts_sec, taken_irqs_on_ts_ns; | |
18 | ||
19 | int hardirq_context; //1 if taken inside an irq handler | |
20 | long hardirq_context_ts_sec, hardirq_context_ts_ns; | |
21 | ||
22 | int pid; //pid of the process currently holding the lock | |
23 | //only valid if lock is present in stack; | |
24 | }; | |
25 | ||
26 | ||
27 | struct lockclass * lockclass_Init(int CPU); | |
28 | ||
29 | struct lockstruct * lockstruct_Init(); | |
30 | int irq_check(struct lockclass *fsm, void *lock, int hardirqs_off, int hardirq_context); | |
31 | ||
32 | int empty_stack(struct lockclass *fsm); | |
33 | int lock_held(struct lockclass *fsm, struct lockstruct *lock); | |
34 | int lock_held_on_behalf(struct lockclass *fsm, guint32 pid); | |
35 | void lockclass_warning(struct lockclass *fsm, char *msg, struct lockstruct *); | |
36 | void lockclass_printstack(struct lockclass *fsm); | |
37 | void poplock(struct lockclass *fsm, struct lockstruct *lock); | |
38 | void pushlock(struct lockclass *fsm, struct lockstruct *lock); | |
39 | void lockclass_clearlock(struct lockclass *fsm, struct lockstruct *lock); | |
40 | void lockclass_updatelock(struct lockclass *fsm, struct lockstruct *lock, guint32 lock_add, int pid, int hardirqs_off, int hardirq_context); | |
41 | void lockclass_test(); |