OVSRCU_TYPE_INITIALIZER now accepts a parameter (the initial value of the RCU protected pointer).
Signed-off-by: Daniele Di Proietto <[email protected]> --- lib/ovs-rcu.h | 6 ++++-- ofproto/ofproto-dpif-xlate.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ovs-rcu.h b/lib/ovs-rcu.h index 5a8064b..7e6ab50 100644 --- a/lib/ovs-rcu.h +++ b/lib/ovs-rcu.h @@ -137,7 +137,7 @@ #if __GNUC__ #define OVSRCU_TYPE(TYPE) struct { ATOMIC(TYPE) p; } -#define OVSRCU_TYPE_INITIALIZER { NULL } +#define OVSRCU_TYPE_INITIALIZER(P) { ATOMIC_VAR_INIT(P) } #define ovsrcu_get__(TYPE, VAR, ORDER) \ ({ \ TYPE value__; \ @@ -188,7 +188,7 @@ #else /* not GNU C */ struct ovsrcu_pointer { ATOMIC(void *) p; }; #define OVSRCU_TYPE(TYPE) struct ovsrcu_pointer -#define OVSRCU_TYPE_INITIALIZER { NULL } +#define OVSRCU_TYPE_INITIALIZER(P) { ATOMIC_VAR_INIT(P) } static inline void * ovsrcu_get__(const struct ovsrcu_pointer *pointer, memory_order order) { @@ -237,6 +237,8 @@ static inline bool ovsrcu_compare_exchange_strong__ } #endif +#define OVSRCU_TYPE_INIT_NULL OVSRCU_TYPE_INITIALIZER(NULL) + /* Writes VALUE to the RCU-protected pointer whose address is VAR. * * Users require external synchronization (e.g. a mutex). See "Usage" above diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 851b946..cc8c977 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -325,7 +325,7 @@ struct xlate_cfg { struct hmap xbundles; struct hmap xports; }; -static OVSRCU_TYPE(struct xlate_cfg *) xcfgp = OVSRCU_TYPE_INITIALIZER; +static OVSRCU_TYPE(struct xlate_cfg *) xcfgp = OVSRCU_TYPE_INIT_NULL; static struct xlate_cfg *new_xcfg = NULL; static bool may_receive(const struct xport *, struct xlate_ctx *); -- 2.1.0.rc1 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
