diff mbox series

[ovs-dev,2/2] ovsschema: Avoid using 'protected' as variable name

Message ID 1512069111-106636-2-git-send-email-yihung.wei@gmail.com
State Changes Requested
Headers show
Series [ovs-dev,1/2] lib, ovsdb: Adapt headers for C++ usage | expand

Commit Message

Yi-Hung Wei Nov. 30, 2017, 7:11 p.m. UTC
In C++, 'protected' is a keyword. This patch renames 'protected'
to 'is_protected' in a couple files so that C++ compiler will
not get confused.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
 ofproto/ofproto-dpif.c     | 10 +++++-----
 ofproto/ofproto.h          |  2 +-
 vswitchd/bridge.c          |  2 +-
 vswitchd/vswitch.ovsschema |  6 +++---
 vswitchd/vswitch.xml       |  2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

Comments

Ben Pfaff Dec. 1, 2017, 9:27 p.m. UTC | #1
On Thu, Nov 30, 2017 at 11:11:51AM -0800, Yi-Hung Wei wrote:
> In C++, 'protected' is a keyword. This patch renames 'protected'
> to 'is_protected' in a couple files so that C++ compiler will
> not get confused.
> 
> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>

Thanks for working on this.

We can't change the name of the "protected" column in the database
schema, because that breaks backward compatibility.  Another approach
would be to make ovsdb-idlc use a different name for columns whose names
are C or C++ keywords; for example, it could append an underscore.
Yi-Hung Wei Dec. 4, 2017, 10:41 p.m. UTC | #2
> We can't change the name of the "protected" column in the database
> schema, because that breaks backward compatibility.  Another approach
> would be to make ovsdb-idlc use a different name for columns whose names
> are C or C++ keywords; for example, it could append an underscore.

Hi Ben,

Thanks for your advise.  I update the patch using ovsdb-idlc to rename
a column name if it is a C++ keyword. Here is the new patch:
https://patchwork.ozlabs.org/patch/844498/

Thanks,

-Yi-Hung
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index b99f04fad300..36de557bd9a8 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -103,7 +103,7 @@  struct ofbundle {
     struct bond *bond;          /* Nonnull iff more than one port. */
     bool use_priority_tags;     /* Use 802.1p tag for frames in VLAN 0? */
 
-    bool protected;             /* Protected port mode */
+    bool is_protected;             /* Protected port mode */
 
     /* Status. */
     bool floodable;          /* True if no port has OFPUTIL_PC_NO_FLOOD set. */
@@ -456,7 +456,7 @@  type_run(const char *type)
                                  bundle->vlan, bundle->trunks, bundle->cvlans,
                                  bundle->use_priority_tags,
                                  bundle->bond, bundle->lacp,
-                                 bundle->floodable, bundle->protected);
+                                 bundle->floodable, bundle->is_protected);
             }
 
             HMAP_FOR_EACH (ofport, up.hmap_node, &ofproto->up.ports) {
@@ -3049,7 +3049,7 @@  bundle_set(struct ofproto *ofproto_, void *aux,
         bundle->bond = NULL;
 
         bundle->floodable = true;
-        bundle->protected = false;
+        bundle->is_protected = false;
         mbridge_register_bundle(ofproto->mbridge, bundle);
     }
 
@@ -3207,8 +3207,8 @@  bundle_set(struct ofproto *ofproto_, void *aux,
     }
 
     /* Set proteced port mode */
-    if (s->protected != bundle->protected) {
-        bundle->protected = s->protected;
+    if (s->is_protected != bundle->is_protected) {
+        bundle->is_protected = s->is_protected;
         need_flush = true;
     }
 
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 1e48e1952aa2..305e353a4526 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -414,7 +414,7 @@  struct ofproto_bundle_settings {
     struct lacp_settings *lacp;              /* Nonnull to enable LACP. */
     struct lacp_slave_settings *lacp_slaves; /* Array of n_slaves elements. */
 
-    bool protected;             /* Protected port mode */
+    bool is_protected;             /* Protected port mode */
 };
 
 int ofproto_bundle_register(struct ofproto *, void *aux,
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 630c6fa535e2..70b4e7f2d388 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1046,7 +1046,7 @@  port_configure(struct port *port)
     }
 
     /* Protected port mode */
-    s.protected = cfg->protected;
+    s.is_protected = cfg->is_protected;
 
     /* Register. */
     ofproto_bundle_register(port->bridge->ofproto, port, &s);
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index 90e50b62612b..fb64fbd93beb 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@ 
 {"name": "Open_vSwitch",
- "version": "7.15.1",
- "cksum": "3682332033 23608",
+ "version": "7.16.0",
+ "cksum": "3048577145 23611",
  "tables": {
    "Open_vSwitch": {
      "columns": {
@@ -208,7 +208,7 @@ 
          "type": {"key": "string", "value": "integer",
                   "min": 0, "max": "unlimited"},
          "ephemeral": true},
-       "protected": {
+       "is_protected": {
          "type": "boolean"},
        "other_config": {
          "type": {"key": "string", "value": "string",
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index c145e1a59abb..8f5fa5126482 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1941,7 +1941,7 @@ 
         Bridge?  See ovs-vsctl(8) for more information.
       </column>
 
-      <column name="protected" type='{"type": "boolean"}'>
+      <column name="is_protected" type='{"type": "boolean"}'>
         The protected ports feature allows certain ports to be designated as
         protected. Traffic between protected ports is blocked. Protected
         ports can send traffic to unprotected ports. Unprotected ports can