From 1c5b49f0edb9f14c9c1b6d6e14b2d53542fc9b29 Mon Sep 17 00:00:00 2001 From: "Jonathan M. Henson" Date: Wed, 18 Oct 2023 12:31:37 -0700 Subject: [PATCH] better card iteration. --- include/aws/common/system_info.h | 4 +++- source/linux/system_info.c | 6 +++--- source/system_info.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/aws/common/system_info.h b/include/aws/common/system_info.h index b8b7c8370..1098e4858 100644 --- a/include/aws/common/system_info.h +++ b/include/aws/common/system_info.h @@ -65,7 +65,9 @@ AWS_COMMON_API const struct aws_string **aws_system_environment_get_network_cards(const struct aws_system_environment *env); AWS_COMMON_API -uint16_t aws_system_environment_get_cpu_group_for_network_card(const struct aws_system_environment *env, size_t card_index); +uint16_t aws_system_environment_get_cpu_group_for_network_card( + const struct aws_system_environment *env, + size_t card_index); /** * Returns the number of processors for the specified compute environment. diff --git a/source/linux/system_info.c b/source/linux/system_info.c index d91d6663b..27423ff51 100644 --- a/source/linux/system_info.c +++ b/source/linux/system_info.c @@ -6,10 +6,10 @@ #include #include -#include -#include #include #include +#include +#include static bool s_is_irrelevant_interface(const struct aws_byte_cursor name) { @@ -51,7 +51,7 @@ int aws_system_environment_load_platform_impl(struct aws_system_environment *env getifaddrs(&addrs); iterator = addrs; - while(iterator) { + while (iterator) { if (iterator->ifa_addr && iterator->ifa_addr->sa_family == AF_PACKET) { struct aws_string *device_name = aws_string_new_from_c_str(env->allocator, iterator->ifa_name); struct aws_byte_cursor device_name_cur = aws_byte_cursor_from_string(device_name); diff --git a/source/system_info.c b/source/system_info.c index 2ab710451..0c9b4a3bc 100644 --- a/source/system_info.c +++ b/source/system_info.c @@ -87,12 +87,13 @@ size_t aws_system_environment_get_network_card_count(const struct aws_system_env return aws_array_list_length(&env->str_list_network_cards); } - const struct aws_string **aws_system_environment_get_network_cards(const struct aws_system_environment *env) { return env->str_list_network_cards.data; } -uint16_t aws_system_environment_get_cpu_group_for_network_card(const struct aws_system_environment *env, size_t card_index) { +uint16_t aws_system_environment_get_cpu_group_for_network_card( + const struct aws_system_environment *env, + size_t card_index) { AWS_FATAL_ASSERT(card_index < aws_array_list_length(&env->u16_nic_to_cpu_group)); uint16_t value = 0;