root/include/crm/common/roles_internal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pcmk__current_node

   1 /*
   2  * Copyright 2004-2024 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef PCMK__CRM_COMMON_ROLES_INTERNAL__H
  11 #define PCMK__CRM_COMMON_ROLES_INTERNAL__H
  12 
  13 #ifdef __cplusplus
  14 extern "C" {
  15 #endif
  16 
  17 // String equivalents of enum rsc_role_e
  18 #define PCMK__ROLE_UNKNOWN      "Unknown"
  19 #define PCMK__ROLE_UNPROMOTED_LEGACY    "Slave"
  20 #define PCMK__ROLE_PROMOTED_LEGACY      "Master"
  21 
  22 /*!
  23  * \internal
  24  * \brief Set resource flags
  25  *
  26  * \param[in,out] resource      Resource to set flags for
  27  * \param[in]     flags_to_set  Group of enum pcmk_rsc_flags to set
  28  */
  29 #define pcmk__set_rsc_flags(resource, flags_to_set) do {                    \
  30         (resource)->flags = pcmk__set_flags_as(__func__, __LINE__,          \
  31             LOG_TRACE, "Resource", (resource)->id, (resource)->flags,       \
  32             (flags_to_set), #flags_to_set);                                 \
  33     } while (0)
  34 
  35 /*!
  36  * \internal
  37  * \brief Clear resource flags
  38  *
  39  * \param[in,out] resource        Resource to clear flags for
  40  * \param[in]     flags_to_clear  Group of enum pcmk_rsc_flags to clear
  41  */
  42 #define pcmk__clear_rsc_flags(resource, flags_to_clear) do {                \
  43         (resource)->flags = pcmk__clear_flags_as(__func__, __LINE__,        \
  44             LOG_TRACE, "Resource", (resource)->id, (resource)->flags,       \
  45             (flags_to_clear), #flags_to_clear);                             \
  46     } while (0)
  47 
  48 /*!
  49  * \internal
  50  * \brief Get node where resource is currently active (if any)
  51  *
  52  * \param[in] rsc  Resource to check
  53  *
  54  * \return Node that \p rsc is active on, if any, otherwise NULL
  55  */
  56 static inline pcmk_node_t *
  57 pcmk__current_node(const pcmk_resource_t *rsc)
     /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59     return (rsc == NULL)? NULL : rsc->fns->active_node(rsc, NULL, NULL);
  60 }
  61 
  62 #ifdef __cplusplus
  63 }
  64 #endif
  65 
  66 #endif // PCMK__CRM_COMMON_ROLES_INTERNAL__H

/* [previous][next][first][last][top][bottom][index][help] */