1#ifndef MISC_H
2#define MISC_H
3
4#include "assume.h"
5#include "int_typedefs.h"
6#include "locks.h"
7
8#include <linux/types.h>
9
10/* Probably won't need to deal with bottom halves. */
11static inline void local_bh_disable(void) {}
12static inline void local_bh_enable(void) {}
13
14#define MODULE_ALIAS(X)
15#define module_param(...)
16#define EXPORT_SYMBOL_GPL(x)
17
18#define container_of(ptr, type, member) ({			\
19	const typeof(((type *)0)->member) *__mptr = (ptr);	\
20	(type *)((char *)__mptr - offsetof(type, member));	\
21})
22
23#ifndef USE_SIMPLE_SYNC_SRCU
24/* Abuse udelay to make sure that busy loops terminate. */
25#define udelay(x) assume(0)
26
27#else
28
29/* The simple custom synchronize_srcu is ok with try_check_zero failing. */
30#define udelay(x) do { } while (0)
31#endif
32
33#define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
34	do { } while (0)
35
36#define notrace
37
38/* Avoid including rcupdate.h */
39struct rcu_synchronize {
40	struct rcu_head head;
41	struct completion completion;
42};
43
44void wakeme_after_rcu(struct rcu_head *head);
45
46#define rcu_lock_acquire(a) do { } while (0)
47#define rcu_lock_release(a) do { } while (0)
48#define rcu_lockdep_assert(c, s) do { } while (0)
49#define RCU_LOCKDEP_WARN(c, s) do { } while (0)
50
51/* Let CBMC non-deterministically choose switch between normal and expedited. */
52bool rcu_gp_is_normal(void);
53bool rcu_gp_is_expedited(void);
54
55/* Do the same for old versions of rcu. */
56#define rcu_expedited (rcu_gp_is_expedited())
57
58#endif
59