samples: bpf: Update outdated error message
authorDaniel T. Lee <danieltimlee@gmail.com>
Thu, 7 Nov 2019 00:51:52 +0000 (09:51 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 9 Nov 2019 03:19:43 +0000 (19:19 -0800)
Currently, under samples, several methods are being used to load bpf
program.

Since using libbpf is preferred solution, lots of previously used
'load_bpf_file' from bpf_load are replaced with 'bpf_prog_load_xattr'
from libbpf.

But some of the error messages still show up as 'load_bpf_file' instead
of 'bpf_prog_load_xattr'.

This commit fixes outdated errror messages under samples and fixes some
code style issues.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20191107005153.31541-2-danieltimlee@gmail.com
samples/bpf/hbm.c
samples/bpf/xdp1_user.c
samples/bpf/xdp_rxq_info_user.c
samples/bpf/xdp_sample_pkts_user.c
samples/bpf/xdp_tx_iptunnel_user.c

index e0fbab9bec83e14347d0330f8f7bad1b14db1b33..829b68d8768770b053e2695d9dd4c4a9a27c9001 100644 (file)
@@ -147,7 +147,7 @@ static int prog_load(char *prog)
        }
 
        if (ret) {
-               printf("ERROR: load_bpf_file failed for: %s\n", prog);
+               printf("ERROR: bpf_prog_load_xattr failed for: %s\n", prog);
                printf("  Output from verifier:\n%s\n------\n", bpf_log_buf);
                ret = -1;
        } else {
index a8e5fa02e8a8c505cf624e0ec5dbfe13878aacfd..3e553eed95a77aadbd588c9372b0bb4e4e315d65 100644 (file)
@@ -139,7 +139,7 @@ int main(int argc, char **argv)
        map_fd = bpf_map__fd(map);
 
        if (!prog_fd) {
-               printf("load_bpf_file: %s\n", strerror(errno));
+               printf("bpf_prog_load_xattr: %s\n", strerror(errno));
                return 1;
        }
 
index c7e4e45d824a473d56c65c4fa8f776eb180b5cb7..51e0d810e0709b2d8800b7629b78a474f1b3a438 100644 (file)
@@ -51,8 +51,8 @@ static const struct option long_options[] = {
        {"sec",         required_argument,      NULL, 's' },
        {"no-separators", no_argument,          NULL, 'z' },
        {"action",      required_argument,      NULL, 'a' },
-       {"readmem",     no_argument,            NULL, 'r' },
-       {"swapmac",     no_argument,            NULL, 'm' },
+       {"readmem",     no_argument,            NULL, 'r' },
+       {"swapmac",     no_argument,            NULL, 'm' },
        {"force",       no_argument,            NULL, 'F' },
        {0, 0, NULL,  0 }
 };
@@ -499,7 +499,7 @@ int main(int argc, char **argv)
        map_fd = bpf_map__fd(map);
 
        if (!prog_fd) {
-               fprintf(stderr, "ERR: load_bpf_file: %s\n", strerror(errno));
+               fprintf(stderr, "ERR: bpf_prog_load_xattr: %s\n", strerror(errno));
                return EXIT_FAIL;
        }
 
index 3002714e3cd55db69668d33d292ba252fb20b5af..a5760e8bf2c44aa4869c4d01b2adce6c341fa166 100644 (file)
@@ -150,7 +150,7 @@ int main(int argc, char **argv)
                return 1;
 
        if (!prog_fd) {
-               printf("load_bpf_file: %s\n", strerror(errno));
+               printf("bpf_prog_load_xattr: %s\n", strerror(errno));
                return 1;
        }
 
index dfb68582e24390a7c0587ae1828a50e5d9a7d7be..2fe4c7f5ffe5e80b0e548f3051412683811af6ea 100644 (file)
@@ -268,7 +268,7 @@ int main(int argc, char **argv)
                return 1;
 
        if (!prog_fd) {
-               printf("load_bpf_file: %s\n", strerror(errno));
+               printf("bpf_prog_load_xattr: %s\n", strerror(errno));
                return 1;
        }