Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp843102img; Wed, 20 Mar 2019 12:03:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxauI7MBBfy+2gSW7hTyMUPnNK8vVChSqtytk/q5MCmSVskY3lTGJ3iXQkp2NRUe8mEvzuf X-Received: by 2002:a17:902:2aca:: with SMTP id j68mr10067543plb.233.1553108630942; Wed, 20 Mar 2019 12:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553108630; cv=none; d=google.com; s=arc-20160816; b=sg+1AChgC1iDW5CQZhsfFOfKXZ9zb2iAXzHIcVM0vQqE2PvI9KSkU3rAYVKWK227O5 ApZlcaYmTP1KLxvkkxoLWzbuWWIy94uMpeKbHOUKFyu7nrWI8K4QwtTfSN+ZKGWAAOKN U1i6KchaPSXtdC/4OXE3K4QcI9CgH16GQ85LUQOTlIe5PbyPMxncqqJuyiYG1pr+1qiB fNUfe4lTgk287eNRdE1GK5pxL2HZ7iHFUgW1agxHEef/+kkAOVfpPeoxOgQQ+Xq82xPa Cpw8GxgNdLwan/x4ZXRDGIlGHwIG+nJkMjsvO2fYkMhwJXpt2+esYhVFXCG/JVcsdjG8 4/tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:openpgp:from:references:cc:to :dkim-signature; bh=wVGsqlkZB91ZoiTOMbrVQxSPZ7tcim55VvEIcIELchs=; b=amsBcen+qlzGYgDvaYVsYEoHTlSjSskucB57tWPwdT8JRmdsuJ3ic1MeGBL9I/Uye6 CllpC6JbFTVPwXw6oy4XSWQ7Q71KwnpUbNzLEB8cp4T4wu2tVlw51n5Xq9iQ7MFlXGYd iChoCFEZCuwQAsGHKlug3ZhygZVyK4Bvbk0zjzPbGZQI+AVRXL5GqTjLMqabUU7IWHFL A3159CiqL9y0bMNwHO+Uu99GV+yPEsmuCM1sYcTHjmKgxdMckIcRXxZzz0CO1LV/Io9k n5I+KtF50424C+wYgkeDBJZd/tcAfj6F4CkclAn0GJLyDDcEWiL0XofHSuIBqNH1KXab eM/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=SPo7clQl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si2227827pgs.450.2019.03.20.12.03.26; Wed, 20 Mar 2019 12:03:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=SPo7clQl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727620AbfCTTBb (ORCPT + 99 others); Wed, 20 Mar 2019 15:01:31 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44265 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbfCTTBb (ORCPT ); Wed, 20 Mar 2019 15:01:31 -0400 Received: by mail-wr1-f67.google.com with SMTP id w2so3963012wrt.11 for ; Wed, 20 Mar 2019 12:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=to:cc:references:from:openpgp:autocrypt:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wVGsqlkZB91ZoiTOMbrVQxSPZ7tcim55VvEIcIELchs=; b=SPo7clQlFFl17PDQJkyJ4lOBZtxTW1Lbr31QaVs6dTVK1CBb3Sq58W1pUrbvdqPwax /szAL2LTTEN5O5/nH8rJlZqLfXou8qQRQfTu03Y6Rs72mdtQt9hod/NG9bosfPiaXJaV N8FmyguAHTRkaHUS1PgQTNuMD3XoE6HrfRqMAE5IJLAKwOdP/NQMwUh6R2rm3qnNRUlu h3f4YzTk+Dqz/mAAyXf/m9k+k7PO0iJPQEEcSejIGyMTZ7zzJcnPikNSE9OJ8Il+A6Pv XgwRg/Jp5JLBBy+hHx/wOU02I7bv2fgkJsS41I5AcbUuX3Jqc9E5lQr5n8k47erowCSj PmwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:openpgp:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wVGsqlkZB91ZoiTOMbrVQxSPZ7tcim55VvEIcIELchs=; b=lDvKGhULOLVCg9RAUjqpkcTQUMXzImuQclf5D2Pxo+hbNCArf2XIQtLm2HL1RHpy/L SKkmcYuZwkqwFsVsQLv12G83PtlNGulcP37eFnOlSV4UrKsg9qCblPXcUMDm2bsuJ1up 2UuewfeYn28MurT4FQHW616+RKvcvHf6qAKgAFYsumkyUQ3GoAFHH3iJR8NJLKPLSU/Z C5l38j7hn9HIl5zdj6t5/ZFOyS2piHe9YtGAtoARzeohzRFzd+kCxWiGLHWrzhAbBmyA ckdYieLgQbyOPzk04TiKKswVEPINUSDBy5LREdEDhCQSYQ20zH/DOi2ce0dwf0psyG1K xKUA== X-Gm-Message-State: APjAAAWUvGyxUw9ahbOzudAxpUpRcjtUP03MrTl+tTV5PodWIhbP2EKH 7sMrXB7mT/E+UJotkrB+e1Q/Y/6q568= X-Received: by 2002:adf:f30a:: with SMTP id i10mr14949958wro.111.1553108489531; Wed, 20 Mar 2019 12:01:29 -0700 (PDT) Received: from [172.20.1.106] ([217.38.71.146]) by smtp.gmail.com with ESMTPSA id j13sm3606118wrx.74.2019.03.20.12.01.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 12:01:28 -0700 (PDT) To: Alban Crequy , ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alban@kinvolk.io, iago@kinvolk.io References: <20190320173332.18105-1-alban@kinvolk.io> <20190320173332.18105-7-alban@kinvolk.io> From: Quentin Monnet Openpgp: preference=signencrypt Autocrypt: addr=quentin.monnet@netronome.com; prefer-encrypt=mutual; keydata= mQINBFnqRlsBEADfkCdH/bkkfjbglpUeGssNbYr/TD4aopXiDZ0dL2EwafFImsGOWmCIIva2 MofTQHQ0tFbwY3Ir74exzU9X0aUqrtHirQHLkKeMwExgDxJYysYsZGfM5WfW7j8X4aVwYtfs AVRXxAOy6/bw1Mccq8ZMTYKhdCgS3BfC7qK+VYC4bhM2AOWxSQWlH5WKQaRbqGOVLyq8Jlxk 2FGLThUsPRlXKz4nl+GabKCX6x3rioSuNoHoWdoPDKsRgYGbP9LKRRQy3ZeJha4x+apy8rAM jcGHppIrciyfH38+LdV1FVi6sCx8sRKX++ypQc3fa6O7d7mKLr6uy16xS9U7zauLu1FYLy2U N/F1c4F+bOlPMndxEzNc/XqMOM9JZu1XLluqbi2C6JWGy0IYfoyirddKpwzEtKIwiDBI08JJ Cv4jtTWKeX8pjTmstay0yWbe0sTINPh+iDw+ybMwgXhr4A/jZ1wcKmPCFOpb7U3JYC+ysD6m 6+O/eOs21wVag/LnnMuOKHZa2oNsi6Zl0Cs6C7Vve87jtj+3xgeZ8NLvYyWrQhIHRu1tUeuf T8qdexDphTguMGJbA8iOrncHXjpxWhMWykIyN4TYrNwnyhqP9UgqRPLwJt5qB1FVfjfAlaPV sfsxuOEwvuIt19B/3pAP0nbevNymR3QpMPRl4m3zXCy+KPaSSQARAQABtC1RdWVudGluIE1v bm5ldCA8cXVlbnRpbi5tb25uZ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+tWD8x53SEOSn94g2AyJA9Txh2xBhWGuZ9CpBuXjtPrnRSd8xdrw36AL53goTt/NiLHUd RHhSHGnKaQ6MfrTge5Q0h5A= Subject: Re: [PATCH bpf-next v1 7/7] tools: bpftool: add error message on map pinning failure Message-ID: Date: Wed, 20 Mar 2019 19:01:28 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <20190320173332.18105-7-alban@kinvolk.io> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2019-03-20 18:33 UTC+0100 ~ Alban Crequy > From: Alban Crequy > > Symptoms, when "dir" does not exist: > > $ sudo bpftool map create /sys/fs/bpf/dir/fooB type hash key 8 value 8 entries 8 name fooB flags 1 > $ echo $? > 255 > > This patch prints an error message when the map pinning fails. > > Signed-off-by: Alban Crequy > --- > tools/bpf/bpftool/map.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c > index 9befcabc299d..c825eb1bbf8f 100644 > --- a/tools/bpf/bpftool/map.c > +++ b/tools/bpf/bpftool/map.c > @@ -1305,8 +1305,10 @@ static int do_create(int argc, char **argv) > > err = do_pin_fd(fd, pinfile); > close(fd); > - if (err) > + if (err) { > + p_err("failed to pin map to %s", pinfile); > return err; > + } do_pin_fd() is already susceptible to print an error message, and this may lead to several messages (thus breaking JSON output). Instead, you could change do_pin_fd() to store the result from bpf_obj_pin(), compare it, and print the message there if non-0. > > if (json_output) > jsonw_null(json_wtr); >