diff mbox series

[ovs-dev,06/13] rstp, stp: Remove tabs from output.

Message ID 20180604212750.14643-6-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev,01/13] bfd: Remove leading tabs from output. | expand

Commit Message

Ben Pfaff June 4, 2018, 9:27 p.m. UTC
OVS uses spaces for indentation in source code and it makes sense for it to
also use spaces for indentation in output.  Spaces also consume less
horizontal space in output, which often makes it easier to read.  This
commit transitions one part of output from tabs to spaces and updates
appropriate parts of the tests to match.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/rstp.c   | 22 +++++++++++-----------
 lib/stp.c    | 23 ++++++++++++-----------
 tests/stp.at | 14 +++++++-------
 3 files changed, 30 insertions(+), 29 deletions(-)
diff mbox series

Patch

diff --git a/lib/rstp.c b/lib/rstp.c
index 7a61b24d7b36..7e351bf32ff8 100644
--- a/lib/rstp.c
+++ b/lib/rstp.c
@@ -1583,15 +1583,15 @@  rstp_bridge_id_details(struct ds *ds, const rstp_identifier bridge_id,
     OVS_REQUIRES(rstp_mutex)
 {
     uint16_t priority = bridge_id >> 48;
-    ds_put_format(ds, "\tstp-priority\t%"PRIu16"\n", priority);
+    ds_put_format(ds, "  stp-priority    %"PRIu16"\n", priority);
 
     struct eth_addr mac;
     const uint64_t mac_bits = (UINT64_C(1) << 48) - 1;
     eth_addr_from_uint64(bridge_id & mac_bits, &mac);
-    ds_put_format(ds, "\tstp-system-id\t"ETH_ADDR_FMT"\n", ETH_ADDR_ARGS(mac));
-    ds_put_format(ds, "\tstp-hello-time\t%"PRIu16"s\n", hello_time);
-    ds_put_format(ds, "\tstp-max-age\t%"PRIu16"s\n", max_age);
-    ds_put_format(ds, "\tstp-fwd-delay\t%"PRIu16"s\n", forward_delay);
+    ds_put_format(ds, "  stp-system-id   "ETH_ADDR_FMT"\n", ETH_ADDR_ARGS(mac));
+    ds_put_format(ds, "  stp-hello-time  %"PRIu16"s\n", hello_time);
+    ds_put_format(ds, "  stp-max-age     %"PRIu16"s\n", max_age);
+    ds_put_format(ds, "  stp-fwd-delay   %"PRIu16"s\n", forward_delay);
 }
 
 static void
@@ -1606,7 +1606,7 @@  rstp_print_details(struct ds *ds, const struct rstp *rstp)
                                rstp->bridge_hello_time,
                                rstp->bridge_max_age,
                                rstp->bridge_forward_delay);
-        ds_put_cstr(ds, "\tThis bridge is the root\n");
+        ds_put_cstr(ds, "  This bridge is the root\n");
     } else {
         struct rstp_port *root_port = rstp_get_root_port__(rstp);
         if (!root_port) {
@@ -1618,8 +1618,8 @@  rstp_print_details(struct ds *ds, const struct rstp *rstp)
                                root_port->designated_times.hello_time,
                                root_port->designated_times.max_age,
                                root_port->designated_times.forward_delay);
-        ds_put_format(ds, "\troot-port\t%s\n", root_port->port_name);
-        ds_put_format(ds, "\troot-path-cost\t%u\n",
+        ds_put_format(ds, "  root-port       %s\n", root_port->port_name);
+        ds_put_format(ds, "  root-path-cost  %u\n",
                       rstp_get_root_path_cost__(rstp));
     }
     ds_put_cstr(ds, "\n");
@@ -1631,14 +1631,14 @@  rstp_print_details(struct ds *ds, const struct rstp *rstp)
                            rstp->bridge_forward_delay);
     ds_put_cstr(ds, "\n");
 
-    ds_put_format(ds, "\t%-11.10s%-11.10s%-11.10s%-9.8s%-8.7s\n",
+    ds_put_format(ds, "  %-11.10s%-11.10s%-11.10s%-9.8s%-8.7s\n",
                   "Interface", "Role", "State", "Cost", "Pri.Nbr");
-    ds_put_cstr(ds, "\t---------- ---------- ---------- -------- -------\n");
+    ds_put_cstr(ds, "  ---------- ---------- ---------- -------- -------\n");
 
     struct rstp_port *p;
     HMAP_FOR_EACH (p, node, &rstp->ports) {
         if (p->rstp_state != RSTP_DISABLED) {
-            ds_put_format(ds, "\t%-11.10s",
+            ds_put_format(ds, "  %-11.10s",
                           p->port_name ? p->port_name : "null");
             ds_put_format(ds, "%-11.10s", rstp_port_role_name(p->role));
             ds_put_format(ds, "%-11.10s", rstp_state_name(p->rstp_state));
diff --git a/lib/stp.c b/lib/stp.c
index 9910d593771b..809b405a5298 100644
--- a/lib/stp.c
+++ b/lib/stp.c
@@ -1644,16 +1644,17 @@  stp_bridge_id_details(struct ds *ds, const stp_identifier bridge_id,
     OVS_REQUIRES(mutex)
 {
     uint16_t priority = bridge_id >> 48;
-    ds_put_format(ds, "\tstp-priority\t%"PRIu16"\n", priority);
+    ds_put_format(ds, "  stp-priority  %"PRIu16"\n", priority);
 
     struct eth_addr mac;
     const uint64_t mac_bits = (UINT64_C(1) << 48) - 1;
     eth_addr_from_uint64(bridge_id & mac_bits, &mac);
-    ds_put_format(ds, "\tstp-system-id\t"ETH_ADDR_FMT"\n", ETH_ADDR_ARGS(mac));
-    ds_put_format(ds, "\tstp-hello-time\t%ds\n",
+    ds_put_format(ds, "  stp-system-id   "ETH_ADDR_FMT"\n",
+                  ETH_ADDR_ARGS(mac));
+    ds_put_format(ds, "  stp-hello-time  %ds\n",
                   timer_to_ms(hello_time) / 1000);
-    ds_put_format(ds, "\tstp-max-age\t%ds\n", timer_to_ms(max_age) / 1000);
-    ds_put_format(ds, "\tstp-fwd-delay\t%ds\n",
+    ds_put_format(ds, "  stp-max-age     %ds\n", timer_to_ms(max_age) / 1000);
+    ds_put_format(ds, "  stp-fwd-delay   %ds\n",
                   timer_to_ms(forward_delay) / 1000);
 }
 
@@ -1670,10 +1671,10 @@  stp_print_details(struct ds *ds, const struct stp *stp)
                           stp->bridge_max_age, stp->bridge_forward_delay);
 
     if (stp_is_root_bridge(stp)) {
-        ds_put_cstr(ds, "\tThis bridge is the root\n");
+        ds_put_cstr(ds, "  This bridge is the root\n");
     } else {
-        ds_put_format(ds, "\troot-port\t%s\n", stp->root_port->port_name);
-        ds_put_format(ds, "\troot-path-cost\t%u\n", stp->root_path_cost);
+        ds_put_format(ds, "  root-port       %s\n", stp->root_port->port_name);
+        ds_put_format(ds, "  root-path-cost  %u\n", stp->root_path_cost);
     }
 
     ds_put_cstr(ds, "\n");
@@ -1685,11 +1686,11 @@  stp_print_details(struct ds *ds, const struct stp *stp)
     ds_put_cstr(ds, "\n");
 
     const struct stp_port *p;
-    ds_put_format(ds, "\t%-11.10s%-11.10s%-11.10s%-6.5s%-8.7s\n",
+    ds_put_format(ds, "  %-11.10s%-11.10s%-11.10s%-6.5s%-8.7s\n",
                   "Interface", "Role", "State", "Cost", "Pri.Nbr");
-    ds_put_cstr(ds, "\t---------- ---------- ---------- ----- -------\n");
+    ds_put_cstr(ds, "  ---------- ---------- ---------- ----- -------\n");
     FOR_EACH_ENABLED_PORT (p, stp) {
-        ds_put_format(ds, "\t%-11.10s", p->port_name);
+        ds_put_format(ds, "  %-11.10s", p->port_name);
         ds_put_format(ds, "%-11.10s", stp_role_name(stp_port_get_role(p)));
         ds_put_format(ds, "%-11.10s", stp_state_name(p->state));
         ds_put_format(ds, "%-6d", p->path_cost);
diff --git a/tests/stp.at b/tests/stp.at
index 9550f72b56a8..3d85acdb9f3f 100644
--- a/tests/stp.at
+++ b/tests/stp.at
@@ -617,10 +617,10 @@  ovs-appctl time/stop
 ovs-appctl time/warp 31000 1000
 
 AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl
-	p1         designated forwarding 19    128.1
+  p1         designated forwarding 19    128.1
 ])
 AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl
-	p2         designated forwarding 19    128.2
+  p2         designated forwarding 19    128.2
 ])
 
 # add a stp port
@@ -634,10 +634,10 @@  ovs-appctl netdev-dummy/set-admin-state p3 down
 
 # We should not show the p3 because its link-state is down
 AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl
-	p1         designated forwarding 19    128.1
+  p1         designated forwarding 19    128.1
 ])
 AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl
-	p2         designated forwarding 19    128.2
+  p2         designated forwarding 19    128.2
 ])
 AT_CHECK([ovs-appctl stp/show br0 | grep p3], [1], [dnl
 ])
@@ -645,13 +645,13 @@  AT_CHECK([ovs-appctl stp/show br0 | grep p3], [1], [dnl
 ovs-appctl netdev-dummy/set-admin-state p3 up
 
 AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl
-	p1         designated forwarding 19    128.1
+  p1         designated forwarding 19    128.1
 ])
 AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl
-	p2         designated forwarding 19    128.2
+  p2         designated forwarding 19    128.2
 ])
 AT_CHECK([ovs-appctl stp/show br0 | grep p3], [0], [dnl
-	p3         designated listening  19    128.3
+  p3         designated listening  19    128.3
 ])