tag = crm_element_name(cib); 
if(cib != NULL) { tag = XML_TAG_CIB; } 
cib_native_perform_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  rc = HA_OK;		struct ha_msg *op_msg   = NULL;	struct ha_msg *op_reply = NULL; 	cib_native_opaque_t *native = cib->variant_opaque;	if(cib->state ==  cib_disconnected) {		return cib_not_connected;	}	if(output_data != NULL) {		*output_data = NULL;	}		if(op == NULL) {		crm_err("No operation specified");		rc = cib_operation;	}	op_msg = ha_msg_new(8);	if (op_msg == NULL) {		crm_err("No memory to create HA_Message");		return cib_create_msg;	}		if(rc == HA_OK) {		rc = ha_msg_add(op_msg, F_TYPE, "cib");	}	if(rc == HA_OK) {		rc = ha_msg_add(op_msg, F_CIB_OPERATION, op);	}	if(rc == HA_OK && host != NULL) {		CRM_DEV_ASSERT(crm_is_allocated(host) == 1);		rc = ha_msg_add(op_msg, F_CIB_HOST, host);	}	if(rc == HA_OK && section != NULL) {		rc = ha_msg_add(op_msg, F_CIB_SECTION, section);	}	if(rc == HA_OK) {		rc = ha_msg_add_int(op_msg, F_CIB_CALLID, cib->call_id);	}	if(rc == HA_OK) {		crm_debug_4("Sending call options: %.8lx, %d",			  (long)call_options, call_options);		rc = ha_msg_add_int(op_msg, F_CIB_CALLOPTS, call_options);	}	if(rc == HA_OK && cib->call_timeout > 0) {		rc = ha_msg_add_int(op_msg, F_CIB_TIMEOUT, cib->call_timeout);	}	if(rc == HA_OK && data != NULL) {		const char *tag = crm_element_name(data);		crm_data_t *cib = data;		if(safe_str_neq(tag, XML_TAG_CIB)) {			cib = find_xml_node(data, XML_TAG_CIB, FALSE);			tag = crm_element_name(cib);		}				if(safe_str_eq(tag, XML_TAG_CIB)) {			const char *version = feature_set(cib);#if 1			/* only needed for 2.0.2 */			int cmp = compare_version(version, "1.1");			if(cmp != 0) {				crm_err("Set XML_ATTR_CIB_REVISION=%s",					version);				crm_xml_add(cib, XML_ATTR_CIB_REVISION,version);			}#else			crm_xml_add(cib, XML_ATTR_CIB_REVISION, version);#endif		} else {			crm_err("Skipping feature check for %s tag", tag);		}		add_message_xml(op_msg, F_CIB_CALLDATA, data);	}		if (rc != HA_OK) {		crm_err("Failed to create CIB operation message");		crm_log_message(LOG_ERR, op_msg);		crm_msg_del(op_msg);		return cib_create_msg;	}	if(call_options & cib_inhibit_bcast) {		CRM_DEV_ASSERT((call_options & cib_scope_local));	}	cib->call_id++;	/* prevent call_id from being negative (or zero) and conflicting	 *    with the cib_errors enum	 * use 2 because we use it as (cib->call_id - 1) below	 */	if(cib->call_id < 2) {		cib->call_id = 2;	}		crm_debug_3("Sending %s message to CIB service", op);	if(send_ipc_message(native->command_channel, op_msg) == FALSE) {		crm_err("Sending message to CIB service FAILED");		return cib_send_failed;	} else {		crm_debug_3("Message sent");	}	op_msg = NULL;	if((call_options & cib_discard_reply)) {		crm_debug_3("Discarding reply");		return cib_ok;	} else if(!(call_options & cib_sync_call)) {		crm_debug_3("Async call, returning");		return cib->call_id - 1;	}	rc = IPC_OK;	crm_debug_3("Waiting for a syncronous reply");	while(native->command_channel->ops->get_chan_status(		      native->command_channel) == IPC_CONNECT) {		rc = native->command_channel->ops->waitin(			native->command_channel);		if(rc == IPC_OK) {			int msg_id = cib->call_id - 1;			int reply_id = -1;			op_reply = msgfromIPC_noauth(native->command_channel);			if(op_reply == NULL) {				break;			}			CRM_DEV_ASSERT(HA_OK == ha_msg_value_int(					       op_reply, F_CIB_CALLID, &reply_id));			CRM_DEV_ASSERT(reply_id <= msg_id);						if(reply_id == msg_id) {				break;			} else if(reply_id < msg_id) {				crm_debug("Recieved old reply: %d (wanted %d)",					reply_id, msg_id);				crm_log_message_adv(					LOG_MSG, "Old reply", op_reply);			} else {				crm_err("Received a __future__ reply:"					" %d (wanted %d)", reply_id, msg_id);			}			crm_msg_del(op_reply);		} else if(rc == IPC_INTR) {			crm_debug_3("a signal arrived, retry the read");		} else {			break;		}	}	if(native->command_channel->ops->get_chan_status(		   native->command_channel) != IPC_CONNECT) {		crm_err("No reply message - disconnected - %d", rc);		cib->state = cib_disconnected;		crm_msg_del(op_reply);		return cib_not_connected;			} else if(rc != IPC_OK) {		crm_err("No reply message - failed - %d", rc);		crm_msg_del(op_reply);		return cib_reply_failed;	} else if(op_reply == NULL) {		crm_err("No reply message - empty - %d", rc);		return cib_reply_failed;	}		crm_debug_3("Syncronous reply recieved");	rc = cib_ok;		/* Start processing the reply... */	if(ha_msg_value_int(op_reply, F_CIB_RC, &rc) != HA_OK) {		rc = cib_return_code;	}		if(rc == cib_ok || rc == cib_not_master || rc == cib_master_timeout) {		crm_log_message(LOG_MSG, op_reply);	} else {/* 	} else if(rc == cib_remote_timeout) { */		crm_err("Call failed: %s", cib_error2string(rc));		crm_log_message(LOG_WARNING, op_reply);	}		if(output_data == NULL) {		/* do nothing more */			} else if(!(call_options & cib_discard_reply)) {		*output_data = get_message_xml(op_reply, F_CIB_CALLDATA);		if(*output_data == NULL) {			crm_debug_3("No output in reply to \"%s\" command %d",				  op, cib->call_id - 1);		}	}		crm_msg_del(op_reply);	return rc;}
8182	/local/tlutelli/issta_data/temp/c/2005_temp/2005/8182/b2722500d74879ce7dab96ac7436f0464edc7a43/cib_native.c/clean/lib/crm/cib/cib_native.c