[ovs-dev] [meters 1/9] ofp-actions: Give ovs_instruction funcs names that start with that prefix.

Ben Pfaff blp at nicira.com
Thu Jun 27 22:19:36 UTC 2013


This seems slightly clearer, because ofpact_instruction_* makes me look
for a type named ofpact_instruction.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/ofp-actions.c |   16 ++++++++--------
 lib/ofp-actions.h |    4 ++--
 lib/ofp-parse.c   |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 34a700b..b934be1 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -914,13 +914,13 @@ OVS_INSTRUCTIONS
 };
 
 const char *
-ofpact_instruction_name_from_type(enum ovs_instruction_type type)
+ovs_instruction_name_from_type(enum ovs_instruction_type type)
 {
     return inst_info[type].name;
 }
 
 int
-ofpact_instruction_type_from_name(const char *name)
+ovs_instruction_type_from_name(const char *name)
 {
     const struct instruction_type_info *p;
     for (p = inst_info; p < &inst_info[ARRAY_SIZE(inst_info)]; p++) {
@@ -1294,8 +1294,8 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len)
         }
 
         if (inst != OVSINST_OFPIT11_APPLY_ACTIONS && next <= inst) {
-            const char *name = ofpact_instruction_name_from_type(inst);
-            const char *next_name = ofpact_instruction_name_from_type(next);
+            const char *name = ovs_instruction_name_from_type(inst);
+            const char *next_name = ovs_instruction_name_from_type(next);
 
             if (next == inst) {
                 VLOG_WARN("duplicate %s instruction not allowed, for OpenFlow "
@@ -2292,14 +2292,14 @@ ofpact_format(const struct ofpact *a, struct ds *s)
 
     case OFPACT_CLEAR_ACTIONS:
         ds_put_format(s, "%s",
-                      ofpact_instruction_name_from_type(
+                      ovs_instruction_name_from_type(
                           OVSINST_OFPIT11_CLEAR_ACTIONS));
         break;
 
     case OFPACT_WRITE_METADATA:
         metadata = ofpact_get_WRITE_METADATA(a);
         ds_put_format(s, "%s:%#"PRIx64,
-                      ofpact_instruction_name_from_type(
+                      ovs_instruction_name_from_type(
                           OVSINST_OFPIT11_WRITE_METADATA),
                       ntohll(metadata->metadata));
         if (metadata->mask != htonll(UINT64_MAX)) {
@@ -2309,14 +2309,14 @@ ofpact_format(const struct ofpact *a, struct ds *s)
 
     case OFPACT_GOTO_TABLE:
         ds_put_format(s, "%s:%"PRIu8,
-                      ofpact_instruction_name_from_type(
+                      ovs_instruction_name_from_type(
                           OVSINST_OFPIT11_GOTO_TABLE),
                       ofpact_get_GOTO_TABLE(a)->table_id);
         break;
 
     case OFPACT_METER:
         ds_put_format(s, "%s:%"PRIu32,
-                      ofpact_instruction_name_from_type(OVSINST_OFPIT13_METER),
+                      ovs_instruction_name_from_type(OVSINST_OFPIT13_METER),
                       ofpact_get_METER(a)->meter_id);
         break;
     }
diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h
index 799f64c..8dd2a21 100644
--- a/lib/ofp-actions.h
+++ b/lib/ofp-actions.h
@@ -657,8 +657,8 @@ ofpact_is_instruction(const struct ofpact *a)
         || a->type == OFPACT_GOTO_TABLE;
 }
 
-const char *ofpact_instruction_name_from_type(enum ovs_instruction_type type);
-int ofpact_instruction_type_from_name(const char *name);
+const char *ovs_instruction_name_from_type(enum ovs_instruction_type type);
+int ovs_instruction_type_from_name(const char *name);
 
 void ofpact_set_field_init(struct ofpact_reg_load *load,
                            const struct mf_field *mf, const void *src);
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index da36f88..2c1fb5d 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -743,7 +743,7 @@ str_to_inst_ofpacts(char *str, struct ofpbuf *ofpacts)
 
     pos = str;
     while (ofputil_parse_key_value(&pos, &inst, &arg)) {
-        type = ofpact_instruction_type_from_name(inst);
+        type = ovs_instruction_type_from_name(inst);
         if (type < 0) {
             if (!str_to_ofpact__(pos, inst, arg, ofpacts, n_actions)) {
                 break;
-- 
1.7.2.5




More information about the dev mailing list