[ovs-dev] [PATCH 19/32] lldp: Miscellaneous coding style fixes.

Ben Pfaff blp at nicira.com
Mon Feb 23 05:20:11 UTC 2015


Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/lldp/lldp.c          |  4 ++--
 lib/lldp/lldpd-structs.h | 14 +++++++-------
 lib/ovs-lldp.c           | 34 +++++++++++++---------------------
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/lib/lldp/lldp.c b/lib/lldp/lldp.c
index 2b8de0e..8fece07 100644
--- a/lib/lldp/lldp.c
+++ b/lib/lldp/lldp.c
@@ -244,8 +244,8 @@ lldp_send(struct lldpd *global OVS_UNUSED,
         /* Element type should be first 4 most significant bits, so bitwise OR
          * that with the first 4 bits of the 12-bit-wide mgmt_vlan
          */
-        aa_element_first_byte = ((port->p_element.type & 0xF) << 4) |
-            ((port->p_element.mgmt_vlan >> 8) & 0xF);
+        aa_element_first_byte = (((port->p_element.type & 0xF) << 4) |
+                                 ((port->p_element.mgmt_vlan >> 8) & 0xF));
 
         /* Second byte should just be the remaining 8 bits of .mgmt_vlan */
         aa_element_second_byte = port->p_element.mgmt_vlan & 0x0FF;
diff --git a/lib/lldp/lldpd-structs.h b/lib/lldp/lldpd-structs.h
index f38969b..ef7af74 100644
--- a/lib/lldp/lldpd-structs.h
+++ b/lib/lldp/lldpd-structs.h
@@ -155,13 +155,13 @@ struct lldpd_frame {
 struct lldpd_hardware;
 struct lldpd;
 struct lldpd_ops {
-    int(*send)(struct lldpd *,
-               struct lldpd_hardware*,
-               char *, size_t); /* Function to send a frame */
-    int(*recv)(struct lldpd *,
-               struct lldpd_hardware*,
-               int, char *, size_t); /* Function to receive a frame */
-    int(*cleanup)(struct lldpd *, struct lldpd_hardware *); /* Cleanup */
+    int (*send)(struct lldpd *,
+                struct lldpd_hardware *,
+                char *, size_t); /* Function to send a frame */
+    int (*recv)(struct lldpd *,
+                struct lldpd_hardware *,
+                int, char *, size_t); /* Function to receive a frame */
+    int (*cleanup)(struct lldpd *, struct lldpd_hardware *); /* Cleanup */
 };
 
 /* An interface is uniquely identified by h_ifindex, h_ifname and h_ops. This
diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c
index 68e8c24..aa52cd9 100644
--- a/lib/ovs-lldp.c
+++ b/lib/ovs-lldp.c
@@ -218,14 +218,10 @@ aa_print_element_status_port(struct ds *ds, struct lldpd_hardware *hw)
             chassisid_to_string((uint8_t *) &port->p_element.system_id,
                 sizeof port->p_element.system_id, &system);
 
-            ds_put_format(ds,
-                          "\tAuto Attach Primary Server Id: %s\n",
-                          id);
-            ds_put_format(ds,
-                          "\tAuto Attach Primary Server Descr: %s\n",
+            ds_put_format(ds, "\tAuto Attach Primary Server Id: %s\n", id);
+            ds_put_format(ds, "\tAuto Attach Primary Server Descr: %s\n",
                           descr);
-            ds_put_format(ds,
-                          "\tAuto Attach Primary Server System Id: %s\n",
+            ds_put_format(ds, "\tAuto Attach Primary Server System Id: %s\n",
                           system);
 
             free(id);
@@ -405,15 +401,13 @@ update_mapping_on_lldp(struct lldp *lldp, struct lldpd_hardware *hardware,
     /* TODO Should be done in the Auto Attach state machine when a mapping goes
      * from "pending" to "active".
      */
-    {
-        struct bridge_aa_vlan *node = xmalloc(sizeof *node);
+    struct bridge_aa_vlan *node = xmalloc(sizeof *node);
 
-        node->port_name = xstrdup(hardware->h_ifname);
-        node->vlan = m->vlan;
-        node->oper = BRIDGE_AA_VLAN_OPER_ADD;
+    node->port_name = xstrdup(hardware->h_ifname);
+    node->vlan = m->vlan;
+    node->oper = BRIDGE_AA_VLAN_OPER_ADD;
 
-        list_push_back(&lldp->active_mapping_queue, &node->list_node);
-    }
+    list_push_back(&lldp->active_mapping_queue, &node->list_node);
 }
 
 /* Bridge will poll the list of VLAN that needs to be auto configure based on
@@ -587,15 +581,13 @@ aa_mapping_unregister_mapping(struct lldp *lldp,
             /* TODO Should be done in the AA SM when a mapping goes
              * from "pending" to "active".
              */
-            {
-                struct bridge_aa_vlan *node = xmalloc(sizeof *node);
+            struct bridge_aa_vlan *node = xmalloc(sizeof *node);
 
-                node->port_name = xstrdup(hw->h_ifname);
-                node->vlan = (uint32_t) m->vlan;
-                node->oper = BRIDGE_AA_VLAN_OPER_REMOVE;
+            node->port_name = xstrdup(hw->h_ifname);
+            node->vlan = m->vlan;
+            node->oper = BRIDGE_AA_VLAN_OPER_REMOVE;
 
-                list_push_back(&lldp->active_mapping_queue, &node->list_node);
-            }
+            list_push_back(&lldp->active_mapping_queue, &node->list_node);
 
             break;
         }
-- 
2.1.3




More information about the dev mailing list