root/include/crm/common/nvpair_internal.h

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

INCLUDED FROM


   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_NVPAIR_INTERNAL__H
  11 #define PCMK__CRM_COMMON_NVPAIR_INTERNAL__H
  12 
  13 #include <glib.h>                           // gboolean
  14 #include <libxml/tree.h>                    // xmlNode
  15 
  16 #include <crm/common/rules.h>               // pcmk_rule_input_t
  17 #include <crm/common/iso8601.h>             // crm_time_t
  18 #include <crm/common/strings_internal.h>    // pcmk__str_eq(), etc.
  19 
  20 #ifdef __cplusplus
  21 extern "C" {
  22 #endif
  23 
  24 // Data needed to sort XML blocks of name/value pairs
  25 typedef struct unpack_data_s {
  26     GHashTable *values;             // Where to put name/value pairs
  27     const char *first_id;           // Block with this XML ID should sort first
  28     pcmk_rule_input_t rule_input;   // Data used to evaluate rules
  29 
  30     /* Whether each block's values should overwrite any existing ones
  31      *
  32      * @COMPAT Only external call paths set this to true. Drop it when we drop
  33      * pe_eval_nvpairs() and pe_unpack_nvpairs() after replacing with a new
  34      * public API that doesn't overwrite.
  35      */
  36     bool overwrite;
  37 
  38     // If not NULL, this will be set to when rule evaluations will change next
  39     crm_time_t *next_change;
  40 } pcmk__nvpair_unpack_t;
  41 
  42 gint pcmk__cmp_nvpair_blocks(gconstpointer a, gconstpointer b,
  43                              gpointer user_data);
  44 
  45 /*!
  46  * \internal
  47  * \brief Insert a meta-attribute into a hash table
  48  *
  49  * \param[in] obj    Resource (pcmk__resource_private_t)
  50  *                   or action (pcmk_action_t) to add to
  51  * \param[in] name   Meta-attribute name
  52  * \param[in] value  Value to add
  53  */
  54 #define pcmk__insert_meta(obj, name, value) do {                        \
  55         if (pcmk__str_eq((value), "#default", pcmk__str_casei)) {       \
  56             /* @COMPAT Deprecated since 2.1.8 */                        \
  57             pcmk__config_warn("Support for setting meta-attributes "    \
  58                               "(such as %s) to the explicit value "     \
  59                               "'#default' is deprecated and will be "   \
  60                               "removed in a future release", (name));   \
  61         } else if ((value) != NULL) {                                   \
  62             pcmk__insert_dup((obj)->meta, (name), (value));             \
  63         }                                                               \
  64     } while (0)
  65 
  66 #ifdef __cplusplus
  67 }
  68 #endif
  69 
  70 #endif // PCMK__CRM_COMMON_NVPAIR_INTERNAL__H

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