diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h index d9423c8915e..189b00c0225 100644 --- a/daemons/attrd/pacemaker-attrd.h +++ b/daemons/attrd/pacemaker-attrd.h @@ -11,6 +11,7 @@ # define PACEMAKER_ATTRD__H #include +#include #include #include #include @@ -114,19 +115,19 @@ void attrd_remove_voter(const pcmk__node_status_t *peer); void attrd_xml_add_writer(xmlNode *xml); enum attrd_attr_flags { - attrd_attr_none = 0U, + attrd_attr_none = 0, // At least one of attribute's values has changed since last write - attrd_attr_changed = (1U << 0), + attrd_attr_changed = (UINT32_C(1) << 0), // At least one of attribute's values has an unknown node XML ID - attrd_attr_node_unknown = (1U << 1), + attrd_attr_node_unknown = (UINT32_C(1) << 1), // This attribute should never be written to the CIB - attrd_attr_is_private = (1U << 2), + attrd_attr_is_private = (UINT32_C(1) << 2), // Ignore any configured delay for next write of this attribute - attrd_attr_force_write = (1U << 3), + attrd_attr_force_write = (UINT32_C(1) << 3), }; typedef struct attribute_s { @@ -154,9 +155,13 @@ typedef struct attribute_s { } while (0) enum attrd_value_flags { - attrd_value_none = 0U, - attrd_value_remote = (1U << 0), // Value is for Pacemaker Remote node - attrd_value_from_peer = (1U << 1), // Value is from peer sync response + attrd_value_none = 0, + + //! Value is for Pacemaker Remote node + attrd_value_remote = (UINT32_C(1) << 0), + + //! Value is from peer sync response + attrd_value_from_peer = (UINT32_C(1) << 1), }; typedef struct attribute_value_s { @@ -214,8 +219,8 @@ char *attrd_nvpair_id(const attribute_t *attr, const char *node_state_id); enum attrd_write_options { attrd_write_changed = 0, - attrd_write_all = (1 << 0), - attrd_write_no_delay = (1 << 1), + attrd_write_all = (UINT32_C(1) << 0), + attrd_write_no_delay = (UINT32_C(1) << 1), }; void attrd_write_attributes(uint32_t options); diff --git a/daemons/controld/controld_control.c b/daemons/controld/controld_control.c index 2804497edaf..47c131f623c 100644 --- a/daemons/controld/controld_control.c +++ b/daemons/controld/controld_control.c @@ -479,35 +479,35 @@ do_started(long long action, } else if (!pcmk__is_set(controld_globals.fsa_input_register, R_MEMBERSHIP)) { - crm_info("Delaying start, no membership data (%.16llx)", R_MEMBERSHIP); + crm_info("Delaying start, no membership data (%.16" PRIx64 ")", R_MEMBERSHIP); crmd_fsa_stall(TRUE); return; } else if (!pcmk__is_set(controld_globals.fsa_input_register, R_LRM_CONNECTED)) { - crm_info("Delaying start, not connected to executor (%.16llx)", R_LRM_CONNECTED); + crm_info("Delaying start, not connected to executor (%.16" PRIx64 ")", R_LRM_CONNECTED); crmd_fsa_stall(TRUE); return; } else if (!pcmk__is_set(controld_globals.fsa_input_register, R_CIB_CONNECTED)) { - crm_info("Delaying start, CIB not connected (%.16llx)", R_CIB_CONNECTED); + crm_info("Delaying start, CIB not connected (%.16" PRIx64 ")", R_CIB_CONNECTED); crmd_fsa_stall(TRUE); return; } else if (!pcmk__is_set(controld_globals.fsa_input_register, R_READ_CONFIG)) { - crm_info("Delaying start, Config not read (%.16llx)", R_READ_CONFIG); + crm_info("Delaying start, Config not read (%.16" PRIx64 ")", R_READ_CONFIG); crmd_fsa_stall(TRUE); return; } else if (!pcmk__is_set(controld_globals.fsa_input_register, R_PEER_DATA)) { - crm_info("Delaying start, No peer data (%.16llx)", R_PEER_DATA); + crm_info("Delaying start, No peer data (%.16" PRIx64 ")", R_PEER_DATA); crmd_fsa_stall(TRUE); return; } diff --git a/daemons/controld/controld_fsa.h b/daemons/controld/controld_fsa.h index 93a2e2464d3..9ccbe10e317 100644 --- a/daemons/controld/controld_fsa.h +++ b/daemons/controld/controld_fsa.h @@ -10,6 +10,7 @@ #ifndef CRMD_FSA__H # define CRMD_FSA__H +# include // UINT64_C, PRIx64 # include # include # include @@ -209,135 +210,133 @@ enum crmd_fsa_input { * *======================================*/ - /* Don't do anything */ -# define A_NOTHING 0x0000000000000000ULL +/* Don't do anything */ +# define A_NOTHING (UINT64_C(0)) /* -- Startup actions -- */ - /* Hook to perform any actions (other than connecting to other daemons) - * that might be needed as part of the startup. - */ -# define A_STARTUP 0x0000000000000001ULL - /* Hook to perform any actions that might be needed as part - * after startup is successful. - */ -# define A_STARTED 0x0000000000000002ULL - /* Connect to cluster layer */ -# define A_HA_CONNECT 0x0000000000000004ULL -# define A_HA_DISCONNECT 0x0000000000000008ULL - -# define A_INTEGRATE_TIMER_START 0x0000000000000010ULL -# define A_INTEGRATE_TIMER_STOP 0x0000000000000020ULL -# define A_FINALIZE_TIMER_START 0x0000000000000040ULL -# define A_FINALIZE_TIMER_STOP 0x0000000000000080ULL +/* Hook to perform any actions (other than connecting to other daemons) that + * might be needed as part of the startup. + */ +# define A_STARTUP (UINT64_C(1) << 0) +/* Hook to perform any actions that might be needed as part after startup is + * successful. + */ +# define A_STARTED (UINT64_C(1) << 1) +/* Connect to cluster layer */ +# define A_HA_CONNECT (UINT64_C(1) << 2) +# define A_HA_DISCONNECT (UINT64_C(1) << 3) + +# define A_INTEGRATE_TIMER_START (UINT64_C(1) << 4) +# define A_INTEGRATE_TIMER_STOP (UINT64_C(1) << 5) +# define A_FINALIZE_TIMER_START (UINT64_C(1) << 6) +# define A_FINALIZE_TIMER_STOP (UINT64_C(1) << 7) /* -- Election actions -- */ -# define A_DC_TIMER_START 0x0000000000000100ULL -# define A_DC_TIMER_STOP 0x0000000000000200ULL -# define A_ELECTION_COUNT 0x0000000000000400ULL -# define A_ELECTION_VOTE 0x0000000000000800ULL +# define A_DC_TIMER_START (UINT64_C(1) << 8) +# define A_DC_TIMER_STOP (UINT64_C(1) << 9) +# define A_ELECTION_COUNT (UINT64_C(1) << 10) +# define A_ELECTION_VOTE (UINT64_C(1) << 11) -# define A_ELECTION_START 0x0000000000001000ULL +# define A_ELECTION_START (UINT64_C(1) << 12) /* -- Message processing -- */ - /* Process the queue of requests */ -# define A_MSG_PROCESS 0x0000000000002000ULL - /* Send the message to the correct recipient */ -# define A_MSG_ROUTE 0x0000000000004000ULL +/* Process the queue of requests */ +# define A_MSG_PROCESS (UINT64_C(1) << 13) +/* Send the message to the correct recipient */ +# define A_MSG_ROUTE (UINT64_C(1) << 14) - /* Send a welcome message to new node(s) */ -# define A_DC_JOIN_OFFER_ONE 0x0000000000008000ULL +/* Send a welcome message to new node(s) */ +# define A_DC_JOIN_OFFER_ONE (UINT64_C(1) << 15) /* -- Server Join protocol actions -- */ - /* Send a welcome message to all nodes */ -# define A_DC_JOIN_OFFER_ALL 0x0000000000010000ULL - /* Process the remote node's ack of our join message */ -# define A_DC_JOIN_PROCESS_REQ 0x0000000000020000ULL - /* Send out the results of the Join phase */ -# define A_DC_JOIN_FINALIZE 0x0000000000040000ULL - /* Send out the results of the Join phase */ -# define A_DC_JOIN_PROCESS_ACK 0x0000000000080000ULL +/* Send a welcome message to all nodes */ +# define A_DC_JOIN_OFFER_ALL (UINT64_C(1) << 16) +/* Process the remote node's ack of our join message */ +# define A_DC_JOIN_PROCESS_REQ (UINT64_C(1) << 17) +/* Send out the results of the Join phase */ +# define A_DC_JOIN_FINALIZE (UINT64_C(1) << 18) +/* Send out the results of the Join phase */ +# define A_DC_JOIN_PROCESS_ACK (UINT64_C(1) << 19) /* -- Client Join protocol actions -- */ -# define A_CL_JOIN_QUERY 0x0000000000100000ULL -# define A_CL_JOIN_ANNOUNCE 0x0000000000200000ULL - /* Request membership to the DC list */ -# define A_CL_JOIN_REQUEST 0x0000000000400000ULL - /* Did the DC accept or reject the request */ -# define A_CL_JOIN_RESULT 0x0000000000800000ULL +# define A_CL_JOIN_QUERY (UINT64_C(1) << 20) +# define A_CL_JOIN_ANNOUNCE (UINT64_C(1) << 21) +/* Request membership to the DC list */ +# define A_CL_JOIN_REQUEST (UINT64_C(1) << 22) +/* Did the DC accept or reject the request */ +# define A_CL_JOIN_RESULT (UINT64_C(1) << 23) /* -- Recovery, DC start/stop -- */ - /* Something bad happened, try to recover */ -# define A_RECOVER 0x0000000001000000ULL - /* Hook to perform any actions (apart from starting, the TE, scheduler, - * and gathering the latest CIB) that might be necessary before - * giving up the responsibilities of being the DC. - */ -# define A_DC_RELEASE 0x0000000002000000ULL - /* */ -# define A_DC_RELEASED 0x0000000004000000ULL - /* Hook to perform any actions (apart from starting, the TE, scheduler, - * and gathering the latest CIB) that might be necessary before - * taking over the responsibilities of being the DC. - */ -# define A_DC_TAKEOVER 0x0000000008000000ULL +/* Something bad happened, try to recover */ +# define A_RECOVER (UINT64_C(1) << 24) +/* Hook to perform any actions (apart from starting, the TE, scheduler, and + * gathering the latest CIB) that might be necessary before giving up the + * responsibilities of being the DC. + */ +# define A_DC_RELEASE (UINT64_C(1) << 25) +# define A_DC_RELEASED (UINT64_C(1) << 26) +/* Hook to perform any actions (apart from starting, the TE, scheduler, and + * gathering the latest CIB) that might be necessary before taking over the + * responsibilities of being the DC. + */ +# define A_DC_TAKEOVER (UINT64_C(1) << 27) /* -- Shutdown actions -- */ -# define A_SHUTDOWN 0x0000000010000000ULL -# define A_STOP 0x0000000020000000ULL -# define A_EXIT_0 0x0000000040000000ULL -# define A_EXIT_1 0x0000000080000000ULL +# define A_SHUTDOWN (UINT64_C(1) << 28) +# define A_STOP (UINT64_C(1) << 29) +# define A_EXIT_0 (UINT64_C(1) << 30) +# define A_EXIT_1 (UINT64_C(1) << 31) -# define A_SHUTDOWN_REQ 0x0000000100000000ULL -# define A_ELECTION_CHECK 0x0000000200000000ULL -# define A_DC_JOIN_FINAL 0x0000000400000000ULL +# define A_SHUTDOWN_REQ (UINT64_C(1) << 32) +# define A_ELECTION_CHECK (UINT64_C(1) << 33) +# define A_DC_JOIN_FINAL (UINT64_C(1) << 34) /* -- CIB actions -- */ -# define A_CIB_START 0x0000020000000000ULL -# define A_CIB_STOP 0x0000040000000000ULL +# define A_CIB_START (UINT64_C(1) << 41) +# define A_CIB_STOP (UINT64_C(1) << 42) /* -- Transition Engine actions -- */ - /* Attempt to reach the newly calculated cluster state. This is - * only called once per transition (except if it is asked to - * stop the transition or start a new one). - * Once given a cluster state to reach, the TE will determine - * tasks that can be performed in parallel, execute them, wait - * for replies and then determine the next set until the new - * state is reached or no further tasks can be taken. - */ -# define A_TE_INVOKE 0x0000100000000000ULL -# define A_TE_START 0x0000200000000000ULL -# define A_TE_STOP 0x0000400000000000ULL -# define A_TE_CANCEL 0x0000800000000000ULL -# define A_TE_HALT 0x0001000000000000ULL +/* Attempt to reach the newly calculated cluster state. This is only called + * once per transition (except if it is asked to stop the transition or start + * a new one). Once given a cluster state to reach, the TE will determine + * tasks that can be performed in parallel, execute them, wait for replies and + * then determine the next set until the new state is reached or no further + * tasks can be taken. + */ +# define A_TE_INVOKE (UINT64_C(1) << 44) +# define A_TE_START (UINT64_C(1) << 45) +# define A_TE_STOP (UINT64_C(1) << 46) +# define A_TE_CANCEL (UINT64_C(1) << 47) +# define A_TE_HALT (UINT64_C(1) << 48) /* -- Scheduler actions -- */ - /* Calculate the next state for the cluster. This is only - * invoked once per needed calculation. - */ -# define A_PE_INVOKE 0x0002000000000000ULL -# define A_PE_START 0x0004000000000000ULL -# define A_PE_STOP 0x0008000000000000ULL +/* Calculate the next state for the cluster. This is only invoked once per + * needed calculation. + */ +# define A_PE_INVOKE (UINT64_C(1) << 49) +# define A_PE_START (UINT64_C(1) << 50) +# define A_PE_STOP (UINT64_C(1) << 51) /* -- Misc actions -- */ - /* Add a system generate "block" so that resources arent moved - * to or are activly moved away from the affected node. This - * way we can return quickly even if busy with other things. - */ -# define A_NODE_BLOCK 0x0010000000000000ULL - /* Update our information in the local CIB */ -# define A_UPDATE_NODESTATUS 0x0020000000000000ULL -# define A_READCONFIG 0x0080000000000000ULL +/* Add a system generate "block" so that resources arent moved to or are + * activly moved away from the affected node. This way we can return quickly + * even if busy with other things. + */ +# define A_NODE_BLOCK (UINT64_C(1) << 52) +/* Update our information in the local CIB */ +# define A_UPDATE_NODESTATUS (UINT64_C(1) << 53) +# define A_READCONFIG (UINT64_C(1) << 55) /* -- LRM Actions -- */ - // Connect to the local executor -# define A_LRM_CONNECT 0x0100000000000000ULL - // Disconnect from the local executor -# define A_LRM_DISCONNECT 0x0200000000000000ULL -# define A_LRM_INVOKE 0x0400000000000000ULL +/* Connect to the local executor */ +# define A_LRM_CONNECT (UINT64_C(1) << 56) +/* Disconnect from the local executor */ +# define A_LRM_DISCONNECT (UINT64_C(1) << 57) +# define A_LRM_INVOKE (UINT64_C(1) << 58) /* -- Logging actions -- */ -# define A_LOG 0x1000000000000000ULL -# define A_ERROR 0x2000000000000000ULL -# define A_WARN 0x4000000000000000ULL +# define A_LOG (UINT64_C(1) << 60) +# define A_ERROR (UINT64_C(1) << 61) +# define A_WARN (UINT64_C(1) << 62) # define O_EXIT (A_SHUTDOWN|A_STOP|A_LRM_DISCONNECT|A_HA_DISCONNECT|A_EXIT_0|A_CIB_STOP) # define O_RELEASE (A_DC_TIMER_STOP|A_DC_RELEASE|A_PE_STOP|A_TE_STOP|A_DC_RELEASED) @@ -355,62 +354,70 @@ enum crmd_fsa_input { * These also count as inputs for synthesizing I_* * *======================================*/ -# define R_THE_DC 0x00000001ULL - /* Are we the DC? */ -# define R_STARTING 0x00000002ULL - /* Are we starting up? */ -# define R_SHUTDOWN 0x00000004ULL - /* Are we trying to shut down? */ -# define R_STAYDOWN 0x00000008ULL - /* Should we restart? */ - -# define R_JOIN_OK 0x00000010ULL /* Have we completed the join process */ -# define R_READ_CONFIG 0x00000040ULL -# define R_INVOKE_PE 0x00000080ULL // Should the scheduler be invoked? - -# define R_CIB_CONNECTED 0x00000100ULL - /* Is the CIB connected? */ -# define R_PE_CONNECTED 0x00000200ULL // Is the scheduler connected? -# define R_TE_CONNECTED 0x00000400ULL - /* Is the Transition Engine connected? */ -# define R_LRM_CONNECTED 0x00000800ULL // Is the executor connected? - -# define R_CIB_REQUIRED 0x00001000ULL - /* Is the CIB required? */ -# define R_PE_REQUIRED 0x00002000ULL // Is the scheduler required? -# define R_TE_REQUIRED 0x00004000ULL - /* Is the Transition Engine required? */ -# define R_ST_REQUIRED 0x00008000ULL - /* Is the fencer daemon required? */ - -# define R_CIB_DONE 0x00010000ULL - /* Have we calculated the CIB? */ -# define R_HAVE_CIB 0x00020000ULL /* Do we have an up-to-date CIB */ - -# define R_MEMBERSHIP 0x00100000ULL /* Have we got cluster layer data yet */ +// Are we the DC? +# define R_THE_DC (UINT64_C(1) << 0) +// Are we starting up? +# define R_STARTING (UINT64_C(1) << 1) +// Are we trying to shut down? +# define R_SHUTDOWN (UINT64_C(1) << 2) +// Should we restart? +# define R_STAYDOWN (UINT64_C(1) << 3) + +// Have we completed the join process? +# define R_JOIN_OK (UINT64_C(1) << 4) +// Has the configuration been read? +# define R_READ_CONFIG (UINT64_C(1) << 6) +// Should the scheduler be invoked? +# define R_INVOKE_PE (UINT64_C(1) << 7) + +// Is the CIB connected? +# define R_CIB_CONNECTED (UINT64_C(1) << 8) +// Is the scheduler connected? +# define R_PE_CONNECTED (UINT64_C(1) << 9) +// Is the Transition Engine connected? +# define R_TE_CONNECTED (UINT64_C(1) << 10) +// Is the executor connected? +# define R_LRM_CONNECTED (UINT64_C(1) << 11) + +// Is the CIB required? +# define R_CIB_REQUIRED (UINT64_C(1) << 12) +// Is the scheduler required? +# define R_PE_REQUIRED (UINT64_C(1) << 13) +// Is the Transition Engine required? +# define R_TE_REQUIRED (UINT64_C(1) << 14) +// Is the fencer daemon required? +# define R_ST_REQUIRED (UINT64_C(1) << 15) + +// Have we calculated the CIB? +# define R_CIB_DONE (UINT64_C(1) << 16) +// Do we have an up-to-date CIB? +# define R_HAVE_CIB (UINT64_C(1) << 17) + +// Have we received cluster layer data yet? +# define R_MEMBERSHIP (UINT64_C(1) << 20) // Ever received membership-layer data -# define R_PEER_DATA 0x00200000ULL - -# define R_HA_DISCONNECTED 0x00400000ULL /* did we sign out of our own accord */ - -# define R_REQ_PEND 0x01000000ULL - /* Are there Requests waiting for - processing? */ -# define R_PE_PEND 0x02000000ULL // Are we awaiting reply from scheduler? -# define R_TE_PEND 0x04000000ULL - /* Has the TE been invoked and we're - awaiting completion? */ -# define R_RESP_PEND 0x08000000ULL - /* Do we have clients waiting on a - response? if so perhaps we shouldn't - stop yet */ - -# define R_SENT_RSC_STOP 0x20000000ULL /* Have we sent a stop action to all - * resources in preparation for - * shutting down */ - -# define R_IN_RECOVERY 0x80000000ULL +# define R_PEER_DATA (UINT64_C(1) << 21) + +// Did we sign out of our own accord? +# define R_HA_DISCONNECTED (UINT64_C(1) << 22) + +// Are there requests waiting for processing? +# define R_REQ_PEND (UINT64_C(1) << 24) +// Are we awaiting reply from scheduler? +# define R_PE_PEND (UINT64_C(1) << 25) +// Has the TE been invoked and we're awaiting completion? +# define R_TE_PEND (UINT64_C(1) << 26) +// Do we have clients waiting on a response? If so perhaps we +// shouldn't stop yet. +# define R_RESP_PEND (UINT64_C(1) << 27) + +// Have we sent a stop action to all resources in preparation for +// shutting down? +# define R_SENT_RSC_STOP (UINT64_C(1) << 29) + +// Are we in recovery mode? +# define R_IN_RECOVERY (UINT64_C(1) << 31) #define CRM_DIRECT_NACK_RC (99) // Deprecated (see PCMK_EXEC_INVALID) diff --git a/daemons/controld/controld_globals.h b/daemons/controld/controld_globals.h index d8d2180d6a3..f6ed3d32568 100644 --- a/daemons/controld/controld_globals.h +++ b/daemons/controld/controld_globals.h @@ -129,22 +129,22 @@ controld_fsa_message_queue_length(void) */ enum controld_flags { //! The DC left in a membership change that is being processed - controld_dc_left = (1 << 0), + controld_dc_left = (UINT32_C(1) << 0), //! The FSA is stalled waiting for further input - controld_fsa_is_stalled = (1 << 1), + controld_fsa_is_stalled = (UINT32_C(1) << 1), //! The local node has been in a quorate partition at some point - controld_ever_had_quorum = (1 << 2), + controld_ever_had_quorum = (UINT32_C(1) << 2), //! The local node is currently in a quorate partition - controld_has_quorum = (1 << 3), + controld_has_quorum = (UINT32_C(1) << 3), //! Panic the local node if it loses quorum - controld_no_quorum_panic = (1 << 4), + controld_no_quorum_panic = (UINT32_C(1) << 4), //! Lock resources to the local node when it shuts down cleanly - controld_shutdown_lock_enabled = (1 << 5), + controld_shutdown_lock_enabled = (UINT32_C(1) << 5), }; # define controld_set_global_flags(flags_to_set) do { \ diff --git a/daemons/controld/controld_lrm.h b/daemons/controld/controld_lrm.h index e28ade33721..f02a901869a 100644 --- a/daemons/controld/controld_lrm.h +++ b/daemons/controld/controld_lrm.h @@ -9,6 +9,7 @@ #ifndef CONTROLD_LRM__H # define CONTROLD_LRM__H +#include // UINT32_C #include // lrmd_t #include @@ -38,8 +39,8 @@ typedef struct resource_history_s { void history_free(gpointer data); enum active_op_e { - active_op_remove = (1 << 0), - active_op_cancelled = (1 << 1), + active_op_remove = (UINT32_C(1) << 0), + active_op_cancelled = (UINT32_C(1) << 1), }; // In-flight action (recurring or pending) diff --git a/daemons/controld/controld_metadata.h b/daemons/controld/controld_metadata.h index 12ea327e4ed..b38794178b5 100644 --- a/daemons/controld/controld_metadata.h +++ b/daemons/controld/controld_metadata.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the Pacemaker project contributors + * Copyright 2017-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -29,20 +29,23 @@ * compliance and does not advertise the reload-agent action. */ enum ra_flags_e { - ra_supports_legacy_reload = (1 << 0), - ra_supports_reload_agent = (1 << 1), + ra_supports_legacy_reload = (UINT32_C(1) << 0), + ra_supports_reload_agent = (UINT32_C(1) << 1), }; enum ra_param_flags_e { - ra_param_unique = (1 << 0), - ra_param_private = (1 << 1), - ra_param_reloadable = (1 << 2), + ra_param_unique = (UINT32_C(1) << 0), + ra_param_private = (UINT32_C(1) << 1), + ra_param_reloadable = (UINT32_C(1) << 2), }; -// Allowed sources of resource agent meta-data when requesting it +/*! + * \internal + * \brief Allowed sources of resource agent meta-data when requesting it + */ enum controld_metadata_source_e { - controld_metadata_from_cache = (1 << 0), - controld_metadata_from_agent = (1 << 1), + controld_metadata_from_cache = (UINT32_C(1) << 0), + controld_metadata_from_agent = (UINT32_C(1) << 1), }; struct ra_param_s { diff --git a/daemons/controld/controld_remote_ra.c b/daemons/controld/controld_remote_ra.c index 2061a7c48be..3cbf3a53dec 100644 --- a/daemons/controld/controld_remote_ra.c +++ b/daemons/controld/controld_remote_ra.c @@ -9,6 +9,8 @@ #include +#include // UINT32_C + #include #include #include @@ -38,8 +40,8 @@ } while (0) enum remote_cmd_status { - cmd_reported_success = (1 << 0), - cmd_cancel = (1 << 1), + cmd_reported_success = (UINT32_C(1) << 0), + cmd_cancel = (UINT32_C(1) << 1), }; #define lrm_remote_set_flags(lrm_state, flags_to_set) do { \ @@ -59,20 +61,20 @@ enum remote_cmd_status { } while (0) enum remote_status { - expect_takeover = (1 << 0), - takeover_complete = (1 << 1), - remote_active = (1 << 2), + expect_takeover = (UINT32_C(1) << 0), + takeover_complete = (UINT32_C(1) << 1), + remote_active = (UINT32_C(1) << 2), /* Maintenance mode is difficult to determine from the controller's context, * so we have it signalled back with the transition from the scheduler. */ - remote_in_maint = (1 << 3), + remote_in_maint = (UINT32_C(1) << 3), /* Similar for whether we are controlling a guest node or remote node. * Fortunately there is a meta-attribute in the transition already and * as the situation doesn't change over time we can use the * resource start for noting down the information for later use when * the attributes aren't at hand. */ - controlling_guest = (1 << 4), + controlling_guest = (UINT32_C(1) << 4), }; static int handle_remote_ra_start(lrm_state_t * lrm_state, remote_ra_cmd_t * cmd, int timeout_ms); diff --git a/daemons/controld/controld_utils.c b/daemons/controld/controld_utils.c index 196b106a446..c99630c0b4a 100644 --- a/daemons/controld/controld_utils.c +++ b/daemons/controld/controld_utils.c @@ -11,6 +11,7 @@ #include #include // uint64_t +#include // PRIx64 #include #include @@ -477,73 +478,73 @@ fsa_dump_inputs(int log_level, const char *text, long long input_register) } if (pcmk__is_set(input_register, R_THE_DC)) { - crm_trace("%s %.16llx (R_THE_DC)", text, R_THE_DC); + crm_trace("%s %.16" PRIx64 " (R_THE_DC)", text, R_THE_DC); } if (pcmk__is_set(input_register, R_STARTING)) { - crm_trace("%s %.16llx (R_STARTING)", text, R_STARTING); + crm_trace("%s %.16" PRIx64 " (R_STARTING)", text, R_STARTING); } if (pcmk__is_set(input_register, R_SHUTDOWN)) { - crm_trace("%s %.16llx (R_SHUTDOWN)", text, R_SHUTDOWN); + crm_trace("%s %.16" PRIx64 " (R_SHUTDOWN)", text, R_SHUTDOWN); } if (pcmk__is_set(input_register, R_STAYDOWN)) { - crm_trace("%s %.16llx (R_STAYDOWN)", text, R_STAYDOWN); + crm_trace("%s %.16" PRIx64 " (R_STAYDOWN)", text, R_STAYDOWN); } if (pcmk__is_set(input_register, R_JOIN_OK)) { - crm_trace("%s %.16llx (R_JOIN_OK)", text, R_JOIN_OK); + crm_trace("%s %.16" PRIx64 " (R_JOIN_OK)", text, R_JOIN_OK); } if (pcmk__is_set(input_register, R_READ_CONFIG)) { - crm_trace("%s %.16llx (R_READ_CONFIG)", text, R_READ_CONFIG); + crm_trace("%s %.16" PRIx64 " (R_READ_CONFIG)", text, R_READ_CONFIG); } if (pcmk__is_set(input_register, R_INVOKE_PE)) { - crm_trace("%s %.16llx (R_INVOKE_PE)", text, R_INVOKE_PE); + crm_trace("%s %.16" PRIx64 " (R_INVOKE_PE)", text, R_INVOKE_PE); } if (pcmk__is_set(input_register, R_CIB_CONNECTED)) { - crm_trace("%s %.16llx (R_CIB_CONNECTED)", text, R_CIB_CONNECTED); + crm_trace("%s %.16" PRIx64 " (R_CIB_CONNECTED)", text, R_CIB_CONNECTED); } if (pcmk__is_set(input_register, R_PE_CONNECTED)) { - crm_trace("%s %.16llx (R_PE_CONNECTED)", text, R_PE_CONNECTED); + crm_trace("%s %.16" PRIx64 " (R_PE_CONNECTED)", text, R_PE_CONNECTED); } if (pcmk__is_set(input_register, R_TE_CONNECTED)) { - crm_trace("%s %.16llx (R_TE_CONNECTED)", text, R_TE_CONNECTED); + crm_trace("%s %.16" PRIx64 " (R_TE_CONNECTED)", text, R_TE_CONNECTED); } if (pcmk__is_set(input_register, R_LRM_CONNECTED)) { - crm_trace("%s %.16llx (R_LRM_CONNECTED)", text, R_LRM_CONNECTED); + crm_trace("%s %.16" PRIx64 " (R_LRM_CONNECTED)", text, R_LRM_CONNECTED); } if (pcmk__is_set(input_register, R_CIB_REQUIRED)) { - crm_trace("%s %.16llx (R_CIB_REQUIRED)", text, R_CIB_REQUIRED); + crm_trace("%s %.16" PRIx64 " (R_CIB_REQUIRED)", text, R_CIB_REQUIRED); } if (pcmk__is_set(input_register, R_PE_REQUIRED)) { - crm_trace("%s %.16llx (R_PE_REQUIRED)", text, R_PE_REQUIRED); + crm_trace("%s %.16" PRIx64 " (R_PE_REQUIRED)", text, R_PE_REQUIRED); } if (pcmk__is_set(input_register, R_TE_REQUIRED)) { - crm_trace("%s %.16llx (R_TE_REQUIRED)", text, R_TE_REQUIRED); + crm_trace("%s %.16" PRIx64 " (R_TE_REQUIRED)", text, R_TE_REQUIRED); } if (pcmk__is_set(input_register, R_REQ_PEND)) { - crm_trace("%s %.16llx (R_REQ_PEND)", text, R_REQ_PEND); + crm_trace("%s %.16" PRIx64 " (R_REQ_PEND)", text, R_REQ_PEND); } if (pcmk__is_set(input_register, R_PE_PEND)) { - crm_trace("%s %.16llx (R_PE_PEND)", text, R_PE_PEND); + crm_trace("%s %.16" PRIx64 " (R_PE_PEND)", text, R_PE_PEND); } if (pcmk__is_set(input_register, R_TE_PEND)) { - crm_trace("%s %.16llx (R_TE_PEND)", text, R_TE_PEND); + crm_trace("%s %.16" PRIx64 " (R_TE_PEND)", text, R_TE_PEND); } if (pcmk__is_set(input_register, R_RESP_PEND)) { - crm_trace("%s %.16llx (R_RESP_PEND)", text, R_RESP_PEND); + crm_trace("%s %.16" PRIx64 " (R_RESP_PEND)", text, R_RESP_PEND); } if (pcmk__is_set(input_register, R_CIB_DONE)) { - crm_trace("%s %.16llx (R_CIB_DONE)", text, R_CIB_DONE); + crm_trace("%s %.16" PRIx64 " (R_CIB_DONE)", text, R_CIB_DONE); } if (pcmk__is_set(input_register, R_HAVE_CIB)) { - crm_trace("%s %.16llx (R_HAVE_CIB)", text, R_HAVE_CIB); + crm_trace("%s %.16" PRIx64 " (R_HAVE_CIB)", text, R_HAVE_CIB); } if (pcmk__is_set(input_register, R_MEMBERSHIP)) { - crm_trace("%s %.16llx (R_MEMBERSHIP)", text, R_MEMBERSHIP); + crm_trace("%s %.16" PRIx64 " (R_MEMBERSHIP)", text, R_MEMBERSHIP); } if (pcmk__is_set(input_register, R_PEER_DATA)) { - crm_trace("%s %.16llx (R_PEER_DATA)", text, R_PEER_DATA); + crm_trace("%s %.16" PRIx64 " (R_PEER_DATA)", text, R_PEER_DATA); } if (pcmk__is_set(input_register, R_IN_RECOVERY)) { - crm_trace("%s %.16llx (R_IN_RECOVERY)", text, R_IN_RECOVERY); + crm_trace("%s %.16" PRIx64 " (R_IN_RECOVERY)", text, R_IN_RECOVERY); } } @@ -551,154 +552,154 @@ void fsa_dump_actions(uint64_t action, const char *text) { if (pcmk__is_set(action, A_READCONFIG)) { - crm_trace("Action %.16llx (A_READCONFIG) %s", A_READCONFIG, text); + crm_trace("Action %.16" PRIx64 " (A_READCONFIG) %s", A_READCONFIG, text); } if (pcmk__is_set(action, A_STARTUP)) { - crm_trace("Action %.16llx (A_STARTUP) %s", A_STARTUP, text); + crm_trace("Action %.16" PRIx64 " (A_STARTUP) %s", A_STARTUP, text); } if (pcmk__is_set(action, A_STARTED)) { - crm_trace("Action %.16llx (A_STARTED) %s", A_STARTED, text); + crm_trace("Action %.16" PRIx64 " (A_STARTED) %s", A_STARTED, text); } if (pcmk__is_set(action, A_HA_CONNECT)) { - crm_trace("Action %.16llx (A_CONNECT) %s", A_HA_CONNECT, text); + crm_trace("Action %.16" PRIx64 " (A_CONNECT) %s", A_HA_CONNECT, text); } if (pcmk__is_set(action, A_HA_DISCONNECT)) { - crm_trace("Action %.16llx (A_DISCONNECT) %s", A_HA_DISCONNECT, text); + crm_trace("Action %.16" PRIx64 " (A_DISCONNECT) %s", A_HA_DISCONNECT, text); } if (pcmk__is_set(action, A_LRM_CONNECT)) { - crm_trace("Action %.16llx (A_LRM_CONNECT) %s", A_LRM_CONNECT, text); + crm_trace("Action %.16" PRIx64 " (A_LRM_CONNECT) %s", A_LRM_CONNECT, text); } if (pcmk__is_set(action, A_LRM_INVOKE)) { - crm_trace("Action %.16llx (A_LRM_INVOKE) %s", A_LRM_INVOKE, text); + crm_trace("Action %.16" PRIx64 " (A_LRM_INVOKE) %s", A_LRM_INVOKE, text); } if (pcmk__is_set(action, A_LRM_DISCONNECT)) { - crm_trace("Action %.16llx (A_LRM_DISCONNECT) %s", A_LRM_DISCONNECT, text); + crm_trace("Action %.16" PRIx64 " (A_LRM_DISCONNECT) %s", A_LRM_DISCONNECT, text); } if (pcmk__is_set(action, A_DC_TIMER_STOP)) { - crm_trace("Action %.16llx (A_DC_TIMER_STOP) %s", A_DC_TIMER_STOP, text); + crm_trace("Action %.16" PRIx64 " (A_DC_TIMER_STOP) %s", A_DC_TIMER_STOP, text); } if (pcmk__is_set(action, A_DC_TIMER_START)) { - crm_trace("Action %.16llx (A_DC_TIMER_START) %s", A_DC_TIMER_START, text); + crm_trace("Action %.16" PRIx64 " (A_DC_TIMER_START) %s", A_DC_TIMER_START, text); } if (pcmk__is_set(action, A_INTEGRATE_TIMER_START)) { - crm_trace("Action %.16llx (A_INTEGRATE_TIMER_START) %s", A_INTEGRATE_TIMER_START, text); + crm_trace("Action %.16" PRIx64 " (A_INTEGRATE_TIMER_START) %s", A_INTEGRATE_TIMER_START, text); } if (pcmk__is_set(action, A_INTEGRATE_TIMER_STOP)) { - crm_trace("Action %.16llx (A_INTEGRATE_TIMER_STOP) %s", A_INTEGRATE_TIMER_STOP, text); + crm_trace("Action %.16" PRIx64 " (A_INTEGRATE_TIMER_STOP) %s", A_INTEGRATE_TIMER_STOP, text); } if (pcmk__is_set(action, A_FINALIZE_TIMER_START)) { - crm_trace("Action %.16llx (A_FINALIZE_TIMER_START) %s", A_FINALIZE_TIMER_START, text); + crm_trace("Action %.16" PRIx64 " (A_FINALIZE_TIMER_START) %s", A_FINALIZE_TIMER_START, text); } if (pcmk__is_set(action, A_FINALIZE_TIMER_STOP)) { - crm_trace("Action %.16llx (A_FINALIZE_TIMER_STOP) %s", A_FINALIZE_TIMER_STOP, text); + crm_trace("Action %.16" PRIx64 " (A_FINALIZE_TIMER_STOP) %s", A_FINALIZE_TIMER_STOP, text); } if (pcmk__is_set(action, A_ELECTION_COUNT)) { - crm_trace("Action %.16llx (A_ELECTION_COUNT) %s", A_ELECTION_COUNT, text); + crm_trace("Action %.16" PRIx64 " (A_ELECTION_COUNT) %s", A_ELECTION_COUNT, text); } if (pcmk__is_set(action, A_ELECTION_VOTE)) { - crm_trace("Action %.16llx (A_ELECTION_VOTE) %s", A_ELECTION_VOTE, text); + crm_trace("Action %.16" PRIx64 " (A_ELECTION_VOTE) %s", A_ELECTION_VOTE, text); } if (pcmk__is_set(action, A_ELECTION_CHECK)) { - crm_trace("Action %.16llx (A_ELECTION_CHECK) %s", A_ELECTION_CHECK, text); + crm_trace("Action %.16" PRIx64 " (A_ELECTION_CHECK) %s", A_ELECTION_CHECK, text); } if (pcmk__is_set(action, A_CL_JOIN_ANNOUNCE)) { - crm_trace("Action %.16llx (A_CL_JOIN_ANNOUNCE) %s", A_CL_JOIN_ANNOUNCE, text); + crm_trace("Action %.16" PRIx64 " (A_CL_JOIN_ANNOUNCE) %s", A_CL_JOIN_ANNOUNCE, text); } if (pcmk__is_set(action, A_CL_JOIN_REQUEST)) { - crm_trace("Action %.16llx (A_CL_JOIN_REQUEST) %s", A_CL_JOIN_REQUEST, text); + crm_trace("Action %.16" PRIx64 " (A_CL_JOIN_REQUEST) %s", A_CL_JOIN_REQUEST, text); } if (pcmk__is_set(action, A_CL_JOIN_RESULT)) { - crm_trace("Action %.16llx (A_CL_JOIN_RESULT) %s", A_CL_JOIN_RESULT, text); + crm_trace("Action %.16" PRIx64 " (A_CL_JOIN_RESULT) %s", A_CL_JOIN_RESULT, text); } if (pcmk__is_set(action, A_DC_JOIN_OFFER_ALL)) { - crm_trace("Action %.16llx (A_DC_JOIN_OFFER_ALL) %s", A_DC_JOIN_OFFER_ALL, text); + crm_trace("Action %.16" PRIx64 " (A_DC_JOIN_OFFER_ALL) %s", A_DC_JOIN_OFFER_ALL, text); } if (pcmk__is_set(action, A_DC_JOIN_OFFER_ONE)) { - crm_trace("Action %.16llx (A_DC_JOIN_OFFER_ONE) %s", A_DC_JOIN_OFFER_ONE, text); + crm_trace("Action %.16" PRIx64 " (A_DC_JOIN_OFFER_ONE) %s", A_DC_JOIN_OFFER_ONE, text); } if (pcmk__is_set(action, A_DC_JOIN_PROCESS_REQ)) { - crm_trace("Action %.16llx (A_DC_JOIN_PROCESS_REQ) %s", A_DC_JOIN_PROCESS_REQ, text); + crm_trace("Action %.16" PRIx64 " (A_DC_JOIN_PROCESS_REQ) %s", A_DC_JOIN_PROCESS_REQ, text); } if (pcmk__is_set(action, A_DC_JOIN_PROCESS_ACK)) { - crm_trace("Action %.16llx (A_DC_JOIN_PROCESS_ACK) %s", A_DC_JOIN_PROCESS_ACK, text); + crm_trace("Action %.16" PRIx64 " (A_DC_JOIN_PROCESS_ACK) %s", A_DC_JOIN_PROCESS_ACK, text); } if (pcmk__is_set(action, A_DC_JOIN_FINALIZE)) { - crm_trace("Action %.16llx (A_DC_JOIN_FINALIZE) %s", A_DC_JOIN_FINALIZE, text); + crm_trace("Action %.16" PRIx64 " (A_DC_JOIN_FINALIZE) %s", A_DC_JOIN_FINALIZE, text); } if (pcmk__is_set(action, A_MSG_PROCESS)) { - crm_trace("Action %.16llx (A_MSG_PROCESS) %s", A_MSG_PROCESS, text); + crm_trace("Action %.16" PRIx64 " (A_MSG_PROCESS) %s", A_MSG_PROCESS, text); } if (pcmk__is_set(action, A_MSG_ROUTE)) { - crm_trace("Action %.16llx (A_MSG_ROUTE) %s", A_MSG_ROUTE, text); + crm_trace("Action %.16" PRIx64 " (A_MSG_ROUTE) %s", A_MSG_ROUTE, text); } if (pcmk__is_set(action, A_RECOVER)) { - crm_trace("Action %.16llx (A_RECOVER) %s", A_RECOVER, text); + crm_trace("Action %.16" PRIx64 " (A_RECOVER) %s", A_RECOVER, text); } if (pcmk__is_set(action, A_DC_RELEASE)) { - crm_trace("Action %.16llx (A_DC_RELEASE) %s", A_DC_RELEASE, text); + crm_trace("Action %.16" PRIx64 " (A_DC_RELEASE) %s", A_DC_RELEASE, text); } if (pcmk__is_set(action, A_DC_RELEASED)) { - crm_trace("Action %.16llx (A_DC_RELEASED) %s", A_DC_RELEASED, text); + crm_trace("Action %.16" PRIx64 " (A_DC_RELEASED) %s", A_DC_RELEASED, text); } if (pcmk__is_set(action, A_DC_TAKEOVER)) { - crm_trace("Action %.16llx (A_DC_TAKEOVER) %s", A_DC_TAKEOVER, text); + crm_trace("Action %.16" PRIx64 " (A_DC_TAKEOVER) %s", A_DC_TAKEOVER, text); } if (pcmk__is_set(action, A_SHUTDOWN)) { - crm_trace("Action %.16llx (A_SHUTDOWN) %s", A_SHUTDOWN, text); + crm_trace("Action %.16" PRIx64 " (A_SHUTDOWN) %s", A_SHUTDOWN, text); } if (pcmk__is_set(action, A_SHUTDOWN_REQ)) { - crm_trace("Action %.16llx (A_SHUTDOWN_REQ) %s", A_SHUTDOWN_REQ, text); + crm_trace("Action %.16" PRIx64 " (A_SHUTDOWN_REQ) %s", A_SHUTDOWN_REQ, text); } if (pcmk__is_set(action, A_STOP)) { - crm_trace("Action %.16llx (A_STOP ) %s", A_STOP, text); + crm_trace("Action %.16" PRIx64 " (A_STOP ) %s", A_STOP, text); } if (pcmk__is_set(action, A_EXIT_0)) { - crm_trace("Action %.16llx (A_EXIT_0) %s", A_EXIT_0, text); + crm_trace("Action %.16" PRIx64 " (A_EXIT_0) %s", A_EXIT_0, text); } if (pcmk__is_set(action, A_EXIT_1)) { - crm_trace("Action %.16llx (A_EXIT_1) %s", A_EXIT_1, text); + crm_trace("Action %.16" PRIx64 " (A_EXIT_1) %s", A_EXIT_1, text); } if (pcmk__is_set(action, A_CIB_START)) { - crm_trace("Action %.16llx (A_CIB_START) %s", A_CIB_START, text); + crm_trace("Action %.16" PRIx64 " (A_CIB_START) %s", A_CIB_START, text); } if (pcmk__is_set(action, A_CIB_STOP)) { - crm_trace("Action %.16llx (A_CIB_STOP) %s", A_CIB_STOP, text); + crm_trace("Action %.16" PRIx64 " (A_CIB_STOP) %s", A_CIB_STOP, text); } if (pcmk__is_set(action, A_TE_INVOKE)) { - crm_trace("Action %.16llx (A_TE_INVOKE) %s", A_TE_INVOKE, text); + crm_trace("Action %.16" PRIx64 " (A_TE_INVOKE) %s", A_TE_INVOKE, text); } if (pcmk__is_set(action, A_TE_START)) { - crm_trace("Action %.16llx (A_TE_START) %s", A_TE_START, text); + crm_trace("Action %.16" PRIx64 " (A_TE_START) %s", A_TE_START, text); } if (pcmk__is_set(action, A_TE_STOP)) { - crm_trace("Action %.16llx (A_TE_STOP) %s", A_TE_STOP, text); + crm_trace("Action %.16" PRIx64 " (A_TE_STOP) %s", A_TE_STOP, text); } if (pcmk__is_set(action, A_TE_CANCEL)) { - crm_trace("Action %.16llx (A_TE_CANCEL) %s", A_TE_CANCEL, text); + crm_trace("Action %.16" PRIx64 " (A_TE_CANCEL) %s", A_TE_CANCEL, text); } if (pcmk__is_set(action, A_PE_INVOKE)) { - crm_trace("Action %.16llx (A_PE_INVOKE) %s", A_PE_INVOKE, text); + crm_trace("Action %.16" PRIx64 " (A_PE_INVOKE) %s", A_PE_INVOKE, text); } if (pcmk__is_set(action, A_PE_START)) { - crm_trace("Action %.16llx (A_PE_START) %s", A_PE_START, text); + crm_trace("Action %.16" PRIx64 " (A_PE_START) %s", A_PE_START, text); } if (pcmk__is_set(action, A_PE_STOP)) { - crm_trace("Action %.16llx (A_PE_STOP) %s", A_PE_STOP, text); + crm_trace("Action %.16" PRIx64 " (A_PE_STOP) %s", A_PE_STOP, text); } if (pcmk__is_set(action, A_NODE_BLOCK)) { - crm_trace("Action %.16llx (A_NODE_BLOCK) %s", A_NODE_BLOCK, text); + crm_trace("Action %.16" PRIx64 " (A_NODE_BLOCK) %s", A_NODE_BLOCK, text); } if (pcmk__is_set(action, A_UPDATE_NODESTATUS)) { - crm_trace("Action %.16llx (A_UPDATE_NODESTATUS) %s", A_UPDATE_NODESTATUS, text); + crm_trace("Action %.16" PRIx64 " (A_UPDATE_NODESTATUS) %s", A_UPDATE_NODESTATUS, text); } if (pcmk__is_set(action, A_LOG)) { - crm_trace("Action %.16llx (A_LOG ) %s", A_LOG, text); + crm_trace("Action %.16" PRIx64 " (A_LOG ) %s", A_LOG, text); } if (pcmk__is_set(action, A_ERROR)) { - crm_trace("Action %.16llx (A_ERROR ) %s", A_ERROR, text); + crm_trace("Action %.16" PRIx64 " (A_ERROR ) %s", A_ERROR, text); } if (pcmk__is_set(action, A_WARN)) { - crm_trace("Action %.16llx (A_WARN ) %s", A_WARN, text); + crm_trace("Action %.16" PRIx64 " (A_WARN ) %s", A_WARN, text); } } diff --git a/daemons/pacemakerd/pcmkd_subdaemons.c b/daemons/pacemakerd/pcmkd_subdaemons.c index 2d697969bea..3ab84f3ce35 100644 --- a/daemons/pacemakerd/pcmkd_subdaemons.c +++ b/daemons/pacemakerd/pcmkd_subdaemons.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -30,14 +31,14 @@ enum child_daemon_flags { child_none = 0, - child_respawn = 1 << 0, - child_needs_cluster = 1 << 1, - child_needs_retry = 1 << 2, - child_active_before_startup = 1 << 3, - child_shutting_down = 1 << 4, + child_respawn = (UINT32_C(1) << 0), + child_needs_cluster = (UINT32_C(1) << 1), + child_needs_retry = (UINT32_C(1) << 2), + child_active_before_startup = (UINT32_C(1) << 3), + child_shutting_down = (UINT32_C(1) << 4), //! Child runs as \c root if set, or as \c CRM_DAEMON_USER otherwise - child_as_root = 1 << 5, + child_as_root = (UINT32_C(1) << 5), }; typedef struct { diff --git a/include/crm/cib/cib_types.h b/include/crm/cib/cib_types.h index b3a3cdc1b34..6909b55a788 100644 --- a/include/crm/cib/cib_types.h +++ b/include/crm/cib/cib_types.h @@ -10,8 +10,11 @@ #ifndef PCMK__CRM_CIB_CIB_TYPES__H # define PCMK__CRM_CIB_CIB_TYPES__H +# include // UINT32_C + # include // gboolean, GList # include // xmlNode + # include # include @@ -54,23 +57,23 @@ enum cib_conn_type { enum cib_call_options { cib_none = 0, - cib_verbose = (1 << 0), //!< Prefer stderr to logs - cib_xpath = (1 << 1), - cib_multiple = (1 << 2), - cib_can_create = (1 << 3), - cib_discard_reply = (1 << 4), - cib_no_children = (1 << 5), + cib_verbose = (UINT32_C(1) << 0), //!< Prefer stderr to logs + cib_xpath = (UINT32_C(1) << 1), + cib_multiple = (UINT32_C(1) << 2), + cib_can_create = (UINT32_C(1) << 3), + cib_discard_reply = (UINT32_C(1) << 4), + cib_no_children = (UINT32_C(1) << 5), //! \deprecated This value will be removed in a future release - cib_xpath_address = (1 << 6), + cib_xpath_address = (UINT32_C(1) << 6), #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) // NOTE: sbd (as of at least 1.5.2) uses this value //! \deprecated This value will be removed in a future release - cib_scope_local = (1 << 8), + cib_scope_local = (UINT32_C(1) << 8), #endif // !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) - cib_dryrun = (1 << 9), + cib_dryrun = (UINT32_C(1) << 9), /*! * \brief Process request when the client commits the active transaction @@ -86,7 +89,7 @@ enum cib_call_options { * \p cib_api_operations_t:end_transaction() for more details on CIB * transactions. */ - cib_transaction = (1 << 10), + cib_transaction = (UINT32_C(1) << 10), /*! * \brief Treat new attribute values as atomic score updates where possible @@ -108,14 +111,14 @@ enum cib_call_options { * * Note: This is implemented only for modify operations. */ - cib_score_update = (1 << 11), + cib_score_update = (UINT32_C(1) << 11), // NOTE: sbd (as of at least 1.5.2) uses this value - cib_sync_call = (1 << 12), + cib_sync_call = (UINT32_C(1) << 12), - cib_no_mtime = (1 << 13), - cib_inhibit_notify = (1 << 16), - cib_force_diff = (1 << 28), + cib_no_mtime = (UINT32_C(1) << 13), + cib_inhibit_notify = (UINT32_C(1) << 16), + cib_force_diff = (UINT32_C(1) << 28), }; typedef struct cib_s cib_t; diff --git a/include/crm/cib/internal.h b/include/crm/cib/internal.h index 8e43cf88a08..2dee5ebbb76 100644 --- a/include/crm/cib/internal.h +++ b/include/crm/cib/internal.h @@ -10,6 +10,8 @@ #ifndef PCMK__CRM_CIB_INTERNAL__H #define PCMK__CRM_CIB_INTERNAL__H +#include // UINT32_C + #include #include #include @@ -46,13 +48,26 @@ extern "C" { * \brief Flags for CIB operation attributes */ enum cib__op_attr { - cib__op_attr_none = 0, //!< No special attributes - cib__op_attr_modifies = (1 << 1), //!< Modifies CIB - cib__op_attr_privileged = (1 << 2), //!< Requires privileges - cib__op_attr_local = (1 << 3), //!< Must only be processed locally - cib__op_attr_replaces = (1 << 4), //!< Replaces CIB - cib__op_attr_writes_through = (1 << 5), //!< Writes to disk on success - cib__op_attr_transaction = (1 << 6), //!< Supported in a transaction + //! No special attributes + cib__op_attr_none = 0, + + //! Modifies CIB + cib__op_attr_modifies = (UINT32_C(1) << 1), + + //! Requires privileges + cib__op_attr_privileged = (UINT32_C(1) << 2), + + //! Must only be processed locally + cib__op_attr_local = (UINT32_C(1) << 3), + + //! Replaces CIB + cib__op_attr_replaces = (UINT32_C(1) << 4), + + //! Writes to disk on success + cib__op_attr_writes_through = (UINT32_C(1) << 5), + + //! Supported in a transaction + cib__op_attr_transaction = (UINT32_C(1) << 6), }; /*! diff --git a/include/crm/cluster/internal.h b/include/crm/cluster/internal.h index d0844506590..139c2e70c7d 100644 --- a/include/crm/cluster/internal.h +++ b/include/crm/cluster/internal.h @@ -54,23 +54,26 @@ enum pcmk__node_status_flags { pcmk__node_status_dirty = (UINT32_C(1) << 1), }; -// Used with node cache search functions +/*! + * \internal + * \brief Used with node cache search functions + */ enum pcmk__node_search_flags { //! Does not affect search pcmk__node_search_none = 0, //! Search for cluster nodes from membership cache - pcmk__node_search_cluster_member = (1 << 0), + pcmk__node_search_cluster_member = (UINT32_C(1) << 0), //! Search for remote nodes - pcmk__node_search_remote = (1 << 1), + pcmk__node_search_remote = (UINT32_C(1) << 1), //! Search for cluster member nodes and remote nodes pcmk__node_search_any = pcmk__node_search_cluster_member |pcmk__node_search_remote, //! Search for cluster nodes from CIB (as of last cache refresh) - pcmk__node_search_cluster_cib = (1 << 2), + pcmk__node_search_cluster_cib = (UINT32_C(1) << 2), }; /*! diff --git a/include/crm/common/action_relation_internal.h b/include/crm/common/action_relation_internal.h index 895bf29eca5..abaf2aebee8 100644 --- a/include/crm/common/action_relation_internal.h +++ b/include/crm/common/action_relation_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the Pacemaker project contributors + * Copyright 2023-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -25,44 +25,44 @@ enum pcmk__action_relation_flags { pcmk__ar_none = 0U, //! Actions are ordered (optionally, if no other flags are set) - pcmk__ar_ordered = (1U << 0), + pcmk__ar_ordered = (UINT32_C(1) << 0), //! Relation applies only if 'first' cannot be part of a live migration - pcmk__ar_if_first_unmigratable = (1U << 1), + pcmk__ar_if_first_unmigratable = (UINT32_C(1) << 1), /*! * If 'then' is required, 'first' becomes required (and becomes unmigratable * if 'then' is); also, if 'first' is a stop of a blocked resource, 'then' * becomes unrunnable */ - pcmk__ar_then_implies_first = (1U << 4), + pcmk__ar_then_implies_first = (UINT32_C(1) << 4), /*! * If 'first' is required, 'then' becomes required; if 'first' is a stop of * a blocked resource, 'then' becomes unrunnable */ - pcmk__ar_first_implies_then = (1U << 5), + pcmk__ar_first_implies_then = (UINT32_C(1) << 5), /*! * If 'then' is required and for a promoted instance, 'first' becomes * required (and becomes unmigratable if 'then' is) */ - pcmk__ar_promoted_then_implies_first = (1U << 6), + pcmk__ar_promoted_then_implies_first = (UINT32_C(1) << 6), /*! * 'first' is runnable only if 'then' is both runnable and migratable, * and 'first' becomes required if 'then' is */ - pcmk__ar_unmigratable_then_blocks = (1U << 7), + pcmk__ar_unmigratable_then_blocks = (UINT32_C(1) << 7), //! 'then' is runnable (and migratable) only if 'first' is runnable - pcmk__ar_unrunnable_first_blocks = (1U << 8), + pcmk__ar_unrunnable_first_blocks = (UINT32_C(1) << 8), //! If 'first' is unrunnable, 'then' becomes a real, unmigratable action - pcmk__ar_first_else_then = (1U << 9), + pcmk__ar_first_else_then = (UINT32_C(1) << 9), //! If 'first' is required, 'then' action for instance on same node is - pcmk__ar_first_implies_same_node_then = (1U << 10), + pcmk__ar_first_implies_same_node_then = (UINT32_C(1) << 10), /*! * Disable relation if 'first' is unrunnable and for an active resource, @@ -73,7 +73,7 @@ enum pcmk__action_relation_flags { * REMOTE_CONTAINER_HACK to replace the connection address with where the * container is running. */ - pcmk__ar_nested_remote_probe = (1U << 11), + pcmk__ar_nested_remote_probe = (UINT32_C(1) << 11), /*! * If 'first' is for a blocked resource, make 'then' unrunnable. @@ -89,7 +89,7 @@ enum pcmk__action_relation_flags { * This is used for "stop then start primitive" (restarts) and * "stop group member then stop previous member". */ - pcmk__ar_intermediate_stop = (1U << 12), + pcmk__ar_intermediate_stop = (UINT32_C(1) << 12), /*! * The actions must be serialized if in the same transition but can be in @@ -101,34 +101,34 @@ enum pcmk__action_relation_flags { * least one if there is a failure during the transition. Or, we could * prefer certain action types over others, or base it on resource priority. */ - pcmk__ar_serialize = (1U << 14), + pcmk__ar_serialize = (UINT32_C(1) << 14), //! Relation applies only if actions are on same node - pcmk__ar_if_on_same_node = (1U << 15), + pcmk__ar_if_on_same_node = (UINT32_C(1) << 15), //! If 'then' is required, 'first' must be added to the transition graph - pcmk__ar_then_implies_first_graphed = (1U << 16), + pcmk__ar_then_implies_first_graphed = (UINT32_C(1) << 16), //! If 'first' is required and runnable, 'then' must be in graph - pcmk__ar_first_implies_then_graphed = (1U << 17), + pcmk__ar_first_implies_then_graphed = (UINT32_C(1) << 17), //! User-configured asymmetric ordering - pcmk__ar_asymmetric = (1U << 20), + pcmk__ar_asymmetric = (UINT32_C(1) << 20), //! Actions are ordered if on same node (or migration target for migrate_to) - pcmk__ar_if_on_same_node_or_target = (1U << 21), + pcmk__ar_if_on_same_node_or_target = (UINT32_C(1) << 21), //! 'then' action is runnable if certain number of 'first' instances are - pcmk__ar_min_runnable = (1U << 22), + pcmk__ar_min_runnable = (UINT32_C(1) << 22), //! Ordering applies only if 'first' is required and on same node as 'then' - pcmk__ar_if_required_on_same_node = (1U << 23), + pcmk__ar_if_required_on_same_node = (UINT32_C(1) << 23), //! Ordering applies even if 'first' runs on guest node created by 'then' - pcmk__ar_guest_allowed = (1U << 24), + pcmk__ar_guest_allowed = (UINT32_C(1) << 24), //! If 'then' action becomes required, 'first' becomes optional - pcmk__ar_then_cancels_first = (1U << 25), + pcmk__ar_then_cancels_first = (UINT32_C(1) << 25), }; /* Action relation object diff --git a/include/crm/common/agents.h b/include/crm/common/agents.h index ba2bd82d5c5..80c19381d87 100644 --- a/include/crm/common/agents.h +++ b/include/crm/common/agents.h @@ -50,15 +50,31 @@ extern "C" { // Capabilities supported by a resource agent standard enum pcmk_ra_caps { - pcmk_ra_cap_none = 0U, - pcmk_ra_cap_provider = (1U << 0), // Requires provider - pcmk_ra_cap_status = (1U << 1), // Supports status instead of monitor - pcmk_ra_cap_params = (1U << 2), // Supports parameters - pcmk_ra_cap_unique = (1U << 3), // Supports unique clones - pcmk_ra_cap_promotable = (1U << 4), // Supports promotable clones - pcmk_ra_cap_stdin = (1U << 5), // Reads from standard input - pcmk_ra_cap_fence_params = (1U << 6), // Supports pcmk_monitor_timeout, etc. - pcmk_ra_cap_cli_exec = (1U << 7), // Supports execution by crm_resource + pcmk_ra_cap_none = 0, + + //! Requires provider + pcmk_ra_cap_provider = (UINT32_C(1) << 0), + + //! Supports status instead of monitor + pcmk_ra_cap_status = (UINT32_C(1) << 1), + + //! Supports parameters + pcmk_ra_cap_params = (UINT32_C(1) << 2), + + //! Supports unique clones + pcmk_ra_cap_unique = (UINT32_C(1) << 3), + + //! Supports promotable clones + pcmk_ra_cap_promotable = (UINT32_C(1) << 4), + + //! Reads from standard input + pcmk_ra_cap_stdin = (UINT32_C(1) << 5), + + //! Supports pcmk_monitor_timeout, etc. + pcmk_ra_cap_fence_params = (UINT32_C(1) << 6), + + //! Supports execution by crm_resource + pcmk_ra_cap_cli_exec = (UINT32_C(1) << 7), }; uint32_t pcmk_get_ra_caps(const char *standard); diff --git a/include/crm/common/alerts_internal.h b/include/crm/common/alerts_internal.h index 359fca2086f..7d7ac40f5a5 100644 --- a/include/crm/common/alerts_internal.h +++ b/include/crm/common/alerts_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the Pacemaker project contributors + * Copyright 2015-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -28,10 +28,10 @@ extern "C" { enum pcmk__alert_flags { pcmk__alert_none = 0, - pcmk__alert_node = (1 << 0), - pcmk__alert_fencing = (1 << 1), - pcmk__alert_resource = (1 << 2), - pcmk__alert_attribute = (1 << 3), + pcmk__alert_node = (UINT32_C(1) << 0), + pcmk__alert_fencing = (UINT32_C(1) << 1), + pcmk__alert_resource = (UINT32_C(1) << 2), + pcmk__alert_attribute = (UINT32_C(1) << 3), pcmk__alert_default = pcmk__alert_node|pcmk__alert_fencing| pcmk__alert_resource, }; diff --git a/include/crm/common/attrs_internal.h b/include/crm/common/attrs_internal.h index ef533153f4b..22c4b4bf5a4 100644 --- a/include/crm/common/attrs_internal.h +++ b/include/crm/common/attrs_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. * @@ -10,6 +10,8 @@ #ifndef PCMK__CRM_COMMON_ATTRS_INTERNAL__H #define PCMK__CRM_COMMON_ATTRS_INTERNAL__H +#include // UINT32_C + #include // crm_system_name #include // LOG_TRACE #include // pcmk_node_t @@ -22,16 +24,16 @@ extern "C" { // Options for clients to use with functions below enum pcmk__node_attr_opts { pcmk__node_attr_none = 0, - pcmk__node_attr_remote = (1 << 0), - pcmk__node_attr_private = (1 << 1), - pcmk__node_attr_pattern = (1 << 2), - pcmk__node_attr_value = (1 << 3), - pcmk__node_attr_delay = (1 << 4), - pcmk__node_attr_perm = (1 << 5), - pcmk__node_attr_sync_local = (1 << 6), - pcmk__node_attr_sync_cluster = (1 << 7), - pcmk__node_attr_utilization = (1 << 8), - pcmk__node_attr_query_all = (1 << 9), + pcmk__node_attr_remote = (UINT32_C(1) << 0), + pcmk__node_attr_private = (UINT32_C(1) << 1), + pcmk__node_attr_pattern = (UINT32_C(1) << 2), + pcmk__node_attr_value = (UINT32_C(1) << 3), + pcmk__node_attr_delay = (UINT32_C(1) << 4), + pcmk__node_attr_perm = (UINT32_C(1) << 5), + pcmk__node_attr_sync_local = (UINT32_C(1) << 6), + pcmk__node_attr_sync_cluster = (UINT32_C(1) << 7), + pcmk__node_attr_utilization = (UINT32_C(1) << 8), + pcmk__node_attr_query_all = (UINT32_C(1) << 9), }; #define pcmk__set_node_attr_flags(node_attr_flags, flags_to_set) do { \ diff --git a/include/crm/common/clone_internal.h b/include/crm/common/clone_internal.h index e2157fc917c..435de0b3cf6 100644 --- a/include/crm/common/clone_internal.h +++ b/include/crm/common/clone_internal.h @@ -12,6 +12,7 @@ #include // NULL #include // bool +#include // UINT32_C #include // pcmk__is_set() #include // pcmk_resource_t @@ -24,14 +25,14 @@ extern "C" { // Clone resource flags (used in variant data) enum pcmk__clone_flags { - // Whether instances should be started sequentially - pcmk__clone_ordered = (1 << 0), + //! Whether instances should be started sequentially + pcmk__clone_ordered = (UINT32_C(1) << 0), - // Whether promotion scores have been added - pcmk__clone_promotion_added = (1 << 1), + //! Whether promotion scores have been added + pcmk__clone_promotion_added = (UINT32_C(1) << 1), - // Whether promotion constraints have been added - pcmk__clone_promotion_constrained = (1 << 2), + //! Whether promotion constraints have been added + pcmk__clone_promotion_constrained = (UINT32_C(1) << 2), }; /*! diff --git a/include/crm/common/failcounts_internal.h b/include/crm/common/failcounts_internal.h index 49c2aa82f6e..f7df81e9196 100644 --- a/include/crm/common/failcounts_internal.h +++ b/include/crm/common/failcounts_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. * @@ -10,17 +10,24 @@ #ifndef PCMK__CRM_COMMON_FAILCOUNTS_INTERNAL__H #define PCMK__CRM_COMMON_FAILCOUNTS_INTERNAL__H +#include // UINT32_C + #ifdef __cplusplus extern "C" { #endif -// Options when getting resource fail counts +/*! + * \internal + * \brief Options when getting resource fail counts + */ enum pcmk__fc_flags { - pcmk__fc_default = (1 << 0), - pcmk__fc_effective = (1 << 1), // Don't count expired failures + pcmk__fc_default = (UINT32_C(1) << 0), + + //! Don't count expired failures + pcmk__fc_effective = (UINT32_C(1) << 1), - // If resource is a launcher, include failures of launched resources - pcmk__fc_launched = (1 << 2), + //! If resource is a launcher, include failures of launched resources + pcmk__fc_launched = (UINT32_C(1) << 2), }; #ifdef __cplusplus diff --git a/include/crm/common/group_internal.h b/include/crm/common/group_internal.h index 220b007a786..ceee6d4527b 100644 --- a/include/crm/common/group_internal.h +++ b/include/crm/common/group_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. * @@ -12,6 +12,7 @@ #include // NULL #include // bool +#include // UINT32_C #include // pcmk_resource_t #include // pcmk__rsc_variant_group etc. @@ -19,10 +20,16 @@ extern "C" { #endif -// Group resource flags (used in variant data) +/*! + * \internal + * \brief Group resource flags (used in variant data) + */ enum pcmk__group_flags { - pcmk__group_ordered = (1 << 0), // Members start sequentially - pcmk__group_colocated = (1 << 1), // Members must be on same node + //! Members start sequentially + pcmk__group_ordered = (UINT32_C(1) << 0), + + //! Members must be on same node + pcmk__group_colocated = (UINT32_C(1) << 1), }; /*! diff --git a/include/crm/common/logging_internal.h b/include/crm/common/logging_internal.h index c24e53492e4..20f9b8d7730 100644 --- a/include/crm/common/logging_internal.h +++ b/include/crm/common/logging_internal.h @@ -10,6 +10,7 @@ #ifndef PCMK__CRM_COMMON_LOGGING_INTERNAL__H #define PCMK__CRM_COMMON_LOGGING_INTERNAL__H +#include // UINT64_C #include #include // pcmk__is_set() @@ -26,23 +27,23 @@ extern "C" { * those warnings needs a flag defined here. */ enum pcmk__warnings { - pcmk__wo_blind = (1 << 0), - pcmk__wo_record_pending = (1 << 1), - pcmk__wo_enable_startup_probes = (1 << 2), - pcmk__wo_concurrent_fencing = (1 << 3), - pcmk__wo_require_all = (1 << 4), - pcmk__wo_order_score = (1 << 5), - pcmk__wo_cancel_removed_actions = (1 << 6), - pcmk__wo_stop_removed_resources = (1 << 7), - pcmk__wo_group_order = (1 << 11), - pcmk__wo_group_coloc = (1 << 12), - pcmk__wo_set_ordering = (1 << 15), - pcmk__wo_rdisc_enabled = (1 << 16), - pcmk__wo_op_attr_expr = (1 << 19), - pcmk__wo_clone_master_max = (1 << 23), - pcmk__wo_clone_master_node_max = (1 << 24), - pcmk__wo_master_role = (1 << 26), - pcmk__wo_slave_role = (1 << 27), + pcmk__wo_blind = (UINT64_C(1) << 0), + pcmk__wo_record_pending = (UINT64_C(1) << 1), + pcmk__wo_enable_startup_probes = (UINT64_C(1) << 2), + pcmk__wo_concurrent_fencing = (UINT64_C(1) << 3), + pcmk__wo_require_all = (UINT64_C(1) << 4), + pcmk__wo_order_score = (UINT64_C(1) << 5), + pcmk__wo_cancel_removed_actions = (UINT64_C(1) << 6), + pcmk__wo_stop_removed_resources = (UINT64_C(1) << 7), + pcmk__wo_group_order = (UINT64_C(1) << 11), + pcmk__wo_group_coloc = (UINT64_C(1) << 12), + pcmk__wo_set_ordering = (UINT64_C(1) << 15), + pcmk__wo_rdisc_enabled = (UINT64_C(1) << 16), + pcmk__wo_op_attr_expr = (UINT64_C(1) << 19), + pcmk__wo_clone_master_max = (UINT64_C(1) << 23), + pcmk__wo_clone_master_node_max = (UINT64_C(1) << 24), + pcmk__wo_master_role = (UINT64_C(1) << 26), + pcmk__wo_slave_role = (UINT64_C(1) << 27), }; /*! diff --git a/include/crm/common/options_internal.h b/include/crm/common/options_internal.h index d3149a85f66..067d7225c8e 100644 --- a/include/crm/common/options_internal.h +++ b/include/crm/common/options_internal.h @@ -17,6 +17,7 @@ #include // GHashTable #include // bool +#include // UINT32_C #include // pcmk_parse_interval_spec() #include // pcmk__output_t @@ -51,27 +52,36 @@ enum pcmk__opt_flags { * * \deprecated This flag will be removed with CIB manager metadata */ - pcmk__opt_based = (1U << 0), + pcmk__opt_based = (UINT32_C(1) << 0), /*! * \brief In controller metadata * * \deprecated This flag will be removed with controller metadata */ - pcmk__opt_controld = (1U << 1), + pcmk__opt_controld = (UINT32_C(1) << 1), /*! * \brief In scheduler metadata * * \deprecated This flag will be removed with scheduler metadata */ - pcmk__opt_schedulerd = (1U << 2), + pcmk__opt_schedulerd = (UINT32_C(1) << 2), - pcmk__opt_advanced = (1U << 3), //!< Advanced use only - pcmk__opt_generated = (1U << 4), //!< Generated by Pacemaker - pcmk__opt_deprecated = (1U << 5), //!< Option is deprecated - pcmk__opt_fencing = (1U << 6), //!< Common fencing resource parameter - pcmk__opt_primitive = (1U << 7), //!< Primitive resource meta-attribute + //! Advanced use only + pcmk__opt_advanced = (UINT32_C(1) << 3), + + //! Generated by Pacemaker + pcmk__opt_generated = (UINT32_C(1) << 4), + + //! Option is deprecated + pcmk__opt_deprecated = (UINT32_C(1) << 5), + + //! Common fencing resource parameter + pcmk__opt_fencing = (UINT32_C(1) << 6), + + //! Primitive resource meta-attribute + pcmk__opt_primitive = (UINT32_C(1) << 7), }; typedef struct pcmk__cluster_option_s { diff --git a/include/crm/common/output.h b/include/crm/common/output.h index acb0a0e20c8..3003612841e 100644 --- a/include/crm/common/output.h +++ b/include/crm/common/output.h @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 the Pacemaker project contributors + * Copyright 2021-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -10,6 +10,8 @@ #ifndef PCMK__CRM_COMMON_OUTPUT__H #define PCMK__CRM_COMMON_OUTPUT__H +#include // UINT32_C + #ifdef __cplusplus extern "C" { #endif @@ -24,23 +26,23 @@ extern "C" { * \brief Control which sections are output */ typedef enum { - pcmk_section_stack = 1 << 0, - pcmk_section_dc = 1 << 1, - pcmk_section_times = 1 << 2, - pcmk_section_counts = 1 << 3, - pcmk_section_options = 1 << 4, - pcmk_section_nodes = 1 << 5, - pcmk_section_resources = 1 << 6, - pcmk_section_attributes = 1 << 7, - pcmk_section_failcounts = 1 << 8, - pcmk_section_operations = 1 << 9, - pcmk_section_fence_failed = 1 << 10, - pcmk_section_fence_pending = 1 << 11, - pcmk_section_fence_worked = 1 << 12, - pcmk_section_tickets = 1 << 13, - pcmk_section_bans = 1 << 14, - pcmk_section_failures = 1 << 15, - pcmk_section_maint_mode = 1 << 16, + pcmk_section_stack = UINT32_C(1) << 0, + pcmk_section_dc = UINT32_C(1) << 1, + pcmk_section_times = UINT32_C(1) << 2, + pcmk_section_counts = UINT32_C(1) << 3, + pcmk_section_options = UINT32_C(1) << 4, + pcmk_section_nodes = UINT32_C(1) << 5, + pcmk_section_resources = UINT32_C(1) << 6, + pcmk_section_attributes = UINT32_C(1) << 7, + pcmk_section_failcounts = UINT32_C(1) << 8, + pcmk_section_operations = UINT32_C(1) << 9, + pcmk_section_fence_failed = UINT32_C(1) << 10, + pcmk_section_fence_pending = UINT32_C(1) << 11, + pcmk_section_fence_worked = UINT32_C(1) << 12, + pcmk_section_tickets = UINT32_C(1) << 13, + pcmk_section_bans = UINT32_C(1) << 14, + pcmk_section_failures = UINT32_C(1) << 15, + pcmk_section_maint_mode = UINT32_C(1) << 16, } pcmk_section_e; #define pcmk_section_fencing_all (pcmk_section_fence_failed | pcmk_section_fence_pending | pcmk_section_fence_worked) @@ -55,18 +57,18 @@ typedef enum { * \brief Further modify the output of sections */ typedef enum { - pcmk_show_brief = 1 << 0, - pcmk_show_clone_detail = 1 << 1, - pcmk_show_node_id = 1 << 2, - pcmk_show_implicit_rscs = 1 << 3, - pcmk_show_timing = 1 << 4, - pcmk_show_inactive_rscs = 1 << 5, - pcmk_show_rscs_by_node = 1 << 6, - pcmk_show_pending = 1 << 7, - pcmk_show_rsc_only = 1 << 8, - pcmk_show_failed_detail = 1 << 9, - pcmk_show_feature_set = 1 << 10, - pcmk_show_description = 1 << 11, + pcmk_show_brief = UINT32_C(1) << 0, + pcmk_show_clone_detail = UINT32_C(1) << 1, + pcmk_show_node_id = UINT32_C(1) << 2, + pcmk_show_implicit_rscs = UINT32_C(1) << 3, + pcmk_show_timing = UINT32_C(1) << 4, + pcmk_show_inactive_rscs = UINT32_C(1) << 5, + pcmk_show_rscs_by_node = UINT32_C(1) << 6, + pcmk_show_pending = UINT32_C(1) << 7, + pcmk_show_rsc_only = UINT32_C(1) << 8, + pcmk_show_failed_detail = UINT32_C(1) << 9, + pcmk_show_feature_set = UINT32_C(1) << 10, + pcmk_show_description = UINT32_C(1) << 11, } pcmk_show_opt_e; #define pcmk_show_details ((pcmk_show_clone_detail) \ diff --git a/include/crm/common/resources.h b/include/crm/common/resources.h index 72b285087b3..e918ad19890 100644 --- a/include/crm/common/resources.h +++ b/include/crm/common/resources.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. * @@ -11,6 +11,7 @@ #define PCMK__CRM_COMMON_RESOURCES__H #include // bool +#include // UINT32_C #include // time_t #include // xmlNode #include // gboolean, guint, GList, GHashTable @@ -31,19 +32,19 @@ extern "C" { //! Search options for resources (exact resource ID always matches) enum pe_find { //! Also match clone instance ID from resource history - pcmk_rsc_match_history = (1 << 0), + pcmk_rsc_match_history = (UINT32_C(1) << 0), //! Also match anonymous clone instances by base name - pcmk_rsc_match_anon_basename = (1 << 1), + pcmk_rsc_match_anon_basename = (UINT32_C(1) << 1), //! Match only clones and their instances, by either clone or instance ID - pcmk_rsc_match_clone_only = (1 << 2), + pcmk_rsc_match_clone_only = (UINT32_C(1) << 2), //! If matching by node, compare current node instead of assigned node - pcmk_rsc_match_current_node = (1 << 3), + pcmk_rsc_match_current_node = (UINT32_C(1) << 3), //! Match clone instances (even unique) by base name as well as exact ID - pcmk_rsc_match_basename = (1 << 5), + pcmk_rsc_match_basename = (UINT32_C(1) << 5), }; //! \internal Do not use diff --git a/include/crm/common/resources_internal.h b/include/crm/common/resources_internal.h index 0a8839b4a1b..62adc177fe1 100644 --- a/include/crm/common/resources_internal.h +++ b/include/crm/common/resources_internal.h @@ -10,6 +10,7 @@ #ifndef PCMK__CRM_COMMON_RESOURCES_INTERNAL__H #define PCMK__CRM_COMMON_RESOURCES_INTERNAL__H +#include // UINT64_C #include // bool #include // uint32_t #include // gboolean, gpointer, guint, etc. @@ -70,108 +71,118 @@ enum pcmk__multiply_active { //! Resource scheduling flags enum pcmk__rsc_flags { // No resource flags set (compare with equality rather than bit set) - pcmk__no_rsc_flags = 0ULL, + pcmk__no_rsc_flags = UINT64_C(0), // Whether resource has been removed from the configuration - pcmk__rsc_removed = (1ULL << 0), + pcmk__rsc_removed = (UINT64_C(1) << 0), /* NOTE: sbd (at least as of 1.5.2) uses pe_rsc_managed which equates to * this value, so the value should not be changed */ // Whether resource is managed - pcmk__rsc_managed = (1ULL << 1), + pcmk__rsc_managed = (UINT64_C(1) << 1), // Whether resource is blocked from further action - pcmk__rsc_blocked = (1ULL << 2), + pcmk__rsc_blocked = (UINT64_C(1) << 2), // Whether resource has been removed but was launched - pcmk__rsc_removed_launched = (1ULL << 3), + pcmk__rsc_removed_launched = (UINT64_C(1) << 3), // Whether resource has clone notifications enabled - pcmk__rsc_notify = (1ULL << 4), + pcmk__rsc_notify = (UINT64_C(1) << 4), // Whether resource is not an anonymous clone instance - pcmk__rsc_unique = (1ULL << 5), + pcmk__rsc_unique = (UINT64_C(1) << 5), // Whether resource's class is "stonith" - pcmk__rsc_fence_device = (1ULL << 6), + pcmk__rsc_fence_device = (UINT64_C(1) << 6), // Whether resource can be promoted and demoted - pcmk__rsc_promotable = (1ULL << 7), + pcmk__rsc_promotable = (UINT64_C(1) << 7), // Whether resource has not yet been assigned to a node - pcmk__rsc_unassigned = (1ULL << 8), + pcmk__rsc_unassigned = (UINT64_C(1) << 8), // Whether resource is in the process of being assigned to a node - pcmk__rsc_assigning = (1ULL << 9), + pcmk__rsc_assigning = (UINT64_C(1) << 9), // Whether resource is in the process of modifying allowed node scores - pcmk__rsc_updating_nodes = (1ULL << 10), + pcmk__rsc_updating_nodes = (UINT64_C(1) << 10), // Whether resource is in the process of scheduling actions to restart - pcmk__rsc_restarting = (1ULL << 11), + pcmk__rsc_restarting = (UINT64_C(1) << 11), // Whether resource must be stopped (instead of demoted) if it is failed - pcmk__rsc_stop_if_failed = (1ULL << 12), + pcmk__rsc_stop_if_failed = (UINT64_C(1) << 12), // Whether a reload action has been scheduled for resource - pcmk__rsc_reload = (1ULL << 13), + pcmk__rsc_reload = (UINT64_C(1) << 13), // Whether resource is a remote connection allowed to run on a remote node - pcmk__rsc_remote_nesting_allowed = (1ULL << 14), + pcmk__rsc_remote_nesting_allowed = (UINT64_C(1) << 14), // Whether resource has \c PCMK_META_CRITICAL meta-attribute enabled - pcmk__rsc_critical = (1ULL << 15), + pcmk__rsc_critical = (UINT64_C(1) << 15), // Whether resource is considered failed - pcmk__rsc_failed = (1ULL << 16), + pcmk__rsc_failed = (UINT64_C(1) << 16), // Flag for non-scheduler code to use to detect recursion loops - pcmk__rsc_detect_loop = (1ULL << 17), + pcmk__rsc_detect_loop = (UINT64_C(1) << 17), // Whether resource is a Pacemaker Remote connection - pcmk__rsc_is_remote_connection = (1ULL << 18), + pcmk__rsc_is_remote_connection = (UINT64_C(1) << 18), // Whether resource has pending start action in history - pcmk__rsc_start_pending = (1ULL << 19), + pcmk__rsc_start_pending = (UINT64_C(1) << 19), // Whether resource is probed only on nodes marked exclusive - pcmk__rsc_exclusive_probes = (1ULL << 20), + pcmk__rsc_exclusive_probes = (UINT64_C(1) << 20), /* * Whether resource is multiply active with recovery set to * \c PCMK_VALUE_STOP_UNEXPECTED */ - pcmk__rsc_stop_unexpected = (1ULL << 22), + pcmk__rsc_stop_unexpected = (UINT64_C(1) << 22), // Whether resource is allowed to live-migrate - pcmk__rsc_migratable = (1ULL << 23), + pcmk__rsc_migratable = (UINT64_C(1) << 23), // Whether resource has an ignorable failure - pcmk__rsc_ignore_failure = (1ULL << 24), + pcmk__rsc_ignore_failure = (UINT64_C(1) << 24), // Whether resource is an implicit container resource for a bundle replica - pcmk__rsc_replica_container = (1ULL << 25), + pcmk__rsc_replica_container = (UINT64_C(1) << 25), // Whether resource, its node, or entire cluster is in maintenance mode - pcmk__rsc_maintenance = (1ULL << 26), + pcmk__rsc_maintenance = (UINT64_C(1) << 26), // Whether resource can be started or promoted only on quorate nodes - pcmk__rsc_needs_quorum = (1ULL << 28), + pcmk__rsc_needs_quorum = (UINT64_C(1) << 28), // Whether resource requires fencing before recovery if on unclean node - pcmk__rsc_needs_fencing = (1ULL << 29), + pcmk__rsc_needs_fencing = (UINT64_C(1) << 29), // Whether resource can be started or promoted only on unfenced nodes - pcmk__rsc_needs_unfencing = (1ULL << 30), + pcmk__rsc_needs_unfencing = (UINT64_C(1) << 30), }; -// Where to look for a resource +/*! + * \internal + * \brief Where to look for a resource + */ enum pcmk__rsc_node { - pcmk__rsc_node_none = 0U, // Nowhere - pcmk__rsc_node_assigned = (1U << 0), // Where resource is assigned - pcmk__rsc_node_current = (1U << 1), // Where resource is running - pcmk__rsc_node_pending = (1U << 2), // Where resource is pending + //! Nowhere + pcmk__rsc_node_none = 0, + + //! Where resource is assigned + pcmk__rsc_node_assigned = (UINT32_C(1) << 0), + + //! Where resource is running + pcmk__rsc_node_current = (UINT32_C(1) << 1), + + //! Where resource is pending + pcmk__rsc_node_pending = (UINT32_C(1) << 2), }; //! Resource assignment methods (implementation defined by libpacemaker) diff --git a/include/crm/common/scheduler_internal.h b/include/crm/common/scheduler_internal.h index 7d69202a0a1..53107cc6bb2 100644 --- a/include/crm/common/scheduler_internal.h +++ b/include/crm/common/scheduler_internal.h @@ -10,6 +10,7 @@ #ifndef PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H #define PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H +#include // UINT64_C #include #include #include @@ -47,78 +48,78 @@ enum pcmk__check_parameters { // Scheduling options and conditions enum pcmk__scheduler_flags { // No scheduler flags set (compare with equality rather than bit set) - pcmk__sched_none = 0ULL, + pcmk__sched_none = UINT64_C(0), /* These flags are dynamically determined conditions */ // Whether partition has quorum (via \c PCMK_XA_HAVE_QUORUM attribute) //! \deprecated Call pcmk_has_quorum() to check quorum instead - pcmk__sched_quorate = (1ULL << 0), + pcmk__sched_quorate = (UINT64_C(1) << 0), // Whether cluster is symmetric (via symmetric-cluster property) - pcmk__sched_symmetric_cluster = (1ULL << 1), + pcmk__sched_symmetric_cluster = (UINT64_C(1) << 1), // Whether scheduling encountered a non-configuration error - pcmk__sched_processing_error = (1ULL << 2), + pcmk__sched_processing_error = (UINT64_C(1) << 2), // Whether cluster is in maintenance mode (via maintenance-mode property) - pcmk__sched_in_maintenance = (1ULL << 3), + pcmk__sched_in_maintenance = (UINT64_C(1) << 3), // Whether fencing is enabled (via \c PCMK_OPT_FENCING_ENABLED property) - pcmk__sched_fencing_enabled = (1ULL << 4), + pcmk__sched_fencing_enabled = (UINT64_C(1) << 4), // Whether cluster has a fencing resource (via CIB resources) /*! \deprecated To indicate the cluster has a fencing resource, add either a * fencing resource configuration or the have-watchdog cluster option to the * input CIB */ - pcmk__sched_have_fencing = (1ULL << 5), + pcmk__sched_have_fencing = (UINT64_C(1) << 5), // Whether any resource provides or requires unfencing (via CIB resources) - pcmk__sched_enable_unfencing = (1ULL << 6), + pcmk__sched_enable_unfencing = (UINT64_C(1) << 6), /* Whether concurrent fencing is allowed (via PCMK__OPT_CONCURRENT_FENCING * property). * * @COMPAT The PCMK__OPT_CONCURRENT_FENCING property is deprecated. */ - pcmk__sched_concurrent_fencing = (1ULL << 7), + pcmk__sched_concurrent_fencing = (UINT64_C(1) << 7), /* Whether resources removed from the configuration should be stopped (via * PCMK__OPT_STOP_REMOVED_RESOURCES property) * * @COMPAT The PCMK__OPT_STOP_REMOVED_RESOURCES property is deprecated. */ - pcmk__sched_stop_removed_resources = (1ULL << 8), + pcmk__sched_stop_removed_resources = (UINT64_C(1) << 8), /* Whether recurring actions removed from the configuration should be * cancelled (via PCMK__OPT_CANCEL_REMOVED_ACTIONS property) * * @COMPAT The PCMK__OPT_CANCEL_REMOVED_ACTIONS property is deprecated. */ - pcmk__sched_cancel_removed_actions = (1ULL << 9), + pcmk__sched_cancel_removed_actions = (UINT64_C(1) << 9), // Whether to stop all resources (via stop-all-resources property) - pcmk__sched_stop_all = (1ULL << 10), + pcmk__sched_stop_all = (UINT64_C(1) << 10), // Whether scheduler processing encountered a warning - pcmk__sched_processing_warning = (1ULL << 11), + pcmk__sched_processing_warning = (UINT64_C(1) << 11), /* * Whether start failure should be treated as if * \c PCMK_META_MIGRATION_THRESHOLD is 1 (via * \c PCMK_OPT_START_FAILURE_IS_FATAL property) */ - pcmk__sched_start_failure_fatal = (1ULL << 12), + pcmk__sched_start_failure_fatal = (UINT64_C(1) << 12), // Whether unseen nodes should be fenced (via startup-fencing property) - pcmk__sched_startup_fencing = (1ULL << 14), + pcmk__sched_startup_fencing = (UINT64_C(1) << 14), /* * Whether resources should be left stopped when their node shuts down * cleanly (via shutdown-lock property) */ - pcmk__sched_shutdown_lock = (1ULL << 15), + pcmk__sched_shutdown_lock = (UINT64_C(1) << 15), /* * Whether resources' current state should be probed (when unknown) before @@ -128,13 +129,13 @@ enum pcmk__scheduler_flags { * @COMPAT Drop this when the PCMK__OPT_ENABLE_STARTUP_PROBES property is * dropped. */ - pcmk__sched_probe_resources = (1ULL << 16), + pcmk__sched_probe_resources = (UINT64_C(1) << 16), // Whether the CIB status section has been parsed yet - pcmk__sched_have_status = (1ULL << 17), + pcmk__sched_have_status = (UINT64_C(1) << 17), // Whether the cluster includes any Pacemaker Remote nodes (via CIB) - pcmk__sched_have_remote_nodes = (1ULL << 18), + pcmk__sched_have_remote_nodes = (UINT64_C(1) << 18), /* The remaining flags are scheduling options that must be set explicitly */ @@ -144,31 +145,31 @@ enum pcmk__scheduler_flags { * sequence after applying node-specific location criteria (skipping * assignment, ordering, actions, etc.). */ - pcmk__sched_location_only = (1ULL << 20), + pcmk__sched_location_only = (UINT64_C(1) << 20), // Whether sensitive resource attributes have been masked - pcmk__sched_sanitized = (1ULL << 21), + pcmk__sched_sanitized = (UINT64_C(1) << 21), // Skip counting of total, disabled, and blocked resource instances - pcmk__sched_no_counts = (1ULL << 23), + pcmk__sched_no_counts = (UINT64_C(1) << 23), // Whether node scores should be output instead of logged - pcmk__sched_output_scores = (1ULL << 25), + pcmk__sched_output_scores = (UINT64_C(1) << 25), // Whether to show node and resource utilization (in log or output) - pcmk__sched_show_utilization = (1ULL << 26), + pcmk__sched_show_utilization = (UINT64_C(1) << 26), /* * Whether to stop the scheduling sequence after unpacking the CIB, * calculating cluster status, and applying node health (skipping * applying node-specific location criteria, assignment, etc.) */ - pcmk__sched_validate_only = (1ULL << 27), + pcmk__sched_validate_only = (UINT64_C(1) << 27), /* Can Pacemaker Remote nodes be fenced even from a node that doesn't * have quorum? */ - pcmk__sched_fence_remote_no_quorum = (1ULL << 28), + pcmk__sched_fence_remote_no_quorum = (UINT64_C(1) << 28), }; // Implementation of pcmk__scheduler_private_t diff --git a/include/crm/common/strings_internal.h b/include/crm/common/strings_internal.h index 4efface92c8..1c5b1445a22 100644 --- a/include/crm/common/strings_internal.h +++ b/include/crm/common/strings_internal.h @@ -31,10 +31,10 @@ extern "C" { enum pcmk__str_flags { pcmk__str_none = 0, - pcmk__str_casei = 1 << 0, - pcmk__str_null_matches = 1 << 1, - pcmk__str_regex = 1 << 2, - pcmk__str_star_matches = 1 << 3, + pcmk__str_casei = (UINT32_C(1) << 0), + pcmk__str_null_matches = (UINT32_C(1) << 1), + pcmk__str_regex = (UINT32_C(1) << 2), + pcmk__str_star_matches = (UINT32_C(1) << 3), }; int pcmk__scan_double(const char *text, double *result, diff --git a/include/crm/common/xml_internal.h b/include/crm/common/xml_internal.h index ed71737113f..2a4dede503f 100644 --- a/include/crm/common/xml_internal.h +++ b/include/crm/common/xml_internal.h @@ -144,23 +144,23 @@ do { */ enum pcmk__xml_fmt_options { //! Exclude certain XML attributes (for calculating digests) - pcmk__xml_fmt_filtered = (1 << 0), + pcmk__xml_fmt_filtered = (UINT32_C(1) << 0), //! Include indentation and newlines - pcmk__xml_fmt_pretty = (1 << 1), + pcmk__xml_fmt_pretty = (UINT32_C(1) << 1), //! Include the opening tag of an XML element, and include XML comments - pcmk__xml_fmt_open = (1 << 3), + pcmk__xml_fmt_open = (UINT32_C(1) << 3), //! Include the children of an XML element - pcmk__xml_fmt_children = (1 << 4), + pcmk__xml_fmt_children = (UINT32_C(1) << 4), //! Include the closing tag of an XML element - pcmk__xml_fmt_close = (1 << 5), + pcmk__xml_fmt_close = (UINT32_C(1) << 5), // @COMPAT Can we start including text nodes unconditionally? //! Include XML text nodes - pcmk__xml_fmt_text = (1 << 6), + pcmk__xml_fmt_text = (UINT32_C(1) << 6), }; int pcmk__xml_show(pcmk__output_t *out, const char *prefix, const xmlNode *data, @@ -328,16 +328,16 @@ xmlNode *pcmk__xml_copy(xmlNode *parent, xmlNode *src); */ enum pcmk__xa_flags { //! Flag has no effect - pcmk__xaf_none = 0U, + pcmk__xaf_none = 0, //! Don't overwrite existing values - pcmk__xaf_no_overwrite = (1U << 0), + pcmk__xaf_no_overwrite = (UINT32_C(1) << 0), /*! * Treat values as score updates where possible (see * \c pcmk__xe_set_score()) */ - pcmk__xaf_score_update = (1U << 1), + pcmk__xaf_score_update = (UINT32_C(1) << 1), }; void pcmk__xml_sanitize_id(char *id); diff --git a/include/crm/lrmd.h b/include/crm/lrmd.h index 4c1f8eed1ee..070a6842e89 100644 --- a/include/crm/lrmd.h +++ b/include/crm/lrmd.h @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the Pacemaker project contributors + * Copyright 2012-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -11,6 +11,7 @@ # define PCMK__CRM_LRMD__H #include // bool +#include // UINT32_C #include // guint, GList #include #include @@ -138,13 +139,13 @@ enum lrmd_call_options { * used with a connection to a remote executor, recurring operations will be * dropped once all remote connections disconnect. */ - lrmd_opt_drop_recurring = (1 << 0), + lrmd_opt_drop_recurring = (UINT32_C(1) << 0), //! Notify only the client that made the request (rather than all clients) - lrmd_opt_notify_orig_only = (1 << 1), + lrmd_opt_notify_orig_only = (UINT32_C(1) << 1), //! Send notifications for recurring operations only when the result changes - lrmd_opt_notify_changes_only = (1 << 2), + lrmd_opt_notify_changes_only = (UINT32_C(1) << 2), }; typedef struct lrmd_rsc_info_s { diff --git a/include/crm/pengine/pe_types_compat.h b/include/crm/pengine/pe_types_compat.h index 63313649c4d..1d70fe3132e 100644 --- a/include/crm/pengine/pe_types_compat.h +++ b/include/crm/pengine/pe_types_compat.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. * @@ -10,6 +10,7 @@ #ifndef PCMK__CRM_PENGINE_PE_TYPES_COMPAT__H # define PCMK__CRM_PENGINE_PE_TYPES_COMPAT__H +#include // UINT64_C #include #ifdef __cplusplus @@ -27,15 +28,15 @@ extern "C" { // NOTE: sbd (as of at least 1.5.2) uses this //! \deprecated Do not use -#define pe_rsc_managed (1ULL << 1) +#define pe_rsc_managed (UINT64_C(1) << 1) // NOTE: sbd (as of at least 1.5.2) uses this //! \deprecated Do not use -#define pe_flag_have_quorum (1ULL << 0) +#define pe_flag_have_quorum (UINT64_C(1) << 0) // NOTE: sbd (as of at least 1.5.2) uses this //! \deprecated Do not use -#define pe_flag_have_stonith_resource (1ULL << 5) +#define pe_flag_have_stonith_resource (UINT64_C(1) << 5) // NOTE: sbd (as of at least 1.5.2) uses this //! \deprecated Use pcmk_node_t instead diff --git a/include/crm/stonith-ng.h b/include/crm/stonith-ng.h index 2f0b0e84013..4c7f3c1065d 100644 --- a/include/crm/stonith-ng.h +++ b/include/crm/stonith-ng.h @@ -33,7 +33,7 @@ extern "C" { # include # include # include // bool -# include // uint32_t +# include // UINT32_C, uint32_t # include // time_t // @TODO Keep this definition but make it internal @@ -60,12 +60,12 @@ enum stonith_call_options { #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) //! \deprecated Do not use - st_opt_verbose = (1 << 0), + st_opt_verbose = (UINT32_C(1) << 0), #endif // The fencing target is allowed to execute the request //! \deprecated Do not use - st_opt_allow_self_fencing = (1 << 1), + st_opt_allow_self_fencing = (UINT32_C(1) << 1), #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) //! \deprecated Do not use @@ -75,45 +75,45 @@ enum stonith_call_options { // Used internally to indicate that request is manual fence confirmation // \internal Do not use //! \deprecated Do not use - st_opt_manual_ack = (1 << 3), + st_opt_manual_ack = (UINT32_C(1) << 3), // Do not return any reply from server //! \deprecated Do not use - st_opt_discard_reply = (1 << 4), + st_opt_discard_reply = (UINT32_C(1) << 4), // Used internally to indicate that request requires a fencing topology // \internal Do not use //! \deprecated Do not use - st_opt_topology = (1 << 6), + st_opt_topology = (UINT32_C(1) << 6), #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1) //! \deprecated Do not use - st_opt_scope_local = (1 << 8), + st_opt_scope_local = (UINT32_C(1) << 8), #endif // Interpret target as node cluster layer ID instead of name //! \deprecated Do not use - st_opt_cs_nodeid = (1 << 9), + st_opt_cs_nodeid = (UINT32_C(1) << 9), // Wait for request to be completed before returning //! \deprecated Do not use - st_opt_sync_call = (1 << 12), + st_opt_sync_call = (UINT32_C(1) << 12), // Request that server send an update with optimal callback timeout //! \deprecated Do not use - st_opt_timeout_updates = (1 << 13), + st_opt_timeout_updates = (UINT32_C(1) << 13), // Invoke callback only if request succeeded //! \deprecated Do not use - st_opt_report_only_success = (1 << 14), + st_opt_report_only_success = (UINT32_C(1) << 14), // For a fence history request, request that the history be cleared //! \deprecated Do not use - st_opt_cleanup = (1 << 19), + st_opt_cleanup = (UINT32_C(1) << 19), // For a fence history request, broadcast the request to all nodes //! \deprecated Do not use - st_opt_broadcast = (1 << 20), + st_opt_broadcast = (UINT32_C(1) << 20), }; // Order matters here, do not change values diff --git a/include/pacemaker.h b/include/pacemaker.h index eae1e233a54..1cebce183c0 100644 --- a/include/pacemaker.h +++ b/include/pacemaker.h @@ -10,8 +10,11 @@ #ifndef PCMK__PACEMAKER__H # define PCMK__PACEMAKER__H +# include // UINT32_C + # include # include + # include # include @@ -32,16 +35,15 @@ extern "C" { * \brief Modify operation of running a cluster simulation. */ enum pcmk_sim_flags { - // @COMPAT Use UINT32_C(1); should not affect behavior pcmk_sim_none = 0, - pcmk_sim_all_actions = 1 << 0, - pcmk_sim_show_pending = 1 << 1, - pcmk_sim_process = 1 << 2, - pcmk_sim_show_scores = 1 << 3, - pcmk_sim_show_utilization = 1 << 4, - pcmk_sim_simulate = 1 << 5, - pcmk_sim_sanitized = 1 << 6, - pcmk_sim_verbose = 1 << 7, + pcmk_sim_all_actions = UINT32_C(1) << 0, + pcmk_sim_show_pending = UINT32_C(1) << 1, + pcmk_sim_process = UINT32_C(1) << 2, + pcmk_sim_show_scores = UINT32_C(1) << 3, + pcmk_sim_show_utilization = UINT32_C(1) << 4, + pcmk_sim_simulate = UINT32_C(1) << 5, + pcmk_sim_sanitized = UINT32_C(1) << 6, + pcmk_sim_verbose = UINT32_C(1) << 7, }; /*! @@ -327,10 +329,17 @@ pcmk_check_rule(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date, //! Bit flags to control which fields of result code info are displayed enum pcmk_rc_disp_flags { - pcmk_rc_disp_none = 0, //!< (Does nothing) - pcmk_rc_disp_code = (1 << 0), //!< Display result code number - pcmk_rc_disp_name = (1 << 1), //!< Display result code name - pcmk_rc_disp_desc = (1 << 2), //!< Display result code description + //! (Does nothing) + pcmk_rc_disp_none = 0, + + //! Display result code number + pcmk_rc_disp_code = (UINT32_C(1) << 0), + + //! Display result code name + pcmk_rc_disp_name = (UINT32_C(1) << 1), + + //! Display result code description + pcmk_rc_disp_desc = (UINT32_C(1) << 2), }; /*! diff --git a/include/pcmki/pcmki_transition.h b/include/pcmki/pcmki_transition.h index 82f2c7d2caf..bc417b76caf 100644 --- a/include/pcmki/pcmki_transition.h +++ b/include/pcmki/pcmki_transition.h @@ -34,10 +34,10 @@ enum pcmk__graph_action_type { }; enum pcmk__synapse_flags { - pcmk__synapse_ready = (1 << 0), - pcmk__synapse_failed = (1 << 1), - pcmk__synapse_executed = (1 << 2), - pcmk__synapse_confirmed = (1 << 3), + pcmk__synapse_ready = (UINT32_C(1) << 0), + pcmk__synapse_failed = (UINT32_C(1) << 1), + pcmk__synapse_executed = (UINT32_C(1) << 2), + pcmk__synapse_confirmed = (UINT32_C(1) << 3), }; typedef struct { @@ -65,10 +65,12 @@ typedef struct { } while (0) enum pcmk__graph_action_flags { - pcmk__graph_action_sent_update = (1 << 0), /* sent to the CIB */ - pcmk__graph_action_executed = (1 << 1), /* sent to the CRM */ - pcmk__graph_action_confirmed = (1 << 2), - pcmk__graph_action_failed = (1 << 3), + //! Sent to the CIB + pcmk__graph_action_sent_update = (UINT32_C(1) << 0), + //! Sent to the CRM + pcmk__graph_action_executed = (UINT32_C(1) << 1), + pcmk__graph_action_confirmed = (UINT32_C(1) << 2), + pcmk__graph_action_failed = (UINT32_C(1) << 3), }; typedef struct { diff --git a/lib/cib/cib_file.c b/lib/cib/cib_file.c index 529ba3ad6b6..b45833e83a4 100644 --- a/lib/cib/cib_file.c +++ b/lib/cib/cib_file.c @@ -40,8 +40,8 @@ static GHashTable *client_table = NULL; enum cib_file_flags { - cib_file_flag_dirty = (1 << 0), - cib_file_flag_live = (1 << 1), + cib_file_flag_dirty = (UINT32_C(1) << 0), + cib_file_flag_live = (UINT32_C(1) << 1), }; typedef struct cib_file_opaque_s { diff --git a/lib/pacemaker/libpacemaker_private.h b/lib/pacemaker/libpacemaker_private.h index a9ae43178ed..309dd7452f6 100644 --- a/lib/pacemaker/libpacemaker_private.h +++ b/lib/pacemaker/libpacemaker_private.h @@ -34,13 +34,13 @@ extern "C" { // Colocation flags enum pcmk__coloc_flags { - pcmk__coloc_none = 0U, + pcmk__coloc_none = 0, // Primary is affected even if already active - pcmk__coloc_influence = (1U << 0), + pcmk__coloc_influence = (UINT32_C(1) << 0), // Colocation was explicitly configured in CIB - pcmk__coloc_explicit = (1U << 1), + pcmk__coloc_explicit = (UINT32_C(1) << 1), }; // Flags to modify the behavior of add_colocated_node_scores() @@ -49,20 +49,20 @@ enum pcmk__coloc_select { pcmk__coloc_select_default = 0, // Apply "this with" colocations instead of "with this" colocations - pcmk__coloc_select_this_with = (1 << 0), + pcmk__coloc_select_this_with = (UINT32_C(1) << 0), // Apply only colocations with non-negative scores - pcmk__coloc_select_nonnegative = (1 << 1), + pcmk__coloc_select_nonnegative = (UINT32_C(1) << 1), // Apply only colocations with at least one matching node - pcmk__coloc_select_active = (1 << 2), + pcmk__coloc_select_active = (UINT32_C(1) << 2), }; // Flags the update_ordered_actions() method can return enum pcmk__updated { pcmk__updated_none = 0, // Nothing changed - pcmk__updated_first = (1 << 0), // First action was updated - pcmk__updated_then = (1 << 1), // Then action was updated + pcmk__updated_first = (UINT32_C(1) << 0), // First action was updated + pcmk__updated_then = (UINT32_C(1) << 1), // Then action was updated }; #define pcmk__set_updated_flags(au_flags, action, flags_to_set) do { \ diff --git a/lib/pacemaker/pcmk_sched_instances.c b/lib/pacemaker/pcmk_sched_instances.c index 64be11e87aa..53b6d94ac94 100644 --- a/lib/pacemaker/pcmk_sched_instances.c +++ b/lib/pacemaker/pcmk_sched_instances.c @@ -13,6 +13,7 @@ #include +#include // UINT32_C #include // g_str_has_suffix() #include #include @@ -876,17 +877,18 @@ pcmk__assign_instances(pcmk_resource_t *collective, GList *instances, } enum instance_state { - instance_starting = (1 << 0), - instance_stopping = (1 << 1), + instance_none = 0, + instance_starting = (UINT32_C(1) << 0), + instance_stopping = (UINT32_C(1) << 1), /* This indicates that some instance is restarting. It's not the same as * instance_starting|instance_stopping, which would indicate that some * instance is starting, and some instance (not necessarily the same one) is * stopping. */ - instance_restarting = (1 << 2), + instance_restarting = (UINT32_C(1) << 2), - instance_active = (1 << 3), + instance_active = (UINT32_C(1) << 3), instance_all = instance_starting|instance_stopping |instance_restarting|instance_active, @@ -903,7 +905,7 @@ static void check_instance_state(const pcmk_resource_t *instance, uint32_t *state) { const GList *iter = NULL; - uint32_t instance_state = 0; // State of just this instance + uint32_t instance_state = instance_none; // State of just this instance // No need to check further if all conditions have already been detected if (pcmk__all_flags_set(*state, instance_all)) { @@ -988,7 +990,7 @@ check_instance_state(const pcmk_resource_t *instance, uint32_t *state) void pcmk__create_instance_actions(pcmk_resource_t *collective, GList *instances) { - uint32_t state = 0; + uint32_t state = instance_none; pcmk_action_t *stop = NULL; pcmk_action_t *stopped = NULL; diff --git a/tools/crm_resource.h b/tools/crm_resource.h index 15c1787faa8..147365eaaf0 100644 --- a/tools/crm_resource.h +++ b/tools/crm_resource.h @@ -44,11 +44,11 @@ typedef struct { } attr_update_data_t; enum resource_check_flags { - rsc_remain_stopped = (1 << 0), - rsc_unpromotable = (1 << 1), - rsc_unmanaged = (1 << 2), - rsc_locked = (1 << 3), - rsc_node_health = (1 << 4), + rsc_remain_stopped = (UINT32_C(1) << 0), + rsc_unpromotable = (UINT32_C(1) << 1), + rsc_unmanaged = (UINT32_C(1) << 2), + rsc_locked = (UINT32_C(1) << 3), + rsc_node_health = (UINT32_C(1) << 4), }; typedef struct resource_checks_s { diff --git a/tools/crm_shadow.c b/tools/crm_shadow.c index 2da6c19695a..389acfaec35 100644 --- a/tools/crm_shadow.c +++ b/tools/crm_shadow.c @@ -9,6 +9,7 @@ #include +#include // UINT32_C #include #include @@ -62,10 +63,10 @@ enum shadow_command { * \note Ignored for XML output. */ enum shadow_disp_flags { - shadow_disp_instance = (1 << 0), - shadow_disp_file = (1 << 1), - shadow_disp_content = (1 << 2), - shadow_disp_diff = (1 << 3), + shadow_disp_instance = (UINT32_C(1) << 0), + shadow_disp_file = (UINT32_C(1) << 1), + shadow_disp_content = (UINT32_C(1) << 2), + shadow_disp_diff = (UINT32_C(1) << 3), }; static crm_exit_t exit_code = CRM_EX_OK;