clang: Pass objects, not their addresses, to thread-safety macros.
authorAlex Wang <alexw@nicira.com>
Thu, 8 Aug 2013 22:14:20 +0000 (15:14 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 9 Aug 2013 20:48:11 +0000 (13:48 -0700)
This commit changes the code such that arguments to thread-safety
macros are not ampersanded.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/bfd.c
lib/cfm.c
lib/lacp.c
lib/stp.c
ofproto/ofproto-dpif-sflow.c
ofproto/tunnel.c
vswitchd/system-stats.c

index cb53d00..81fd178 100644 (file)
--- 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);
 
index 838b8b1..a238c67 100644 (file)
--- 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;
index a4ef8b6..8269874 100644 (file)
@@ -778,7 +778,7 @@ info_tx_equal(struct lacp_info *a, struct lacp_info *b)
 }
 \f
 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;
index ed3a08d..d570be9 100644 (file)
--- 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);   \
index 065aa8b..b387b94 100644 (file)
@@ -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;
index ce325c0..c23e2d7 100644 (file)
@@ -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;
index 9e3d228..ae523f3 100644 (file)
@@ -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);