File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -969,6 +969,24 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
969
969
#define rcu_assign_pointer (p , v ) \
970
970
__rcu_assign_pointer((p), (v), __rcu)
971
971
972
+ /**
973
+ * rcu_replace_pointer() - replace an RCU pointer, returning its old value
974
+ * @rcu_ptr: RCU pointer, whose old value is returned
975
+ * @ptr: regular pointer
976
+ * @c: the lockdep conditions under which the dereference will take place
977
+ *
978
+ * Perform a replacement, where @rcu_ptr is an RCU-annotated
979
+ * pointer and @c is the lockdep argument that is passed to the
980
+ * rcu_dereference_protected() call used to read that pointer. The old
981
+ * value of @rcu_ptr is returned, and @rcu_ptr is set to @ptr.
982
+ */
983
+ #define rcu_replace_pointer (rcu_ptr , ptr , c ) \
984
+ ({ \
985
+ typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c)); \
986
+ rcu_assign_pointer((rcu_ptr), (ptr)); \
987
+ __tmp; \
988
+ })
989
+
972
990
/**
973
991
* RCU_INIT_POINTER() - initialize an RCU protected pointer
974
992
*
You can’t perform that action at this time.
0 commit comments