[ovs-dev] [PATCH 1/3] clang: Use OVS_REQUIRES() for plain mutex.

Alex Wang alexw at nicira.com
Thu Aug 8 22:14:19 UTC 2013


This commit changes the code to use OVS_REQUIRES() instead of
OVS_REQ_WRLOCK(), for plain mutex.

Signed-off-by: Alex Wang <alexw at nicira.com>
---
 lib/bfd.c                    |   48 +++++++--------
 lib/cfm.c                    |   14 ++---
 lib/lacp.c                   |   40 ++++++------
 lib/stp.c                    |  140 +++++++++++++++++++++---------------------
 ofproto/ofproto-dpif-ipfix.c |    2 +-
 ofproto/ofproto-dpif-sflow.c |   10 +--
 ofproto/ofproto-dpif.c       |    2 +-
 7 files changed, 128 insertions(+), 128 deletions(-)

diff --git a/lib/bfd.c b/lib/bfd.c
index d1b8237..cb53d00 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -191,29 +191,29 @@ static struct ovs_mutex mutex = OVS_MUTEX_INITIALIZER;
 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_REQ_WRLOCK(mutex);
-static bool bfd_in_poll(const struct bfd *) OVS_REQ_WRLOCK(&mutex);
-static void bfd_poll(struct bfd *bfd) OVS_REQ_WRLOCK(&mutex);
-static const char *bfd_diag_str(enum diag) OVS_REQ_WRLOCK(&mutex);
-static const char *bfd_state_str(enum state) OVS_REQ_WRLOCK(&mutex);
-static long long int bfd_min_tx(const struct bfd *) OVS_REQ_WRLOCK(&mutex);
+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 long long int bfd_tx_interval(const struct bfd *)
-    OVS_REQ_WRLOCK(&mutex);
+    OVS_REQUIRES(&mutex);
 static long long int bfd_rx_interval(const struct bfd *)
-    OVS_REQ_WRLOCK(&mutex);
-static void bfd_set_next_tx(struct bfd *) OVS_REQ_WRLOCK(&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_REQ_WRLOCK(&mutex);
-static uint32_t generate_discriminator(void) OVS_REQ_WRLOCK(&mutex);
+    OVS_REQUIRES(&mutex);
+static uint32_t generate_discriminator(void) OVS_REQUIRES(&mutex);
 static void bfd_put_details(struct ds *, const struct bfd *)
-    OVS_REQ_WRLOCK(&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_REQ_WRLOCK(&mutex);
+                    const struct bfd *) OVS_REQUIRES(&mutex);
 
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(20, 20);
 
@@ -683,7 +683,7 @@ out:
 }
 
 static bool
-bfd_forwarding__(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_forwarding__(const struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     if (bfd->forwarding_override != -1) {
         return bfd->forwarding_override == 1;
@@ -697,13 +697,13 @@ bfd_forwarding__(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
 
 /* Helpers. */
 static bool
-bfd_in_poll(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_in_poll(const struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     return (bfd->flags & FLAG_POLL) != 0;
 }
 
 static void
-bfd_poll(struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_poll(struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     if (bfd->state > STATE_DOWN && !bfd_in_poll(bfd)
         && !(bfd->flags & FLAG_FINAL)) {
@@ -716,7 +716,7 @@ bfd_poll(struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
 }
 
 static long long int
-bfd_min_tx(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_min_tx(const struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     /* RFC 5880 Section 6.8.3
      * When bfd.SessionState is not Up, the system MUST set
@@ -728,20 +728,20 @@ bfd_min_tx(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
 }
 
 static long long int
-bfd_tx_interval(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_tx_interval(const struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     long long int interval = bfd_min_tx(bfd);
     return MAX(interval, bfd->rmt_min_rx);
 }
 
 static long long int
-bfd_rx_interval(const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_rx_interval(const struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     return MAX(bfd->min_rx, bfd->rmt_min_tx);
 }
 
 static void
-bfd_set_next_tx(struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_set_next_tx(struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     long long int interval = bfd_tx_interval(bfd);
     interval -= interval * random_range(26) / 100;
@@ -817,7 +817,7 @@ bfd_diag_str(enum diag diag) {
 
 static void
 log_msg(enum vlog_level level, const struct msg *p, const char *message,
-        const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+        const struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     struct ds ds = DS_EMPTY_INITIALIZER;
 
@@ -849,7 +849,7 @@ log_msg(enum vlog_level level, const struct msg *p, const char *message,
 
 static void
 bfd_set_state(struct bfd *bfd, enum state state, enum diag diag)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     if (diag == DIAG_NONE && bfd->cpath_down) {
         diag = DIAG_CPATH_DOWN;
@@ -911,7 +911,7 @@ generate_discriminator(void)
 }
 
 static struct bfd *
-bfd_find_by_name(const char *name) OVS_REQ_WRLOCK(mutex)
+bfd_find_by_name(const char *name) OVS_REQUIRES(mutex)
 {
     struct bfd *bfd;
 
@@ -924,7 +924,7 @@ bfd_find_by_name(const char *name) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-bfd_put_details(struct ds *ds, const struct bfd *bfd) OVS_REQ_WRLOCK(mutex)
+bfd_put_details(struct ds *ds, const struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     ds_put_format(ds, "\tForwarding: %s\n",
                   bfd_forwarding__(bfd) ? "true" : "false");
diff --git a/lib/cfm.c b/lib/cfm.c
index 0bd41bf..838b8b1 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -156,7 +156,7 @@ static unixctl_cb_func cfm_unixctl_show;
 static unixctl_cb_func cfm_unixctl_set_fault;
 
 static uint64_t
-cfm_rx_packets(const struct cfm *cfm) OVS_REQ_WRLOCK(mutex)
+cfm_rx_packets(const struct cfm *cfm) OVS_REQUIRES(mutex)
 {
     struct netdev_stats stats;
 
@@ -204,7 +204,7 @@ ds_put_cfm_fault(struct ds *ds, int fault)
 }
 
 static void
-cfm_generate_maid(struct cfm *cfm) OVS_REQ_WRLOCK(mutex)
+cfm_generate_maid(struct cfm *cfm) OVS_REQUIRES(mutex)
 {
     const char *ovs_md_name = "ovs";
     const char *ovs_ma_name = "ovs";
@@ -247,7 +247,7 @@ ccm_interval_to_ms(uint8_t interval)
 }
 
 static long long int
-cfm_fault_interval(struct cfm *cfm) OVS_REQ_WRLOCK(mutex)
+cfm_fault_interval(struct cfm *cfm) OVS_REQUIRES(mutex)
 {
     /* According to the 802.1ag specification we should assume every other MP
      * with the same MAID has the same transmission interval that we have.  If
@@ -289,7 +289,7 @@ cfm_is_valid_mpid(bool extended, uint64_t mpid)
 }
 
 static struct remote_mp *
-lookup_remote_mp(const struct cfm *cfm, uint64_t mpid) OVS_REQ_WRLOCK(mutex)
+lookup_remote_mp(const struct cfm *cfm, uint64_t mpid) OVS_REQUIRES(mutex)
 {
     struct remote_mp *rmp;
 
@@ -795,7 +795,7 @@ out:
 }
 
 static int
-cfm_get_fault__(const struct cfm *cfm) OVS_REQ_WRLOCK(mutex)
+cfm_get_fault__(const struct cfm *cfm) OVS_REQUIRES(mutex)
 {
     if (cfm->fault_override >= 0) {
         return cfm->fault_override ? CFM_FAULT_OVERRIDE : 0;
@@ -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_REQ_WRLOCK(&mutex)
+cfm_find(const char *name) OVS_REQUIRES(&mutex)
 {
     struct cfm *cfm;
 
@@ -879,7 +879,7 @@ cfm_find(const char *name) OVS_REQ_WRLOCK(&mutex)
 }
 
 static void
-cfm_print_details(struct ds *ds, const struct cfm *cfm) OVS_REQ_WRLOCK(&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 de0b663..a4ef8b6 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -128,21 +128,21 @@ static struct ovs_mutex mutex;
 static struct list all_lacps__ = LIST_INITIALIZER(&all_lacps__);
 static struct list *const all_lacps OVS_GUARDED_BY(mutex) = &all_lacps__;
 
-static void lacp_update_attached(struct lacp *) OVS_REQ_WRLOCK(mutex);
+static void lacp_update_attached(struct lacp *) OVS_REQUIRES(mutex);
 
-static void slave_destroy(struct slave *) OVS_REQ_WRLOCK(mutex);
-static void slave_set_defaulted(struct slave *) OVS_REQ_WRLOCK(mutex);
-static void slave_set_expired(struct slave *) OVS_REQ_WRLOCK(mutex);
+static void slave_destroy(struct slave *) OVS_REQUIRES(mutex);
+static void slave_set_defaulted(struct slave *) OVS_REQUIRES(mutex);
+static void slave_set_expired(struct slave *) OVS_REQUIRES(mutex);
 static void slave_get_actor(struct slave *, struct lacp_info *actor)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void slave_get_priority(struct slave *, struct lacp_info *priority)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static bool slave_may_tx(const struct slave *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static struct slave *slave_lookup(const struct lacp *, const void *slave)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static bool info_tx_equal(struct lacp_info *, struct lacp_info *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 
 static unixctl_cb_func lacp_unixctl_show;
 
@@ -446,7 +446,7 @@ out:
 }
 
 static bool
-slave_may_enable__(struct slave *slave) OVS_REQ_WRLOCK(mutex)
+slave_may_enable__(struct slave *slave) OVS_REQUIRES(mutex)
 {
     /* The slave may be enabled if it's attached to an aggregator and its
      * partner is synchronized.*/
@@ -564,7 +564,7 @@ lacp_wait(struct lacp *lacp) OVS_EXCLUDED(mutex)
 /* Updates the attached status of all slaves controlled by 'lacp' and sets its
  * negotiated parameter to true if any slaves are attachable. */
 static void
-lacp_update_attached(struct lacp *lacp) OVS_REQ_WRLOCK(mutex)
+lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex)
 {
     struct slave *lead, *slave;
     struct lacp_info lead_pri;
@@ -613,7 +613,7 @@ lacp_update_attached(struct lacp *lacp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-slave_destroy(struct slave *slave) OVS_REQ_WRLOCK(mutex)
+slave_destroy(struct slave *slave) OVS_REQUIRES(mutex)
 {
     if (slave) {
         struct lacp *lacp = slave->lacp;
@@ -637,7 +637,7 @@ slave_destroy(struct slave *slave) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-slave_set_defaulted(struct slave *slave) OVS_REQ_WRLOCK(mutex)
+slave_set_defaulted(struct slave *slave) OVS_REQUIRES(mutex)
 {
     memset(&slave->partner, 0, sizeof slave->partner);
 
@@ -646,7 +646,7 @@ slave_set_defaulted(struct slave *slave) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-slave_set_expired(struct slave *slave) OVS_REQ_WRLOCK(mutex)
+slave_set_expired(struct slave *slave) OVS_REQUIRES(mutex)
 {
     slave->status = LACP_EXPIRED;
     slave->partner.state |= LACP_STATE_TIME;
@@ -657,7 +657,7 @@ slave_set_expired(struct slave *slave) OVS_REQ_WRLOCK(mutex)
 
 static void
 slave_get_actor(struct slave *slave, struct lacp_info *actor)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     struct lacp *lacp = slave->lacp;
     uint16_t key;
@@ -710,7 +710,7 @@ slave_get_actor(struct slave *slave, struct lacp_info *actor)
  * link. */
 static void
 slave_get_priority(struct slave *slave, struct lacp_info *priority)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     uint16_t partner_priority, actor_priority;
 
@@ -735,13 +735,13 @@ slave_get_priority(struct slave *slave, struct lacp_info *priority)
 }
 
 static bool
-slave_may_tx(const struct slave *slave) OVS_REQ_WRLOCK(mutex)
+slave_may_tx(const struct slave *slave) OVS_REQUIRES(mutex)
 {
     return slave->lacp->active || slave->status != LACP_DEFAULTED;
 }
 
 static struct slave *
-slave_lookup(const struct lacp *lacp, const void *slave_) OVS_REQ_WRLOCK(mutex)
+slave_lookup(const struct lacp *lacp, const void *slave_) OVS_REQUIRES(mutex)
 {
     struct slave *slave;
 
@@ -778,7 +778,7 @@ info_tx_equal(struct lacp_info *a, struct lacp_info *b)
 }
 
 static struct lacp *
-lacp_find(const char *name) OVS_REQ_WRLOCK(&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_REQ_WRLOCK(&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 2ff9df7..ed3a08d 100644
--- a/lib/stp.c
+++ b/lib/stp.c
@@ -154,7 +154,7 @@ static struct list *const all_stps OVS_GUARDED_BY(&mutex) = &all_stps__;
          (PORT) = stp_next_enabled_port((STP), (PORT) + 1))
 static struct stp_port *
 stp_next_enabled_port(const struct stp *stp, const struct stp_port *port)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     for (; port < &stp->ports[ARRAY_SIZE(stp->ports)]; port++) {
         if (port->state != STP_DISABLED) {
@@ -166,57 +166,57 @@ stp_next_enabled_port(const struct stp *stp, const struct stp_port *port)
 
 #define MESSAGE_AGE_INCREMENT 1
 
-static void stp_transmit_config(struct stp_port *) OVS_REQ_WRLOCK(mutex);
+static void stp_transmit_config(struct stp_port *) OVS_REQUIRES(mutex);
 static bool stp_supersedes_port_info(const struct stp_port *,
                                      const struct stp_config_bpdu *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void stp_record_config_information(struct stp_port *,
                                           const struct stp_config_bpdu *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void stp_record_config_timeout_values(struct stp *,
                                              const struct stp_config_bpdu  *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static bool stp_is_designated_port(const struct stp_port *)
-    OVS_REQ_WRLOCK(mutex);
-static void stp_config_bpdu_generation(struct stp *) OVS_REQ_WRLOCK(mutex);
-static void stp_transmit_tcn(struct stp *) OVS_REQ_WRLOCK(mutex);
-static void stp_configuration_update(struct stp *) OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
+static void stp_config_bpdu_generation(struct stp *) OVS_REQUIRES(mutex);
+static void stp_transmit_tcn(struct stp *) OVS_REQUIRES(mutex);
+static void stp_configuration_update(struct stp *) OVS_REQUIRES(mutex);
 static bool stp_supersedes_root(const struct stp_port *root,
-                                const struct stp_port *) OVS_REQ_WRLOCK(mutex);
-static void stp_root_selection(struct stp *) OVS_REQ_WRLOCK(mutex);
-static void stp_designated_port_selection(struct stp *) OVS_REQ_WRLOCK(mutex);
+                                const struct stp_port *) OVS_REQUIRES(mutex);
+static void stp_root_selection(struct stp *) OVS_REQUIRES(mutex);
+static void stp_designated_port_selection(struct stp *) OVS_REQUIRES(mutex);
 static void stp_become_designated_port(struct stp_port *)
-    OVS_REQ_WRLOCK(mutex);
-static void stp_port_state_selection(struct stp *) OVS_REQ_WRLOCK(mutex);
-static void stp_make_forwarding(struct stp_port *) OVS_REQ_WRLOCK(mutex);
-static void stp_make_blocking(struct stp_port *) OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
+static void stp_port_state_selection(struct stp *) OVS_REQUIRES(mutex);
+static void stp_make_forwarding(struct stp_port *) OVS_REQUIRES(mutex);
+static void stp_make_blocking(struct stp_port *) OVS_REQUIRES(mutex);
 static void stp_set_port_state(struct stp_port *, enum stp_state)
-    OVS_REQ_WRLOCK(mutex);
-static void stp_topology_change_detection(struct stp *) OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
+static void stp_topology_change_detection(struct stp *) OVS_REQUIRES(mutex);
 static void stp_topology_change_acknowledged(struct stp *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void stp_acknowledge_topology_change(struct stp_port *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void stp_received_config_bpdu(struct stp *, struct stp_port *,
                                      const struct stp_config_bpdu *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void stp_received_tcn_bpdu(struct stp *, struct stp_port *)
-    OVS_REQ_WRLOCK(mutex);
-static void stp_hello_timer_expiry(struct stp *) OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
+static void stp_hello_timer_expiry(struct stp *) OVS_REQUIRES(mutex);
 static void stp_message_age_timer_expiry(struct stp_port *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static bool stp_is_designated_for_some_port(const struct stp *)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void stp_forward_delay_timer_expiry(struct stp_port *)
-    OVS_REQ_WRLOCK(mutex);
-static void stp_tcn_timer_expiry(struct stp *) OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
+static void stp_tcn_timer_expiry(struct stp *) OVS_REQUIRES(mutex);
 static void stp_topology_change_timer_expiry(struct stp *)
-    OVS_REQ_WRLOCK(mutex);
-static void stp_hold_timer_expiry(struct stp_port *) OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
+static void stp_hold_timer_expiry(struct stp_port *) OVS_REQUIRES(mutex);
 static void stp_initialize_port(struct stp_port *, enum stp_state)
-    OVS_REQ_WRLOCK(mutex);
-static void stp_become_root_bridge(struct stp *) OVS_REQ_WRLOCK(mutex);
-static void stp_update_bridge_timers(struct stp *) OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
+static void stp_become_root_bridge(struct stp *) OVS_REQUIRES(mutex);
+static void stp_update_bridge_timers(struct stp *) OVS_REQUIRES(mutex);
 
 static int clamp(int x, int min, int max);
 static int ms_to_timer(int ms);
@@ -226,7 +226,7 @@ static void stp_stop_timer(struct stp_timer *);
 static bool stp_timer_expired(struct stp_timer *, int elapsed, int timeout);
 
 static void stp_send_bpdu(struct stp_port *, const void *, size_t)
-    OVS_REQ_WRLOCK(mutex);
+    OVS_REQUIRES(mutex);
 static void stp_unixctl_tcn(struct unixctl_conn *, int argc,
                             const char *argv[], void *aux);
 
@@ -393,7 +393,7 @@ out:
 
 static void
 set_bridge_id(struct stp *stp, stp_identifier new_bridge_id)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     if (new_bridge_id != stp->bridge_id) {
         bool root;
@@ -1005,7 +1005,7 @@ stp_port_disable_change_detection(struct stp_port *p)
 }
 
 static void
-stp_transmit_config(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_transmit_config(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     struct stp *stp = p->stp;
     bool root = stp_is_root_bridge(stp);
@@ -1052,7 +1052,7 @@ stp_transmit_config(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 static bool
 stp_supersedes_port_info(const struct stp_port *p,
                          const struct stp_config_bpdu *config)
-     OVS_REQ_WRLOCK(mutex)
+     OVS_REQUIRES(mutex)
 {
     if (ntohll(config->root_id) != p->designated_root) {
         return ntohll(config->root_id) < p->designated_root;
@@ -1069,7 +1069,7 @@ stp_supersedes_port_info(const struct stp_port *p,
 static void
 stp_record_config_information(struct stp_port *p,
                               const struct stp_config_bpdu *config)
-     OVS_REQ_WRLOCK(mutex)
+     OVS_REQUIRES(mutex)
 {
     p->designated_root = ntohll(config->root_id);
     p->designated_cost = ntohl(config->root_path_cost);
@@ -1081,7 +1081,7 @@ stp_record_config_information(struct stp_port *p,
 static void
 stp_record_config_timeout_values(struct stp *stp,
                                  const struct stp_config_bpdu  *config)
-     OVS_REQ_WRLOCK(mutex)
+     OVS_REQUIRES(mutex)
 {
     stp->max_age = ntohs(config->max_age);
     stp->hello_time = ntohs(config->hello_time);
@@ -1090,14 +1090,14 @@ stp_record_config_timeout_values(struct stp *stp,
 }
 
 static bool
-stp_is_designated_port(const struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_is_designated_port(const struct stp_port *p) OVS_REQUIRES(mutex)
 {
     return (p->designated_bridge == p->stp->bridge_id
             && p->designated_port == p->port_id);
 }
 
 static void
-stp_config_bpdu_generation(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_config_bpdu_generation(struct stp *stp) OVS_REQUIRES(mutex)
 {
     struct stp_port *p;
 
@@ -1109,7 +1109,7 @@ stp_config_bpdu_generation(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_transmit_tcn(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_transmit_tcn(struct stp *stp) OVS_REQUIRES(mutex)
 {
     struct stp_port *p = stp->root_port;
     struct stp_tcn_bpdu tcn_bpdu;
@@ -1123,7 +1123,7 @@ stp_transmit_tcn(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_configuration_update(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_configuration_update(struct stp *stp) OVS_REQUIRES(mutex)
 {
     stp_root_selection(stp);
     stp_designated_port_selection(stp);
@@ -1131,7 +1131,7 @@ stp_configuration_update(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 
 static bool
 stp_supersedes_root(const struct stp_port *root, const struct stp_port *p)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     int p_cost = p->designated_cost + p->path_cost;
     int root_cost = root->designated_cost + root->path_cost;
@@ -1150,7 +1150,7 @@ stp_supersedes_root(const struct stp_port *root, const struct stp_port *p)
 }
 
 static void
-stp_root_selection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_root_selection(struct stp *stp) OVS_REQUIRES(mutex)
 {
     struct stp_port *p, *root;
 
@@ -1176,7 +1176,7 @@ stp_root_selection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_designated_port_selection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_designated_port_selection(struct stp *stp) OVS_REQUIRES(mutex)
 {
     struct stp_port *p;
 
@@ -1195,7 +1195,7 @@ stp_designated_port_selection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_become_designated_port(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_become_designated_port(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     struct stp *stp = p->stp;
     p->designated_root = stp->designated_root;
@@ -1205,7 +1205,7 @@ stp_become_designated_port(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_port_state_selection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_port_state_selection(struct stp *stp) OVS_REQUIRES(mutex)
 {
     struct stp_port *p;
 
@@ -1226,7 +1226,7 @@ stp_port_state_selection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_make_forwarding(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_make_forwarding(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     if (p->state == STP_BLOCKING) {
         stp_set_port_state(p, STP_LISTENING);
@@ -1235,7 +1235,7 @@ stp_make_forwarding(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_make_blocking(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_make_blocking(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     if (!(p->state & (STP_DISABLED | STP_BLOCKING))) {
         if (p->state & (STP_FORWARDING | STP_LEARNING)) {
@@ -1250,7 +1250,7 @@ stp_make_blocking(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 
 static void
 stp_set_port_state(struct stp_port *p, enum stp_state state)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     if (state != p->state && !p->state_changed) {
         p->state_changed = true;
@@ -1262,7 +1262,7 @@ stp_set_port_state(struct stp_port *p, enum stp_state state)
 }
 
 static void
-stp_topology_change_detection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_topology_change_detection(struct stp *stp) OVS_REQUIRES(mutex)
 {
     static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
 
@@ -1279,14 +1279,14 @@ stp_topology_change_detection(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_topology_change_acknowledged(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_topology_change_acknowledged(struct stp *stp) OVS_REQUIRES(mutex)
 {
     stp->topology_change_detected = false;
     stp_stop_timer(&stp->tcn_timer);
 }
 
 static void
-stp_acknowledge_topology_change(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_acknowledge_topology_change(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     p->topology_change_ack = true;
     stp_transmit_config(p);
@@ -1295,7 +1295,7 @@ stp_acknowledge_topology_change(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 static void
 stp_received_config_bpdu(struct stp *stp, struct stp_port *p,
                          const struct stp_config_bpdu *config)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     if (ntohs(config->message_age) >= ntohs(config->max_age)) {
         VLOG_WARN("%s: received config BPDU with message age (%u) greater "
@@ -1336,7 +1336,7 @@ stp_received_config_bpdu(struct stp *stp, struct stp_port *p,
 
 static void
 stp_received_tcn_bpdu(struct stp *stp, struct stp_port *p)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     if (p->state != STP_DISABLED) {
         if (stp_is_designated_port(p)) {
@@ -1347,14 +1347,14 @@ stp_received_tcn_bpdu(struct stp *stp, struct stp_port *p)
 }
 
 static void
-stp_hello_timer_expiry(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_hello_timer_expiry(struct stp *stp) OVS_REQUIRES(mutex)
 {
     stp_config_bpdu_generation(stp);
     stp_start_timer(&stp->hello_timer, 0);
 }
 
 static void
-stp_message_age_timer_expiry(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_message_age_timer_expiry(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     struct stp *stp = p->stp;
     bool root = stp_is_root_bridge(stp);
@@ -1373,7 +1373,7 @@ stp_message_age_timer_expiry(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 }
 
 static bool
-stp_is_designated_for_some_port(const struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_is_designated_for_some_port(const struct stp *stp) OVS_REQUIRES(mutex)
 {
     const struct stp_port *p;
 
@@ -1386,7 +1386,7 @@ stp_is_designated_for_some_port(const struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_forward_delay_timer_expiry(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_forward_delay_timer_expiry(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     if (p->state == STP_LISTENING) {
         stp_set_port_state(p, STP_LEARNING);
@@ -1402,21 +1402,21 @@ stp_forward_delay_timer_expiry(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_tcn_timer_expiry(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_tcn_timer_expiry(struct stp *stp) OVS_REQUIRES(mutex)
 {
     stp_transmit_tcn(stp);
     stp_start_timer(&stp->tcn_timer, 0);
 }
 
 static void
-stp_topology_change_timer_expiry(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_topology_change_timer_expiry(struct stp *stp) OVS_REQUIRES(mutex)
 {
     stp->topology_change_detected = false;
     stp->topology_change = false;
 }
 
 static void
-stp_hold_timer_expiry(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
+stp_hold_timer_expiry(struct stp_port *p) OVS_REQUIRES(mutex)
 {
     if (p->config_pending) {
         stp_transmit_config(p);
@@ -1425,7 +1425,7 @@ stp_hold_timer_expiry(struct stp_port *p) OVS_REQ_WRLOCK(mutex)
 
 static void
 stp_initialize_port(struct stp_port *p, enum stp_state state)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     ovs_assert(state & (STP_DISABLED | STP_BLOCKING));
     stp_become_designated_port(p);
@@ -1441,7 +1441,7 @@ stp_initialize_port(struct stp_port *p, enum stp_state state)
 }
 
 static void
-stp_become_root_bridge(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_become_root_bridge(struct stp *stp) OVS_REQUIRES(mutex)
 {
     stp->max_age = stp->bridge_max_age;
     stp->hello_time = stp->bridge_hello_time;
@@ -1453,21 +1453,21 @@ stp_become_root_bridge(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 }
 
 static void
-stp_start_timer(struct stp_timer *timer, int value) OVS_REQ_WRLOCK(mutex)
+stp_start_timer(struct stp_timer *timer, int value) OVS_REQUIRES(mutex)
 {
     timer->value = value;
     timer->active = true;
 }
 
 static void
-stp_stop_timer(struct stp_timer *timer) OVS_REQ_WRLOCK(mutex)
+stp_stop_timer(struct stp_timer *timer) OVS_REQUIRES(mutex)
 {
     timer->active = false;
 }
 
 static bool
 stp_timer_expired(struct stp_timer *timer, int elapsed, int timeout)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     if (timer->active) {
         timer->value += elapsed;
@@ -1502,7 +1502,7 @@ clamp(int x, int min, int max)
 }
 
 static void
-stp_update_bridge_timers(struct stp *stp) OVS_REQ_WRLOCK(mutex)
+stp_update_bridge_timers(struct stp *stp) OVS_REQUIRES(mutex)
 {
     int ht, ma, fd;
 
@@ -1523,7 +1523,7 @@ stp_update_bridge_timers(struct stp *stp) OVS_REQ_WRLOCK(mutex)
 
 static void
 stp_send_bpdu(struct stp_port *p, const void *bpdu, size_t bpdu_size)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     struct eth_header *eth;
     struct llc_header *llc;
@@ -1552,7 +1552,7 @@ stp_send_bpdu(struct stp_port *p, const void *bpdu, size_t bpdu_size)
 /* Unixctl. */
 
 static struct stp *
-stp_find(const char *name) OVS_REQ_WRLOCK(mutex)
+stp_find(const char *name) OVS_REQUIRES(mutex)
 {
     struct stp *stp;
 
diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 5f01327..8e8e7a2 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -506,7 +506,7 @@ dpif_ipfix_get_bridge_exporter_probability(const struct dpif_ipfix *di)
 }
 
 static void
-dpif_ipfix_clear(struct dpif_ipfix *di) OVS_REQ_WRLOCK(mutex)
+dpif_ipfix_clear(struct dpif_ipfix *di) OVS_REQUIRES(mutex)
 {
     struct dpif_ipfix_flow_exporter_map_node *node, *next;
 
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index ac80ff9..065aa8b 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_REQ_WRLOCK(&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_REQ_WRLOCK(&mutex)
+    OVS_REQUIRES(&mutex)
 {
     struct dpif_sflow *ds = ds_;
     SFLCounters_sample_element elem;
@@ -276,7 +276,7 @@ success:
 }
 
 static void
-dpif_sflow_clear__(struct dpif_sflow *ds) OVS_REQ_WRLOCK(mutex)
+dpif_sflow_clear__(struct dpif_sflow *ds) OVS_REQUIRES(mutex)
 {
     if (ds->sflow_agent) {
         sfl_agent_release(ds->sflow_agent);
@@ -382,7 +382,7 @@ dpif_sflow_unref(struct dpif_sflow *ds) OVS_EXCLUDED(mutex)
 
 static void
 dpif_sflow_add_poller(struct dpif_sflow *ds, struct dpif_sflow_port *dsp)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     SFLPoller *poller = sfl_agent_addPoller(ds->sflow_agent, &dsp->dsi, ds,
                                             sflow_agent_get_counters);
@@ -426,7 +426,7 @@ out:
 
 static void
 dpif_sflow_del_port__(struct dpif_sflow *ds, struct dpif_sflow_port *dsp)
-    OVS_REQ_WRLOCK(mutex)
+    OVS_REQUIRES(mutex)
 {
     if (ds->sflow_agent) {
         sfl_agent_removePoller(ds->sflow_agent, &dsp->dsi);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index a8e5cd5..0120640 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -6377,7 +6377,7 @@ vlandev_find(const struct ofproto_dpif *ofproto, ofp_port_t vlandev_ofp_port)
 static ofp_port_t
 vsp_vlandev_to_realdev(const struct ofproto_dpif *ofproto,
                        ofp_port_t vlandev_ofp_port, int *vid)
-    OVS_REQ_WRLOCK(ofproto->vsp_mutex)
+    OVS_REQUIRES(ofproto->vsp_mutex)
 {
     if (!hmap_is_empty(&ofproto->vlandev_map)) {
         const struct vlan_splinter *vsp;
-- 
1.7.9.5




More information about the dev mailing list