compiler.h | compiler.h | |||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
#endif | #endif | |||
/* | /* | |||
* caa_container_of - Get the address of an object containing a field. | * caa_container_of - Get the address of an object containing a field. | |||
* | * | |||
* @ptr: pointer to the field. | * @ptr: pointer to the field. | |||
* @type: type of the object. | * @type: type of the object. | |||
* @member: name of the field within the object. | * @member: name of the field within the object. | |||
*/ | */ | |||
#define caa_container_of(ptr, type, member) \ | #define caa_container_of(ptr, type, member) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \ | const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \ | |||
(type *)((char *)__ptr - offsetof(type, member)); \ | (type *)((char *)__ptr - offsetof(type, member)); \ | |||
}) | }) | |||
#define CAA_BUILD_BUG_ON_ZERO(cond) (sizeof(struct { int:-!!(cond); })) | #define CAA_BUILD_BUG_ON_ZERO(cond) (sizeof(struct { int:-!!(cond); })) | |||
#define CAA_BUILD_BUG_ON(cond) ((void)CAA_BUILD_BUG_ON_ZERO(cond)) | #define CAA_BUILD_BUG_ON(cond) ((void)CAA_BUILD_BUG_ON_ZERO(cond)) | |||
/* | /* | |||
* __rcu is an annotation that documents RCU pointer accesses that need | * __rcu is an annotation that documents RCU pointer accesses that need | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
system.h | system.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
/* | /* | |||
* Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come | * Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come | |||
* before the load. | * before the load. | |||
*/ | */ | |||
#define _CMM_LOAD_SHARED(p) CMM_ACCESS_ONCE(p) | #define _CMM_LOAD_SHARED(p) CMM_ACCESS_ONCE(p) | |||
/* | /* | |||
* Load a data from shared memory, doing a cache flush if required. | * Load a data from shared memory, doing a cache flush if required. | |||
*/ | */ | |||
#define CMM_LOAD_SHARED(p) \ | #define CMM_LOAD_SHARED(p) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
cmm_smp_rmc(); \ | cmm_smp_rmc(); \ | |||
_CMM_LOAD_SHARED(p); \ | _CMM_LOAD_SHARED(p); \ | |||
}) | }) | |||
/* | /* | |||
* Identify a shared store. A cmm_smp_wmc() or cmm_smp_mc() should | * Identify a shared store. A cmm_smp_wmc() or cmm_smp_mc() should | |||
* follow the store. | * follow the store. | |||
*/ | */ | |||
#define _CMM_STORE_SHARED(x, v) ({ CMM_ACCESS_ONCE(x) = (v); }) | #define _CMM_STORE_SHARED(x, v) __extension__ ({ CMM_ACCESS_ONCE(x) = (v); }) | |||
/* | /* | |||
* Store v into x, where x is located in shared memory. Performs the | * Store v into x, where x is located in shared memory. Performs the | |||
* required cache flush after writing. Returns v. | * required cache flush after writing. Returns v. | |||
*/ | */ | |||
#define CMM_STORE_SHARED(x, v) \ | #define CMM_STORE_SHARED(x, v) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(x) _v = _CMM_STORE_SHARED(x, v); \ | __typeof__(x) _v = _CMM_STORE_SHARED(x, v); \ | |||
cmm_smp_wmc(); \ | cmm_smp_wmc(); \ | |||
_v = _v; /* Work around clang "unused result" */ \ | _v = _v; /* Work around clang "unused result" */ \ | |||
}) | }) | |||
#endif /* _URCU_SYSTEM_H */ | #endif /* _URCU_SYSTEM_H */ | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
urcu-bp.h | urcu-bp.h | |||
---|---|---|---|---|
skipping to change at line 97 | skipping to change at line 97 | |||
* library wrappers to be used by non-LGPL compatible source code. | * library wrappers to be used by non-LGPL compatible source code. | |||
* See LGPL-only urcu/static/urcu-pointer.h for documentation. | * See LGPL-only urcu/static/urcu-pointer.h for documentation. | |||
*/ | */ | |||
extern void rcu_read_lock(void); | extern void rcu_read_lock(void); | |||
extern void rcu_read_unlock(void); | extern void rcu_read_unlock(void); | |||
extern int rcu_read_ongoing(void); | extern int rcu_read_ongoing(void); | |||
extern void *rcu_dereference_sym_bp(void *p); | extern void *rcu_dereference_sym_bp(void *p); | |||
#define rcu_dereference_bp(p) \ | #define rcu_dereference_bp(p) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \ | __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \ | |||
rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \ | rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \ | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new); | extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new); | |||
#define rcu_cmpxchg_pointer_bp(p, old, _new) \ | #define rcu_cmpxchg_pointer_bp(p, old, _new) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(*(p)) _________pold = (old); \ | __typeof__(*(p)) _________pold = (old); \ | |||
__typeof__(*(p)) _________pnew = (_new); \ | __typeof__(*(p)) _________pnew = (_new); \ | |||
__typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | |||
rcu_cmpxchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ | rcu_cmpxchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ | |||
_________pold, \ | _________pold, \ | |||
_________pnew)); \ | _________pnew)); \ | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
extern void *rcu_xchg_pointer_sym_bp(void **p, void *v); | extern void *rcu_xchg_pointer_sym_bp(void **p, void *v); | |||
#define rcu_xchg_pointer_bp(p, v) \ | #define rcu_xchg_pointer_bp(p, v) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(*(p)) _________pv = (v); \ | __typeof__(*(p)) _________pv = (v); \ | |||
__typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)),\ | __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)),\ | |||
rcu_xchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ | rcu_xchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ | |||
_________pv)); \ | _________pv)); \ | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
extern void *rcu_set_pointer_sym_bp(void **p, void *v); | extern void *rcu_set_pointer_sym_bp(void **p, void *v); | |||
#define rcu_set_pointer_bp(p, v) \ | #define rcu_set_pointer_bp(p, v) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(*(p)) _________pv = (v); \ | __typeof__(*(p)) _________pv = (v); \ | |||
__typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | |||
rcu_set_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ | rcu_set_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ | |||
_________pv)); \ | _________pv)); \ | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
#endif /* !_LGPL_SOURCE */ | #endif /* !_LGPL_SOURCE */ | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added | |||
urcu-pointer.h | urcu-pointer.h | |||
---|---|---|---|---|
skipping to change at line 69 | skipping to change at line 69 | |||
* return: old pointer value | * return: old pointer value | |||
*/ | */ | |||
#define rcu_cmpxchg_pointer _rcu_cmpxchg_pointer | #define rcu_cmpxchg_pointer _rcu_cmpxchg_pointer | |||
#define rcu_xchg_pointer _rcu_xchg_pointer | #define rcu_xchg_pointer _rcu_xchg_pointer | |||
#define rcu_set_pointer _rcu_set_pointer | #define rcu_set_pointer _rcu_set_pointer | |||
#else /* !(defined(_LGPL_SOURCE) || defined(URCU_INLINE_SMALL_FUNCTIONS)) * / | #else /* !(defined(_LGPL_SOURCE) || defined(URCU_INLINE_SMALL_FUNCTIONS)) * / | |||
extern void *rcu_dereference_sym(void *p); | extern void *rcu_dereference_sym(void *p); | |||
#define rcu_dereference(p) \ | #define rcu_dereference(p) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p ), \ | __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p ), \ | |||
rcu_dereference_sym(URCU_FORCE_CAST(void *, p))); \ | rcu_dereference_sym(URCU_FORCE_CAST(void *, p))); \ | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new); | extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new); | |||
#define rcu_cmpxchg_pointer(p, old, _new) \ | #define rcu_cmpxchg_pointer(p, old, _new) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(*(p)) _________pold = (old); \ | __typeof__(*(p)) _________pold = (old); \ | |||
__typeof__(*(p)) _________pnew = (_new); \ | __typeof__(*(p)) _________pnew = (_new); \ | |||
__typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | |||
rcu_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p), \ | rcu_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p), \ | |||
_________pold, \ | _________pold, \ | |||
_________pnew)); \ | _________pnew)); \ | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
extern void *rcu_xchg_pointer_sym(void **p, void *v); | extern void *rcu_xchg_pointer_sym(void **p, void *v); | |||
#define rcu_xchg_pointer(p, v) \ | #define rcu_xchg_pointer(p, v) \ | |||
__extension__ \ | ||||
({ \ | ({ \ | |||
__typeof__(*(p)) _________pv = (v); \ | __typeof__(*(p)) _________pv = (v); \ | |||
__typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*( p)), \ | |||
rcu_xchg_pointer_sym(URCU_FORCE_CAST(void **, p), \ | rcu_xchg_pointer_sym(URCU_FORCE_CAST(void **, p), \ | |||
_________pv)); \ | _________pv)); \ | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
/* | /* | |||
* Note: rcu_set_pointer_sym returns @v because we don't want to break | * Note: rcu_set_pointer_sym returns @v because we don't want to break | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
urcu-qsbr.h | urcu-qsbr.h | |||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
* publication headers. | * publication headers. | |||
*/ | */ | |||
#include <urcu-pointer.h> | #include <urcu-pointer.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#include <urcu/map/urcu-qsbr.h> | #include <urcu/map/urcu-qsbr.h> | |||
#ifdef RCU_DEBUG /* For backward compatibility */ | ||||
#define DEBUG_RCU | ||||
#endif | ||||
/* | /* | |||
* Important ! | * Important ! | |||
* | * | |||
* Each thread containing read-side critical sections must be registered | * Each thread containing read-side critical sections must be registered | |||
* with rcu_register_thread() before calling rcu_read_lock(). | * with rcu_register_thread() before calling rcu_read_lock(). | |||
* rcu_unregister_thread() should be called before the thread exits. | * rcu_unregister_thread() should be called before the thread exits. | |||
*/ | */ | |||
#ifdef _LGPL_SOURCE | #ifdef _LGPL_SOURCE | |||
skipping to change at line 89 | skipping to change at line 93 | |||
#else /* !_LGPL_SOURCE */ | #else /* !_LGPL_SOURCE */ | |||
/* | /* | |||
* library wrappers to be used by non-LGPL compatible source code. | * library wrappers to be used by non-LGPL compatible source code. | |||
*/ | */ | |||
/* | /* | |||
* QSBR read lock/unlock are guaranteed to be no-ops. Therefore, we expose them | * QSBR read lock/unlock are guaranteed to be no-ops. Therefore, we expose them | |||
* in the LGPL header for any code to use. However, the debug version is no t | * in the LGPL header for any code to use. However, the debug version is no t | |||
* nops and may contain sanity checks. To activate it, applications must be | * nops and may contain sanity checks. To activate it, applications must be | |||
* recompiled with -DRCU_DEBUG (even non-LGPL/GPL applications). This is th e | * recompiled with -DDEBUG_RCU (even non-LGPL/GPL applications). This is th e | |||
* best trade-off between license/performance/code triviality and | * best trade-off between license/performance/code triviality and | |||
* library debugging & tracing features we could come up with. | * library debugging & tracing features we could come up with. | |||
*/ | */ | |||
#if (!defined(BUILD_QSBR_LIB) && !defined(RCU_DEBUG)) | #if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU)) | |||
static inline void rcu_read_lock(void) | static inline void rcu_read_lock(void) | |||
{ | { | |||
} | } | |||
static inline void rcu_read_unlock(void) | static inline void rcu_read_unlock(void) | |||
{ | { | |||
} | } | |||
#else /* !RCU_DEBUG */ | #else /* !DEBUG_RCU */ | |||
extern void rcu_read_lock(void); | extern void rcu_read_lock(void); | |||
extern void rcu_read_unlock(void); | extern void rcu_read_unlock(void); | |||
#endif /* !RCU_DEBUG */ | #endif /* !DEBUG_RCU */ | |||
extern int rcu_read_ongoing(void); | extern int rcu_read_ongoing(void); | |||
extern void rcu_quiescent_state(void); | extern void rcu_quiescent_state(void); | |||
extern void rcu_thread_offline(void); | extern void rcu_thread_offline(void); | |||
extern void rcu_thread_online(void); | extern void rcu_thread_online(void); | |||
#endif /* !_LGPL_SOURCE */ | #endif /* !_LGPL_SOURCE */ | |||
extern void synchronize_rcu(void); | extern void synchronize_rcu(void); | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 8 lines changed or added | |||