From patchwork Mon Jun 4 21:27:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 925239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4107QD5z5Tz9s08 for ; Tue, 5 Jun 2018 07:30:28 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 65F461181; Mon, 4 Jun 2018 21:28:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A9145115B for ; Mon, 4 Jun 2018 21:28:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9A048713 for ; Mon, 4 Jun 2018 21:28:04 +0000 (UTC) X-Originating-IP: 208.91.3.26 Received: from sigabrt.benpfaff.org (unknown [208.91.3.26]) (Authenticated sender: blp@ovn.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id DBDDD240009; Mon, 4 Jun 2018 23:28:05 +0200 (CEST) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 4 Jun 2018 14:27:43 -0700 Message-Id: <20180604212750.14643-6-blp@ovn.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180604212750.14643-1-blp@ovn.org> References: <20180604212750.14643-1-blp@ovn.org> X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 06/13] rstp, stp: Remove tabs from output. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 --- lib/rstp.c | 22 +++++++++++----------- lib/stp.c | 23 ++++++++++++----------- tests/stp.at | 14 +++++++------- 3 files changed, 30 insertions(+), 29 deletions(-) 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 ])