Skip to content

Commit f1003ce

Browse files
authored
Remove deprecated APIs (#4712)
Fixes #4673
1 parent a230bfd commit f1003ce

File tree

5 files changed

+7
-198
lines changed

5 files changed

+7
-198
lines changed

ebpfapi/Source.def

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,29 +102,23 @@ EXPORTS
102102
bpf_xdp_detach
103103
bpf_xdp_query_id
104104
ebpf_api_elf_disassemble_program
105-
ebpf_api_elf_disassemble_section
106105
ebpf_api_elf_verify_program_from_file
107106
ebpf_api_elf_verify_program_from_memory
108-
ebpf_api_elf_verify_section_from_file
109-
ebpf_api_elf_verify_section_from_memory
110107
ebpf_api_close_handle
111108
ebpf_api_get_pinned_map_info
112109
ebpf_api_map_info_free
113110
ebpf_canonicalize_pin_path
114111
ebpf_close_fd
115112
ebpf_duplicate_fd
116113
ebpf_enumerate_programs
117-
ebpf_enumerate_sections = ebpf_enumerate_programs
118114
ebpf_free_programs
119-
ebpf_free_sections = ebpf_free_programs
120115
ebpf_free_string
121116
ebpf_get_attach_type_name
122117
ebpf_get_bpf_attach_type
123118
ebpf_get_bpf_program_type
124119
ebpf_get_ebpf_attach_type
125120
ebpf_get_ebpf_program_type
126121
ebpf_get_next_pinned_object_path
127-
ebpf_get_next_pinned_program_path
128122
ebpf_get_program_info_from_verifier
129123
ebpf_get_program_type_by_name
130124
ebpf_get_program_type_name

include/ebpf_api.h

Lines changed: 6 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,14 @@ extern "C"
6666
size_t offset_in_section; // Byte offset of program in section.
6767
} ebpf_api_program_info_t;
6868

69-
// The type ebpf_section_info_t was replaced by ebpf_api_program_info_t
70-
// which also added the offset_in_section field at the end.
71-
#define ebpf_section_info_t ebpf_api_program_info_t
72-
7369
/**
74-
- * @brief Get list of programs and stats in an eBPF file.
75-
- * @param[in] file Name of file containing eBPF programs.
76-
- * @param[in] verbose Obtain additional info about the programs.
77-
- * @param[out] infos On success points to a list of eBPF programs.
70+
* @brief Get list of programs and stats in an eBPF file.
71+
* @param[in] file Name of file containing eBPF programs.
72+
* @param[in] verbose Obtain additional info about the programs.
73+
* @param[out] infos On success points to a list of eBPF programs.
7874
* The caller is responsible for freeing the list via ebpf_free_programs().
79-
- * @param[out] error_message On failure points to a text description of
80-
- * the error.
75+
* @param[out] error_message On failure points to a text description of
76+
* the error.
8177
*/
8278
_Must_inspect_result_ ebpf_result_t
8379
ebpf_enumerate_programs(
@@ -86,38 +82,13 @@ extern "C"
8682
_Outptr_result_maybenull_ ebpf_api_program_info_t** infos,
8783
_Outptr_result_maybenull_z_ const char** error_message) EBPF_NO_EXCEPT;
8884

89-
/**
90-
* @brief Get list of sections and stats in an eBPF file.
91-
* @param[in] file Name of file containing eBPF program sections.
92-
* @param[in] verbose Obtain additional info about the program sections.
93-
* @param[out] infos On success points to a list of eBPF program sections.
94-
* The caller is responsible for freeing the list via ebpf_free_sections().
95-
* @param[out] error_message On failure points to a text description of
96-
* the error.
97-
* @deprecated Use ebpf_enumerate_programs() instead.
98-
*/
99-
__declspec(deprecated("Use ebpf_enumerate_programs() instead.")) _Must_inspect_result_ ebpf_result_t
100-
ebpf_enumerate_sections(
101-
_In_z_ const char* file,
102-
bool verbose,
103-
_Outptr_result_maybenull_ ebpf_section_info_t** infos,
104-
_Outptr_result_maybenull_z_ const char** error_message) EBPF_NO_EXCEPT;
105-
10685
/**
10786
* @brief Free memory returned from \ref ebpf_enumerate_programs.
10887
* @param[in] data Memory to free.
10988
*/
11089
void
11190
ebpf_free_programs(_In_opt_ _Post_invalid_ ebpf_api_program_info_t* infos) EBPF_NO_EXCEPT;
11291

113-
/**
114-
* @brief Free memory returned from \ref ebpf_enumerate_sections.
115-
* @param[in] data Memory to free.
116-
* @deprecated Use ebpf_free_programs() instead.
117-
*/
118-
__declspec(deprecated("Use ebpf_free_programs() instead.")) void
119-
ebpf_free_sections(_In_opt_ _Post_invalid_ ebpf_section_info_t* infos) EBPF_NO_EXCEPT;
120-
12192
/**
12293
* @brief Convert an eBPF program to human readable byte code.
12394
* @param[in] file Name of ELF file containing eBPF program.
@@ -137,21 +108,6 @@ extern "C"
137108
_Outptr_result_maybenull_z_ const char** disassembly,
138109
_Outptr_result_maybenull_z_ const char** error_message) EBPF_NO_EXCEPT;
139110

140-
/**
141-
* @brief Convert an eBPF program to human readable byte code.
142-
* @param[in] file Name of ELF file containing eBPF program.
143-
* @param[in] section The name of the section to disassemble.
144-
* @param[out] disassembly On success points text version of the program.
145-
* @param[out] error_message On failure points to a text description of
146-
* the error.
147-
*/
148-
__declspec(deprecated("Use ebpf_api_elf_disassemble_program() instead.")) uint32_t
149-
ebpf_api_elf_disassemble_section(
150-
_In_z_ const char* file,
151-
_In_z_ const char* section,
152-
_Outptr_result_maybenull_z_ const char** disassembly,
153-
_Outptr_result_maybenull_z_ const char** error_message) EBPF_NO_EXCEPT;
154-
155111
typedef struct
156112
{
157113
int total_unreachable;
@@ -194,31 +150,6 @@ extern "C"
194150
_Outptr_result_maybenull_z_ const char** error_message,
195151
_Out_opt_ ebpf_api_verifier_stats_t* stats) EBPF_NO_EXCEPT;
196152

197-
/**
198-
* @brief Verify that the program is safe to execute.
199-
* @param[in] file Name of ELF file containing eBPF program.
200-
* @param[in] section The name of the section to verify.
201-
* @param[in] program_type Optional program type.
202-
* If NULL, the program type is derived from the section name.
203-
* @param[in] verbosity How much additional info about the programs to obtain.
204-
* @param[out] report Points to a text section describing why the program
205-
* failed verification.
206-
* @param[out] error_message On failure points to a text description of
207-
* the error.
208-
* @param[out] stats If non-NULL, returns verification statistics.
209-
* @retval 0 Verification succeeded.
210-
* @retval 1 Verification failed.
211-
*/
212-
__declspec(deprecated("Use ebpf_api_elf_verify_program_from_file() instead.")) _Success_(return == 0) uint32_t
213-
ebpf_api_elf_verify_section_from_file(
214-
_In_z_ const char* file,
215-
_In_z_ const char* section,
216-
_In_opt_ const ebpf_program_type_t* program_type,
217-
ebpf_verification_verbosity_t verbosity,
218-
_Outptr_result_maybenull_z_ const char** report,
219-
_Outptr_result_maybenull_z_ const char** error_message,
220-
_Out_opt_ ebpf_api_verifier_stats_t* stats) EBPF_NO_EXCEPT;
221-
222153
/**
223154
* @brief Verify that the program is safe to execute.
224155
* @param[in] data Memory containing the ELF file containing eBPF program.
@@ -249,33 +180,6 @@ extern "C"
249180
_Outptr_result_maybenull_z_ const char** error_message,
250181
_Out_opt_ ebpf_api_verifier_stats_t* stats) EBPF_NO_EXCEPT;
251182

252-
/**
253-
* @brief Verify that the program is safe to execute.
254-
* @param[in] data Memory containing the ELF file containing eBPF program.
255-
* @param[in] data_length Length of data.
256-
* @param[in] section_name The name of the section to verify.
257-
* @param[in] program_type Optional program type.
258-
* If NULL, the program type is derived from the section name.
259-
* @param[in] verbosity How much additional info about the programs to obtain.
260-
* @param[out] report Points to a text section describing why the program
261-
* failed verification.
262-
* @param[out] error_message On failure points to a text description of
263-
* the error.
264-
* @param[out] stats If non-NULL, returns verification statistics.
265-
* @retval 0 Verification succeeded.
266-
* @retval 1 Verification failed.
267-
*/
268-
__declspec(deprecated("Use ebpf_api_elf_verify_program_from_memory() instead.")) _Success_(return == 0) uint32_t
269-
ebpf_api_elf_verify_section_from_memory(
270-
_In_reads_(data_length) const char* data,
271-
size_t data_length,
272-
_In_z_ const char* section_name,
273-
_In_opt_ const ebpf_program_type_t* program_type,
274-
ebpf_verification_verbosity_t verbosity,
275-
_Outptr_result_maybenull_z_ const char** report,
276-
_Outptr_result_maybenull_z_ const char** error_message,
277-
_Out_opt_ ebpf_api_verifier_stats_t* stats) EBPF_NO_EXCEPT;
278-
279183
/**
280184
* @brief Free memory for a string returned from an eBPF API.
281185
* @param[in] string Memory to free.
@@ -589,20 +493,6 @@ extern "C"
589493
_Ret_maybenull_z_ const char*
590494
ebpf_get_attach_type_name(_In_ const ebpf_attach_type_t* attach_type) EBPF_NO_EXCEPT;
591495

592-
/**
593-
* @brief Gets the next pinned program after a given path.
594-
*
595-
* @param[in] start_path Path to look for an entry greater than.
596-
* @param[out] next_path Returns the next path, if one exists.
597-
*
598-
* @retval EBPF_SUCCESS The operation was successful.
599-
* @retval EBPF_NO_MORE_KEYS No more entries found.
600-
* @deprecated Use ebpf_get_next_pinned_object_path() instead.
601-
*/
602-
__declspec(deprecated("Use ebpf_get_next_pinned_object_path() instead.")) _Must_inspect_result_ ebpf_result_t
603-
ebpf_get_next_pinned_program_path(
604-
_In_z_ const char* start_path, _Out_writes_z_(EBPF_MAX_PIN_PATH_LENGTH) char* next_path) EBPF_NO_EXCEPT;
605-
606496
/**
607497
* @brief Retrieve the next pinned path of an eBPF object.
608498
*

libs/api/Verifier.cpp

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -626,16 +626,6 @@ ebpf_api_elf_disassemble_program(
626626
return 0;
627627
}
628628

629-
uint32_t
630-
ebpf_api_elf_disassemble_section(
631-
_In_z_ const char* file,
632-
_In_z_ const char* section,
633-
_Outptr_result_maybenull_z_ const char** disassembly,
634-
_Outptr_result_maybenull_z_ const char** error_message) noexcept
635-
{
636-
return ebpf_api_elf_disassemble_program(file, section, {}, disassembly, error_message);
637-
}
638-
639629
static _Success_(return == 0) uint32_t _ebpf_api_elf_verify_program_from_stream(
640630
std::istream& stream,
641631
_In_z_ const char* stream_name,
@@ -798,19 +788,6 @@ _Success_(return == 0) uint32_t ebpf_api_elf_verify_program_from_file(
798788
data, file, section_name, program_name, program_type, verbosity, report, error_message, stats);
799789
}
800790

801-
_Success_(return == 0) uint32_t ebpf_api_elf_verify_section_from_file(
802-
_In_z_ const char* file,
803-
_In_z_ const char* section,
804-
_In_opt_ const ebpf_program_type_t* program_type,
805-
ebpf_verification_verbosity_t verbosity,
806-
_Outptr_result_maybenull_z_ const char** report,
807-
_Outptr_result_maybenull_z_ const char** error_message,
808-
_Out_opt_ ebpf_api_verifier_stats_t* stats) noexcept
809-
{
810-
return ebpf_api_elf_verify_program_from_file(
811-
file, section, {}, program_type, verbosity, report, error_message, stats);
812-
}
813-
814791
_Success_(return == 0) uint32_t ebpf_api_elf_verify_program_from_memory(
815792
_In_reads_(data_length) const char* data,
816793
size_t data_length,
@@ -833,17 +810,3 @@ _Success_(return == 0) uint32_t ebpf_api_elf_verify_program_from_memory(
833810
error_message,
834811
stats);
835812
}
836-
837-
_Success_(return == 0) uint32_t ebpf_api_elf_verify_section_from_memory(
838-
_In_reads_(data_length) const char* data,
839-
size_t data_length,
840-
_In_z_ const char* section,
841-
_In_opt_ const ebpf_program_type_t* program_type,
842-
ebpf_verification_verbosity_t verbosity,
843-
_Outptr_result_maybenull_z_ const char** report,
844-
_Outptr_result_maybenull_z_ const char** error_message,
845-
_Out_opt_ ebpf_api_verifier_stats_t* stats) noexcept
846-
{
847-
return ebpf_api_elf_verify_program_from_memory(
848-
data, data_length, section, {}, program_type, verbosity, report, error_message, stats);
849-
}

libs/api/ebpf_api.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,15 +4246,6 @@ ebpf_get_link_fd_by_id(ebpf_id_t id, _Out_ int* fd) NO_EXCEPT_TRY
42464246
}
42474247
CATCH_NO_MEMORY_EBPF_RESULT
42484248

4249-
_Must_inspect_result_ ebpf_result_t
4250-
ebpf_get_next_pinned_program_path(
4251-
_In_z_ const char* start_path, _Out_writes_z_(EBPF_MAX_PIN_PATH_LENGTH) char* next_path) NO_EXCEPT_TRY
4252-
{
4253-
ebpf_object_type_t type = EBPF_OBJECT_PROGRAM;
4254-
return ebpf_get_next_pinned_object_path(start_path, next_path, EBPF_MAX_PIN_PATH_LENGTH, &type);
4255-
}
4256-
CATCH_NO_MEMORY_EBPF_RESULT
4257-
42584249
_Must_inspect_result_ ebpf_result_t
42594250
ebpf_get_next_pinned_object_path(
42604251
_In_z_ const char* start_path,
@@ -5271,4 +5262,4 @@ _ebpf_link_mark_as_legacy_mode(ebpf_handle_t link_handle) NO_EXCEPT_TRY
52715262
result = win32_error_code_to_ebpf_result(invoke_ioctl(request));
52725263
EBPF_RETURN_RESULT(result);
52735264
}
5274-
CATCH_NO_MEMORY_EBPF_RESULT
5265+
CATCH_NO_MEMORY_EBPF_RESULT

tests/end_to_end/end_to_end.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -916,35 +916,6 @@ TEST_CASE("enum programs", "[end_to_end]")
916916
ebpf_free_string(error_message);
917917
}
918918

919-
TEST_CASE("verify section", "[end_to_end][deprecated]")
920-
{
921-
_test_helper_end_to_end test_helper;
922-
test_helper.initialize();
923-
924-
const char* error_message = nullptr;
925-
const char* report = nullptr;
926-
uint32_t result;
927-
program_info_provider_t sample_test_program_info;
928-
REQUIRE(sample_test_program_info.initialize(EBPF_PROGRAM_TYPE_SAMPLE) == EBPF_SUCCESS);
929-
930-
ebpf_api_verifier_stats_t stats;
931-
#pragma warning(suppress : 4996) // deprecated
932-
REQUIRE(
933-
(result = ebpf_api_elf_verify_section_from_file(
934-
SAMPLE_PATH "test_sample_ebpf.o",
935-
"sample_ext",
936-
nullptr,
937-
EBPF_VERIFICATION_VERBOSITY_NORMAL,
938-
&report,
939-
&error_message,
940-
&stats),
941-
ebpf_free_string(error_message),
942-
error_message = nullptr,
943-
result == 0));
944-
REQUIRE(report != nullptr);
945-
ebpf_free_string(report);
946-
}
947-
948919
TEST_CASE("verify program", "[end_to_end]")
949920
{
950921
_test_helper_end_to_end test_helper;

0 commit comments

Comments
 (0)