Skip to content
Snippets Groups Projects
Commit 3cdf7c9d authored by Utz-Uwe Haus's avatar Utz-Uwe Haus
Browse files

transport cleanups

parent 69e2d9db
Branches
Tags
No related merge requests found
......@@ -73,21 +73,21 @@ mstro_transport_get_dst_buffer(mstro_cdo dst, size_t len, void** data)
return MSTRO_FAIL;
}
} else {
const void *available_size;
const int64_t *available_size;
enum mstro_cdo_attr_value_type type;
status = mstro_cdo_attribute_get(
dst, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, &available_size);
dst, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, (const void**)&available_size);
if(status!=MSTRO_OK) {
ERR("Failed to fetch size attribute\n");
return MSTRO_FAIL;
}
if(*(const int64_t*)available_size<len) {
ERR("local CDO handle has raw-ptr allocation, but it is too small for incoming CDO: have %zu, need %zu\n",
*(const int64_t*)available_size, len);
if(*available_size<len) {
ERR("local CDO handle has raw-ptr allocation, but it is too small for incoming CDO: have %" PRIi64 ", need %" PRIi64 "\n",
*available_size, len);
return MSTRO_FAIL;
} else {
DEBUG("Pre-allocated RAW-PTR (have %zu, need %zu), good\n",
*(const int64_t*)available_size, len);
DEBUG("Pre-allocated RAW-PTR (have %" PRIi64 ", need %" PRIi64 "), good\n",
*available_size, len);
*data = dst->raw_ptr;
}
}
......@@ -99,23 +99,23 @@ mstro_status
mstro_transport_get_datalen(mstro_cdo src, struct mstro_transport_datalen* dl)
{
enum mstro_cdo_attr_value_type type;
const void* val;
const int64_t* val;
if (src->raw_ptr != NULL ) {
INFO ("Found a raw ptr in CDO %s\n", src->name);
dl->data = src->raw_ptr;
if (!(MSTRO_OK == mstro_cdo_attribute_get(
src, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, &val))) {
src, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, (const void**)&val))) {
ERR("Failed to get size attribute of CDO %s for transport\n", src->name);
return MSTRO_FAIL;
}
dl->len = *(size_t*)val;
dl->len = *val;
INFO("CDO size is %zu\n", dl->len);
}
else if (src->mamba_array != NULL) {
mmbArray* ma = src->mamba_array;
dl->data = (char*)ma->allocation->ptr;
dl->len = (size_t)ma->allocation->n_bytes;
dl->len = ma->allocation->n_bytes;
}
else {
ERR("Failed to find a raw pointer or a Mamba array to transport from CDO %s\n", src->name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment