本文整理汇总了C++中crm_free函数的典型用法代码示例。如果您正苦于以下问题:C++ crm_free函数的具体用法?C++ crm_free怎么用?C++ crm_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了crm_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: handle_failcount_op
static enum crmd_fsa_input
handle_failcount_op(xmlNode * stored_msg)
{
const char *rsc = NULL;
xmlNode *xml_rsc = get_xpath_object("//" XML_CIB_TAG_RESOURCE, stored_msg, LOG_ERR);
if (xml_rsc) {
rsc = ID(xml_rsc);
}
if (rsc) {
char *attr = NULL;
crm_info("Removing failcount for %s", rsc);
attr = crm_concat("fail-count", rsc, '-');
update_attrd(NULL, attr, NULL, NULL);
crm_free(attr);
attr = crm_concat("last-failure", rsc, '-');
update_attrd(NULL, attr, NULL, NULL);
crm_free(attr);
attr = generate_op_key(rsc, "last_failure", 0);
delete_op_entry(NULL, rsc, attr, 0);
crm_free(attr);
} else {
crm_log_xml_warn(stored_msg, "invalid failcount op");
}
return I_NULL;
}
开发者ID:fghaas,项目名称:pacemaker,代码行数:33,代码来源:messages.c
示例2: attrd_connection_destroy
static void
attrd_connection_destroy(gpointer user_data)
{
attrd_client_t *client = user_data;
/* cib_process_disconnect */
if (client == NULL) {
return;
}
if (client->source != NULL) {
crm_trace("Deleting %s (%p) from mainloop", client->name, client->source);
G_main_del_IPC_Channel(client->source);
client->source = NULL;
}
crm_trace("Destroying %s (%p)", client->name, client);
crm_free(client->name);
crm_free(client->id);
crm_free(client->user);
crm_free(client);
crm_trace("Freed the cib client");
return;
}
开发者ID:brhellman,项目名称:pacemaker,代码行数:26,代码来源:attrd.c
示例3: crm_warn
static char *get_heartbeat_uuid(uint32_t unused, const char *uname)
{
char *uuid_calc = NULL;
#if SUPPORT_HEARTBEAT
cl_uuid_t uuid_raw;
const char *unknown = "00000000-0000-0000-0000-000000000000";
if (heartbeat_cluster == NULL) {
crm_warn("No connection to heartbeat, using uuid=uname");
return NULL;
}
if (heartbeat_cluster->llc_ops->get_uuid_by_name(heartbeat_cluster, uname, &uuid_raw) ==
HA_FAIL) {
crm_err("get_uuid_by_name() call failed for host %s", uname);
crm_free(uuid_calc);
return NULL;
}
crm_malloc0(uuid_calc, 50);
cl_uuid_unparse(&uuid_raw, uuid_calc);
if (safe_str_eq(uuid_calc, unknown)) {
crm_warn("Could not calculate UUID for %s", uname);
crm_free(uuid_calc);
return NULL;
}
#endif
return uuid_calc;
}
开发者ID:smellman,项目名称:pacemaker,代码行数:30,代码来源:cluster.c
示例4: pe_free_nodes
static void
pe_free_nodes(GListPtr nodes)
{
GListPtr iterator = nodes;
while (iterator != NULL) {
node_t *node = (node_t *) iterator->data;
struct node_shared_s *details = node->details;
iterator = iterator->next;
crm_trace("deleting node");
print_node("delete", node, FALSE);
if (details != NULL) {
crm_trace("%s is being deleted", details->uname);
if (details->attrs != NULL) {
g_hash_table_destroy(details->attrs);
}
if (details->utilization != NULL) {
g_hash_table_destroy(details->utilization);
}
g_list_free(details->running_rsc);
g_list_free(details->allocated_rsc);
crm_free(details);
}
crm_free(node);
}
if (nodes != NULL) {
g_list_free(nodes);
}
}
开发者ID:brhellman,项目名称:pacemaker,代码行数:32,代码来源:status.c
示例5: cib_update_counter
enum cib_errors
cib_update_counter(xmlNode * xml_obj, const char *field, gboolean reset)
{
char *new_value = NULL;
char *old_value = NULL;
int int_value = -1;
if (reset == FALSE && crm_element_value(xml_obj, field) != NULL) {
old_value = crm_element_value_copy(xml_obj, field);
}
if (old_value != NULL) {
crm_malloc0(new_value, 128);
int_value = atoi(old_value);
sprintf(new_value, "%d", ++int_value);
} else {
new_value = crm_strdup("1");
}
crm_debug_4("%s %d(%s)->%s", field, int_value, crm_str(old_value), crm_str(new_value));
crm_xml_add(xml_obj, field, new_value);
crm_free(new_value);
crm_free(old_value);
return cib_ok;
}
开发者ID:fghaas,项目名称:pacemaker,代码行数:26,代码来源:cib_ops.c
示例6: stonith_client_destroy
static void
stonith_client_destroy(gpointer user_data)
{
stonith_client_t *stonith_client = user_data;
if(stonith_client == NULL) {
crm_trace("Destroying %p", user_data);
return;
}
if(stonith_client->source != NULL) {
crm_trace("Deleting %s (%p) from mainloop",
stonith_client->name, stonith_client->source);
G_main_del_IPC_Channel(stonith_client->source);
stonith_client->source = NULL;
}
crm_trace("Destroying %s (%p)", stonith_client->name, user_data);
crm_free(stonith_client->name);
crm_free(stonith_client->callback_id);
crm_free(stonith_client->id);
crm_free(stonith_client);
crm_trace("Freed the cib client");
return;
}
开发者ID:tserong,项目名称:pacemaker,代码行数:26,代码来源:main.c
示例7: unpack_graph
crm_graph_t *
unpack_graph(xmlNode * xml_graph, const char *reference)
{
/*
<transition_graph>
<synapse>
<action_set>
<rsc_op id="2"
...
<inputs>
<rsc_op id="2"
...
*/
crm_graph_t *new_graph = NULL;
const char *t_id = NULL;
const char *time = NULL;
xmlNode *synapse = NULL;
crm_malloc0(new_graph, sizeof(crm_graph_t));
new_graph->id = -1;
new_graph->abort_priority = 0;
new_graph->network_delay = -1;
new_graph->transition_timeout = -1;
new_graph->stonith_timeout = -1;
new_graph->completion_action = tg_done;
new_graph->migrating = g_hash_table_new_full(crm_str_hash, g_str_equal,
g_hash_destroy_str, g_hash_destroy_str);
if (reference) {
new_graph->source = crm_strdup(reference);
} else {
new_graph->source = crm_strdup("unknown");
}
if (xml_graph != NULL) {
t_id = crm_element_value(xml_graph, "transition_id");
CRM_CHECK(t_id != NULL, crm_free(new_graph);
return NULL);
new_graph->id = crm_parse_int(t_id, "-1");
time = crm_element_value(xml_graph, "cluster-delay");
CRM_CHECK(time != NULL, crm_free(new_graph);
return NULL);
new_graph->network_delay = crm_get_msec(time);
time = crm_element_value(xml_graph, "stonith-timeout");
if (time == NULL) {
new_graph->stonith_timeout = new_graph->network_delay;
} else {
new_graph->stonith_timeout = crm_get_msec(time);
}
t_id = crm_element_value(xml_graph, "batch-limit");
new_graph->batch_limit = crm_parse_int(t_id, "0");
t_id = crm_element_value(xml_graph, "migration-limit");
new_graph->migration_limit = crm_parse_int(t_id, "-1");
}
开发者ID:smellman,项目名称:pacemaker,代码行数:60,代码来源:unpack.c
示例8: do_election_check
/*
A_ELECTION_CHECKアクション
CRM_OP_VOTEメッセージを受信してから流れる処理
voteハッシュテーブルに全てのアクティブなクラスタ構成メンバーからの受信をおこなったかどうかチェックし
全ての受信が行われている場合は、I_ELECTION_DCへ遷移する */
*/
void
do_election_check(long long action,
enum crmd_fsa_cause cause,
enum crmd_fsa_state cur_state,
enum crmd_fsa_input current_input,
fsa_data_t *msg_data)
{
int voted_size = 0;
/* 現在のアクティブなメンバー数を取得する */
int num_members = crm_active_members();
if(voted) {
/* votedハッシュテーブルが存在する場合は、テーブルサイズを取得する */
voted_size = g_hash_table_size(voted);
}
/* in the case of #voted > #members, it is better to
* wait for the timeout and give the cluster time to
* stabilize
*/
if(fsa_state != S_ELECTION) {
/* S_ELECTION状態の場合はチェックしない */
crm_debug("Ignore election check: we not in an election");
} else if(voted_size >= num_members) {
/* voteハッシュテーブルのサイズ(メンバー数)が現在のアクティブなメンバー数以上の場合 */
/* we won and everyone has voted */
/* メンバーが揃ったのでelection_timeoutタイマーを止める */
crm_timer_stop(election_timeout);
/* アクティブメンバー数とvoteサイズが一致もしくは、voteサイズが大きい状態になったので、 */
/* メンバーは揃ったので、内部メッセージにI_ELECTION_DCをセットする */
register_fsa_input(C_FSA_INTERNAL, I_ELECTION_DC, NULL);
if(voted_size > num_members) {
char *data = NULL;
data = crm_strdup("member");
g_hash_table_foreach(crm_peer_cache, log_member_uname, data);
crm_free(data);
data = crm_strdup("voted");
g_hash_table_foreach(voted, log_node, data);
crm_free(data);
}
crm_debug("Destroying voted hash");
/* votedハッシュテーブルを破棄する */
g_hash_table_destroy(voted);
voted = NULL;
} else {
crm_debug("Still waiting on %d non-votes (%d total)",
num_members - voted_size, num_members);
}
return;
}
开发者ID:HideoYamauchi,项目名称:Comment-Pacemaker1-0-12,代码行数:66,代码来源:election.c
示例9: free_remote_query
static void free_remote_query(gpointer data)
{
if(data) {
st_query_result_t *query = data;
crm_free(query->host);
crm_free(query);
}
}
开发者ID:huiser,项目名称:pacemaker,代码行数:8,代码来源:remote.c
示例10: check_join_state
gboolean
check_join_state(enum crmd_fsa_state cur_state, const char *source)
{
crm_debug("Invoked by %s in state: %s", source, fsa_state2string(cur_state));
if (saved_ccm_membership_id != crm_peer_seq) {
crm_debug("%s: Membership changed since join started: %llu -> %llu",
source, saved_ccm_membership_id, crm_peer_seq);
register_fsa_input_before(C_FSA_INTERNAL, I_NODE_JOIN, NULL);
} else if (cur_state == S_INTEGRATION) {
if (g_hash_table_size(welcomed_nodes) == 0) {
crm_debug("join-%d: Integration of %d peers complete: %s",
current_join_id, g_hash_table_size(integrated_nodes), source);
register_fsa_input_before(C_FSA_INTERNAL, I_INTEGRATED, NULL);
return TRUE;
}
} else if (cur_state == S_FINALIZE_JOIN) {
if (is_set(fsa_input_register, R_HAVE_CIB) == FALSE) {
crm_debug("join-%d: Delaying I_FINALIZED until we have the CIB", current_join_id);
return TRUE;
} else if (g_hash_table_size(integrated_nodes) == 0
&& g_hash_table_size(finalized_nodes) == 0) {
crm_debug("join-%d complete: %s", current_join_id, source);
register_fsa_input_later(C_FSA_INTERNAL, I_FINALIZED, NULL);
} else if (g_hash_table_size(integrated_nodes) != 0
&& g_hash_table_size(finalized_nodes) != 0) {
char *msg = NULL;
crm_err("join-%d: Waiting on %d integrated nodes"
" AND %d finalized nodes",
current_join_id,
g_hash_table_size(integrated_nodes), g_hash_table_size(finalized_nodes));
msg = crm_strdup("Integrated node");
g_hash_table_foreach(integrated_nodes, ghash_print_node, msg);
crm_free(msg);
msg = crm_strdup("Finalized node");
g_hash_table_foreach(finalized_nodes, ghash_print_node, msg);
crm_free(msg);
} else if (g_hash_table_size(integrated_nodes) != 0) {
crm_debug("join-%d: Still waiting on %d integrated nodes",
current_join_id, g_hash_table_size(integrated_nodes));
} else if (g_hash_table_size(finalized_nodes) != 0) {
crm_debug("join-%d: Still waiting on %d finalized nodes",
current_join_id, g_hash_table_size(finalized_nodes));
}
}
return FALSE;
}
开发者ID:esimone74,项目名称:pacemaker,代码行数:56,代码来源:join_dc.c
示例11: decodeNVpair
gboolean
decodeNVpair(const char *srcstring, char separator, char **name, char **value)
{
int lpc = 0;
int len = 0;
const char *temp = NULL;
CRM_ASSERT(name != NULL && value != NULL);
*name = NULL;
*value = NULL;
crm_debug_4("Attempting to decode: [%s]", srcstring);
if (srcstring != NULL) {
len = strlen(srcstring);
while(lpc <= len) {
if (srcstring[lpc] == separator) {
crm_malloc0(*name, lpc+1);
if(*name == NULL) {
break; /* and return FALSE */
}
strncpy(*name, srcstring, lpc);
(*name)[lpc] = '\0';
/* this sucks but as the strtok manpage says..
* it *is* a bug
*/
len = len-lpc; len--;
if(len <= 0) {
*value = NULL;
} else {
crm_malloc0(*value, len+1);
if(*value == NULL) {
crm_free(*name);
break; /* and return FALSE */
}
temp = srcstring+lpc+1;
strncpy(*value, temp, len);
(*value)[len] = '\0';
}
return TRUE;
}
lpc++;
}
}
if(*name != NULL) {
crm_free(*name);
}
*name = NULL;
*value = NULL;
return FALSE;
}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:54,代码来源:utils.c
示例12: destroy_crm_node
void destroy_crm_node(gpointer data)
{
crm_node_t *node = data;
crm_debug_2("Destroying entry for node %u", node->id);
crm_free(node->addr);
crm_free(node->uname);
crm_free(node->state);
crm_free(node->uuid);
crm_free(node);
}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:11,代码来源:membership.c
示例13: rsc_expand_action
static action_t *
rsc_expand_action(action_t * action)
{
action_t *result = action;
if (action->rsc && action->rsc->variant >= pe_group) {
/* Expand 'start' -> 'started' */
char *uuid = NULL;
gboolean notify = FALSE;
if (action->rsc->parent == NULL) {
/* Only outter-most resources have notification actions */
notify = is_set(action->rsc->flags, pe_rsc_notify);
}
uuid = convert_non_atomic_uuid(action->uuid, action->rsc, notify, FALSE);
if (uuid) {
crm_trace("Converting %s to %s %d", action->uuid, uuid,
is_set(action->rsc->flags, pe_rsc_notify));
result = find_first_action(action->rsc->actions, uuid, NULL, NULL);
if (result == NULL) {
crm_err("Couldn't expand %s", action->uuid);
result = action;
}
crm_free(uuid);
}
}
return result;
}
开发者ID:esimone74,项目名称:pacemaker,代码行数:29,代码来源:graph.c
示例14: validate_on_disk_cib
static gboolean
validate_on_disk_cib(const char *filename, xmlNode ** on_disk_cib)
{
int s_res = -1;
struct stat buf;
gboolean passed = TRUE;
xmlNode *root = NULL;
CRM_ASSERT(filename != NULL);
s_res = stat(filename, &buf);
if (s_res == 0) {
char *sigfile = NULL;
size_t fnsize;
crm_debug_2("Reading cluster configuration from: %s", filename);
root = filename2xml(filename);
fnsize = strlen(filename) + 5;
crm_malloc0(sigfile, fnsize);
snprintf(sigfile, fnsize, "%s.sig", filename);
if (validate_cib_digest(root, sigfile) == FALSE) {
passed = FALSE;
}
crm_free(sigfile);
}
if (on_disk_cib != NULL) {
*on_disk_cib = root;
} else {
free_xml(root);
}
return passed;
}
开发者ID:huiser,项目名称:pacemaker,代码行数:35,代码来源:io.c
示例15: pe_free_shallow_adv
void
pe_free_shallow_adv(GListPtr alist, gboolean with_data)
{
GListPtr item;
GListPtr item_next = alist;
if(with_data == FALSE && alist != NULL) {
g_list_free(alist);
return;
}
while(item_next != NULL) {
item = item_next;
item_next = item_next->next;
if(with_data) {
/* crm_debug_5("freeing %p", item->data); */
crm_free(item->data);
}
item->data = NULL;
item->next = NULL;
g_list_free_1(item);
}
}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:25,代码来源:utils.c
示例16: cleanup_calculations
void
cleanup_calculations(pe_working_set_t *data_set)
{
pe_dataset = NULL;
if(data_set == NULL) {
return;
}
if(data_set->config_hash != NULL) {
g_hash_table_destroy(data_set->config_hash);
}
crm_free(data_set->dc_uuid);
crm_debug_3("deleting resources");
pe_free_resources(data_set->resources);
crm_debug_3("deleting actions");
pe_free_actions(data_set->actions);
crm_debug_3("deleting nodes");
pe_free_nodes(data_set->nodes);
free_xml(data_set->graph);
free_ha_date(data_set->now);
free_xml(data_set->input);
free_xml(data_set->failed);
data_set->stonith_action = NULL;
CRM_CHECK(data_set->ordering_constraints == NULL, ;);
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:30,代码来源:status.c
示例17: initialize_join
void
initialize_join(gboolean before)
{
/* clear out/reset a bunch of stuff */
crm_debug("join-%d: Initializing join data (flag=%s)",
current_join_id, before ? "true" : "false");
g_hash_table_destroy(welcomed_nodes);
g_hash_table_destroy(integrated_nodes);
g_hash_table_destroy(finalized_nodes);
g_hash_table_destroy(confirmed_nodes);
if (before) {
if (max_generation_from != NULL) {
crm_free(max_generation_from);
max_generation_from = NULL;
}
if (max_generation_xml != NULL) {
free_xml(max_generation_xml);
max_generation_xml = NULL;
}
clear_bit_inplace(fsa_input_register, R_HAVE_CIB);
clear_bit_inplace(fsa_input_register, R_CIB_ASKED);
}
welcomed_nodes = g_hash_table_new_full(crm_str_hash, g_str_equal,
g_hash_destroy_str, g_hash_destroy_str);
integrated_nodes = g_hash_table_new_full(crm_str_hash, g_str_equal,
g_hash_destroy_str, g_hash_destroy_str);
finalized_nodes = g_hash_table_new_full(crm_str_hash, g_str_equal,
g_hash_destroy_str, g_hash_destroy_str);
confirmed_nodes = g_hash_table_new_full(crm_str_hash, g_str_equal,
g_hash_destroy_str, g_hash_destroy_str);
}
开发者ID:esimone74,项目名称:pacemaker,代码行数:34,代码来源:join_dc.c
示例18: finalize_sync_callback
void
finalize_sync_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data)
{
CRM_LOG_ASSERT(cib_not_master != rc);
clear_bit_inplace(fsa_input_register, R_CIB_ASKED);
if (rc != cib_ok) {
do_crm_log((rc == cib_old_data ? LOG_WARNING : LOG_ERR),
"Sync from %s failed: %s",
(char *)user_data, cib_error2string(rc));
/* restart the whole join process */
register_fsa_error_adv(C_FSA_INTERNAL, I_ELECTION_DC, NULL, NULL, __FUNCTION__);
} else if (AM_I_DC && fsa_state == S_FINALIZE_JOIN) {
set_bit_inplace(fsa_input_register, R_HAVE_CIB);
clear_bit_inplace(fsa_input_register, R_CIB_ASKED);
/* make sure dc_uuid is re-set to us */
if (check_join_state(fsa_state, __FUNCTION__) == FALSE) {
crm_debug("Notifying %d clients of join-%d results",
g_hash_table_size(integrated_nodes), current_join_id);
g_hash_table_foreach_remove(integrated_nodes, finalize_join_for, NULL);
}
} else {
crm_debug("No longer the DC in S_FINALIZE_JOIN: %s/%s",
AM_I_DC ? "DC" : "CRMd", fsa_state2string(fsa_state));
}
crm_free(user_data);
}
开发者ID:esimone74,项目名称:pacemaker,代码行数:31,代码来源:join_dc.c
示例19: save_cib_contents
static void
save_cib_contents(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data)
{
char *id = user_data;
register_fsa_error_adv(C_FSA_INTERNAL, I_ERROR, NULL, NULL, __FUNCTION__);
CRM_CHECK(id != NULL, return);
if (rc == cib_ok) {
int len = 15;
char *filename = NULL;
len += strlen(id);
len += strlen(PE_STATE_DIR);
crm_malloc0(filename, len);
CRM_CHECK(filename != NULL, return);
sprintf(filename, PE_STATE_DIR "/pe-core-%s.bz2", id);
if (write_xml_file(output, filename, TRUE) < 0) {
crm_err("Could not save CIB contents after PE crash to %s", filename);
} else {
crm_notice("Saved CIB contents after PE crash to %s", filename);
}
crm_free(filename);
}
开发者ID:esimone74,项目名称:pacemaker,代码行数:27,代码来源:pengine.c
示例20: create_action_name
static char *
create_action_name(action_t * action)
{
char *action_name = NULL;
const char *action_host = NULL;
if (action->node) {
action_host = action->node->details->uname;
action_name = crm_concat(action->uuid, action_host, ' ');
} else if (is_set(action->flags, pe_action_pseudo)) {
action_name = crm_strdup(action->uuid);
} else {
action_host = "<none>";
action_name = crm_concat(action->uuid, action_host, ' ');
}
if (safe_str_eq(action->task, RSC_CANCEL)) {
char *tmp_action_name = action_name;
action_name = crm_concat("Cancel", tmp_action_name, ' ');
crm_free(tmp_action_name);
}
return action_name;
}
开发者ID:brhellman,项目名称:pacemaker,代码行数:26,代码来源:ptest.c
注:本文中的crm_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论