From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0EF5C352AA for ; Wed, 2 Oct 2019 14:35:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B63F21783 for ; Wed, 2 Oct 2019 14:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728176AbfJBOf6 (ORCPT ); Wed, 2 Oct 2019 10:35:58 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:38626 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728114AbfJBOf5 (ORCPT ); Wed, 2 Oct 2019 10:35:57 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from tariqt@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Oct 2019 17:35:54 +0300 Received: from dev-l-vrt-207-011.mtl.labs.mlnx. (dev-l-vrt-207-011.mtl.labs.mlnx [10.134.207.11]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x92EZsEb000653; Wed, 2 Oct 2019 17:35:54 +0300 From: Tariq Toukan To: Stephen Hemminger , David Ahern Cc: netdev@vger.kernel.org, Moshe Shemesh , Aya Levin , Jiri Pirko , Tariq Toukan Subject: [PATCH V2 iproute2 2/3] devlink: Left justification on FMSG output Date: Wed, 2 Oct 2019 17:35:15 +0300 Message-Id: <1570026916-27592-3-git-send-email-tariqt@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1570026916-27592-1-git-send-email-tariqt@mellanox.com> References: <1570026916-27592-1-git-send-email-tariqt@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Aya Levin FMSG output is dynamic, space separator must be on the left hand side of the value. Otherwise output has redundant left indentation regardless the hierarchy. Before the patch: Common config: SQ: stride size: 64 size: 1024 CQ: stride size: 64 size: 1024 SQs: channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0 channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0 channel ix: 2 tc: 0 txq ix: 2 sqn: 18 HW state: 1 stopped: false cc: 5 pc: 5 CQ: cqn: 14 HW status: 0 channel ix: 3 tc: 0 txq ix: 3 sqn: 22 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 18 HW status: 0 With the patch: Common config: SQ: stride size: 64 size: 1024 CQ: stride size: 64 size: 1024 SQs: channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0 channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0 channel ix: 2 tc: 0 txq ix: 2 sqn: 18 HW state: 1 stopped: false cc: 5 pc: 5 CQ: cqn: 14 HW status: 0 channel ix: 3 tc: 0 txq ix: 3 sqn: 22 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 18 HW status: 0 Fixes: 844a61764c6f ("devlink: Add helper functions for name and value separately") Signed-off-by: Aya Levin Acked-by: Jiri Pirko Signed-off-by: Tariq Toukan --- devlink/devlink.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index d654dc7bc637..50baf82af937 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -1872,26 +1872,29 @@ static void pr_out_u64(struct dl *dl, const char *name, uint64_t val) static void pr_out_bool_value(struct dl *dl, bool value) { + __pr_out_indent_newline(dl); if (dl->json_output) jsonw_bool(dl->jw, value); else - pr_out(" %s", value ? "true" : "false"); + pr_out("%s", value ? "true" : "false"); } static void pr_out_uint_value(struct dl *dl, unsigned int value) { + __pr_out_indent_newline(dl); if (dl->json_output) jsonw_uint(dl->jw, value); else - pr_out(" %u", value); + pr_out("%u", value); } static void pr_out_uint64_value(struct dl *dl, uint64_t value) { + __pr_out_indent_newline(dl); if (dl->json_output) jsonw_u64(dl->jw, value); else - pr_out(" %"PRIu64, value); + pr_out("%"PRIu64, value); } static bool is_binary_eol(int i) @@ -1918,18 +1921,20 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len) static void pr_out_str_value(struct dl *dl, const char *value) { + __pr_out_indent_newline(dl); if (dl->json_output) jsonw_string(dl->jw, value); else - pr_out(" %s", value); + pr_out("%s", value); } static void pr_out_name(struct dl *dl, const char *name) { + __pr_out_indent_newline(dl); if (dl->json_output) jsonw_name(dl->jw, name); else - pr_out(" %s:", name); + pr_out("%s:", name); } static void pr_out_region_chunk_start(struct dl *dl, uint64_t addr) -- 2.21.0