1 /* 2 * Copyright (C) 2012 Andrew Beekhof <andrew@beekhof.net> 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This software is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 #ifndef CRM_ERROR__H 19 # define CRM_ERROR__H 20 # include <crm_config.h> 21 # include <assert.h> 22 23 /** 24 * \file 25 * \brief Error codes and asserts 26 * \ingroup core 27 */ 28 29 /* 30 System error codes 31 - /usr/include/asm-generic/errno.h 32 - /usr/include/asm-generic/errno-base.h 33 */ 34 35 # define CRM_ASSERT(expr) do { \ 36 if(__unlikely((expr) == FALSE)) { \ 37 crm_abort(__FILE__, __FUNCTION__, __LINE__, #expr, TRUE, FALSE); \ 38 abort(); /* Redundant but it makes analyzers like coverity and clang happy */ \ 39 } \ 40 } while(0) 41 42 # define pcmk_ok 0 43 # define PCMK_ERROR_OFFSET 190 /* Replacements on non-linux systems, see include/portability.h */ 44 # define PCMK_CUSTOM_OFFSET 200 /* Purely custom codes */ 45 # define pcmk_err_generic 201 46 # define pcmk_err_no_quorum 202 47 # define pcmk_err_schema_validation 203 48 # define pcmk_err_transform_failed 204 49 # define pcmk_err_old_data 205 50 # define pcmk_err_diff_failed 206 51 # define pcmk_err_diff_resync 207 52 # define pcmk_err_cib_modified 208 53 # define pcmk_err_cib_backup 209 54 # define pcmk_err_cib_save 210 55 # define pcmk_err_schema_unchanged 211 56 # define pcmk_err_cib_corrupt 212 57 # define pcmk_err_panic 255 58 59 const char *pcmk_strerror(int rc); 60 const char *pcmk_errorname(int rc); 61 const char *bz2_strerror(int rc); 62 63 #endif