From d0d854e841f303a7dac106f85aab2b1e2208732e Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 11:48:46 -0500 Subject: [PATCH 01/22] Refactor: include: Don't allow including pcmki headers directly. Instead of including any of the pcmki/pcmki_* headers, you should include the top-level pacemaker-internal.h instead. And then fix the one place that wasn't following this rule. Ref T777 --- include/pacemaker-internal.h | 6 +++++- include/pcmki/pcmki_acl.h | 6 +++++- include/pcmki/pcmki_agents.h | 6 +++++- include/pcmki/pcmki_cluster_queries.h | 5 ++++- include/pcmki/pcmki_fence.h | 6 +++++- include/pcmki/pcmki_options.h | 5 ++++- include/pcmki/pcmki_output.h | 6 +++++- include/pcmki/pcmki_resource.h | 6 +++++- include/pcmki/pcmki_result_code.h | 5 ++++- include/pcmki/pcmki_rule.h | 5 ++++- include/pcmki/pcmki_scheduler.h | 5 ++++- include/pcmki/pcmki_simulate.h | 5 ++++- include/pcmki/pcmki_status.h | 6 +++++- include/pcmki/pcmki_ticket.h | 5 ++++- include/pcmki/pcmki_transition.h | 5 ++++- include/pcmki/pcmki_verify.h | 5 ++++- tools/attrd_updater.c | 2 +- 17 files changed, 72 insertions(+), 17 deletions(-) diff --git a/include/pacemaker-internal.h b/include/pacemaker-internal.h index 7faa31e264a..e1b9e402a58 100644 --- a/include/pacemaker-internal.h +++ b/include/pacemaker-internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the Pacemaker project contributors + * Copyright 2019-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -10,6 +10,8 @@ #ifndef PCMK__PACEMAKER_INTERNAL__H #define PCMK__PACEMAKER_INTERNAL__H +#define PCMK__DIRECT_INCLUDE + #include #include #include @@ -26,4 +28,6 @@ #include #include +#undef PCMK__DIRECT_INCLUDE + #endif // PCMK__PACEMAKER_INTERNAL__H diff --git a/include/pcmki/pcmki_acl.h b/include/pcmki/pcmki_acl.h index adb56a5eb3a..38fb4f9cfe8 100644 --- a/include/pcmki/pcmki_acl.h +++ b/include/pcmki/pcmki_acl.h @@ -1,11 +1,15 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__PCMKI_PCMKI_ACL__H #define PCMK__PCMKI_PCMKI_ACL__H diff --git a/include/pcmki/pcmki_agents.h b/include/pcmki/pcmki_agents.h index dbf25696bc5..d7a7e69d122 100644 --- a/include/pcmki/pcmki_agents.h +++ b/include/pcmki/pcmki_agents.h @@ -1,11 +1,15 @@ /* - * Copyright 2023-2024 the Pacemaker project contributors + * Copyright 2023-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__PCMKI_PCMKI_AGENTS__H #define PCMK__PCMKI_PCMKI_AGENTS__H diff --git a/include/pcmki/pcmki_cluster_queries.h b/include/pcmki/pcmki_cluster_queries.h index 213dd727401..63da8f8e7ca 100644 --- a/include/pcmki/pcmki_cluster_queries.h +++ b/include/pcmki/pcmki_cluster_queries.h @@ -1,11 +1,14 @@ /* - * Copyright 2020-2025 the Pacemaker project contributors + * Copyright 2020-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_CLUSTER_QUERIES__H #define PCMK__PCMKI_PCMKI_CLUSTER_QUERIES__H diff --git a/include/pcmki/pcmki_fence.h b/include/pcmki/pcmki_fence.h index 2bf09315347..b8493d12e0f 100644 --- a/include/pcmki/pcmki_fence.h +++ b/include/pcmki/pcmki_fence.h @@ -1,11 +1,15 @@ /* - * Copyright 2019-2025 the Pacemaker project contributors + * Copyright 2019-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__PCMKI_PCMKI_FENCE__H #define PCMK__PCMKI_PCMKI_FENCE__H diff --git a/include/pcmki/pcmki_options.h b/include/pcmki/pcmki_options.h index e6190562d54..e030ee12564 100644 --- a/include/pcmki/pcmki_options.h +++ b/include/pcmki/pcmki_options.h @@ -1,11 +1,14 @@ /* - * Copyright 2024-2025 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_OPTIONS__H #define PCMK__PCMKI_PCMKI_OPTIONS__H diff --git a/include/pcmki/pcmki_output.h b/include/pcmki/pcmki_output.h index bc951c855f9..a1dce04ef54 100644 --- a/include/pcmki/pcmki_output.h +++ b/include/pcmki/pcmki_output.h @@ -1,11 +1,15 @@ /* - * Copyright 2019-2024 the Pacemaker project contributors + * Copyright 2019-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__PCMKI_PCMKI_OUTPUT__H #define PCMK__PCMKI_PCMKI_OUTPUT__H diff --git a/include/pcmki/pcmki_resource.h b/include/pcmki/pcmki_resource.h index ad9ff983b29..b41c1449cd9 100644 --- a/include/pcmki/pcmki_resource.h +++ b/include/pcmki/pcmki_resource.h @@ -1,11 +1,15 @@ /* - * Copyright 2021-2024 the Pacemaker project contributors + * Copyright 2021-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__PCMKI_PCMKI_RESOURCE__H #define PCMK__PCMKI_PCMKI_RESOURCE__H diff --git a/include/pcmki/pcmki_result_code.h b/include/pcmki/pcmki_result_code.h index c6daca8716d..7a7fa519300 100644 --- a/include/pcmki/pcmki_result_code.h +++ b/include/pcmki/pcmki_result_code.h @@ -1,11 +1,14 @@ /* - * Copyright 2022-2024 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_RESULT_CODE__H #define PCMK__PCMKI_PCMKI_RESULT_CODE__H diff --git a/include/pcmki/pcmki_rule.h b/include/pcmki/pcmki_rule.h index 78ea4e2753f..46892637dea 100644 --- a/include/pcmki/pcmki_rule.h +++ b/include/pcmki/pcmki_rule.h @@ -1,11 +1,14 @@ /* - * Copyright 2022-2024 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_RULE__H #define PCMK__PCMKI_PCMKI_RULE__H diff --git a/include/pcmki/pcmki_scheduler.h b/include/pcmki/pcmki_scheduler.h index b2daea7dc3e..260245d0ccc 100644 --- a/include/pcmki/pcmki_scheduler.h +++ b/include/pcmki/pcmki_scheduler.h @@ -1,11 +1,14 @@ /* - * Copyright 2014-2025 the Pacemaker project contributors + * Copyright 2014-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_SCHEDULER__H #define PCMK__PCMKI_PCMKI_SCHEDULER__H diff --git a/include/pcmki/pcmki_simulate.h b/include/pcmki/pcmki_simulate.h index 5451d0179b8..1fbe523e6da 100644 --- a/include/pcmki/pcmki_simulate.h +++ b/include/pcmki/pcmki_simulate.h @@ -1,11 +1,14 @@ /* - * Copyright 2021-2025 the Pacemaker project contributors + * Copyright 2021-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_SIMULATE__H #define PCMK__PCMKI_PCMKI_SIMULATE__H diff --git a/include/pcmki/pcmki_status.h b/include/pcmki/pcmki_status.h index 47254620959..65847212d7b 100644 --- a/include/pcmki/pcmki_status.h +++ b/include/pcmki/pcmki_status.h @@ -1,11 +1,15 @@ /* - * Copyright 2022-2024 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__PCMKI_PCMKI_STATUS__H #define PCMK__PCMKI_PCMKI_STATUS__H diff --git a/include/pcmki/pcmki_ticket.h b/include/pcmki/pcmki_ticket.h index 474378cc2df..e4ef6e7ff0f 100644 --- a/include/pcmki/pcmki_ticket.h +++ b/include/pcmki/pcmki_ticket.h @@ -1,11 +1,14 @@ /* - * Copyright 2024-2025 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_TICKET__H #define PCMK__PCMKI_PCMKI_TICKET__H diff --git a/include/pcmki/pcmki_transition.h b/include/pcmki/pcmki_transition.h index a159b9a29b1..f8b0c48e8ba 100644 --- a/include/pcmki/pcmki_transition.h +++ b/include/pcmki/pcmki_transition.h @@ -1,11 +1,14 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_TRANSITION__H #define PCMK__PCMKI_PCMKI_TRANSITION__H diff --git a/include/pcmki/pcmki_verify.h b/include/pcmki/pcmki_verify.h index c72585b0240..e05f207efc6 100644 --- a/include/pcmki/pcmki_verify.h +++ b/include/pcmki/pcmki_verify.h @@ -1,11 +1,14 @@ /* - * Copyright 2024 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_PACEMAKER_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__PCMKI_PCMKI_VERIFY__H #define PCMK__PCMKI_PCMKI_VERIFY__H diff --git a/tools/attrd_updater.c b/tools/attrd_updater.c index f8a2ebc8441..4e95092dc45 100644 --- a/tools/attrd_updater.c +++ b/tools/attrd_updater.c @@ -27,7 +27,7 @@ #include -#include +#include #define SUMMARY "query and update Pacemaker node attributes" From e8a458e9223f158a8a606ae7a0a84542ed4134df Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 5 Jan 2026 12:43:45 -0500 Subject: [PATCH 02/22] Refactor: include: Don't directly include output_internal.h. Instead, go through crm/common/internal.h. I guess it's somewhat debatable if this is necessary since it's an internal header including another internal header, but the fact that it's cross-library makes me want to clean it up to preserve boundaries between libraries. While I'm here, reorganize the include blocks (though I've not gone through and verified everything with include-what-you-use or add the comments for what is being included). --- include/pacemaker-internal.h | 6 +++--- include/pcmki/pcmki_agents.h | 2 +- include/pcmki/pcmki_cluster_queries.h | 2 +- include/pcmki/pcmki_fence.h | 2 +- include/pcmki/pcmki_options.h | 2 +- include/pcmki/pcmki_output.h | 3 ++- include/pcmki/pcmki_resource.h | 2 +- include/pcmki/pcmki_result_code.h | 2 +- include/pcmki/pcmki_rule.h | 4 ++-- include/pcmki/pcmki_scheduler.h | 3 ++- include/pcmki/pcmki_simulate.h | 11 ++++++----- include/pcmki/pcmki_status.h | 4 ++-- include/pcmki/pcmki_ticket.h | 5 ++--- include/pcmki/pcmki_transition.h | 1 + include/pcmki/pcmki_verify.h | 5 +++-- 15 files changed, 29 insertions(+), 25 deletions(-) diff --git a/include/pacemaker-internal.h b/include/pacemaker-internal.h index e1b9e402a58..95414d6eda3 100644 --- a/include/pacemaker-internal.h +++ b/include/pacemaker-internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2025 the Pacemaker project contributors + * Copyright 2019-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -10,7 +10,7 @@ #ifndef PCMK__PACEMAKER_INTERNAL__H #define PCMK__PACEMAKER_INTERNAL__H -#define PCMK__DIRECT_INCLUDE +#define PCMK__INCLUDED_PACEMAKER_INTERNAL_H #include #include @@ -28,6 +28,6 @@ #include #include -#undef PCMK__DIRECT_INCLUDE +#undef PCMK__INCLUDED_PACEMAKER_INTERNAL_H #endif // PCMK__PACEMAKER_INTERNAL__H diff --git a/include/pcmki/pcmki_agents.h b/include/pcmki/pcmki_agents.h index d7a7e69d122..c3382bf627c 100644 --- a/include/pcmki/pcmki_agents.h +++ b/include/pcmki/pcmki_agents.h @@ -13,7 +13,7 @@ #ifndef PCMK__PCMKI_PCMKI_AGENTS__H #define PCMK__PCMKI_PCMKI_AGENTS__H -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_cluster_queries.h b/include/pcmki/pcmki_cluster_queries.h index 63da8f8e7ca..8b94e9cc0c5 100644 --- a/include/pcmki/pcmki_cluster_queries.h +++ b/include/pcmki/pcmki_cluster_queries.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/include/pcmki/pcmki_fence.h b/include/pcmki/pcmki_fence.h index b8493d12e0f..d05c07fd2f3 100644 --- a/include/pcmki/pcmki_fence.h +++ b/include/pcmki/pcmki_fence.h @@ -15,8 +15,8 @@ #include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_options.h b/include/pcmki/pcmki_options.h index e030ee12564..d87bd038cff 100644 --- a/include/pcmki/pcmki_options.h +++ b/include/pcmki/pcmki_options.h @@ -15,7 +15,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_output.h b/include/pcmki/pcmki_output.h index a1dce04ef54..62da884dfdf 100644 --- a/include/pcmki/pcmki_output.h +++ b/include/pcmki/pcmki_output.h @@ -14,7 +14,8 @@ #define PCMK__PCMKI_PCMKI_OUTPUT__H #include -#include + +#include #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_resource.h b/include/pcmki/pcmki_resource.h index b41c1449cd9..8412cba9326 100644 --- a/include/pcmki/pcmki_resource.h +++ b/include/pcmki/pcmki_resource.h @@ -16,8 +16,8 @@ #include #include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_result_code.h b/include/pcmki/pcmki_result_code.h index 7a7fa519300..f20d23910e0 100644 --- a/include/pcmki/pcmki_result_code.h +++ b/include/pcmki/pcmki_result_code.h @@ -15,8 +15,8 @@ #include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_rule.h b/include/pcmki/pcmki_rule.h index 46892637dea..6694c8ab21b 100644 --- a/include/pcmki/pcmki_rule.h +++ b/include/pcmki/pcmki_rule.h @@ -13,9 +13,9 @@ #ifndef PCMK__PCMKI_PCMKI_RULE__H #define PCMK__PCMKI_PCMKI_RULE__H -#include +#include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_scheduler.h b/include/pcmki/pcmki_scheduler.h index 260245d0ccc..6a016c43481 100644 --- a/include/pcmki/pcmki_scheduler.h +++ b/include/pcmki/pcmki_scheduler.h @@ -13,8 +13,9 @@ #ifndef PCMK__PCMKI_PCMKI_SCHEDULER__H #define PCMK__PCMKI_PCMKI_SCHEDULER__H -#include // GList #include // bool + +#include // GList #include // xmlNode #include // lrmd_event_data_t diff --git a/include/pcmki/pcmki_simulate.h b/include/pcmki/pcmki_simulate.h index 1fbe523e6da..6ed449d75c2 100644 --- a/include/pcmki/pcmki_simulate.h +++ b/include/pcmki/pcmki_simulate.h @@ -13,14 +13,15 @@ #ifndef PCMK__PCMKI_PCMKI_SIMULATE__H #define PCMK__PCMKI_PCMKI_SIMULATE__H -#include -#include -#include -#include // cib_t -#include #include #include +#include // cib_t +#include +#include +#include +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/include/pcmki/pcmki_status.h b/include/pcmki/pcmki_status.h index 65847212d7b..f96118a9d4a 100644 --- a/include/pcmki/pcmki_status.h +++ b/include/pcmki/pcmki_status.h @@ -17,9 +17,9 @@ #include #include -#include +#include #include -#include +#include #include #ifdef __cplusplus diff --git a/include/pcmki/pcmki_ticket.h b/include/pcmki/pcmki_ticket.h index e4ef6e7ff0f..bca39d46307 100644 --- a/include/pcmki/pcmki_ticket.h +++ b/include/pcmki/pcmki_ticket.h @@ -15,10 +15,9 @@ #include // bool -#include // pcmk__output_t -#include // pcmk_scheduler_t - #include +#include // pcmk__output_t +#include // pcmk_scheduler_t #ifdef __cplusplus extern "C" { diff --git a/include/pcmki/pcmki_transition.h b/include/pcmki/pcmki_transition.h index f8b0c48e8ba..353c1adaf07 100644 --- a/include/pcmki/pcmki_transition.h +++ b/include/pcmki/pcmki_transition.h @@ -16,6 +16,7 @@ #include // bool #include // uint32_t #include // time_t + #include // guint, GList, GHashTable #include // xmlNode diff --git a/include/pcmki/pcmki_verify.h b/include/pcmki/pcmki_verify.h index e05f207efc6..d8236479407 100644 --- a/include/pcmki/pcmki_verify.h +++ b/include/pcmki/pcmki_verify.h @@ -13,10 +13,11 @@ #ifndef PCMK__PCMKI_PCMKI_VERIFY__H #define PCMK__PCMKI_PCMKI_VERIFY__H -#include -#include #include +#include +#include + #ifdef __cplusplus extern "C" { #endif From 59bf21d1050c61d0d294f02c2cc9bb005c84c115 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:05:57 -0500 Subject: [PATCH 03/22] Refactor: include: Rearrange includes in crm/common/internal.h ...and remove a couple that are no longer needed. --- include/crm/common/internal.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 6199d14fea8..9bbff68d965 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,29 +10,28 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include // struct passwd -#include // getpid() +#include // PRIx64 #include // bool #include // uint8_t, uint64_t #include // pid_t, uid_t, gid_t -#include // PRIu64 +#include // getpid() #include // guint, GList, GHashTable -#include // xmlNode #include // do_crm_log_unlikely(), etc. #include // mainloop_io_t, struct ipc_client_callbacks + +#include #include #include #include #include #include -#include #include #include +#include #include #include // pcmk__assert_asprintf() -#include #ifdef __cplusplus extern "C" { From 42f51345ca02a5991921162176bfdf79260d0fcc Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:07:37 -0500 Subject: [PATCH 04/22] Refactor: include: Move function definitions into agents_internal.h. This is the first part of a project to reduce crm/common/internal.h to a file that basically just includes all the other internal files. After that, we can then use the #error technique to make sure the subheaders are not included anywhere. But first, we need to move everything out of this header to avoid circular imports. Ref T777 --- include/crm/common/agents_internal.h | 2 ++ include/crm/common/internal.h | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/crm/common/agents_internal.h b/include/crm/common/agents_internal.h index 693bf87dd0e..ddc10f2aa69 100644 --- a/include/crm/common/agents_internal.h +++ b/include/crm/common/agents_internal.h @@ -16,6 +16,8 @@ extern "C" { #define PCMK__FENCING_STONITH_TIMEOUT "stonith-timeout" +int pcmk__effective_rc(int rc); + #ifdef __cplusplus } #endif diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 9bbff68d965..e66ff4f955a 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -21,6 +21,7 @@ #include // do_crm_log_unlikely(), etc. #include // mainloop_io_t, struct ipc_client_callbacks +#include #include #include #include @@ -392,9 +393,6 @@ pcmk__lastfailure_name(const char *rsc_id, const char *op, guint interval_ms) interval_ms); } -// internal resource agent functions (from agents.c) -int pcmk__effective_rc(int rc); - #ifdef __cplusplus } #endif From 59e4e84a1e1e6ac3968422a6c28d182f13758177 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:12:55 -0500 Subject: [PATCH 05/22] Refactor: include: Move function definitions into nvpair_internal.h. Ref T777 --- include/crm/common/internal.h | 6 ------ include/crm/common/nvpair_internal.h | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index e66ff4f955a..0ca8efcda3a 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -65,12 +65,6 @@ int pcmk__add_mainloop_ipc(crm_ipc_t *ipc, int priority, void *userdata, guint pcmk__mainloop_timer_get_period(const mainloop_timer_t *timer); -/* internal name/value utilities (from nvpair.c) */ - -int pcmk__scan_nvpair(const gchar *input, gchar **name, gchar **value); -char *pcmk__format_nvpair(const char *name, const char *value, - const char *units); - /* internal procfs utilities (from procfs.c) */ pid_t pcmk__procfs_pid_of(const char *name); diff --git a/include/crm/common/nvpair_internal.h b/include/crm/common/nvpair_internal.h index c16786058ac..98c8d3f2044 100644 --- a/include/crm/common/nvpair_internal.h +++ b/include/crm/common/nvpair_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -44,6 +44,10 @@ gint pcmk__cmp_nvpair_blocks(gconstpointer a, gconstpointer b, void pcmk__unpack_nvpair_block(gpointer data, gpointer user_data); +int pcmk__scan_nvpair(const gchar *input, gchar **name, gchar **value); +char *pcmk__format_nvpair(const char *name, const char *value, + const char *units); + /*! * \internal * \brief Insert a meta-attribute into a hash table From ea6fb0721d69fc4e50fae8a4ad632994edc5c339 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:17:41 -0500 Subject: [PATCH 06/22] Refactor: include: Add mainloop_internal.h. This provides a place for internal mainloop related functions from crm/common/internal.h to be moved to. Ref T777 --- include/crm/common/internal.h | 10 +-------- include/crm/common/mainloop_internal.h | 31 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 include/crm/common/mainloop_internal.h diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 0ca8efcda3a..833b7a1fb23 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -19,7 +19,6 @@ #include // guint, GList, GHashTable #include // do_crm_log_unlikely(), etc. -#include // mainloop_io_t, struct ipc_client_callbacks #include #include @@ -28,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -57,14 +57,6 @@ int pcmk__substitute_secrets(const char *rsc_id, GHashTable *params); #endif -/* internal main loop utilities (from mainloop.c) */ - -int pcmk__add_mainloop_ipc(crm_ipc_t *ipc, int priority, void *userdata, - const struct ipc_client_callbacks *callbacks, - mainloop_io_t **source); -guint pcmk__mainloop_timer_get_period(const mainloop_timer_t *timer); - - /* internal procfs utilities (from procfs.c) */ pid_t pcmk__procfs_pid_of(const char *name); diff --git a/include/crm/common/mainloop_internal.h b/include/crm/common/mainloop_internal.h new file mode 100644 index 00000000000..7b1f677a9e0 --- /dev/null +++ b/include/crm/common/mainloop_internal.h @@ -0,0 +1,31 @@ +/* + * Copyright 2015-2025 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_MAINLOOP_INTERNAL__H +#define PCMK__CRM_COMMON_MAINLOOP_INTERNAL__H + +#include // guint + +#include // crm_ipc_t +#include // ipc_client_callbacks, mainloop_* + +#ifdef __cplusplus +extern "C" { +#endif + +int pcmk__add_mainloop_ipc(crm_ipc_t *ipc, int priority, void *userdata, + const struct ipc_client_callbacks *callbacks, + mainloop_io_t **source); +guint pcmk__mainloop_timer_get_period(const mainloop_timer_t *timer); + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_MAINLOOP_INTERNAL__H From c6f2e931fb15b83ef3a819171aadaac06e2878b9 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:23:16 -0500 Subject: [PATCH 07/22] Refactor: include: Add flags_internal.h. This provides a place for internal flag-related functions from crm/common/internal.h to be moved to. Ref T777 --- include/crm/common/flags_internal.h | 163 ++++++++++++++++++++++++++++ include/crm/common/internal.h | 142 +----------------------- 2 files changed, 164 insertions(+), 141 deletions(-) create mode 100644 include/crm/common/flags_internal.h diff --git a/include/crm/common/flags_internal.h b/include/crm/common/flags_internal.h new file mode 100644 index 00000000000..4c2e40c36d6 --- /dev/null +++ b/include/crm/common/flags_internal.h @@ -0,0 +1,163 @@ +/* + * Copyright 2015-2025 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_FLAGS_INTERNAL__H +#define PCMK__CRM_COMMON_FLAGS_INTERNAL__H + +#include // PRIx64 +#include // bool +#include // uint8_t, uint64_t + +#include // do_crm_log_unlikely() +#include // pcmk__s, pcmk__btoa + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \internal + * \brief Set specified flags in a flag group + * + * \param[in] function Function name of caller + * \param[in] line Line number of caller + * \param[in] log_level Log a message at this level + * \param[in] flag_type Label describing this flag group (for logging) + * \param[in] target Name of object whose flags these are (for logging) + * \param[in] flag_group Flag group being manipulated + * \param[in] flags Which flags in the group should be set + * \param[in] flags_str Readable equivalent of \p flags (for logging) + * + * \return Possibly modified flag group + */ +static inline uint64_t +pcmk__set_flags_as(const char *function, int line, uint8_t log_level, + const char *flag_type, const char *target, + uint64_t flag_group, uint64_t flags, const char *flags_str) +{ + uint64_t result = flag_group | flags; + + if (result != flag_group) { + do_crm_log_unlikely(log_level, + "%s flags %#.8" PRIx64 " (%s) for %s set by %s:%d", + pcmk__s(flag_type, "Group of"), flags, + pcmk__s(flags_str, "flags"), + pcmk__s(target, "target"), function, line); + } + return result; +} + +/*! + * \internal + * \brief Clear specified flags in a flag group + * + * \param[in] function Function name of caller + * \param[in] line Line number of caller + * \param[in] log_level Log a message at this level + * \param[in] flag_type Label describing this flag group (for logging) + * \param[in] target Name of object whose flags these are (for logging) + * \param[in] flag_group Flag group being manipulated + * \param[in] flags Which flags in the group should be cleared + * \param[in] flags_str Readable equivalent of \p flags (for logging) + * + * \return Possibly modified flag group + */ +static inline uint64_t +pcmk__clear_flags_as(const char *function, int line, uint8_t log_level, + const char *flag_type, const char *target, + uint64_t flag_group, uint64_t flags, const char *flags_str) +{ + uint64_t result = flag_group & ~flags; + + if (result != flag_group) { + do_crm_log_unlikely(log_level, + "%s flags %#.8" PRIx64 + " (%s) for %s cleared by %s:%d", + pcmk__s(flag_type, "Group of"), flags, + pcmk__s(flags_str, "flags"), + pcmk__s(target, "target"), function, line); + } + return result; +} + +/*! + * \internal + * \brief Check whether any of specified flags are set in a flag group + * + * \param[in] flag_group Flag group to check whether \p flags_to_check are + * set + * \param[in] flags_to_check Flags to check whether set in \p flag_group + * + * \retval \c true if \p flags_to_check is nonzero and any of its flags are + * set in \p flag_group + * \retval \c false otherwise + */ +static inline bool +pcmk__any_flags_set(uint64_t flag_group, uint64_t flags_to_check) +{ + return (flag_group & flags_to_check) != 0; +} + +/*! + * \internal + * \brief Check whether all of specified flags are set in a flag group + * + * \param[in] flag_group Flag group to check whether \p flags_to_check are + * set + * \param[in] flags_to_check Flags to check whether set in \p flag_group + * + * \retval \c true if all flags in \p flags_to_check are set in \p flag_group + * or if \p flags_to_check is 0 + * \retval \c false otherwise + */ +static inline bool +pcmk__all_flags_set(uint64_t flag_group, uint64_t flags_to_check) +{ + return (flag_group & flags_to_check) == flags_to_check; +} + +/*! + * \internal + * \brief Convenience alias for \c pcmk__all_flags_set(), to check single flag + * + * This is truly identical to \c pcmk__all_flags_set() but allows a call that's + * shorter and semantically clearer for checking a single flag. + * + * \param[in] flag_group Flag group (check whether \p flag is set in this) + * \param[in] flag Flag (check whether this is set in \p flag_group) + * + * \retval \c true if \p flag is set in \p flag_group or if \p flag is 0 + * \retval \c false otherwise + */ +static inline bool +pcmk__is_set(uint64_t flag_group, uint64_t flag) +{ + return pcmk__all_flags_set(flag_group, flag); +} + +/*! + * \internal + * \brief Get readable string for whether specified flags are set + * + * \param[in] flag_group Group of flags to check + * \param[in] flags Which flags in \p flag_group should be checked + * + * \return "true" if all \p flags are set in \p flag_group, otherwise "false" + */ +static inline const char * +pcmk__flag_text(uint64_t flag_group, uint64_t flags) +{ + return pcmk__btoa(pcmk__all_flags_set(flag_group, flags)); +} + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_FLAGS_INTERNAL__H diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 833b7a1fb23..e42b5a2b23a 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,7 +10,6 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include // PRIx64 #include // bool #include // uint8_t, uint64_t #include // pid_t, uid_t, gid_t @@ -18,12 +17,11 @@ #include // guint, GList, GHashTable -#include // do_crm_log_unlikely(), etc. - #include #include #include #include +#include #include #include #include @@ -89,144 +87,6 @@ bool pcmk__throttle_load_avg(float *load); int pcmk__pid_active(pid_t pid, const char *daemon); -// bitwise arithmetic utilities - -/*! - * \internal - * \brief Set specified flags in a flag group - * - * \param[in] function Function name of caller - * \param[in] line Line number of caller - * \param[in] log_level Log a message at this level - * \param[in] flag_type Label describing this flag group (for logging) - * \param[in] target Name of object whose flags these are (for logging) - * \param[in] flag_group Flag group being manipulated - * \param[in] flags Which flags in the group should be set - * \param[in] flags_str Readable equivalent of \p flags (for logging) - * - * \return Possibly modified flag group - */ -static inline uint64_t -pcmk__set_flags_as(const char *function, int line, uint8_t log_level, - const char *flag_type, const char *target, - uint64_t flag_group, uint64_t flags, const char *flags_str) -{ - uint64_t result = flag_group | flags; - - if (result != flag_group) { - do_crm_log_unlikely(log_level, - "%s flags %#.8" PRIx64 " (%s) for %s set by %s:%d", - pcmk__s(flag_type, "Group of"), flags, - pcmk__s(flags_str, "flags"), - pcmk__s(target, "target"), function, line); - } - return result; -} - -/*! - * \internal - * \brief Clear specified flags in a flag group - * - * \param[in] function Function name of caller - * \param[in] line Line number of caller - * \param[in] log_level Log a message at this level - * \param[in] flag_type Label describing this flag group (for logging) - * \param[in] target Name of object whose flags these are (for logging) - * \param[in] flag_group Flag group being manipulated - * \param[in] flags Which flags in the group should be cleared - * \param[in] flags_str Readable equivalent of \p flags (for logging) - * - * \return Possibly modified flag group - */ -static inline uint64_t -pcmk__clear_flags_as(const char *function, int line, uint8_t log_level, - const char *flag_type, const char *target, - uint64_t flag_group, uint64_t flags, const char *flags_str) -{ - uint64_t result = flag_group & ~flags; - - if (result != flag_group) { - do_crm_log_unlikely(log_level, - "%s flags %#.8" PRIx64 - " (%s) for %s cleared by %s:%d", - pcmk__s(flag_type, "Group of"), flags, - pcmk__s(flags_str, "flags"), - pcmk__s(target, "target"), function, line); - } - return result; -} - -/*! - * \internal - * \brief Check whether any of specified flags are set in a flag group - * - * \param[in] flag_group Flag group to check whether \p flags_to_check are - * set - * \param[in] flags_to_check Flags to check whether set in \p flag_group - * - * \retval \c true if \p flags_to_check is nonzero and any of its flags are - * set in \p flag_group - * \retval \c false otherwise - */ -static inline bool -pcmk__any_flags_set(uint64_t flag_group, uint64_t flags_to_check) -{ - return (flag_group & flags_to_check) != 0; -} - -/*! - * \internal - * \brief Check whether all of specified flags are set in a flag group - * - * \param[in] flag_group Flag group to check whether \p flags_to_check are - * set - * \param[in] flags_to_check Flags to check whether set in \p flag_group - * - * \retval \c true if all flags in \p flags_to_check are set in \p flag_group - * or if \p flags_to_check is 0 - * \retval \c false otherwise - */ -static inline bool -pcmk__all_flags_set(uint64_t flag_group, uint64_t flags_to_check) -{ - return (flag_group & flags_to_check) == flags_to_check; -} - -/*! - * \internal - * \brief Convenience alias for \c pcmk__all_flags_set(), to check single flag - * - * This is truly identical to \c pcmk__all_flags_set() but allows a call that's - * shorter and semantically clearer for checking a single flag. - * - * \param[in] flag_group Flag group (check whether \p flag is set in this) - * \param[in] flag Flag (check whether this is set in \p flag_group) - * - * \retval \c true if \p flag is set in \p flag_group or if \p flag is 0 - * \retval \c false otherwise - */ -static inline bool -pcmk__is_set(uint64_t flag_group, uint64_t flag) -{ - return pcmk__all_flags_set(flag_group, flag); -} - -/*! - * \internal - * \brief Get readable string for whether specified flags are set - * - * \param[in] flag_group Group of flags to check - * \param[in] flags Which flags in \p flag_group should be checked - * - * \return "true" if all \p flags are set in \p flag_group, otherwise "false" - */ -static inline const char * -pcmk__flag_text(uint64_t flag_group, uint64_t flags) -{ - return pcmk__btoa(pcmk__all_flags_set(flag_group, flags)); -} - - // miscellaneous utilities (from utils.c) int pcmk__compare_versions(const char *version1, const char *version2); From e540f550992082ba0dfd8e32ae61698db0b41b63 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:34:54 -0500 Subject: [PATCH 08/22] Refactor: include: Add memory_internal.h. This provides a place for internal memory related functions from crm/common/internal.h to be moved to. I've also moved pcmk__mem_assert from results_internal.h to this file since it feels memory related, but I've left pcmk__assert and pcmk__abort_as. Those don't really belong in that file, but I can't think of anywhere else to put them at the moment. Ref T777 --- include/crm/common/internal.h | 72 +--------------- include/crm/common/memory_internal.h | 118 ++++++++++++++++++++++++++ include/crm/common/results_internal.h | 17 ---- 3 files changed, 119 insertions(+), 88 deletions(-) create mode 100644 include/crm/common/memory_internal.h diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index e42b5a2b23a..38cf366d335 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -103,77 +104,6 @@ extern int pcmk__score_red; extern int pcmk__score_green; extern int pcmk__score_yellow; -/*! - * \internal - * \brief Allocate new zero-initialized memory, asserting on failure - * - * \param[in] file File where \p function is located - * \param[in] function Calling function - * \param[in] line Line within \p file - * \param[in] nmemb Number of elements to allocate memory for - * \param[in] size Size of each element - * - * \return Newly allocated memory of of size nmemb * size (guaranteed - * not to be \c NULL) - * - * \note The caller is responsible for freeing the return value using \c free(). - */ -static inline void * -pcmk__assert_alloc_as(const char *file, const char *function, uint32_t line, - size_t nmemb, size_t size) -{ - void *ptr = calloc(nmemb, size); - - if (ptr == NULL) { - crm_abort(file, function, line, "Out of memory", FALSE, TRUE); - crm_exit(CRM_EX_OSERR); - } - return ptr; -} - -/*! - * \internal - * \brief Allocate new zero-initialized memory, asserting on failure - * - * \param[in] nmemb Number of elements to allocate memory for - * \param[in] size Size of each element - * - * \return Newly allocated memory of of size nmemb * size (guaranteed - * not to be \c NULL) - * - * \note The caller is responsible for freeing the return value using \c free(). - */ -#define pcmk__assert_alloc(nmemb, size) \ - pcmk__assert_alloc_as(__FILE__, __func__, __LINE__, nmemb, size) - -/*! - * \internal - * \brief Resize a dynamically allocated memory block - * - * \param[in] ptr Memory block to resize (or NULL to allocate new memory) - * \param[in] size New size of memory block in bytes (must be > 0) - * - * \return Pointer to resized memory block - * - * \note This asserts on error, so the result is guaranteed to be non-NULL - * (which is the main advantage of this over directly using realloc()). - */ -static inline void * -pcmk__realloc(void *ptr, size_t size) -{ - void *new_ptr; - - // realloc(p, 0) can replace free(p) but this wrapper can't - pcmk__assert(size > 0); - - new_ptr = realloc(ptr, size); - if (new_ptr == NULL) { - free(ptr); - abort(); - } - return new_ptr; -} - static inline char * pcmk__getpid_s(void) { diff --git a/include/crm/common/memory_internal.h b/include/crm/common/memory_internal.h new file mode 100644 index 00000000000..fd204992551 --- /dev/null +++ b/include/crm/common/memory_internal.h @@ -0,0 +1,118 @@ +/* + * Copyright 2015-2025 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_MEMORY_INTERNAL__H +#define PCMK__CRM_COMMON_MEMORY_INTERNAL__H + +#include // size_t +#include // uint32_t +#include // abort, calloc, free, realloc + +#include // FALSE, TRUE + +#include // CRM_EX_OSERR, crm_abort, crm_exit +#include // pcmk__assert + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \internal + * \brief Abort without dumping core if a pointer is \c NULL + * + * This is intended to check for memory allocation failure, rather than for null + * pointers in general. + * + * \param[in] ptr Pointer to check + */ +#define pcmk__mem_assert(ptr) do { \ + if ((ptr) == NULL) { \ + crm_abort(__FILE__, __func__, __LINE__, "Out of memory", FALSE, \ + TRUE); \ + crm_exit(CRM_EX_OSERR); \ + } \ + } while (0) + +/*! + * \internal + * \brief Allocate new zero-initialized memory, asserting on failure + * + * \param[in] file File where \p function is located + * \param[in] function Calling function + * \param[in] line Line within \p file + * \param[in] nmemb Number of elements to allocate memory for + * \param[in] size Size of each element + * + * \return Newly allocated memory of of size nmemb * size (guaranteed + * not to be \c NULL) + * + * \note The caller is responsible for freeing the return value using \c free(). + */ +static inline void * +pcmk__assert_alloc_as(const char *file, const char *function, uint32_t line, + size_t nmemb, size_t size) +{ + void *ptr = calloc(nmemb, size); + + if (ptr == NULL) { + crm_abort(file, function, line, "Out of memory", FALSE, TRUE); + crm_exit(CRM_EX_OSERR); + } + return ptr; +} + +/*! + * \internal + * \brief Allocate new zero-initialized memory, asserting on failure + * + * \param[in] nmemb Number of elements to allocate memory for + * \param[in] size Size of each element + * + * \return Newly allocated memory of of size nmemb * size (guaranteed + * not to be \c NULL) + * + * \note The caller is responsible for freeing the return value using \c free(). + */ +#define pcmk__assert_alloc(nmemb, size) \ + pcmk__assert_alloc_as(__FILE__, __func__, __LINE__, nmemb, size) + +/*! + * \internal + * \brief Resize a dynamically allocated memory block + * + * \param[in] ptr Memory block to resize (or NULL to allocate new memory) + * \param[in] size New size of memory block in bytes (must be > 0) + * + * \return Pointer to resized memory block + * + * \note This asserts on error, so the result is guaranteed to be non-NULL + * (which is the main advantage of this over directly using realloc()). + */ +static inline void * +pcmk__realloc(void *ptr, size_t size) +{ + void *new_ptr; + + // realloc(p, 0) can replace free(p) but this wrapper can't + pcmk__assert(size > 0); + + new_ptr = realloc(ptr, size); + if (new_ptr == NULL) { + free(ptr); + abort(); + } + return new_ptr; +} + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_MEMORY_INTERNAL__H diff --git a/include/crm/common/results_internal.h b/include/crm/common/results_internal.h index 99e89269903..1032644b214 100644 --- a/include/crm/common/results_internal.h +++ b/include/crm/common/results_internal.h @@ -33,23 +33,6 @@ _Noreturn void pcmk__abort_as(const char *file, const char *function, int line, } \ } while(0) -/*! - * \internal - * \brief Abort without dumping core if a pointer is \c NULL - * - * This is intended to check for memory allocation failure, rather than for null - * pointers in general. - * - * \param[in] ptr Pointer to check - */ -#define pcmk__mem_assert(ptr) do { \ - if ((ptr) == NULL) { \ - crm_abort(__FILE__, __func__, __LINE__, "Out of memory", FALSE, \ - TRUE); \ - crm_exit(CRM_EX_OSERR); \ - } \ - } while (0) - /* Error domains for use with g_set_error */ GQuark pcmk__rc_error_quark(void); From fa7c46aef6e69b96cb504aa1a99583d117755f2b Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:52:50 -0500 Subject: [PATCH 09/22] Refactor: include: Add procfs_internal.h. This provides a place for internal procfs-related functions from crm/common/internal.h to be moved to. Ref T777 --- include/crm/common/internal.h | 12 +--------- include/crm/common/procfs_internal.h | 34 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 include/crm/common/procfs_internal.h diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 38cf366d335..540139f04eb 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include // pcmk__assert_asprintf() @@ -56,17 +57,6 @@ int pcmk__substitute_secrets(const char *rsc_id, GHashTable *params); #endif -/* internal procfs utilities (from procfs.c) */ - -pid_t pcmk__procfs_pid_of(const char *name); -unsigned int pcmk__procfs_num_cores(void); -int pcmk__procfs_pid2path(pid_t pid, char **path); -bool pcmk__procfs_has_pids(void); -DIR *pcmk__procfs_fd_dir(void); -void pcmk__sysrq_trigger(char t); -bool pcmk__throttle_cib_load(const char *server, float *load); -bool pcmk__throttle_load_avg(float *load); - /* internal functions related to process IDs (from pid.c) */ /*! diff --git a/include/crm/common/procfs_internal.h b/include/crm/common/procfs_internal.h new file mode 100644 index 00000000000..09d8dcee3a9 --- /dev/null +++ b/include/crm/common/procfs_internal.h @@ -0,0 +1,34 @@ +/* + * Copyright 2015-2025 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_PROCFS_INTERNAL__H +#define PCMK__CRM_COMMON_PROCFS_INTERNAL__H + +#include // DIR +#include // bool +#include // pid_t + +#ifdef __cplusplus +extern "C" { +#endif + +pid_t pcmk__procfs_pid_of(const char *name); +unsigned int pcmk__procfs_num_cores(void); +int pcmk__procfs_pid2path(pid_t pid, char **path); +bool pcmk__procfs_has_pids(void); +DIR *pcmk__procfs_fd_dir(void); +void pcmk__sysrq_trigger(char t); +bool pcmk__throttle_cib_load(const char *server, float *load); +bool pcmk__throttle_load_avg(float *load); + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_PROCFS_INTERNAL__H From ced91bab17fac4b2790ef9d5c3ab3f4d1d036121 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:55:55 -0500 Subject: [PATCH 10/22] Refactor: include: Move score-related variables out of internal.h. ...and into scores_internal.h where they belong. Ref T777 --- include/crm/common/internal.h | 4 ---- include/crm/common/scores_internal.h | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 540139f04eb..d42ca07baf3 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -90,10 +90,6 @@ void pcmk__sleep_ms(unsigned int ms); guint pcmk__create_timer(guint interval_ms, GSourceFunc fn, gpointer data); guint pcmk__timeout_ms2s(guint timeout_ms); -extern int pcmk__score_red; -extern int pcmk__score_green; -extern int pcmk__score_yellow; - static inline char * pcmk__getpid_s(void) { diff --git a/include/crm/common/scores_internal.h b/include/crm/common/scores_internal.h index 9bf291c579a..6bddc3a1157 100644 --- a/include/crm/common/scores_internal.h +++ b/include/crm/common/scores_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the Pacemaker project contributors + * Copyright 2022-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -14,6 +14,10 @@ extern "C" { #endif +extern int pcmk__score_red; +extern int pcmk__score_green; +extern int pcmk__score_yellow; + int pcmk__add_scores(int score1, int score2); #ifdef __cplusplus From b8ee42917f4baab236566628a457965276ce0003 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 12:59:53 -0500 Subject: [PATCH 11/22] Refactor: include: Move list-related functions out of internal.h. ...and into lists_internal.h where they belong. Ref T777 --- include/crm/common/internal.h | 18 ++---------------- include/crm/common/lists_internal.h | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index d42ca07baf3..c21d1247795 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,12 +10,11 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include // bool #include // uint8_t, uint64_t #include // pid_t, uid_t, gid_t #include // getpid() -#include // guint, GList, GHashTable +#include // guint, GHashTable #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -96,20 +96,6 @@ pcmk__getpid_s(void) return pcmk__assert_asprintf("%lu", (unsigned long) getpid()); } -// More efficient than g_list_length(list) == 1 -static inline bool -pcmk__list_of_1(GList *list) -{ - return list && (list->next == NULL); -} - -// More efficient than g_list_length(list) > 1 -static inline bool -pcmk__list_of_multiple(GList *list) -{ - return list && (list->next != NULL); -} - /* convenience functions for failure-related node attributes */ #define PCMK__FAIL_COUNT_PREFIX "fail-count" diff --git a/include/crm/common/lists_internal.h b/include/crm/common/lists_internal.h index 8a61007c5d5..29bb22806f9 100644 --- a/include/crm/common/lists_internal.h +++ b/include/crm/common/lists_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 the Pacemaker project contributors + * Copyright 2020-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -10,7 +10,9 @@ #ifndef PCMK__CRM_COMMON_LISTS_INTERNAL__H #define PCMK__CRM_COMMON_LISTS_INTERNAL__H -#include +#include // bool + +#include // GCompareFunc, GList #ifdef __cplusplus extern "C" { @@ -26,8 +28,21 @@ extern "C" { * * \return Newly allocated list */ -GList *pcmk__subtract_lists(GList *from, const GList *items, - GCompareFunc cmp); +GList *pcmk__subtract_lists(GList *from, const GList *items, GCompareFunc cmp); + +// More efficient than g_list_length(list) == 1 +static inline bool +pcmk__list_of_1(GList *list) +{ + return list && (list->next == NULL); +} + +// More efficient than g_list_length(list) > 1 +static inline bool +pcmk__list_of_multiple(GList *list) +{ + return list && (list->next != NULL); +} #ifdef __cplusplus } From b8d795670d1c5fedd30b0df4f102c4cfb2de7056 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 13:08:35 -0500 Subject: [PATCH 12/22] Refactor: include: Add utils_internal.h. This provides a place for internal miscellaneous functions from crm/common/internal.h to be moved to. I kind of hate ever having a file named utils, but this lines up with the C file in lib/common/. Ref T777 --- include/crm/common/internal.h | 17 ++------------ include/crm/common/utils_internal.h | 35 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 include/crm/common/utils_internal.h diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index c21d1247795..24c041eaf43 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,8 +10,7 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include // uint8_t, uint64_t -#include // pid_t, uid_t, gid_t +#include // pid_t, uid_t #include // getpid() #include // guint, GHashTable @@ -33,6 +32,7 @@ #include #include #include // pcmk__assert_asprintf() +#include #ifdef __cplusplus extern "C" { @@ -77,19 +77,6 @@ int pcmk__substitute_secrets(const char *rsc_id, GHashTable *params); */ int pcmk__pid_active(pid_t pid, const char *daemon); - -// miscellaneous utilities (from utils.c) - -int pcmk__compare_versions(const char *version1, const char *version2); -int pcmk__daemon_user(uid_t *uid, gid_t *gid); -char *pcmk__generate_uuid(void); -int pcmk__lookup_user(const char *name, uid_t *uid, gid_t *gid); -void pcmk__panic(const char *reason); -pid_t pcmk__locate_sbd(void); -void pcmk__sleep_ms(unsigned int ms); -guint pcmk__create_timer(guint interval_ms, GSourceFunc fn, gpointer data); -guint pcmk__timeout_ms2s(guint timeout_ms); - static inline char * pcmk__getpid_s(void) { diff --git a/include/crm/common/utils_internal.h b/include/crm/common/utils_internal.h new file mode 100644 index 00000000000..6db14cd78fa --- /dev/null +++ b/include/crm/common/utils_internal.h @@ -0,0 +1,35 @@ +/* + * Copyright 2015-2025 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_UTILS_INTERNAL__H +#define PCMK__CRM_COMMON_UTILS_INTERNAL__H + +#include // pid_t, uid_t, gid_t + +#include // GSourceFunc, gpointer, guint + +#ifdef __cplusplus +extern "C" { +#endif + +int pcmk__compare_versions(const char *version1, const char *version2); +int pcmk__daemon_user(uid_t *uid, gid_t *gid); +char *pcmk__generate_uuid(void); +int pcmk__lookup_user(const char *name, uid_t *uid, gid_t *gid); +void pcmk__panic(const char *reason); +pid_t pcmk__locate_sbd(void); +void pcmk__sleep_ms(unsigned int ms); +guint pcmk__create_timer(guint interval_ms, GSourceFunc fn, gpointer data); +guint pcmk__timeout_ms2s(guint timeout_ms); + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_UTILS_INTERNAL__H From 45ccd34ed34bb815eef7eae10a3e3376464f20ed Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 13:17:35 -0500 Subject: [PATCH 13/22] Refactor: include: Add pid_internal.h. This provides a place for internal process-related functions from crm/common/internal.h to be moved to. Ref T777 --- include/crm/common/internal.h | 32 ++------------------ include/crm/common/pid_internal.h | 50 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 30 deletions(-) create mode 100644 include/crm/common/pid_internal.h diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 24c041eaf43..55e4ce0f666 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,9 +10,6 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include // pid_t, uid_t -#include // getpid() - #include // guint, GHashTable #include @@ -28,10 +25,11 @@ #include #include #include +#include #include #include #include -#include // pcmk__assert_asprintf() +#include #include #ifdef __cplusplus @@ -57,32 +55,6 @@ int pcmk__substitute_secrets(const char *rsc_id, GHashTable *params); #endif -/* internal functions related to process IDs (from pid.c) */ - -/*! - * \internal - * \brief Check whether process exists (by PID and optionally executable path) - * - * \param[in] pid PID of process to check - * \param[in] daemon If not NULL, path component to match with procfs entry - * - * \return Standard Pacemaker return code - * \note Particular return codes of interest include pcmk_rc_ok for alive, - * ESRCH for process is not alive (verified by kill and/or executable path - * match), EACCES for caller unable or not allowed to check. A result of - * "alive" is less reliable when \p daemon is not provided or procfs is - * not available, since there is no guarantee that the PID has not been - * recycled for another process. - * \note This function cannot be used to verify \e authenticity of the process. - */ -int pcmk__pid_active(pid_t pid, const char *daemon); - -static inline char * -pcmk__getpid_s(void) -{ - return pcmk__assert_asprintf("%lu", (unsigned long) getpid()); -} - /* convenience functions for failure-related node attributes */ #define PCMK__FAIL_COUNT_PREFIX "fail-count" diff --git a/include/crm/common/pid_internal.h b/include/crm/common/pid_internal.h new file mode 100644 index 00000000000..d31331259d4 --- /dev/null +++ b/include/crm/common/pid_internal.h @@ -0,0 +1,50 @@ +/* + * Copyright 2015-2025 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_PID_INTERNAL__H +#define PCMK__CRM_COMMON_PID_INTERNAL__H + +#include // pid_t +#include // getpid() + +#include // pcmk__assert_asprintf + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \internal + * \brief Check whether process exists (by PID and optionally executable path) + * + * \param[in] pid PID of process to check + * \param[in] daemon If not NULL, path component to match with procfs entry + * + * \return Standard Pacemaker return code + * \note Particular return codes of interest include pcmk_rc_ok for alive, + * ESRCH for process is not alive (verified by kill and/or executable path + * match), EACCES for caller unable or not allowed to check. A result of + * "alive" is less reliable when \p daemon is not provided or procfs is + * not available, since there is no guarantee that the PID has not been + * recycled for another process. + * \note This function cannot be used to verify \e authenticity of the process. + */ +int pcmk__pid_active(pid_t pid, const char *daemon); + +static inline char * +pcmk__getpid_s(void) +{ + return pcmk__assert_asprintf("%lu", (unsigned long) getpid()); +} + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_PID_INTERNAL__H From 193ab74037e91001d01462df8d9bc1874480807b Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 13:25:03 -0500 Subject: [PATCH 14/22] Refactor: include: Move failure-related functions out of internal.h. ...and into failcounts_internal.h where they belong. Additionally, logging.h needs to include results.h because CRM_CHECK uses crm_abort. It would be worth going through all these header files and make sure they include everything they need, but that's a project for a different day. Ref T777 --- include/crm/common/failcounts_internal.h | 50 +++++++++++++++++++++++- include/crm/common/internal.h | 49 +---------------------- include/crm/common/logging.h | 2 + 3 files changed, 53 insertions(+), 48 deletions(-) diff --git a/include/crm/common/failcounts_internal.h b/include/crm/common/failcounts_internal.h index f7df81e9196..d1e7ee0a106 100644 --- a/include/crm/common/failcounts_internal.h +++ b/include/crm/common/failcounts_internal.h @@ -10,7 +10,12 @@ #ifndef PCMK__CRM_COMMON_FAILCOUNTS_INTERNAL__H #define PCMK__CRM_COMMON_FAILCOUNTS_INTERNAL__H -#include // UINT32_C +#include // UINT32_C + +#include // guint + +#include // CRM_CHECK +#include // pcmk__assert_asprintf #ifdef __cplusplus extern "C" { @@ -30,6 +35,49 @@ enum pcmk__fc_flags { pcmk__fc_launched = (UINT32_C(1) << 2), }; +#define PCMK__FAIL_COUNT_PREFIX "fail-count" +#define PCMK__LAST_FAILURE_PREFIX "last-failure" + +/*! + * \internal + * \brief Generate a failure-related node attribute name for a resource + * + * \param[in] prefix Start of attribute name + * \param[in] rsc_id Resource name + * \param[in] op Operation name + * \param[in] interval_ms Operation interval + * + * \return Newly allocated string with attribute name + * + * \note Failure attributes are named like PREFIX-RSC#OP_INTERVAL (for example, + * "fail-count-myrsc#monitor_30000"). The '#' is used because it is not + * a valid character in a resource ID, to reliably distinguish where the + * operation name begins. The '_' is used simply to be more comparable to + * action labels like "myrsc_monitor_30000". + */ +static inline char * +pcmk__fail_attr_name(const char *prefix, const char *rsc_id, const char *op, + guint interval_ms) +{ + CRM_CHECK(prefix && rsc_id && op, return NULL); + return pcmk__assert_asprintf("%s-%s#%s_%u", prefix, rsc_id, op, + interval_ms); +} + +static inline char * +pcmk__failcount_name(const char *rsc_id, const char *op, guint interval_ms) +{ + return pcmk__fail_attr_name(PCMK__FAIL_COUNT_PREFIX, rsc_id, op, + interval_ms); +} + +static inline char * +pcmk__lastfailure_name(const char *rsc_id, const char *op, guint interval_ms) +{ + return pcmk__fail_attr_name(PCMK__LAST_FAILURE_PREFIX, rsc_id, op, + interval_ms); +} + #ifdef __cplusplus } #endif diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 55e4ce0f666..1a13a734c08 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,12 +10,13 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include // guint, GHashTable +#include // GHashTable #include #include #include #include +#include #include #include #include @@ -54,52 +55,6 @@ extern bool pcmk__is_daemon; int pcmk__substitute_secrets(const char *rsc_id, GHashTable *params); #endif - -/* convenience functions for failure-related node attributes */ - -#define PCMK__FAIL_COUNT_PREFIX "fail-count" -#define PCMK__LAST_FAILURE_PREFIX "last-failure" - -/*! - * \internal - * \brief Generate a failure-related node attribute name for a resource - * - * \param[in] prefix Start of attribute name - * \param[in] rsc_id Resource name - * \param[in] op Operation name - * \param[in] interval_ms Operation interval - * - * \return Newly allocated string with attribute name - * - * \note Failure attributes are named like PREFIX-RSC#OP_INTERVAL (for example, - * "fail-count-myrsc#monitor_30000"). The '#' is used because it is not - * a valid character in a resource ID, to reliably distinguish where the - * operation name begins. The '_' is used simply to be more comparable to - * action labels like "myrsc_monitor_30000". - */ -static inline char * -pcmk__fail_attr_name(const char *prefix, const char *rsc_id, const char *op, - guint interval_ms) -{ - CRM_CHECK(prefix && rsc_id && op, return NULL); - return pcmk__assert_asprintf("%s-%s#%s_%u", prefix, rsc_id, op, - interval_ms); -} - -static inline char * -pcmk__failcount_name(const char *rsc_id, const char *op, guint interval_ms) -{ - return pcmk__fail_attr_name(PCMK__FAIL_COUNT_PREFIX, rsc_id, op, - interval_ms); -} - -static inline char * -pcmk__lastfailure_name(const char *rsc_id, const char *op, guint interval_ms) -{ - return pcmk__fail_attr_name(PCMK__LAST_FAILURE_PREFIX, rsc_id, op, - interval_ms); -} - #ifdef __cplusplus } #endif diff --git a/include/crm/common/logging.h b/include/crm/common/logging.h index 4f5dcf525ca..2e49d85107e 100644 --- a/include/crm/common/logging.h +++ b/include/crm/common/logging.h @@ -16,6 +16,8 @@ #include // LOG_TRACE, qb_*, QB_* #include +#include // crm_abort + #ifdef __cplusplus extern "C" { #endif From f9caed06b526d045af6781a143a369144c432f16 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 13:39:58 -0500 Subject: [PATCH 15/22] Refactor: include: Add cib_secrets_internal.h. This provides a place for internal cibsecrets-related functions from crm/common/internal.h to be moved to. Ref T777 --- include/crm/common/cib_secrets_internal.h | 27 +++++++++++++++++++++++ include/crm/common/internal.h | 9 +------- 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 include/crm/common/cib_secrets_internal.h diff --git a/include/crm/common/cib_secrets_internal.h b/include/crm/common/cib_secrets_internal.h new file mode 100644 index 00000000000..268628ca664 --- /dev/null +++ b/include/crm/common/cib_secrets_internal.h @@ -0,0 +1,27 @@ +/* + * Copyright 2015-2025 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * + * This source code is licensed under the GNU Lesser General Public License + * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. + */ + +#ifndef PCMK__CRM_COMMON_CIB_SECRETS_INTERNAL__H +#define PCMK__CRM_COMMON_CIB_SECRETS_INTERNAL__H + +#include // GHashTable + +#ifdef __cplusplus +extern "C" { +#endif + +#if PCMK__ENABLE_CIBSECRETS +int pcmk__substitute_secrets(const char *rsc_id, GHashTable *params); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // PCMK__CRM_COMMON_CIB_SECRETS_INTERNAL__H diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 1a13a734c08..72277cb3c6d 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,11 +10,10 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include // GHashTable - #include #include #include +#include #include #include #include @@ -49,12 +48,6 @@ extern bool pcmk__is_daemon; // Number of elements in a statically defined array #define PCMK__NELEM(a) ((int) (sizeof(a)/sizeof(a[0])) ) -#if PCMK__ENABLE_CIBSECRETS -/* internal CIB utilities (from cib_secrets.c) */ - -int pcmk__substitute_secrets(const char *rsc_id, GHashTable *params); -#endif - #ifdef __cplusplus } #endif From c19486528b3e98a1e888517f2e26c9144332f4e8 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 13:41:00 -0500 Subject: [PATCH 16/22] Refactor: include: Move pcmk__is_daemon into logging_internal.h. It's defined in logging.c in libcrmcommon, so this is a natural place for the extern line to go. Ref T777 --- include/crm/common/internal.h | 10 +--------- include/crm/common/logging_internal.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 72277cb3c6d..42340ed6f1b 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -36,15 +37,6 @@ extern "C" { #endif -/* This says whether the current application is a Pacemaker daemon or not, - * and is used to change default logging settings such as whether to log to - * stderr, etc., as well as a few other details such as whether blackbox signal - * handling is enabled. - * - * It is set when logging is initialized, and does not need to be set directly. - */ -extern bool pcmk__is_daemon; - // Number of elements in a statically defined array #define PCMK__NELEM(a) ((int) (sizeof(a)/sizeof(a[0])) ) diff --git a/include/crm/common/logging_internal.h b/include/crm/common/logging_internal.h index 0676d5871bf..d22468d9389 100644 --- a/include/crm/common/logging_internal.h +++ b/include/crm/common/logging_internal.h @@ -16,7 +16,7 @@ #include #include // LOG_TRACE, qb_* -#include // pcmk__is_set() +#include // pcmk__is_set() #include #include @@ -240,6 +240,15 @@ extern void *pcmk__config_warning_context; void pcmk__set_config_error_handler(pcmk__config_error_func error_handler, void *error_context); void pcmk__set_config_warning_handler(pcmk__config_warning_func warning_handler, void *warning_context); +/* This says whether the current application is a Pacemaker daemon or not, + * and is used to change default logging settings such as whether to log to + * stderr, etc., as well as a few other details such as whether blackbox signal + * handling is enabled. + * + * It is set when logging is initialized, and does not need to be set directly. + */ +extern bool pcmk__is_daemon; + /* Pacemaker library functions set this when a configuration error is found, * which turns on extra messages at the end of processing. */ From ee1f39f72509f3d26405ec155fa09423ed5edd11 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 13:50:39 -0500 Subject: [PATCH 17/22] Refactor: include: crm/common/internal.h now includes all internal headers. A couple of the subheaders need to be fixed to avoid the circular includes, but it's much better now than it was before all those previous patches to split things out of internal.h. I'm leaving PCMK__NELEM in here because I can't think of a better place for it (maybe utils_internal.h?) and it's not really doing any harm here. I've intentionally left out a couple headers: * unittest_internal.h - This is specific to unit testing and doesn't really have anything to do with public vs. private API. The _internal.h part of its name is mostly meant to make sure it's not included in the source distribution by Makefile.am * various XML headers - xml_internal.h is meant to wrap including all of those, so they don't need to be separately listed. Ref T777 --- include/crm/common/clone_internal.h | 2 +- include/crm/common/history_internal.h | 4 +-- include/crm/common/internal.h | 35 ++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/include/crm/common/clone_internal.h b/include/crm/common/clone_internal.h index 435de0b3cf6..6e0bf8ef3ec 100644 --- a/include/crm/common/clone_internal.h +++ b/include/crm/common/clone_internal.h @@ -14,7 +14,7 @@ #include // bool #include // UINT32_C -#include // pcmk__is_set() +#include // pcmk__is_set() #include // pcmk_resource_t #include // pcmk_rsc_unique, #include // pcmk__rsc_variant_clone etc. diff --git a/include/crm/common/history_internal.h b/include/crm/common/history_internal.h index 783e6d7f2a2..1385d23cb95 100644 --- a/include/crm/common/history_internal.h +++ b/include/crm/common/history_internal.h @@ -13,9 +13,9 @@ #include // NULL #include // xmlNode -#include // pcmk__str_empty() +#include // pcmk__str_empty() #include // pcmk__xe_id() -#include // PCMK__XA_OPERATION_KEY +#include // PCMK__XA_OPERATION_KEY #ifdef __cplusplus extern "C" { diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 42340ed6f1b..2ce9d1a5cc8 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,28 +10,61 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H -#include +#include #include #include +#include +#include +#include +#include +#include #include +#include +#include #include #include #include +#include #include +#include #include +#include +#include #include #include +#include #include #include #include #include +#include #include +#include +#include #include +#include #include +#include +#include #include +#include +#include +#include +#include #include +#include +// unittest_internal.h intentionally left out #include +#include +#include #include +// xml_comment_internal.h intentionally left out +// xml_element_internal.h intentionally left out +// xml_idref_internal.h intentionally left out +#include +// xml_io_internal.h intentionally left out +// xml_names_internal.h intentionally left out +// xpath_internal.h intentionally left out #ifdef __cplusplus extern "C" { From 63f4d5ab1a4c48b2576818c7d163495863cb0a71 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 14:21:46 -0500 Subject: [PATCH 18/22] Refactor: include: Simplify includes in crm_internal.h. Now that crm/common/internal.h includes all the private header files, crm_internal.h can include just that one. Ref T777 --- include/crm_internal.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/include/crm_internal.h b/include/crm_internal.h index 0aec87fe4e3..277fe824830 100644 --- a/include/crm_internal.h +++ b/include/crm_internal.h @@ -38,18 +38,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include From 8ce8c6d5dd60c0138fdef0d9d33a5c6fb7bdce5e Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 15:04:38 -0500 Subject: [PATCH 19/22] Refactor: include: Don't allow including internal libcrmcommon... ...headers directly. Instead of including any of the crm/common/*_internal.h headers, you should include the top-level crm/common/internal.h instead. And then fix the many, many places that were including these headers. Note that the #ifdef/#error/#endif blocks need to go above any of the multiple inclusion guards. This is because every file includes crm_internal.h first, which includes crm/common/internal.h, which includes all the internal headers, which causes the multilple inclusion guards to be set. Then when those internal headers are included directly later on, the guards will prevent the file from being included and also prevent the #error from happening. Ref T777 --- daemons/attrd/attrd_alerts.c | 2 -- daemons/attrd/attrd_attributes.c | 1 - daemons/attrd/attrd_cib.c | 1 - daemons/attrd/attrd_corosync.c | 1 - daemons/attrd/attrd_ipc.c | 3 --- daemons/attrd/attrd_messages.c | 1 - daemons/attrd/attrd_sync.c | 1 - daemons/attrd/attrd_utils.c | 1 - daemons/attrd/pacemaker-attrd.c | 4 ---- daemons/attrd/pacemaker-attrd.h | 2 +- daemons/based/based_callbacks.c | 1 - daemons/based/based_messages.c | 2 -- daemons/based/based_notify.c | 1 - daemons/based/based_remote.c | 3 --- daemons/based/pacemaker-based.c | 2 -- daemons/based/pacemaker-based.h | 2 +- daemons/controld/controld_alerts.c | 1 - daemons/controld/controld_attrd.c | 2 -- daemons/controld/controld_cib.c | 1 - daemons/controld/controld_control.c | 1 - daemons/controld/controld_fsa.h | 2 +- daemons/controld/controld_membership.c | 1 - daemons/controld/controld_messages.c | 1 - daemons/controld/controld_messages.h | 2 +- daemons/controld/controld_remote_ra.c | 1 - daemons/controld/controld_schedulerd.c | 1 - daemons/controld/controld_te_callbacks.c | 1 - daemons/controld/controld_te_events.c | 3 --- daemons/controld/pacemaker-controld.c | 2 -- daemons/execd/cts-exec-helper.c | 1 - daemons/execd/execd_alerts.c | 2 -- daemons/execd/execd_commands.c | 1 - daemons/execd/execd_messages.c | 2 -- daemons/execd/pacemaker-execd.c | 4 ---- daemons/execd/pacemaker-execd.h | 2 +- daemons/execd/remoted_proxy.c | 1 - daemons/execd/remoted_tls.c | 2 -- daemons/fenced/cts-fence-helper.c | 1 - daemons/fenced/fenced_commands.c | 1 - daemons/fenced/fenced_history.c | 2 -- daemons/fenced/fenced_remote.c | 2 -- daemons/fenced/pacemaker-fenced.c | 4 ---- include/crm/cib/internal.h | 5 +---- include/crm/common/acl_internal.h | 6 +++++- include/crm/common/action_relation_internal.h | 6 +++++- include/crm/common/actions_internal.h | 6 +++++- include/crm/common/agents_internal.h | 6 +++++- include/crm/common/alerts_internal.h | 6 +++++- include/crm/common/attrs_internal.h | 6 +++++- include/crm/common/bundles_internal.h | 6 +++++- include/crm/common/cib_internal.h | 6 +++++- include/crm/common/cib_secrets_internal.h | 6 +++++- include/crm/common/clone_internal.h | 6 +++++- include/crm/common/cmdline_internal.h | 6 +++++- include/crm/common/digest_internal.h | 6 +++++- include/crm/common/failcounts_internal.h | 6 +++++- include/crm/common/flags_internal.h | 6 +++++- include/crm/common/group_internal.h | 6 +++++- include/crm/common/health_internal.h | 6 +++++- include/crm/common/history_internal.h | 6 +++++- include/crm/common/internal.h | 4 ++++ include/crm/common/io_internal.h | 6 +++++- include/crm/common/ipc_attrd_internal.h | 6 +++++- include/crm/common/ipc_internal.h | 6 +++++- include/crm/common/iso8601_internal.h | 6 +++++- include/crm/common/lists_internal.h | 6 +++++- include/crm/common/location_internal.h | 6 +++++- include/crm/common/logging_internal.h | 6 +++++- include/crm/common/mainloop_internal.h | 6 +++++- include/crm/common/memory_internal.h | 6 +++++- include/crm/common/messages_internal.h | 6 +++++- include/crm/common/nodes_internal.h | 6 +++++- include/crm/common/nvpair_internal.h | 6 +++++- include/crm/common/options_internal.h | 6 +++++- include/crm/common/output_internal.h | 6 +++++- include/crm/common/pid_internal.h | 6 +++++- include/crm/common/primitive_internal.h | 6 +++++- include/crm/common/procfs_internal.h | 6 +++++- include/crm/common/remote_internal.h | 6 +++++- include/crm/common/resources_internal.h | 6 +++++- include/crm/common/results_internal.h | 6 +++++- include/crm/common/roles_internal.h | 6 +++++- include/crm/common/rules_internal.h | 6 +++++- include/crm/common/scheduler_internal.h | 7 ++++++- include/crm/common/schemas_internal.h | 6 +++++- include/crm/common/scores_internal.h | 6 +++++- include/crm/common/servers_internal.h | 6 +++++- include/crm/common/strings_internal.h | 6 +++++- include/crm/common/tickets_internal.h | 6 +++++- include/crm/common/tls_internal.h | 6 +++++- include/crm/common/utils_internal.h | 5 ++++- include/crm/common/xml_comment_internal.h | 6 +++++- include/crm/common/xml_element_internal.h | 6 +++++- include/crm/common/xml_idref_internal.h | 6 +++++- include/crm/common/xml_internal.h | 6 +++++- include/crm/common/xml_io_internal.h | 6 +++++- include/crm/common/xml_names_internal.h | 6 +++++- include/crm/common/xpath_internal.h | 6 +++++- include/crm/fencing/internal.h | 3 +-- include/crm/lrmd_internal.h | 4 +--- include/crm/pengine/internal.h | 3 --- include/crm/services_internal.h | 2 +- lib/cib/cib_attrs.c | 2 -- lib/cib/cib_file.c | 1 - lib/cib/cib_ops.c | 1 - lib/cib/cib_remote.c | 4 ---- lib/cib/cib_utils.c | 2 -- lib/cluster/corosync.c | 1 - lib/cluster/cpg.c | 1 - lib/cluster/membership.c | 1 - lib/common/acl.c | 1 - lib/common/actions.c | 1 - lib/common/alerts.c | 3 --- lib/common/attrs.c | 1 - lib/common/cib.c | 1 - lib/common/cmdline.c | 2 -- lib/common/crmcommon_private.h | 3 +-- lib/common/health.c | 1 - lib/common/ipc_attrd.c | 2 -- lib/common/ipc_client.c | 1 - lib/common/ipc_controld.c | 1 - lib/common/ipc_pacemakerd.c | 1 - lib/common/ipc_schedulerd.c | 1 - lib/common/ipc_server.c | 1 - lib/common/iso8601.c | 1 - lib/common/lists.c | 1 - lib/common/mainloop.c | 1 - lib/common/messages.c | 1 - lib/common/nvpair.c | 1 - lib/common/output_html.c | 1 - lib/common/output_log.c | 1 - lib/common/output_none.c | 1 - lib/common/output_text.c | 1 - lib/common/output_xml.c | 2 -- lib/common/patchset.c | 2 -- lib/common/remote.c | 3 --- lib/common/resources.c | 1 - lib/common/roles.c | 1 - lib/common/rules.c | 4 ---- lib/common/schemas.c | 1 - lib/common/tls.c | 2 -- lib/common/xml.c | 1 - lib/common/xml_attr.c | 1 - lib/common/xml_display.c | 1 - lib/common/xpath.c | 1 - lib/fencing/st_output.c | 2 -- lib/lrmd/lrmd_alerts.c | 1 - lib/lrmd/lrmd_client.c | 3 --- lib/lrmd/lrmd_output.c | 1 - lib/pacemaker/libpacemaker_private.h | 2 +- lib/pacemaker/pcmk_acl.c | 1 - lib/pacemaker/pcmk_cluster_queries.c | 2 -- lib/pacemaker/pcmk_graph_consumer.c | 1 - lib/pacemaker/pcmk_injections.c | 1 - lib/pacemaker/pcmk_resource.c | 1 - lib/pacemaker/pcmk_sched_actions.c | 1 - lib/pacemaker/pcmk_sched_colocation.c | 6 ++---- lib/pacemaker/pcmk_sched_constraints.c | 1 - lib/pacemaker/pcmk_sched_location.c | 1 - lib/pacemaker/pcmk_sched_nodes.c | 1 - lib/pacemaker/pcmk_sched_recurring.c | 1 - lib/pacemaker/pcmk_sched_remote.c | 1 - lib/pacemaker/pcmk_sched_tickets.c | 1 - lib/pacemaker/pcmk_scheduler.c | 2 -- lib/pengine/bundle.c | 1 - lib/pengine/clone.c | 2 -- lib/pengine/complex.c | 2 -- lib/pengine/group.c | 2 -- lib/pengine/pe_actions.c | 2 -- lib/pengine/pe_digest.c | 1 - lib/pengine/pe_output.c | 2 -- lib/pengine/pe_status_private.h | 2 +- lib/pengine/remote.c | 1 - lib/pengine/rules_compat.c | 1 - lib/pengine/status.c | 1 - lib/pengine/unpack.c | 1 - tools/attrd_updater.c | 6 ------ tools/cibadmin.c | 1 - tools/crm_attribute.c | 4 ---- tools/crm_error.c | 3 --- tools/crm_mon.c | 3 --- tools/crm_mon.h | 2 +- tools/crm_mon_curses.c | 1 - tools/crm_node.c | 3 --- tools/crm_resource.c | 3 --- tools/crm_resource.h | 12 ++++-------- tools/crm_resource_print.c | 1 - tools/crm_resource_runtime.c | 2 -- tools/crm_rule.c | 2 -- tools/crm_shadow.c | 2 -- tools/crm_simulate.c | 2 -- tools/crm_ticket.c | 1 - tools/crm_verify.c | 2 -- tools/crmadmin.c | 3 --- tools/iso8601.c | 1 - tools/stonith_admin.c | 2 -- 196 files changed, 293 insertions(+), 290 deletions(-) diff --git a/daemons/attrd/attrd_alerts.c b/daemons/attrd/attrd_alerts.c index 9ee8738bc3c..3324e66a5aa 100644 --- a/daemons/attrd/attrd_alerts.c +++ b/daemons/attrd/attrd_alerts.c @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include #include "pacemaker-attrd.h" diff --git a/daemons/attrd/attrd_attributes.c b/daemons/attrd/attrd_attributes.c index a4864ca65b4..42960dee2b5 100644 --- a/daemons/attrd/attrd_attributes.c +++ b/daemons/attrd/attrd_attributes.c @@ -16,7 +16,6 @@ #include #include -#include #include #include "pacemaker-attrd.h" diff --git a/daemons/attrd/attrd_cib.c b/daemons/attrd/attrd_cib.c index d63aacaa067..d4adfd48549 100644 --- a/daemons/attrd/attrd_cib.c +++ b/daemons/attrd/attrd_cib.c @@ -17,7 +17,6 @@ #include // cib__* #include #include -#include #include #include // pcmk__get_node() diff --git a/daemons/attrd/attrd_corosync.c b/daemons/attrd/attrd_corosync.c index a9e8f41179f..11fca1a9bff 100644 --- a/daemons/attrd/attrd_corosync.c +++ b/daemons/attrd/attrd_corosync.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "pacemaker-attrd.h" diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c index 57b0450ee01..36f175e545f 100644 --- a/daemons/attrd/attrd_ipc.c +++ b/daemons/attrd/attrd_ipc.c @@ -18,11 +18,8 @@ #include #include -#include -#include #include #include -#include #include #include diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c index b367b585df3..f74ec6f78c0 100644 --- a/daemons/attrd/attrd_messages.c +++ b/daemons/attrd/attrd_messages.c @@ -14,7 +14,6 @@ #include -#include #include // pcmk__get_node() #include diff --git a/daemons/attrd/attrd_sync.c b/daemons/attrd/attrd_sync.c index 52bbbeba2d7..8477338d00d 100644 --- a/daemons/attrd/attrd_sync.c +++ b/daemons/attrd/attrd_sync.c @@ -12,7 +12,6 @@ #include #include -#include #include "pacemaker-attrd.h" diff --git a/daemons/attrd/attrd_utils.c b/daemons/attrd/attrd_utils.c index 3102c0acafe..8ba5bc43b20 100644 --- a/daemons/attrd/attrd_utils.c +++ b/daemons/attrd/attrd_utils.c @@ -17,7 +17,6 @@ #include #include -#include #include #include diff --git a/daemons/attrd/pacemaker-attrd.c b/daemons/attrd/pacemaker-attrd.c index 04f75cfe453..2c9d2a83ff9 100644 --- a/daemons/attrd/pacemaker-attrd.c +++ b/daemons/attrd/pacemaker-attrd.c @@ -21,15 +21,11 @@ #include #include -#include #include #include -#include -#include #include #include -#include #include "pacemaker-attrd.h" #define SUMMARY "daemon for managing Pacemaker node attributes" diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h index f10cf605bbe..83a3204bdec 100644 --- a/daemons/attrd/pacemaker-attrd.h +++ b/daemons/attrd/pacemaker-attrd.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include /* diff --git a/daemons/based/based_callbacks.c b/daemons/based/based_callbacks.c index d121d2fe735..f02bfe74042 100644 --- a/daemons/based/based_callbacks.c +++ b/daemons/based/based_callbacks.c @@ -30,7 +30,6 @@ #include #include -#include #include diff --git a/daemons/based/based_messages.c b/daemons/based/based_messages.c index aa317570a5b..0aaedec5001 100644 --- a/daemons/based/based_messages.c +++ b/daemons/based/based_messages.c @@ -27,8 +27,6 @@ #include #include -#include -#include #include #include diff --git a/daemons/based/based_notify.c b/daemons/based/based_notify.c index d9271c2c9c5..dba81da44c3 100644 --- a/daemons/based/based_notify.c +++ b/daemons/based/based_notify.c @@ -29,7 +29,6 @@ #include #include -#include #include struct cib_notification_s { diff --git a/daemons/based/based_remote.c b/daemons/based/based_remote.c index c948c614ca4..c51d788d7f7 100644 --- a/daemons/based/based_remote.c +++ b/daemons/based/based_remote.c @@ -29,10 +29,7 @@ #include #include -#include #include -#include -#include #include #include "pacemaker-based.h" diff --git a/daemons/based/pacemaker-based.c b/daemons/based/pacemaker-based.c index bae2104041a..41712b43af7 100644 --- a/daemons/based/pacemaker-based.c +++ b/daemons/based/pacemaker-based.c @@ -23,9 +23,7 @@ #include #include #include -#include #include -#include #include #include diff --git a/daemons/based/pacemaker-based.h b/daemons/based/pacemaker-based.h index eb7aff7c0ad..8ef9396f123 100644 --- a/daemons/based/pacemaker-based.h +++ b/daemons/based/pacemaker-based.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/daemons/controld/controld_alerts.c b/daemons/controld/controld_alerts.c index 3e0fbfa8837..e01586c0e32 100644 --- a/daemons/controld/controld_alerts.c +++ b/daemons/controld/controld_alerts.c @@ -14,7 +14,6 @@ #include #include -#include #include #include #include diff --git a/daemons/controld/controld_attrd.c b/daemons/controld/controld_attrd.c index 30db3a44850..cb0bcec6886 100644 --- a/daemons/controld/controld_attrd.c +++ b/daemons/controld/controld_attrd.c @@ -12,9 +12,7 @@ #include #include -#include #include -#include #include #include diff --git a/daemons/controld/controld_cib.c b/daemons/controld/controld_cib.c index 765dba6fc80..bdfd8dd8d87 100644 --- a/daemons/controld/controld_cib.c +++ b/daemons/controld/controld_cib.c @@ -12,7 +12,6 @@ #include #include /* sleep */ -#include #include #include #include diff --git a/daemons/controld/controld_control.c b/daemons/controld/controld_control.c index e0179380037..a371ce707fc 100644 --- a/daemons/controld/controld_control.c +++ b/daemons/controld/controld_control.c @@ -18,7 +18,6 @@ #include #include #include -#include #include diff --git a/daemons/controld/controld_fsa.h b/daemons/controld/controld_fsa.h index 9be940b5ebc..04eeb8156cf 100644 --- a/daemons/controld/controld_fsa.h +++ b/daemons/controld/controld_fsa.h @@ -17,7 +17,7 @@ # include # include # include -# include +# include /*! States the controller can be in */ enum crmd_fsa_state { diff --git a/daemons/controld/controld_membership.c b/daemons/controld/controld_membership.c index b9e882bd29a..ea03fd98b60 100644 --- a/daemons/controld/controld_membership.c +++ b/daemons/controld/controld_membership.c @@ -16,7 +16,6 @@ #include #include -#include #include #include diff --git a/daemons/controld/controld_messages.c b/daemons/controld/controld_messages.c index 79fda0f48b0..bb142ab5f15 100644 --- a/daemons/controld/controld_messages.c +++ b/daemons/controld/controld_messages.c @@ -20,7 +20,6 @@ #include #include #include -#include #include diff --git a/daemons/controld/controld_messages.h b/daemons/controld/controld_messages.h index ef1cbb46f2f..a6bcc6b8e2a 100644 --- a/daemons/controld/controld_messages.h +++ b/daemons/controld/controld_messages.h @@ -13,7 +13,7 @@ #include # include -# include +# include # include # include # include diff --git a/daemons/controld/controld_remote_ra.c b/daemons/controld/controld_remote_ra.c index 6f12ba5c2e9..31abfe3cf70 100644 --- a/daemons/controld/controld_remote_ra.c +++ b/daemons/controld/controld_remote_ra.c @@ -14,7 +14,6 @@ #include #include -#include #include #include #include diff --git a/daemons/controld/controld_schedulerd.c b/daemons/controld/controld_schedulerd.c index f6fba506464..402e712d399 100644 --- a/daemons/controld/controld_schedulerd.c +++ b/daemons/controld/controld_schedulerd.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include diff --git a/daemons/controld/controld_te_callbacks.c b/daemons/controld/controld_te_callbacks.c index f4e013c3939..6867cc48f92 100644 --- a/daemons/controld/controld_te_callbacks.c +++ b/daemons/controld/controld_te_callbacks.c @@ -14,7 +14,6 @@ #include #include -#include #include // xmlXPathObject, etc. diff --git a/daemons/controld/controld_te_events.c b/daemons/controld/controld_te_events.c index 8ce62762fcf..5b5d047ac7e 100644 --- a/daemons/controld/controld_te_events.c +++ b/daemons/controld/controld_te_events.c @@ -20,9 +20,6 @@ #include -#include -#include - /*! * \internal * \brief Action numbers of outside events processed in current update diff diff --git a/daemons/controld/pacemaker-controld.c b/daemons/controld/pacemaker-controld.c index 4ebd085a848..84442c93e2c 100644 --- a/daemons/controld/pacemaker-controld.c +++ b/daemons/controld/pacemaker-controld.c @@ -21,9 +21,7 @@ #include #include -#include #include -#include #include #include diff --git a/daemons/execd/cts-exec-helper.c b/daemons/execd/cts-exec-helper.c index 514d5d05176..dc36de22027 100644 --- a/daemons/execd/cts-exec-helper.c +++ b/daemons/execd/cts-exec-helper.c @@ -15,7 +15,6 @@ #include #include -#include #include #include diff --git a/daemons/execd/execd_alerts.c b/daemons/execd/execd_alerts.c index da6595d4ef5..f074311a297 100644 --- a/daemons/execd/execd_alerts.c +++ b/daemons/execd/execd_alerts.c @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include "pacemaker-execd.h" diff --git a/daemons/execd/execd_commands.c b/daemons/execd/execd_commands.c index 4f007378cf0..562eee1cc59 100644 --- a/daemons/execd/execd_commands.c +++ b/daemons/execd/execd_commands.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "pacemaker-execd.h" diff --git a/daemons/execd/execd_messages.c b/daemons/execd/execd_messages.c index 6fe556666fd..796e39be186 100644 --- a/daemons/execd/execd_messages.c +++ b/daemons/execd/execd_messages.c @@ -24,9 +24,7 @@ #include // CRM_SYSTEM_LRMD #include // pcmk__process_request, pcmk__xml_free #include // crm_ipc_flags -#include // pcmk__client_s, pcmk__find_client #include // pcmk_rc_e, pcmk_rc_str -#include // PCMK__XA_LRMD_*, pcmk__xe_is #include "pacemaker-execd.h" // client_disconnect_cleanup diff --git a/daemons/execd/pacemaker-execd.c b/daemons/execd/pacemaker-execd.c index 5a43636c669..64e65388e16 100644 --- a/daemons/execd/pacemaker-execd.c +++ b/daemons/execd/pacemaker-execd.c @@ -17,12 +17,8 @@ #include #include #include -#include #include -#include #include -#include -#include #include // stonith__api_new() #include diff --git a/daemons/execd/pacemaker-execd.h b/daemons/execd/pacemaker-execd.h index 4e92f99ebed..e1be09fae21 100644 --- a/daemons/execd/pacemaker-execd.h +++ b/daemons/execd/pacemaker-execd.h @@ -11,7 +11,7 @@ # define PACEMAKER_EXECD__H # include -# include +# include # include # include diff --git a/daemons/execd/remoted_proxy.c b/daemons/execd/remoted_proxy.c index 21766a637df..360135cf16a 100644 --- a/daemons/execd/remoted_proxy.c +++ b/daemons/execd/remoted_proxy.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/daemons/execd/remoted_tls.c b/daemons/execd/remoted_tls.c index 2fb78ccee92..818b48caa4d 100644 --- a/daemons/execd/remoted_tls.c +++ b/daemons/execd/remoted_tls.c @@ -16,8 +16,6 @@ #include #include #include -#include -#include #include #include diff --git a/daemons/fenced/cts-fence-helper.c b/daemons/fenced/cts-fence-helper.c index f585088b9c8..37b7759facc 100644 --- a/daemons/fenced/cts-fence-helper.c +++ b/daemons/fenced/cts-fence-helper.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c index 4d90b7b16e2..f0d4d4dbad1 100644 --- a/daemons/fenced/fenced_commands.c +++ b/daemons/fenced/fenced_commands.c @@ -28,7 +28,6 @@ #include #include -#include #include #include diff --git a/daemons/fenced/fenced_history.c b/daemons/fenced/fenced_history.c index 6d16a3db318..58861d35c9e 100644 --- a/daemons/fenced/fenced_history.c +++ b/daemons/fenced/fenced_history.c @@ -18,13 +18,11 @@ #include #include -#include #include #include #include #include -#include #include diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c index 83cc59d0620..578453a8204 100644 --- a/daemons/fenced/fenced_remote.c +++ b/daemons/fenced/fenced_remote.c @@ -28,13 +28,11 @@ #include #include -#include #include #include #include #include -#include #include #include diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c index 6158037d30f..4cd58ebdee2 100644 --- a/daemons/fenced/pacemaker-fenced.c +++ b/daemons/fenced/pacemaker-fenced.c @@ -23,15 +23,11 @@ #include // PRIu32, PRIx32 #include -#include #include -#include -#include #include #include #include -#include #include diff --git a/include/crm/cib/internal.h b/include/crm/cib/internal.h index 436576b1665..4c4c54fd473 100644 --- a/include/crm/cib/internal.h +++ b/include/crm/cib/internal.h @@ -14,10 +14,7 @@ #include // UINT32_C #include -#include -#include -#include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/crm/common/acl_internal.h b/include/crm/common/acl_internal.h index 954d4d9fb80..0be318e1eab 100644 --- a/include/crm/common/acl_internal.h +++ b/include/crm/common/acl_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_ACL_INTERNAL__H #define PCMK__CRM_COMMON_ACL_INTERNAL__H diff --git a/include/crm/common/action_relation_internal.h b/include/crm/common/action_relation_internal.h index abaf2aebee8..b9c35e2093e 100644 --- a/include/crm/common/action_relation_internal.h +++ b/include/crm/common/action_relation_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2023-2025 the Pacemaker project contributors + * Copyright 2023-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H #define PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H diff --git a/include/crm/common/actions_internal.h b/include/crm/common/actions_internal.h index ccecdff863b..883c5eab6d1 100644 --- a/include/crm/common/actions_internal.h +++ b/include/crm/common/actions_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_ACTIONS_INTERNAL__H #define PCMK__CRM_COMMON_ACTIONS_INTERNAL__H diff --git a/include/crm/common/agents_internal.h b/include/crm/common/agents_internal.h index ddc10f2aa69..3b5d14a6b5c 100644 --- a/include/crm/common/agents_internal.h +++ b/include/crm/common/agents_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2025 the Pacemaker project contributors + * Copyright 2025-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_AGENTS_INTERNAL__H #define PCMK__CRM_COMMON_AGENTS_INTERNAL__H diff --git a/include/crm/common/alerts_internal.h b/include/crm/common/alerts_internal.h index 7d7ac40f5a5..1363ffe5d7e 100644 --- a/include/crm/common/alerts_internal.h +++ b/include/crm/common/alerts_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_ALERTS_INTERNAL__H #define PCMK__CRM_COMMON_ALERTS_INTERNAL__H diff --git a/include/crm/common/attrs_internal.h b/include/crm/common/attrs_internal.h index a08981cbbc3..0ed83ba42ab 100644 --- a/include/crm/common/attrs_internal.h +++ b/include/crm/common/attrs_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_ATTRS_INTERNAL__H #define PCMK__CRM_COMMON_ATTRS_INTERNAL__H diff --git a/include/crm/common/bundles_internal.h b/include/crm/common/bundles_internal.h index 27fe053c0e3..d94b9d594f1 100644 --- a/include/crm/common/bundles_internal.h +++ b/include/crm/common/bundles_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the Pacemaker project contributors + * Copyright 2017-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_BUNDLES_INTERNAL__H #define PCMK__CRM_COMMON_BUNDLES_INTERNAL__H diff --git a/include/crm/common/cib_internal.h b/include/crm/common/cib_internal.h index fa65e58494e..34e91ad06be 100644 --- a/include/crm/common/cib_internal.h +++ b/include/crm/common/cib_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the Pacemaker project contributors + * Copyright 2023-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_CIB_INTERNAL__H #define PCMK__CRM_COMMON_CIB_INTERNAL__H diff --git a/include/crm/common/cib_secrets_internal.h b/include/crm/common/cib_secrets_internal.h index 268628ca664..41e18993ca5 100644 --- a/include/crm/common/cib_secrets_internal.h +++ b/include/crm/common/cib_secrets_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_CIB_SECRETS_INTERNAL__H #define PCMK__CRM_COMMON_CIB_SECRETS_INTERNAL__H diff --git a/include/crm/common/clone_internal.h b/include/crm/common/clone_internal.h index 6e0bf8ef3ec..50d0848cf92 100644 --- a/include/crm/common/clone_internal.h +++ b/include/crm/common/clone_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_CLONE_INTERNAL__H #define PCMK__CRM_COMMON_CLONE_INTERNAL__H diff --git a/include/crm/common/cmdline_internal.h b/include/crm/common/cmdline_internal.h index d60ba7fca11..0bfcd47333e 100644 --- a/include/crm/common/cmdline_internal.h +++ b/include/crm/common/cmdline_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2025 the Pacemaker project contributors + * Copyright 2019-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_CMDLINE_INTERNAL__H #define PCMK__CRM_COMMON_CMDLINE_INTERNAL__H diff --git a/include/crm/common/digest_internal.h b/include/crm/common/digest_internal.h index b5265deed29..20277c6ce9f 100644 --- a/include/crm/common/digest_internal.h +++ b/include/crm/common/digest_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_DIGEST_INTERNAL__H #define PCMK__CRM_COMMON_DIGEST_INTERNAL__H diff --git a/include/crm/common/failcounts_internal.h b/include/crm/common/failcounts_internal.h index d1e7ee0a106..ad4a2dea796 100644 --- a/include/crm/common/failcounts_internal.h +++ b/include/crm/common/failcounts_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_FAILCOUNTS_INTERNAL__H #define PCMK__CRM_COMMON_FAILCOUNTS_INTERNAL__H diff --git a/include/crm/common/flags_internal.h b/include/crm/common/flags_internal.h index 4c2e40c36d6..04111f6f588 100644 --- a/include/crm/common/flags_internal.h +++ b/include/crm/common/flags_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_FLAGS_INTERNAL__H #define PCMK__CRM_COMMON_FLAGS_INTERNAL__H diff --git a/include/crm/common/group_internal.h b/include/crm/common/group_internal.h index ceee6d4527b..06b823ffa09 100644 --- a/include/crm/common/group_internal.h +++ b/include/crm/common/group_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_GROUP_INTERNAL__H #define PCMK__CRM_COMMON_GROUP_INTERNAL__H diff --git a/include/crm/common/health_internal.h b/include/crm/common/health_internal.h index 4bed8210508..ec44b77a3e3 100644 --- a/include/crm/common/health_internal.h +++ b/include/crm/common/health_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_HEALTH_INTERNAL__H #define PCMK__CRM_COMMON_HEALTH_INTERNAL__H diff --git a/include/crm/common/history_internal.h b/include/crm/common/history_internal.h index 1385d23cb95..e5e4de66b50 100644 --- a/include/crm/common/history_internal.h +++ b/include/crm/common/history_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_HISTORY_INTERNAL__H #define PCMK__CRM_COMMON_HISTORY_INTERNAL__H diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index 2ce9d1a5cc8..c150cfc6327 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -10,6 +10,8 @@ #ifndef PCMK__CRM_COMMON_INTERNAL__H #define PCMK__CRM_COMMON_INTERNAL__H +#define PCMK__INCLUDED_CRM_COMMON_INTERNAL_H + #include #include #include @@ -66,6 +68,8 @@ // xml_names_internal.h intentionally left out // xpath_internal.h intentionally left out +#undef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H + #ifdef __cplusplus extern "C" { #endif diff --git a/include/crm/common/io_internal.h b/include/crm/common/io_internal.h index 95661c75117..7d3d0129254 100644 --- a/include/crm/common/io_internal.h +++ b/include/crm/common/io_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2022-2025 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_IO_INTERNAL__H #define PCMK__CRM_COMMON_IO_INTERNAL__H diff --git a/include/crm/common/ipc_attrd_internal.h b/include/crm/common/ipc_attrd_internal.h index 9545425e3d1..7cf0165b8fb 100644 --- a/include/crm/common/ipc_attrd_internal.h +++ b/include/crm/common/ipc_attrd_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2022-2025 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_IPC_ATTRD_INTERNAL__H #define PCMK__CRM_COMMON_IPC_ATTRD_INTERNAL__H diff --git a/include/crm/common/ipc_internal.h b/include/crm/common/ipc_internal.h index 2bc47c11cf9..911979ebe2a 100644 --- a/include/crm/common/ipc_internal.h +++ b/include/crm/common/ipc_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2013-2025 the Pacemaker project contributors + * Copyright 2013-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_IPC_INTERNAL__H #define PCMK__CRM_COMMON_IPC_INTERNAL__H diff --git a/include/crm/common/iso8601_internal.h b/include/crm/common/iso8601_internal.h index 146988e0640..f8817ff0d5c 100644 --- a/include/crm/common/iso8601_internal.h +++ b/include/crm/common/iso8601_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_ISO8601_INTERNAL__H #define PCMK__CRM_COMMON_ISO8601_INTERNAL__H diff --git a/include/crm/common/lists_internal.h b/include/crm/common/lists_internal.h index 29bb22806f9..43b588c48fd 100644 --- a/include/crm/common/lists_internal.h +++ b/include/crm/common/lists_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2020-2025 the Pacemaker project contributors + * Copyright 2020-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_LISTS_INTERNAL__H #define PCMK__CRM_COMMON_LISTS_INTERNAL__H diff --git a/include/crm/common/location_internal.h b/include/crm/common/location_internal.h index 1ca3024c3c9..a50b768e83a 100644 --- a/include/crm/common/location_internal.h +++ b/include/crm/common/location_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_LOCATION_INTERNAL__H #define PCMK__CRM_COMMON_LOCATION_INTERNAL__H diff --git a/include/crm/common/logging_internal.h b/include/crm/common/logging_internal.h index d22468d9389..5c165fb0012 100644 --- a/include/crm/common/logging_internal.h +++ b/include/crm/common/logging_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * or later (GPLv2+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_LOGGING_INTERNAL__H #define PCMK__CRM_COMMON_LOGGING_INTERNAL__H diff --git a/include/crm/common/mainloop_internal.h b/include/crm/common/mainloop_internal.h index 7b1f677a9e0..3b5d07ec1d7 100644 --- a/include/crm/common/mainloop_internal.h +++ b/include/crm/common/mainloop_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_MAINLOOP_INTERNAL__H #define PCMK__CRM_COMMON_MAINLOOP_INTERNAL__H diff --git a/include/crm/common/memory_internal.h b/include/crm/common/memory_internal.h index fd204992551..45bf6eb726f 100644 --- a/include/crm/common/memory_internal.h +++ b/include/crm/common/memory_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_MEMORY_INTERNAL__H #define PCMK__CRM_COMMON_MEMORY_INTERNAL__H diff --git a/include/crm/common/messages_internal.h b/include/crm/common/messages_internal.h index e9481d0e752..c27b4585957 100644 --- a/include/crm/common/messages_internal.h +++ b/include/crm/common/messages_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2018-2024 the Pacemaker project contributors + * Copyright 2018-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_MESSAGES_INTERNAL__H #define PCMK__CRM_COMMON_MESSAGES_INTERNAL__H diff --git a/include/crm/common/nodes_internal.h b/include/crm/common/nodes_internal.h index b8525758a3d..ed5388ffb5e 100644 --- a/include/crm/common/nodes_internal.h +++ b/include/crm/common/nodes_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2024 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_NODES_INTERNAL__H #define PCMK__CRM_COMMON_NODES_INTERNAL__H diff --git a/include/crm/common/nvpair_internal.h b/include/crm/common/nvpair_internal.h index 98c8d3f2044..43589879a97 100644 --- a/include/crm/common/nvpair_internal.h +++ b/include/crm/common/nvpair_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_NVPAIR_INTERNAL__H #define PCMK__CRM_COMMON_NVPAIR_INTERNAL__H diff --git a/include/crm/common/options_internal.h b/include/crm/common/options_internal.h index 067d7225c8e..1cf836e7feb 100644 --- a/include/crm/common/options_internal.h +++ b/include/crm/common/options_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2025 the Pacemaker project contributors + * Copyright 2006-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_OPTIONS_INTERNAL__H #define PCMK__CRM_COMMON_OPTIONS_INTERNAL__H diff --git a/include/crm/common/output_internal.h b/include/crm/common/output_internal.h index 0dab4075ca9..4cc7036b4ae 100644 --- a/include/crm/common/output_internal.h +++ b/include/crm/common/output_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2025 the Pacemaker project contributors + * Copyright 2019-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_OUTPUT_INTERNAL__H #define PCMK__CRM_COMMON_OUTPUT_INTERNAL__H diff --git a/include/crm/common/pid_internal.h b/include/crm/common/pid_internal.h index d31331259d4..380614fa269 100644 --- a/include/crm/common/pid_internal.h +++ b/include/crm/common/pid_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_PID_INTERNAL__H #define PCMK__CRM_COMMON_PID_INTERNAL__H diff --git a/include/crm/common/primitive_internal.h b/include/crm/common/primitive_internal.h index 816b632402d..1a6e451de29 100644 --- a/include/crm/common/primitive_internal.h +++ b/include/crm/common/primitive_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2024 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_PRIMITIVE_INTERNAL__H #define PCMK__CRM_COMMON_PRIMITIVE_INTERNAL__H diff --git a/include/crm/common/procfs_internal.h b/include/crm/common/procfs_internal.h index 09d8dcee3a9..5545861e954 100644 --- a/include/crm/common/procfs_internal.h +++ b/include/crm/common/procfs_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_PROCFS_INTERNAL__H #define PCMK__CRM_COMMON_PROCFS_INTERNAL__H diff --git a/include/crm/common/remote_internal.h b/include/crm/common/remote_internal.h index 2f00183d620..6656d9c0d1b 100644 --- a/include/crm/common/remote_internal.h +++ b/include/crm/common/remote_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 the Pacemaker project contributors + * Copyright 2008-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_REMOTE_INTERNAL__H #define PCMK__CRM_COMMON_REMOTE_INTERNAL__H diff --git a/include/crm/common/resources_internal.h b/include/crm/common/resources_internal.h index 62adc177fe1..3475ddcf2df 100644 --- a/include/crm/common/resources_internal.h +++ b/include/crm/common/resources_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2024-2025 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_RESOURCES_INTERNAL__H #define PCMK__CRM_COMMON_RESOURCES_INTERNAL__H diff --git a/include/crm/common/results_internal.h b/include/crm/common/results_internal.h index 1032644b214..0bff95c33cd 100644 --- a/include/crm/common/results_internal.h +++ b/include/crm/common/results_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2020-2025 the Pacemaker project contributors + * Copyright 2020-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_RESULTS_INTERNAL__H #define PCMK__CRM_COMMON_RESULTS_INTERNAL__H diff --git a/include/crm/common/roles_internal.h b/include/crm/common/roles_internal.h index b0b1693794f..2fc5ce0da7b 100644 --- a/include/crm/common/roles_internal.h +++ b/include/crm/common/roles_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_ROLES_INTERNAL__H #define PCMK__CRM_COMMON_ROLES_INTERNAL__H diff --git a/include/crm/common/rules_internal.h b/include/crm/common/rules_internal.h index 95eaca7883c..91ea703febf 100644 --- a/include/crm/common/rules_internal.h +++ b/include/crm/common/rules_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_RULES_INTERNAL__H #define PCMK__CRM_COMMON_RULES_INTERNAL__H diff --git a/include/crm/common/scheduler_internal.h b/include/crm/common/scheduler_internal.h index a953c8cf43e..4d36ee6deae 100644 --- a/include/crm/common/scheduler_internal.h +++ b/include/crm/common/scheduler_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H #define PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H @@ -22,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/include/crm/common/schemas_internal.h b/include/crm/common/schemas_internal.h index 5936ed795e6..f685118673c 100644 --- a/include/crm/common/schemas_internal.h +++ b/include/crm/common/schemas_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2024 the Pacemaker project contributors + * Copyright 2006-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_SCHEMAS_INTERNAL__H #define PCMK__CRM_COMMON_SCHEMAS_INTERNAL__H diff --git a/include/crm/common/scores_internal.h b/include/crm/common/scores_internal.h index 6bddc3a1157..5760b3bc11b 100644 --- a/include/crm/common/scores_internal.h +++ b/include/crm/common/scores_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2022-2025 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_SCORES_INTERNAL__H #define PCMK__CRM_COMMON_SCORES_INTERNAL__H diff --git a/include/crm/common/servers_internal.h b/include/crm/common/servers_internal.h index b092c9e7cb4..d6aec80e91d 100644 --- a/include/crm/common/servers_internal.h +++ b/include/crm/common/servers_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2024 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_SERVERS_INTERNAL__H #define PCMK__CRM_COMMON_SERVERS_INTERNAL__H diff --git a/include/crm/common/strings_internal.h b/include/crm/common/strings_internal.h index b36abcae155..33586adf214 100644 --- a/include/crm/common/strings_internal.h +++ b/include/crm/common/strings_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_STRINGS_INTERNAL__H #define PCMK__CRM_COMMON_STRINGS_INTERNAL__H diff --git a/include/crm/common/tickets_internal.h b/include/crm/common/tickets_internal.h index e57e2b7423d..42ddc3d3b72 100644 --- a/include/crm/common/tickets_internal.h +++ b/include/crm/common/tickets_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_TICKETS_INTERNAL__H #define PCMK__CRM_COMMON_TICKETS_INTERNAL__H diff --git a/include/crm/common/tls_internal.h b/include/crm/common/tls_internal.h index b7cb0a1207b..819dbbd5fbe 100644 --- a/include/crm/common/tls_internal.h +++ b/include/crm/common/tls_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2024-2025 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_TLS_INTERNAL__H #define PCMK__CRM_COMMON_TLS_INTERNAL__H diff --git a/include/crm/common/utils_internal.h b/include/crm/common/utils_internal.h index 6db14cd78fa..dff3690b163 100644 --- a/include/crm/common/utils_internal.h +++ b/include/crm/common/utils_internal.h @@ -1,11 +1,14 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * * This source code is licensed under the GNU Lesser General Public License * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif #ifndef PCMK__CRM_COMMON_UTILS_INTERNAL__H #define PCMK__CRM_COMMON_UTILS_INTERNAL__H diff --git a/include/crm/common/xml_comment_internal.h b/include/crm/common/xml_comment_internal.h index 59f85591fe8..ff3212e0bbe 100644 --- a/include/crm/common/xml_comment_internal.h +++ b/include/crm/common/xml_comment_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2024 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_XML_COMMENT_INTERNAL__H #define PCMK__CRM_COMMON_XML_COMMENT_INTERNAL__H diff --git a/include/crm/common/xml_element_internal.h b/include/crm/common/xml_element_internal.h index 67710d404ce..ec2964c2504 100644 --- a/include/crm/common/xml_element_internal.h +++ b/include/crm/common/xml_element_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2025 the Pacemaker project contributors + * Copyright 2017-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_XML_ELEMENT_INTERNAL__H #define PCMK__CRM_COMMON_XML_ELEMENT_INTERNAL__H diff --git a/include/crm/common/xml_idref_internal.h b/include/crm/common/xml_idref_internal.h index 4046cc4cea9..9a4480b421f 100644 --- a/include/crm/common/xml_idref_internal.h +++ b/include/crm/common/xml_idref_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2024 the Pacemaker project contributors + * Copyright 2024-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_XML_IDREF_INTERNAL__H #define PCMK__CRM_COMMON_XML_IDREF_INTERNAL__H diff --git a/include/crm/common/xml_internal.h b/include/crm/common/xml_internal.h index 9999e2043fb..eed9c6fc837 100644 --- a/include/crm/common/xml_internal.h +++ b/include/crm/common/xml_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2025 the Pacemaker project contributors + * Copyright 2017-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_XML_INTERNAL__H #define PCMK__CRM_COMMON_XML_INTERNAL__H diff --git a/include/crm/common/xml_io_internal.h b/include/crm/common/xml_io_internal.h index 2e1feab1277..39d61649499 100644 --- a/include/crm/common/xml_io_internal.h +++ b/include/crm/common/xml_io_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2025 the Pacemaker project contributors + * Copyright 2017-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_XML_IO_INTERNAL__H #define PCMK__CRM_COMMON_XML_IO_INTERNAL__H diff --git a/include/crm/common/xml_names_internal.h b/include/crm/common/xml_names_internal.h index 9d0487831dc..7fa63b67987 100644 --- a/include/crm/common/xml_names_internal.h +++ b/include/crm/common/xml_names_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2025 the Pacemaker project contributors + * Copyright 2004-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_XML_NAMES_INTERNAL__H #define PCMK__CRM_COMMON_XML_NAMES_INTERNAL__H diff --git a/include/crm/common/xpath_internal.h b/include/crm/common/xpath_internal.h index f63675a6785..d05a0a97cd6 100644 --- a/include/crm/common/xpath_internal.h +++ b/include/crm/common/xpath_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2022-2025 the Pacemaker project contributors + * Copyright 2022-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -7,6 +7,10 @@ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. */ +#ifndef PCMK__INCLUDED_CRM_COMMON_INTERNAL_H +#error "Include instead of directly" +#endif + #ifndef PCMK__CRM_COMMON_XPATH_INTERNAL__H #define PCMK__CRM_COMMON_XPATH_INTERNAL__H diff --git a/include/crm/fencing/internal.h b/include/crm/fencing/internal.h index f81044ddfa7..d2a670544c3 100644 --- a/include/crm/fencing/internal.h +++ b/include/crm/fencing/internal.h @@ -13,10 +13,9 @@ #include // bool #include +#include #include #include -#include -#include #include #ifdef __cplusplus diff --git a/include/crm/lrmd_internal.h b/include/crm/lrmd_internal.h index 983ff3fc781..2de3eec1c84 100644 --- a/include/crm/lrmd_internal.h +++ b/include/crm/lrmd_internal.h @@ -13,11 +13,9 @@ #include // uint32_t #include // GList, GHashTable, gpointer #include // xmlNode +#include // pcmk__output_t, pcmk__remote_t, pcmk__action_result_t #include // crm_ipc_t #include // mainloop_io_t, ipc_client_callbacks -#include // pcmk__output_t -#include // pcmk__remote_t -#include // pcmk__action_result_t #include // lrmd_t, lrmd_event_data_t, lrmd_rsc_info_t #ifdef __cplusplus diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h index 1417912c058..543d1a92023 100644 --- a/include/crm/pengine/internal.h +++ b/include/crm/pengine/internal.h @@ -17,9 +17,6 @@ #include #include #include -#include -#include -#include #ifdef __cplusplus extern "C" { diff --git a/include/crm/services_internal.h b/include/crm/services_internal.h index 059d7a9d447..c282813eb96 100644 --- a/include/crm/services_internal.h +++ b/include/crm/services_internal.h @@ -10,7 +10,7 @@ #ifndef PCMK__CRM_SERVICES_INTERNAL__H #define PCMK__CRM_SERVICES_INTERNAL__H -#include // pcmk__action_result_t +#include // pcmk__action_result_t #include // svc_action_t #ifdef __cplusplus diff --git a/lib/cib/cib_attrs.c b/lib/cib/cib_attrs.c index a36caddb68a..1a2de1c5c17 100644 --- a/lib/cib/cib_attrs.c +++ b/lib/cib/cib_attrs.c @@ -24,8 +24,6 @@ #include #include -#include -#include #include static pcmk__output_t * diff --git a/lib/cib/cib_file.c b/lib/cib/cib_file.c index b0b058ce9eb..d827e582bd3 100644 --- a/lib/cib/cib_file.c +++ b/lib/cib/cib_file.c @@ -27,7 +27,6 @@ #include #include #include -#include #define CIB_SERIES "cib" #define CIB_SERIES_MAX 100 diff --git a/lib/cib/cib_ops.c b/lib/cib/cib_ops.c index 559a090767b..c390f71a6d2 100644 --- a/lib/cib/cib_ops.c +++ b/lib/cib/cib_ops.c @@ -28,7 +28,6 @@ #include #include -#include // @TODO: Free this via crm_exit() when libcib gets merged with libcrmcommon static GHashTable *operation_table = NULL; diff --git a/lib/cib/cib_remote.c b/lib/cib/cib_remote.c index de8ec853795..d812857bf6b 100644 --- a/lib/cib/cib_remote.c +++ b/lib/cib/cib_remote.c @@ -23,12 +23,8 @@ #include #include -#include #include #include -#include -#include -#include #include diff --git a/lib/cib/cib_utils.c b/lib/cib/cib_utils.c index 48532009372..043c57e14ec 100644 --- a/lib/cib/cib_utils.c +++ b/lib/cib/cib_utils.c @@ -20,9 +20,7 @@ #include #include -#include #include -#include gboolean cib_version_details(xmlNode * cib, int *admin_epoch, int *epoch, int *updates) diff --git a/lib/cluster/corosync.c b/lib/cluster/corosync.c index 233fa028067..d354aaf28b6 100644 --- a/lib/cluster/corosync.c +++ b/lib/cluster/corosync.c @@ -30,7 +30,6 @@ #include #include -#include // PCMK__SPECIAL_PID #include #include diff --git a/lib/cluster/cpg.c b/lib/cluster/cpg.c index 946908ba301..00884a2a776 100644 --- a/lib/cluster/cpg.c +++ b/lib/cluster/cpg.c @@ -30,7 +30,6 @@ #include #include -#include // PCMK__SPECIAL_PID #include #include diff --git a/lib/cluster/membership.c b/lib/cluster/membership.c index 30058dfeeb1..f162e48b4fc 100644 --- a/lib/cluster/membership.c +++ b/lib/cluster/membership.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include "crmcluster_private.h" diff --git a/lib/common/acl.c b/lib/common/acl.c index 6850d370dcf..039e00968a4 100644 --- a/lib/common/acl.c +++ b/lib/common/acl.c @@ -23,7 +23,6 @@ #include #include -#include #include "crmcommon_private.h" typedef struct xml_acl_s { diff --git a/lib/common/actions.c b/lib/common/actions.c index 308040d199c..b312c2ac612 100644 --- a/lib/common/actions.c +++ b/lib/common/actions.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include diff --git a/lib/common/alerts.c b/lib/common/alerts.c index 7da88534810..6bc0209b202 100644 --- a/lib/common/alerts.c +++ b/lib/common/alerts.c @@ -14,9 +14,6 @@ #include #include #include -#include -#include -#include const char *pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX] = { [PCMK__alert_key_recipient] = "CRM_alert_recipient", diff --git a/lib/common/attrs.c b/lib/common/attrs.c index 0086cee643a..2478cde94b4 100644 --- a/lib/common/attrs.c +++ b/lib/common/attrs.c @@ -14,7 +14,6 @@ #include #include -#include #define OCF_RESKEY_PREFIX "OCF_RESKEY_" #define LRM_TARGET_ENV OCF_RESKEY_PREFIX CRM_META "_" PCMK__META_ON_NODE diff --git a/lib/common/cib.c b/lib/common/cib.c index 58fcceb969e..f9f187a88eb 100644 --- a/lib/common/cib.c +++ b/lib/common/cib.c @@ -15,7 +15,6 @@ #include #include -#include /* * Functions to help find particular sections of the CIB diff --git a/lib/common/cmdline.c b/lib/common/cmdline.c index 780344fa91a..656360c55ed 100644 --- a/lib/common/cmdline.c +++ b/lib/common/cmdline.c @@ -15,8 +15,6 @@ #include #include -#include -#include #include static gboolean diff --git a/lib/common/crmcommon_private.h b/lib/common/crmcommon_private.h index 019fc7300df..cb12b69c0a0 100644 --- a/lib/common/crmcommon_private.h +++ b/lib/common/crmcommon_private.h @@ -23,13 +23,12 @@ #include // xmlChar #include // struct qb_ipc_response_header +#include #include // pcmk_ipc_api_t, crm_ipc_t, etc. #include // crm_time_t #include // mainloop_io_t -#include // pcmk__output_t #include // crm_exit_t #include // pcmk_rule_input_t -#include // enum pcmk__xml_flags #ifdef __cplusplus extern "C" { diff --git a/lib/common/health.c b/lib/common/health.c index 6ecbb6ecc65..af8d8c94c25 100644 --- a/lib/common/health.c +++ b/lib/common/health.c @@ -13,7 +13,6 @@ #include // NULL #include // pcmk_scheduler_t -#include // pcmk_scheduler_t private data /*! * \internal diff --git a/lib/common/ipc_attrd.c b/lib/common/ipc_attrd.c index 74b6473517c..e448a2d0e55 100644 --- a/lib/common/ipc_attrd.c +++ b/lib/common/ipc_attrd.c @@ -15,9 +15,7 @@ #include // xmlChar #include -#include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/ipc_client.c b/lib/common/ipc_client.c index 4c8fcacdfea..fd8a6058290 100644 --- a/lib/common/ipc_client.c +++ b/lib/common/ipc_client.c @@ -24,7 +24,6 @@ #include /* indirectly: pcmk_err_generic */ #include #include -#include #include "crmcommon_private.h" static int is_ipc_provider_expected(qb_ipcc_connection_t *qb_ipc, int sock, diff --git a/lib/common/ipc_controld.c b/lib/common/ipc_controld.c index c499ac27b0a..21bfdf0ea39 100644 --- a/lib/common/ipc_controld.c +++ b/lib/common/ipc_controld.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/ipc_pacemakerd.c b/lib/common/ipc_pacemakerd.c index c42488c15d3..c8bb377b9b6 100644 --- a/lib/common/ipc_pacemakerd.c +++ b/lib/common/ipc_pacemakerd.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/ipc_schedulerd.c b/lib/common/ipc_schedulerd.c index 819db436f22..b2a420ad5c1 100644 --- a/lib/common/ipc_schedulerd.c +++ b/lib/common/ipc_schedulerd.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/ipc_server.c b/lib/common/ipc_server.c index 515605a4115..96a5316386a 100644 --- a/lib/common/ipc_server.c +++ b/lib/common/ipc_server.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "crmcommon_private.h" /* Evict clients whose event queue grows this large (by default) */ diff --git a/lib/common/iso8601.c b/lib/common/iso8601.c index 3e868488f09..e9bd9efdac9 100644 --- a/lib/common/iso8601.c +++ b/lib/common/iso8601.c @@ -25,7 +25,6 @@ #include // g_strchomp() #include -#include #include "crmcommon_private.h" /* diff --git a/lib/common/lists.c b/lib/common/lists.c index 9cd88d73c09..079f5ab8d95 100644 --- a/lib/common/lists.c +++ b/lib/common/lists.c @@ -8,7 +8,6 @@ */ #include -#include GList* pcmk__subtract_lists(GList *from, const GList *items, GCompareFunc cmp) diff --git a/lib/common/mainloop.c b/lib/common/mainloop.c index 09db65459ed..b38ed21dfb7 100644 --- a/lib/common/mainloop.c +++ b/lib/common/mainloop.c @@ -20,7 +20,6 @@ #include #include #include -#include #include diff --git a/lib/common/messages.c b/lib/common/messages.c index f534ee68855..fe8a0921e9d 100644 --- a/lib/common/messages.c +++ b/lib/common/messages.c @@ -17,7 +17,6 @@ #include #include -#include /*! * \internal diff --git a/lib/common/nvpair.c b/lib/common/nvpair.c index cc8bdca76bf..c480aa427f5 100644 --- a/lib/common/nvpair.c +++ b/lib/common/nvpair.c @@ -21,7 +21,6 @@ #include #include -#include #include "crmcommon_private.h" /* diff --git a/lib/common/output_html.c b/lib/common/output_html.c index dac0e73a72d..3215e0825b1 100644 --- a/lib/common/output_html.c +++ b/lib/common/output_html.c @@ -19,7 +19,6 @@ #include // xmlNode #include // xmlChar -#include #include static const char *stylesheet_default = diff --git a/lib/common/output_log.c b/lib/common/output_log.c index 6224ca4480f..608efd625ed 100644 --- a/lib/common/output_log.c +++ b/lib/common/output_log.c @@ -8,7 +8,6 @@ */ #include -#include #include #include diff --git a/lib/common/output_none.c b/lib/common/output_none.c index 24d74422b6e..8a5032a2242 100644 --- a/lib/common/output_none.c +++ b/lib/common/output_none.c @@ -15,7 +15,6 @@ #include #include -#include static void none_free_priv(pcmk__output_t *out) { diff --git a/lib/common/output_text.c b/lib/common/output_text.c index 5d3ee4e55a0..fcade4736b8 100644 --- a/lib/common/output_text.c +++ b/lib/common/output_text.c @@ -8,7 +8,6 @@ */ #include -#include #include #include diff --git a/lib/common/output_xml.c b/lib/common/output_xml.c index 1dcfbad6d39..1b237db96d2 100644 --- a/lib/common/output_xml.c +++ b/lib/common/output_xml.c @@ -20,10 +20,8 @@ #include // xmlNode #include // xmlChar -#include #include #include -#include // pcmk__xml2fd typedef struct subst_s { const char *from; diff --git a/lib/common/patchset.c b/lib/common/patchset.c index dad4e497e4c..3650cf5f286 100644 --- a/lib/common/patchset.c +++ b/lib/common/patchset.c @@ -22,9 +22,7 @@ #include // xmlNode #include -#include #include -#include // CRM_XML_LOG_BASE, etc. #include "crmcommon_private.h" static const char *const vfields[] = { diff --git a/lib/common/remote.c b/lib/common/remote.c index cd1fddd1ff8..f228d60123c 100644 --- a/lib/common/remote.c +++ b/lib/common/remote.c @@ -29,11 +29,8 @@ #include #include -#include #include #include -#include -#include #include diff --git a/lib/common/resources.c b/lib/common/resources.c index 993344805c4..a268c7ddbad 100644 --- a/lib/common/resources.c +++ b/lib/common/resources.c @@ -13,7 +13,6 @@ #include // bool, false #include -#include /*! * \internal diff --git a/lib/common/roles.c b/lib/common/roles.c index 9389455cb29..3005cb16050 100644 --- a/lib/common/roles.c +++ b/lib/common/roles.c @@ -10,7 +10,6 @@ #include #include -#include /*! * \brief Get readable description of a resource role diff --git a/lib/common/rules.c b/lib/common/rules.c index 01a3c4795fc..7486e88dee0 100644 --- a/lib/common/rules.c +++ b/lib/common/rules.c @@ -20,10 +20,6 @@ #include -#include -#include -#include -#include #include "crmcommon_private.h" /*! diff --git a/lib/common/schemas.c b/lib/common/schemas.c index b81588f80fe..87d87f95910 100644 --- a/lib/common/schemas.c +++ b/lib/common/schemas.c @@ -29,7 +29,6 @@ #include #include -#include /* PCMK__XML_LOG_BASE */ #include "crmcommon_private.h" diff --git a/lib/common/tls.c b/lib/common/tls.c index 66a2174c5cb..0fa7973cde9 100644 --- a/lib/common/tls.c +++ b/lib/common/tls.c @@ -16,8 +16,6 @@ #include #include -#include - static char * get_gnutls_priorities(gnutls_credentials_type_t cred_type) { diff --git a/lib/common/xml.c b/lib/common/xml.c index b635a56dc37..772ef3d4f2e 100644 --- a/lib/common/xml.c +++ b/lib/common/xml.c @@ -24,7 +24,6 @@ #include #include -#include // PCMK__XML_LOG_BASE, etc. #include "crmcommon_private.h" //! libxml2 supports only XML version 1.0, at least as of libxml2-2.12.5 diff --git a/lib/common/xml_attr.c b/lib/common/xml_attr.c index cc9d02ca343..c7993bbab2f 100644 --- a/lib/common/xml_attr.c +++ b/lib/common/xml_attr.c @@ -25,7 +25,6 @@ #include #include -#include // PCMK__XML_LOG_BASE, etc. #include "crmcommon_private.h" /*! diff --git a/lib/common/xml_display.c b/lib/common/xml_display.c index 2a4aedcbc65..26dfb7f44ca 100644 --- a/lib/common/xml_display.c +++ b/lib/common/xml_display.c @@ -15,7 +15,6 @@ #include #include -#include // PCMK__XML_LOG_BASE, etc. #include "crmcommon_private.h" static int show_xml_node(pcmk__output_t *out, GString *buffer, diff --git a/lib/common/xpath.c b/lib/common/xpath.c index c9a85406a11..8bff702dcb0 100644 --- a/lib/common/xpath.c +++ b/lib/common/xpath.c @@ -17,7 +17,6 @@ #include // xmlXPathObject, etc. #include -#include #include "crmcommon_private.h" /*! diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c index 33c61d90e72..0f68ed2ad74 100644 --- a/lib/fencing/st_output.c +++ b/lib/fencing/st_output.c @@ -17,8 +17,6 @@ #include #include #include -#include -#include #include #include diff --git a/lib/lrmd/lrmd_alerts.c b/lib/lrmd/lrmd_alerts.c index e908150dc2e..3fba9d47bd1 100644 --- a/lib/lrmd/lrmd_alerts.c +++ b/lib/lrmd/lrmd_alerts.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/lib/lrmd/lrmd_client.c b/lib/lrmd/lrmd_client.c index 03f88337763..54a65c41b13 100644 --- a/lib/lrmd/lrmd_client.c +++ b/lib/lrmd/lrmd_client.c @@ -31,9 +31,6 @@ #include #include #include -#include -#include -#include #include #include diff --git a/lib/lrmd/lrmd_output.c b/lib/lrmd/lrmd_output.c index 2e3271c82c2..daa54e661c1 100644 --- a/lib/lrmd/lrmd_output.c +++ b/lib/lrmd/lrmd_output.c @@ -12,7 +12,6 @@ #include #include -#include static int default_list(pcmk__output_t *out, lrmd_list_t *list, const char *title) { diff --git a/lib/pacemaker/libpacemaker_private.h b/lib/pacemaker/libpacemaker_private.h index 087fe6edc3e..43a4213921b 100644 --- a/lib/pacemaker/libpacemaker_private.h +++ b/lib/pacemaker/libpacemaker_private.h @@ -20,8 +20,8 @@ #include // guint, gpointer, GList, GHashTable #include // xmlNode +#include // pcmk__location_t, etc. #include // pcmk_action_t, pcmk_node_t, etc. -#include // pcmk__location_t, etc. #include // cib_t #include // lrmd_event_data_t #include // pe__const_top_resource(), etc. diff --git a/lib/pacemaker/pcmk_acl.c b/lib/pacemaker/pcmk_acl.c index b64a7a269fd..74260d0b00a 100644 --- a/lib/pacemaker/pcmk_acl.c +++ b/lib/pacemaker/pcmk_acl.c @@ -25,7 +25,6 @@ #include #include -#include #include #include diff --git a/lib/pacemaker/pcmk_cluster_queries.c b/lib/pacemaker/pcmk_cluster_queries.c index ed23e421e36..90438ded189 100644 --- a/lib/pacemaker/pcmk_cluster_queries.c +++ b/lib/pacemaker/pcmk_cluster_queries.c @@ -19,9 +19,7 @@ #include #include #include -#include #include -#include #include #include #include diff --git a/lib/pacemaker/pcmk_graph_consumer.c b/lib/pacemaker/pcmk_graph_consumer.c index f6593db8a09..cc4cac15324 100644 --- a/lib/pacemaker/pcmk_graph_consumer.c +++ b/lib/pacemaker/pcmk_graph_consumer.c @@ -15,7 +15,6 @@ #include #include -#include #include #include diff --git a/lib/pacemaker/pcmk_injections.c b/lib/pacemaker/pcmk_injections.c index aa302d6179c..81cec41f8c9 100644 --- a/lib/pacemaker/pcmk_injections.c +++ b/lib/pacemaker/pcmk_injections.c @@ -26,7 +26,6 @@ #include #include #include -#include #include // lrmd_event_data_t, etc. #include #include diff --git a/lib/pacemaker/pcmk_resource.c b/lib/pacemaker/pcmk_resource.c index c62ec51f022..894ed0eb961 100644 --- a/lib/pacemaker/pcmk_resource.c +++ b/lib/pacemaker/pcmk_resource.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/lib/pacemaker/pcmk_sched_actions.c b/lib/pacemaker/pcmk_sched_actions.c index c4222852147..e7e6852ad4a 100644 --- a/lib/pacemaker/pcmk_sched_actions.c +++ b/lib/pacemaker/pcmk_sched_actions.c @@ -17,7 +17,6 @@ #include // xmlNode #include -#include #include #include "libpacemaker_private.h" diff --git a/lib/pacemaker/pcmk_sched_colocation.c b/lib/pacemaker/pcmk_sched_colocation.c index 97148e2dfe8..20e8fd9a2d1 100644 --- a/lib/pacemaker/pcmk_sched_colocation.c +++ b/lib/pacemaker/pcmk_sched_colocation.c @@ -14,13 +14,11 @@ #include #include -#include +#include +#include #include #include -#include "crm/common/util.h" -#include "crm/common/xml_internal.h" -#include "crm/common/xml.h" #include "libpacemaker_private.h" // Used to temporarily mark a node as unusable diff --git a/lib/pacemaker/pcmk_sched_constraints.c b/lib/pacemaker/pcmk_sched_constraints.c index a363c33f76a..a4206fc5c5c 100644 --- a/lib/pacemaker/pcmk_sched_constraints.c +++ b/lib/pacemaker/pcmk_sched_constraints.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/pacemaker/pcmk_sched_location.c b/lib/pacemaker/pcmk_sched_location.c index 51688a6fb62..1181670468b 100644 --- a/lib/pacemaker/pcmk_sched_location.c +++ b/lib/pacemaker/pcmk_sched_location.c @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/lib/pacemaker/pcmk_sched_nodes.c b/lib/pacemaker/pcmk_sched_nodes.c index 42572138c2e..92f5ed1f434 100644 --- a/lib/pacemaker/pcmk_sched_nodes.c +++ b/lib/pacemaker/pcmk_sched_nodes.c @@ -12,7 +12,6 @@ #include #include -#include #include #include #include "libpacemaker_private.h" diff --git a/lib/pacemaker/pcmk_sched_recurring.c b/lib/pacemaker/pcmk_sched_recurring.c index 4f8f087f81f..0714918f411 100644 --- a/lib/pacemaker/pcmk_sched_recurring.c +++ b/lib/pacemaker/pcmk_sched_recurring.c @@ -12,7 +12,6 @@ #include #include -#include #include #include "libpacemaker_private.h" diff --git a/lib/pacemaker/pcmk_sched_remote.c b/lib/pacemaker/pcmk_sched_remote.c index 1a663136b8d..49314995e7c 100644 --- a/lib/pacemaker/pcmk_sched_remote.c +++ b/lib/pacemaker/pcmk_sched_remote.c @@ -15,7 +15,6 @@ #include #include #include -#include #include diff --git a/lib/pacemaker/pcmk_sched_tickets.c b/lib/pacemaker/pcmk_sched_tickets.c index 523fc766d48..d5db2bc3f70 100644 --- a/lib/pacemaker/pcmk_sched_tickets.c +++ b/lib/pacemaker/pcmk_sched_tickets.c @@ -14,7 +14,6 @@ #include #include -#include #include #include diff --git a/lib/pacemaker/pcmk_scheduler.c b/lib/pacemaker/pcmk_scheduler.c index e1f64ec9df6..0bf698cedab 100644 --- a/lib/pacemaker/pcmk_scheduler.c +++ b/lib/pacemaker/pcmk_scheduler.c @@ -15,8 +15,6 @@ #include #include #include -#include -#include #include diff --git a/lib/pengine/bundle.c b/lib/pengine/bundle.c index 971a560740d..3aeafddc3fd 100644 --- a/lib/pengine/bundle.c +++ b/lib/pengine/bundle.c @@ -17,7 +17,6 @@ #include #include #include -#include #include enum pe__bundle_mount_flags { diff --git a/lib/pengine/clone.c b/lib/pengine/clone.c index c7d3deea437..3325b19ff93 100644 --- a/lib/pengine/clone.c +++ b/lib/pengine/clone.c @@ -17,8 +17,6 @@ #include #include #include -#include -#include typedef struct clone_variant_data_s { int clone_max; diff --git a/lib/pengine/complex.c b/lib/pengine/complex.c index 22980cdcee1..8e33876b9f6 100644 --- a/lib/pengine/complex.c +++ b/lib/pengine/complex.c @@ -15,8 +15,6 @@ #include #include -#include -#include #include "pe_status_private.h" diff --git a/lib/pengine/group.c b/lib/pengine/group.c index f14558b55a5..e280e13d9d1 100644 --- a/lib/pengine/group.c +++ b/lib/pengine/group.c @@ -16,8 +16,6 @@ #include #include #include -#include -#include #include typedef struct group_variant_data_s { diff --git a/lib/pengine/pe_actions.c b/lib/pengine/pe_actions.c index 2f499bef1f4..f3b5109d17d 100644 --- a/lib/pengine/pe_actions.c +++ b/lib/pengine/pe_actions.c @@ -14,9 +14,7 @@ #include #include -#include #include -#include #include "pe_status_private.h" static void unpack_operation(pcmk_action_t *action, const xmlNode *xml_obj, diff --git a/lib/pengine/pe_digest.c b/lib/pengine/pe_digest.c index 0f94a8ce96e..2c809da9b40 100644 --- a/lib/pengine/pe_digest.c +++ b/lib/pengine/pe_digest.c @@ -14,7 +14,6 @@ #include #include -#include #include #include "pe_status_private.h" diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c index 04413f1b82a..c2398958f32 100644 --- a/lib/pengine/pe_output.c +++ b/lib/pengine/pe_output.c @@ -15,9 +15,7 @@ #include // g_strchomp() #include // xmlNode -#include #include -#include #include #include #include diff --git a/lib/pengine/pe_status_private.h b/lib/pengine/pe_status_private.h index d62c7e8f22f..894a40de6ab 100644 --- a/lib/pengine/pe_status_private.h +++ b/lib/pengine/pe_status_private.h @@ -17,7 +17,7 @@ #include // G_GNUC_INTERNAL, GSList, GList, etc. #include // xmlNode -#include // pcmk__op_digest_t +#include // pcmk__op_digest_t #include // pcmk_action_t, etc. #ifdef __cplusplus diff --git a/lib/pengine/remote.c b/lib/pengine/remote.c index 5523c3b332f..84b5ca4972c 100644 --- a/lib/pengine/remote.c +++ b/lib/pengine/remote.c @@ -12,7 +12,6 @@ #include #include -#include #include #include diff --git a/lib/pengine/rules_compat.c b/lib/pengine/rules_compat.c index eceee75833e..b154d8ae309 100644 --- a/lib/pengine/rules_compat.c +++ b/lib/pengine/rules_compat.c @@ -19,7 +19,6 @@ #include #include // pcmk_rule_input_t, etc. -#include // pcmk__nvpair_unpack_t, etc. CRM_TRACE_INIT_DATA(pe_rules); diff --git a/lib/pengine/status.c b/lib/pengine/status.c index 334325aeedf..4f16f3bb56a 100644 --- a/lib/pengine/status.c +++ b/lib/pengine/status.c @@ -17,7 +17,6 @@ #include #include -#include #include #include diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c index 931af1c6376..60b9f86550b 100644 --- a/lib/pengine/unpack.c +++ b/lib/pengine/unpack.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include diff --git a/tools/attrd_updater.c b/tools/attrd_updater.c index 4e95092dc45..6dca3a51f91 100644 --- a/tools/attrd_updater.c +++ b/tools/attrd_updater.c @@ -20,12 +20,6 @@ #include #include -#include -#include -#include -#include - -#include #include diff --git a/tools/cibadmin.c b/tools/cibadmin.c index 6b0cd3f3cdc..fc20bdea950 100644 --- a/tools/cibadmin.c +++ b/tools/cibadmin.c @@ -14,7 +14,6 @@ #include // NULL #include -#include #include #include #include diff --git a/tools/crm_attribute.c b/tools/crm_attribute.c index 47fbc3a10fb..4a2ce9cf72b 100644 --- a/tools/crm_attribute.c +++ b/tools/crm_attribute.c @@ -30,11 +30,7 @@ #include #include -#include -#include -#include #include -#include #include #include diff --git a/tools/crm_error.c b/tools/crm_error.c index 9db7e6e5912..8a0d2f1dde8 100644 --- a/tools/crm_error.c +++ b/tools/crm_error.c @@ -12,9 +12,6 @@ #include #include -#include -#include -#include #include diff --git a/tools/crm_mon.c b/tools/crm_mon.c index fbaf7f4d669..ab42c3bac96 100644 --- a/tools/crm_mon.c +++ b/tools/crm_mon.c @@ -31,15 +31,12 @@ #include #include -#include #include #include #include -#include #include #include #include -#include #include #include diff --git a/tools/crm_mon.h b/tools/crm_mon.h index a0df25036ab..eba01717f54 100644 --- a/tools/crm_mon.h +++ b/tools/crm_mon.h @@ -14,8 +14,8 @@ #include +#include #include -#include #include /* diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c index 20b06b2d014..2732ac00eb4 100644 --- a/tools/crm_mon_curses.c +++ b/tools/crm_mon_curses.c @@ -16,7 +16,6 @@ #include #include -#include #include #include // stonith__history_description() #include diff --git a/tools/crm_node.c b/tools/crm_node.c index 319e34a502b..0a89e7f3cb6 100644 --- a/tools/crm_node.c +++ b/tools/crm_node.c @@ -17,14 +17,11 @@ #include #include -#include -#include #include #include #include #include #include -#include #include diff --git a/tools/crm_resource.c b/tools/crm_resource.c index ac3d7544b42..bbcd5f77738 100644 --- a/tools/crm_resource.c +++ b/tools/crm_resource.c @@ -11,9 +11,6 @@ #include #include -#include -#include -#include #include #include // stonith__agent_exists() #include diff --git a/tools/crm_resource.h b/tools/crm_resource.h index 147365eaaf0..5cf77865a4b 100644 --- a/tools/crm_resource.h +++ b/tools/crm_resource.h @@ -12,18 +12,14 @@ #include #include -#include - -#include +#include +#include #include #include -#include -#include - -#include -#include +#include #include #include +#include #include #define ATTR_SET_ELEMENT "attr_set_element" diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c index 45695f91ed6..65246f1fd2f 100644 --- a/tools/crm_resource_print.c +++ b/tools/crm_resource_print.c @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c index af5f7915be2..07078f53b6e 100644 --- a/tools/crm_resource_runtime.c +++ b/tools/crm_resource_runtime.c @@ -17,9 +17,7 @@ #include // xmlNode #include // xmlXPathObject, etc. -#include #include -#include #include #include diff --git a/tools/crm_rule.c b/tools/crm_rule.c index 9d4f9beae7a..bf22b197c3b 100644 --- a/tools/crm_rule.c +++ b/tools/crm_rule.c @@ -11,8 +11,6 @@ #include -#include -#include #include #include #include diff --git a/tools/crm_shadow.c b/tools/crm_shadow.c index 5a24af009f5..890994815de 100644 --- a/tools/crm_shadow.c +++ b/tools/crm_shadow.c @@ -25,9 +25,7 @@ #include // GOption, etc. -#include #include -#include #include #include diff --git a/tools/crm_simulate.c b/tools/crm_simulate.c index b45af8d67fa..6f08a917f44 100644 --- a/tools/crm_simulate.c +++ b/tools/crm_simulate.c @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/tools/crm_ticket.c b/tools/crm_ticket.c index 5a2b9f3dafd..75ae668e1e1 100644 --- a/tools/crm_ticket.c +++ b/tools/crm_ticket.c @@ -25,7 +25,6 @@ #include #include -#include #include #include diff --git a/tools/crm_verify.c b/tools/crm_verify.c index 12ac6c26e1e..6da34e0259d 100644 --- a/tools/crm_verify.c +++ b/tools/crm_verify.c @@ -9,8 +9,6 @@ #include #include -#include -#include #include #include diff --git a/tools/crmadmin.c b/tools/crmadmin.c index 7ddc452c7d2..281705327d2 100644 --- a/tools/crmadmin.c +++ b/tools/crmadmin.c @@ -18,9 +18,6 @@ #include -#include -#include - #define SUMMARY "query and manage the Pacemaker controller" static enum { diff --git a/tools/iso8601.c b/tools/iso8601.c index d0581fc8788..d8d0a1a7f8a 100644 --- a/tools/iso8601.c +++ b/tools/iso8601.c @@ -12,7 +12,6 @@ #include #include -#include #include #include #include diff --git a/tools/stonith_admin.c b/tools/stonith_admin.c index 4fab87e55ed..431f4705b70 100644 --- a/tools/stonith_admin.c +++ b/tools/stonith_admin.c @@ -27,8 +27,6 @@ #include #include #include -#include -#include #include #include // stonith__register_messages() From 62221485b444489ab338b908e1f3b6d95256b2af Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 15:49:54 -0500 Subject: [PATCH 20/22] Refactor: libcrmcommon: Fix internal includes for unit tests. Ref T777 --- lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c | 1 - lib/common/tests/cmdline/pcmk__new_common_args_test.c | 1 - lib/common/tests/cmdline/pcmk__quote_cmdline_test.c | 1 - lib/common/tests/iso8601/pcmk__add_time_from_xml_test.c | 1 - lib/common/tests/iso8601/pcmk__time_format_hr_test.c | 1 - lib/common/tests/lists/pcmk__subtract_lists_test.c | 1 - lib/common/tests/messages/pcmk__new_message_as_test.c | 3 --- lib/common/tests/nvpair/pcmk__cmp_nvpair_blocks_test.c | 1 - lib/common/tests/nvpair/pcmk__unpack_nvpair_block_test.c | 1 - lib/common/tests/output/pcmk__call_message_test.c | 1 - lib/common/tests/output/pcmk__output_and_clear_error_test.c | 1 - lib/common/tests/output/pcmk__output_free_test.c | 1 - lib/common/tests/output/pcmk__output_new_test.c | 1 - lib/common/tests/output/pcmk__register_format_test.c | 1 - lib/common/tests/output/pcmk__register_formats_test.c | 1 - lib/common/tests/output/pcmk__register_message_test.c | 1 - lib/common/tests/output/pcmk__register_messages_test.c | 1 - lib/common/tests/output/pcmk__unregister_formats_test.c | 1 - lib/common/tests/patchset/pcmk__cib_element_in_patchset_test.c | 1 - lib/common/tests/rules/pcmk__cmp_by_type_test.c | 1 - lib/common/tests/rules/pcmk__evaluate_attr_expression_test.c | 1 - lib/common/tests/rules/pcmk__evaluate_condition_test.c | 1 - lib/common/tests/rules/pcmk__evaluate_date_expression_test.c | 1 - lib/common/tests/rules/pcmk__evaluate_date_spec_test.c | 1 - lib/common/tests/rules/pcmk__evaluate_op_expression_test.c | 1 - lib/common/tests/rules/pcmk__evaluate_rsc_expression_test.c | 1 - lib/common/tests/rules/pcmk__parse_combine_test.c | 1 - lib/common/tests/rules/pcmk__parse_comparison_test.c | 1 - lib/common/tests/rules/pcmk__parse_source_test.c | 1 - lib/common/tests/rules/pcmk__parse_type_test.c | 1 - lib/common/tests/rules/pcmk__replace_submatches_test.c | 1 - lib/common/tests/rules/pcmk_evaluate_rule_test.c | 1 - lib/common/tests/scheduler/pcmk__update_recheck_time_test.c | 1 - lib/common/tests/scheduler/pcmk_has_quorum_test.c | 1 - lib/common/tests/schemas/pcmk__build_schema_xml_node_test.c | 1 - lib/common/tests/schemas/pcmk__cmp_schemas_by_name_test.c | 1 - lib/common/tests/schemas/pcmk__get_schema_test.c | 1 - lib/common/tests/schemas/pcmk__schema_files_later_than_test.c | 1 - lib/common/tests/schemas/pcmk__schema_init_test.c | 1 - lib/common/tests/xml/pcmk__xml_escape_test.c | 1 - lib/common/tests/xml/pcmk__xml_is_name_char_test.c | 1 - lib/common/tests/xml/pcmk__xml_is_name_start_char_test.c | 1 - lib/common/tests/xml/pcmk__xml_needs_escape_test.c | 1 - lib/common/tests/xml/pcmk__xml_sanitize_id_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_attr_is_true_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_first_child_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_foreach_child_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_get_bool_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_get_datetime_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_get_flags_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_next_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_set_bool_test.c | 1 - lib/common/tests/xml_element/pcmk__xe_set_id_test.c | 1 - .../tests/xml_idref/pcmk__xe_dereference_children_test.c | 1 - lib/common/tests/xpath/pcmk__xpath_node_id_test.c | 1 - 55 files changed, 57 deletions(-) diff --git a/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c b/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c index 299fec68697..035be34f984 100644 --- a/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c +++ b/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c @@ -10,7 +10,6 @@ #include #include -#include #include #include diff --git a/lib/common/tests/cmdline/pcmk__new_common_args_test.c b/lib/common/tests/cmdline/pcmk__new_common_args_test.c index 8b92000ac21..48d37f9ff5c 100644 --- a/lib/common/tests/cmdline/pcmk__new_common_args_test.c +++ b/lib/common/tests/cmdline/pcmk__new_common_args_test.c @@ -12,7 +12,6 @@ #include #include -#include #include "mock_private.h" diff --git a/lib/common/tests/cmdline/pcmk__quote_cmdline_test.c b/lib/common/tests/cmdline/pcmk__quote_cmdline_test.c index bd0817909e2..ae09f076e4c 100644 --- a/lib/common/tests/cmdline/pcmk__quote_cmdline_test.c +++ b/lib/common/tests/cmdline/pcmk__quote_cmdline_test.c @@ -10,7 +10,6 @@ #include #include -#include #include diff --git a/lib/common/tests/iso8601/pcmk__add_time_from_xml_test.c b/lib/common/tests/iso8601/pcmk__add_time_from_xml_test.c index 13e1485ce51..fa7f6ab183e 100644 --- a/lib/common/tests/iso8601/pcmk__add_time_from_xml_test.c +++ b/lib/common/tests/iso8601/pcmk__add_time_from_xml_test.c @@ -14,7 +14,6 @@ #include #include -#include #include #include "../../crmcommon_private.h" diff --git a/lib/common/tests/iso8601/pcmk__time_format_hr_test.c b/lib/common/tests/iso8601/pcmk__time_format_hr_test.c index 8c27a868119..ead23e9c8fc 100644 --- a/lib/common/tests/iso8601/pcmk__time_format_hr_test.c +++ b/lib/common/tests/iso8601/pcmk__time_format_hr_test.c @@ -11,7 +11,6 @@ #include // NULL -#include #include #define YEAR_S "2024" diff --git a/lib/common/tests/lists/pcmk__subtract_lists_test.c b/lib/common/tests/lists/pcmk__subtract_lists_test.c index 1198e2ba7d7..803c91c114a 100644 --- a/lib/common/tests/lists/pcmk__subtract_lists_test.c +++ b/lib/common/tests/lists/pcmk__subtract_lists_test.c @@ -10,7 +10,6 @@ #include #include -#include #include diff --git a/lib/common/tests/messages/pcmk__new_message_as_test.c b/lib/common/tests/messages/pcmk__new_message_as_test.c index 0f28f97660c..4c0f958395e 100644 --- a/lib/common/tests/messages/pcmk__new_message_as_test.c +++ b/lib/common/tests/messages/pcmk__new_message_as_test.c @@ -13,9 +13,6 @@ #include // xmlNode #include // pcmk_ipc_controld -#include // pcmk__new_message_as() -#include // pcmk__server_message_type() -#include // pcmk__xe_create(), etc. #include diff --git a/lib/common/tests/nvpair/pcmk__cmp_nvpair_blocks_test.c b/lib/common/tests/nvpair/pcmk__cmp_nvpair_blocks_test.c index e8a3dcbe853..7df8553a208 100644 --- a/lib/common/tests/nvpair/pcmk__cmp_nvpair_blocks_test.c +++ b/lib/common/tests/nvpair/pcmk__cmp_nvpair_blocks_test.c @@ -12,7 +12,6 @@ #include #include -#include #define FIRST_ID "foo" diff --git a/lib/common/tests/nvpair/pcmk__unpack_nvpair_block_test.c b/lib/common/tests/nvpair/pcmk__unpack_nvpair_block_test.c index d39eae71210..bb9a4630b63 100644 --- a/lib/common/tests/nvpair/pcmk__unpack_nvpair_block_test.c +++ b/lib/common/tests/nvpair/pcmk__unpack_nvpair_block_test.c @@ -12,7 +12,6 @@ #include #include -#include #define XML_PASSING_RULE \ "<" PCMK_XE_RULE " " PCMK_XA_ID "='rp' >\n" \ diff --git a/lib/common/tests/output/pcmk__call_message_test.c b/lib/common/tests/output/pcmk__call_message_test.c index 2f6bad9e4cb..8077fce2ba0 100644 --- a/lib/common/tests/output/pcmk__call_message_test.c +++ b/lib/common/tests/output/pcmk__call_message_test.c @@ -12,7 +12,6 @@ #include #include -#include static int default_message_fn(pcmk__output_t *out, va_list args) { diff --git a/lib/common/tests/output/pcmk__output_and_clear_error_test.c b/lib/common/tests/output/pcmk__output_and_clear_error_test.c index 3e52200bf6e..98406147e3b 100644 --- a/lib/common/tests/output/pcmk__output_and_clear_error_test.c +++ b/lib/common/tests/output/pcmk__output_and_clear_error_test.c @@ -12,7 +12,6 @@ #include #include -#include #include diff --git a/lib/common/tests/output/pcmk__output_free_test.c b/lib/common/tests/output/pcmk__output_free_test.c index 030ea09ec80..31b97f99c22 100644 --- a/lib/common/tests/output/pcmk__output_free_test.c +++ b/lib/common/tests/output/pcmk__output_free_test.c @@ -12,7 +12,6 @@ #include #include -#include static int null_message_fn(pcmk__output_t *out, va_list args) { diff --git a/lib/common/tests/output/pcmk__output_new_test.c b/lib/common/tests/output/pcmk__output_new_test.c index af8d3874cfd..9025c4a095d 100644 --- a/lib/common/tests/output/pcmk__output_new_test.c +++ b/lib/common/tests/output/pcmk__output_new_test.c @@ -12,7 +12,6 @@ #include #include -#include #include "mock_private.h" diff --git a/lib/common/tests/output/pcmk__register_format_test.c b/lib/common/tests/output/pcmk__register_format_test.c index bcbde482946..f32ff99f593 100644 --- a/lib/common/tests/output/pcmk__register_format_test.c +++ b/lib/common/tests/output/pcmk__register_format_test.c @@ -10,7 +10,6 @@ #include #include -#include static pcmk__output_t * null_create_fn(char **argv) { diff --git a/lib/common/tests/output/pcmk__register_formats_test.c b/lib/common/tests/output/pcmk__register_formats_test.c index 4be2d7876d6..236e4d99863 100644 --- a/lib/common/tests/output/pcmk__register_formats_test.c +++ b/lib/common/tests/output/pcmk__register_formats_test.c @@ -10,7 +10,6 @@ #include #include -#include static pcmk__output_t * null_create_fn(char **argv) { diff --git a/lib/common/tests/output/pcmk__register_message_test.c b/lib/common/tests/output/pcmk__register_message_test.c index de5045ea002..bf80b15241a 100644 --- a/lib/common/tests/output/pcmk__register_message_test.c +++ b/lib/common/tests/output/pcmk__register_message_test.c @@ -12,7 +12,6 @@ #include #include -#include #include "../../crmcommon_private.h" diff --git a/lib/common/tests/output/pcmk__register_messages_test.c b/lib/common/tests/output/pcmk__register_messages_test.c index 10c0bbdf826..8326f892713 100644 --- a/lib/common/tests/output/pcmk__register_messages_test.c +++ b/lib/common/tests/output/pcmk__register_messages_test.c @@ -12,7 +12,6 @@ #include #include -#include #include "../../crmcommon_private.h" diff --git a/lib/common/tests/output/pcmk__unregister_formats_test.c b/lib/common/tests/output/pcmk__unregister_formats_test.c index 0631c95cf2c..da8d9d6b72b 100644 --- a/lib/common/tests/output/pcmk__unregister_formats_test.c +++ b/lib/common/tests/output/pcmk__unregister_formats_test.c @@ -10,7 +10,6 @@ #include #include -#include static pcmk__output_t * null_create_fn(char **argv) { diff --git a/lib/common/tests/patchset/pcmk__cib_element_in_patchset_test.c b/lib/common/tests/patchset/pcmk__cib_element_in_patchset_test.c index f99fa78a664..56cca4e99e1 100644 --- a/lib/common/tests/patchset/pcmk__cib_element_in_patchset_test.c +++ b/lib/common/tests/patchset/pcmk__cib_element_in_patchset_test.c @@ -13,7 +13,6 @@ #include #include -#include #define ORIG_CIB \ "<" PCMK_XE_CIB " " PCMK_XA_ADMIN_EPOCH "=\"0\"" \ diff --git a/lib/common/tests/rules/pcmk__cmp_by_type_test.c b/lib/common/tests/rules/pcmk__cmp_by_type_test.c index fe041545eb1..0e6fd4f3610 100644 --- a/lib/common/tests/rules/pcmk__cmp_by_type_test.c +++ b/lib/common/tests/rules/pcmk__cmp_by_type_test.c @@ -11,7 +11,6 @@ #include // INT_MIN, INT_MAX -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__evaluate_attr_expression_test.c b/lib/common/tests/rules/pcmk__evaluate_attr_expression_test.c index 64a9f926c25..b229893aa59 100644 --- a/lib/common/tests/rules/pcmk__evaluate_attr_expression_test.c +++ b/lib/common/tests/rules/pcmk__evaluate_attr_expression_test.c @@ -13,7 +13,6 @@ #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__evaluate_condition_test.c b/lib/common/tests/rules/pcmk__evaluate_condition_test.c index 4618f3adbe1..157a6400762 100644 --- a/lib/common/tests/rules/pcmk__evaluate_condition_test.c +++ b/lib/common/tests/rules/pcmk__evaluate_condition_test.c @@ -13,7 +13,6 @@ #include #include -#include #include /* diff --git a/lib/common/tests/rules/pcmk__evaluate_date_expression_test.c b/lib/common/tests/rules/pcmk__evaluate_date_expression_test.c index 581cf6b239e..cfb6bdbf7f5 100644 --- a/lib/common/tests/rules/pcmk__evaluate_date_expression_test.c +++ b/lib/common/tests/rules/pcmk__evaluate_date_expression_test.c @@ -14,7 +14,6 @@ #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__evaluate_date_spec_test.c b/lib/common/tests/rules/pcmk__evaluate_date_spec_test.c index 351d9db67f1..8522f30be8b 100644 --- a/lib/common/tests/rules/pcmk__evaluate_date_spec_test.c +++ b/lib/common/tests/rules/pcmk__evaluate_date_spec_test.c @@ -13,7 +13,6 @@ #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__evaluate_op_expression_test.c b/lib/common/tests/rules/pcmk__evaluate_op_expression_test.c index f9906c9152f..e04497f22f2 100644 --- a/lib/common/tests/rules/pcmk__evaluate_op_expression_test.c +++ b/lib/common/tests/rules/pcmk__evaluate_op_expression_test.c @@ -13,7 +13,6 @@ #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__evaluate_rsc_expression_test.c b/lib/common/tests/rules/pcmk__evaluate_rsc_expression_test.c index 74c1f429c24..e1d24853e5c 100644 --- a/lib/common/tests/rules/pcmk__evaluate_rsc_expression_test.c +++ b/lib/common/tests/rules/pcmk__evaluate_rsc_expression_test.c @@ -13,7 +13,6 @@ #include #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__parse_combine_test.c b/lib/common/tests/rules/pcmk__parse_combine_test.c index afebcf8f3f9..ba3f2b0f348 100644 --- a/lib/common/tests/rules/pcmk__parse_combine_test.c +++ b/lib/common/tests/rules/pcmk__parse_combine_test.c @@ -11,7 +11,6 @@ #include -#include #include static void diff --git a/lib/common/tests/rules/pcmk__parse_comparison_test.c b/lib/common/tests/rules/pcmk__parse_comparison_test.c index a99559620a4..1c9a66c4f68 100644 --- a/lib/common/tests/rules/pcmk__parse_comparison_test.c +++ b/lib/common/tests/rules/pcmk__parse_comparison_test.c @@ -11,7 +11,6 @@ #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__parse_source_test.c b/lib/common/tests/rules/pcmk__parse_source_test.c index 9cf9b3253b2..871dcdb3df4 100644 --- a/lib/common/tests/rules/pcmk__parse_source_test.c +++ b/lib/common/tests/rules/pcmk__parse_source_test.c @@ -11,7 +11,6 @@ #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__parse_type_test.c b/lib/common/tests/rules/pcmk__parse_type_test.c index 96f02c87e41..681d1826386 100644 --- a/lib/common/tests/rules/pcmk__parse_type_test.c +++ b/lib/common/tests/rules/pcmk__parse_type_test.c @@ -11,7 +11,6 @@ #include -#include #include #include "crmcommon_private.h" diff --git a/lib/common/tests/rules/pcmk__replace_submatches_test.c b/lib/common/tests/rules/pcmk__replace_submatches_test.c index f2a48f7b683..5f3b2fd837f 100644 --- a/lib/common/tests/rules/pcmk__replace_submatches_test.c +++ b/lib/common/tests/rules/pcmk__replace_submatches_test.c @@ -11,7 +11,6 @@ #include // regmatch_t -#include #include // An example matched string with submatches diff --git a/lib/common/tests/rules/pcmk_evaluate_rule_test.c b/lib/common/tests/rules/pcmk_evaluate_rule_test.c index ac31f7efd68..0a028076c58 100644 --- a/lib/common/tests/rules/pcmk_evaluate_rule_test.c +++ b/lib/common/tests/rules/pcmk_evaluate_rule_test.c @@ -13,7 +13,6 @@ #include #include -#include #include /* diff --git a/lib/common/tests/scheduler/pcmk__update_recheck_time_test.c b/lib/common/tests/scheduler/pcmk__update_recheck_time_test.c index 73448916453..9da185802f9 100644 --- a/lib/common/tests/scheduler/pcmk__update_recheck_time_test.c +++ b/lib/common/tests/scheduler/pcmk__update_recheck_time_test.c @@ -13,7 +13,6 @@ #include // time_t #include -#include #include static void diff --git a/lib/common/tests/scheduler/pcmk_has_quorum_test.c b/lib/common/tests/scheduler/pcmk_has_quorum_test.c index dc4d5b5f47d..6a5c6b75622 100644 --- a/lib/common/tests/scheduler/pcmk_has_quorum_test.c +++ b/lib/common/tests/scheduler/pcmk_has_quorum_test.c @@ -10,7 +10,6 @@ #include #include -#include #include static void diff --git a/lib/common/tests/schemas/pcmk__build_schema_xml_node_test.c b/lib/common/tests/schemas/pcmk__build_schema_xml_node_test.c index ca0683741c1..3ef480f5228 100644 --- a/lib/common/tests/schemas/pcmk__build_schema_xml_node_test.c +++ b/lib/common/tests/schemas/pcmk__build_schema_xml_node_test.c @@ -11,7 +11,6 @@ #include #include -#include #include diff --git a/lib/common/tests/schemas/pcmk__cmp_schemas_by_name_test.c b/lib/common/tests/schemas/pcmk__cmp_schemas_by_name_test.c index 74e0ba42b6a..cc968c80a86 100644 --- a/lib/common/tests/schemas/pcmk__cmp_schemas_by_name_test.c +++ b/lib/common/tests/schemas/pcmk__cmp_schemas_by_name_test.c @@ -11,7 +11,6 @@ #include #include -#include #include "crmcommon_private.h" static int diff --git a/lib/common/tests/schemas/pcmk__get_schema_test.c b/lib/common/tests/schemas/pcmk__get_schema_test.c index 09b74fc41d5..d9c999fca1e 100644 --- a/lib/common/tests/schemas/pcmk__get_schema_test.c +++ b/lib/common/tests/schemas/pcmk__get_schema_test.c @@ -11,7 +11,6 @@ #include #include -#include #include "crmcommon_private.h" static int diff --git a/lib/common/tests/schemas/pcmk__schema_files_later_than_test.c b/lib/common/tests/schemas/pcmk__schema_files_later_than_test.c index c48944da3e8..056ee26405b 100644 --- a/lib/common/tests/schemas/pcmk__schema_files_later_than_test.c +++ b/lib/common/tests/schemas/pcmk__schema_files_later_than_test.c @@ -10,7 +10,6 @@ #include #include -#include #include diff --git a/lib/common/tests/schemas/pcmk__schema_init_test.c b/lib/common/tests/schemas/pcmk__schema_init_test.c index 9c69f424578..2b2196a69cf 100644 --- a/lib/common/tests/schemas/pcmk__schema_init_test.c +++ b/lib/common/tests/schemas/pcmk__schema_init_test.c @@ -14,7 +14,6 @@ #include #include -#include #include "crmcommon_private.h" static char *remote_schema_dir = NULL; diff --git a/lib/common/tests/xml/pcmk__xml_escape_test.c b/lib/common/tests/xml/pcmk__xml_escape_test.c index 5894aecdef4..39972cdfa1d 100644 --- a/lib/common/tests/xml/pcmk__xml_escape_test.c +++ b/lib/common/tests/xml/pcmk__xml_escape_test.c @@ -10,7 +10,6 @@ #include #include -#include #include "crmcommon_private.h" diff --git a/lib/common/tests/xml/pcmk__xml_is_name_char_test.c b/lib/common/tests/xml/pcmk__xml_is_name_char_test.c index 4f450ba28d9..2187fb99683 100644 --- a/lib/common/tests/xml/pcmk__xml_is_name_char_test.c +++ b/lib/common/tests/xml/pcmk__xml_is_name_char_test.c @@ -14,7 +14,6 @@ #include // gchar, g_ascii_isalnum(), etc. #include -#include #include "crmcommon_private.h" // pcmk__xml_is_name_char() diff --git a/lib/common/tests/xml/pcmk__xml_is_name_start_char_test.c b/lib/common/tests/xml/pcmk__xml_is_name_start_char_test.c index fe34661d088..5d264a6c67a 100644 --- a/lib/common/tests/xml/pcmk__xml_is_name_start_char_test.c +++ b/lib/common/tests/xml/pcmk__xml_is_name_start_char_test.c @@ -15,7 +15,6 @@ #include // xmlGetUTF8Char() #include -#include #include "crmcommon_private.h" // pcmk__xml_is_name_start_char() diff --git a/lib/common/tests/xml/pcmk__xml_needs_escape_test.c b/lib/common/tests/xml/pcmk__xml_needs_escape_test.c index a1c13260036..7366f9ba4e3 100644 --- a/lib/common/tests/xml/pcmk__xml_needs_escape_test.c +++ b/lib/common/tests/xml/pcmk__xml_needs_escape_test.c @@ -10,7 +10,6 @@ #include #include -#include #include "crmcommon_private.h" diff --git a/lib/common/tests/xml/pcmk__xml_sanitize_id_test.c b/lib/common/tests/xml/pcmk__xml_sanitize_id_test.c index 0fa10c54f35..cdf2ed9ed87 100644 --- a/lib/common/tests/xml/pcmk__xml_sanitize_id_test.c +++ b/lib/common/tests/xml/pcmk__xml_sanitize_id_test.c @@ -10,7 +10,6 @@ #include #include -#include static void assert_sanitized(const char *str, const char *reference) diff --git a/lib/common/tests/xml_element/pcmk__xe_attr_is_true_test.c b/lib/common/tests/xml_element/pcmk__xe_attr_is_true_test.c index 498e45e4a83..ebbe8901bb0 100644 --- a/lib/common/tests/xml_element/pcmk__xe_attr_is_true_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_attr_is_true_test.c @@ -12,7 +12,6 @@ #include #include -#include static void empty_input(void **state) diff --git a/lib/common/tests/xml_element/pcmk__xe_first_child_test.c b/lib/common/tests/xml_element/pcmk__xe_first_child_test.c index 41ea91b1177..56e8f1e6c9f 100644 --- a/lib/common/tests/xml_element/pcmk__xe_first_child_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_first_child_test.c @@ -11,7 +11,6 @@ #include #include -#include const char *str1 = "\n" diff --git a/lib/common/tests/xml_element/pcmk__xe_foreach_child_test.c b/lib/common/tests/xml_element/pcmk__xe_foreach_child_test.c index 12302d4aa16..e1ab5f10137 100644 --- a/lib/common/tests/xml_element/pcmk__xe_foreach_child_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_foreach_child_test.c @@ -10,7 +10,6 @@ #include #include -#include static int compare_name_handler(xmlNode *xml, void *userdata) { function_called(); diff --git a/lib/common/tests/xml_element/pcmk__xe_get_bool_test.c b/lib/common/tests/xml_element/pcmk__xe_get_bool_test.c index 2df62b96702..634426a03f0 100644 --- a/lib/common/tests/xml_element/pcmk__xe_get_bool_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_get_bool_test.c @@ -12,7 +12,6 @@ #include #include -#include static void empty_input(void **state) diff --git a/lib/common/tests/xml_element/pcmk__xe_get_datetime_test.c b/lib/common/tests/xml_element/pcmk__xe_get_datetime_test.c index 716c9f627e5..bad68bffbf1 100644 --- a/lib/common/tests/xml_element/pcmk__xe_get_datetime_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_get_datetime_test.c @@ -16,7 +16,6 @@ #include #include -#include #define REFERENCE_ISO8601 "2024-001" #define ATTR_PRESENT "start" diff --git a/lib/common/tests/xml_element/pcmk__xe_get_flags_test.c b/lib/common/tests/xml_element/pcmk__xe_get_flags_test.c index b91b1fa85d0..7f26333496b 100644 --- a/lib/common/tests/xml_element/pcmk__xe_get_flags_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_get_flags_test.c @@ -16,7 +16,6 @@ #include #include -#include #define DEFAULT_VALUE 0xfff diff --git a/lib/common/tests/xml_element/pcmk__xe_next_test.c b/lib/common/tests/xml_element/pcmk__xe_next_test.c index a57dce43bc8..2a293679cf8 100644 --- a/lib/common/tests/xml_element/pcmk__xe_next_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_next_test.c @@ -11,7 +11,6 @@ #include #include -#include static void null_xml(void **state) diff --git a/lib/common/tests/xml_element/pcmk__xe_set_bool_test.c b/lib/common/tests/xml_element/pcmk__xe_set_bool_test.c index 2985fb53b06..0670add77fb 100644 --- a/lib/common/tests/xml_element/pcmk__xe_set_bool_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_set_bool_test.c @@ -12,7 +12,6 @@ #include #include -#include #include static void diff --git a/lib/common/tests/xml_element/pcmk__xe_set_id_test.c b/lib/common/tests/xml_element/pcmk__xe_set_id_test.c index 8c7f6c19e8f..015f332f1e4 100644 --- a/lib/common/tests/xml_element/pcmk__xe_set_id_test.c +++ b/lib/common/tests/xml_element/pcmk__xe_set_id_test.c @@ -10,7 +10,6 @@ #include #include -#include static void null_node(void **state) diff --git a/lib/common/tests/xml_idref/pcmk__xe_dereference_children_test.c b/lib/common/tests/xml_idref/pcmk__xe_dereference_children_test.c index 9f41f2f1c58..103b0121f4b 100644 --- a/lib/common/tests/xml_idref/pcmk__xe_dereference_children_test.c +++ b/lib/common/tests/xml_idref/pcmk__xe_dereference_children_test.c @@ -12,7 +12,6 @@ #include // GList, GHashTable, etc. #include -#include /*! * \internal diff --git a/lib/common/tests/xpath/pcmk__xpath_node_id_test.c b/lib/common/tests/xpath/pcmk__xpath_node_id_test.c index 35c0c1a0738..509b1720fef 100644 --- a/lib/common/tests/xpath/pcmk__xpath_node_id_test.c +++ b/lib/common/tests/xpath/pcmk__xpath_node_id_test.c @@ -11,7 +11,6 @@ #include #include -#include static void empty_input(void **state) { From ce0c423c2bd4b8b28d0f7cf3833b312b7b0c169b Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 26 Nov 2025 15:50:52 -0500 Subject: [PATCH 21/22] Test: test-headers.sh: Set internal include guards before testing headers. These need to be defined or else testing internal headers will fail due to the #error preprocessor directives. --- tests/test-headers.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test-headers.sh b/tests/test-headers.sh index 0976d4b75e0..764431dfca9 100644 --- a/tests/test-headers.sh +++ b/tests/test-headers.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2022-2024 the Pacemaker project contributors +# Copyright 2022-2026 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -33,6 +33,8 @@ do PROTECT="PCMK__$(echo "$NAME" | tr '[:lower:]/\-\.' '[:upper:]___' | sed 's/_H$/__H/')" cat >"$TESTFILE" < #ifndef $PROTECT #error no $PROTECT header protector in file $i From 620d33481a46659c83acf683864a087038ea0e37 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 5 Jan 2026 11:14:29 -0500 Subject: [PATCH 22/22] Refactor: include: Move PCMK__NELEMS to utils_internal.h. --- include/crm/common/internal.h | 5 +---- include/crm/common/utils_internal.h | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/crm/common/internal.h b/include/crm/common/internal.h index c150cfc6327..874cd162a89 100644 --- a/include/crm/common/internal.h +++ b/include/crm/common/internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2025 the Pacemaker project contributors + * Copyright 2015-2026 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -74,9 +74,6 @@ extern "C" { #endif -// Number of elements in a statically defined array -#define PCMK__NELEM(a) ((int) (sizeof(a)/sizeof(a[0])) ) - #ifdef __cplusplus } #endif diff --git a/include/crm/common/utils_internal.h b/include/crm/common/utils_internal.h index dff3690b163..08f49a0d430 100644 --- a/include/crm/common/utils_internal.h +++ b/include/crm/common/utils_internal.h @@ -21,6 +21,9 @@ extern "C" { #endif +// Number of elements in a statically defined array +#define PCMK__NELEM(a) ((int) (sizeof(a)/sizeof(a[0])) ) + int pcmk__compare_versions(const char *version1, const char *version2); int pcmk__daemon_user(uid_t *uid, gid_t *gid); char *pcmk__generate_uuid(void);