2004-06-16 00:35:30 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* 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.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-16 00:35:30 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2004-06-16 00:35:30 +04:00
|
|
|
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-08-13 00:46:25 +04:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_msgbuf_internal.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/constants.h"
|
2004-06-16 00:35:30 +04:00
|
|
|
|
2004-06-16 03:31:37 +04:00
|
|
|
/*
|
|
|
|
* local prototypes
|
|
|
|
*/
|
|
|
|
int mca_base_msgbuf_init (void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* local variables
|
|
|
|
*/
|
|
|
|
static bool initialized = false;
|
|
|
|
|
2004-06-16 00:35:30 +04:00
|
|
|
|
|
|
|
/* blank prototypes for now that return unimplemented */
|
|
|
|
|
|
|
|
|
|
|
|
/* get/create a free buffer */
|
|
|
|
/* if reqsize = MCA_BASE_MSGBUF_GETBUF, then the system gives an unlimited buffer. */
|
|
|
|
/* Giving a req size just makes it more memory efficient. */
|
|
|
|
mca_base_msgbuf_t mca_base_msgbuf_new (size_t reqsize)
|
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return ((mca_base_msgbuf_t)OPAL_ERR_NOT_SUPPORTED);
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* make a copy of an existing buffer */
|
|
|
|
/* this is usefull for the registry and is needed as unpack is */
|
|
|
|
/* destructive */
|
2004-06-16 04:26:32 +04:00
|
|
|
int mca_base_msgbuf_copy (mca_base_msgbuf_t* copybufid,
|
2004-06-16 00:35:30 +04:00
|
|
|
mca_base_msgbuf_t orgbufid)
|
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return (OPAL_ERR_NOT_SUPPORTED);
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set a buffer. As base_pack send/recv handles buffer you might not want */
|
|
|
|
/* to pack a buffer but do a send from memory directly */
|
|
|
|
/* a free on this special buffer just frees its structure not the memory */
|
|
|
|
mca_base_msgbuf_t mca_base_msgbuf_construct (void* ptr, size_t datasize)
|
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return ((mca_base_msgbuf_t)OPAL_ERR_NOT_SUPPORTED);
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* explicit free of a buffer when not auto freeing them */
|
2004-06-16 04:26:32 +04:00
|
|
|
int mca_base_msgbuf_free (mca_base_msgbuf_t* bufid)
|
2004-06-16 00:35:30 +04:00
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* pack and unpack non-string typed data */
|
|
|
|
int mca_base_msgbuf_pack (mca_base_msgbuf_t bufid, void* ptr, size_t num_items,
|
|
|
|
mca_base_msgbuf_data_t datatype)
|
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int mca_base_msgbuf_unpack (mca_base_msgbuf_t bufid, void* ptr,
|
|
|
|
size_t num_items, mca_base_msgbuf_data_t datatype)
|
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* handles strings */
|
|
|
|
/* note this takes NULL terminated strings and returns null terminated strings */
|
|
|
|
int mca_base_msgbuf_pack_string (mca_base_msgbuf_t bufid, char* strptr)
|
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int mca_base_msgbuf_unpack_string (mca_base_msgbuf_t bufid, char* strptr,
|
|
|
|
size_t maxlen)
|
|
|
|
{
|
2004-06-16 03:31:37 +04:00
|
|
|
if (!initialized) mca_base_msgbuf_init ();
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
2004-06-16 00:35:30 +04:00
|
|
|
}
|
|
|
|
|
2004-06-16 03:31:37 +04:00
|
|
|
|
|
|
|
/* private functions just inside this code */
|
|
|
|
|
|
|
|
int mca_base_msgbuf_init ()
|
|
|
|
{
|
|
|
|
if (initialized) return (0);
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
2004-06-16 03:31:37 +04:00
|
|
|
}
|