From 344e21d47ecfe342fc5c3c8f32020d7a43089301 Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Thu, 8 Aug 2013 15:14:20 -0700 Subject: [PATCH 1/1] clang: Pass objects, not their addresses, to thread-safety macros. This commit changes the code such that arguments to thread-safety macros are not ampersanded. Signed-off-by: Alex Wang Signed-off-by: Ben Pfaff --- lib/bfd.c | 24 ++++++++++++------------ lib/cfm.c | 4 ++-- lib/lacp.c | 4 ++-- lib/stp.c | 2 +- ofproto/ofproto-dpif-sflow.c | 4 ++-- ofproto/tunnel.c | 16 ++++++++-------- vswitchd/system-stats.c | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/bfd.c b/lib/bfd.c index cb53d0085..81fd17877 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -192,28 +192,28 @@ static struct hmap all_bfds__ = HMAP_INITIALIZER(&all_bfds__); static struct hmap *const all_bfds OVS_GUARDED_BY(mutex) = &all_bfds__; static bool bfd_forwarding__(const struct bfd *) OVS_REQUIRES(mutex); -static bool bfd_in_poll(const struct bfd *) OVS_REQUIRES(&mutex); -static void bfd_poll(struct bfd *bfd) OVS_REQUIRES(&mutex); -static const char *bfd_diag_str(enum diag) OVS_REQUIRES(&mutex); -static const char *bfd_state_str(enum state) OVS_REQUIRES(&mutex); -static long long int bfd_min_tx(const struct bfd *) OVS_REQUIRES(&mutex); +static bool bfd_in_poll(const struct bfd *) OVS_REQUIRES(mutex); +static void bfd_poll(struct bfd *bfd) OVS_REQUIRES(mutex); +static const char *bfd_diag_str(enum diag) OVS_REQUIRES(mutex); +static const char *bfd_state_str(enum state) OVS_REQUIRES(mutex); +static long long int bfd_min_tx(const struct bfd *) OVS_REQUIRES(mutex); static long long int bfd_tx_interval(const struct bfd *) - OVS_REQUIRES(&mutex); + OVS_REQUIRES(mutex); static long long int bfd_rx_interval(const struct bfd *) - OVS_REQUIRES(&mutex); -static void bfd_set_next_tx(struct bfd *) OVS_REQUIRES(&mutex); + OVS_REQUIRES(mutex); +static void bfd_set_next_tx(struct bfd *) OVS_REQUIRES(mutex); static void bfd_set_state(struct bfd *, enum state, enum diag) - OVS_REQUIRES(&mutex); -static uint32_t generate_discriminator(void) OVS_REQUIRES(&mutex); + OVS_REQUIRES(mutex); +static uint32_t generate_discriminator(void) OVS_REQUIRES(mutex); static void bfd_put_details(struct ds *, const struct bfd *) - OVS_REQUIRES(&mutex); + OVS_REQUIRES(mutex); static void bfd_unixctl_show(struct unixctl_conn *, int argc, const char *argv[], void *aux OVS_UNUSED); static void bfd_unixctl_set_forwarding_override(struct unixctl_conn *, int argc, const char *argv[], void *aux OVS_UNUSED); static void log_msg(enum vlog_level, const struct msg *, const char *message, - const struct bfd *) OVS_REQUIRES(&mutex); + const struct bfd *) OVS_REQUIRES(mutex); static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(20, 20); diff --git a/lib/cfm.c b/lib/cfm.c index 838b8b1d5..a238c67a9 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -866,7 +866,7 @@ cfm_get_remote_mpids(const struct cfm *cfm, uint64_t **rmps, size_t *n_rmps) } static struct cfm * -cfm_find(const char *name) OVS_REQUIRES(&mutex) +cfm_find(const char *name) OVS_REQUIRES(mutex) { struct cfm *cfm; @@ -879,7 +879,7 @@ cfm_find(const char *name) OVS_REQUIRES(&mutex) } static void -cfm_print_details(struct ds *ds, const struct cfm *cfm) OVS_REQUIRES(&mutex) +cfm_print_details(struct ds *ds, const struct cfm *cfm) OVS_REQUIRES(mutex) { struct remote_mp *rmp; bool extended; diff --git a/lib/lacp.c b/lib/lacp.c index a4ef8b64f..82698746d 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -778,7 +778,7 @@ info_tx_equal(struct lacp_info *a, struct lacp_info *b) } static struct lacp * -lacp_find(const char *name) OVS_REQUIRES(&mutex) +lacp_find(const char *name) OVS_REQUIRES(mutex) { struct lacp *lacp; @@ -828,7 +828,7 @@ ds_put_lacp_state(struct ds *ds, uint8_t state) } static void -lacp_print_details(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(&mutex) +lacp_print_details(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(mutex) { struct shash slave_shash = SHASH_INITIALIZER(&slave_shash); const struct shash_node **sorted_slaves = NULL; diff --git a/lib/stp.c b/lib/stp.c index ed3a08de0..d570be957 100644 --- a/lib/stp.c +++ b/lib/stp.c @@ -146,7 +146,7 @@ struct stp { static struct ovs_mutex mutex; static struct list all_stps__ = LIST_INITIALIZER(&all_stps__); -static struct list *const all_stps OVS_GUARDED_BY(&mutex) = &all_stps__; +static struct list *const all_stps OVS_GUARDED_BY(mutex) = &all_stps__; #define FOR_EACH_ENABLED_PORT(PORT, STP) \ for ((PORT) = stp_next_enabled_port((STP), (STP)->ports); \ diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c index 065aa8b06..b387b945a 100644 --- a/ofproto/ofproto-dpif-sflow.c +++ b/ofproto/ofproto-dpif-sflow.c @@ -146,7 +146,7 @@ sflow_agent_send_packet_cb(void *ds_, SFLAgent *agent OVS_UNUSED, static struct dpif_sflow_port * dpif_sflow_find_port(const struct dpif_sflow *ds, odp_port_t odp_port) - OVS_REQUIRES(&mutex) + OVS_REQUIRES(mutex) { struct dpif_sflow_port *dsp; @@ -162,7 +162,7 @@ dpif_sflow_find_port(const struct dpif_sflow *ds, odp_port_t odp_port) static void sflow_agent_get_counters(void *ds_, SFLPoller *poller, SFL_COUNTERS_SAMPLE_TYPE *cs) - OVS_REQUIRES(&mutex) + OVS_REQUIRES(mutex) { struct dpif_sflow *ds = ds_; SFLCounters_sample_element elem; diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index ce325c006..c23e2d769 100644 --- a/ofproto/tunnel.c +++ b/ofproto/tunnel.c @@ -64,25 +64,25 @@ static struct hmap *ofport_map OVS_GUARDED_BY(rwlock) = &ofport_map__; static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); static struct vlog_rate_limit dbg_rl = VLOG_RATE_LIMIT_INIT(60, 60); -static struct tnl_port *tnl_find(struct tnl_match *) OVS_REQ_RDLOCK(&rwlock); +static struct tnl_port *tnl_find(struct tnl_match *) OVS_REQ_RDLOCK(rwlock); static struct tnl_port *tnl_find_exact(struct tnl_match *) - OVS_REQ_RDLOCK(&rwlock); + OVS_REQ_RDLOCK(rwlock); static struct tnl_port *tnl_find_ofport(const struct ofport_dpif *) - OVS_REQ_RDLOCK(&rwlock); + OVS_REQ_RDLOCK(rwlock); static uint32_t tnl_hash(struct tnl_match *); static void tnl_match_fmt(const struct tnl_match *, struct ds *); -static char *tnl_port_fmt(const struct tnl_port *) OVS_REQ_RDLOCK(&rwlock); +static char *tnl_port_fmt(const struct tnl_port *) OVS_REQ_RDLOCK(rwlock); static void tnl_port_mod_log(const struct tnl_port *, const char *action) - OVS_REQ_RDLOCK(&rwlock); + OVS_REQ_RDLOCK(rwlock); static const char *tnl_port_get_name(const struct tnl_port *) - OVS_REQ_RDLOCK(&rwlock); -static void tnl_port_del__(const struct ofport_dpif *) OVS_REQ_WRLOCK(&rwlock); + OVS_REQ_RDLOCK(rwlock); +static void tnl_port_del__(const struct ofport_dpif *) OVS_REQ_WRLOCK(rwlock); static bool tnl_port_add__(const struct ofport_dpif *ofport, const struct netdev *netdev, odp_port_t odp_port, bool warn) - OVS_REQ_WRLOCK(&rwlock) + OVS_REQ_WRLOCK(rwlock) { const struct netdev_tunnel_config *cfg; struct tnl_port *existing_port; diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c index 9e3d228ad..ae523f34c 100644 --- a/vswitchd/system-stats.c +++ b/vswitchd/system-stats.c @@ -576,7 +576,7 @@ system_stats_wait(void) } static void -discard_stats(void) OVS_REQUIRES(&mutex) +discard_stats(void) OVS_REQUIRES(mutex) { if (system_stats) { smap_destroy(system_stats); -- 2.43.0