Page MenuHomeClusterLabs Projects

No OneTemporary

diff --git a/include/crm/cib.h b/include/crm/cib.h
index 48ab544f9d..b55e3f0642 100644
--- a/include/crm/cib.h
+++ b/include/crm/cib.h
@@ -1,307 +1,308 @@
-/* $Id: cib.h,v 1.24 2005/05/27 08:41:54 andrew Exp $ */
+/* $Id: cib.h,v 1.25 2005/05/31 11:43:56 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CIB__H
#define CIB__H
#include <clplumbing/ipc.h>
#include <crm/common/ipc.h>
#include <crm/common/xml.h>
#include <ha_msg.h>
#define cib_feature_revision 1
#define cib_feature_revision_s "1"
enum cib_variant {
cib_native,
cib_database,
cib_edir
};
enum cib_state {
cib_connected_command,
cib_connected_query,
cib_disconnected
};
enum cib_conn_type {
cib_command,
cib_query,
cib_no_connection
};
enum cib_call_options {
cib_none = 0x00000000,
cib_verbose = 0x00000001,
cib_discard_reply = 0x00000010,
cib_scope_local = 0x00000100,
cib_sync_call = 0x00001000,
cib_inhibit_notify = 0x00010000,
cib_quorum_override = 0x00100000,
cib_inhibit_bcast = 0x01000000
};
#define cib_default_options = cib_none
enum cib_errors {
cib_ok = 0,
cib_operation = -1,
cib_create_msg = -2,
cib_not_connected = -3,
cib_not_authorized = -4,
cib_send_failed = -5,
cib_reply_failed = -6,
cib_return_code = -7,
cib_output_ptr = -8,
cib_output_data = -9,
cib_connection = -10,
cib_authentication = -11,
cib_missing = -12,
cib_variant = -28,
CIBRES_MISSING_ID = -13,
CIBRES_MISSING_TYPE = -14,
CIBRES_MISSING_FIELD = -15,
CIBRES_OBJTYPE_MISMATCH = -16,
CIBRES_CORRUPT = -17,
CIBRES_OTHER = -18,
cib_unknown = -19,
cib_STALE = -20,
cib_EXISTS = -21,
cib_NOTEXISTS = -22,
cib_ACTIVATION = -23,
cib_NOSECTION = -24,
cib_NOOBJECT = -25,
cib_NOPARENT = -26,
cib_NODECOPY = -27,
cib_NOTSUPPORTED = -29,
cib_registration_msg = -30,
cib_callback_token = -31,
cib_callback_register = -32,
cib_msg_field_add = -33,
cib_client_gone = -34,
cib_not_master = -35,
cib_client_corrupt = -36,
cib_master_timeout = -37,
cib_revision_unsupported= -38,
cib_revision_unknown = -39,
cib_missing_data = -40,
cib_remote_timeout = -41,
cib_no_quorum = -42
};
enum cib_op {
CIB_OP_NONE = 0,
CIB_OP_ADD,
CIB_OP_MODIFY,
CIB_OP_DELETE,
CIB_OP_MAX
};
enum cib_section {
cib_section_none,
cib_section_all,
cib_section_nodes,
cib_section_constraints,
cib_section_resources,
cib_section_crmconfig,
cib_section_status
};
#define F_CIB_CLIENTID "cib_clientid"
#define F_CIB_CALLOPTS "cib_callopt"
#define F_CIB_CALLID "cib_callid"
#define F_CIB_CALLDATA "cib_calldata"
#define F_CIB_OPERATION "cib_op"
#define F_CIB_ISREPLY "cib_isreplyto"
#define F_CIB_SECTION "cib_section"
#define F_CIB_HOST "cib_host"
#define F_CIB_RC "cib_rc"
#define F_CIB_DELEGATED "cib_delegated_from"
#define F_CIB_OBJID "cib_object"
#define F_CIB_OBJTYPE "cib_object_type"
#define F_CIB_EXISTING "cib_existing_object"
#define F_CIB_SEENCOUNT "cib_seen"
#define F_CIB_TIMEOUT "cib_timeout"
#define F_CIB_UPDATE "cib_update"
#define F_CIB_CALLBACK_TOKEN "cib_callback_token"
#define F_CIB_GLOBAL_UPDATE "cib_update"
#define F_CIB_UPDATE_RESULT "cib_update_result"
#define F_CIB_CLIENTNAME "cib_clientname"
#define F_CIB_NOTIFY_TYPE "cib_notify_type"
#define F_CIB_NOTIFY_ACTIVATE "cib_notify_activate"
#define T_CIB "cib"
#define T_CIB_NOTIFY "cib_notify"
/* notify sub-types */
#define T_CIB_PRE_NOTIFY "cib_pre_notify"
#define T_CIB_POST_NOTIFY "cib_post_notify"
#define T_CIB_UPDATE_CONFIRM "cib_update_confirmation"
+#define T_CIB_DIFF_NOTIFY "cib_diff_notify"
#define cib_channel_ro "cib_ro"
#define cib_channel_rw "cib_rw"
#define cib_channel_callback "cib_callback"
typedef struct cib_s cib_t;
typedef struct cib_api_operations_s
{
int (*variant_op)(
cib_t *cib, const char *op, const char *host,
const char *section, crm_data_t *data,
crm_data_t **output_data, int call_options);
int (*signon) (
cib_t *cib, const char *name, enum cib_conn_type type);
int (*signoff)(cib_t *cib);
int (*free) (cib_t *cib);
int (*set_op_callback)(
cib_t *cib, void (*callback)(
const HA_Message *msg, int callid ,
int rc, crm_data_t *output));
int (*add_notify_callback)(
cib_t *cib, const char *event, void (*callback)(
const char *event, HA_Message *msg));
int (*del_notify_callback)(
cib_t *cib, const char *event, void (*callback)(
const char *event, HA_Message *msg));
int (*set_connection_dnotify)(
cib_t *cib, void (*dnotify)(gpointer user_data));
IPC_Channel *(*channel)(cib_t* cib);
int (*inputfd)(cib_t* cib);
int (*noop)(cib_t *cib, int call_options);
int (*ping)(
cib_t *cib, crm_data_t **output_data, int call_options);
int (*query)(cib_t *cib, const char *section,
crm_data_t **output_data, int call_options);
int (*query_from)(
cib_t *cib, const char *host, const char *section,
crm_data_t **output_data, int call_options);
int (*is_master) (cib_t *cib);
int (*set_master)(cib_t *cib, int call_options);
int (*set_slave) (cib_t *cib, int call_options);
int (*set_slave_all)(cib_t *cib, int call_options);
int (*sync)(cib_t *cib, const char *section, int call_options);
int (*sync_from)(
cib_t *cib, const char *host, const char *section,
int call_options);
int (*bump_epoch)(cib_t *cib, int call_options);
int (*create)(cib_t *cib, const char *section, crm_data_t *data,
crm_data_t **output_data, int call_options) ;
int (*modify)(cib_t *cib, const char *section, crm_data_t *data,
crm_data_t **output_data, int call_options) ;
int (*replace)(cib_t *cib, const char *section, crm_data_t *data,
crm_data_t **output_data, int call_options) ;
int (*delete)(cib_t *cib, const char *section, crm_data_t *data,
crm_data_t **output_data, int call_options) ;
int (*erase)(
cib_t *cib, crm_data_t **output_data, int call_options);
int (*quit)(cib_t *cib, int call_options);
gboolean (*msgready)(cib_t* cib);
int (*rcvmsg)(cib_t* cib, int blocking);
gboolean (*dispatch)(IPC_Channel *channel, gpointer user_data);
int (*register_callback)(
cib_t* cib, const char *callback, int enabled);
} cib_api_operations_t;
struct cib_s
{
enum cib_state state;
enum cib_conn_type type;
int call_id;
int call_timeout;
void *variant_opaque;
GList *notify_list;
void (*op_callback)(const HA_Message *msg, int call_id,
int rc, crm_data_t *output);
cib_api_operations_t *cmds;
};
typedef struct cib_notify_client_s
{
const char *event;
const char *obj_id; /* implement one day */
const char *obj_type; /* implement one day */
void (*callback)(
const char *event, HA_Message *msg);
} cib_notify_client_t;
typedef struct cib_callback_client_s
{
void (*callback)(
const HA_Message*, int, int, crm_data_t*, void*);
void *user_data;
gboolean only_success;
} cib_callback_client_t;
/* Core functions */
extern cib_t *cib_new(void);
extern gboolean startCib(const char *filename);
extern crm_data_t *get_cib_copy(cib_t *cib);
extern crm_data_t *cib_get_generation(cib_t *cib);
extern int cib_compare_generation(crm_data_t *left, crm_data_t *right);
extern gboolean add_cib_op_callback(
int call_id, gboolean only_success, void *user_data,
void (*callback)(const HA_Message*, int, int, crm_data_t*,void*));
extern void remove_cib_op_callback(int call_id, gboolean all_callbacks);
extern int num_cib_op_callbacks(void);
/* Utility functions */
extern crm_data_t *get_object_root(const char *object_type,crm_data_t *the_root);
extern crm_data_t *create_cib_fragment_adv(
crm_data_t *update, const char *section, const char *source);
extern char *cib_pluralSection(const char *a_section);
extern const char *get_crm_option(
crm_data_t *cib, const char *name, gboolean do_warn);
/* Error Interpretation*/
extern const char *cib_error2string(enum cib_errors);
extern const char *cib_op2string(enum cib_op);
extern crm_data_t *createEmptyCib(void);
extern gboolean verifyCibXml(crm_data_t *cib);
extern int cib_section2enum(const char *a_section);
#define create_cib_fragment(update,section) create_cib_fragment_adv(update, section, __FUNCTION__)
#endif
diff --git a/include/crm/common/ipc.h b/include/crm/common/ipc.h
index 5287f078c2..4b21922c4d 100644
--- a/include/crm/common/ipc.h
+++ b/include/crm/common/ipc.h
@@ -1,65 +1,67 @@
-/* $Id: ipc.h,v 1.8 2005/04/11 10:34:11 andrew Exp $ */
+/* $Id: ipc.h,v 1.9 2005/05/31 11:43:56 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CRM_COMMON_IPC__H
#define CRM_COMMON_IPC__H
#include <clplumbing/ipc.h>
#include <clplumbing/GSource.h>
#include <crm/common/xml.h>
#include <crm/common/msg.h>
typedef struct crmd_client_s
{
char *sub_sys;
char *uuid;
char *table_key;
IPC_Channel *client_channel;
GCHSource *client_source;
} crmd_client_t;
extern gboolean send_ha_message(
ll_cluster_t *hb_conn, HA_Message *msg, const char *node);
extern gboolean crm_send_ipc_message(
IPC_Channel *ipc_client, HA_Message *msg, gboolean is_server);
#define send_ipc_message(ipc, msg) crm_send_ipc_message(ipc, msg, FALSE)
extern void default_ipc_connection_destroy(gpointer user_data);
extern int init_server_ipc_comms(
char *channel_name,
gboolean (*channel_client_connect)(
IPC_Channel *newclient, gpointer user_data),
void (*channel_connection_destroy)(gpointer user_data));
extern GCHSource *init_client_ipc_comms(
const char *channel_name,
gboolean (*dispatch)(
IPC_Channel* source_data, gpointer user_data),
void *client_data, IPC_Channel **ch);
extern IPC_Channel *init_client_ipc_comms_nodispatch(const char *channel_name);
extern gboolean subsystem_msg_dispatch(IPC_Channel *sender, void *user_data);
extern IPC_WaitConnection *wait_channel_init(char daemonsocket[]);
+extern gboolean is_ipc_empty(IPC_Channel *ch);
+
#endif
diff --git a/include/crm/common/util.h b/include/crm/common/util.h
index 8f8f251c87..f77674eb75 100644
--- a/include/crm/common/util.h
+++ b/include/crm/common/util.h
@@ -1,95 +1,95 @@
-/* $Id: util.h,v 1.18 2005/05/20 14:59:48 andrew Exp $ */
+/* $Id: util.h,v 1.19 2005/05/31 11:43:56 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CRM_COMMON_UTIL__H
#define CRM_COMMON_UTIL__H
#include <signal.h>
#include <crm/common/xml.h>
#include <hb_api.h>
#include <ocf/oc_event.h>
#include <lrm/lrm_api.h>
#define DEBUG_INC SIGUSR1
#define DEBUG_DEC SIGUSR2
extern unsigned int crm_log_level;
extern gboolean crm_log_init(const char *entity);
extern void do_crm_log(int log_level, const char *file, const char *function,
const char *format, ...) G_GNUC_PRINTF(4,5);
/* returns the old value */
extern unsigned int set_crm_log_level(unsigned int level);
extern unsigned int get_crm_log_level(void);
extern char *crm_itoa(int an_int);
extern char *crm_strdup(const char *a);
extern char *generate_hash_key(const char *crm_msg_reference,
const char *sys);
extern char *generate_hash_value(const char *src_node,
const char *src_subsys);
extern gboolean decode_hash_value(gpointer value,
char **node,
char **subsys);
extern gboolean decodeNVpair(const char *srcstring,
char separator,
char **name,
char **value);
extern int compare_version(const char *version1, const char *version2);
extern char *generateReference(const char *custom1, const char *custom2);
extern void alter_debug(int nsig);
extern void g_hash_destroy_str(gpointer data);
extern void set_uuid(
ll_cluster_t* hb, crm_data_t *node, const char *attr, const char *uname);
extern void crm_set_ha_options(ll_cluster_t *hb_cluster);
extern gboolean crm_is_true(const char * s);
extern int crm_str_to_boolean(const char * s, int * ret);
extern long crm_get_msec(const char * input);
extern gboolean ccm_have_quorum(oc_ed_t event);
extern const char *ccm_event_name(oc_ed_t event);
extern const char *op_status2text(op_status_t status);
extern char *generate_op_key(
const char *rsc_id, const char *op_type, int interval);
-extern void crm_mem_stats(volatile cl_mem_stats_t *mem_stats);
+extern gboolean crm_mem_stats(volatile cl_mem_stats_t *mem_stats);
extern void crm_zero_mem_stats(volatile cl_mem_stats_t *stats);
#endif
diff --git a/include/crm/crm.h b/include/crm/crm.h
index 12eca99691..9df44067bb 100644
--- a/include/crm/crm.h
+++ b/include/crm/crm.h
@@ -1,307 +1,306 @@
-/* $Id: crm.h,v 1.63 2005/05/20 14:59:00 andrew Exp $ */
+/* $Id: crm.h,v 1.64 2005/05/31 11:43:56 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CRM__H
#define CRM__H
#include <stdlib.h>
#include <ha_config.h>
#include <glib.h>
#include <string.h>
#include <clplumbing/cl_log.h>
#include <clplumbing/cl_malloc.h>
#ifdef MCHECK
#include <mcheck.h>
#endif
#include <config.h>
#ifndef CRM_DEV_BUILD
# define CRM_DEV_BUILD 0
#endif
#define ipc_call_diff_max_ms 5000
#define action_diff_warn_ms 5000
#define action_diff_max_ms 20000
#define fsa_diff_warn_ms 10000
#define fsa_diff_max_ms 30000
#include <crm/common/util.h>
#define CRM_ASSERT(expr) if((expr) == FALSE) { \
do_crm_log(LOG_CRIT, __FILE__, __PRETTY_FUNCTION__, \
"Triggered dev assert at %s:%d : %s", \
__FILE__, __LINE__, #expr); \
abort(); \
}
extern gboolean crm_assert_failed;
#define CRM_DEV_ASSERT(expr) crm_assert_failed = FALSE; \
if((expr) == FALSE) { \
crm_assert_failed = TRUE; \
do_crm_log(CRM_DEV_BUILD?LOG_CRIT:LOG_ERR, \
__FILE__, __PRETTY_FUNCTION__, \
"Triggered dev assert at %s:%d : %s", \
__FILE__, __LINE__, #expr); \
if(CRM_DEV_BUILD) { \
abort(); \
} \
}
/* Clean these up at some point, some probably should be runtime options */
#define WORKING_DIR HA_VARLIBDIR"/heartbeat/crm"
#define BIN_DIR HA_LIBDIR"/heartbeat"
#define SOCKET_LEN 1024
#define APPNAME_LEN 256
#define MAX_IPC_FAIL 5
#define CIB_FILENAME WORKING_DIR"/cib.xml"
#define CIB_BACKUP WORKING_DIR"/cib_backup.xml"
#define CRM_VERSION "0.8"
#define MSG_LOG 1
#define DOT_FSA_ACTIONS 1
#define DOT_ALL_FSA_INPUTS 1
-#define FSA_TRACE 1
-/* #define USE_FAKE_LRM 1 */
+/* #define FSA_TRACE 1 */
#define INFINITY_S "INFINITY"
#define MINUS_INFINITY_S "-INFINITY"
#define INFINITY 1000000.0
/* Sub-systems */
#define CRM_SYSTEM_DC "dc"
#define CRM_SYSTEM_DCIB "dcib" /* The master CIB */
#define CRM_SYSTEM_CIB "cib"
#define CRM_SYSTEM_CRMD "crmd"
#define CRM_SYSTEM_LRMD "lrmd"
#define CRM_SYSTEM_PENGINE "pengine"
#define CRM_SYSTEM_TENGINE "tengine"
/* Valid operations */
#define CRM_OP_NOOP "noop"
/* soon to be moved to cib.h */
#define CRM_OP_CIB_SLAVE "cib_slave"
#define CRM_OP_CIB_SLAVEALL "cib_slave_all"
#define CRM_OP_CIB_MASTER "cib_master"
#define CRM_OP_CIB_SYNC "cib_sync"
#define CRM_OP_CIB_ISMASTER "cib_ismaster"
#define CRM_OP_CIB_BUMP "cib_bump"
#define CRM_OP_CIB_QUERY "cib_query"
#define CRM_OP_CIB_CREATE "cib_create"
#define CRM_OP_CIB_UPDATE "cib_update"
#define CRM_OP_CIB_DELETE "cib_delete"
#define CRM_OP_CIB_ERASE "cib_erase"
#define CRM_OP_CIB_REPLACE "cib_replace"
#define CRM_OP_CIB_NOTIFY "cib_notify"
#define CRM_OP_JOIN_ANNOUNCE "join_announce"
#define CRM_OP_JOIN_OFFER "join_offer"
#define CRM_OP_JOIN_REQUEST "join_request"
#define CRM_OP_JOIN_ACKNAK "join_ack_nack"
#define CRM_OP_JOIN_CONFIRM "join_confirm"
#define CRM_OP_DIE "die_no_respawn"
#define CRM_OP_RETRIVE_CIB "retrieve_cib"
#define CRM_OP_PING "ping"
#define CRM_OP_VOTE "vote"
#define CRM_OP_HELLO "hello"
#define CRM_OP_HBEAT "dc_beat"
#define CRM_OP_PECALC "pe_calc"
#define CRM_OP_ABORT "abort"
#define CRM_OP_QUIT "quit"
#define CRM_OP_LOCAL_SHUTDOWN "start_shutdown"
#define CRM_OP_SHUTDOWN_REQ "req_shutdown"
#define CRM_OP_SHUTDOWN "do_shutdown"
#define CRM_OP_FENCE "stonith"
#define CRM_OP_EVENTCC "event_cc"
#define CRM_OP_TEABORT "te_abort"
#define CRM_OP_TEABORTED "te_abort_confirmed" /* we asked */
#define CRM_OP_TE_HALT "te_halt"
#define CRM_OP_TECOMPLETE "te_complete"
#define CRM_OP_TETIMEOUT "te_timeout"
#define CRM_OP_TRANSITION "transition"
#define CRM_OP_REGISTER "register"
#define CRM_OP_DEBUG_UP "debug_inc"
#define CRM_OP_DEBUG_DOWN "debug_dec"
#define CRMD_STATE_ACTIVE "member"
#define CRMD_STATE_INACTIVE "down"
#define CRMD_JOINSTATE_DOWN "down"
#define CRMD_JOINSTATE_PENDING "pending"
#define CRMD_JOINSTATE_MEMBER "member"
#define CRMD_ACTION_START "start"
#define CRMD_ACTION_STARTED "running"
#define CRMD_ACTION_START_FAIL "start_failed"
#define CRMD_ACTION_START_PENDING "starting"
#define CRMD_ACTION_STOP "stop"
#define CRMD_ACTION_STOPPED "stopped"
#define CRMD_ACTION_STOP_FAIL "stop_failed"
#define CRMD_ACTION_STOP_PENDING "stopping"
#define CRMD_ACTION_MON "monitor"
#define CRMD_ACTION_MON_PENDING CRMD_ACTION_STARTED
#define CRMD_ACTION_MON_OK CRMD_ACTION_STARTED
#define CRMD_ACTION_MON_FAIL "monitor_failed"
/* #define CRMD_ACTION_GENERIC "pending" */
#define CRMD_ACTION_GENERIC_PENDING "pending"
#define CRMD_ACTION_GENERIC_OK "complete"
#define CRMD_ACTION_GENERIC_FAIL "pending_failed"
typedef GList* GListPtr;
#define crm_atoi(text, default) atoi(text?text:default)
extern gboolean safe_str_eq(const char *a, const char *b);
extern gboolean safe_str_neq(const char *a, const char *b);
#define slist_iter(child, child_type, parent, counter, a) \
{ \
GListPtr __crm_iter_head = parent; \
child_type *child = NULL; \
int counter = 0; \
for(; __crm_iter_head != NULL; counter++) { \
child = __crm_iter_head->data; \
__crm_iter_head = __crm_iter_head->next; \
{ a; } \
} \
}
#define LOG_DEBUG_2 LOG_DEBUG+1
#define LOG_DEBUG_3 LOG_DEBUG+2
#define LOG_DEBUG_4 LOG_DEBUG+3
#define LOG_DEBUG_5 LOG_DEBUG+4
#define LOG_DEBUG_6 LOG_DEBUG+5
#define LOG_MSG LOG_DEBUG_3
#define crm_crit(w...) do_crm_log(LOG_CRIT, __FILE__, __FUNCTION__, w)
#define crm_err(w...) do_crm_log(LOG_ERR, __FILE__, __FUNCTION__, w)
#define crm_warn(w...) do_crm_log(LOG_WARNING, __FILE__, __FUNCTION__, w)
#define crm_notice(w...) do_crm_log(LOG_NOTICE, __FILE__, __FUNCTION__, w)
#define crm_info(w...) do_crm_log(LOG_INFO, __FILE__, __FUNCTION__, w)
#define crm_log_maybe(level, fmt...) if(crm_log_level >= level) { \
do_crm_log(level, __FILE__, __FUNCTION__, fmt); \
}
#define crm_debug(fmt...) crm_log_maybe(LOG_DEBUG, fmt)
#define crm_debug_2(fmt...) crm_log_maybe(LOG_DEBUG_2, fmt)
/* If this is not a developmental build, give the compiler every chance to
* optimize these away
*/
#if CRM_DEV_BUILD
# define crm_debug_3(fmt...) crm_log_maybe(LOG_DEBUG_3, fmt)
# define crm_debug_4(fmt...) crm_log_maybe(LOG_DEBUG_4, fmt)
# define crm_debug_5(fmt...) crm_log_maybe(LOG_DEBUG_5, fmt)
#else
# define crm_debug_3(w...) if(0) { do_crm_log(LOG_DEBUG, NULL, NULL, w); }
# define crm_debug_4(w...) if(0) { do_crm_log(LOG_DEBUG, NULL, NULL, w); }
# define crm_debug_5(w...) if(0) { do_crm_log(LOG_DEBUG, NULL, NULL, w); }
#endif
extern void crm_log_message_adv(
int level, const char *alt_debugfile, const HA_Message *msg);
#define crm_log_message(level, msg) if(crm_log_level >= level) { \
crm_log_message_adv(level, NULL, msg); \
}
#define crm_do_action(level, actions) if(crm_log_level >= level) { \
actions; \
}
#define crm_action_info(x) crm_do_action(LOG_INFO, x)
#define crm_action_debug(x) crm_do_action(LOG_DEBUG, x)
#define crm_action_debug_2(x) crm_do_action(LOG_DEBUG_2, x)
#define crm_action_debug_3(x) crm_do_action(LOG_DEBUG_3, x)
#define crm_log_xml(level, text, xml) if(crm_log_level >= level) { \
print_xml_formatted(level, __FUNCTION__, xml, text); \
}
#define crm_log_xml_crit(xml, text) crm_log_xml(LOG_CRIT, text, xml)
#define crm_log_xml_err(xml, text) crm_log_xml(LOG_ERR, text, xml)
#define crm_log_xml_warn(xml, text) crm_log_xml(LOG_WARNING, text, xml)
#define crm_log_xml_notice(xml, text) crm_log_xml(LOG_NOTICE, text, xml)
#define crm_log_xml_info(xml, text) crm_log_xml(LOG_INFO, text, xml)
#define crm_log_xml_debug(xml, text) crm_log_xml(LOG_DEBUG, text, xml)
#define crm_log_xml_debug_2(xml, text) crm_log_xml(LOG_DEBUG_2, text, xml)
#define crm_log_xml_debug_3(xml, text) crm_log_xml(LOG_DEBUG_3, text, xml)
#define crm_log_xml_debug_4(xml, text) crm_log_xml(LOG_DEBUG_4, text, xml)
#define crm_log_xml_debug_5(xml, text) crm_log_xml(LOG_DEBUG_5, text, xml)
#define crm_str(x) (const char*)(x?x:"<null>")
#if CRM_USE_MALLOC
# define crm_malloc0(new_obj,length) \
{ \
new_obj = malloc(length); \
if(new_obj == NULL) { \
crm_crit("Out of memory... exiting"); \
exit(1); \
} else { \
memset(new_obj, 0, length); \
} \
}
# define crm_free(x) if(x) { free(x); x=NULL; }
# define crm_is_allocated(obj) obj?TRUE:FALSE
#else
# if CRM_DEV_BUILD
# define crm_malloc0(new_obj,length) \
{ \
if(new_obj) { \
crm_err("Potential memory leak:" \
" %s at %s:%d not NULL before alloc.", \
#new_obj, __FILE__, __LINE__); \
abort(); \
} \
new_obj = cl_malloc(length); \
if(new_obj == NULL) { \
crm_crit("Out of memory... exiting"); \
abort(); \
} \
memset(new_obj, 0, length); \
}
#else
# define crm_malloc0(new_obj,length) \
{ \
new_obj = cl_malloc(length); \
if(new_obj == NULL) { \
crm_crit("Out of memory... exiting"); \
abort(); \
} \
memset(new_obj, 0, length); \
}
# endif
# define crm_free(x) if(x) { \
CRM_ASSERT(cl_is_allocated(x) == 1); \
cl_free(x); \
x=NULL; \
}
# define crm_is_allocated(obj) cl_is_allocated(obj)
#endif
#define crm_msg_del(msg) if(msg != NULL) { ha_msg_del(msg); msg = NULL; }
#endif

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jul 10, 1:34 AM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2009542
Default Alt Text
(24 KB)

Event Timeline