STORE_SHARED(p, v); \
})
+/**
+ * _rcu_cmpxchg_pointer - same as rcu_assign_pointer, but tests if the pointer
+ * is as expected by "old". If succeeds, returns the previous pointer to the
+ * data structure, which can be safely freed after waiting for a quiescent state
+ * using synchronize_rcu(). If fails (unexpected value), returns old (which
+ * should not be freed !).
+ */
+
+#define _rcu_cmpxchg_pointer(p, old, _new) \
+ ({ \
+ if (!__builtin_constant_p(_new) || \
+ ((_new) != NULL)) \
+ wmb(); \
+ cmpxchg(p, old, _new); \
+ })
+
/**
* _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous
* pointer to the data structure, which can be safely freed after waiting for a
return STORE_SHARED(p, v);
}
+void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new)
+{
+ wmb();
+ return cmpxchg(p, old, _new);
+}
+
void *rcu_xchg_pointer_sym(void **p, void *v)
{
wmb();
#define rcu_assign_pointer(p, v) \
rcu_assign_pointer_sym((void **)(p), (v))
+extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
+#define rcu_cmpxchg_pointer(p, old, _new) \
+ rcu_cmpxchg_pointer_sym((void **)(p), (old), (_new))
+
extern void *rcu_xchg_pointer_sym(void **p, void *v);
#define rcu_xchg_pointer(p, v) \
rcu_xchg_pointer_sym((void **)(p), (v))
STORE_SHARED(p, v); \
})
+/**
+ * _rcu_cmpxchg_pointer - same as rcu_assign_pointer, but tests if the pointer
+ * is as expected by "old". If succeeds, returns the previous pointer to the
+ * data structure, which can be safely freed after waiting for a quiescent state
+ * using synchronize_rcu(). If fails (unexpected value), returns old (which
+ * should not be freed !).
+ */
+
+#define _rcu_cmpxchg_pointer(p, old, _new) \
+ ({ \
+ if (!__builtin_constant_p(_new) || \
+ ((_new) != NULL)) \
+ wmb(); \
+ cmpxchg(p, old, _new); \
+ })
+
/**
* _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous
* pointer to the data structure, which can be safely freed after waiting for a
return xchg(p, v);
}
+void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new)
+{
+ wmb();
+ return cmpxchg(p, old, _new);
+}
+
void *rcu_publish_content_sym(void **p, void *v)
{
void *oldptr;
#define rcu_assign_pointer(p, v) \
rcu_assign_pointer_sym((void **)(p), (v))
+extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
+#define rcu_cmpxchg_pointer(p, old, _new) \
+ rcu_cmpxchg_pointer_sym((void **)(p), (old), (_new))
+
extern void *rcu_xchg_pointer_sym(void **p, void *v);
#define rcu_xchg_pointer(p, v) \
rcu_xchg_pointer_sym((void **)(p), (v))