From patchwork Thu Feb 21 13:42:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aya Levin X-Patchwork-Id: 1046181 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 444wf62VBKz9s6w for ; Fri, 22 Feb 2019 00:43:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbfBUNnI (ORCPT ); Thu, 21 Feb 2019 08:43:08 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:43864 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728149AbfBUNnF (ORCPT ); Thu, 21 Feb 2019 08:43:05 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ayal@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Feb 2019 15:42:59 +0200 Received: from dev-l-vrt-210.mtl.labs.mlnx (dev-l-vrt-210.mtl.labs.mlnx [10.134.210.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x1LDgxkB013963; Thu, 21 Feb 2019 15:42:59 +0200 Received: from dev-l-vrt-210.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Debian-8ubuntu1) with ESMTP id x1LDgxV9018294; Thu, 21 Feb 2019 15:42:59 +0200 Received: (from ayal@localhost) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id x1LDgwZn018293; Thu, 21 Feb 2019 15:42:58 +0200 From: Aya Levin To: David Ahern Cc: netdev@vger.kernel.org, Jiri Pirko , Moshe Shemesh , Eran Ben Elisha , Aya Levin Subject: [PATCH v2 iproute2-next 03/11] devlink: Fix boolean JSON print Date: Thu, 21 Feb 2019 15:42:39 +0200 Message-Id: <1550756567-18227-4-git-send-email-ayal@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1550756567-18227-1-git-send-email-ayal@mellanox.com> References: <1550756567-18227-1-git-send-email-ayal@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch removes the inverted commas from boolean values in JSON format: true/false instead of "true"/"false". Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Acked-by: Jiri Pirko --- devlink/devlink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 2c921f3811fc..b073ae020d52 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -1603,10 +1603,10 @@ static void pr_out_str(struct dl *dl, const char *name, const char *val) static void pr_out_bool(struct dl *dl, const char *name, bool val) { - if (val) - pr_out_str(dl, name, "true"); + if (dl->json_output) + jsonw_bool_field(dl->jw, name, val); else - pr_out_str(dl, name, "false"); + pr_out_str(dl, name, val ? "true" : "false"); } static void pr_out_uint(struct dl *dl, const char *name, unsigned int val)