From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: netdev@vger.kernel.org, alexei.starovoitov@gmail.com,
daniel@iogearbox.net
Cc: oss-drivers@netronome.com, guro@fb.com,
Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH bpf-next 3/3] tools: bpftool: remove new lines from errors
Date: Tue, 2 Jan 2018 14:48:37 -0800 [thread overview]
Message-ID: <20180102224837.13736-4-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180102224837.13736-1-jakub.kicinski@netronome.com>
It's a little bit unusual for kernel style, but we add the new line
character to error strings inside the p_err() function. We do this
because new lines at the end of error strings will break JSON output.
Fix a few p_err("..\n") which snuck in recently.
Fixes: 5ccda64d38cc ("bpftool: implement cgroup bpf operations")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
tools/bpf/bpftool/cgroup.c | 18 +++++++++---------
tools/bpf/bpftool/prog.c | 4 ++--
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c
index 35f5f003df28..cae32a61cb18 100644
--- a/tools/bpf/bpftool/cgroup.c
+++ b/tools/bpf/bpftool/cgroup.c
@@ -124,16 +124,16 @@ static int do_show(int argc, char **argv)
int ret = -1;
if (argc < 1) {
- p_err("too few parameters for cgroup show\n");
+ p_err("too few parameters for cgroup show");
goto exit;
} else if (argc > 1) {
- p_err("too many parameters for cgroup show\n");
+ p_err("too many parameters for cgroup show");
goto exit;
}
cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) {
- p_err("can't open cgroup %s\n", argv[1]);
+ p_err("can't open cgroup %s", argv[1]);
goto exit;
}
@@ -171,19 +171,19 @@ static int do_attach(int argc, char **argv)
int i;
if (argc < 4) {
- p_err("too few parameters for cgroup attach\n");
+ p_err("too few parameters for cgroup attach");
goto exit;
}
cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) {
- p_err("can't open cgroup %s\n", argv[1]);
+ p_err("can't open cgroup %s", argv[1]);
goto exit;
}
attach_type = parse_attach_type(argv[1]);
if (attach_type == __MAX_BPF_ATTACH_TYPE) {
- p_err("invalid attach type\n");
+ p_err("invalid attach type");
goto exit_cgroup;
}
@@ -199,7 +199,7 @@ static int do_attach(int argc, char **argv)
} else if (is_prefix(argv[i], "override")) {
attach_flags |= BPF_F_ALLOW_OVERRIDE;
} else {
- p_err("unknown option: %s\n", argv[i]);
+ p_err("unknown option: %s", argv[i]);
goto exit_cgroup;
}
}
@@ -229,13 +229,13 @@ static int do_detach(int argc, char **argv)
int ret = -1;
if (argc < 4) {
- p_err("too few parameters for cgroup detach\n");
+ p_err("too few parameters for cgroup detach");
goto exit;
}
cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) {
- p_err("can't open cgroup %s\n", argv[1]);
+ p_err("can't open cgroup %s", argv[1]);
goto exit;
}
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 5577960bffe4..c6a28be4665c 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -813,12 +813,12 @@ static int do_load(int argc, char **argv)
usage();
if (bpf_prog_load(argv[0], BPF_PROG_TYPE_UNSPEC, &obj, &prog_fd)) {
- p_err("failed to load program\n");
+ p_err("failed to load program");
return -1;
}
if (do_pin_fd(prog_fd, argv[1])) {
- p_err("failed to pin program\n");
+ p_err("failed to pin program");
return -1;
}
--
2.15.1
next prev parent reply other threads:[~2018-01-02 22:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 22:48 [PATCH bpf-next 0/3] tools: bpftool: alias "show" and "list" and fix errors in JSON Jakub Kicinski
2018-01-02 22:48 ` [PATCH bpf-next 1/3] tools: bpftool: rename cgroup list -> show in the code Jakub Kicinski
2018-01-02 22:48 ` [PATCH bpf-next 2/3] tools: bpftool: alias show and list commands Jakub Kicinski
2018-01-02 22:48 ` Jakub Kicinski [this message]
2018-01-04 11:31 ` [PATCH bpf-next 0/3] tools: bpftool: alias "show" and "list" and fix errors in JSON Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180102224837.13736-4-jakub.kicinski@netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=guro@fb.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox