2004-06-15 23:07:45 +04:00
|
|
|
/**
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
2004-07-13 00:05:29 +04:00
|
|
|
* Description of the Memory Pool framework
|
2004-06-15 23:07:45 +04:00
|
|
|
*/
|
|
|
|
#ifndef MCA_MPOOL_H
|
|
|
|
#define MCA_MPOOL_H
|
|
|
|
#include "mca/mca.h"
|
|
|
|
|
|
|
|
struct mca_mpool_t;
|
|
|
|
|
|
|
|
|
2004-06-18 00:57:47 +04:00
|
|
|
/**
|
|
|
|
* if appropriate - returns base address of memory pool
|
|
|
|
*/
|
|
|
|
typedef void* (*mca_mpool_base_address_fn_t)(void);
|
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/**
|
|
|
|
* allocate function typedef
|
|
|
|
*/
|
2004-06-16 19:41:29 +04:00
|
|
|
typedef void* (*mca_mpool_base_alloc_fn_t)(size_t size, size_t align);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-06-24 20:47:00 +04:00
|
|
|
/**
|
|
|
|
* allocate function typedef
|
|
|
|
*/
|
|
|
|
typedef void* (*mca_mpool_base_alloc_and_register_fn_t)(size_t size, size_t align, void* user);
|
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/**
|
|
|
|
* realloc function typedef
|
|
|
|
*/
|
2004-06-16 19:41:29 +04:00
|
|
|
typedef void* (*mca_mpool_base_realloc_fn_t)(void* addr, size_t size);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* free function typedef
|
|
|
|
*/
|
2004-06-16 19:41:29 +04:00
|
|
|
typedef void (*mca_mpool_base_free_fn_t)(void *);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* register memory
|
|
|
|
*/
|
2004-06-24 20:47:00 +04:00
|
|
|
typedef int (*mca_mpool_base_register_fn_t)(void * addr, size_t size, void* user);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* deregister memory
|
|
|
|
*/
|
2004-06-24 20:47:00 +04:00
|
|
|
typedef int (*mca_mpool_base_deregister_fn_t)(void * addr, size_t size);
|
2004-06-16 19:41:29 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* finalize
|
|
|
|
*/
|
|
|
|
typedef void (*mca_mpool_base_finalize_fn_t)(struct mca_mpool_t*);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-06-16 19:41:29 +04:00
|
|
|
|
|
|
|
/**
|
2004-07-13 00:05:29 +04:00
|
|
|
* initialize
|
2004-06-16 19:41:29 +04:00
|
|
|
*/
|
|
|
|
typedef struct mca_mpool_t* (*mca_mpool_base_init_fn_t)(bool *allow_multi_user_threads);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* mpool component descriptor. Contains component version information
|
|
|
|
* and open/close/init functions.
|
|
|
|
*/
|
2004-06-16 19:41:29 +04:00
|
|
|
struct mca_mpool_base_component_1_0_0_t {
|
2004-07-13 00:05:29 +04:00
|
|
|
mca_base_module_t mpool_version; /**< version */
|
|
|
|
mca_base_module_data_1_0_0_t mpool_data;/**< metadata */
|
|
|
|
mca_mpool_base_init_fn_t mpool_init; /**< init function */
|
2004-06-16 19:41:29 +04:00
|
|
|
};
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* Convenience typedef.
|
|
|
|
*/
|
2004-06-16 19:41:29 +04:00
|
|
|
typedef struct mca_mpool_base_component_1_0_0_t mca_mpool_base_component_1_0_0_t;
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* Convenience typedef
|
|
|
|
*/
|
2004-06-16 19:41:29 +04:00
|
|
|
typedef struct mca_mpool_base_component_1_0_0_t mca_mpool_base_component_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mpool module descriptor. Contains functions exported
|
|
|
|
* by the component.
|
|
|
|
*/
|
2004-06-15 23:07:45 +04:00
|
|
|
struct mca_mpool_t {
|
2004-07-13 00:05:29 +04:00
|
|
|
mca_mpool_base_component_t *mpool_component; /**< component stuct */
|
|
|
|
mca_mpool_base_address_fn_t mpool_base; /**< returns the base address */
|
|
|
|
mca_mpool_base_alloc_fn_t mpool_alloc; /**< allocate function */
|
|
|
|
mca_mpool_base_realloc_fn_t mpool_realloc; /**< reallocate function */
|
|
|
|
mca_mpool_base_free_fn_t mpool_free; /**< free function */
|
|
|
|
mca_mpool_base_register_fn_t mpool_register; /**< register memory */
|
|
|
|
mca_mpool_base_deregister_fn_t mpool_deregister; /**< deregister memory */
|
|
|
|
mca_mpool_base_finalize_fn_t mpool_finalize; /**< finalize */
|
2004-06-15 23:07:45 +04:00
|
|
|
};
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* Convenience typedef
|
|
|
|
*/
|
2004-06-15 23:07:45 +04:00
|
|
|
typedef struct mca_mpool_t mca_mpool_t;
|
|
|
|
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* Macro for use in modules that are of type mpool v1.0.0
|
2004-06-16 19:41:29 +04:00
|
|
|
*/
|
|
|
|
#define MCA_MPOOL_BASE_VERSION_1_0_0 \
|
|
|
|
/* mpool v1.0 is chained to MCA v1.0 */ \
|
|
|
|
MCA_BASE_VERSION_1_0_0, \
|
|
|
|
/* ptl v1.0 */ \
|
|
|
|
"mpool", 1, 0, 0
|
2004-06-15 23:07:45 +04:00
|
|
|
|
|
|
|
#endif /* MCA_MPOOL_H */
|
|
|
|
|