devlink: Left justification on FMSG output

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: 844a61764c ("devlink: Add helper functions for name and value separately")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Aya Levin 2019-10-02 17:35:15 +03:00 committed by Stephen Hemminger
parent 56b725a442
commit 7dd3d51b91
1 changed files with 10 additions and 5 deletions

View File

@ -1872,6 +1872,7 @@ 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
@ -1880,6 +1881,7 @@ static void pr_out_bool_value(struct dl *dl, bool value)
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
@ -1888,6 +1890,7 @@ static void pr_out_uint_value(struct dl *dl, unsigned int 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
@ -1918,6 +1921,7 @@ 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
@ -1926,6 +1930,7 @@ static void pr_out_str_value(struct dl *dl, const char *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