Ejemplo n.º 1
0
static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
				       uint8_t *buf, size_t *npush)
{
	size_t np = 0, offset;
	uint32_t u32;

	switch (cd->opcode) {
	case CTDB_CONTROL_PROCESS_EXISTS:
		ctdb_pid_push(&cd->data.pid, buf, &np);
		break;

	case CTDB_CONTROL_GETDBPATH:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_SETVNNMAP:
		ctdb_vnn_map_push(cd->data.vnnmap, buf, &np);
		break;

	case CTDB_CONTROL_SET_DEBUG:
		ctdb_uint32_push(&cd->data.loglevel, buf, &np);
		break;

	case CTDB_CONTROL_PULL_DB:
		ctdb_pulldb_push(cd->data.pulldb, buf, &np);
		break;

	case CTDB_CONTROL_PUSH_DB:
		ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
		break;

	case CTDB_CONTROL_SET_RECMODE:
		ctdb_uint32_push(&cd->data.recmode, buf, &np);
		break;

	case CTDB_CONTROL_DB_ATTACH:
		ctdb_string_push(&cd->data.db_name, buf, &np);
		break;

	case CTDB_CONTROL_SET_CALL:
		break;

	case CTDB_CONTROL_TRAVERSE_START:
		ctdb_traverse_start_push(cd->data.traverse_start, buf, &np);
		break;

	case CTDB_CONTROL_TRAVERSE_ALL:
		ctdb_traverse_all_push(cd->data.traverse_all, buf, &np);
		break;

	case CTDB_CONTROL_TRAVERSE_DATA:
		ctdb_rec_data_push(cd->data.rec_data, buf, &np);
		break;

	case CTDB_CONTROL_GET_DBNAME:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_ENABLE_SEQNUM:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_UPDATE_SEQNUM:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_SET_RECMASTER:
		ctdb_uint32_push(&cd->data.recmaster, buf, &np);
		break;

	case CTDB_CONTROL_TCP_CLIENT:
		ctdb_connection_push(cd->data.conn, buf, &np);
		break;

	case CTDB_CONTROL_TCP_ADD:
		ctdb_connection_push(cd->data.conn, buf, &np);
		break;

	case CTDB_CONTROL_TCP_REMOVE:
		ctdb_connection_push(cd->data.conn, buf, &np);
		break;

	case CTDB_CONTROL_SET_TUNABLE:
		ctdb_tunable_push(cd->data.tunable, buf, &np);
		break;

	case CTDB_CONTROL_GET_TUNABLE:
		ctdb_stringn_push(&cd->data.tun_var, buf, &np);
		break;

	case CTDB_CONTROL_MODIFY_FLAGS:
		ctdb_node_flag_change_push(cd->data.flag_change, buf, &np);
		break;

	case CTDB_CONTROL_GET_TCP_TICKLE_LIST:
		ctdb_sock_addr_push(cd->data.addr, buf, &np);
		break;

	case CTDB_CONTROL_SET_TCP_TICKLE_LIST:
		ctdb_tickle_list_push(cd->data.tickles, buf, &np);
		break;

	case CTDB_CONTROL_DB_ATTACH_PERSISTENT:
		ctdb_string_push(&cd->data.db_name, buf, &np);
		break;

	case CTDB_CONTROL_UPDATE_RECORD:
		ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
		break;

	case CTDB_CONTROL_SEND_GRATUITOUS_ARP:
		ctdb_addr_info_push(cd->data.addr_info, buf, &np);
		break;

	case CTDB_CONTROL_WIPE_DATABASE:
		ctdb_transdb_push(cd->data.transdb, buf, &np);
		break;

	case CTDB_CONTROL_TRY_DELETE_RECORDS:
		ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
		break;

	case CTDB_CONTROL_ADD_PUBLIC_IP:
		ctdb_addr_info_push(cd->data.addr_info, buf, &np);
		break;

	case CTDB_CONTROL_DEL_PUBLIC_IP:
		ctdb_addr_info_push(cd->data.addr_info, buf, &np);
		break;

	case CTDB_CONTROL_RELEASE_IP:
		ctdb_public_ip_push(cd->data.pubip, buf, &np);
		break;

	case CTDB_CONTROL_TAKEOVER_IP:
		ctdb_public_ip_push(cd->data.pubip, buf, &np);
		break;

	case CTDB_CONTROL_TRAVERSE_KILL:
		ctdb_traverse_start_push(cd->data.traverse_start, buf, &np);
		break;

	case CTDB_CONTROL_RECD_RECLOCK_LATENCY:
		ctdb_double_push(&cd->data.reclock_latency, buf, &np);
		break;

	case CTDB_CONTROL_SET_LMASTERROLE:
		ctdb_uint32_push(&cd->data.role, buf, &np);
		break;

	case CTDB_CONTROL_SET_RECMASTERROLE:
		ctdb_uint32_push(&cd->data.role, buf, &np);
		break;

	case CTDB_CONTROL_SET_BAN_STATE:
		ctdb_ban_state_push(cd->data.ban_state, buf, &np);
		break;

	case CTDB_CONTROL_REGISTER_NOTIFY:
		ctdb_notify_data_push(cd->data.notify, buf, &np);
		break;

	case CTDB_CONTROL_DEREGISTER_NOTIFY:
		ctdb_uint64_push(&cd->data.srvid, buf, &np);
		break;

	case CTDB_CONTROL_TRANS3_COMMIT:
		ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
		break;

	case CTDB_CONTROL_GET_DB_SEQNUM:
		u32 = 0;
		offset = 0;
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		offset += np;
		ctdb_uint32_push(&u32, buf+offset, &np);
		offset += np;
		np = offset;
		break;

	case CTDB_CONTROL_DB_SET_HEALTHY:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_DB_GET_HEALTH:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_GET_PUBLIC_IP_INFO:
		ctdb_sock_addr_push(cd->data.addr, buf, &np);
		break;

	case CTDB_CONTROL_SET_IFACE_LINK_STATE:
		ctdb_iface_push(cd->data.iface, buf, &np);
		break;

	case CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE:
		ctdb_connection_push(cd->data.conn, buf, &np);
		break;

	case CTDB_CONTROL_SCHEDULE_FOR_DELETION:
		ctdb_key_data_push(cd->data.key, buf, &np);
		break;

	case CTDB_CONTROL_SET_DB_READONLY:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_CHECK_SRVIDS:
		break;

	case CTDB_CONTROL_TRAVERSE_START_EXT:
		ctdb_traverse_start_ext_push(cd->data.traverse_start_ext, buf,
					     &np);
		break;

	case CTDB_CONTROL_GET_DB_STATISTICS:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_SET_DB_STICKY:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_TRAVERSE_ALL_EXT:
		ctdb_traverse_all_ext_push(cd->data.traverse_all_ext, buf,
					   &np);
		break;

	case CTDB_CONTROL_RECEIVE_RECORDS:
		ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
		break;

	case CTDB_CONTROL_DB_DETACH:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_DB_FREEZE:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_DB_THAW:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_DB_TRANSACTION_START:
		ctdb_transdb_push(cd->data.transdb, buf, &np);
		break;

	case CTDB_CONTROL_DB_TRANSACTION_COMMIT:
		ctdb_transdb_push(cd->data.transdb, buf, &np);
		break;

	case CTDB_CONTROL_DB_TRANSACTION_CANCEL:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_DB_PULL:
		ctdb_pulldb_ext_push(cd->data.pulldb_ext, buf, &np);
		break;

	case CTDB_CONTROL_DB_PUSH_START:
		ctdb_pulldb_ext_push(cd->data.pulldb_ext, buf, &np);
		break;

	case CTDB_CONTROL_DB_PUSH_CONFIRM:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_DB_OPEN_FLAGS:
		ctdb_uint32_push(&cd->data.db_id, buf, &np);
		break;

	case CTDB_CONTROL_DB_ATTACH_REPLICATED:
		ctdb_string_push(&cd->data.db_name, buf, &np);
		break;

	case CTDB_CONTROL_CHECK_PID_SRVID:
		ctdb_pid_srvid_push(cd->data.pid_srvid, buf, &np);
		break;
	}

	*npush = np;
}
Ejemplo n.º 2
0
static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
				       uint8_t *buf)
{
	uint64_t u64;

	switch (cd->opcode) {
	case CTDB_CONTROL_PROCESS_EXISTS:
		ctdb_pid_push(cd->data.pid, buf);
		break;

	case CTDB_CONTROL_GETDBPATH:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_SETVNNMAP:
		ctdb_vnn_map_push(cd->data.vnnmap, buf);
		break;

	case CTDB_CONTROL_SET_DEBUG:
		ctdb_uint32_push(cd->data.loglevel, buf);
		break;

	case CTDB_CONTROL_PULL_DB:
		ctdb_pulldb_push(cd->data.pulldb, buf);
		break;

	case CTDB_CONTROL_PUSH_DB:
		ctdb_rec_buffer_push(cd->data.recbuf, buf);
		break;

	case CTDB_CONTROL_SET_RECMODE:
		ctdb_uint32_push(cd->data.recmode, buf);
		break;

	case CTDB_CONTROL_DB_ATTACH:
		ctdb_string_push(cd->data.db_name, buf);
		break;

	case CTDB_CONTROL_SET_CALL:
		break;

	case CTDB_CONTROL_TRAVERSE_START:
		ctdb_traverse_start_push(cd->data.traverse_start, buf);
		break;

	case CTDB_CONTROL_TRAVERSE_ALL:
		ctdb_traverse_all_push(cd->data.traverse_all, buf);
		break;

	case CTDB_CONTROL_TRAVERSE_DATA:
		ctdb_rec_data_push(cd->data.rec_data, buf);
		break;

	case CTDB_CONTROL_GET_DBNAME:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_ENABLE_SEQNUM:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_UPDATE_SEQNUM:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_SET_RECMASTER:
		ctdb_uint32_push(cd->data.recmaster, buf);
		break;

	case CTDB_CONTROL_TCP_CLIENT:
		ctdb_connection_push(cd->data.conn, buf);
		break;

	case CTDB_CONTROL_TCP_ADD:
		ctdb_connection_push(cd->data.conn, buf);
		break;

	case CTDB_CONTROL_TCP_REMOVE:
		ctdb_connection_push(cd->data.conn, buf);
		break;

	case CTDB_CONTROL_SET_TUNABLE:
		ctdb_tunable_push(cd->data.tunable, buf);
		break;

	case CTDB_CONTROL_GET_TUNABLE:
		ctdb_stringn_push(cd->data.tun_var, buf);
		break;

	case CTDB_CONTROL_MODIFY_FLAGS:
		ctdb_node_flag_change_push(cd->data.flag_change, buf);
		break;

	case CTDB_CONTROL_KILL_TCP:
		ctdb_connection_push(cd->data.conn, buf);
		break;

	case CTDB_CONTROL_GET_TCP_TICKLE_LIST:
		ctdb_sock_addr_push(cd->data.addr, buf);
		break;

	case CTDB_CONTROL_SET_TCP_TICKLE_LIST:
		ctdb_tickle_list_push(cd->data.tickles, buf);
		break;

	case CTDB_CONTROL_REGISTER_SERVER_ID:
		ctdb_client_id_push(cd->data.cid, buf);
		break;

	case CTDB_CONTROL_UNREGISTER_SERVER_ID:
		ctdb_client_id_push(cd->data.cid, buf);
		break;

	case CTDB_CONTROL_CHECK_SERVER_ID:
		ctdb_client_id_push(cd->data.cid, buf);
		break;

	case CTDB_CONTROL_DB_ATTACH_PERSISTENT:
		ctdb_string_push(cd->data.db_name, buf);
		break;

	case CTDB_CONTROL_UPDATE_RECORD:
		ctdb_rec_buffer_push(cd->data.recbuf, buf);
		break;

	case CTDB_CONTROL_SEND_GRATUITOUS_ARP:
		ctdb_addr_info_push(cd->data.addr_info, buf);
		break;

	case CTDB_CONTROL_TRANSACTION_START:
		ctdb_uint32_push(cd->data.tid, buf);
		break;

	case CTDB_CONTROL_TRANSACTION_COMMIT:
		ctdb_uint32_push(cd->data.tid, buf);
		break;

	case CTDB_CONTROL_WIPE_DATABASE:
		ctdb_transdb_push(cd->data.transdb, buf);
		break;

	case CTDB_CONTROL_TRY_DELETE_RECORDS:
		ctdb_rec_buffer_push(cd->data.recbuf, buf);
		break;

	case CTDB_CONTROL_ADD_PUBLIC_IP:
		ctdb_addr_info_push(cd->data.addr_info, buf);
		break;

	case CTDB_CONTROL_DEL_PUBLIC_IP:
		ctdb_addr_info_push(cd->data.addr_info, buf);
		break;

	case CTDB_CONTROL_RUN_EVENTSCRIPTS:
		ctdb_string_push(cd->data.event_str, buf);
		break;

	case CTDB_CONTROL_RELEASE_IP:
		ctdb_public_ip_push(cd->data.pubip, buf);
		break;

	case CTDB_CONTROL_TAKEOVER_IP:
		ctdb_public_ip_push(cd->data.pubip, buf);
		break;

	case CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS:
		ctdb_uint32_push(cd->data.event, buf);
		break;

	case CTDB_CONTROL_TRAVERSE_KILL:
		ctdb_traverse_start_push(cd->data.traverse_start, buf);
		break;

	case CTDB_CONTROL_RECD_RECLOCK_LATENCY:
		ctdb_double_push(cd->data.reclock_latency, buf);
		break;

	case CTDB_CONTROL_SET_RECLOCK_FILE:
		ctdb_string_push(cd->data.reclock_file, buf);
		break;

	case CTDB_CONTROL_SET_NATGWSTATE:
		ctdb_uint32_push(cd->data.role, buf);
		break;

	case CTDB_CONTROL_SET_LMASTERROLE:
		ctdb_uint32_push(cd->data.role, buf);
		break;

	case CTDB_CONTROL_SET_RECMASTERROLE:
		ctdb_uint32_push(cd->data.role, buf);
		break;

	case CTDB_CONTROL_ENABLE_SCRIPT:
		ctdb_string_push(cd->data.script, buf);
		break;

	case CTDB_CONTROL_DISABLE_SCRIPT:
		ctdb_string_push(cd->data.script, buf);
		break;

	case CTDB_CONTROL_SET_BAN_STATE:
		ctdb_ban_state_push(cd->data.ban_state, buf);
		break;

	case CTDB_CONTROL_SET_DB_PRIORITY:
		ctdb_db_priority_push(cd->data.db_prio, buf);
		break;

	case CTDB_CONTROL_GET_DB_PRIORITY:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_REGISTER_NOTIFY:
		ctdb_notify_data_push(cd->data.notify, buf);
		break;

	case CTDB_CONTROL_DEREGISTER_NOTIFY:
		ctdb_uint64_push(cd->data.srvid, buf);
		break;

	case CTDB_CONTROL_TRANS3_COMMIT:
		ctdb_rec_buffer_push(cd->data.recbuf, buf);
		break;

	case CTDB_CONTROL_GET_DB_SEQNUM:
		u64 = cd->data.db_id;
		ctdb_uint32_push(u64, buf);
		break;

	case CTDB_CONTROL_DB_SET_HEALTHY:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_DB_GET_HEALTH:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_GET_PUBLIC_IP_INFO:
		ctdb_sock_addr_push(cd->data.addr, buf);
		break;

	case CTDB_CONTROL_SET_IFACE_LINK_STATE:
		ctdb_iface_push(cd->data.iface, buf);
		break;

	case CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE:
		ctdb_connection_push(cd->data.conn, buf);
		break;

	case CTDB_CONTROL_SCHEDULE_FOR_DELETION:
		ctdb_key_data_push(cd->data.key, buf);
		break;

	case CTDB_CONTROL_SET_DB_READONLY:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_CHECK_SRVIDS:
		ctdb_uint64_array_push(cd->data.u64_array, buf);
		break;

	case CTDB_CONTROL_TRAVERSE_START_EXT:
		ctdb_traverse_start_ext_push(cd->data.traverse_start_ext, buf);
		break;

	case CTDB_CONTROL_GET_DB_STATISTICS:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_SET_DB_STICKY:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_TRAVERSE_ALL_EXT:
		ctdb_traverse_all_ext_push(cd->data.traverse_all_ext, buf);
		break;

	case CTDB_CONTROL_RECEIVE_RECORDS:
		ctdb_rec_buffer_push(cd->data.recbuf, buf);
		break;

	case CTDB_CONTROL_DB_DETACH:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_DB_FREEZE:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_DB_THAW:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;

	case CTDB_CONTROL_DB_TRANSACTION_START:
		ctdb_transdb_push(cd->data.transdb, buf);
		break;

	case CTDB_CONTROL_DB_TRANSACTION_COMMIT:
		ctdb_transdb_push(cd->data.transdb, buf);
		break;

	case CTDB_CONTROL_DB_TRANSACTION_CANCEL:
		ctdb_uint32_push(cd->data.db_id, buf);
		break;
	}
}