op_msg = ha_msg_new(7);
op_msg = ha_msg_new(8);
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(7);	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(cl_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_trace("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 && data != NULL) {		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;	}	cib->call_id++;	crm_debug("Sending %s message to CIB service", op); 	crm_log_message(LOG_MSG, op_msg);	rc = msg2ipcchan(op_msg, native->command_channel);	CRM_DEV_ASSERT(native->command_channel->send_queue->current_qlen < native->command_channel->send_queue->max_qlen);		if (rc != HA_OK) {		crm_err("Sending message to CIB service FAILED: %d", rc);/* 		CRM_DEV_ASSERT(native->command_channel->should_send_blocking); */		crm_log_message(LOG_ERR, op_msg);		crm_msg_del(op_msg);		return cib_send_failed;	} else {		crm_devel("Message sent");	} 	crm_msg_del(op_msg);	op_msg = NULL;	if((call_options & cib_discard_reply)) {		crm_devel("Discarding reply");		return cib_ok;	} else if(!(call_options & cib_sync_call)) {		crm_devel("Async call, returning");		return cib->call_id - 1;	}	crm_devel("Waiting for a syncronous reply");	op_reply = msgfromIPC_noauth(native->command_channel);	if (op_reply == NULL) {		crm_err("No reply message");		return cib_reply_failed;	}	crm_devel("Syncronous reply recieved"); 	crm_log_message(LOG_MSG, op_reply);	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(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("No output in reply to \"%s\" command %d",				  op, cib->call_id - 1);		}	}		crm_msg_del(op_reply);	return rc;}