diff options
Diffstat (limited to 'src/H5SMbtree2.c')
-rw-r--r-- | src/H5SMbtree2.c | 99 |
1 files changed, 71 insertions, 28 deletions
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index e24dbb7..e533ae8 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -45,11 +45,12 @@ /********************/ /* v2 B-tree callbacks */ -static void *H5SM_bt2_crt_context(void *udata); -static herr_t H5SM_bt2_dst_context(void *ctx); -static herr_t H5SM_bt2_store(void *native, const void *udata); -static herr_t H5SM_bt2_debug(FILE *stream, int indent, int fwidth, - const void *record); +static void *H5SM__bt2_crt_context(void *udata); +static herr_t H5SM__bt2_dst_context(void *ctx); +static herr_t H5SM__bt2_store(void *native, const void *udata); +static herr_t H5SM__bt2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); +static void *H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*****************************/ @@ -60,13 +61,15 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ H5B2_SOHM_INDEX_ID, /* Type of B-tree */ "H5B2_SOHM_INDEX_ID", /* Name of B-tree class */ sizeof(H5SM_sohm_t), /* Size of native record */ - H5SM_bt2_crt_context, /* Create client callback context */ - H5SM_bt2_dst_context, /* Destroy client callback context */ - H5SM_bt2_store, /* Record storage callback */ - H5SM_message_compare, /* Record comparison callback */ - H5SM_message_encode, /* Record encoding callback */ - H5SM_message_decode, /* Record decoding callback */ - H5SM_bt2_debug /* Record debugging callback */ + H5SM__bt2_crt_context, /* Create client callback context */ + H5SM__bt2_dst_context, /* Destroy client callback context */ + H5SM__bt2_store, /* Record storage callback */ + H5SM__message_compare, /* Record comparison callback */ + H5SM__message_encode, /* Record encoding callback */ + H5SM__message_decode, /* Record decoding callback */ + H5SM__bt2_debug, /* Record debugging callback */ + H5SM__bt2_crt_dbg_context, /* Create debugging context */ + H5SM__bt2_dst_context /* Destroy debugging context */ }}; @@ -80,7 +83,7 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); /*------------------------------------------------------------------------- - * Function: H5SM_bt2_crt_context + * Function: H5SM__bt2_crt_context * * Purpose: Create client callback context * @@ -93,13 +96,13 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); *------------------------------------------------------------------------- */ static void * -H5SM_bt2_crt_context(void *_f) +H5SM__bt2_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5SM_bt2_ctx_t *ctx; /* Callback context structure */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -116,11 +119,11 @@ H5SM_bt2_crt_context(void *_f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5SM_bt2_crt_context() */ +} /* H5SM__bt2_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_dst_context + * Function: H5SM__bt2_dst_context * * Purpose: Destroy client callback context * @@ -133,11 +136,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_dst_context(void *_ctx) +H5SM__bt2_dst_context(void *_ctx) { H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -146,11 +149,11 @@ H5SM_bt2_dst_context(void *_ctx) ctx = H5FL_FREE(H5SM_bt2_ctx_t, ctx); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5SM_bt2_dst_context() */ +} /* H5SM__bt2_dst_context() */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_store + * Function: H5SM__bt2_store * * Purpose: Store a H5SM_sohm_t SOHM message in the B-tree. The message * comes in UDATA as a H5SM_mesg_key_t* and is copied to @@ -165,21 +168,21 @@ H5SM_bt2_dst_context(void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_store(void *native, const void *udata) +H5SM__bt2_store(void *native, const void *udata) { const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *)udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy the source message to the B-tree */ *(H5SM_sohm_t *)native = key->message; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_bt2_store */ +} /* end H5SM__bt2_store */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_debug + * Function: H5SM__bt2_debug * * Purpose: Print debugging information for a H5SM_sohm_t. * @@ -192,11 +195,12 @@ H5SM_bt2_store(void *native, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record) +H5SM__bt2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void H5_ATTR_UNUSED *_udata) { const H5SM_sohm_t *sohm = (const H5SM_sohm_t *)record; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(sohm->location == H5SM_IN_HEAP) HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx}\n", indent, "", fwidth, @@ -210,7 +214,46 @@ H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_bt2_debug */ +} /* end H5SM__bt2_debug */ + + +/*------------------------------------------------------------------------- + * Function: H5SM__bt2_crt_dbg_context + * + * Purpose: Create context for debugging callback + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, December 1, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +{ + H5SM_bt2_ctx_t *ctx; /* Callback context structure */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses & lengths in the file */ + ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5SM__bt2_crt_dbg_context() */ /*------------------------------------------------------------------------- |