1 /*
2 * Copyright 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_PRIMITIVE_INTERNAL__H
11 #define PCMK__CRM_COMMON_PRIMITIVE_INTERNAL__H
12
13 #include <stdbool.h> // bool
14 #include <crm/common/scheduler_types.h> // pcmk_resource_t
15 #include <crm/common/resources.h> // pcmk_rsc_variant_primitive
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 /*!
22 * \internal
23 * \brief Check whether a resource is a primitive resource
24 *
25 * \param[in] rsc Resource to check
26 *
27 * \return true if \p rsc is a primitive, otherwise false
28 */
29 static inline bool
30 pcmk__is_primitive(const pcmk_resource_t *rsc)
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
31 {
32 return (rsc != NULL) && (rsc->variant == pcmk_rsc_variant_primitive);
33 }
34
35 #ifdef __cplusplus
36 }
37 #endif
38
39 #endif // PCMK__CRM_COMMON_PRIMITIVE_INTERNAL__H