[ovs-dev] [PATCH v3 02/12] ofproto: Rename *_begin functions as *_start.

Jarno Rajahalme jrajahalme at nicira.com
Fri Jun 5 22:08:42 UTC 2015


Weirdest things can bother you at night when you try to sleep ;-)

Now we have function triples such as add_flow_begin(),
add_flow_finish(), and add_flow_revert(), where a modification is
started in *_begin(), which can fail, and when successful can be
either made permanent with *_finish(), or cancelled with *_revert().

Linguistically it should be either "begin/end" or "start/finish", not
"begin/finish".  "begin/end" has some C++ STL baggage, so let's go
with "start/finish".  IMO "revert" rhymes with it, too.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
 ofproto/ofproto.c |   38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 0a1d032..9f43034 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -278,7 +278,7 @@ static bool ofproto_group_exists(const struct ofproto *ofproto,
     OVS_EXCLUDED(ofproto->groups_rwlock);
 static enum ofperr add_group(struct ofproto *, struct ofputil_group_mod *);
 static void handle_openflow(struct ofconn *, const struct ofpbuf *);
-static enum ofperr do_bundle_flow_mod_begin(struct ofproto *,
+static enum ofperr do_bundle_flow_mod_start(struct ofproto *,
                                             struct ofputil_flow_mod *,
                                             struct ofp_bundle_entry *)
     OVS_REQUIRES(ofproto_mutex);
@@ -4356,7 +4356,7 @@ set_conjunctions(struct rule *rule, const struct cls_conjunction *conjs,
  *
  * The caller retains ownership of 'fm->ofpacts'. */
 static enum ofperr
-add_flow_begin(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
+add_flow_start(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
                struct rule **rulep, bool *modify)
     OVS_REQUIRES(ofproto_mutex)
 {
@@ -4468,7 +4468,7 @@ add_flow_begin(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
     return 0;
 }
 
-/* Revert the effects of add_flow_begin().
+/* Revert the effects of add_flow_start().
  * 'new_rule' must be passed in as NULL, if no new rule was allocated and
  * inserted to the classifier.
  * Note: evictions cannot be reverted. */
@@ -4705,7 +4705,7 @@ modify_flows__(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
 }
 
 static enum ofperr
-modify_flows_begin__(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
+modify_flows_start__(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
                      struct rule_collection *rules)
     OVS_REQUIRES(ofproto_mutex)
 {
@@ -4717,7 +4717,7 @@ modify_flows_begin__(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
                  || fm->new_cookie == OVS_BE64_MAX)) {
         bool modify;
 
-        error = add_flow_begin(ofproto, fm, &rules->rules[0], &modify);
+        error = add_flow_start(ofproto, fm, &rules->rules[0], &modify);
         if (!error) {
             ovs_assert(!modify);
         }
@@ -4734,7 +4734,7 @@ modify_flows_begin__(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
  * 'ofconn' is used to retrieve the packet buffer specified in fm->buffer_id,
  * if any. */
 static enum ofperr
-modify_flows_begin_loose(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
+modify_flows_start_loose(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
                          struct rule_collection *rules)
     OVS_REQUIRES(ofproto_mutex)
 {
@@ -4749,7 +4749,7 @@ modify_flows_begin_loose(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
     rule_criteria_destroy(&criteria);
 
     if (!error) {
-        error = modify_flows_begin__(ofproto, fm, rules);
+        error = modify_flows_start__(ofproto, fm, rules);
     }
 
     if (error) {
@@ -4787,7 +4787,7 @@ modify_flows_finish(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
 /* Implements OFPFC_MODIFY_STRICT.  Returns 0 on success or an OpenFlow error
  * code on failure. */
 static enum ofperr
-modify_flow_begin_strict(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
+modify_flow_start_strict(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
                          struct rule_collection *rules)
     OVS_REQUIRES(ofproto_mutex)
 {
@@ -4803,7 +4803,7 @@ modify_flow_begin_strict(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
 
     if (!error) {
         /* collect_rules_strict() can return max 1 rule. */
-        error = modify_flows_begin__(ofproto, fm, rules);
+        error = modify_flows_start__(ofproto, fm, rules);
     }
 
     if (error) {
@@ -4862,7 +4862,7 @@ delete_flows__(const struct rule_collection *rules,
 
 /* Implements OFPFC_DELETE. */
 static enum ofperr
-delete_flows_begin_loose(struct ofproto *ofproto,
+delete_flows_start_loose(struct ofproto *ofproto,
                          const struct ofputil_flow_mod *fm,
                          struct rule_collection *rules)
     OVS_REQUIRES(ofproto_mutex)
@@ -4913,7 +4913,7 @@ delete_flows_finish(const struct ofputil_flow_mod *fm,
 
 /* Implements OFPFC_DELETE_STRICT. */
 static enum ofperr
-delete_flow_begin_strict(struct ofproto *ofproto,
+delete_flow_start_strict(struct ofproto *ofproto,
                          const struct ofputil_flow_mod *fm,
                          struct rule_collection *rules)
     OVS_REQUIRES(ofproto_mutex)
@@ -5074,7 +5074,7 @@ handle_flow_mod__(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
     enum ofperr error;
 
     ovs_mutex_lock(&ofproto_mutex);
-    error = do_bundle_flow_mod_begin(ofproto, fm, &be);
+    error = do_bundle_flow_mod_start(ofproto, fm, &be);
     if (!error) {
         do_bundle_flow_mod_finish(ofproto, fm, req, &be);
     }
@@ -6440,25 +6440,25 @@ handle_table_mod(struct ofconn *ofconn, const struct ofp_header *oh)
 }
 
 static enum ofperr
-do_bundle_flow_mod_begin(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
+do_bundle_flow_mod_start(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
                          struct ofp_bundle_entry *be)
     OVS_REQUIRES(ofproto_mutex)
 {
     switch (fm->command) {
     case OFPFC_ADD:
-        return add_flow_begin(ofproto, fm, &be->rule, &be->modify);
+        return add_flow_start(ofproto, fm, &be->rule, &be->modify);
 
     case OFPFC_MODIFY:
-        return modify_flows_begin_loose(ofproto, fm, &be->rules);
+        return modify_flows_start_loose(ofproto, fm, &be->rules);
 
     case OFPFC_MODIFY_STRICT:
-        return modify_flow_begin_strict(ofproto, fm, &be->rules);
+        return modify_flow_start_strict(ofproto, fm, &be->rules);
 
     case OFPFC_DELETE:
-        return delete_flows_begin_loose(ofproto, fm, &be->rules);
+        return delete_flows_start_loose(ofproto, fm, &be->rules);
 
     case OFPFC_DELETE_STRICT:
-        return delete_flow_begin_strict(ofproto, fm, &be->rules);
+        return delete_flow_start_strict(ofproto, fm, &be->rules);
     }
 
     return OFPERR_OFPFMFC_BAD_COMMAND;
@@ -6558,7 +6558,7 @@ do_bundle_commit(struct ofconn *ofconn, uint32_t id, uint16_t flags)
                 /* Not supported yet. */
                 error = OFPERR_OFPBFC_MSG_FAILED;
             } else if (be->type == OFPTYPE_FLOW_MOD) {
-                error = do_bundle_flow_mod_begin(ofproto, &be->fm, be);
+                error = do_bundle_flow_mod_start(ofproto, &be->fm, be);
             } else {
                 OVS_NOT_REACHED();
             }
-- 
1.7.10.4




More information about the dev mailing list