Skip to content

Commit 28ddeac

Browse files
author
Alan Jowett
committed
PR feedback
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
1 parent eacec2c commit 28ddeac

File tree

8 files changed

+37
-38
lines changed

8 files changed

+37
-38
lines changed

tests/sample/unsafe/invalid_maps2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ BindMonitor(bind_md_t* ctx)
149149
uint32_t* dummy_value = bpf_map_lookup_elem(&dummy_map, &dummy_key);
150150

151151
if (!dummy_value) {
152-
// Callee0 is at index 0
152+
// Callee0 is at index 0.
153153
int index = 0;
154154
bpf_tail_call(ctx, &prog_array_map, index);
155155
}
@@ -165,7 +165,7 @@ BindMonitor_Callee0(bind_md_t* ctx)
165165
uint32_t* dummy_value = bpf_map_lookup_elem(&dummy_map, &dummy_key);
166166

167167
if (!dummy_value) {
168-
// Callee1 is at index 1
168+
// Callee1 is at index 1.
169169
int index = 1;
170170
bpf_tail_call(ctx, &prog_array_map, index);
171171
}

tests/stress/km/stress_tests_km.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ static const std::map<std::string, test_program_attributes> _test_program_info =
3030
struct object_table_entry
3131
{
3232
std::unique_ptr<std::mutex> lock{nullptr};
33-
_Guarded_by_(lock) bool available{true};
34-
_Guarded_by_(lock) bpf_object_ptr object{nullptr};
35-
_Guarded_by_(lock) bool loaded{false};
33+
_Guarded_by_(lock) bool available { true };
34+
_Guarded_by_(lock) bpf_object_ptr object { nullptr };
35+
_Guarded_by_(lock) bool loaded { false };
3636
bool attach{false};
3737

3838
// The following fields are for debugging this test itself.
@@ -353,7 +353,7 @@ _do_creator_work(thread_context& context, std::time_t endtime_seconds)
353353
// to force a race between 'load', 'attach' and 'destroy'.
354354
std::lock_guard lock(*entry.lock.get());
355355

356-
// Make sure entry is _still_ free (some other creator thread may have grabbed it)
356+
// Make sure entry is _still_ free (some other creator thread may have grabbed it).
357357
if (!entry.available) {
358358
continue;
359359
}
@@ -747,13 +747,13 @@ wait_and_verify_test_threads(
747747
std::vector<std::thread>& extension_restart_thread_table,
748748
std::vector<thread_context>& extension_restart_thread_context_table)
749749
{
750-
// Wait for all test threads
750+
// Wait for all test threads.
751751
LOG_VERBOSE("waiting on {} test threads...", thread_table.size());
752752
for (auto& t : thread_table) {
753753
t.join();
754754
}
755755

756-
// Wait for all extension restart threads
756+
// Wait for all extension restart threads.
757757
if (test_control_info.extension_restart_enabled) {
758758
LOG_VERBOSE("waiting on {} extension restart threads...", extension_restart_thread_table.size());
759759
for (auto& t : extension_restart_thread_table) {
@@ -835,7 +835,7 @@ _mt_prog_load_stress_test(ebpf_execution_type_t program_type, const test_control
835835
context_entry.file_name = _make_unique_file_copy(program_attribs.native_file_name);
836836
} else {
837837

838-
// Use the same file name for all 'creator' threads
838+
// Use the same file name for all 'creator' threads.
839839
context_entry.file_name = program_attribs.native_file_name;
840840
}
841841
} else {
@@ -1042,7 +1042,7 @@ _invoke_test_thread_function(thread_context& context)
10421042
exit(-1);
10431043
}
10441044

1045-
// Set the timeout for connect attempts
1045+
// Set the timeout for connect attempts.
10461046
timeval timeout;
10471047
timeout.tv_sec = 5; // 5 seconds
10481048
timeout.tv_usec = 0;
@@ -1974,7 +1974,7 @@ _mt_load_stress_test_with_restart_timing(
19741974
if (test_control_info.extension_restart_enabled && !start_restart_before_load) {
19751975
// Wait for programs to load, then start extension restart.
19761976
LOG_INFO("Waiting for programs to load, then starting extension restart");
1977-
std::this_thread::sleep_for(std::chrono::seconds(5)); // Give programs time to load and attach
1977+
std::this_thread::sleep_for(std::chrono::seconds(5)); // Give programs time to load and attach.
19781978
configure_extension_restart(
19791979
test_control_info,
19801980
extension_names,
@@ -2032,9 +2032,9 @@ _mt_invoke_stress_test_multiple_programs(ebpf_execution_type_t program_type, con
20322032
}
20332033

20342034
context_entry.program_name = "cgroup_sock_addr";
2035-
context_entry.role = thread_role_type::CREATOR; // All threads are creators for this test
2035+
context_entry.role = thread_role_type::CREATOR; // All threads are creators for this test.
20362036
context_entry.thread_index = i;
2037-
context_entry.compartment_id = i + 1; // Unique compartment IDs
2037+
context_entry.compartment_id = i + 1; // Unique compartment IDs.
20382038
context_entry.duration_minutes = test_control_info.duration_minutes;
20392039
context_entry.extension_restart_enabled = test_control_info.extension_restart_enabled;
20402040
}

tests/unit/wer_report_test_wrapper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ AddVectoredExceptionHandler_test(_In_ unsigned long first, _In_ PVECTORED_EXCEPT
4545
unsigned long SetThreadStackGuarantee_test_stack_size_in_bytes = 0;
4646

4747
// Use BOOL to pass "SetThreadStackGuarantee"
48-
// defined in windows "processthreadapi.h" file
48+
// defined in windows "processthreadapi.h" file.
4949
BOOL
5050
SetThreadStackGuarantee_test(_Inout_ unsigned long* stack_size_in_bytes)
5151
{
@@ -209,7 +209,7 @@ TEST_CASE("wer_report_failure", "[wer_report]")
209209
WerReportAddDump_test_called = false;
210210
WerReportSubmit_test_called = false;
211211

212-
// Fail WerReportCreate
212+
// Fail WerReportCreate.
213213
REQUIRE(AddVectoredExceptionHandler_test_handler(&exception_pointers) == EXCEPTION_CONTINUE_SEARCH);
214214
REQUIRE(WerReportCreate_test_called);
215215
REQUIRE(!WerReportAddDump_test_called);
@@ -222,7 +222,7 @@ TEST_CASE("wer_report_failure", "[wer_report]")
222222
WerReportAddDump_test_called = false;
223223
WerReportSubmit_test_called = false;
224224

225-
// Fail WerReportAddDump
225+
// Fail WerReportAddDump.
226226
REQUIRE(AddVectoredExceptionHandler_test_handler(&exception_pointers) == EXCEPTION_CONTINUE_SEARCH);
227227
REQUIRE(WerReportCreate_test_called);
228228
REQUIRE(WerReportAddDump_test_called);
@@ -235,7 +235,7 @@ TEST_CASE("wer_report_failure", "[wer_report]")
235235
WerReportAddDump_test_called = false;
236236
WerReportSubmit_test_called = false;
237237

238-
// Fail WerReportSubmit
238+
// Fail WerReportSubmit.
239239
REQUIRE(AddVectoredExceptionHandler_test_handler(&exception_pointers) == EXCEPTION_CONTINUE_SEARCH);
240240
REQUIRE(WerReportCreate_test_called);
241241
REQUIRE(WerReportAddDump_test_called);

tools/bpf2c/bpf2c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ get_program_info_type_hash(const std::vector<int32_t>& actual_helper_ids, const
104104
helper_id_ordering[helper_id] = index;
105105
}
106106
}
107-
// Hash helper ids in increasing helper_id order
107+
// Hash helper ids in increasing helper_id order.
108108
for (auto [helper_id, index] : helper_id_ordering) {
109109
hash_t::append_byte_range(
110110
byte_range, program_info->program_type_specific_helper_prototype[index].helper_id);

tools/bpf2c/bpf2c_dll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "bpf2c.h"
55

66
#include <stdio.h>
7-
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
7+
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers.
88
#include <windows.h>
99

1010
#define metadata_table ___METADATA_TABLE___##_metadata_table

tools/bpf2c/bpf_code_generator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static const std::string _predicate_format_string[] = {
120120

121121
#define ADD_OPCODE(X) {static_cast<uint8_t>(X), std::string(#X)}
122122

123-
// remove EBPF_ATOMIC_ prefix
123+
// Remove EBPF_ATOMIC_ prefix.
124124
#define ADD_ATOMIC_OPCODE(X) {static_cast<int32_t>(X), std::string(#X).substr(12)}
125125

126126
static std::map<int32_t, std::string> _atomic_opcode_name_strings = {
@@ -478,7 +478,7 @@ bpf_code_generator::visit_symbols(symbol_visitor_t visitor, const unsafe_string&
478478
throw bpf_code_generator_exception("invalid symbol value");
479479
}
480480

481-
// Check for overflow of value + size
481+
// Check for overflow of value + size.
482482
if ((value + size) < value) {
483483
throw bpf_code_generator_exception("invalid symbol value");
484484
}
@@ -1076,7 +1076,7 @@ bpf_code_generator::bpf_code_generator_program::encode_instructions(
10761076
auto effective_program_name = !program_name.empty() ? program_name : elf_section_name;
10771077
auto helper_array_prefix = "runtime_context->helper_data[{}]";
10781078

1079-
// Encode instructions
1079+
// Encode instructions.
10801080
for (size_t i = 0; i < program_output.size(); i++) {
10811081
auto& output = program_output[i];
10821082
auto& inst = output.instruction;

tools/netsh/dllmain.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ DllMain(HMODULE moduleHandle, unsigned long reasonForCall, void* reserved)
3232
return TRUE;
3333
}
3434

35-
// Verbs
35+
// Verbs.
3636
#define CMD_GROUP_ADD L"add"
3737
#define CMD_GROUP_DELETE L"delete"
3838
#define CMD_GROUP_PIN L"pin"
3939
#define CMD_GROUP_SET L"set"
4040
#define CMD_GROUP_SHOW L"show"
4141
#define CMD_GROUP_UNPIN L"unpin"
4242

43-
// Nouns
43+
// Nouns.
4444
#define CMD_EBPF_SHOW_DISASSEMBLY L"disassembly"
4545
#define CMD_EBPF_SHOW_LINKS L"links"
4646
#define CMD_EBPF_SHOW_MAPS L"maps"
@@ -87,25 +87,25 @@ CMD_ENTRY g_EbpfShowCommandTable[] = {
8787
#else
8888
typedef struct _CMD_ENTRY_ORIGINAL
8989
{
90-
_Field_z_ const wchar_t* pwszCmdToken; // The token for the command
91-
PFN_HANDLE_CMD pfnCmdHandler; // The function which handles this command
92-
unsigned long dwShortCmdHelpToken; // The short help message
90+
_Field_z_ const wchar_t* pwszCmdToken; // The token for the command.
91+
PFN_HANDLE_CMD pfnCmdHandler; // The function which handles this command.
92+
unsigned long dwShortCmdHelpToken; // The short help message.
9393
unsigned long
94-
dwCmdHlpToken; // The message to display if the only thing after the command is a help token (HELP, /?, -?, ?)
95-
unsigned long dwFlags; // Flags (see CMD_FLAGS_xxx above)
96-
PNS_OSVERSIONCHECK pOsVersionCheck; // Check for the version of the OS this command can run against
94+
dwCmdHlpToken; // The message to display if the only thing after the command is a help token (HELP, /?, -?, ?).
95+
unsigned long dwFlags; // Flags (see CMD_FLAGS_xxx above).
96+
PNS_OSVERSIONCHECK pOsVersionCheck; // Check for the version of the OS this command can run against.
9797
} CMD_ENTRY_ORIGINAL, *PCMD_ENTRY_ORIGINAL;
9898
#define CREATE_CMD_ENTRY_ORIGINAL(t, f) {CMD_##t, f, HLP_##t, HLP_##t##_EX, CMD_FLAG_PRIVATE, NULL}
9999

100100
typedef struct _CMD_ENTRY_LONG
101101
{
102-
_Field_z_ const wchar_t* pwszCmdToken; // The token for the command
103-
PFN_HANDLE_CMD pfnCmdHandler; // The function which handles this command
104-
unsigned long dwShortCmdHelpToken; // The short help message
102+
_Field_z_ const wchar_t* pwszCmdToken; // The token for the command.
103+
PFN_HANDLE_CMD pfnCmdHandler; // The function which handles this command.
104+
unsigned long dwShortCmdHelpToken; // The short help message.
105105
unsigned long
106-
dwCmdHlpToken; // The message to display if the only thing after the command is a help token (HELP, /?, -?, ?)
107-
unsigned long dwFlags; // Flags (see CMD_FLAGS_xxx above)
108-
PNS_OSVERSIONCHECK pOsVersionCheck; // Check for the version of the OS this command can run against
106+
dwCmdHlpToken; // The message to display if the only thing after the command is a help token (HELP, /?, -?, ?).
107+
unsigned long dwFlags; // Flags (see CMD_FLAGS_xxx above).
108+
PNS_OSVERSIONCHECK pOsVersionCheck; // Check for the version of the OS this command can run against.
109109
void* pfnCustomHelpFn;
110110
} CMD_ENTRY_LONG, *PCMD_ENTRY_LONG;
111111
#define CREATE_CMD_ENTRY_LONG(t, f) {CMD_##t, f, HLP_##t, HLP_##t##_EX, CMD_FLAG_PRIVATE, NULL, NULL}

undocked/tests/sample/ext/drv/sample_ext_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ _sample_ebpf_ext_driver_initialize_objects(
124124
status = WdfDeviceCreate(&device_initialize, WDF_NO_OBJECT_ATTRIBUTES, device);
125125

126126
if (!NT_SUCCESS(status)) {
127-
// Do not free if any other call
128-
// after WdfDeviceCreate fails.
127+
// Do not free if any other call after WdfDeviceCreate fails.
129128
WdfDeviceInitFree(device_initialize);
130129
device_initialize = NULL;
131130
goto Exit;

0 commit comments

Comments
 (0)