-static inline void rcu_read_lock(void)
-{
- long tmp;
-
- tmp = urcu_active_readers;
- /* urcu_gp_ctr = RCU_GP_COUNT | (~RCU_GP_CTR_BIT or RCU_GP_CTR_BIT) */
- /* The data dependency "read urcu_gp_ctr, write urcu_active_readers",
- * serializes those two memory operations. */
- if (likely(!(tmp & RCU_GP_CTR_NEST_MASK)))
- urcu_active_readers = ACCESS_ONCE(urcu_gp_ctr);
- else
- urcu_active_readers = tmp + RCU_GP_COUNT;
- /*
- * Increment active readers count before accessing the pointer.
- * See force_mb_all_threads().
- */
- read_barrier();
-}
-
-static inline void rcu_read_unlock(void)
-{
- read_barrier();
- /*
- * Finish using rcu before decrementing the pointer.
- * See force_mb_all_threads().
- */
- urcu_active_readers -= RCU_GP_COUNT;
-}
-
-/**
- * rcu_assign_pointer - assign (publicize) a pointer to a newly
- * initialized structure that will be dereferenced by RCU read-side
- * critical sections. Returns the value assigned.
- *
- * Inserts memory barriers on architectures that require them
- * (pretty much all of them other than x86), and also prevents
- * the compiler from reordering the code that initializes the
- * structure after the pointer assignment. More importantly, this
- * call documents which pointers will be dereferenced by RCU read-side
- * code.
- */
-
-#define rcu_assign_pointer(p, v) \
- ({ \
- if (!__builtin_constant_p(v) || \
- ((v) != NULL)) \
- wmb(); \
- (p) = (v); \
- })
-
-#define rcu_xchg_pointer(p, v) \
- ({ \
- if (!__builtin_constant_p(v) || \
- ((v) != NULL)) \
- wmb(); \
- xchg(p, v); \
- })
-
-extern void synchronize_rcu(void);
-
-/*
- * Exchanges the pointer and waits for quiescent state.
- * The pointer returned can be freed.
- */
-#define urcu_publish_content(p, v) \
- ({ \
- void *oldptr; \
- oldptr = rcu_xchg_pointer(p, v); \
- synchronize_rcu(); \
- oldptr; \
- })
-
-/*
- * Reader thread registration.
- */
-extern void urcu_register_thread(void);
-extern void urcu_unregister_thread(void);