5dfd54c778
Clean up the remainder of the size_t references in the runtime itself. Convert to orte_std_cntr_t wherever it makes sense (only avoid those places where the actual memory size is referenced). Remove the obsolete oob barrier function (we actually obsoleted it a long time ago - just never bothered to clean it up). I have done my best to go through all the components and catch everything, even if I couldn't test compile them since I wasn't on that type of system. Still, I cannot guarantee that problems won't show up when you test this on specific systems. Usually, these will just show as "warning: comparison between signed and unsigned" notes which are easily fixed (just change a size_t to orte_std_cntr_t). In some places, people didn't use size_t, but instead used some other variant (e.g., I found several places with uint32_t). I tried to catch all of them, but... Once we get all the instances caught and fixed, this should once and for all resolve many of the heterogeneity problems. This commit was SVN r11204.
108 строки
2.7 KiB
C
108 строки
2.7 KiB
C
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
* Corporation. All rights reserved.
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
* of Tennessee Research Foundation. All rights
|
|
* reserved.
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
/*
|
|
* DPS Buffer Operations
|
|
*/
|
|
|
|
/** @file:
|
|
*
|
|
*/
|
|
|
|
#include "orte_config.h"
|
|
|
|
#include <sys/types.h>
|
|
#ifdef HAVE_NETINET_IN_H
|
|
#include <netinet/in.h>
|
|
#endif
|
|
|
|
#include "orte/mca/ns/base/base.h"
|
|
|
|
#include "orte/dss/dss_internal.h"
|
|
|
|
|
|
int orte_dss_unload(orte_buffer_t *buffer, void **payload,
|
|
orte_std_cntr_t *bytes_used)
|
|
{
|
|
/* check that buffer is not null */
|
|
if (!buffer) {
|
|
return ORTE_ERR_BAD_PARAM;
|
|
}
|
|
|
|
/* were we given someplace to point to the payload */
|
|
if (NULL == payload) {
|
|
return ORTE_ERR_BAD_PARAM;
|
|
}
|
|
|
|
/* anything in the buffer - if not, nothing to do */
|
|
if (NULL == buffer->base_ptr || 0 == buffer->bytes_used) {
|
|
*payload = NULL;
|
|
*bytes_used = 0;
|
|
return ORTE_SUCCESS;
|
|
}
|
|
|
|
/* okay, we have something to provide - pass it back */
|
|
*payload = buffer->base_ptr;
|
|
*bytes_used = buffer->bytes_used;
|
|
|
|
/* dereference everything in buffer */
|
|
buffer->base_ptr = NULL;
|
|
buffer->pack_ptr = buffer->unpack_ptr = NULL;
|
|
buffer->bytes_allocated = buffer->bytes_used = buffer->bytes_avail = 0;
|
|
|
|
/* All done */
|
|
|
|
return ORTE_SUCCESS;
|
|
}
|
|
|
|
|
|
int orte_dss_load(orte_buffer_t *buffer, void *payload,
|
|
orte_std_cntr_t bytes_used)
|
|
{
|
|
/* check to see if the buffer has been initialized */
|
|
if (NULL == buffer) {
|
|
return ORTE_ERR_BAD_PARAM;
|
|
}
|
|
|
|
/* check that the payload is there */
|
|
if (NULL == payload) {
|
|
return ORTE_SUCCESS;
|
|
}
|
|
|
|
/* check if buffer already has payload - free it if so */
|
|
if (NULL != buffer->base_ptr) {
|
|
free(buffer->base_ptr);
|
|
}
|
|
|
|
/* populate the buffer */
|
|
buffer->base_ptr = payload;
|
|
|
|
/* set pack/unpack pointers */
|
|
buffer->pack_ptr = ((char*)buffer->base_ptr) + bytes_used;
|
|
buffer->unpack_ptr = buffer->base_ptr;
|
|
|
|
/* set counts for size and space */
|
|
buffer->bytes_allocated = buffer->bytes_used = bytes_used;
|
|
buffer->bytes_avail = 0;
|
|
|
|
/* All done */
|
|
|
|
return ORTE_SUCCESS;
|
|
}
|
|
|