Exemplo n.º 1
0
extern int select_nodeinfo_unpack(select_nodeinfo_t **nodeinfo, Buf buffer,
				  uint16_t protocol_version)
{
	uint16_t size = 0;
	select_nodeinfo_t *nodeinfo_ptr = NULL;
	uint32_t j = 0;

	if (protocol_version >= SLURM_2_1_PROTOCOL_VERSION) {
		safe_unpack16(&size, buffer);

		nodeinfo_ptr = select_nodeinfo_alloc((uint32_t)size);
		*nodeinfo = nodeinfo_ptr;

		safe_unpack16(&size, buffer);
		nodeinfo_ptr->subgrp_list = list_create(_free_node_subgrp);
		for(j=0; j<size; j++) {
			node_subgrp_t *subgrp = NULL;
			if (_unpack_node_subgrp(&subgrp, buffer,
						nodeinfo_ptr->bitmap_size,
						protocol_version)
			    != SLURM_SUCCESS)
				goto unpack_error;
			list_append(nodeinfo_ptr->subgrp_list, subgrp);
		}
	}
	return SLURM_SUCCESS;

unpack_error:
	error("select_nodeinfo_unpack: error unpacking here");
	select_nodeinfo_free(nodeinfo_ptr);
	*nodeinfo = NULL;

	return SLURM_ERROR;
}
Exemplo n.º 2
0
extern int select_nodeinfo_unpack(select_nodeinfo_t **nodeinfo, Buf buffer,
				  uint16_t protocol_version)
{
	uint16_t size = 0;
	select_nodeinfo_t *nodeinfo_ptr = NULL;
	uint32_t j = 0;
	uint32_t uint32_tmp;

	if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) {
		safe_unpack16(&size, buffer);

		nodeinfo_ptr = select_nodeinfo_alloc((uint32_t)size);
		*nodeinfo = nodeinfo_ptr;

		safe_unpackstr_xmalloc(&nodeinfo_ptr->extra_info,
				       &uint32_tmp, buffer);

		safe_unpackstr_xmalloc(&nodeinfo_ptr->failed_cnodes,
				       &uint32_tmp, buffer);

		safe_unpackstr_xmalloc(&nodeinfo_ptr->rack_mp,
				       &uint32_tmp, buffer);

		safe_unpack16(&size, buffer);
		nodeinfo_ptr->subgrp_list = list_create(_free_node_subgrp);
		for (j=0; j<size; j++) {
			node_subgrp_t *subgrp = NULL;
			if (_unpack_node_subgrp(&subgrp, buffer,
						nodeinfo_ptr->bitmap_size,
						protocol_version)
			    != SLURM_SUCCESS)
				goto unpack_error;
			list_append(nodeinfo_ptr->subgrp_list, subgrp);
		}
	} else {
 		error("select_nodeinfo_unpack: protocol_version "
 		      "%hu not supported", protocol_version);
	}
	return SLURM_SUCCESS;

unpack_error:
	error("select_nodeinfo_unpack: error unpacking here");
	select_nodeinfo_free(nodeinfo_ptr);
	*nodeinfo = NULL;

	return SLURM_ERROR;
}