diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-01 16:45:27 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-01 16:45:27 (GMT) |
commit | 71a9d507255366be01c25e458ac4c953d4481f45 (patch) | |
tree | 511f2662e8cc85010434af4a64812da147848317 /src/H5HFbtree2.c | |
parent | 1bc79f977be67f734a44fd237be6f05b5fb25f53 (diff) | |
download | hdf5-71a9d507255366be01c25e458ac4c953d4481f45.zip hdf5-71a9d507255366be01c25e458ac4c953d4481f45.tar.gz hdf5-71a9d507255366be01c25e458ac4c953d4481f45.tar.bz2 |
[svn-r17943] Description:
Finish refactoring v2 B-trees so that they can have client callback
context provided to the encode/decode callbacks.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.2 (amazon) in debug mode
Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5HFbtree2.c')
-rw-r--r-- | src/H5HFbtree2.c | 532 |
1 files changed, 356 insertions, 176 deletions
diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index ae50bf3..3f208e7 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -49,6 +49,12 @@ /* Local Typedefs */ /******************/ +/* v2 B-tree client callback context */ +typedef struct H5HF_huge_bt2_ctx_t { + uint8_t sizeof_size; /* Size of file sizes */ + uint8_t sizeof_addr; /* Size of file addresses */ +} H5HF_huge_bt2_ctx_t; + /********************/ /* Package Typedefs */ @@ -59,92 +65,114 @@ /* Local Prototypes */ /********************/ + /* v2 B-tree driver callbacks */ -static herr_t H5HF_huge_btree2_indir_store(void *native, const void *udata); -static herr_t H5HF_huge_btree2_indir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_btree2_indir_encode(const H5F_t *f, uint8_t *raw, - const void *native); -static herr_t H5HF_huge_btree2_indir_decode(const H5F_t *f, const uint8_t *raw, - void *native); -static herr_t H5HF_huge_btree2_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, + +static void *H5HF_huge_bt2_crt_context(void *udata); +static herr_t H5HF_huge_bt2_dst_context(void *ctx); +static void *H5HF_huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); + +static herr_t H5HF_huge_bt2_indir_store(void *native, const void *udata); +static herr_t H5HF_huge_bt2_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *native, + void *ctx); +static herr_t H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *native, + void *ctx); +static herr_t H5HF_huge_bt2_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *_udata); -static herr_t H5HF_huge_btree2_filt_indir_store(void *native, const void *udata); -static herr_t H5HF_huge_btree2_filt_indir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_btree2_filt_indir_encode(const H5F_t *f, uint8_t *raw, - const void *native); -static herr_t H5HF_huge_btree2_filt_indir_decode(const H5F_t *f, const uint8_t *raw, - void *native); -static herr_t H5HF_huge_btree2_filt_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, +static herr_t H5HF_huge_bt2_filt_indir_store(void *native, const void *udata); +static herr_t H5HF_huge_bt2_filt_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *native, + void *ctx); +static herr_t H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *native, + void *ctx); +static herr_t H5HF_huge_bt2_filt_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *_udata); -static herr_t H5HF_huge_btree2_dir_store(void *native, const void *udata); -static herr_t H5HF_huge_btree2_dir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_btree2_dir_encode(const H5F_t *f, uint8_t *raw, - const void *native); -static herr_t H5HF_huge_btree2_dir_decode(const H5F_t *f, const uint8_t *raw, - void *native); -static herr_t H5HF_huge_btree2_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, +static herr_t H5HF_huge_bt2_dir_store(void *native, const void *udata); +static herr_t H5HF_huge_bt2_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *native, + void *ctx); +static herr_t H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *native, + void *ctx); +static herr_t H5HF_huge_bt2_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *_udata); -static herr_t H5HF_huge_btree2_filt_dir_store(void *native, const void *udata); -static herr_t H5HF_huge_btree2_filt_dir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_btree2_filt_dir_encode(const H5F_t *f, uint8_t *raw, - const void *native); -static herr_t H5HF_huge_btree2_filt_dir_decode(const H5F_t *f, const uint8_t *raw, - void *native); -static herr_t H5HF_huge_btree2_filt_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, +static herr_t H5HF_huge_bt2_filt_dir_store(void *native, const void *udata); +static herr_t H5HF_huge_bt2_filt_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *native, + void *ctx); +static herr_t H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *native, + void *ctx); +static herr_t H5HF_huge_bt2_filt_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *_udata); /*********************/ /* Package Variables */ /*********************/ /* v2 B-tree class for indirectly accessed 'huge' objects */ -const H5B2_class_t H5HF_BT2_INDIR[1]={{ /* B-tree class information */ - H5B2_FHEAP_HUGE_INDIR_ID, /* Type of B-tree */ - "H5B2_FHEAP_HUGE_INDIR_ID", /* Name of B-tree class */ - sizeof(H5HF_huge_bt2_indir_rec_t), /* Size of native record */ - H5HF_huge_btree2_indir_store, /* Record storage callback */ - H5HF_huge_btree2_indir_compare, /* Record comparison callback */ - H5HF_huge_btree2_indir_encode, /* Record encoding callback */ - H5HF_huge_btree2_indir_decode, /* Record decoding callback */ - H5HF_huge_btree2_indir_debug /* Record debugging callback */ +const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */ + H5B2_FHEAP_HUGE_INDIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_INDIR_ID", /* Name of B-tree class */ + sizeof(H5HF_huge_bt2_indir_rec_t), /* Size of native record */ + H5HF_huge_bt2_crt_context, /* Create client callback context */ + H5HF_huge_bt2_dst_context, /* Destroy client callback context */ + H5HF_huge_bt2_indir_store, /* Record storage callback */ + H5HF_huge_bt2_indir_compare, /* Record comparison callback */ + H5HF_huge_bt2_indir_encode, /* Record encoding callback */ + H5HF_huge_bt2_indir_decode, /* Record decoding callback */ + H5HF_huge_bt2_indir_debug, /* Record debugging callback */ + H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF_huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for indirectly accessed, filtered 'huge' objects */ -const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */ - H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* Type of B-tree */ - "H5B2_FHEAP_HUGE_FILT_INDIR_ID", /* Name of B-tree class */ - sizeof(H5HF_huge_bt2_filt_indir_rec_t), /* Size of native record */ - H5HF_huge_btree2_filt_indir_store, /* Record storage callback */ - H5HF_huge_btree2_filt_indir_compare, /* Record comparison callback */ - H5HF_huge_btree2_filt_indir_encode, /* Record encoding callback */ - H5HF_huge_btree2_filt_indir_decode, /* Record decoding callback */ - H5HF_huge_btree2_filt_indir_debug /* Record debugging callback */ +const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */ + H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_FILT_INDIR_ID", /* Name of B-tree class */ + sizeof(H5HF_huge_bt2_filt_indir_rec_t), /* Size of native record */ + H5HF_huge_bt2_crt_context, /* Create client callback context */ + H5HF_huge_bt2_dst_context, /* Destroy client callback context */ + H5HF_huge_bt2_filt_indir_store, /* Record storage callback */ + H5HF_huge_bt2_filt_indir_compare, /* Record comparison callback */ + H5HF_huge_bt2_filt_indir_encode, /* Record encoding callback */ + H5HF_huge_bt2_filt_indir_decode, /* Record decoding callback */ + H5HF_huge_bt2_filt_indir_debug, /* Record debugging callback */ + H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF_huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for directly accessed 'huge' objects */ -const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */ - H5B2_FHEAP_HUGE_DIR_ID, /* Type of B-tree */ - "H5B2_FHEAP_HUGE_DIR_ID", /* Name of B-tree class */ - sizeof(H5HF_huge_bt2_dir_rec_t), /* Size of native record */ - H5HF_huge_btree2_dir_store, /* Record storage callback */ - H5HF_huge_btree2_dir_compare, /* Record comparison callback */ - H5HF_huge_btree2_dir_encode, /* Record encoding callback */ - H5HF_huge_btree2_dir_decode, /* Record decoding callback */ - H5HF_huge_btree2_dir_debug /* Record debugging callback */ +const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */ + H5B2_FHEAP_HUGE_DIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_DIR_ID", /* Name of B-tree class */ + sizeof(H5HF_huge_bt2_dir_rec_t), /* Size of native record */ + H5HF_huge_bt2_crt_context, /* Create client callback context */ + H5HF_huge_bt2_dst_context, /* Destroy client callback context */ + H5HF_huge_bt2_dir_store, /* Record storage callback */ + H5HF_huge_bt2_dir_compare, /* Record comparison callback */ + H5HF_huge_bt2_dir_encode, /* Record encoding callback */ + H5HF_huge_bt2_dir_decode, /* Record decoding callback */ + H5HF_huge_bt2_dir_debug, /* Record debugging callback */ + H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF_huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for directly accessed, filtered 'huge' objects */ -const H5B2_class_t H5HF_BT2_FILT_DIR[1]={{ /* B-tree class information */ - H5B2_FHEAP_HUGE_FILT_DIR_ID, /* Type of B-tree */ - "H5B2_FHEAP_HUGE_FILT_DIR_ID", /* Name of B-tree class */ - sizeof(H5HF_huge_bt2_filt_dir_rec_t),/* Size of native record */ - H5HF_huge_btree2_filt_dir_store, /* Record storage callback */ - H5HF_huge_btree2_filt_dir_compare, /* Record comparison callback */ - H5HF_huge_btree2_filt_dir_encode, /* Record encoding callback */ - H5HF_huge_btree2_filt_dir_decode, /* Record decoding callback */ - H5HF_huge_btree2_filt_dir_debug /* Record debugging callback */ +const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */ + H5B2_FHEAP_HUGE_FILT_DIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_FILT_DIR_ID", /* Name of B-tree class */ + sizeof(H5HF_huge_bt2_filt_dir_rec_t), /* Size of native record */ + H5HF_huge_bt2_crt_context, /* Create client callback context */ + H5HF_huge_bt2_dst_context, /* Destroy client callback context */ + H5HF_huge_bt2_filt_dir_store, /* Record storage callback */ + H5HF_huge_bt2_filt_dir_compare, /* Record comparison callback */ + H5HF_huge_bt2_filt_dir_encode, /* Record encoding callback */ + H5HF_huge_bt2_filt_dir_decode, /* Record decoding callback */ + H5HF_huge_bt2_filt_dir_debug, /* Record debugging callback */ + H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF_huge_bt2_dst_context /* Destroy debugging context */ }}; /*****************************/ @@ -156,6 +184,126 @@ const H5B2_class_t H5HF_BT2_FILT_DIR[1]={{ /* B-tree class information */ /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5HF_huge_bt2_ctx_t struct */ +H5FL_DEFINE_STATIC(H5HF_huge_bt2_ctx_t); + + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_bt2_crt_context + * + * Purpose: Create client callback context + * + * Note: Common to all 'huge' v2 B-tree clients + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Thursday, November 26, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5HF_huge_bt2_crt_context(void *_f) +{ + H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ + H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_bt2_crt_context) + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_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); + ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_huge_bt2_crt_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_bt2_dst_context + * + * Purpose: Destroy client callback context + * + * Note: Common to all 'huge' v2 B-tree clients + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Thursday, November 26, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_bt2_dst_context(void *_ctx) +{ + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_dst_context) + + /* Sanity check */ + HDassert(ctx); + + /* Release callback context */ + ctx = H5FL_FREE(H5HF_huge_bt2_ctx_t, ctx); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_huge_bt2_dst_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_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 * +H5HF_huge_bt2_crt_dbg_context(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr) +{ + H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_bt2_crt_dbg_context) + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_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); + ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_huge_bt2_crt_dbg_context() */ + /*------------------------------------------------------------------------- * Function: H5HF_huge_bt2_indir_found @@ -223,7 +371,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_indir_store + * Function: H5HF_huge_bt2_indir_store * * Purpose: Store native information into record for v2 B-tree * @@ -236,18 +384,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_indir_store(void *nrecord, const void *udata) +H5HF_huge_bt2_indir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_indir_store) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_indir_store) *(H5HF_huge_bt2_indir_rec_t *)nrecord = *(const H5HF_huge_bt2_indir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_indir_store() */ +} /* H5HF_huge_bt2_indir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_indir_compare + * Function: H5HF_huge_bt2_indir_compare * * Purpose: Compare two native information records, according to some key * @@ -261,25 +409,25 @@ H5HF_huge_btree2_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_indir_compare(const void *_rec1, const void *_rec2) +H5HF_huge_bt2_indir_compare(const void *_rec1, const void *_rec2) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_indir_compare) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_indir_compare) #ifdef QAK { const H5HF_huge_bt2_indir_rec_t *rec1 = (const H5HF_huge_bt2_indir_rec_t *)_rec1; const H5HF_huge_bt2_indir_rec_t *rec2 = (const H5HF_huge_bt2_indir_rec_t *)_rec2; -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %Hu}\n", "H5HF_huge_btree2_indir_compare", rec1->addr, rec1->len, rec1->id); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_btree2_indir_compare", rec2->addr, rec2->len, rec2->id); +HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec1->addr, rec1->len, rec1->id); +HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec2->addr, rec2->len, rec2->id); } #endif /* QAK */ FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id)) -} /* H5HF_huge_btree2_indir_compare() */ +} /* H5HF_huge_bt2_indir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_indir_encode + * Function: H5HF_huge_bt2_indir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -292,23 +440,27 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_btree2_indir_compare *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_indir_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord) +H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_indir_encode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_indir_encode) + + /* Sanity check */ + HDassert(ctx); /* Encode the record's fields */ - H5F_addr_encode(f, &raw, nrecord->addr); - H5F_ENCODE_LENGTH(f, raw, nrecord->len); - H5F_ENCODE_LENGTH(f, raw, nrecord->id); + H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_indir_encode() */ +} /* H5HF_huge_bt2_indir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_indir_decode + * Function: H5HF_huge_bt2_indir_decode * * Purpose: Decode raw disk form of record into native form * @@ -321,23 +473,27 @@ H5HF_huge_btree2_indir_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_indir_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord) +H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_indir_rec_t *nrecord = (H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_indir_decode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_indir_decode) + + /* Sanity check */ + HDassert(ctx); /* Decode the record's fields */ - H5F_addr_decode(f, &raw, &nrecord->addr); - H5F_DECODE_LENGTH(f, raw, nrecord->len); - H5F_DECODE_LENGTH(f, raw, nrecord->id); + H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); + H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_indir_decode() */ +} /* H5HF_huge_bt2_indir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_indir_debug + * Function: H5HF_huge_bt2_indir_debug * * Purpose: Debug native form of record * @@ -350,19 +506,19 @@ H5HF_huge_btree2_indir_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_indir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, +H5HF_huge_bt2_indir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata) { const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_indir_debug) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_indir_debug) HDfprintf(stream, "%*s%-*s {%a, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_indir_debug() */ +} /* H5HF_huge_bt2_indir_debug() */ /*------------------------------------------------------------------------- @@ -433,7 +589,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_indir_store + * Function: H5HF_huge_bt2_filt_indir_store * * Purpose: Store native information into record for v2 B-tree * @@ -446,18 +602,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_indir_store(void *nrecord, const void *udata) +H5HF_huge_bt2_filt_indir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_indir_store) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_indir_store) *(H5HF_huge_bt2_filt_indir_rec_t *)nrecord = *(const H5HF_huge_bt2_filt_indir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_indir_store() */ +} /* H5HF_huge_bt2_filt_indir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_indir_compare + * Function: H5HF_huge_bt2_filt_indir_compare * * Purpose: Compare two native information records, according to some key * @@ -471,25 +627,25 @@ H5HF_huge_btree2_filt_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_indir_compare(const void *_rec1, const void *_rec2) +H5HF_huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_indir_compare) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_indir_compare) #ifdef QAK { const H5HF_huge_bt2_filt_indir_rec_t *rec1 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec1; const H5HF_huge_bt2_filt_indir_rec_t *rec2 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec2; -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_btree2_filt_indir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size, rec1->id); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_btree2_filt_indir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size, rec2->id); +HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size, rec1->id); +HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size, rec2->id); } #endif /* QAK */ FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id)) -} /* H5HF_huge_btree2_filt_indir_compare() */ +} /* H5HF_huge_bt2_filt_indir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_indir_encode + * Function: H5HF_huge_bt2_filt_indir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -502,25 +658,29 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_btree2_filt *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_indir_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord) +H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_indir_encode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_indir_encode) + + /* Sanity check */ + HDassert(ctx); /* Encode the record's fields */ - H5F_addr_encode(f, &raw, nrecord->addr); - H5F_ENCODE_LENGTH(f, raw, nrecord->len); + H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32ENCODE(raw, nrecord->filter_mask); - H5F_ENCODE_LENGTH(f, raw, nrecord->obj_size); - H5F_ENCODE_LENGTH(f, raw, nrecord->id); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_indir_encode() */ +} /* H5HF_huge_bt2_filt_indir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_indir_decode + * Function: H5HF_huge_bt2_filt_indir_decode * * Purpose: Decode raw disk form of record into native form * @@ -533,25 +693,29 @@ H5HF_huge_btree2_filt_indir_encode(const H5F_t *f, uint8_t *raw, const void *_nr *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_indir_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord) +H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_filt_indir_rec_t *nrecord = (H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_indir_decode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_indir_decode) + + /* Sanity check */ + HDassert(ctx); /* Decode the record's fields */ - H5F_addr_decode(f, &raw, &nrecord->addr); - H5F_DECODE_LENGTH(f, raw, nrecord->len); + H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); + H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32DECODE(raw, nrecord->filter_mask); - H5F_DECODE_LENGTH(f, raw, nrecord->obj_size); - H5F_DECODE_LENGTH(f, raw, nrecord->id); + H5F_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); + H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_indir_decode() */ +} /* H5HF_huge_bt2_filt_indir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_indir_debug + * Function: H5HF_huge_bt2_filt_indir_debug * * Purpose: Debug native form of record * @@ -564,19 +728,19 @@ H5HF_huge_btree2_filt_indir_decode(const H5F_t *f, const uint8_t *raw, void *_nr *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_indir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, +H5HF_huge_bt2_filt_indir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata) { const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_indir_debug) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_indir_debug) HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_indir_debug() */ +} /* H5HF_huge_bt2_filt_indir_debug() */ /*------------------------------------------------------------------------- @@ -614,7 +778,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_dir_store + * Function: H5HF_huge_bt2_dir_store * * Purpose: Store native information into record for v2 B-tree * @@ -627,18 +791,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_dir_store(void *nrecord, const void *udata) +H5HF_huge_bt2_dir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_dir_store) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_dir_store) *(H5HF_huge_bt2_dir_rec_t *)nrecord = *(const H5HF_huge_bt2_dir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_dir_store() */ +} /* H5HF_huge_bt2_dir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_dir_compare + * Function: H5HF_huge_bt2_dir_compare * * Purpose: Compare two native information records, according to some key * @@ -652,17 +816,17 @@ H5HF_huge_btree2_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_dir_compare(const void *_rec1, const void *_rec2) +H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1; const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2; herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_dir_compare) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_dir_compare) #ifdef QAK -HDfprintf(stderr, "%s: rec1 = {%a, %Hu}\n", "H5HF_huge_btree2_dir_compare", rec1->addr, rec1->len); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_btree2_dir_compare", rec2->addr, rec2->len); +HDfprintf(stderr, "%s: rec1 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec1->addr, rec1->len); +HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->addr, rec2->len); #endif /* QAK */ if(rec1->addr < rec2->addr) ret_value = -1; @@ -676,11 +840,11 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_btree2_dir_compare", rec2 ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_btree2_dir_compare() */ +} /* H5HF_huge_bt2_dir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_dir_encode + * Function: H5HF_huge_bt2_dir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -693,22 +857,26 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_btree2_dir_compare", rec2 *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_dir_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord) +H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_dir_encode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_dir_encode) + + /* Sanity check */ + HDassert(ctx); /* Encode the record's fields */ - H5F_addr_encode(f, &raw, nrecord->addr); - H5F_ENCODE_LENGTH(f, raw, nrecord->len); + H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_dir_encode() */ +} /* H5HF_huge_bt2_dir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_dir_decode + * Function: H5HF_huge_bt2_dir_decode * * Purpose: Decode raw disk form of record into native form * @@ -721,22 +889,26 @@ H5HF_huge_btree2_dir_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_dir_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord) +H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_dir_rec_t *nrecord = (H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_dir_decode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_dir_decode) + + /* Sanity check */ + HDassert(ctx); /* Decode the record's fields */ - H5F_addr_decode(f, &raw, &nrecord->addr); - H5F_DECODE_LENGTH(f, raw, nrecord->len); + H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); + H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_dir_decode() */ +} /* H5HF_huge_bt2_dir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_dir_debug + * Function: H5HF_huge_bt2_dir_debug * * Purpose: Debug native form of record * @@ -749,19 +921,19 @@ H5HF_huge_btree2_dir_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_dir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, +H5HF_huge_bt2_dir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata) { const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_dir_debug) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_dir_debug) HDfprintf(stream, "%*s%-*s {%a, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_dir_debug() */ +} /* H5HF_huge_bt2_dir_debug() */ /*------------------------------------------------------------------------- @@ -831,7 +1003,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_dir_store + * Function: H5HF_huge_bt2_filt_dir_store * * Purpose: Store native information into record for v2 B-tree * @@ -844,18 +1016,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_dir_store(void *nrecord, const void *udata) +H5HF_huge_bt2_filt_dir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_dir_store) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_dir_store) *(H5HF_huge_bt2_filt_dir_rec_t *)nrecord = *(const H5HF_huge_bt2_filt_dir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_dir_store() */ +} /* H5HF_huge_bt2_filt_dir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_dir_compare + * Function: H5HF_huge_bt2_filt_dir_compare * * Purpose: Compare two native information records, according to some key * @@ -869,17 +1041,17 @@ H5HF_huge_btree2_filt_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_dir_compare(const void *_rec1, const void *_rec2) +H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1; const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2; herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_dir_compare) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_dir_compare) #ifdef QAK -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_btree2_filt_dir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_btree2_filt_dir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size); +HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size); +HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size); #endif /* QAK */ if(rec1->addr < rec2->addr) ret_value = -1; @@ -893,11 +1065,11 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_btree2_filt_dir_ ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_btree2_filt_dir_compare() */ +} /* H5HF_huge_bt2_filt_dir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_dir_encode + * Function: H5HF_huge_bt2_filt_dir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -910,24 +1082,28 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_btree2_filt_dir_ *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_dir_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord) +H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_dir_encode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_dir_encode) + + /* Sanity check */ + HDassert(ctx); /* Encode the record's fields */ - H5F_addr_encode(f, &raw, nrecord->addr); - H5F_ENCODE_LENGTH(f, raw, nrecord->len); + H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32ENCODE(raw, nrecord->filter_mask); - H5F_ENCODE_LENGTH(f, raw, nrecord->obj_size); + H5F_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_dir_encode() */ +} /* H5HF_huge_bt2_filt_dir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_dir_decode + * Function: H5HF_huge_bt2_filt_dir_decode * * Purpose: Decode raw disk form of record into native form * @@ -940,24 +1116,28 @@ H5HF_huge_btree2_filt_dir_encode(const H5F_t *f, uint8_t *raw, const void *_nrec *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_dir_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord) +H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { + H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_filt_dir_rec_t *nrecord = (H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_dir_decode) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_dir_decode) + + /* Sanity check */ + HDassert(ctx); /* Decode the record's fields */ - H5F_addr_decode(f, &raw, &nrecord->addr); - H5F_DECODE_LENGTH(f, raw, nrecord->len); + H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); + H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32DECODE(raw, nrecord->filter_mask); - H5F_DECODE_LENGTH(f, raw, nrecord->obj_size); + H5F_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_dir_decode() */ +} /* H5HF_huge_bt2_filt_dir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_btree2_filt_dir_debug + * Function: H5HF_huge_bt2_filt_dir_debug * * Purpose: Debug native form of record * @@ -970,16 +1150,16 @@ H5HF_huge_btree2_filt_dir_decode(const H5F_t *f, const uint8_t *raw, void *_nrec *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_btree2_filt_dir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, +H5HF_huge_bt2_filt_dir_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata) { const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_dir_debug) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_filt_dir_debug) HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_btree2_filt_dir_debug() */ +} /* H5HF_huge_bt2_filt_dir_debug() */ |