Skip to content

Commit 470ae8c

Browse files
sahidqmonnet
authored andcommitted
bpftool: remove support of --legacy option for bpftool
Following: commit bd054102a8c7 ("libbpf: enforce strict libbpf 1.0 behaviors") commit 93b8952d223a ("libbpf: deprecate legacy BPF map definitions") The --legacy option is no longer relevant as libbpf no longer supports it. libbpf_set_strict_mode() is a no-op operation. Signed-off-by: Sahid Orentino Ferdjaoui <[email protected]> Acked-by: Yonghong Song <[email protected]> Reviewed-by: Quentin Monnet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 2087e33 commit 470ae8c

File tree

6 files changed

+3
-33
lines changed

6 files changed

+3
-33
lines changed

Diff for: bash-completion/bpftool

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ _bpftool()
261261
# Deal with options
262262
if [[ ${words[cword]} == -* ]]; then
263263
local c='--version --json --pretty --bpffs --mapcompat --debug \
264-
--use-loader --base-btf --legacy'
264+
--use-loader --base-btf'
265265
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
266266
return 0
267267
fi

Diff for: docs/common_options.rst

-9
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,3 @@
2323
Print all logs available, even debug-level information. This includes
2424
logs from libbpf as well as from the verifier, when attempting to
2525
load programs.
26-
27-
-l, --legacy
28-
Use legacy libbpf mode which has more relaxed BPF program
29-
requirements. By default, bpftool has more strict requirements
30-
about section names, changes pinning logic and doesn't support
31-
some of the older non-BTF map declarations.
32-
33-
See https://github.com/libbpf/libbpf/wiki/Libbpf:-the-road-to-v1.0
34-
for details.

Diff for: docs/substitutions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
22
3-
.. |COMMON_OPTIONS| replace:: { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | { **-l** | **--legacy** }
3+
.. |COMMON_OPTIONS| replace:: { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** }

Diff for: src/main.c

-15
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ bool block_mount;
3131
bool verifier_logs;
3232
bool relaxed_maps;
3333
bool use_loader;
34-
bool legacy_libbpf;
3534
struct btf *base_btf;
3635
struct hashmap *refs_table;
3736

@@ -160,7 +159,6 @@ static int do_version(int argc, char **argv)
160159
jsonw_start_object(json_wtr); /* features */
161160
jsonw_bool_field(json_wtr, "libbfd", has_libbfd);
162161
jsonw_bool_field(json_wtr, "llvm", has_llvm);
163-
jsonw_bool_field(json_wtr, "libbpf_strict", !legacy_libbpf);
164162
jsonw_bool_field(json_wtr, "skeletons", has_skeletons);
165163
jsonw_bool_field(json_wtr, "bootstrap", bootstrap);
166164
jsonw_end_object(json_wtr); /* features */
@@ -179,7 +177,6 @@ static int do_version(int argc, char **argv)
179177
printf("features:");
180178
print_feature("libbfd", has_libbfd, &nb_features);
181179
print_feature("llvm", has_llvm, &nb_features);
182-
print_feature("libbpf_strict", !legacy_libbpf, &nb_features);
183180
print_feature("skeletons", has_skeletons, &nb_features);
184181
print_feature("bootstrap", bootstrap, &nb_features);
185182
printf("\n");
@@ -451,7 +448,6 @@ int main(int argc, char **argv)
451448
{ "debug", no_argument, NULL, 'd' },
452449
{ "use-loader", no_argument, NULL, 'L' },
453450
{ "base-btf", required_argument, NULL, 'B' },
454-
{ "legacy", no_argument, NULL, 'l' },
455451
{ 0 }
456452
};
457453
bool version_requested = false;
@@ -524,9 +520,6 @@ int main(int argc, char **argv)
524520
case 'L':
525521
use_loader = true;
526522
break;
527-
case 'l':
528-
legacy_libbpf = true;
529-
break;
530523
default:
531524
p_err("unrecognized option '%s'", argv[optind - 1]);
532525
if (json_output)
@@ -536,14 +529,6 @@ int main(int argc, char **argv)
536529
}
537530
}
538531

539-
if (!legacy_libbpf) {
540-
/* Allow legacy map definitions for skeleton generation.
541-
* It will still be rejected if users use LIBBPF_STRICT_ALL
542-
* mode for loading generated skeleton.
543-
*/
544-
libbpf_set_strict_mode(LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS);
545-
}
546-
547532
argc -= optind;
548533
argv += optind;
549534
if (argc < 0)

Diff for: src/main.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static inline void *u64_to_ptr(__u64 ptr)
5757
#define HELP_SPEC_PROGRAM \
5858
"PROG := { id PROG_ID | pinned FILE | tag PROG_TAG | name PROG_NAME }"
5959
#define HELP_SPEC_OPTIONS \
60-
"OPTIONS := { {-j|--json} [{-p|--pretty}] | {-d|--debug} | {-l|--legacy}"
60+
"OPTIONS := { {-j|--json} [{-p|--pretty}] | {-d|--debug}"
6161
#define HELP_SPEC_MAP \
6262
"MAP := { id MAP_ID | pinned FILE | name MAP_NAME }"
6363
#define HELP_SPEC_LINK \
@@ -82,7 +82,6 @@ extern bool block_mount;
8282
extern bool verifier_logs;
8383
extern bool relaxed_maps;
8484
extern bool use_loader;
85-
extern bool legacy_libbpf;
8685
extern struct btf *base_btf;
8786
extern struct hashmap *refs_table;
8887

Diff for: src/prog.c

-5
Original file line numberDiff line numberDiff line change
@@ -1802,11 +1802,6 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
18021802
else
18031803
bpf_object__unpin_programs(obj, pinfile);
18041804
err_close_obj:
1805-
if (!legacy_libbpf) {
1806-
p_info("Warning: bpftool is now running in libbpf strict mode and has more stringent requirements about BPF programs.\n"
1807-
"If it used to work for this object file but now doesn't, see --legacy option for more details.\n");
1808-
}
1809-
18101805
bpf_object__close(obj);
18111806
err_free_reuse_maps:
18121807
for (i = 0; i < old_map_fds; i++)

0 commit comments

Comments
 (0)