From 24d8506dd564c5cc0fdebb5ebdfaec7bda5a7435 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 10 Feb 2003 12:26:09 -0500 Subject: [svn-r6387] Purpose: Bug Fix Description: Metadata cache in parallel I/O can cause hangs in applications which perform independent I/O on chunked datasets, because the metadata cache can attempt to flush out dirty metadata from only a single process, instead of collectively from all processes. Solution: Pass a dataset transfer property list down from every API function which could possibly trigger metadata I/O. Then, split the metadata cache into two sets of entries to allow dirty metadata to be set aside when a hash table collision occurs during independent I/O. Platforms tested: Tested h5committest {arabica (fortran), eirene (fortran, C++) modi4 (parallel, fortran)} FreeBSD 4.7 (sleipnir) serial & parallel Misc. update: Updated release_docs/RELEASE --- release_docs/RELEASE.txt | 3 + src/H5.c | 2 + src/H5A.c | 83 ++--- src/H5AC.c | 853 ++++++++++++++++++++++++++++++++++++++++------- src/H5ACprivate.h | 62 ++-- src/H5Aprivate.h | 2 - src/H5B.c | 251 ++++++++------ src/H5Bprivate.h | 33 +- src/H5D.c | 258 +++++++------- src/H5Distore.c | 151 +++++---- src/H5Dprivate.h | 12 +- src/H5Dseq.c | 80 ++--- src/H5F.c | 109 +++--- src/H5FD.c | 132 +++++--- src/H5FDcore.c | 113 +++---- src/H5FDfamily.c | 6 +- src/H5FDlog.c | 11 +- src/H5FDmpio.c | 63 ++-- src/H5FDmpio.h | 9 - src/H5FDmpiposix.c | 4 +- src/H5FDmulti.c | 22 +- src/H5FDprivate.h | 10 +- src/H5FDpublic.h | 14 +- src/H5FDsec2.c | 4 +- src/H5FDsrb.c | 4 +- src/H5FDstdio.c | 6 +- src/H5Farray.c | 84 ++--- src/H5Fistore.c | 151 +++++---- src/H5Fpkg.h | 26 +- src/H5Fprivate.h | 10 +- src/H5Fseq.c | 80 ++--- src/H5G.c | 235 +++++++------ src/H5Gent.c | 4 +- src/H5Gnode.c | 372 +++++++++++---------- src/H5Gpkg.h | 17 +- src/H5Gprivate.h | 55 +-- src/H5Gstab.c | 30 +- src/H5HG.c | 214 ++++++------ src/H5HGprivate.h | 14 +- src/H5HL.c | 139 ++++---- src/H5HLprivate.h | 14 +- src/H5MF.c | 12 +- src/H5MFprivate.h | 6 +- src/H5O.c | 260 +++++++++------ src/H5Oattr.c | 18 +- src/H5Obogus.c | 8 +- src/H5Ocont.c | 8 +- src/H5Odtype.c | 14 +- src/H5Oefl.c | 12 +- src/H5Ofill.c | 22 +- src/H5Ofphdf5.c | 8 +- src/H5Olayout.c | 8 +- src/H5Omtime.c | 12 +- src/H5Oname.c | 8 +- src/H5Opline.c | 8 +- src/H5Oplist.c | 8 +- src/H5Oprivate.h | 37 +- src/H5Osdspace.c | 8 +- src/H5Oshared.c | 10 +- src/H5Ostab.c | 8 +- src/H5Pdcpl.c | 4 +- src/H5Pfapl.c | 6 +- src/H5R.c | 50 +-- src/H5S.c | 16 +- src/H5Sprivate.h | 8 +- src/H5T.c | 290 ++++++++-------- src/H5Tconv.c | 246 +++++++------- src/H5Tpkg.h | 16 +- src/H5Tprivate.h | 12 +- src/H5Tvlen.c | 22 +- test/gheap.c | 16 +- test/istore.c | 12 +- test/lheap.c | 6 +- test/ohdr.c | 38 +-- testpar/t_dset.c | 21 +- tools/misc/h5debug.c | 17 +- 76 files changed, 2864 insertions(+), 2133 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 38a5a75..202ca58 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -35,6 +35,9 @@ Bug Fixes since HDF5-1.4.0 Library ------- + * Corrected metadata caching bug in parallel I/O which could cause hangs + when chunked datasets were accessed with independent transfer mode. + QAK - 2003/02/10 * Corrected memory/resource leaks in per-thread key information when thread-safe operation was enabled. QAK - 2003/02/07 * H5Fopen without the H5F_ACC_CREAT flag should not succeed in creating diff --git a/src/H5.c b/src/H5.c index 18b3df3..2c5f532 100644 --- a/src/H5.c +++ b/src/H5.c @@ -146,6 +146,8 @@ H5_init_library(void) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize datatype interface"); if (H5D_init()<0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataset interface"); + if (H5AC_init()<0) + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize metadata caching interface"); /* Debugging? */ H5_debug_mask("-all"); diff --git a/src/H5A.c b/src/H5A.c index 5818a68..31530cb 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -38,11 +38,13 @@ static herr_t H5A_init_interface(void); /* PRIVATE PROTOTYPES */ static hid_t H5A_create(const H5G_entry_t *ent, const char *name, - const H5T_t *type, const H5S_t *space); -static hid_t H5A_open(H5G_entry_t *ent, unsigned idx); -static herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf); -static herr_t H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf); -static int H5A_get_index(H5G_entry_t *ent, const char *name); + const H5T_t *type, const H5S_t *space, hid_t dxpl_id); +static hid_t H5A_open(H5G_entry_t *ent, unsigned idx, hid_t dxpl_id); +static herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id); +static herr_t H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id); +static int H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id); +static hsize_t H5A_get_storage_size(H5A_t *attr); +static herr_t H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t dxpl_id); /*-------------------------------------------------------------------------- @@ -175,7 +177,7 @@ H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); /* Go do the real work for attaching the attribute to the dataset */ - if ((ret_value=H5A_create(ent,name,type,space))<0) + if ((ret_value=H5A_create(ent,name,type,space, H5AC_dxpl_id))<0) HGOTO_ERROR (H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute"); done: @@ -209,7 +211,7 @@ done: */ static hid_t H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, - const H5S_t *space) + const H5S_t *space, hid_t dxpl_id) { H5A_t *attr = NULL; H5A_t found_attr; @@ -260,7 +262,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, /* Read in the existing attributes to check for duplicates */ seq=0; - while(H5O_read(&(attr->ent), H5O_ATTR, seq, &found_attr)!=NULL) { + while(H5O_read(&(attr->ent), H5O_ATTR, seq, &found_attr, dxpl_id)!=NULL) { /* * Compare found attribute name to new attribute name reject creation * if names are the same. @@ -275,7 +277,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, H5E_clear (); /* Create the attribute message and save the attribute index */ - if (H5O_modify(&(attr->ent), H5O_ATTR, H5O_NEW_MESG, 0, 1, attr) < 0) + if (H5O_modify(&(attr->ent), H5O_ATTR, H5O_NEW_MESG, 0, 1, attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages"); /* Register the new attribute and get an ID for it */ @@ -316,7 +318,7 @@ done: object header. --------------------------------------------------------------------------*/ static int -H5A_get_index(H5G_entry_t *ent, const char *name) +H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id) { H5A_t found_attr; int i; /* Index variable */ @@ -329,7 +331,7 @@ H5A_get_index(H5G_entry_t *ent, const char *name) /* Look up the attribute for the object */ i=0; - while(H5O_read(ent, H5O_ATTR, i, &found_attr)!=NULL) { + while(H5O_read(ent, H5O_ATTR, i, &found_attr, dxpl_id)!=NULL) { /* * Compare found attribute name to new attribute name reject creation * if names are the same. @@ -397,11 +399,11 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Look up the attribute for the object */ - if((idx=H5A_get_index(ent,name))<0) + if((idx=H5A_get_index(ent,name, H5AC_dxpl_id))<0) HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "attribute not found"); /* Go do the real work for opening the attribute */ - if ((ret_value=H5A_open(ent, (unsigned)idx))<0) + if ((ret_value=H5A_open(ent, (unsigned)idx, H5AC_dxpl_id))<0) HGOTO_ERROR (H5E_ATTR, H5E_CANTINIT, FAIL, "unable to open attribute"); done: @@ -452,7 +454,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); /* Go do the real work for opening the attribute */ - if ((ret_value=H5A_open(ent, idx))<0) + if ((ret_value=H5A_open(ent, idx, H5AC_dxpl_id))<0) HGOTO_ERROR (H5E_ATTR, H5E_CANTINIT, FAIL, "unable to open attribute"); done: @@ -483,7 +485,7 @@ done: *------------------------------------------------------------------------- */ static hid_t -H5A_open(H5G_entry_t *ent, unsigned idx) +H5A_open(H5G_entry_t *ent, unsigned idx, hid_t dxpl_id) { H5A_t *attr = NULL; hid_t ret_value = FAIL; @@ -495,7 +497,7 @@ H5A_open(H5G_entry_t *ent, unsigned idx) /* Read in attribute with H5O_read() */ H5_CHECK_OVERFLOW(idx,unsigned,int); - if (NULL==(attr=H5O_read(ent, H5O_ATTR, (int)idx, attr))) + if (NULL==(attr=H5O_read(ent, H5O_ATTR, (int)idx, attr, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from dataset header"); attr->initialized=1; @@ -561,7 +563,7 @@ H5Awrite(hid_t attr_id, hid_t type_id, const void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer"); /* Go write the actual data to the attribute */ - if ((ret_value=H5A_write(attr,mem_type,buf))<0) + if ((ret_value=H5A_write(attr,mem_type,buf, H5AC_dxpl_id))<0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute"); done: @@ -588,7 +590,7 @@ done: This function writes a complete attribute to disk. --------------------------------------------------------------------------*/ static herr_t -H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf) +H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) { uint8_t *tconv_buf = NULL; /* data type conv buffer */ uint8_t *bkg_buf = NULL; /* temp conversion buffer */ @@ -625,7 +627,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf) /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ - if (NULL == (tpath = H5T_path_find(mem_type, attr->dt, NULL, NULL))) { + if (NULL == (tpath = H5T_path_find(mem_type, attr->dt, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } else if (!H5T_IS_NOOP(tpath)) { if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL)))<0 || @@ -635,7 +637,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf) /* Perform data type conversion */ if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, - H5P_DATASET_XFER_DEFAULT)<0) { + dxpl_id)<0) { HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed"); } @@ -645,12 +647,12 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf) H5MM_xfree(attr->data); /* Look up the attribute for the object */ - if((idx=H5A_get_index(&(attr->ent),attr->name))<0) + if((idx=H5A_get_index(&(attr->ent),attr->name,dxpl_id))<0) HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "attribute not found"); /* Modify the attribute data */ attr->data=tconv_buf; /* Set the data pointer temporarily */ - if (H5O_modify(&(attr->ent), H5O_ATTR, idx, 0, 1, attr) < 0) + if (H5O_modify(&(attr->ent), H5O_ATTR, idx, 0, 1, attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages"); @@ -709,7 +711,7 @@ H5Aread(hid_t attr_id, hid_t type_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer"); /* Go write the actual data to the attribute */ - if ((ret_value=H5A_read(attr,mem_type,buf))<0) + if ((ret_value=H5A_read(attr,mem_type,buf,H5AC_dxpl_id))<0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute"); done: @@ -736,7 +738,7 @@ done: This function reads a complete attribute from disk. --------------------------------------------------------------------------*/ static herr_t -H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf) +H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) { uint8_t *tconv_buf = NULL; /* data type conv buffer*/ uint8_t *bkg_buf = NULL; /* background buffer */ @@ -778,7 +780,7 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf) /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ - if (NULL == (tpath = H5T_path_find(attr->dt, mem_type, NULL, NULL))) { + if (NULL == (tpath = H5T_path_find(attr->dt, mem_type, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } else if (!H5T_IS_NOOP(tpath)) { if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->dt, H5T_COPY_ALL)))<0 || @@ -787,7 +789,7 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf) } /* Perform data type conversion. */ - if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, H5P_DATASET_XFER_DEFAULT)<0) + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed"); /* Copy the converted data into the user's buffer */ @@ -1045,17 +1047,16 @@ done: * *------------------------------------------------------------------------- */ -hsize_t +static hsize_t H5A_get_storage_size(H5A_t *attr) { hsize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5A_get_storage_size, 0); + FUNC_ENTER_NOINIT(H5A_get_storage_size); /* Set return value */ ret_value = attr->data_size; -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -1112,7 +1113,7 @@ H5Aget_num_attrs(hid_t loc_id) } /* Look up the attribute for the object */ - ret_value=H5O_count(ent, H5O_ATTR); + ret_value=H5O_count(ent, H5O_ATTR, H5AC_dxpl_id); done: FUNC_LEAVE_API(ret_value); @@ -1153,7 +1154,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); /* Call private function */ - ret_value = H5A_rename(ent, old_name, new_name); + ret_value = H5A_rename(ent, old_name, new_name, H5AC_dxpl_id); done: FUNC_LEAVE_API(ret_value); @@ -1176,14 +1177,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name) +static herr_t +H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t dxpl_id) { int seq, idx=FAIL; /* Index of attribute being querried */ H5A_t *found_attr; /* Attribute with OLD_NAME */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5A_rename, FAIL); + FUNC_ENTER_NOINIT(H5A_rename); /* Check arguments */ assert(ent); @@ -1196,7 +1197,7 @@ H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name) /* Read in the existing attributes to check for duplicates */ seq=0; - while(H5O_read(ent, H5O_ATTR, seq, found_attr)!=NULL) { + while(H5O_read(ent, H5O_ATTR, seq, found_attr, dxpl_id)!=NULL) { /* * Compare found attribute name. */ @@ -1223,7 +1224,7 @@ H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name) found_attr->initialized=TRUE; /* Modify the attribute message */ - if (H5O_modify(ent, H5O_ATTR, idx, 0, 1, found_attr) < 0) + if (H5O_modify(ent, H5O_ATTR, idx, 0, 1, found_attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages"); /* Close the attribute */ @@ -1302,8 +1303,8 @@ H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, void *op_data) * reasonable. */ idx = attr_num ? (int)*attr_num : 0; - if(idxdt,tmp_buf)<0) + if (H5A_write(attr,attr->dt,tmp_buf,H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute"); /* Free temporary buffer */ diff --git a/src/H5AC.c b/src/H5AC.c index 6da9b0b..67b88c6 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -28,6 +28,7 @@ #include "H5private.h" #include "H5ACprivate.h" +#include "H5Dprivate.h" /* Dataset functions */ #include "H5Eprivate.h" #include "H5Fpkg.h" #include "H5FLprivate.h" /*Free Lists */ @@ -36,10 +37,11 @@ #include "H5Pprivate.h" /* Property lists */ /* - * Sorting the cache by address before flushing is sometimes faster - * than flushing in cache order. + * The MPIO & MPIPOSIX drivers are needed because there are places where we + * check for the parallel I/O transfer mode. */ -#define H5AC_SORT_BY_ADDR +#include "H5FDmpio.h" +#include "H5FDmpiposix.h" /* * Private file-scope variables. @@ -51,12 +53,22 @@ static int interface_initialize_g = 0; #define INTERFACE_INIT H5AC_init_interface static herr_t H5AC_init_interface(void); -/* Dataset transfer property list for flush calls */ -static hid_t H5AC_dxpl_id=(-1); +/* Default dataset transfer property list for metadata I/O calls */ +/* (Collective set, "block before metadata write" set and "library internal" set) */ +/* (Global variable definition, declaration is in H5ACprivate.h also) */ +hid_t H5AC_dxpl_id=(-1); + +/* Private dataset transfer property list for metadata I/O calls */ +/* (Collective set and "library internal" set) */ +/* (Static variable definition) */ +static hid_t H5AC_noblock_dxpl_id=(-1); + +/* Dataset transfer property list for independent metadata I/O calls */ +/* (just "library internal" set - i.e. independent transfer mode) */ +/* (Global variable definition, declaration is in H5ACprivate.h also) */ +hid_t H5AC_ind_dxpl_id=(-1); -#ifdef H5AC_SORT_BY_ADDR static H5AC_t *current_cache_g = NULL; /*for sorting */ -#endif /* Declare a free list to manage the H5AC_t struct */ H5FL_DEFINE_STATIC(H5AC_t); @@ -74,6 +86,35 @@ H5FL_ARR_DEFINE_STATIC(H5AC_prot_t,-1); /*------------------------------------------------------------------------- + * Function: H5AC_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, January 18, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_init(void) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5AC_init, FAIL); + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5AC_init_interface * * Purpose: Initialize interface-specific information @@ -93,7 +134,9 @@ H5AC_init_interface(void) H5P_genclass_t *xfer_pclass; /* Dataset transfer property list class object */ #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ - unsigned block_before_meta_write=1; /* Custom value for "block before meta write" property */ + unsigned block_before_meta_write; /* "block before meta write" property value */ + unsigned library_internal=1; /* "library internal" property value */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value=SUCCEED; /* Return value */ @@ -106,7 +149,7 @@ H5AC_init_interface(void) if (NULL == (xfer_pclass = H5I_object(H5P_CLS_DATASET_XFER_g))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get property list class"); - /* Create a new dataset transfer property list */ + /* Get an ID for the blocking, collective H5AC dxpl */ if ((H5AC_dxpl_id=H5P_create_id(xfer_pclass)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list"); @@ -116,8 +159,66 @@ H5AC_init_interface(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object"); /* Insert 'block before metadata write' property */ + block_before_meta_write=1; if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property"); + + /* Insert 'library internal' property */ + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property"); + + /* Set the transfer mode */ + xfer_mode=H5FD_MPIO_COLLECTIVE; + if (H5P_set(xfer_plist,H5D_XFER_IO_XFER_MODE_NAME,&xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); +#endif /* H5_HAVE_PARALLEL */ + + /* Get an ID for the non-blocking, collective H5AC dxpl */ + if ((H5AC_noblock_dxpl_id=H5P_create_id(xfer_pclass)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list"); + +#ifdef H5_HAVE_PARALLEL + /* Get the property list object */ + if (NULL == (xfer_plist = H5I_object(H5AC_noblock_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object"); + + /* Insert 'block before metadata write' property */ + block_before_meta_write=0; + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property"); + + /* Insert 'library internal' property */ + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property"); + + /* Set the transfer mode */ + xfer_mode=H5FD_MPIO_COLLECTIVE; + if (H5P_set(xfer_plist,H5D_XFER_IO_XFER_MODE_NAME,&xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); +#endif /* H5_HAVE_PARALLEL */ + + /* Get an ID for the non-blocking, independent H5AC dxpl */ + if ((H5AC_ind_dxpl_id=H5P_create_id(xfer_pclass)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list"); + +#ifdef H5_HAVE_PARALLEL + /* Get the property list object */ + if (NULL == (xfer_plist = H5I_object(H5AC_ind_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object"); + + /* Insert 'block before metadata write' property */ + block_before_meta_write=0; + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property"); + + /* Insert 'library internal' property */ + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property"); + + /* Set the transfer mode */ + xfer_mode=H5FD_MPIO_INDEPENDENT; + if (H5P_set(xfer_plist,H5D_XFER_IO_XFER_MODE_NAME,&xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); #endif /* H5_HAVE_PARALLEL */ done: @@ -150,16 +251,20 @@ H5AC_term_interface(void) FUNC_ENTER_NOINIT(H5AC_term_interface); if (interface_initialize_g) { - if(H5AC_dxpl_id>0) { + if(H5AC_dxpl_id>0 || H5AC_noblock_dxpl_id>0 || H5AC_ind_dxpl_id>0) { /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ - if (H5Pclose(H5AC_dxpl_id) < 0) + if (H5Pclose(H5AC_dxpl_id) < 0 || + H5Pclose(H5AC_noblock_dxpl_id) < 0 || + H5Pclose(H5AC_ind_dxpl_id) < 0) H5E_clear(); /*ignore the error*/ else { - /* Reset static ID */ + /* Reset static IDs */ H5AC_dxpl_id=(-1); + H5AC_noblock_dxpl_id=(-1); + H5AC_ind_dxpl_id=(-1); /* Reset interface initialization flag */ interface_initialize_g = 0; @@ -209,8 +314,9 @@ H5AC_create(H5F_t *f, int size_hint) if (NULL==(f->shared->cache = cache = H5FL_CALLOC(H5AC_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); cache->nslots = size_hint; - cache->slot = H5FL_ARR_CALLOC(H5AC_info_ptr_t,cache->nslots); - if (NULL==cache->slot) + if (NULL==( cache->slot = H5FL_ARR_CALLOC(H5AC_info_ptr_t,cache->nslots))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if (NULL==( cache->dslot = H5FL_ARR_CALLOC(H5AC_info_ptr_t,cache->nslots))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); #ifdef H5AC_DEBUG if ((cache->prot = H5FL_ARR_CALLOC(H5AC_prot_t,cache->nslots))==NULL) @@ -223,6 +329,8 @@ H5AC_create(H5F_t *f, int size_hint) done: if(ret_value<0) { if(cache!=NULL) { + if(cache->dslot !=NULL) + cache->dslot = H5FL_ARR_FREE (H5AC_info_ptr_t,cache->dslot); if(cache->slot !=NULL) cache->slot = H5FL_ARR_FREE (H5AC_info_ptr_t,cache->slot); #ifdef H5AC_DEBUG @@ -255,7 +363,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_dest(H5F_t *f) +H5AC_dest(H5F_t *f, hid_t dxpl_id) { H5AC_t *cache = NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -266,7 +374,7 @@ H5AC_dest(H5F_t *f) assert(f->shared->cache); cache = f->shared->cache; - if (H5AC_flush(f, NULL, HADDR_UNDEF, TRUE) < 0) + if (H5AC_flush(f, dxpl_id, NULL, HADDR_UNDEF, TRUE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); #ifdef H5AC_DEBUG @@ -281,6 +389,7 @@ H5AC_dest(H5F_t *f) } #endif + cache->dslot = H5FL_ARR_FREE(H5AC_info_ptr_t,cache->dslot); cache->slot = H5FL_ARR_FREE(H5AC_info_ptr_t,cache->slot); cache->nslots = 0; f->shared->cache = cache = H5FL_FREE(H5AC_t,cache); @@ -291,7 +400,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_find_f + * Function: H5AC_find * * Purpose: Given an object type and the address at which that object * is located in the file, return a pointer to the object. @@ -336,18 +445,20 @@ done: *------------------------------------------------------------------------- */ void * -H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr, +H5AC_find(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2) { unsigned idx; - herr_t status; void *thing; H5AC_flush_func_t flush; H5AC_info_t **info; +#ifdef H5_HAVE_PARALLEL + H5AC_info_t **dinfo = NULL; +#endif /* H5_HAVE_PARALLEL */ H5AC_t *cache; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5AC_find_f, NULL); + FUNC_ENTER_NOAPI(H5AC_find, NULL); assert(f); assert(f->shared->cache); @@ -356,17 +467,55 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr, assert(type->flush); assert(H5F_addr_defined(addr)); - /* Get local copies of information */ + /* Get local pointers to the file's cache information */ idx = H5AC_HASH(f, addr); cache = f->shared->cache; info = cache->slot + idx; +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_dest_func_t dest; + + /* Get local pointer to file's dirty cache information */ + dinfo = cache->dslot + idx; + + /* Check if the cache has 'held' information for this cache slot */ + if (*dinfo) { + /* Sanity check that the 'clean' item is really clean */ + assert(*info); + assert((*info)->dirty==0); + + /* Destroy 'current' information */ + dest = (*info)->type->dest; + if ((dest)(f, (*info))<0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, NULL, "unable to free cached object"); + + /* Restore 'held' information back to 'current' information */ + (*info)=(*dinfo); + + /* Clear 'held' information */ + (*dinfo)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[type->id].nrestores++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + /* * Return right away if the item is in the cache. */ - if ((*info) && H5F_addr_eq(addr,(*info)->addr)) { + if ((*info) && H5F_addr_eq(addr,(*info)->addr) +#ifdef H5AC_DEBUG + && (*info)->type==type +#endif /* H5AC_DEBUG */ + ) { +#ifndef H5AC_DEBUG /* Sanity check that the object in the cache is the correct type */ assert((*info)->type==type); +#endif /* H5AC_DEBUG */ #ifdef H5AC_DEBUG cache->diagnostics[type->id].nhits++; @@ -398,11 +547,46 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr, * Load a new thing. If it can't be loaded, then return an error * without preempting anything. */ - if (NULL == (thing = (type->load)(f, H5P_DATASET_XFER_DEFAULT, addr, udata1, udata2))) + if (NULL == (thing = (type->load)(f, dxpl_id, addr, udata1, udata2))) HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load object"); +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ + + /* Get the dataset transfer property list */ + if (NULL == (dxpl = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataset creation property list"); + + /* Get the transfer mode property */ + if(H5P_get(dxpl, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve xfer mode"); + + /* Make certain there is no 'held' info for this slot */ + assert((*dinfo)==NULL); + + /* Must be using collective I/O to flush metadata in parallel */ + if(xfer_mode==H5FD_MPIO_INDEPENDENT) { + /* Check if there is dirty metadata in this slot */ + if((*info) && (*info)->dirty) { + /* 'Hold' the current metadata for later */ + (*dinfo)=(*info); + + /* Reset the 'current' metadata, so it doesn't get flushed */ + (*info)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[(*dinfo)->type->id].nholds++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end else */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + /* - * Free the previous cache entry if there is one. + * Flush & destroy the previous cache entry if there is one. */ if (*info) { #ifdef H5AC_DEBUG @@ -410,20 +594,19 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr, #endif /* H5AC_DEBUG */ flush = (*info)->type->flush; - status = (flush)(f, H5AC_dxpl_id, TRUE, (*info)->addr, (*info)); - if (status < 0) { + if ( (flush)(f, dxpl_id, TRUE, (*info)->addr, (*info)) < 0) { /* * The old thing could not be removed from the stack. * Release the new thing and fail. */ - if ((type->flush)(f, H5AC_dxpl_id, TRUE, addr, thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "unable to flush just-loaded object"); + if ((type->dest)(f, thing) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "unable to destroy just-loaded object"); HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "unable to flush existing cached object"); } #ifdef H5AC_DEBUG cache->diagnostics[type_id].nflushes++; #endif /* H5AC_DEBUG */ - } + } /* end if */ /* * Make the cache point to the new thing. @@ -431,6 +614,7 @@ H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr, (*info)=thing; (*info)->type = type; (*info)->addr = addr; + assert((*info)->dirty==0); /* Should be clean after being loaded */ /* Set the return value */ ret_value=thing; @@ -458,7 +642,6 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5AC_SORT_BY_ADDR static int H5AC_compare(const void *_a, const void *_b) { @@ -490,7 +673,6 @@ H5AC_compare(const void *_a, const void *_b) FUNC_LEAVE_NOAPI(ret_value); } -#endif /*------------------------------------------------------------------------- @@ -520,15 +702,13 @@ H5AC_compare(const void *_a, const void *_b) *------------------------------------------------------------------------- */ herr_t -H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy) +H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, hbool_t destroy) { unsigned i; herr_t status; H5AC_flush_func_t flush=NULL; H5AC_info_t **info; -#ifdef H5AC_SORT_BY_ADDR int *map = NULL; -#endif /* H5AC_SORT_BY_ADDR */ unsigned nslots; H5AC_t *cache; herr_t ret_value=SUCCEED; /* Return value */ @@ -544,42 +724,92 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy) if (!H5F_addr_defined(addr)) { unsigned first_flush=1; /* Indicate if this is the first flush */ -#ifdef H5AC_SORT_BY_ADDR /* * Sort the cache entries by address since flushing them in - * ascending order by address may be much more efficient. + * ascending order by address is much more efficient. */ if (NULL==(map=H5FL_ARR_MALLOC(int,cache->nslots))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - for (i = nslots = 0; i < cache->nslots; i++) { - if (cache->slot[i]!=NULL) - map[nslots++] = i; - } +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_info_t **dinfo; + H5AC_subid_t type_id; +#ifndef NDEBUG + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ + + /* Get the dataset transfer property list */ + if (NULL == (dxpl = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); + + /* Get the transfer mode property */ + if(H5P_get(dxpl, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve xfer mode"); + + /* Sanity check transfer mode */ + assert(xfer_mode==H5FD_MPIO_COLLECTIVE); +#endif /* NDEBUG */ + + /* Create the mapping */ + for (i = nslots = 0; i < cache->nslots; i++) { + info = cache->slot + i; + dinfo = cache->dslot + i; + + /* Move dirty metadata from 'held' slots into 'regular' slots */ + if((*dinfo)!=NULL) { + H5AC_dest_func_t dest; + + /* Various sanity checks */ + assert((*dinfo)->dirty); + assert((*info)!=NULL); + assert((*info)->dirty==0); + + type_id=(*info)->type->id; /* Remember this for later */ + + /* Destroy 'current' information */ + dest = (*info)->type->dest; + if ((dest)(f, (*info))<0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, NULL, "unable to free cached object"); + + /* Restore 'held' information back to 'current' information */ + (*info)=(*dinfo); + + /* Clear 'held' information */ + (*dinfo)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[type_id].nrestores++; +#endif /* H5AC_DEBUG */ + } /* end if */ + if ((*info)) + map[nslots++] = i; + } /* end for */ + } /* end if */ + else { +#endif /* H5_HAVE_PARALLEL */ + for (i = nslots = 0; i < cache->nslots; i++) { + if (cache->slot[i]!=NULL) + map[nslots++] = i; + } +#ifdef H5_HAVE_PARALLEL + } /* end else */ +#endif /* H5_HAVE_PARALLEL */ assert(NULL == current_cache_g); current_cache_g = cache; HDqsort(map, nslots, sizeof(int), H5AC_compare); current_cache_g = NULL; -#ifdef NDEBUG +#ifndef NDEBUG for (i = 1; i < nslots; i++) - assert(H5F_addr_lt(cache->slot[i - 1]->addr, cache->slot[i]->addr)); + assert(H5F_addr_lt(cache->slot[map[i - 1]]->addr, cache->slot[map[i]]->addr)); #endif -#else /* H5AC_SORT_BY_ADDR */ - nslots = cache->nslots; -#endif /* H5AC_SORT_BY_ADDR */ /* * Look at all cache entries. */ for (i = 0; i < nslots; i++) { -#ifdef H5AC_SORT_BY_ADDR info = cache->slot + map[i]; - if (NULL == (*info)) - break; /*the rest are empty */ -#else /* H5AC_SORT_BY_ADDR */ - info = cache->slot + i; - if (NULL == (*info)) - continue; -#endif /* H5AC_SORT_BY_ADDR */ + assert(*info); if (!type || type == (*info)->type) { #ifdef H5AC_DEBUG H5AC_subid_t type_id=(*info)->type->id; /* Remember this for later */ @@ -588,12 +818,12 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy) flush = (*info)->type->flush; /* Only block for all the processes on the first piece of metadata */ - if(first_flush) { - status = (flush)(f, H5AC_dxpl_id, destroy, (*info)->addr, (*info)); + if(first_flush && (*info)->dirty) { + status = (flush)(f, dxpl_id, destroy, (*info)->addr, (*info)); first_flush=0; } /* end if */ else - status = (flush)(f, H5P_DATASET_XFER_DEFAULT, destroy, (*info)->addr, (*info)); + status = (flush)(f, H5AC_noblock_dxpl_id, destroy, (*info)->addr, (*info)); if (status < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); @@ -613,32 +843,81 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy) HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "cache has protected items"); } else { i = H5AC_HASH(f, addr); - if (cache->slot[i] && (!type || cache->slot[i]->type == type) && - H5F_addr_eq(addr,cache->slot[i]->addr)) { + info = cache->slot + i; +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_info_t **dinfo; + H5AC_subid_t type_id; +#ifndef NDEBUG + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ + + /* Get the dataset transfer property list */ + if (NULL == (dxpl = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); + + /* Get the transfer mode property */ + if(H5P_get(dxpl, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve xfer mode"); + + /* Sanity check transfer mode */ + assert(xfer_mode==H5FD_MPIO_COLLECTIVE); +#endif /* NDEBUG */ + + dinfo = cache->dslot + i; + + /* Restore dirty metadata from 'held' slot to 'current' slot */ + if((*dinfo)!=NULL) { + H5AC_dest_func_t dest; + + /* Various sanity checks */ + assert((*dinfo)->dirty); + assert((*info)!=NULL); + assert((*info)->dirty==0); + + type_id=(*info)->type->id; /* Remember this for later */ + + /* Destroy 'current' information */ + dest = (*info)->type->dest; + if ((dest)(f, (*info))<0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, NULL, "unable to free cached object"); + + /* Restore 'held' information back to 'current' information */ + (*info)=(*dinfo); + + /* Clear 'held' information */ + (*dinfo)=NULL; + #ifdef H5AC_DEBUG - H5AC_subid_t type_id=cache->slot[i]->type->id; /* Remember this for later */ + cache->diagnostics[type_id].nrestores++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + if ((*info) && (!type || (*info)->type == type) && + H5F_addr_eq((*info)->addr, addr)) { +#ifdef H5AC_DEBUG + H5AC_subid_t type_id=(*info)->type->id; /* Remember this for later */ #endif /* H5AC_DEBUG */ /* * Flush just this entry. */ - flush = cache->slot[i]->type->flush; - if ((flush)(f, H5AC_dxpl_id, destroy, cache->slot[i]->addr, - cache->slot[i]) < 0) + flush = (*info)->type->flush; + if((flush)(f, dxpl_id, destroy, (*info)->addr, (*info)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object"); #ifdef H5AC_DEBUG cache->diagnostics[type_id].nflushes++; #endif /* H5AC_DEBUG */ if (destroy) - cache->slot[i]= NULL; - } - } + (*info)= NULL; + } /* end if */ + } /* end else */ done: -#ifdef H5AC_SORT_BY_ADDR if(map!=NULL) map = H5FL_ARR_FREE(int,map); -#endif /* H5AC_SORT_BY_ADDR */ FUNC_LEAVE_NOAPI(ret_value); } @@ -666,7 +945,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing) +H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing) { unsigned idx; H5AC_flush_func_t flush; @@ -699,6 +978,77 @@ H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing) } #endif +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_info_t **dinfo; + H5AC_subid_t type_id; + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ + + /* Get the dataset transfer property list */ + if (NULL == (dxpl = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); + + /* Get the transfer mode property */ + if(H5P_get(dxpl, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve xfer mode"); + + /* Get pointer to 'held' information */ + dinfo = cache->dslot + idx; + + /* Sanity check transfer mode */ + if(xfer_mode==H5FD_MPIO_COLLECTIVE) { + /* Check for dirty metadata */ + if(*dinfo) { + H5AC_dest_func_t dest; + + /* Various sanity checks */ + assert((*dinfo)->dirty); + assert((*info)!=NULL); + assert((*info)->dirty==0); + + type_id=(*info)->type->id; /* Remember this for later */ + + /* Destroy 'current' information */ + dest = (*info)->type->dest; + if ((dest)(f, (*info))<0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, NULL, "unable to free cached object"); + + /* Restore 'held' information back to 'current' information */ + (*info)=(*dinfo); + + /* Clear 'held' information */ + (*dinfo)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[type_id].nrestores++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end if */ + else { + /* Sanity check */ + assert((*dinfo)==NULL); + assert(xfer_mode==H5FD_MPIO_INDEPENDENT); + + /* Make certain there will be no write of dirty metadata */ + if((*info) && (*info)->dirty) { + /* Sanity check new item */ + assert(((H5AC_info_t*)thing)->dirty==0); + + /* 'Hold' the current metadata for later */ + (*dinfo)=(*info); + + /* Reset the 'current' metadata, so it doesn't get flushed */ + (*info)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[(*dinfo)->type->id].nholds++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end else */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ /* Flush any object already in cache slot */ if ((*info)) { @@ -707,13 +1057,14 @@ H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing) #endif /* H5AC_DEBUG */ flush = (*info)->type->flush; - if ((flush)(f, H5AC_dxpl_id, TRUE, (*info)->addr, (*info)) < 0) + if ((flush)(f, dxpl_id, TRUE, (*info)->addr, (*info)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object"); #ifdef H5AC_DEBUG cache->diagnostics[type_id].nflushes++; #endif /* H5AC_DEBUG */ - } + } /* end if */ + /* Cache this item */ (*info)=thing; (*info)->type = type; (*info)->addr = addr; @@ -748,12 +1099,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, +H5AC_rename(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr) { unsigned old_idx, new_idx; H5AC_flush_func_t flush; H5AC_t *cache; + H5AC_info_t **new_info = NULL; + H5AC_info_t **old_info = NULL; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_rename, FAIL); @@ -766,6 +1119,8 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, old_idx = H5AC_HASH(f, old_addr); new_idx = H5AC_HASH(f, new_addr); cache = f->shared->cache; + new_info = cache->slot + new_idx; + old_info = cache->slot + old_idx; #ifdef H5AC_DEBUG { @@ -785,25 +1140,95 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, * We don't need to do anything if the object isn't cached or if the * new hash value is the same as the old one. */ - if (cache->slot[old_idx]->type != type || - H5F_addr_ne(cache->slot[old_idx]->addr, old_addr)) { + if (H5F_addr_ne((*old_info)->addr, old_addr) || (*old_info)->type!=type) HGOTO_DONE(SUCCEED); - } if (old_idx == new_idx) { - cache->slot[old_idx]->addr = new_addr; + (*old_info)->addr = new_addr; HGOTO_DONE(SUCCEED); } + +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_info_t **new_dinfo; + H5AC_subid_t type_id; + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ + + /* Get the dataset transfer property list */ + if (NULL == (dxpl = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); + + /* Get the transfer mode property */ + if(H5P_get(dxpl, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve xfer mode"); + + /* Get pointer to new 'held' information */ + new_dinfo = cache->dslot + new_idx; + + /* Sanity check transfer mode */ + if(xfer_mode==H5FD_MPIO_COLLECTIVE) { + /* Check for dirty metadata */ + if(*new_dinfo) { + H5AC_dest_func_t dest; + + /* Various sanity checks */ + assert((*new_dinfo)->dirty); + assert((*new_info)!=NULL); + assert((*new_info)->dirty==0); + + type_id=(*new_info)->type->id; /* Remember this for later */ + + /* Destroy 'current' information */ + dest = (*new_info)->type->dest; + if ((dest)(f, (*new_info))<0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, NULL, "unable to free cached object"); + + /* Restore 'held' information back to 'current' information */ + (*new_info)=(*new_dinfo); + + /* Clear 'held' information */ + (*new_dinfo)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[type_id].nrestores++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end if */ + else { + /* Sanity check that there will be no write of dirty metadata */ + assert((*new_dinfo)==NULL); + assert(xfer_mode==H5FD_MPIO_INDEPENDENT); + + /* Make certain there will be no write of dirty metadata */ + if((*new_info) && (*new_info)->dirty) { + /* Sanity check that we won't put two pieces of dirty metadata in same cache location */ + assert((*old_info)->dirty==0); + + /* 'Hold' the current metadata for later */ + (*new_dinfo)=(*new_info); + + /* Reset the 'current' metadata, so it doesn't get flushed */ + (*new_info)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[(*new_dinfo)->type->id].nholds++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end else */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + /* * Free the item from the destination cache line. */ - if (cache->slot[new_idx]) { + if (*new_info) { #ifdef H5AC_DEBUG - H5AC_subid_t type_id=cache->slot[new_idx]->type->id; /* Remember this for later */ + H5AC_subid_t type_id=(*new_info)->type->id; /* Remember this for later */ #endif /* H5AC_DEBUG */ - flush = cache->slot[new_idx]->type->flush; - if ((flush)(f, H5AC_dxpl_id, TRUE, cache->slot[new_idx]->addr, - cache->slot[new_idx]) < 0) + flush = (*new_info)->type->flush; + if ( (flush)(f, dxpl_id, TRUE, (*new_info)->addr, (*new_info)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object"); #ifdef H5AC_DEBUG cache->diagnostics[type_id].nflushes++; @@ -813,10 +1238,45 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, /* * Move the source to the destination (it might not be cached) */ - cache->slot[new_idx]= cache->slot[old_idx]; - cache->slot[new_idx]->type = cache->slot[old_idx]->type; - cache->slot[new_idx]->addr = new_addr; - cache->slot[old_idx]= NULL; + (*new_info)= (*old_info); + (*new_info)->addr = new_addr; + +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_info_t **old_dinfo; + H5AC_subid_t type_id; + + /* Get pointer to new 'held' information */ + old_dinfo = cache->dslot + old_idx; + + /* Check for 'held' metadata in old location & restore it, if so */ + if(*old_dinfo) { + /* Sanity check */ + assert((*old_dinfo)->dirty); + + type_id=(*old_info)->type->id; /* Remember this for later */ + + /* Restore 'held' information back to 'current' information */ + (*old_info)=(*old_dinfo); + + /* Clear 'held' information */ + (*old_dinfo)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[type_id].nrestores++; +#endif /* H5AC_DEBUG */ + } /* end if */ + else + (*old_info)= NULL; + } /* end if */ + else { +#endif /* H5_HAVE_PARALLEL */ + + (*old_info)= NULL; +#ifdef H5_HAVE_PARALLEL + } /* end else */ +#endif /* H5_HAVE_PARALLEL */ done: FUNC_LEAVE_NOAPI(ret_value); @@ -851,19 +1311,19 @@ done: *------------------------------------------------------------------------- */ void * -H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, +H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2) { int idx; - void *thing; + void *thing=NULL; H5AC_t *cache; H5AC_info_t **info; void *ret_value; /* Return value */ #ifdef H5AC_DEBUG H5AC_prot_t *prot = NULL; - static int ncalls = 0; + if (0 == ncalls++) { if (H5DEBUG(AC)) { fprintf(H5DEBUG(AC), "H5AC: debugging cache (expensive)\n"); @@ -889,43 +1349,120 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, prot = cache->prot + idx; #endif /* H5AC_DEBUG */ - if ((*info) && H5F_addr_eq(addr,(*info)->addr)) { - /* Sanity check that the object in the cache is the correct type */ - assert((*info)->type==type); +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_info_t **dinfo; + + /* Get pointer to new 'held' information */ + dinfo = cache->dslot + idx; + + /* Check for 'held' metadata in location & handle it */ + if(*dinfo) { + /* Sanity checks */ + assert((*dinfo)->dirty); + assert((*info)); + assert((*info)->dirty==0); + assert((*dinfo)->addr!=(*info)->addr); + + /* Is 'held' metadata the metadata we are looking for? */ + if (H5F_addr_eq((*dinfo)->addr, addr) +#ifdef H5AC_DEBUG + && (*dinfo)->type==type +#endif /* H5AC_DEBUG */ + ) { +#ifndef H5AC_DEBUG + /* Sanity check that the object in the cache is the correct type */ + assert((*dinfo)->type==type); +#endif /* H5AC_DEBUG */ + /* + * The object is already cached; simply remove it from the cache. + */ + thing = (*dinfo); + (*dinfo)->type = NULL; + (*dinfo)->addr = HADDR_UNDEF; + (*dinfo)= NULL; +#ifdef H5AC_DEBUG + cache->diagnostics[(*dinfo)->type->id].nhits++; +#endif /* H5AC_DEBUG */ + } /* end if */ + /* 'held' metadata isn't what we are looking for, but check for 'current' metadata */ + else { + if(H5F_addr_eq((*info)->addr, addr) +#ifdef H5AC_DEBUG + && (*info)->type==type +#endif /* H5AC_DEBUG */ + ) { +#ifndef H5AC_DEBUG + /* Sanity check that the object in the cache is the correct type */ + assert((*info)->type==type); +#endif /* H5AC_DEBUG */ + /* + * The object is already cached; remove it from the cache. + * and bring the 'held' object into the 'regular' information + */ + thing = (*info); + (*info)->type = NULL; + (*info)->addr = HADDR_UNDEF; + (*info)= (*dinfo); + (*dinfo)= NULL; +#ifdef H5AC_DEBUG + cache->diagnostics[(*info)->type->id].nhits++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end else */ + } /* end if */ + } /* end if */ - /* - * The object is already cached; simply remove it from the cache. - */ + /* Check if we've already found the object to protect */ + if(thing==NULL) { +#endif /* H5_HAVE_PARALLEL */ + if ((*info) && H5F_addr_eq(addr,(*info)->addr) #ifdef H5AC_DEBUG - cache->diagnostics[(*info)->type->id].nhits++; + && (*info)->type==type #endif /* H5AC_DEBUG */ - thing = (*info); - (*info)->type = NULL; - (*info)->addr = HADDR_UNDEF; - (*info)= NULL; - } else { + ) { +#ifndef H5AC_DEBUG + /* Sanity check that the object in the cache is the correct type */ + assert((*info)->type==type); +#endif /* H5AC_DEBUG */ + + /* + * The object is already cached; simply remove it from the cache. + */ + thing = (*info); + (*info)->type = NULL; + (*info)->addr = HADDR_UNDEF; + (*info)= NULL; #ifdef H5AC_DEBUG - /* - * Check that the requested thing isn't protected, for protected things - * can only be modified through the pointer already handed out by the - * H5AC_protect() function. - */ - int i; + cache->diagnostics[(*info)->type->id].nhits++; +#endif /* H5AC_DEBUG */ + } else { +#ifdef H5AC_DEBUG + /* + * Check that the requested thing isn't protected, for protected things + * can only be modified through the pointer already handed out by the + * H5AC_protect() function. + */ + int i; - for (i = 0; i < prot->nprots; i++) - assert(H5F_addr_ne(addr, prot->slot[i]->addr)); + for (i = 0; i < prot->nprots; i++) + assert(H5F_addr_ne(addr, prot->slot[i]->addr)); #endif /* H5AC_DEBUG */ - /* - * Load a new thing. If it can't be loaded, then return an error - * without preempting anything. - */ + /* + * Load a new thing. If it can't be loaded, then return an error + * without preempting anything. + */ + if (NULL == (thing = (type->load)(f, dxpl_id, addr, udata1, udata2))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load object"); #ifdef H5AC_DEBUG - cache->diagnostics[type->id].nmisses++; + cache->diagnostics[type->id].nmisses++; #endif /* H5AC_DEBUG */ - if (NULL == (thing = (type->load)(f, H5P_DATASET_XFER_DEFAULT, addr, udata1, udata2))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load object"); - } + } +#ifdef H5_HAVE_PARALLEL + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ #ifdef H5AC_DEBUG /* @@ -934,8 +1471,8 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, */ if (prot->nprots >= prot->aprots) { size_t na = prot->aprots + 10; - H5AC_info_t **x = H5MM_realloc(prot->slot, - na * sizeof(H5AC_info_t *)); + H5AC_info_t **x = H5MM_realloc(prot->slot, na * sizeof(H5AC_info_t *)); + if (NULL==x) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); prot->aprots = (int)na; @@ -981,7 +1518,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing) +H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing) { unsigned idx; H5AC_flush_func_t flush; @@ -1004,6 +1541,78 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing) cache = f->shared->cache; info = cache->slot + idx; +#ifdef H5_HAVE_PARALLEL + /* If MPIO or MPIPOSIX is used, do special parallel I/O actions */ + if(IS_H5FD_MPIO(f) || IS_H5FD_MPIPOSIX(f)) { + H5AC_info_t **dinfo; + H5AC_subid_t type_id; + H5P_genplist_t *dxpl; /* Dataset transfer property list */ + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode property value */ + + /* Get the dataset transfer property list */ + if (NULL == (dxpl = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); + + /* Get the transfer mode property */ + if(H5P_get(dxpl, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve xfer mode"); + + /* Get pointer to 'held' information */ + dinfo = cache->dslot + idx; + + /* Sanity check transfer mode */ + if(xfer_mode==H5FD_MPIO_COLLECTIVE) { + /* Check for dirty metadata */ + if(*dinfo) { + H5AC_dest_func_t dest; + + /* Various sanity checks */ + assert((*dinfo)->dirty); + assert((*info)!=NULL); + assert((*info)->dirty==0); + + type_id=(*info)->type->id; /* Remember this for later */ + + /* Destroy 'current' information */ + dest = (*info)->type->dest; + if ((dest)(f, (*info))<0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free cached object"); + + /* Restore 'held' information back to 'current' information */ + (*info)=(*dinfo); + + /* Clear 'held' information */ + (*dinfo)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[type_id].nrestores++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end if */ + else { + /* Sanity check */ + assert((*dinfo)==NULL); + assert(xfer_mode==H5FD_MPIO_INDEPENDENT); + + /* Make certain there will be no write of dirty metadata */ + if((*info) && (*info)->dirty) { + /* Sanity check new item */ + assert(((H5AC_info_t*)thing)->dirty==0); + + /* 'Hold' the current metadata for later */ + (*dinfo)=(*info); + + /* Reset the 'current' metadata, so it doesn't get flushed */ + (*info)=NULL; + +#ifdef H5AC_DEBUG + cache->diagnostics[(*dinfo)->type->id].nholds++; +#endif /* H5AC_DEBUG */ + } /* end if */ + } /* end else */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + /* * Flush any object already in the cache at that location. It had * better not be another copy of the protected object. @@ -1015,12 +1624,13 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing) assert(H5F_addr_ne((*info)->addr, addr)); flush = (*info)->type->flush; - if ((flush)(f, H5AC_dxpl_id, TRUE, (*info)->addr, (*info)) < 0) + if ((flush)(f, dxpl_id, TRUE, (*info)->addr, (*info)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object"); #ifdef H5AC_DEBUG cache->diagnostics[type_id].nflushes++; #endif /* H5AC_DEBUG */ } + #ifdef H5AC_DEBUG /* * Remove the object's protect data to indicate that it is no longer @@ -1079,7 +1689,7 @@ H5AC_debug(H5F_t UNUSED *f) char s[32], ascii[32]; H5AC_t *cache = f->shared->cache; double miss_rate; -#endif +#endif /* H5AC_DEBUG */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_debug, FAIL); @@ -1138,8 +1748,9 @@ H5AC_debug(H5F_t UNUSED *f) (long)(cache->diagnostics[i].ninits))); } } -#endif +#endif /* H5AC_DEBUG */ done: FUNC_LEAVE_NOAPI(ret_value); } + diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index d587df6..96cf05c 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -34,6 +34,16 @@ # undef H5AC_DEBUG #endif +/* Dataset transfer property list for flush calls */ +/* (Collective set, "block before metadata write" set and "library internal" set) */ +/* (Global variable declaration, definition is in H5AC.c) */ +extern hid_t H5AC_dxpl_id; + +/* Dataset transfer property list for independent metadata I/O calls */ +/* (just "library internal" set - i.e. independent transfer mode) */ +/* (Global variable declaration, definition is in H5AC.c) */ +extern hid_t H5AC_ind_dxpl_id; + /* * Class methods pertaining to caching. Each type of cached object will * have a constant variable with permanent life-span that describes how @@ -58,13 +68,15 @@ typedef enum H5AC_subid_t { H5AC_NTYPES = 5 /*THIS MUST BE LAST! */ } H5AC_subid_t; -typedef void *(*H5AC_load_func_t)(H5F_t*, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); -typedef herr_t (*H5AC_flush_func_t)(H5F_t*, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing); +typedef void *(*H5AC_load_func_t)(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); +typedef herr_t (*H5AC_flush_func_t)(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing); +typedef herr_t (*H5AC_dest_func_t)(H5F_t *f, void *thing); typedef struct H5AC_class_t { H5AC_subid_t id; H5AC_load_func_t load; H5AC_flush_func_t flush; + H5AC_dest_func_t dest; } H5AC_class_t; /* @@ -81,6 +93,7 @@ typedef struct H5AC_class_t { typedef struct H5AC_info_t { const H5AC_class_t *type; /*type of object stored here */ haddr_t addr; /*file address for object */ + hbool_t dirty; /* 'Dirty' flag for cached object */ } H5AC_info_t; typedef H5AC_info_t *H5AC_info_ptr_t; /* Typedef for free lists */ @@ -95,6 +108,7 @@ typedef struct H5AC_prot_t { typedef struct H5AC_t { unsigned nslots; /*number of cache slots */ H5AC_info_t **slot; /*the cache slots, an array of pointers to the cached objects */ + H5AC_info_t **dslot; /*"held object" cache slots, an array of pointers to dirty cached objects */ #ifdef H5AC_DEBUG H5AC_prot_t *prot; /*the protected slots */ #endif /* H5AC_DEBUG */ @@ -105,6 +119,11 @@ typedef struct H5AC_t { unsigned nmisses; /*number of cache misses */ unsigned ninits; /*number of cache inits */ unsigned nflushes; /*number of flushes to disk */ +#ifdef H5_HAVE_PARALLEL + unsigned ndestroys; /*number of cache destroys */ + unsigned nholds; /*number of cache holds */ + unsigned nrestores; /*number of cache restores */ +#endif /* H5_HAVE_PARALLEL */ } diagnostics[H5AC_NTYPES]; /*diagnostics for each type of object*/ #endif /* H5AC_DEBUG */ } H5AC_t; @@ -114,39 +133,32 @@ typedef struct H5AC_t { #define H5AC_BLOCK_BEFORE_META_WRITE_NAME "H5AC_block_before_meta_write" #define H5AC_BLOCK_BEFORE_META_WRITE_SIZE sizeof(unsigned) #define H5AC_BLOCK_BEFORE_META_WRITE_DEF 0 + +/* Definitions for "library internal" property */ +#define H5AC_LIBRARY_INTERNAL_NAME "H5AC_library_internal" +#define H5AC_LIBRARY_INTERNAL_SIZE sizeof(unsigned) +#define H5AC_LIBRARY_INTERNAL_DEF 0 #endif /* H5_HAVE_PARALLEL */ /* * Library prototypes. */ -H5_DLL herr_t H5AC_dest(H5F_t *f); -H5_DLL void *H5AC_find_f(H5F_t *f, const H5AC_class_t *type, haddr_t addr, - const void *udata1, void *udata2); -H5_DLL void *H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, +H5_DLL herr_t H5AC_init(void); +H5_DLL herr_t H5AC_create(H5F_t *f, int size_hint); +H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, + void *thing); +H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2); -H5_DLL herr_t H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, +H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing); -H5_DLL herr_t H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, +H5_DLL void *H5AC_find(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, + haddr_t addr, const void *udata1, void *udata2); +H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, hbool_t destroy); -H5_DLL herr_t H5AC_create(H5F_t *f, int size_hint); -H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type, +H5_DLL herr_t H5AC_rename(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr); -H5_DLL herr_t H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr, - void *thing); +H5_DLL herr_t H5AC_dest(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5AC_debug(H5F_t *f); -/* This seems to be slower than just calling H5AC_find_f, which performs the - * cache lookup also. - QAK - */ -#ifdef OLD_WAY -#define H5AC_find(F,TYPE,ADDR,UDATA1,UDATA2) \ - ((F)->shared->cache->slot[H5AC_HASH(F,ADDR)]!=NULL && \ - ((F)->shared->cache->slot[H5AC_HASH(F,ADDR)]->type==(TYPE) && \ - (F)->shared->cache->slot[H5AC_HASH(F,ADDR)]->addr==ADDR) ? \ - ((F)->shared->cache->diagnostics[(TYPE)->id].nhits++, \ - (F)->shared->cache->slot[H5AC_HASH(F,ADDR)]) : \ - H5AC_find_f(F, TYPE, ADDR, UDATA1, UDATA2)) -#endif /* OLD_WAY */ - #endif /* !_H5ACprivate_H */ diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index 14d55d0..d9faaa7 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -28,7 +28,5 @@ typedef struct H5A_t H5A_t; H5_DLL H5A_t *H5A_copy(const H5A_t *old_attr); H5_DLL herr_t H5A_close(H5A_t *attr); H5_DLL H5G_entry_t *H5A_entof(H5A_t *attr); -H5_DLL hsize_t H5A_get_storage_size(H5A_t *attr); -H5_DLL herr_t H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name); #endif diff --git a/src/H5B.c b/src/H5B.c index 45d5dbd..e2ffcc8 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -106,7 +106,7 @@ #define BOUND(MIN,X,MAX) ((X)<(MIN)?(MIN):((X)>(MAX)?(MAX):(X))) /* PRIVATE PROTOTYPES */ -static H5B_ins_t H5B_insert_helper(H5F_t *f, haddr_t addr, +static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, const double split_ratios[], uint8_t *lt_key, @@ -118,13 +118,14 @@ static H5B_ins_t H5B_insert_helper(H5F_t *f, haddr_t addr, static herr_t H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, int idx, haddr_t child, H5B_ins_t anchor, void *md_key); -static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b); static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); +static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b); +static herr_t H5B_dest(H5F_t *f, H5B_t *b); static herr_t H5B_decode_key(H5F_t *f, H5B_t *bt, int idx); static herr_t H5B_decode_keys(H5F_t *f, H5B_t *bt, int idx); static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type, size_t *total_nkey_size, size_t sizeof_rkey); -static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, +static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, int idx, const double split_ratios[], void *udata, haddr_t *new_addr/*out*/); @@ -139,6 +140,7 @@ static const H5AC_class_t H5AC_BT[1] = {{ H5AC_BT_ID, (H5AC_load_func_t)H5B_load, (H5AC_flush_func_t)H5B_flush, + (H5AC_dest_func_t)H5B_dest, }}; /* Interface initialization? */ @@ -185,7 +187,7 @@ H5FL_DEFINE_STATIC(H5B_t); *------------------------------------------------------------------------- */ herr_t -H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, +H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, haddr_t *addr_p/*out*/) { H5B_t *bt = NULL; @@ -210,13 +212,14 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, */ sizeof_rkey = (type->get_sizeof_rkey) (f, udata); size = H5B_nodesize(f, type, &total_native_keysize, sizeof_rkey); - if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)size))) + H5_CHECK_OVERFLOW(size,size_t,hsize_t); + if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree root node"); if (NULL==(bt = H5FL_CALLOC(H5B_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node"); bt->type = type; bt->sizeof_rkey = sizeof_rkey; - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->ndirty = 0; bt->level = 0; bt->left = HADDR_UNDEF; @@ -253,7 +256,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, /* * Cache the new B-tree node. */ - if (H5AC_set(f, H5AC_BT, *addr_p, bt) < 0) + if (H5AC_set(f, dxpl_id, H5AC_BT, *addr_p, bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache"); #ifdef H5B_DEBUG H5B_assert(f, *addr_p, type, udata); @@ -261,14 +264,10 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, done: if (ret_value<0) { - H5MF_xfree(f, H5FD_MEM_BTREE, *addr_p, (hsize_t)size); - if (bt) { - H5FL_BLK_FREE (page,bt->page); - H5FL_BLK_FREE (native_block,bt->native); - H5FL_ARR_FREE (haddr_t,bt->child); - H5FL_ARR_FREE (H5B_key_t,bt->key); - H5FL_FREE (H5B_t,bt); - } + H5_CHECK_OVERFLOW(size,size_t,hsize_t); + H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, *addr_p, (hsize_t)size); + if (bt) + H5B_dest(f,bt); } FUNC_LEAVE_NOAPI(ret_value); @@ -321,7 +320,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) bt->sizeof_rkey = (type->get_sizeof_rkey) (f, udata); size = H5B_nodesize(f, type, &total_nkey_size, bt->sizeof_rkey); bt->type = type; - bt->dirty = FALSE; + bt->cache_info.dirty = FALSE; bt->ndirty = 0; if (NULL==(bt->page=H5FL_BLK_MALLOC(page,size)) || NULL==(bt->native=H5FL_BLK_MALLOC(native_block,total_nkey_size)) || @@ -373,13 +372,8 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) ret_value = bt; done: - if (!ret_value && bt) { - H5FL_ARR_FREE(haddr_t,bt->child); - H5FL_ARR_FREE(H5B_key_t,bt->key); - H5FL_BLK_FREE(page,bt->page); - H5FL_BLK_FREE(native_block,bt->native); - H5FL_FREE(H5B_t,bt); - } + if (!ret_value && bt) + H5B_dest(f,bt); FUNC_LEAVE_NOAPI(ret_value); } @@ -428,7 +422,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt) size = H5B_nodesize(f, bt->type, NULL, bt->sizeof_rkey); - if (bt->dirty) { + if (bt->cache_info.dirty) { /* magic number */ HDmemcpy(p, H5B_MAGIC, H5B_SIZEOF_MAGIC); @@ -475,15 +469,12 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt) */ if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, bt->page)<0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk"); - bt->dirty = FALSE; + bt->cache_info.dirty = FALSE; bt->ndirty = 0; } if (destroy) { - H5FL_ARR_FREE(haddr_t,bt->child); - H5FL_ARR_FREE(H5B_key_t,bt->key); - H5FL_BLK_FREE(page,bt->page); - H5FL_BLK_FREE(native_block,bt->native); - H5FL_FREE(H5B_t,bt); + if(H5B_dest(f,bt)<0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node"); } done: @@ -492,6 +483,44 @@ done: /*------------------------------------------------------------------------- + * Function: H5B_dest + * + * Purpose: Destroys a B-tree node in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B_dest(H5F_t UNUSED *f, H5B_t *bt) +{ + FUNC_ENTER_NOINIT(H5B_dest); + + /* + * Check arguments. + */ + assert(bt); + + /* Verify that node is clean */ + assert(bt->cache_info.dirty==0); + + H5FL_ARR_FREE(haddr_t,bt->child); + H5FL_ARR_FREE(H5B_key_t,bt->key); + H5FL_BLK_FREE(page,bt->page); + H5FL_BLK_FREE(native_block,bt->native); + H5FL_FREE(H5B_t,bt); + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5B_dest() */ + + +/*------------------------------------------------------------------------- * Function: H5B_find * * Purpose: Locate the specified information in a B-tree and return @@ -518,7 +547,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) +H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { H5B_t *bt = NULL; int idx = -1, lt = 0, rt, cmp = 1; @@ -540,7 +569,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) * Perform a binary search to locate the child which contains * the thing for which we're searching. */ - if (NULL == (bt = H5AC_protect(f, H5AC_BT, addr, type, udata))) + if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node"); rt = bt->nchildren; @@ -549,7 +578,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) if (H5B_decode_keys(f, bt, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, FAIL, "unable to decode B-tree key(s)"); /* compare */ - if ((cmp = (type->cmp3) (f, bt->key[idx].nkey, udata, + if ((cmp = (type->cmp3) (f, dxpl_id, bt->key[idx].nkey, udata, bt->key[idx+1].nkey)) < 0) { rt = idx; } else { @@ -564,15 +593,15 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) */ assert(idx >= 0 && idx < bt->nchildren); if (bt->level > 0) { - if (H5B_find(f, type, bt->child[idx], udata) < 0) + if (H5B_find(f, dxpl_id, type, bt->child[idx], udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in subtree"); } else { - if ((type->found) (f, bt->child[idx], bt->key[idx].nkey, udata, bt->key[idx+1].nkey) < 0) + if ((type->found) (f, dxpl_id, bt->child[idx], bt->key[idx].nkey, udata, bt->key[idx+1].nkey) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node"); } done: - if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt) < 0 && ret_value>=0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt) < 0 && ret_value>=0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node"); FUNC_LEAVE_NOAPI(ret_value); @@ -606,7 +635,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, +H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, int idx, const double split_ratios[], void *udata, haddr_t *new_addr_p/*out*/) { @@ -680,9 +709,9 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, /* * Create the new B-tree node. */ - if (H5B_create(f, type, udata, new_addr_p/*out*/) < 0) + if (H5B_create(f, dxpl_id, type, udata, new_addr_p/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree"); - if (NULL==(new_bt=H5AC_protect(f, H5AC_BT, *new_addr_p, type, udata))) + if (NULL==(new_bt=H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to protect B-tree"); new_bt->level = old_bt->level; @@ -711,7 +740,7 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, /* * Truncate the old node. */ - old_bt->dirty = TRUE; + old_bt->cache_info.dirty = TRUE; old_bt->nchildren = nleft; old_bt->ndirty = MIN(old_bt->ndirty, old_bt->nchildren); @@ -722,15 +751,15 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, new_bt->right = old_bt->right; if (H5F_addr_defined(old_bt->right)) { - if (NULL == (tmp_bt = H5AC_find_f(f, H5AC_BT, old_bt->right, type, udata))) + if (NULL == (tmp_bt = H5AC_find(f, dxpl_id, H5AC_BT, old_bt->right, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling"); - tmp_bt->dirty = TRUE; + tmp_bt->cache_info.dirty = TRUE; tmp_bt->left = *new_addr_p; } old_bt->right = *new_addr_p; done: - if (new_bt && H5AC_unprotect(f, H5AC_BT, *new_addr_p, new_bt) < 0 && ret_value>=0) + if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt) < 0 && ret_value>=0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value); @@ -833,7 +862,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, +H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, const double split_ratios[], void *udata) { /* @@ -862,7 +891,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, assert(type->sizeof_nkey <= sizeof _lt_key); assert(H5F_addr_defined(addr)); - if ((my_ins = H5B_insert_helper(f, addr, type, split_ratios, lt_key, + if ((my_ins = H5B_insert_helper(f, dxpl_id, addr, type, split_ratios, lt_key, <_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0 || my_ins<0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key"); @@ -871,7 +900,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, assert(H5B_INS_RIGHT == my_ins); /* the current root */ - if (NULL == (bt = H5AC_find_f(f, H5AC_BT, addr, type, udata))) + if (NULL == (bt = H5AC_find(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to locate root of B-tree"); level = bt->level; if (!lt_key_changed) { @@ -881,7 +910,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, } /* the new node */ - if (NULL == (bt = H5AC_find_f(f, H5AC_BT, child, type, udata))) + if (NULL == (bt = H5AC_find(f, dxpl_id, H5AC_BT, child, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new node"); if (!rt_key_changed) { if (!bt->key[bt->nchildren].nkey && @@ -896,13 +925,13 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, * from "moving". */ size = H5B_nodesize(f, type, NULL, bt->sizeof_rkey); - if (HADDR_UNDEF==(old_root=H5MF_alloc(f, H5FD_MEM_BTREE, size))) + if (HADDR_UNDEF==(old_root=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space to move root"); /* update the new child's left pointer */ - if (NULL == (bt = H5AC_find_f(f, H5AC_BT, child, type, udata))) + if (NULL == (bt = H5AC_find(f, dxpl_id, H5AC_BT, child, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child"); - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->left = old_root; /* @@ -910,27 +939,27 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, * at the new location -QAK */ /* Bring the old root into the cache if it's not already */ - if (NULL == (bt = H5AC_find_f(f, H5AC_BT, addr, type, udata))) + if (NULL == (bt = H5AC_find(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child"); /* Make certain the old root info is marked as dirty before moving it, */ /* so it is certain to be written out at the new location */ - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; /* Make a copy of the old root information */ if (NULL == (bt = H5B_copy(f, bt))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to copy old root"); /* Move the location on the disk */ - if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0) + if (H5AC_rename(f, dxpl_id, H5AC_BT, addr, old_root) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node"); /* Insert the copy of the old root into the file again */ - if (H5AC_set(f, H5AC_BT, addr, bt) < 0) + if (H5AC_set(f, dxpl_id, H5AC_BT, addr, bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush old B-tree root node"); /* clear the old root info at the old address (we already copied it) */ - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->left = HADDR_UNDEF; bt->right = HADDR_UNDEF; @@ -992,7 +1021,7 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, assert(bt); assert(bt->nchildren<2*H5F_KVALUE(f, type)); - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; recsize = bt->sizeof_rkey + H5F_SIZEOF_ADDR(f); if (H5B_INS_RIGHT == anchor) { @@ -1107,7 +1136,7 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, *------------------------------------------------------------------------- */ static H5B_ins_t -H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, +H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, const double split_ratios[], uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, uint8_t *rt_key, hbool_t *rt_key_changed, @@ -1144,7 +1173,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * data. When the search completes IDX points to the child that * should get the new data. */ - if (NULL == (bt = H5AC_protect(f, H5AC_BT, addr, type, udata))) + if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node"); rt = bt->nchildren; @@ -1152,7 +1181,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, idx = (lt + rt) / 2; if (H5B_decode_keys(f, bt, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); - if ((cmp = (type->cmp3) (f, bt->key[idx].nkey, udata, + if ((cmp = (type->cmp3) (f, dxpl_id, bt->key[idx].nkey, udata, bt->key[idx+1].nkey)) < 0) { rt = idx; } else { @@ -1168,20 +1197,20 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, assert(0 == bt->level); bt->key[0].nkey = bt->native; bt->key[1].nkey = bt->native + type->sizeof_nkey; - if ((type->new_node)(f, H5B_INS_FIRST, bt->key[0].nkey, udata, + if ((type->new_node)(f, dxpl_id, H5B_INS_FIRST, bt->key[0].nkey, udata, bt->key[1].nkey, bt->child + 0/*out*/) < 0) { bt->key[0].nkey = bt->key[1].nkey = NULL; HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node"); } bt->nchildren = 1; - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->ndirty = 1; bt->key[0].dirty = TRUE; bt->key[1].dirty = TRUE; idx = 0; if (type->follow_min) { - if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey, + if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node"); @@ -1197,7 +1226,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, idx = 0; if (H5B_decode_keys(f, bt, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); - if ((my_ins = H5B_insert_helper(f, bt->child[idx], type, split_ratios, + if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, split_ratios, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) @@ -1211,7 +1240,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, idx = 0; if (H5B_decode_keys(f, bt, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); - if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey, + if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node"); @@ -1226,7 +1255,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); my_ins = H5B_INS_LEFT; HDmemcpy(md_key, bt->key[idx].nkey, type->sizeof_nkey); - if ((type->new_node)(f, H5B_INS_LEFT, bt->key[idx].nkey, udata, + if ((type->new_node)(f, dxpl_id, H5B_INS_LEFT, bt->key[idx].nkey, udata, md_key, &child_addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node"); *lt_key_changed = TRUE; @@ -1239,7 +1268,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, idx = bt->nchildren - 1; if (H5B_decode_keys(f, bt, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); - if ((my_ins = H5B_insert_helper(f, bt->child[idx], type, split_ratios, + if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, split_ratios, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree"); @@ -1252,7 +1281,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, idx = bt->nchildren - 1; if (H5B_decode_keys(f, bt, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); - if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey, + if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node"); @@ -1267,7 +1296,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); my_ins = H5B_INS_RIGHT; HDmemcpy(md_key, bt->key[idx+1].nkey, type->sizeof_nkey); - if ((type->new_node)(f, H5B_INS_RIGHT, md_key, udata, + if ((type->new_node)(f, dxpl_id, H5B_INS_RIGHT, md_key, udata, bt->key[idx+1].nkey, &child_addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node"); *rt_key_changed = TRUE; @@ -1285,7 +1314,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * Follow a branch out of this node to another subtree. */ assert(idx >= 0 && idx < bt->nchildren); - if ((my_ins = H5B_insert_helper(f, bt->child[idx], type, split_ratios, + if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, split_ratios, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree"); @@ -1294,7 +1323,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * Follow a branch out of this node to a leaf node of some other type. */ assert(idx >= 0 && idx < bt->nchildren); - if ((my_ins = (type->insert)(f, bt->child[idx], bt->key[idx].nkey, + if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node"); @@ -1305,7 +1334,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * Update the left and right keys of the current node. */ if (*lt_key_changed) { - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->key[idx].dirty = TRUE; if (idx > 0) { *lt_key_changed = FALSE; @@ -1314,7 +1343,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, } } if (*rt_key_changed) { - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->key[idx+1].dirty = TRUE; if (idx+1 < bt->nchildren) { *rt_key_changed = FALSE; @@ -1327,7 +1356,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * The insertion simply changed the address for the child. */ bt->child[idx] = child_addr; - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->ndirty = MAX(bt->ndirty, idx+1); ret_value = H5B_INS_NOOP; @@ -1336,10 +1365,10 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * If this node is full then split it before inserting the new child. */ if (bt->nchildren == 2 * H5F_KVALUE(f, type)) { - if (H5B_split(f, type, bt, addr, idx, split_ratios, udata, + if (H5B_split(f, dxpl_id, type, bt, addr, idx, split_ratios, udata, new_node_p/*out*/)<0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node"); - if (NULL == (twin = H5AC_protect(f, H5AC_BT, *new_node_p, type, udata))) + if (NULL == (twin = H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node"); if (idxnchildren) { tmp_bt = bt; @@ -1384,8 +1413,8 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, done: { - herr_t e1 = (bt && H5AC_unprotect(f, H5AC_BT, addr, bt) < 0); - herr_t e2 = (twin && H5AC_unprotect(f, H5AC_BT, *new_node_p, twin)<0); + herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt) < 0); + herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, twin)<0); if (e1 || e2) /*use vars to prevent short-circuit of side effects */ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node(s)"); } @@ -1418,7 +1447,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_iterate (H5F_t *f, const H5B_class_t *type, H5B_operator_t op, haddr_t addr, void *udata) +H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op, haddr_t addr, void *udata) { H5B_t *bt = NULL; haddr_t next_addr; @@ -1440,11 +1469,11 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, H5B_operator_t op, haddr_t addr, assert(H5F_addr_defined(addr)); assert(udata); - if (NULL == (bt=H5AC_find_f(f, H5AC_BT, addr, type, udata))) + if (NULL == (bt=H5AC_find(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node"); if (bt->level > 0) { /* Keep following the left-most child until we reach a leaf node. */ - if (H5B_iterate(f, type, op, bt->child[0], udata)<0) + if (H5B_iterate(f, dxpl_id, type, op, bt->child[0], udata)<0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to list B-tree node"); } else { /* @@ -1461,7 +1490,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, H5B_operator_t op, haddr_t addr, * leave the B-tree node protected during an application * callback. */ - if (NULL==(bt=H5AC_find_f (f, H5AC_BT, cur_addr, type, udata))) + if (NULL==(bt=H5AC_find (f, dxpl_id, H5AC_BT, cur_addr, type, udata))) HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, "B-tree node"); for (i=0; inchildren; i++) child[i] = bt->child[i]; @@ -1480,7 +1509,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, H5B_operator_t op, haddr_t addr, * application callback. */ for (i=0; isizeof_nkey, + ret_flag = (*op)(f, dxpl_id, key+i*type->sizeof_nkey, child[i], key+(i+1)*type->sizeof_nkey, udata); if (ret_flag==H5B_ITER_ERROR) { HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "iterator function failed"); @@ -1530,7 +1559,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, +H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, int level, uint8_t *lt_key/*out*/, hbool_t *lt_key_changed/*out*/, void *udata, uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/) @@ -1557,14 +1586,14 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * Perform a binary search to locate the child which contains the thing * for which we're searching. */ - if (NULL==(bt=H5AC_protect(f, H5AC_BT, addr, type, udata))) + if (NULL==(bt=H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load B-tree node"); rt = bt->nchildren; while (ltcmp3)(f, bt->key[idx].nkey, udata, + if ((cmp=(type->cmp3)(f, dxpl_id, bt->key[idx].nkey, udata, bt->key[idx+1].nkey))<0) { rt = idx; } else { @@ -1581,7 +1610,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, assert(idx>=0 && idxnchildren); if (bt->level>0) { /* We're at an internal node -- call recursively */ - if ((ret_value=H5B_remove_helper(f, + if ((ret_value=H5B_remove_helper(f, dxpl_id, bt->child[idx], type, level+1, bt->key[idx].nkey/*out*/, lt_key_changed/*out*/, udata, bt->key[idx+1].nkey/*out*/, rt_key_changed/*out*/))<0) @@ -1592,7 +1621,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * has a removal method. Pass the removal request to the pointed-to * object and let it decide how to progress. */ - if ((ret_value=(type->remove)(f, + if ((ret_value=(type->remove)(f, dxpl_id, bt->child[idx], bt->key[idx].nkey, lt_key_changed, udata, bt->key[idx+1].nkey, rt_key_changed))<0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node"); @@ -1616,7 +1645,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * our right key and indicate that it changed. */ if (*lt_key_changed) { - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->key[idx].dirty = TRUE; if (idx>0) { *lt_key_changed = FALSE; @@ -1625,7 +1654,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, } } if (*rt_key_changed) { - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->key[idx+1].dirty = TRUE; if (idx+1nchildren) { *rt_key_changed = FALSE; @@ -1645,29 +1674,29 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * keys and the subtree pointer. Free this node (unless it's the * root node) and return H5B_INS_REMOVE. */ - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->nchildren = 0; bt->ndirty = 0; if (level>0) { if (H5F_addr_defined(bt->left)) { - if (NULL==(sibling=H5AC_find_f(f, H5AC_BT, bt->left, type, udata))) + if (NULL==(sibling=H5AC_find(f, dxpl_id, H5AC_BT, bt->left, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree"); sibling->right = bt->right; - sibling->dirty = TRUE; + sibling->cache_info.dirty = TRUE; } if (H5F_addr_defined(bt->right)) { - if (NULL==(sibling=H5AC_find_f(f, H5AC_BT, bt->right, type, udata))) + if (NULL==(sibling=H5AC_find(f, dxpl_id, H5AC_BT, bt->right, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree"); sibling->left = bt->left; - sibling->dirty = TRUE; + sibling->cache_info.dirty = TRUE; } bt->left = HADDR_UNDEF; bt->right = HADDR_UNDEF; sizeof_rkey = (type->get_sizeof_rkey)(f, udata); sizeof_node = H5B_nodesize(f, type, NULL, sizeof_rkey); - if (H5AC_unprotect(f, H5AC_BT, addr, bt)<0 || - H5AC_flush(f, H5AC_BT, addr, TRUE)<0 || - H5MF_xfree(f, H5FD_MEM_BTREE, addr, sizeof_node)<0) { + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt)<0 || + H5AC_flush(f, dxpl_id, H5AC_BT, addr, TRUE)<0 || + H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, sizeof_node)<0) { bt = NULL; HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to free B-tree node"); } @@ -1682,7 +1711,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * key into lt_key and notify the caller that the left key has * changed. Return H5B_INS_NOOP. */ - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->nchildren -= 1; bt->ndirty = bt->nchildren; @@ -1715,7 +1744,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * freed). We copy the new right-most key into rt_key and notify the * caller that the right key has changed. Return H5B_INS_NOOP. */ - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->nchildren -= 1; bt->ndirty = MIN(bt->ndirty, bt->nchildren); assert(bt->key[bt->nchildren].nkey); @@ -1731,7 +1760,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, * the right are shifted left by one place. The subtree has already * been freed). Return H5B_INS_NOOP. */ - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; bt->nchildren -= 1; bt->ndirty = bt->nchildren; @@ -1760,7 +1789,7 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, done: - if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt)<0 && ret_value>=0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt)<0 && ret_value>=0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node"); FUNC_LEAVE_NOAPI(ret_value); @@ -1786,7 +1815,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) +H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { /* These are defined this way to satisfy alignment constraints */ uint64_t _lt_key[128], _rt_key[128]; @@ -1806,7 +1835,7 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) assert(H5F_addr_defined(addr)); /* The actual removal */ - if (H5B_remove_helper(f, addr, type, 0, lt_key, <_key_changed, + if (H5B_remove_helper(f, dxpl_id, addr, type, 0, lt_key, <_key_changed, udata, rt_key, &rt_key_changed)==H5B_INS_ERROR) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree"); @@ -1814,11 +1843,11 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) * If the B-tree is now empty then make sure we mark the root node as * being at level zero */ - if (NULL==(bt=H5AC_find_f(f, H5AC_BT, addr, type, udata))) + if (NULL==(bt=H5AC_find(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree root node"); if (0==bt->nchildren && 0!=bt->level) { bt->level = 0; - bt->dirty = TRUE; + bt->cache_info.dirty = TRUE; } #ifdef H5B_DEBUG @@ -1994,7 +2023,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, +H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B_class_t *type, void *udata) { H5B_t *bt = NULL; @@ -2016,7 +2045,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* * Load the tree node. */ - if (NULL == (bt = H5AC_find_f(f, H5AC_BT, addr, type, udata))) + if (NULL == (bt = H5AC_find(f, dxpl_id, H5AC_BT, addr, type, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node"); /* @@ -2034,7 +2063,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, (unsigned long) (bt->sizeof_rkey)); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty flag:", - bt->dirty ? "True" : "False"); + bt->cache_info.dirty ? "True" : "False"); HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Number of initial dirty children:", (int) (bt->ndirty)); @@ -2116,7 +2145,7 @@ H5B_assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) } } /* Initialize the queue */ - bt = H5AC_find_f(f, H5AC_BT, addr, type, udata); + bt = H5AC_find(f, dxpl_id, H5AC_BT, addr, type, udata); assert(bt); cur = H5MM_calloc(sizeof(struct child_t)); assert (cur); @@ -2131,7 +2160,7 @@ H5B_assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) * test. */ for (ncell = 0; cur; ncell++) { - bt = H5AC_protect(f, H5AC_BT, cur->addr, type, udata); + bt = H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, type, udata); assert(bt); /* Check node header */ @@ -2176,7 +2205,7 @@ H5B_assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) } } /* Release node */ - status = H5AC_unprotect(f, H5AC_BT, cur->addr, bt); + status = H5AC_unprotect(f, dxpl_id, H5AC_BT, cur->addr, bt); assert(status >= 0); /* Advance current location in queue */ diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index d22edcb..5c8ef1a 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -58,7 +58,7 @@ typedef enum H5B_iterate_t { } H5B_iterate_t; /* Define the operator callback function pointer for H5B_iterate() */ -typedef H5B_iterate_t (*H5B_operator_t)(H5F_t *f, void *_lt_key, haddr_t addr, +typedef H5B_iterate_t (*H5B_operator_t)(H5F_t *f, hid_t, void *_lt_key, haddr_t addr, void *_rt_key, void *_udata); /* @@ -74,13 +74,13 @@ typedef struct H5B_class_t { H5B_subid_t id; /*id as found in file*/ size_t sizeof_nkey; /*size of native (memory) key*/ size_t (*get_sizeof_rkey)(H5F_t*, const void*); /*raw key size */ - herr_t (*new_node)(H5F_t*, H5B_ins_t, void*, void*, void*, haddr_t*); - int (*cmp2)(H5F_t*, void*, void*, void*); /*compare 2 keys */ - int (*cmp3)(H5F_t*, void*, void*, void*); /*compare 3 keys */ - herr_t (*found)(H5F_t*, haddr_t, const void*, void*, const void*); + herr_t (*new_node)(H5F_t*, hid_t, H5B_ins_t, void*, void*, void*, haddr_t*); + int (*cmp2)(H5F_t*, hid_t, void*, void*, void*); /*compare 2 keys */ + int (*cmp3)(H5F_t*, hid_t, void*, void*, void*); /*compare 3 keys */ + herr_t (*found)(H5F_t*, hid_t, haddr_t, const void*, void*, const void*); /* insert new data */ - H5B_ins_t (*insert)(H5F_t*, haddr_t, void*, hbool_t*, void*, void*, + H5B_ins_t (*insert)(H5F_t*, hid_t, haddr_t, void*, hbool_t*, void*, void*, void*, hbool_t*, haddr_t*); /* min insert uses min leaf, not new(), similarily for max insert */ @@ -88,7 +88,7 @@ typedef struct H5B_class_t { hbool_t follow_max; /* remove existing data */ - H5B_ins_t (*remove)(H5F_t*, haddr_t, void*, hbool_t*, void*, void*, + H5B_ins_t (*remove)(H5F_t*, hid_t, haddr_t, void*, hbool_t*, void*, void*, hbool_t*); /* encode, decode, debug key values */ @@ -112,7 +112,6 @@ typedef struct H5B_t { /* first field in structure */ const H5B_class_t *type; /*type of tree */ size_t sizeof_rkey; /*size of raw (disk) key */ - hbool_t dirty; /*something in the tree is dirty */ int ndirty; /*num child ptrs to emit */ int level; /*node level */ haddr_t left; /*address of left sibling */ @@ -127,17 +126,17 @@ typedef struct H5B_t { /* * Library prototypes. */ -H5_DLL herr_t H5B_debug (H5F_t *f, haddr_t addr, FILE * stream, - int indent, int fwidth, const H5B_class_t *type, - void *udata); -H5_DLL herr_t H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, +H5_DLL herr_t H5B_create (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, haddr_t *addr_p/*out*/); -H5_DLL herr_t H5B_find (H5F_t *f, const H5B_class_t *type, haddr_t addr, +H5_DLL herr_t H5B_find (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata); -H5_DLL herr_t H5B_insert (H5F_t *f, const H5B_class_t *type, haddr_t addr, +H5_DLL herr_t H5B_insert (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, const double split_ratios[], void *udata); -H5_DLL herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, - void *udata); -H5_DLL herr_t H5B_iterate (H5F_t *f, const H5B_class_t *type, H5B_operator_t +H5_DLL herr_t H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op, haddr_t addr, void *udata); +H5_DLL herr_t H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, + void *udata); +H5_DLL herr_t H5B_debug (H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, + int indent, int fwidth, const H5B_class_t *type, + void *udata); #endif diff --git a/src/H5D.c b/src/H5D.c index 0aa194a..ec9dbfb 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -65,13 +65,13 @@ static int interface_initialize_g = 0; /* Local functions */ static herr_t H5D_init_interface(void); -static herr_t H5D_alloc_storage (H5F_t *f, H5D_t *dset,H5D_time_alloc_t time_alloc, +static herr_t H5D_alloc_storage (H5F_t *f, hid_t dxpl_id, H5D_t *dset,H5D_time_alloc_t time_alloc, hbool_t update_time, hbool_t full_overwrite); -static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite); +static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id); static H5D_t * H5D_new(hid_t dcpl_id, hbool_t creating); static H5D_t * H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, - const H5S_t *space, hid_t dcpl_id); -static H5D_t * H5D_open_oid(H5G_entry_t *ent); + const H5S_t *space, hid_t dcpl_id, hid_t dxpl_id); +static H5D_t * H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id); static herr_t H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, void *buf/*out*/); @@ -79,11 +79,13 @@ static herr_t H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, const void *buf); static herr_t H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, - const H5T_t *buf_type, const H5S_t *space); -static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation); -static hsize_t H5D_get_storage_size(H5D_t *dset); + const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id); +static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id); +static hsize_t H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id); static haddr_t H5D_get_offset(H5D_t *dset); -static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size); +static herr_t H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); +static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); +static herr_t H5D_close(H5D_t *dataset); /* Declare a free list to manage the H5D_t struct */ H5FL_DEFINE_STATIC(H5D_t); @@ -167,6 +169,7 @@ H5D_init_interface(void) * - Default value for file driver info * - Default value for 'gather reads' property * - Default value for vector size + * - Default value for I/O transfer mode * - Default value for EDC property * - Default value for filter callback */ @@ -187,6 +190,7 @@ H5D_init_interface(void) hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF; void *def_vfl_info = H5D_XFER_VFL_INFO_DEF; size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; + H5FD_mpio_xfer_t def_io_xfer_mode = H5D_XFER_IO_XFER_MODE_DEF; H5Z_EDC_t enable_edc = H5D_XFER_EDC_DEF; H5Z_cb_t filter_cb = H5D_XFER_FILTER_CB_DEF; @@ -291,6 +295,10 @@ H5D_init_interface(void) if(H5P_register(xfer_pclass,H5D_XFER_HYPER_VECTOR_SIZE_NAME,H5D_XFER_HYPER_VECTOR_SIZE_SIZE,&def_hyp_vec_size,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + /* Register the I/O transfer mode property */ + if(H5P_register(xfer_pclass,H5D_XFER_IO_XFER_MODE_NAME,H5D_XFER_IO_XFER_MODE_SIZE,&def_io_xfer_mode,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + /* Register the EDC property */ if(H5P_register(xfer_pclass,H5D_XFER_EDC_NAME,H5D_XFER_EDC_SIZE,&enable_edc,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); @@ -607,7 +615,7 @@ H5D_xfer_create(hid_t dxpl_id, void UNUSED *create_data) /* Increment the reference count on the driver and copy the driver info */ if(H5I_inc_ref(driver_id)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment VFL driver ID"); - if((driver_info = H5FD_dxpl_copy(driver_id, driver_info))==NULL) + if(H5FD_dxpl_copy(driver_id, driver_info, &driver_info)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "Can't copy VFL driver"); /* Set the driver information for the new property list */ @@ -775,7 +783,7 @@ H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list"); /* build and open the new dataset */ - if (NULL == (new_dset = H5D_create(loc, name, type, space, plist_id))) + if (NULL == (new_dset = H5D_create(loc, name, type, space, plist_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset"); /* Register the new dataset to get an ID for it */ @@ -833,11 +841,11 @@ H5Dopen(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Find the dataset object */ - if (H5G_find(loc, name, NULL, &ent) < 0) + if (H5G_find(loc, name, NULL, &ent, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found"); /* Open the dataset */ - if ((ret_value = H5D_open(&ent)) < 0) + if ((ret_value = H5D_open(&ent, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register dataset"); done: @@ -972,7 +980,7 @@ herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); /* Read data space address and return */ - if(FAIL==(ret_value=H5D_get_space_status(dset, allocation))) + if(FAIL==(ret_value=H5D_get_space_status(dset, allocation, H5AC_dxpl_id))) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status"); done: @@ -996,7 +1004,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation) +static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id) { H5S_t *space; /* Dataset's dataspace */ hsize_t space_allocated; /* The number of bytes allocated for chunks */ @@ -1026,7 +1034,7 @@ static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation) full_size=((hsize_t)total_elem)*type_size; /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - space_allocated=H5D_get_storage_size(dset); + space_allocated=H5D_get_storage_size(dset,dxpl_id); /* Decide on how much of the space is allocated */ if(space_allocated==0) @@ -1402,7 +1410,7 @@ H5Dextend(hid_t dset_id, const hsize_t *size) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified"); /* Increase size */ - if (H5D_extend (dset, size)<0) + if (H5D_extend (dset, size, H5AC_dxpl_id)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset"); done: @@ -1507,7 +1515,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) +H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *plist) { size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */ H5G_entry_t *ent=NULL; /* Dataset's group entry */ @@ -1547,11 +1555,11 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) ohdr_size += layout->size; /* Create (open for write access) an object header */ - if (H5O_create(file, ohdr_size, ent) < 0) + if (H5O_create(file, dxpl_id, ohdr_size, ent) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header"); /* Get a pointer to the object header itself */ - if((oh=H5O_protect(ent))==NULL) + if((oh=H5O_protect(ent, dxpl_id))==NULL) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to protect dataset object header"); /* Point at dataset's copy, to cache it for later */ @@ -1584,7 +1592,7 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) if (H5O_copy(H5O_FILL, fill_prop, &fill) == NULL) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to copy fill value"); - if (fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(&fill, type) < 0) + if (fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(&fill, type, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type"); fill.fill_defined = TRUE; @@ -1603,7 +1611,7 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to create dataset"); /* Write new fill value message */ - if (H5O_append(file, oh, H5O_FILL_NEW, H5O_FLAG_CONSTANT, &fill) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_FILL_NEW, H5O_FLAG_CONSTANT, &fill) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message"); /* If there is valid information for the old fill value struct, update it */ @@ -1616,7 +1624,7 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL,"unable to copy fill value"); /* Write old fill value */ - if (fill_prop->buf && H5O_append(file, oh, H5O_FILL, H5O_FLAG_CONSTANT, fill_prop) < 0) + if (fill_prop->buf && H5O_append(file, dxpl_id, oh, H5O_FILL, H5O_FLAG_CONSTANT, fill_prop) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message"); /* Update dataset creation property */ @@ -1625,8 +1633,8 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) } /* end if */ /* Update the type and space header messages */ - if (H5O_append(file, oh, H5O_DTYPE, H5O_FLAG_CONSTANT | H5O_FLAG_SHARED, type) < 0 || - H5S_append(file, oh, space) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_DTYPE, H5O_FLAG_CONSTANT | H5O_FLAG_SHARED, type) < 0 || + H5S_append(file, dxpl_id, oh, space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update type or space header messages"); /* Update the filters message, if this is a chunked dataset */ @@ -1637,7 +1645,7 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve pipeline filter"); if (pline.nfilters > 0 && - H5O_append(file, oh, H5O_PLINE, H5O_FLAG_CONSTANT, &pline) < 0) + H5O_append(file, dxpl_id, oh, H5O_PLINE, H5O_FLAG_CONSTANT, &pline) < 0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message"); } /* end if */ @@ -1646,7 +1654,7 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) * allocation until later. */ if (alloc_time == H5D_ALLOC_TIME_EARLY) - if (H5D_alloc_storage(file, dset, H5D_ALLOC_CREATE, FALSE, FALSE) < 0) + if (H5D_alloc_storage(file, dxpl_id, dset, H5D_ALLOC_CREATE, FALSE, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage"); /* Update external storage message */ @@ -1657,12 +1665,12 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) for (i = 0; i < efl->nused; ++i) heap_size += H5HL_ALIGN(HDstrlen(efl->slot[i].name) + 1); - if (H5HL_create(file, heap_size, &efl->heap_addr/*out*/) < 0 || - H5HL_insert(file, efl->heap_addr, 1, "") == (size_t)(-1)) + if (H5HL_create(file, dxpl_id, heap_size, &efl->heap_addr/*out*/) < 0 || + H5HL_insert(file, dxpl_id, efl->heap_addr, 1, "") == (size_t)(-1)) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create external file list name heap"); for (i = 0; i < efl->nused; ++i) { - size_t offset = H5HL_insert(file, efl->heap_addr, + size_t offset = H5HL_insert(file, dxpl_id, efl->heap_addr, HDstrlen(efl->slot[i].name) + 1, efl->slot[i].name); assert(0 == efl->slot[i].name_offset); @@ -1673,21 +1681,21 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) efl->slot[i].name_offset = offset; } - if (H5O_append(file, oh, H5O_EFL, H5O_FLAG_CONSTANT, efl) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_EFL, H5O_FLAG_CONSTANT, efl) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message"); } /* Update layout message */ /* (Don't make layout message constant yet, since space may not be allocated) */ /* Note: this is relying on H5D_alloc_storage not calling H5O_modify during dataset creation */ - if (H5D_COMPACT != layout->type && H5O_append(file, oh, H5O_LAYOUT, 0, layout) < 0) + if (H5D_COMPACT != layout->type && H5O_append(file, dxpl_id, oh, H5O_LAYOUT, 0, layout) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout"); #ifdef H5O_ENABLE_BOGUS /* * Add a "bogus" message. */ - if (H5O_bogus_oh(file, oh))<0) + if (H5O_bogus_oh(file, dxpl_id, oh))<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to update 'bogus' message"); #endif /* H5O_ENABLE_BOGUS */ @@ -1698,7 +1706,7 @@ H5D_update_entry_info(H5F_t *file, H5D_t *dset, H5P_genplist_t *plist) done: /* Release pointer to object header itself */ if(ent!=NULL && oh!=NULL) - if(H5O_unprotect(ent,oh)<0) + if(H5O_unprotect(ent,oh, dxpl_id)<0) HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to unprotect dataset object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1764,7 +1772,7 @@ done: */ static H5D_t * H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, - const H5S_t *space, hid_t dcpl_id) + const H5S_t *space, hid_t dcpl_id, hid_t dxpl_id) { H5D_t *new_dset = NULL; H5D_t *ret_value = NULL; @@ -1775,7 +1783,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, H5F_t *file; int chunk_ndims = 0; hsize_t chunk_size[32]={0}; - H5P_genplist_t *new_plist=NULL; /* New Property list */ + H5P_genplist_t *dc_plist=NULL; /* New Property list */ FUNC_ENTER_NOAPI(H5D_create, NULL); @@ -1798,7 +1806,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy datatype"); /* What file is the dataset being added to? */ - if (NULL==(file=H5G_insertion_file(loc, name))) + if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to locate insertion point"); /* Mark any VL datatypes as being on disk now */ @@ -1820,16 +1828,16 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, H5D_alloc_time_t alloc_time; /* Dataset's allocation time */ /* Get new dataset's property list object */ - if (NULL == (new_plist = H5I_object(new_dset->dcpl_id))) + if (NULL == (dc_plist = H5I_object(new_dset->dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get dataset creation property list"); - if(H5P_get(new_plist, H5D_CRT_DATA_PIPELINE_NAME, &dcpl_pline) < 0) + if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &dcpl_pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve pipeline filter"); - if(H5P_get(new_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) + if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout"); if(dcpl_pline.nfilters > 0 && H5D_CHUNKED != dcpl_layout) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout"); - if(H5P_get(new_plist, H5D_CRT_ALLOC_TIME_NAME, &alloc_time) < 0) + if(H5P_get(dc_plist, H5D_CRT_ALLOC_TIME_NAME, &alloc_time) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve space allocation time"); /* Check if the alloc_time is the default and set it accordingly */ @@ -1864,15 +1872,15 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet"); /* Chunked datasets are non-default, so retrieve their info here */ - if(H5P_get(new_plist, H5D_CRT_CHUNK_DIM_NAME, &chunk_ndims) < 0) + if(H5P_get(dc_plist, H5D_CRT_CHUNK_DIM_NAME, &chunk_ndims) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout"); /* Get the dataset's external file list information */ - if(H5P_get(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &new_dset->efl) < 0) + if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, &new_dset->efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve external file list"); /* Get the dataset's data storage method */ - if(H5P_get(new_plist, H5D_CRT_LAYOUT_NAME, &(new_dset->layout.type)) < 0) + if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &(new_dset->layout.type)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout"); } /* end if */ @@ -1930,7 +1938,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, * The chunk size of a dimension with a fixed size cannot exceed * the maximum dimension size */ - if(H5P_get(new_plist, H5D_CRT_CHUNK_SIZE_NAME, chunk_size) < 0) + if(H5P_get(dc_plist, H5D_CRT_CHUNK_SIZE_NAME, chunk_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve chunk size"); if (H5S_get_simple_extent_dims(new_dset->space, NULL, max_dim)<0) @@ -1977,7 +1985,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, /* * Update the dataset's entry info. */ - if (H5D_update_entry_info(file, new_dset, new_plist) != SUCCEED) + if (H5D_update_entry_info(file, dxpl_id, new_dset, dc_plist) != SUCCEED) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache"); /* @@ -1985,7 +1993,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, * "H5G_entry_t" object to the group this dataset is being initially * created in. */ - if (H5G_insert(loc, name, &new_dset->ent) < 0) + if (H5G_insert(loc, name, &new_dset->ent, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset"); /* Success */ @@ -2029,7 +2037,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5D_isa(H5G_entry_t *ent) +H5D_isa(H5G_entry_t *ent, hid_t dxpl_id) { htri_t exists; htri_t ret_value=TRUE; /* Return value */ @@ -2039,14 +2047,14 @@ H5D_isa(H5G_entry_t *ent) assert(ent); /* Data type */ - if ((exists=H5O_exists(ent, H5O_DTYPE, 0))<0) { + if ((exists=H5O_exists(ent, H5O_DTYPE, 0, dxpl_id))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header"); } else if (!exists) { HGOTO_DONE(FALSE); } /* Layout */ - if ((exists=H5O_exists(ent, H5O_LAYOUT, 0))<0) { + if ((exists=H5O_exists(ent, H5O_LAYOUT, 0, dxpl_id))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header"); } else if (!exists) { HGOTO_DONE(FALSE); @@ -2078,7 +2086,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5D_open(H5G_entry_t *ent) +H5D_open(H5G_entry_t *ent, hid_t dxpl_id) { hid_t ret_value; /* Return value */ @@ -2094,7 +2102,7 @@ H5D_open(H5G_entry_t *ent) H5E_clear(); /* Open the dataset object */ - if ((dataset=H5D_open_oid(ent)) ==NULL) + if ((dataset=H5D_open_oid(ent, dxpl_id)) ==NULL) HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found"); /* Create an atom for the dataset */ @@ -2149,7 +2157,7 @@ done: *------------------------------------------------------------------------- */ static H5D_t * -H5D_open_oid(H5G_entry_t *ent) +H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) { H5D_t *dataset = NULL; /*new dataset struct */ H5D_t *ret_value = NULL; /*return value */ @@ -2177,10 +2185,10 @@ H5D_open_oid(H5G_entry_t *ent) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open"); /* Get the type and space */ - if (NULL==(dataset->type=H5O_read(&(dataset->ent), H5O_DTYPE, 0, NULL))) + if (NULL==(dataset->type=H5O_read(&(dataset->ent), H5O_DTYPE, 0, NULL, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to load type info from dataset header"); - if (NULL==(dataset->space=H5S_read(&(dataset->ent)))) + if (NULL==(dataset->space=H5S_read(&(dataset->ent),dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to load space info from dataset header"); /* Get dataset creation property list object */ @@ -2188,7 +2196,7 @@ H5D_open_oid(H5G_entry_t *ent) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get dataset creation property list"); /* Get the optional filters message */ - if(NULL == H5O_read(&(dataset->ent), H5O_PLINE, 0, &pline)) { + if(NULL == H5O_read(&(dataset->ent), H5O_PLINE, 0, &pline, dxpl_id)) { H5E_clear(); HDmemset(&pline, 0, sizeof(pline)); } @@ -2205,7 +2213,7 @@ H5D_open_oid(H5G_entry_t *ent) * values are copied to the dataset create plist so the user can query * them. */ - if (NULL==H5O_read(&(dataset->ent), H5O_LAYOUT, 0, &(dataset->layout))) + if (NULL==H5O_read(&(dataset->ent), H5O_LAYOUT, 0, &(dataset->layout), dxpl_id)) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to read data layout message"); switch (dataset->layout.type) { case H5D_CONTIGUOUS: @@ -2249,7 +2257,7 @@ H5D_open_oid(H5G_entry_t *ent) H5O_reset(H5O_FILL, fill_prop); /* Get the new fill value message */ - if(NULL == H5O_read(&(dataset->ent), H5O_FILL_NEW, 0, &fill)) { + if(NULL == H5O_read(&(dataset->ent), H5O_FILL_NEW, 0, &fill, dxpl_id)) { H5E_clear(); HDmemset(&fill, 0, sizeof(fill)); @@ -2277,7 +2285,7 @@ H5D_open_oid(H5G_entry_t *ent) } else { /* For compatibility with v1.4. Retrieve the old fill value message. * If size is 0, make it -1 for undefined. */ - if(NULL == H5O_read(&(dataset->ent), H5O_FILL, 0, fill_prop)) { + if(NULL == H5O_read(&(dataset->ent), H5O_FILL, 0, fill_prop, dxpl_id)) { H5E_clear(); HDmemset(fill_prop, 0, sizeof(H5O_fill_t)); } @@ -2301,7 +2309,7 @@ H5D_open_oid(H5G_entry_t *ent) * also undefined when space allocate time is H5D_ALLOC_TIME_LATE. */ if( !H5F_addr_defined(dataset->layout.addr)) { HDmemset(&dataset->efl,0,sizeof(H5O_efl_t)); - if(NULL != H5O_read(&(dataset->ent), H5O_EFL, 0, &dataset->efl)) + if(NULL != H5O_read(&(dataset->ent), H5O_EFL, 0, &dataset->efl, dxpl_id)) if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->efl) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set external file list"); } @@ -2313,7 +2321,7 @@ H5D_open_oid(H5G_entry_t *ent) if ((H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR) && (dataset->layout.type!=H5D_COMPACT && dataset->layout.addr==HADDR_UNDEF) && (IS_H5FD_MPIO(dataset->ent.file) || IS_H5FD_MPIPOSIX(dataset->ent.file))) { - if (H5D_alloc_storage(dataset->ent.file, dataset,H5D_ALLOC_OPEN, TRUE, FALSE)<0) + if (H5D_alloc_storage(dataset->ent.file, dxpl_id, dataset,H5D_ALLOC_OPEN, TRUE, FALSE)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize file storage"); } @@ -2357,7 +2365,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5D_close(H5D_t *dataset) { unsigned free_failed; @@ -2377,7 +2385,7 @@ H5D_close(H5D_t *dataset) /* Update header message of layout for compact dataset. */ if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty) { - if(H5O_modify(&(dataset->ent), H5O_LAYOUT, 0, 0, 1, &(dataset->layout))<0) + if(H5O_modify(&(dataset->ent), H5O_LAYOUT, 0, 0, 1, &(dataset->layout), H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout message"); dataset->layout.dirty = FALSE; } /* end if */ @@ -2482,7 +2490,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, hsize_t request_nelmts; /*requested strip mine */ H5T_bkg_t need_bkg; /*type of background buf*/ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_dxpl_t *dx = NULL; H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /*xfer_mode for this request */ hbool_t xfer_mode_changed=0; /*xfer_mode needs restore */ hbool_t doing_mpio=0; /*This is an MPIO access */ @@ -2519,11 +2526,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Collect Parallel I/O information for possible later use */ if (H5FD_MPIO==H5P_peek_hid_t(dx_plist,H5D_XFER_VFL_ID_NAME)) { doing_mpio++; - if (NULL == (dx=H5P_peek_voidp(dx_plist,H5D_XFER_VFL_INFO_NAME))) { - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to retrieve data xfer info"); - } else { - xfer_mode = dx->xfer_mode; - } + xfer_mode=H5P_peek_unsigned(dx_plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ /* Collective access is not permissible without the MPIO or MPIPOSIX driver */ if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && @@ -2578,7 +2581,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_DONE(SUCCEED); /* Go fill the user's selection with the dataset's fill value */ - if(H5D_fill(fill.buf,fill.type,buf,mem_type,mem_space)<0) { + if(H5D_fill(fill.buf,fill.type,buf,mem_type,mem_space, dxpl_id)<0) { HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed"); } else HGOTO_DONE(SUCCEED); @@ -2592,7 +2595,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * enough value in xfer_parms since turning off data type conversion also * turns off background preservation. */ - if (NULL==(tpath=H5T_path_find(dataset->type, mem_type, NULL, NULL))) { + if (NULL==(tpath=H5T_path_find(dataset->type, mem_type, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } else if (!H5T_IS_NOOP(tpath)) { if ((src_id=H5I_register(H5I_DATATYPE, H5T_copy(dataset->type, H5T_COPY_ALL)))<0 || @@ -2661,15 +2664,14 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * Better way is to get a temporary data_xfer property with * INDEPENDENT xfer_mode and pass it downwards. */ - dx->xfer_mode = H5FD_MPIO_INDEPENDENT; + xfer_mode = H5FD_MPIO_INDEPENDENT; + if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode"); xfer_mode_changed++; /* restore it before return */ #ifdef H5D_DEBUG - if (H5DEBUG(D)) { + if (H5DEBUG(D)) fprintf(H5DEBUG(D), - "H5D: Cannot handle this COLLECTIVE read request. Do it via INDEPENDENT calls\n" - "dx->xfermode was %d, changed to %d\n", - xfer_mode, dx->xfer_mode); - } /* end if */ + "H5D: Cannot handle this COLLECTIVE read request. Do it via INDEPENDENT calls\n"); #endif } /* end if */ #endif /*H5_HAVE_PARALLEL*/ @@ -2797,12 +2799,12 @@ done: /* restore xfer_mode due to the kludge */ if (doing_mpio && xfer_mode_changed) { #ifdef H5D_DEBUG - if (H5DEBUG(D)) { - fprintf (H5DEBUG(D), "H5D: dx->xfermode was %d, restored to %d\n", - dx->xfer_mode, xfer_mode); - } /* end if */ + if (H5DEBUG(D)) + fprintf (H5DEBUG(D), "H5D: dx->xfer_mode was COLLECTIVE, restored to INDEPENDENT\n"); #endif - dx->xfer_mode = xfer_mode; + xfer_mode = H5FD_MPIO_COLLECTIVE; + if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode"); } /* end if */ #endif /*H5_HAVE_PARALLEL*/ /* Release selection iterators */ @@ -2896,7 +2898,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, hsize_t request_nelmts; /*requested strip mine */ H5T_bkg_t need_bkg; /*type of background buf*/ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_dxpl_t *dx = NULL; H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /*xfer_mode for this request */ hbool_t xfer_mode_changed=0; /*xfer_mode needs restore */ hbool_t doing_mpio=0; /*This is an MPIO access */ @@ -2949,11 +2950,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Collect Parallel I/O information for possible later use */ if (H5FD_MPIO==H5P_peek_hid_t(dx_plist,H5D_XFER_VFL_ID_NAME)) { doing_mpio++; - if (NULL==(dx=H5P_peek_voidp(dx_plist,H5D_XFER_VFL_INFO_NAME))) { - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to retrieve data xfer info"); - } else { - xfer_mode = dx->xfer_mode; - } + xfer_mode=H5P_peek_unsigned(dx_plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ /* Collective access is not permissible without the MPIO or MPIPOSIX driver */ @@ -2997,7 +2994,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, FAIL, "can't retrieve number of elements in file dataset"); /* Allocate storage */ - if(H5D_alloc_storage(dataset->ent.file, dataset,H5D_ALLOC_WRITE, TRUE, (hbool_t)((hsize_t)file_nelmts==nelmts ? TRUE : FALSE))<0) + if(H5D_alloc_storage(dataset->ent.file,dxpl_id,dataset,H5D_ALLOC_WRITE, TRUE, (hbool_t)((hsize_t)file_nelmts==nelmts ? TRUE : FALSE))<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage"); } /* end if */ @@ -3009,7 +3006,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * enough value in xfer_parms since turning off data type conversion also * turns off background preservation. */ - if (NULL==(tpath=H5T_path_find(mem_type, dataset->type, NULL, NULL))) { + if (NULL==(tpath=H5T_path_find(mem_type, dataset->type, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } else if (!H5T_IS_NOOP(tpath)) { if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL)))<0 || @@ -3076,14 +3073,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * Better way is to get a temporary data_xfer property with * INDEPENDENT xfer_mode and pass it downwards. */ - dx->xfer_mode = H5FD_MPIO_INDEPENDENT; + xfer_mode = H5FD_MPIO_INDEPENDENT; + if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode"); xfer_mode_changed++; /* restore it before return */ #ifdef H5D_DEBUG - if (H5DEBUG(D)) { - fprintf(H5DEBUG(D), - "H5D: Cannot handle this COLLECTIVE write request. Do it via INDEPENDENT calls\n" - "dx->xfermode was %d, changed to %d\n", xfer_mode, dx->xfer_mode); - } /* end if */ + if (H5DEBUG(D)) + fprintf(H5DEBUG(D), "H5D: Cannot handle this COLLECTIVE write request. Do it via INDEPENDENT calls\n"); #endif } /* end if */ #endif /*H5_HAVE_PARALLEL*/ @@ -3213,7 +3209,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * Update modification time. We have to do this explicitly because * writing to a dataset doesn't necessarily change the object header. */ - if (H5O_touch(&(dataset->ent), FALSE)<0) + if (H5O_touch(&(dataset->ent), FALSE, dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time"); done: @@ -3221,12 +3217,12 @@ done: /* restore xfer_mode due to the kludge */ if (doing_mpio && xfer_mode_changed) { #ifdef H5D_DEBUG - if (H5DEBUG(D)) { - fprintf (H5DEBUG(D), "H5D: dx->xfermode was %d, restored to %d\n", - dx->xfer_mode, xfer_mode); - } /* end if */ + if (H5DEBUG(D)) + fprintf (H5DEBUG(D), "H5D: dx->xfer_mode was COLLECTIVE, restored to INDEPENDENT\n"); #endif - dx->xfer_mode = xfer_mode; + xfer_mode = H5FD_MPIO_COLLECTIVE; + if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode"); } /* end if */ #endif /*H5_HAVE_PARALLEL*/ /* Release selection iterators */ @@ -3270,8 +3266,8 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5D_extend (H5D_t *dataset, const hsize_t *size) +static herr_t +H5D_extend (H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) { int changed; /* Flag to indicate that the dataspace was successfully extended */ H5S_t *space = NULL; /* Dataset's dataspace */ @@ -3296,12 +3292,12 @@ H5D_extend (H5D_t *dataset, const hsize_t *size) if (changed>0){ /* Save the new dataspace in the file if necessary */ - if (H5S_modify (&(dataset->ent), space, TRUE)<0) + if (H5S_modify (&(dataset->ent), space, TRUE, dxpl_id)<0) HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace"); /* Allocate space for the new parts of the dataset, if appropriate */ if(dataset->alloc_time==H5D_ALLOC_TIME_EARLY) - if (H5D_alloc_storage(dataset->ent.file, dataset, H5D_ALLOC_EXTEND, TRUE, FALSE)<0) + if (H5D_alloc_storage(dataset->ent.file, dxpl_id, dataset, H5D_ALLOC_EXTEND, TRUE, FALSE)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value"); } /* end if */ @@ -3414,7 +3410,7 @@ H5D_get_file (const H5D_t *dset) *------------------------------------------------------------------------- */ static herr_t -H5D_alloc_storage (H5F_t *f, H5D_t *dset/*in,out*/, H5D_time_alloc_t time_alloc, +H5D_alloc_storage (H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_alloc_t time_alloc, hbool_t update_time, hbool_t full_overwrite) { struct H5O_layout_t *layout; /* The dataset's layout information */ @@ -3444,7 +3440,7 @@ H5D_alloc_storage (H5F_t *f, H5D_t *dset/*in,out*/, H5D_time_alloc_t time_alloc, for (u=0, nbytes=1; undims; u++) nbytes *= layout->dim[u]; assert (nbytes>0); - if (HADDR_UNDEF==(layout->addr=H5MF_alloc(f, H5FD_MEM_DRAW, nbytes))) + if (HADDR_UNDEF==(layout->addr=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, nbytes))) HGOTO_ERROR (H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space"); /* Indicate that we allocated space */ @@ -3455,7 +3451,7 @@ H5D_alloc_storage (H5F_t *f, H5D_t *dset/*in,out*/, H5D_time_alloc_t time_alloc, case H5D_CHUNKED: if(layout->addr==HADDR_UNDEF) { /* Create the root of the B-tree that describes chunked storage */ - if (H5F_istore_create (f, layout/*out*/)<0) + if (H5F_istore_create (f, dxpl_id, layout/*out*/)<0) HGOTO_ERROR (H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); /* Indicate that we allocated space */ @@ -3492,7 +3488,7 @@ H5D_alloc_storage (H5F_t *f, H5D_t *dset/*in,out*/, H5D_time_alloc_t time_alloc, /* If we are filling the dataset on allocation, do that now */ if(dset->fill_time==H5D_FILL_TIME_ALLOC && !(dset->alloc_time==H5D_ALLOC_TIME_INCR && time_alloc==H5D_ALLOC_WRITE)) { - if(H5D_init_storage(dset, full_overwrite) < 0) + if(H5D_init_storage(dset, full_overwrite, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value"); } /* end if */ @@ -3500,7 +3496,7 @@ H5D_alloc_storage (H5F_t *f, H5D_t *dset/*in,out*/, H5D_time_alloc_t time_alloc, * (this is only for forward compatibility). */ if(time_alloc!=H5D_ALLOC_CREATE) - if (H5O_modify (&(dset->ent), H5O_LAYOUT, 0, H5O_FLAG_CONSTANT, update_time, &(dset->layout)) < 0) + if (H5O_modify (&(dset->ent), H5O_LAYOUT, 0, H5O_FLAG_CONSTANT, update_time, &(dset->layout), dxpl_id) < 0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout message"); } /* end if */ } /* end if */ @@ -3532,7 +3528,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_init_storage(H5D_t *dset, hbool_t full_overwrite) +H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hid_t dxpl_id) { hssize_t snpoints; /* Number of points in space (for error checking) */ size_t npoints; /* Number of points in space */ @@ -3573,9 +3569,8 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite) if (NULL == (plist = H5I_object(dset->dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); - if (H5F_contig_fill(dset->ent.file, H5P_DATASET_XFER_DEFAULT, - &(dset->layout), plist, &(dset->efl), space, - &dset->fill, H5T_get_size(dset->type))<0) + if (H5F_contig_fill(dset->ent.file, dxpl_id, &(dset->layout), + plist, &(dset->efl), space, &dset->fill, H5T_get_size(dset->type))<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset"); } /* end if */ break; @@ -3598,8 +3593,7 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get simple data space info"); dim[ndims] = dset->layout.dim[ndims]; - if (H5F_istore_allocate(dset->ent.file, H5P_DATASET_XFER_DEFAULT, - &(dset->layout), dim, plist, full_overwrite)<0) + if (H5F_istore_allocate(dset->ent.file, dxpl_id, &(dset->layout), dim, plist, full_overwrite)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset"); } /* end if */ break; @@ -3644,7 +3638,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset"); /* Set return value */ - ret_value = H5D_get_storage_size(dset); + ret_value = H5D_get_storage_size(dset,H5AC_dxpl_id); done: FUNC_LEAVE_API(ret_value); @@ -3669,7 +3663,7 @@ done: *------------------------------------------------------------------------- */ static hsize_t -H5D_get_storage_size(H5D_t *dset) +H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) { unsigned u; /* Index variable */ hsize_t ret_value; @@ -3681,7 +3675,7 @@ H5D_get_storage_size(H5D_t *dset) if(dset->layout.addr == HADDR_UNDEF) ret_value=0; else - ret_value = H5F_istore_allocated(dset->ent.file, dset->layout.ndims, + ret_value = H5F_istore_allocated(dset->ent.file, dxpl_id, dset->layout.ndims, dset->layout.addr); break; @@ -4162,7 +4156,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type, const H5S_t *space) +H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id) { H5T_path_t *tpath = NULL; /* Conversion information*/ uint8_t *tconv_buf = NULL; /* Data type conv buffer */ @@ -4201,7 +4195,7 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ - if (NULL == (tpath = H5T_path_find(fill_type, buf_type, NULL, NULL))) { + if (NULL == (tpath = H5T_path_find(fill_type, buf_type, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } else if (!H5T_IS_NOOP(tpath)) { if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL)))<0 || @@ -4210,7 +4204,7 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t } /* Perform data type conversion */ - if (H5T_convert(tpath, src_id, dst_id, (hsize_t)1, 0, 0, tconv_buf, bkg_buf, H5P_DATASET_XFER_DEFAULT)<0) + if (H5T_convert(tpath, src_id, dst_id, (hsize_t)1, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed"); /* Fill the selection in the memory buffer */ @@ -4271,7 +4265,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); /* Fill the selection in the memory buffer */ - if(H5D_fill(fill,fill_type,buf,buf_type,space)<0) + if(H5D_fill(fill,fill_type,buf,buf_type,space, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); done: @@ -4314,7 +4308,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified"); /* Private function */ - if(H5D_set_extent(dset, size) < 0) + if(H5D_set_extent(dset, size, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset"); done: @@ -4342,7 +4336,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_set_extent(H5D_t *dset, const hsize_t *size) +H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) { hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */ int rank; /* Dataspace # of dimensions */ @@ -4394,12 +4388,12 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size) *------------------------------------------------------------------------- */ /* Save the new dataspace in the file if necessary */ - if(H5S_modify(&(dset->ent), space, TRUE) < 0) + if(H5S_modify(&(dset->ent), space, TRUE, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace"); /* Allocate space for the new parts of the dataset, if appropriate */ if(expand && dset->alloc_time==H5D_ALLOC_TIME_EARLY) - if(H5D_alloc_storage(dset->ent.file, dset, H5D_ALLOC_EXTEND, TRUE, FALSE) < 0) + if(H5D_alloc_storage(dset->ent.file, dxpl_id, dset, H5D_ALLOC_EXTEND, TRUE, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset storage"); @@ -4414,11 +4408,11 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dset creation property list"); /* Remove excess chunks */ - if(H5F_istore_prune_by_extent(dset->ent.file, &dset->layout, space) < 0) + if(H5F_istore_prune_by_extent(dset->ent.file, dxpl_id, &dset->layout, space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks "); /* Reset the elements outsize the new dimensions, but in existing chunks */ - if(H5F_istore_initialize_by_extent(dset->ent.file, &dset->layout, plist, space) < 0) + if(H5F_istore_initialize_by_extent(dset->ent.file, dxpl_id, &dset->layout, plist, space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to initialize chunks "); } /* end if */ } /* end if */ @@ -4448,7 +4442,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_flush(H5F_t *f) +H5D_flush(H5F_t *f, hid_t dxpl_id) { unsigned num_dsets; /* Number of datasets in file */ hid_t *id_list=NULL; /* list of dataset IDs */ @@ -4473,7 +4467,7 @@ H5D_flush(H5F_t *f) if(NULL==(dataset=H5I_object_verify(id_list[j], H5I_DATASET))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset object"); if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty) - if(H5O_modify(&(dataset->ent), H5O_LAYOUT, 0, 0, 1, &(dataset->layout))<0) + if(H5O_modify(&(dataset->ent), H5O_LAYOUT, 0, 0, 1, &(dataset->layout), dxpl_id)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message"); dataset->layout.dirty = FALSE; } @@ -4518,7 +4512,7 @@ H5Ddebug(hid_t dset_id, unsigned UNUSED flags) /* Print B-tree information */ if (H5D_CHUNKED==dset->layout.type) { - H5F_istore_dump_btree(dset->ent.file, stdout, dset->layout.ndims, dset->layout.addr); + H5F_istore_dump_btree(dset->ent.file, H5AC_dxpl_id, stdout, dset->layout.ndims, dset->layout.addr); } else if (H5D_CONTIGUOUS==dset->layout.type) { HDfprintf(stdout, " %-10s %a\n", "Address:", dset->layout.addr); } diff --git a/src/H5Distore.c b/src/H5Distore.c index eefa690..ec233bf 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -108,23 +108,23 @@ typedef H5F_rdcc_ent_t *H5F_rdcc_ent_ptr_t; /* For free lists */ /* Private prototypes */ static size_t H5F_istore_sizeof_rkey(H5F_t *f, const void *_udata); -static herr_t H5F_istore_new_node(H5F_t *f, H5B_ins_t, void *_lt_key, +static herr_t H5F_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p /*out*/); -static int H5F_istore_cmp2(H5F_t *f, void *_lt_key, void *_udata, +static int H5F_istore_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); -static int H5F_istore_cmp3(H5F_t *f, void *_lt_key, void *_udata, +static int H5F_istore_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); -static herr_t H5F_istore_found(H5F_t *f, haddr_t addr, const void *_lt_key, +static herr_t H5F_istore_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key, void *_udata, const void *_rt_key); -static H5B_ins_t H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, +static H5B_ins_t H5F_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t *rt_key_changed, haddr_t *new_node/*out*/); -static H5B_iterate_t H5F_istore_iter_allocated(H5F_t *f, void *left_key, haddr_t addr, +static H5B_iterate_t H5F_istore_iter_allocated(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr, void *right_key, void *_udata); -static H5B_iterate_t H5F_istore_iter_dump(H5F_t *f, void *left_key, haddr_t addr, +static H5B_iterate_t H5F_istore_iter_dump(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr, void *right_key, void *_udata); static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, void *_key); @@ -132,11 +132,11 @@ static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, void *_key); static herr_t H5F_istore_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata); -static haddr_t H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, +static haddr_t H5F_istore_get_addr(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const hssize_t offset[]); -static H5B_iterate_t H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t addr, +static H5B_iterate_t H5F_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr, void *_rt_key, void *_udata); -static H5B_ins_t H5F_istore_remove( H5F_t *f, haddr_t addr, void *_lt_key, +static H5B_ins_t H5F_istore_remove( H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_udata, void *_rt_key, hbool_t *rt_key_changed); @@ -387,7 +387,7 @@ done: *------------------------------------------------------------------------- */ static int -H5F_istore_cmp2(H5F_t UNUSED *f, void *_lt_key, void *_udata, +H5F_istore_cmp2(H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key; @@ -440,7 +440,7 @@ done: *------------------------------------------------------------------------- */ static int -H5F_istore_cmp3(H5F_t UNUSED *f, void *_lt_key, void *_udata, +H5F_istore_cmp3(H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key; @@ -489,7 +489,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_new_node(H5F_t *f, H5B_ins_t op, +H5F_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { @@ -511,7 +511,8 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op, /* Allocate new storage */ assert (udata->key.nbytes > 0); - if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); + if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage"); udata->addr = *addr_p; @@ -573,7 +574,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_found(H5F_t UNUSED *f, haddr_t addr, const void *_lt_key, +H5F_istore_found(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key, void *_udata, const void UNUSED *_rt_key) { H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata; @@ -641,7 +642,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, +H5F_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t UNUSED *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed, @@ -668,7 +669,7 @@ H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, assert(rt_key_changed); assert(new_node_p); - cmp = H5F_istore_cmp3(f, lt_key, udata, rt_key); + cmp = H5F_istore_cmp3(f, dxpl_id, lt_key, udata, rt_key); assert(cmp <= 0); if (cmp < 0) { @@ -698,9 +699,11 @@ H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, (hsize_t)lt_key->nbytes, (hsize_t)udata->key.nbytes))) HGOTO_ERROR (H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage"); #else /* OLD_WAY */ - if (H5MF_xfree(f, H5FD_MEM_DRAW, addr,(hsize_t)lt_key->nbytes)<0) + H5_CHECK_OVERFLOW( lt_key->nbytes ,size_t, hsize_t); + if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk"); - if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); + if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk"); #endif /* OLD_WAY */ lt_key->nbytes = udata->key.nbytes; @@ -733,7 +736,8 @@ H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, /* * Allocate storage for the new chunk */ - if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); + if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed"); udata->addr = *new_node_p; ret_value = H5B_INS_RIGHT; @@ -769,7 +773,7 @@ done: *------------------------------------------------------------------------- */ static H5B_iterate_t -H5F_istore_iter_allocated (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, +H5F_istore_iter_allocated (H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr, void UNUSED *_rt_key, void *_udata) { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; @@ -805,7 +809,7 @@ H5F_istore_iter_allocated (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, *------------------------------------------------------------------------- */ static H5B_iterate_t -H5F_istore_iter_dump (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, +H5F_istore_iter_dump (H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr, void UNUSED *_rt_key, void *_udata) { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; @@ -890,7 +894,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) +H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ H5F_istore_ud1_t udata; /*pass through B-tree */ @@ -898,8 +902,6 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) void *buf=NULL; /*temporary buffer */ size_t alloc; /*bytes allocated for BUF */ hbool_t point_of_no_return = FALSE; - H5Z_cb_t cb_struct={NULL,NULL}; - H5Z_EDC_t edc=H5Z_ENABLE_EDC; FUNC_ENTER_NOINIT(H5F_istore_flush_entry); @@ -921,6 +923,10 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) /* Should the chunk be filtered before writing it to disk? */ if (ent->pline && ent->pline->nfilters) { + H5P_genplist_t *plist; /* Data xfer property list */ + H5Z_cb_t cb_struct; + H5Z_EDC_t edc; + if (!reset) { /* * Copy the chunk to a new buffer before running it through @@ -947,6 +953,12 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) /* Don't know whether we should involve transfer property list. So * just pass in H5Z_ENABLE_EDC and default callback setting for data * read. */ + if (NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); + if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get edc information"); + if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get filter callback struct"); if (H5Z_pipeline(f, ent->pline, 0, &(udata.key.filter_mask), edc, cb_struct, &(udata.key.nbytes), &alloc, &buf)<0) { HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, @@ -958,9 +970,9 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) * Create the chunk it if it doesn't exist, or reallocate the chunk if * its size changed. Then write the data into the file. */ - if (H5B_insert(f, H5B_ISTORE, ent->layout->addr, ent->split_ratios, &udata)<0) + if (H5B_insert(f, dxpl_id, H5B_ISTORE, ent->layout->addr, ent->split_ratios, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); - if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0) + if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, buf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); /* Mark cache entry as clean */ @@ -1018,7 +1030,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_preempt(H5F_t *f, H5F_rdcc_ent_t * ent, hbool_t flush) +H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); herr_t ret_value=SUCCEED; /* Return value */ @@ -1032,7 +1044,7 @@ H5F_istore_preempt(H5F_t *f, H5F_rdcc_ent_t * ent, hbool_t flush) if(flush) { /* Flush */ - if(H5F_istore_flush_entry(f, ent, TRUE) < 0) + if(H5F_istore_flush_entry(f, dxpl_id, ent, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); } else { @@ -1086,7 +1098,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_flush (H5F_t *f, hbool_t preempt) +H5F_istore_flush (H5F_t *f, hid_t dxpl_id, hbool_t preempt) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; @@ -1098,10 +1110,10 @@ H5F_istore_flush (H5F_t *f, hbool_t preempt) for (ent=rdcc->head; ent; ent=next) { next = ent->next; if (preempt) { - if (H5F_istore_preempt(f, ent, TRUE )<0) + if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) nerrors++; } else { - if (H5F_istore_flush_entry(f, ent, FALSE)<0) + if (H5F_istore_flush_entry(f, dxpl_id, ent, FALSE)<0) nerrors++; } } @@ -1132,7 +1144,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_dest (H5F_t *f) +H5F_istore_dest (H5F_t *f, hid_t dxpl_id) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; @@ -1147,7 +1159,7 @@ H5F_istore_dest (H5F_t *f) HDfflush(stderr); #endif next = ent->next; - if (H5F_istore_preempt(f, ent, TRUE )<0) + if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) nerrors++; } if (nerrors) @@ -1180,7 +1192,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_prune (H5F_t *f, size_t size) +H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) { int i, j, nerrors=0; H5F_rdcc_t *rdcc = &(f->shared->rdcc); @@ -1259,7 +1271,7 @@ H5F_istore_prune (H5F_t *f, size_t size) if (n[j]==cur) n[j] = cur->next; } - if (H5F_istore_preempt(f, cur, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_id, cur, TRUE)<0) nerrors++; } } @@ -1331,7 +1343,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, herr_t status; /*func return status */ void *chunk=NULL; /*the file chunk */ void *ret_value; /*return value */ - H5P_genplist_t *plist=NULL; /* Property list */ + H5P_genplist_t *plist; /* Property list */ H5Z_EDC_t edc; H5Z_cb_t cb_struct; @@ -1399,7 +1411,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, H5_ASSIGN_OVERFLOW(chunk_size,tempchunk_size,hsize_t,size_t); udata.mesg = *layout; udata.addr = HADDR_UNDEF; - status = H5B_find (f, H5B_ISTORE, layout->addr, &udata); + status = H5B_find (f, dxpl_id, H5B_ISTORE, layout->addr, &udata); H5E_clear (); if (status>=0 && H5F_addr_defined(udata.addr)) { @@ -1413,7 +1425,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, chunk_alloc = udata.key.nbytes; if (NULL==(chunk = H5MM_malloc (chunk_alloc))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); - if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, chunk)<0) + if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get edc information"); @@ -1459,11 +1471,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HDputc('#', stderr); HDfflush(stderr); #endif - if (H5F_istore_preempt(f, ent, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_id, ent, TRUE)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache"); } - - if (H5F_istore_prune(f, chunk_size)<0) + if (H5F_istore_prune(f, dxpl_id, chunk_size)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache"); /* Create a new entry */ @@ -1629,7 +1640,7 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(plist!=NULL); H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(x.split_ratios)); - H5F_istore_flush_entry (f, &x, TRUE); + H5F_istore_flush_entry (f, dxpl_id, &x, TRUE); } else { if(chunk) H5MM_xfree (chunk); @@ -1763,7 +1774,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* Get the address of this chunk on disk */ - chunk_addr=H5F_istore_get_addr(f, layout, chunk_offset); + chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_offset); /* * If the chunk is too large to load into the cache and it has no @@ -1800,8 +1811,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, for (u=l.ndims; u-- > 0; /*void*/) l.dim[u] = layout->dim[u]; l.addr = chunk_addr; - if (H5F_arr_read(f, H5P_DATASET_XFER_DEFAULT, &l, dc_plist, - sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) + if (H5F_arr_read(f, dxpl_id, &l, dc_plist, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data from file"); } /* end if */ else { @@ -1945,7 +1955,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* Get the address of this chunk on disk */ - chunk_addr=H5F_istore_get_addr(f, layout, chunk_offset); + chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_offset); /* * If the chunk is too large to load into the cache and it has no @@ -1982,8 +1992,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, for (u=l.ndims; u-- > 0; /*void*/) l.dim[u] = layout->dim[u]; l.addr = chunk_addr; - if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &l, dc_plist, - sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) + if (H5F_arr_write(f, dxpl_id, &l, dc_plist, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); } /* end if */ else { @@ -2037,7 +2046,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ ) +H5F_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) { H5F_istore_ud1_t udata; #ifndef NDEBUG @@ -2057,7 +2066,7 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ ) #endif udata.mesg.ndims = layout->ndims; - if (H5B_create(f, H5B_ISTORE, &udata, &(layout->addr)/*out*/) < 0) + if (H5B_create(f, dxpl_id, H5B_ISTORE, &udata, &(layout->addr)/*out*/) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree"); done: @@ -2085,7 +2094,7 @@ done: *------------------------------------------------------------------------- */ hsize_t -H5F_istore_allocated(H5F_t *f, unsigned ndims, haddr_t addr) +H5F_istore_allocated(H5F_t *f, hid_t dxpl_id, unsigned ndims, haddr_t addr) { H5F_istore_ud1_t udata; hsize_t ret_value; /* Return value */ @@ -2094,7 +2103,7 @@ H5F_istore_allocated(H5F_t *f, unsigned ndims, haddr_t addr) HDmemset(&udata, 0, sizeof udata); udata.mesg.ndims = ndims; - if (H5B_iterate(f, H5B_ISTORE, H5F_istore_iter_allocated, addr, &udata)<0) + if (H5B_iterate(f, dxpl_id, H5B_ISTORE, H5F_istore_iter_allocated, addr, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree"); /* Set return value */ @@ -2124,7 +2133,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_dump_btree(H5F_t *f, FILE *stream, unsigned ndims, haddr_t addr) +H5F_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, haddr_t addr) { H5F_istore_ud1_t udata; herr_t ret_value=SUCCEED; /* Return value */ @@ -2136,7 +2145,7 @@ H5F_istore_dump_btree(H5F_t *f, FILE *stream, unsigned ndims, haddr_t addr) udata.stream = stream; if(stream) HDfprintf(stream, " Address: %a\n",addr); - if(H5B_iterate(f, H5B_ISTORE, H5F_istore_iter_dump, addr, &udata)<0) + if(H5B_iterate(f, dxpl_id, H5B_ISTORE, H5F_istore_iter_dump, addr, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree"); done: @@ -2225,7 +2234,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, +H5F_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, int ndims) { H5F_istore_ud1_t udata; @@ -2236,7 +2245,7 @@ H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, HDmemset (&udata, 0, sizeof udata); udata.mesg.ndims = ndims; - H5B_debug (f, addr, stream, indent, fwidth, H5B_ISTORE, &udata); + H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2262,7 +2271,7 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, +H5F_istore_get_addr(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const hssize_t offset[]) { H5F_istore_ud1_t udata; /* Information about a chunk */ @@ -2282,7 +2291,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, udata.addr = HADDR_UNDEF; /* Go get the chunk information */ - if (H5B_find (f, H5B_ISTORE, layout->addr, &udata)<0) { + if (H5B_find (f, dxpl_id, H5B_ISTORE, layout->addr, &udata)<0) { H5E_clear(); HGOTO_ERROR(H5E_BTREE,H5E_NOTFOUND,HADDR_UNDEF,"Can't locate chunk info"); } /* end if */ @@ -2478,7 +2487,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, while (carry==0) { /* Check if the chunk exists yet on disk */ chunk_exists=1; - if(H5F_istore_get_addr(f,layout,chunk_offset)==HADDR_UNDEF) { + if(H5F_istore_get_addr(f,dxpl_id,layout,chunk_offset)==HADDR_UNDEF) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); /*raw data chunk cache */ H5F_rdcc_ent_t *ent = NULL; /*cache entry */ @@ -2512,7 +2521,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, udata.key.offset[u] = chunk_offset[u]; /* Allocate the chunk with all processes */ - if (H5B_insert(f, H5B_ISTORE, layout->addr, split_ratios, &udata)<0) + if (H5B_insert(f, dxpl_id, H5B_ISTORE, layout->addr, split_ratios, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); /* Check if fill values should be written to blocks */ @@ -2673,7 +2682,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_prune_by_extent(H5F_t *f, const H5O_layout_t *layout, const H5S_t * space) +H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); /*raw data chunk cache */ H5F_rdcc_ent_t *ent = NULL, *next = NULL; /*cache entry */ @@ -2726,7 +2735,7 @@ H5F_istore_prune_by_extent(H5F_t *f, const H5O_layout_t *layout, const H5S_t * s #endif /* Preempt the entry from the cache, but do not flush it to disk */ - if(H5F_istore_preempt(f, ent, FALSE) < 0) + if(H5F_istore_preempt(f, dxpl_id, ent, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk"); } } @@ -2744,7 +2753,7 @@ H5F_istore_prune_by_extent(H5F_t *f, const H5O_layout_t *layout, const H5S_t * s udata.mesg.dim[u] = layout->dim[u]; udata.dims = curr_dims; - if(H5B_iterate(f, H5B_ISTORE, H5F_istore_prune_extent, layout->addr, &udata) < 0) + if(H5B_iterate(f, dxpl_id, H5B_ISTORE, H5F_istore_prune_extent, layout->addr, &udata) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over B-tree"); done: @@ -2770,7 +2779,7 @@ done: *------------------------------------------------------------------------- */ static H5B_iterate_t -H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t UNUSED addr, +H5F_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr, void UNUSED *_rt_key, void *_udata) { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; @@ -2802,7 +2811,7 @@ H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t UNUSED addr, udata.mesg = bt_udata->mesg; /* Remove */ - if(H5B_remove(f, H5B_ISTORE, bt_udata->mesg.addr, &udata) < 0) + if(H5B_remove(f, dxpl_id, H5B_ISTORE, bt_udata->mesg.addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to remove entry"); break; } /* end if */ @@ -2831,7 +2840,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5F_istore_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */ , +H5F_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out */ , hbool_t *lt_key_changed /*out */ , void UNUSED * _udata /*in,out */ , void UNUSED * _rt_key /*in,out */ , @@ -2842,7 +2851,7 @@ H5F_istore_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */ , FUNC_ENTER_NOAPI(H5F_istore_remove,H5B_INS_ERROR); - H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes); + H5FD_free(f->shared->lf, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes); *lt_key_changed = FALSE; *rt_key_changed = FALSE; @@ -2876,10 +2885,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_initialize_by_extent(H5F_t *f, const H5O_layout_t *layout, +H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, H5P_genplist_t *dc_plist, const H5S_t * space) { - hid_t dxpl_id; /*dataset transfer property list */ uint8_t *chunk = NULL; /*the file chunk */ unsigned idx_hint = 0; /*input value for H5F_istore_lock */ hssize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */ @@ -2930,9 +2938,6 @@ H5F_istore_initialize_by_extent(H5F_t *f, const H5O_layout_t *layout, size[i] = curr_dims[i]; size[i] = layout->dim[i]; - /* Default dataset transfer property list */ - dxpl_id = H5P_DATASET_XFER_DEFAULT; - /* Create a data space for a chunk & set the extent */ if(NULL == (space_chunk = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 239a187..c3366f2 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -140,6 +140,10 @@ #define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size" #define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t) #define H5D_XFER_HYPER_VECTOR_SIZE_DEF 1024 +/* Definitions for I/O transfer mode property */ +#define H5D_XFER_IO_XFER_MODE_NAME "io_xfer_mode" +#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t) +#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT /* Definitions for EDC property */ #define H5D_XFER_EDC_NAME "error-detecting" #define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t) @@ -167,10 +171,8 @@ typedef struct H5D_t { /* Functions defined in H5D.c */ H5_DLL herr_t H5D_init(void); -H5_DLL hid_t H5D_open(H5G_entry_t *ent); -H5_DLL herr_t H5D_close(H5D_t *dataset); -H5_DLL htri_t H5D_isa(H5G_entry_t *ent); -H5_DLL herr_t H5D_extend(H5D_t *dataset, const hsize_t *size); +H5_DLL hid_t H5D_open(H5G_entry_t *ent, hid_t dxpl_id); +H5_DLL htri_t H5D_isa(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL H5G_entry_t *H5D_entof(H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(H5D_t *dset); H5_DLL herr_t H5D_crt_copy(hid_t new_plist_t, hid_t old_plist_t, @@ -180,7 +182,7 @@ H5_DLL herr_t H5D_xfer_create(hid_t dxpl_id, void *create_data); H5_DLL herr_t H5D_xfer_copy(hid_t new_plist_id, hid_t old_plist_id, void *copy_data); H5_DLL herr_t H5D_xfer_close(hid_t dxpl_id, void *close_data); -H5_DLL herr_t H5D_flush(H5F_t *f); +H5_DLL herr_t H5D_flush(H5F_t *f, hid_t dxpl_id); #endif diff --git a/src/H5Dseq.c b/src/H5Dseq.c index 15cb668..fddf48f 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -176,7 +176,6 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, int i,j; /*counters */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; - H5P_genplist_t *plist=NULL; /* Property list */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -191,32 +190,25 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL - { - H5FD_mpio_dxpl_t *dx; + /* Get the transfer mode for MPIO transfers */ + if(IS_H5FD_MPIO(f)) { hid_t driver_id; /* VFL driver ID */ + H5P_genplist_t *plist; /* Property list */ - /* Get the transfer mode for MPIO transfers */ - if(IS_H5FD_MPIO(f)) { - /* Get the plist structure */ - if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get the driver ID */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - - /* Check if we are using the MPIO driver (for the DXPL) */ - if(H5FD_MPIO==driver_id) { - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &dx)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); - - /* Check if we are not using independent I/O */ - if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) - xfer_mode = dx->xfer_mode; - } /* end if */ + /* Get the plist structure */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get the driver ID */ + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + + /* Check if we are using the MPIO driver (for the DXPL) */ + if(H5FD_MPIO==driver_id) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ - } + } /* end if */ /* Collective MPIO access is unsupported for non-contiguous datasets */ if (H5D_CHUNKED==layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) @@ -563,7 +555,6 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, int i,j; /*counters */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; - H5P_genplist_t *plist=NULL; /* Property list */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -578,32 +569,25 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL - { - H5FD_mpio_dxpl_t *dx; + /* Get the transfer mode for MPIO transfers */ + if(IS_H5FD_MPIO(f)) { hid_t driver_id; /* VFL driver ID */ + H5P_genplist_t *plist=NULL; /* Property list */ + + /* Get the plist structure */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get the driver ID */ + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - /* Get the transfer mode for MPIO transfers */ - if(IS_H5FD_MPIO(f)) { - /* Get the plist structure */ - if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get the driver ID */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - - /* Check if we are using the MPIO driver (for the DXPL) */ - if(H5FD_MPIO==driver_id) { - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &dx)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); - - /* Check if we are not using independent I/O */ - if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) - xfer_mode = dx->xfer_mode; - } /* end if */ + /* Check if we are using the MPIO driver (for the DXPL) */ + if(H5FD_MPIO==driver_id) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ - } + } /* end if */ /* Collective MPIO access is unsupported for non-contiguous datasets */ if (H5D_CHUNKED==layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) diff --git a/src/H5F.c b/src/H5F.c index 34c0dc0..3ca2c30 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -63,12 +63,19 @@ typedef struct H5F_olist_t { } H5F_olist_t; /* PRIVATE PROTOTYPES */ +static H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id); +static herr_t H5F_close(H5F_t *f); +static herr_t H5F_close_all(void); +#ifdef NOT_YET +static herr_t H5F_flush_all(hbool_t invalidate); +static int H5F_flush_all_cb(H5F_t *f, hid_t fid, const void *_invalidate); +#endif /* NOT_YET */ static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id); -static herr_t H5F_dest(H5F_t *f); -static herr_t H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, +static herr_t H5F_dest(H5F_t *f, hid_t dxpl_id); +static herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, hbool_t invalidate, hbool_t alloc_only, hbool_t closing); -static haddr_t H5F_locate_signature(H5FD_t *file); -static int H5F_flush_all_cb(H5F_t *f, hid_t fid, const void *_invalidate); +static haddr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id); static herr_t H5F_get_objects(H5F_t *f, unsigned types, hid_t *obj_id_list, unsigned *obj_id_count); static herr_t H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); @@ -634,6 +641,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef NOT_YET /*------------------------------------------------------------------------- * Function: H5F_flush_all_cb @@ -691,6 +699,7 @@ H5F_flush_all(hbool_t invalidate) done: FUNC_LEAVE_NOAPI(ret_value); } +#endif /* NOT_YET */ /*------------------------------------------------------------------------- @@ -711,7 +720,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5F_close_all(void) { herr_t ret_value=SUCCEED; /* Return value */ @@ -725,6 +734,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef NOT_YET /*-------------------------------------------------------------------------- NAME @@ -759,6 +769,7 @@ H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l) #endif } +#endif /* NOT_YET */ /*------------------------------------------------------------------------- @@ -1293,7 +1304,7 @@ H5F_equal(void *_haystack, hid_t UNUSED id, const void *_needle) *------------------------------------------------------------------------- */ static haddr_t -H5F_locate_signature(H5FD_t *file) +H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) { haddr_t addr, eoa; uint8_t buf[H5F_SIGNATURE_LEN]; @@ -1318,7 +1329,7 @@ H5F_locate_signature(H5FD_t *file) addr = (8==n) ? 0 : (haddr_t)1 << n; if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature"); - if (H5FD_read(file, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, addr, H5F_SIGNATURE_LEN, buf)<0) + if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, H5F_SIGNATURE_LEN, buf)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature"); if (!HDmemcmp(buf, H5F_SIGNATURE, H5F_SIGNATURE_LEN)) break; @@ -1379,7 +1390,7 @@ H5Fis_hdf5(const char *name) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file"); /* The file is an hdf5 file if the hdf5 file signature can be found */ - ret_value = (HADDR_UNDEF!=H5F_locate_signature(file)); + ret_value = (HADDR_UNDEF!=H5F_locate_signature(file, H5AC_dxpl_id)); done: /* Close the file */ @@ -1547,7 +1558,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_dest(H5F_t *f) +H5F_dest(H5F_t *f, hid_t dxpl_id) { herr_t ret_value = SUCCEED; @@ -1567,11 +1578,11 @@ H5F_dest(H5F_t *f) H5FL_FREE(H5G_t,f->shared->root_grp); f->shared->root_grp=NULL; } - if (H5AC_dest(f)) { + if (H5AC_dest(f, dxpl_id)) { HERROR(H5E_FILE, H5E_CANTRELEASE, "problems closing file"); ret_value = FAIL; /*but keep going*/ } - if (H5F_istore_dest (f)<0) { + if (H5F_istore_dest (f, dxpl_id)<0) { HERROR(H5E_FILE, H5E_CANTRELEASE, "problems closing file"); ret_value = FAIL; /*but keep going*/ } @@ -1702,8 +1713,8 @@ done: * *------------------------------------------------------------------------- */ -H5F_t * -H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) +static H5F_t * +H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id) { H5F_t *file=NULL; /*the success return value */ H5F_t *ret_value; /*actual return value */ @@ -1868,19 +1879,19 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) shared->boot_addr = userblock_size; shared->base_addr = shared->boot_addr; shared->consist_flags = 0x03; - if (H5F_flush(file, H5F_SCOPE_LOCAL, FALSE, TRUE,FALSE)<0) + if (H5F_flush(file, dxpl_id, H5F_SCOPE_LOCAL, FALSE, TRUE,FALSE)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to write file superblock"); /* Create and open the root group */ - if (H5G_mkroot(file, NULL)<0) + if (H5G_mkroot(file, dxpl_id, NULL)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group"); } else if (1==shared->nrefs) { /* Read the superblock if it hasn't been read before. */ - if (HADDR_UNDEF==(shared->boot_addr=H5F_locate_signature(lf))) + if (HADDR_UNDEF==(shared->boot_addr=H5F_locate_signature(lf,dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL, "unable to find file signature"); if (H5FD_set_eoa(lf, shared->boot_addr+fixed_size)<0 || - H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, shared->boot_addr, fixed_size, buf)<0) + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->boot_addr, fixed_size, buf)<0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock"); /* Signature, already checked */ @@ -1968,7 +1979,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5G_SIZEOF_ENTRY(file); /*root group ptr*/ assert(variable_size<=sizeof(buf)); if (H5FD_set_eoa(lf, shared->boot_addr+fixed_size+variable_size)<0 || - H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, shared->boot_addr+fixed_size, variable_size, &buf[fixed_size])<0) + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->boot_addr+fixed_size, variable_size, &buf[fixed_size])<0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read superblock"); H5F_addr_decode(file, &p, &(shared->base_addr)/*out*/); H5F_addr_decode(file, &p, &(shared->freespace_addr)/*out*/); @@ -1989,7 +2000,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (H5F_addr_defined(shared->driver_addr)) { haddr_t drv_addr = shared->base_addr + shared->driver_addr; if (H5FD_set_eoa(lf, drv_addr+16)<0 || - H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, drv_addr, 16, buf)<0) + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, 16, buf)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read driver information block"); p = buf; @@ -2009,7 +2020,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Read driver information and decode */ if (H5FD_set_eoa(lf, drv_addr+16+driver_size)<0 || - H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, drv_addr+16, driver_size, &buf[16])<0) + H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr+16, driver_size, &buf[16])<0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read file driver information"); if (H5FD_sb_decode(lf, driver_name, &buf[16])<0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to decode driver information"); @@ -2025,7 +2036,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ /* Make sure we can open the root group */ - if (H5G_mkroot(file, &root_ent)<0) + if (H5G_mkroot(file, dxpl_id, &root_ent)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group"); /* @@ -2080,7 +2091,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) done: if (!ret_value && file) - H5F_dest(file); /* Don't indicate error here, to leave the error stack with the correct error */ + H5F_dest(file, dxpl_id); /* Don't indicate error here, to leave the error stack with the correct error */ FUNC_LEAVE_NOAPI(ret_value); } @@ -2184,7 +2195,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, /* * Create a new file or truncate an existing file. */ - if (NULL==(new_file=H5F_open(filename, flags, fcpl_id, fapl_id))) + if (NULL==(new_file=H5F_open(filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file"); /* Get an atom for the file */ @@ -2260,7 +2271,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list"); /* Open the file */ - if (NULL==(new_file=H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + if (NULL==(new_file=H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file"); /* Get an atom for the file */ @@ -2350,7 +2361,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file"); /* Flush the file */ - if (H5F_flush(f, scope, FALSE, FALSE, FALSE)<0) + if (H5F_flush(f, H5AC_dxpl_id, scope, FALSE, FALSE, FALSE)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "flush failed"); done: @@ -2409,7 +2420,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, +H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, hbool_t invalidate, hbool_t alloc_only, hbool_t closing) { uint8_t sbuf[1024]; /* Superblock encoding buffer */ @@ -2447,7 +2458,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, } if (H5F_SCOPE_DOWN==scope) { for (i=0; imtab.nmounts; i++) { - if (H5F_flush(f->mtab.child[i].file, scope, invalidate, FALSE, closing)<0) + if (H5F_flush(f->mtab.child[i].file, dxpl_id, scope, invalidate, FALSE, closing)<0) nerrors++; } } @@ -2455,7 +2466,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, /* Avoid flushing buffers & caches when alloc_only set */ if(!alloc_only) { /* flush any cached compact storage raw data */ - if (H5D_flush(f)<0) + if (H5D_flush(f, dxpl_id)<0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache"); /* If we are invalidating everything (which only happens just before @@ -2466,7 +2477,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, if(f->shared->lf->feature_flags&H5FD_FEAT_AGGREGATE_METADATA) { /* Return the unused portion of the metadata block to a free list */ if(f->shared->lf->eoma!=0) - if(H5FD_free(f->shared->lf,H5FD_MEM_DEFAULT,f->shared->lf->eoma,f->shared->lf->cur_meta_block_size)<0) + if(H5FD_free(f->shared->lf,H5FD_MEM_DEFAULT,dxpl_id,f->shared->lf->eoma,f->shared->lf->cur_meta_block_size)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free metadata block"); /* Reset metadata block information, just in case */ @@ -2476,7 +2487,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, if(f->shared->lf->feature_flags&H5FD_FEAT_AGGREGATE_SMALLDATA) { /* Return the unused portion of the "small data" block to a free list */ if(f->shared->lf->eosda!=0) - if(H5FD_free(f->shared->lf,H5FD_MEM_DRAW,f->shared->lf->eosda,f->shared->lf->cur_sdata_block_size)<0) + if(H5FD_free(f->shared->lf,H5FD_MEM_DRAW,dxpl_id,f->shared->lf->eosda,f->shared->lf->cur_sdata_block_size)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free 'small data' block"); /* Reset "small data" block information, just in case */ @@ -2488,7 +2499,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, /* flush the data sieve buffer, if we have a dirty one */ if(f->shared->sieve_buf && f->shared->sieve_dirty) { /* Write dirty data sieve buffer to file */ - if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, H5P_DATASET_XFER_DEFAULT, f->shared->sieve_buf)<0) + if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); /* Reset sieve buffer dirty flag */ @@ -2496,11 +2507,11 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, } /* end if */ /* flush the entire raw data cache */ - if (H5F_istore_flush (f, invalidate)<0) + if (H5F_istore_flush (f, dxpl_id, invalidate)<0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush raw data cache"); /* flush (and invalidate) the entire meta data cache */ - if (H5AC_flush(f, NULL, HADDR_UNDEF, invalidate)<0) + if (H5AC_flush(f, dxpl_id, NULL, HADDR_UNDEF, invalidate)<0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush meta data cache"); } /* end if */ @@ -2583,7 +2594,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, * format address zero. */ H5_CHECK_OVERFLOW(f->shared->base_addr,haddr_t,hsize_t); - addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, + addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, dxpl_id, ((hsize_t)f->shared->base_addr + superblock_size + driver_size)); if (HADDR_UNDEF==addr) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file space for userblock and/or superblock"); @@ -2606,7 +2617,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, /* Compare with current checksums */ if(chksum!=f->shared->boot_chksum) { /* Write superblock */ - if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, f->shared->boot_addr, superblock_size, sbuf)<0) + if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, dxpl_id, f->shared->boot_addr, superblock_size, sbuf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock"); /* Update checksum information if different */ @@ -2623,7 +2634,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, /* Compare with current checksums */ if(chksum!=f->shared->boot_chksum) { /* Write driver information block */ - if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, f->shared->base_addr+superblock_size, driver_size, dbuf)<0) + if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, dxpl_id, f->shared->base_addr+superblock_size, driver_size, dbuf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write driver information block"); /* Update checksum information if different */ @@ -2633,7 +2644,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, } /* end else */ /* Flush file buffers to disk */ - if (!alloc_only && H5FD_flush(f->shared->lf,closing)<0) + if (!alloc_only && H5FD_flush(f->shared->lf,dxpl_id,closing)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed"); /* Check flush errors for children - errors are already on the stack */ @@ -2676,7 +2687,7 @@ done: * Modified to use the virtual file layer. *------------------------------------------------------------------------- */ -herr_t +static herr_t H5F_close(H5F_t *f) { H5F_close_degree_t fc_degree; /* What action to take when closing the last file ID for a file */ @@ -2695,7 +2706,7 @@ H5F_close(H5F_t *f) */ if (f->nrefs>1) { /* Decrement reference counts */ - if (H5F_dest(f)<0) + if (H5F_dest(f, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file"); HGOTO_DONE(SUCCEED); } /* end if */ @@ -2830,7 +2841,7 @@ H5F_close(H5F_t *f) H5F_istore_stats(f, FALSE); /* Flush and destroy all caches */ - if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE, TRUE)<0) + if (H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL, TRUE, FALSE, TRUE)<0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); } /* end if */ @@ -2839,7 +2850,7 @@ H5F_close(H5F_t *f) * shared H5F_file_t struct. If the reference count for the H5F_file_t * struct reaches zero then destroy it also. */ - if (H5F_dest(f)<0) + if (H5F_dest(f,H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file"); done: @@ -2916,7 +2927,7 @@ done: */ static herr_t H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child, - hid_t UNUSED plist_id) + hid_t UNUSED plist_id, hid_t dxpl_id) { H5G_t *mount_point = NULL; /*mount point group */ H5G_entry_t *mp_ent = NULL; /*mount point symbol table entry*/ @@ -2940,7 +2951,7 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child, */ if (child->mtab.parent) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted"); - if (NULL==(mount_point=H5G_open(loc, name))) + if (NULL==(mount_point=H5G_open(loc, name, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found"); parent = H5G_fileof(mount_point); @@ -3037,7 +3048,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_unmount(H5G_entry_t *loc, const char *name) +H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id) { H5G_t *mounted = NULL; /*mount point group */ H5G_entry_t *mnt_ent = NULL; /*mounted symbol table entry */ @@ -3058,7 +3069,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name) * If we get the root group and the file has a parent in the mount tree, * then we must have found the mount point. */ - if (NULL==(mounted=H5G_open(loc, name))) + if (NULL==(mounted=H5G_open(loc, name, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found"); child = H5G_fileof(mounted); mnt_ent = H5G_entof(mounted); @@ -3311,7 +3322,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property list"); /* Do the mount */ - if (H5F_mount(loc, name, child, plist_id)<0) + if (H5F_mount(loc, name, child, plist_id, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file"); done: @@ -3356,7 +3367,7 @@ H5Funmount(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Unmount */ - if (H5F_unmount(loc, name)<0) + if (H5F_unmount(loc, name, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file"); done: @@ -3940,7 +3951,7 @@ H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/, *------------------------------------------------------------------------- */ herr_t -H5F_debug(H5F_t *f, haddr_t UNUSED addr, FILE * stream, int indent, +H5F_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE * stream, int indent, int fwidth) { hsize_t userblock_size; @@ -4021,7 +4032,7 @@ H5F_debug(H5F_t *f, haddr_t UNUSED addr, FILE * stream, int indent, "Root group symbol table entry:", f->shared->root_grp ? "" : "(none)"); if (f->shared->root_grp) { - H5G_ent_debug(f, H5G_entof(f->shared->root_grp), stream, + H5G_ent_debug(f, dxpl_id, H5G_entof(f->shared->root_grp), stream, indent+3, MAX(0, fwidth-3), HADDR_UNDEF); } diff --git a/src/H5FD.c b/src/H5FD.c index 7c2c701..c4ff8f8 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -33,7 +33,7 @@ static int interface_initialize_g = 0; /* static prototypes */ static herr_t H5FD_init_interface(void); static herr_t H5FD_free_cls(H5FD_class_t *cls); -static haddr_t H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size); +static haddr_t H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); /* Declare a free list to manage the H5FD_free_t struct */ H5FL_DEFINE(H5FD_free_t); @@ -596,32 +596,34 @@ done: * *------------------------------------------------------------------------- */ -void * -H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl) +herr_t +H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl) { void *new_dxpl = NULL; H5FD_class_t *driver=NULL; - void *ret_value; /* Return value */ + herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_dxpl_copy, NULL); + FUNC_ENTER_NOAPI(H5FD_dxpl_copy, FAIL); /* Check args */ if (NULL==(driver=H5I_object(driver_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver ID"); - if (!old_dxpl) - HGOTO_DONE(NULL); /*but no error*/ + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID"); - /* Allow the driver to copy or do it ourselves */ - if (driver->dxpl_copy) { - new_dxpl = (driver->dxpl_copy)(old_dxpl); - } else if (driver->dxpl_size>0) { - new_dxpl = H5MM_malloc(driver->dxpl_size); - HDmemcpy(new_dxpl, old_dxpl, driver->dxpl_size); - } else - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "no way to copy driver file access property list"); + /* Copy old dxpl, if one exists */ + if (old_dxpl) { + /* Allow the driver to copy or do it ourselves */ + if (driver->dxpl_copy) { + new_dxpl = (driver->dxpl_copy)(old_dxpl); + } else if (driver->dxpl_size>0) { + new_dxpl = H5MM_malloc(driver->dxpl_size); + assert(new_dxpl); + HDmemcpy(new_dxpl, old_dxpl, driver->dxpl_size); + } else + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "no way to copy driver file access property list"); + } /* end if */ - /* Set return value */ - ret_value=new_dxpl; + /* Set copied value */ + *copied_dxpl=new_dxpl; done: FUNC_LEAVE_NOAPI(ret_value); @@ -1171,7 +1173,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5FDalloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) +H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { haddr_t ret_value = HADDR_UNDEF; @@ -1185,9 +1187,14 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type"); if (size<=0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request"); + if (H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; + else + if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list"); /* Do the real work */ - if (HADDR_UNDEF==(ret_value=H5FD_alloc(file, type, size))) + if (HADDR_UNDEF==(ret_value=H5FD_alloc(file, type, dxpl_id, size))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory"); done: @@ -1214,7 +1221,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) +H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { haddr_t ret_value = HADDR_UNDEF; H5FD_mem_t mapped_type; @@ -1451,7 +1458,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) /* Check if the block asked for is too large for a metadata block */ if(size>=file->def_meta_block_size) { /* Allocate more room for this new block the regular way */ - new_meta=H5FD_real_alloc(file,type,size); + new_meta=H5FD_real_alloc(file,type,dxpl_id,size); /* Check if the new metadata is at the end of the current metadata block */ if(file->eoma+file->cur_meta_block_size==new_meta) { @@ -1470,7 +1477,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) } /* end if */ else { /* Allocate another metadata block */ - new_meta=H5FD_real_alloc(file,H5FD_MEM_DEFAULT,file->def_meta_block_size); + new_meta=H5FD_real_alloc(file,H5FD_MEM_DEFAULT,dxpl_id,file->def_meta_block_size); /* Check if the new metadata is at the end of the current metadata block */ if(file->eoma+file->cur_meta_block_size==new_meta) { @@ -1479,7 +1486,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) else { /* Return the unused portion of the metadata block to a free list */ if(file->eoma!=0) - if(H5FD_free(file,H5FD_MEM_DEFAULT,file->eoma,file->cur_meta_block_size)<0) + if(H5FD_free(file,H5FD_MEM_DEFAULT,dxpl_id,file->eoma,file->cur_meta_block_size)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free metadata block"); /* Point the metadata block at the newly allocated block */ @@ -1502,7 +1509,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) } /* end else */ } /* end if */ else { /* Allocate data the regular way */ - ret_value=H5FD_real_alloc(file,type,size); + ret_value=H5FD_real_alloc(file,type,dxpl_id,size); } /* end else */ } /* end if */ else { /* Allocate "raw" data */ @@ -1519,7 +1526,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) /* Check if the block asked for is too large for the "small data" block */ if(size>=file->def_sdata_block_size) { /* Allocate more room for this new block the regular way */ - new_data=H5FD_real_alloc(file,type,size); + new_data=H5FD_real_alloc(file,type,dxpl_id,size); /* Check if the new raw data is at the end of the current "small data" block */ if(file->eosda+file->cur_sdata_block_size==new_data) { @@ -1539,7 +1546,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) } /* end if */ else { /* Allocate another "small data" block */ - new_data=H5FD_real_alloc(file,type,file->def_sdata_block_size); + new_data=H5FD_real_alloc(file,type,dxpl_id,file->def_sdata_block_size); /* Check if the new raw data is at the end of the current "small data" block */ if(file->eosda+file->cur_sdata_block_size==new_data) { @@ -1548,7 +1555,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) else { /* Return the unused portion of the "small data" block to a free list */ if(file->eosda!=0) - if(H5FD_free(file,H5FD_MEM_DRAW,file->eosda,file->cur_sdata_block_size)<0) + if(H5FD_free(file,H5FD_MEM_DRAW,dxpl_id,file->eosda,file->cur_sdata_block_size)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free 'small data' block"); /* Point the "small data" block at the newly allocated block */ @@ -1571,7 +1578,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) } /* end else */ } /* end if */ else { /* Allocate data the regular way */ - ret_value=H5FD_real_alloc(file,type,size); + ret_value=H5FD_real_alloc(file,type,dxpl_id,size); } /* end else */ } /* end else */ @@ -1599,7 +1606,7 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) +H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { haddr_t ret_value = HADDR_UNDEF; @@ -1615,7 +1622,7 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) * marker */ if (file->cls->alloc) { - ret_value = (file->cls->alloc)(file, type, size); + ret_value = (file->cls->alloc)(file, type, dxpl_id, size); if (HADDR_UNDEF==ret_value) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed"); } else { @@ -1653,7 +1660,7 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) /* Free the wasted memory */ if (wasted) - H5FDfree(file, type, oldeoa, wasted); + H5FD_free(file, type, dxpl_id, oldeoa, wasted); #ifdef H5F_DEBUG if (file->alignment * file->threshold != 1 && H5DEBUG(F)) { @@ -1692,7 +1699,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FDfree(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) +H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1704,9 +1711,14 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer"); if (type<0 || type>=H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type"); + if (H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; + else + if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); /* Do the real work */ - if (H5FD_free(file, type, addr, size)<0) + if (H5FD_free(file, type, dxpl_id, addr, size)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file deallocation request failed"); done: @@ -1731,7 +1743,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_free(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) +H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { H5FD_mem_t mapped_type; herr_t ret_value=SUCCEED; /* Return value */ @@ -1812,7 +1824,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) H5_ASSIGN_OVERFLOW(tail_size,(file->accum_loc+file->accum_size)-tail_addr,haddr_t,size_t); /* Write out the part of the accumulator after the block to free */ - if (H5FD_write(file, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, tail_addr, tail_size, file->meta_accum+(tail_addr-file->accum_loc))<0) + if (H5FD_write(file, H5FD_MEM_DEFAULT, dxpl_id, tail_addr, tail_size, file->meta_accum+(tail_addr-file->accum_loc))<0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed"); } /* end if */ @@ -1937,7 +1949,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) } } } else if (file->cls->free) { - if ((file->cls->free)(file, type, addr, size)<0) + if ((file->cls->free)(file, type, dxpl_id, addr, size)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed"); } else { /* leak memory */ @@ -1967,7 +1979,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5FDrealloc(H5FD_t *file, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size, +H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size) { haddr_t ret_value=HADDR_UNDEF; @@ -1975,7 +1987,14 @@ H5FDrealloc(H5FD_t *file, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size, FUNC_ENTER_API(H5FDrealloc, HADDR_UNDEF); H5TRACE5("a","xMtahh",file,type,old_addr,old_size,new_size); - if (HADDR_UNDEF==(ret_value=H5FD_realloc(file, type, old_addr, old_size, new_size))) + /* Check args */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; + else + if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list"); + + if (HADDR_UNDEF==(ret_value=H5FD_realloc(file, type, dxpl_id, old_addr, old_size, new_size))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file reallocation request failed"); done: @@ -2001,7 +2020,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5FD_realloc(H5FD_t *file, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size, +H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size) { haddr_t new_addr=old_addr; @@ -2017,17 +2036,17 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size, } else if (0==old_size) { /* allocate memory */ assert(!H5F_addr_defined(old_addr)); - if (HADDR_UNDEF==(new_addr=H5FDalloc(file, type, new_size))) + if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed"); } else if (0==new_size) { /* free memory */ assert(H5F_addr_defined(old_addr)); - H5FDfree(file, type, old_addr, old_size); + H5FD_free(file, type, dxpl_id, old_addr, old_size); new_addr = HADDR_UNDEF; } else if (new_sizesizeof(size_t) and the @@ -2036,23 +2055,23 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size, * to move pieces of the realloced data through a fixed size buffer, etc. * -QAK, 6/20/01 */ - if (HADDR_UNDEF==(new_addr=H5FDalloc(file, type, new_size))) + if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed"); H5_CHECK_OVERFLOW(old_size,hsize_t,size_t); if (old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc((size_t)old_size))) { - H5FDfree(file, type, new_addr, new_size); + H5FD_free(file, type, dxpl_id, new_addr, new_size); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed"); } - if (H5FDread(file, type, H5P_DEFAULT, old_addr, (size_t)old_size, buf)<0 || - H5FDwrite(file, type, H5P_DEFAULT, new_addr, (size_t)old_size, buf)<0) { - H5FDfree(file, type, new_addr, new_size); + if (H5FD_read(file, type, dxpl_id, old_addr, (size_t)old_size, buf)<0 || + H5FD_write(file, type, dxpl_id, new_addr, (size_t)old_size, buf)<0) { + H5FD_free(file, type, dxpl_id, new_addr, new_size); H5MM_xfree(buf); HGOTO_ERROR(H5E_FILE, H5E_READERROR, HADDR_UNDEF, "unable to move file block"); } if (buf!=_buf) H5MM_xfree(buf); - H5FDfree(file, type, old_addr, old_size); + H5FD_free(file, type, dxpl_id, old_addr, old_size); } /* Set return value */ @@ -2846,7 +2865,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FDflush(H5FD_t *file, unsigned closing) +H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing) { herr_t ret_value=SUCCEED; /* Return value */ @@ -2856,9 +2875,14 @@ H5FDflush(H5FD_t *file, unsigned closing) /* Check args */ if (!file || !file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer"); + if (H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; + else + if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); /* Do the real work */ - if (H5FD_flush(file,closing)<0) + if (H5FD_flush(file,dxpl_id,closing)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file flush request failed"); done: @@ -2885,7 +2909,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_flush(H5FD_t *file, unsigned closing) +H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing) { herr_t ret_value=SUCCEED; /* Return value */ @@ -2897,14 +2921,14 @@ H5FD_flush(H5FD_t *file, unsigned closing) if((file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA) && file->accum_dirty && file->accum_size>0) { /* Flush the metadata contents */ /* Not certain if the type and dxpl should be the way they are... -QAK */ - if ((file->cls->write)(file, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, file->accum_loc, file->accum_size, file->meta_accum)<0) + if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver write request failed"); /* Reset the dirty flag */ file->accum_dirty=FALSE; } /* end if */ - if (file->cls->flush && (file->cls->flush)(file,closing)<0) + if (file->cls->flush && (file->cls->flush)(file,dxpl_id,closing)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed"); done: diff --git a/src/H5FDcore.c b/src/H5FDcore.c index fc56096..9ea8ada 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -78,7 +78,6 @@ typedef struct H5FD_core_fapl_t { static void *H5FD_core_fapl_get(H5FD_t *_file); static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_core_flush(H5FD_t *_file, unsigned closing); static herr_t H5FD_core_close(H5FD_t *_file); static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static haddr_t H5FD_core_get_eoa(H5FD_t *_file); @@ -89,6 +88,7 @@ static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd size_t size, void *buf); static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); +static herr_t H5FD_core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static const H5FD_class_t H5FD_core_g = { "core", /*name */ @@ -370,59 +370,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_flush - * - * Purpose: Flushes the file to backing store if there is any and if the - * dirty flag is set. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, October 15, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_core_flush(H5FD_t *_file, unsigned UNUSED closing) -{ - H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5FD_core_flush, FAIL); - - /* Write to backing store */ - if (file->dirty && file->fd>=0) { - haddr_t size = file->eof; - unsigned char *ptr = file->mem; - - if (0!=HDlseek(file->fd, (off_t)0, SEEK_SET)) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store"); - - while (size) { - ssize_t n; - - H5_CHECK_OVERFLOW(size,hsize_t,size_t); - n = HDwrite(file->fd, ptr, (size_t)size); - if (n<0 && EINTR==errno) - continue; - if (n<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "error writing backing store"); - ptr += (size_t)n; - size -= (size_t)n; - } - file->dirty = FALSE; - } - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - - -/*------------------------------------------------------------------------- * Function: H5FD_core_close * * Purpose: Closes the file. @@ -448,10 +395,6 @@ H5FD_core_close(H5FD_t *_file) FUNC_ENTER_NOAPI(H5FD_core_close, FAIL); - /* Flush */ - if (H5FD_core_flush(_file,TRUE)<0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file"); - /* Release resources */ if (file->fd>=0) HDclose(file->fd); @@ -790,3 +733,57 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had done: FUNC_LEAVE_NOAPI(ret_value); } + + +/*------------------------------------------------------------------------- + * Function: H5FD_core_flush + * + * Purpose: Flushes the file to backing store if there is any and if the + * dirty flag is set. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Friday, October 15, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned UNUSED closing) +{ + H5FD_core_t *file = (H5FD_core_t*)_file; + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5FD_core_flush, FAIL); + + /* Write to backing store */ + if (file->dirty && file->fd>=0) { + haddr_t size = file->eof; + unsigned char *ptr = file->mem; + + if (0!=HDlseek(file->fd, (off_t)0, SEEK_SET)) + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store"); + + while (size) { + ssize_t n; + + H5_CHECK_OVERFLOW(size,hsize_t,size_t); + n = HDwrite(file->fd, ptr, (size_t)size); + if (n<0 && EINTR==errno) + continue; + if (n<0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "error writing backing store"); + ptr += (size_t)n; + size -= (size_t)n; + } + file->dirty = FALSE; + } + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 831b60c..f181582 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -82,7 +82,7 @@ static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, ha size_t size, void *_buf/*out*/); static herr_t H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf); -static herr_t H5FD_family_flush(H5FD_t *_file,unsigned closing); +static herr_t H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); /* The class struct */ static const H5FD_class_t H5FD_family_g = { @@ -1117,7 +1117,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_flush(H5FD_t *_file, unsigned closing) +H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) { H5FD_family_t *file = (H5FD_family_t*)_file; int i, nerrors=0; @@ -1126,7 +1126,7 @@ H5FD_family_flush(H5FD_t *_file, unsigned closing) FUNC_ENTER_NOAPI(H5FD_family_flush, FAIL); for (i=0; inmembs; i++) - if (file->memb[i] && H5FDflush(file->memb[i],closing)<0) + if (file->memb[i] && H5FDflush(file->memb[i], dxpl_id, closing)<0) nerrors++; if (nerrors) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 736695d..ecf98ce 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -166,7 +166,7 @@ static H5FD_t *H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, static herr_t H5FD_log_close(H5FD_t *_file); static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_log_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size); +static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); static haddr_t H5FD_log_get_eoa(H5FD_t *_file); static herr_t H5FD_log_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_log_get_eof(H5FD_t *_file); @@ -175,7 +175,7 @@ static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr size_t size, void *buf); static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_log_flush(H5FD_t *_file, unsigned closing); +static herr_t H5FD_log_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); /* * The free list map which causes each request type to use no free lists @@ -610,9 +610,6 @@ H5FD_log_close(H5FD_t *_file) FUNC_ENTER_NOAPI(H5FD_log_close, FAIL); - if (H5FD_log_flush(_file,TRUE)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to flush file"); - #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags&H5FD_LOG_TIME_CLOSE) HDgettimeofday(&timeval_start,NULL); @@ -823,7 +820,7 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size) +H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { H5FD_log_t *file = (H5FD_log_t*)_file; haddr_t addr; @@ -1299,7 +1296,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_flush(H5FD_t *_file, unsigned UNUSED closing) +H5FD_log_flush(H5FD_t *_file, hid_t dxpl_id, unsigned UNUSED closing) { H5FD_log_t *file = (H5FD_log_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index fadb298..6f49e24 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -28,6 +28,7 @@ */ #include "H5private.h" /*library functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Dataset functions */ #include "H5Eprivate.h" /*error handling */ #include "H5Fprivate.h" /*files */ #include "H5FDprivate.h" /*file driver */ @@ -83,7 +84,7 @@ static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hadd size_t size, void *buf); static herr_t H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_mpio_flush(H5FD_t *_file, unsigned closing); +static herr_t H5FD_mpio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); /* MPIO-specific file access properties */ typedef struct H5FD_mpio_fapl_t { @@ -103,7 +104,7 @@ static const H5FD_class_t H5FD_mpio_g = { H5FD_mpio_fapl_get, /*fapl_get */ NULL, /*fapl_copy */ NULL, /*fapl_free */ - sizeof(H5FD_mpio_dxpl_t), /*dxpl_size */ + 0, /*dxpl_size */ NULL, /*dxpl_copy */ NULL, /*dxpl_free */ H5FD_mpio_open, /*open */ @@ -377,7 +378,6 @@ done: herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) { - H5FD_mpio_dxpl_t dx; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; @@ -393,10 +393,12 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) if (H5FD_MPIO_INDEPENDENT!=xfer_mode && H5FD_MPIO_COLLECTIVE!=xfer_mode) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode"); - /* Initialize driver-specific properties */ - dx.xfer_mode = xfer_mode; + /* Set the transfer mode */ + if (H5P_set(plist,H5D_XFER_IO_XFER_MODE_NAME,&xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); - ret_value= H5P_set_driver(plist, H5FD_MPIO, &dx); + /* Initialize driver-specific properties */ + ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL); done: FUNC_LEAVE_API(ret_value); @@ -426,7 +428,6 @@ done: herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/) { - H5FD_mpio_dxpl_t *dx; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ @@ -437,11 +438,11 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); if (H5FD_MPIO!=H5P_get_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if (NULL==(dx=H5P_get_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); + /* Get the transfer mode */ if (xfer_mode) - *xfer_mode = dx->xfer_mode; + if (H5P_get(plist,H5D_XFER_IO_XFER_MODE_NAME,xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value); @@ -1299,15 +1300,14 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add void *buf/*out*/) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - const H5FD_mpio_dxpl_t *dx=NULL; - H5FD_mpio_dxpl_t _dx; MPI_Offset mpi_off, mpi_disp; MPI_Status mpi_stat; int mpi_code; /* mpi return code */ MPI_Datatype buf_type, file_type; int size_i, bytes_read, n; unsigned use_view_this_time=0; - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist; /* Property list pointer */ + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /* I/O tranfer mode */ herr_t ret_value=SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_read, FAIL); @@ -1342,13 +1342,10 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* Obtain the data transfer properties */ if(NULL == (plist = H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); - if (H5FD_MPIO!=H5P_get_driver(plist)) { - _dx.xfer_mode = H5FD_MPIO_INDEPENDENT; /*the default*/ - dx = &_dx; - } else { - dx = H5P_get_driver_info(plist); - assert(dx); - } + if (H5FD_MPIO==H5P_get_driver(plist)) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + } /* end if */ /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1393,8 +1390,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add } /* end if */ /* Read the data. */ - assert(H5FD_MPIO_INDEPENDENT==dx->xfer_mode || H5FD_MPIO_COLLECTIVE==dx->xfer_mode); - if (H5FD_MPIO_INDEPENDENT==dx->xfer_mode) { + assert(H5FD_MPIO_INDEPENDENT==xfer_mode || H5FD_MPIO_COLLECTIVE==xfer_mode); + if (H5FD_MPIO_INDEPENDENT==xfer_mode) { if (MPI_SUCCESS!= (mpi_code=MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code); } else { @@ -1609,8 +1606,6 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - const H5FD_mpio_dxpl_t *dx=NULL; - H5FD_mpio_dxpl_t _dx; MPI_Offset mpi_off, mpi_disp; MPI_Status mpi_stat; MPI_Datatype buf_type, file_type; @@ -1618,7 +1613,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, int size_i, bytes_written; unsigned use_view_this_time=0; unsigned block_before_meta_write=0; /* Whether to block before a metadata write */ - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist; /* Property list pointer */ + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /* I/O tranfer mode */ herr_t ret_value=SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_write, FAIL); @@ -1653,13 +1649,10 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* Obtain the data transfer properties */ if(NULL == (plist = H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); - if (H5FD_MPIO!=H5P_get_driver(plist)) { - _dx.xfer_mode = H5FD_MPIO_INDEPENDENT; /*the default*/ - dx = &_dx; - } else { - dx = H5P_get_driver_info(plist); - assert(dx); - } + if (H5FD_MPIO==H5P_get_driver(plist)) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + } /* end if */ /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1735,8 +1728,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, } /* end if */ /* Write the data. */ - assert(H5FD_MPIO_INDEPENDENT==dx->xfer_mode || H5FD_MPIO_COLLECTIVE==dx->xfer_mode); - if (H5FD_MPIO_INDEPENDENT==dx->xfer_mode) { + assert(H5FD_MPIO_INDEPENDENT==xfer_mode || H5FD_MPIO_COLLECTIVE==xfer_mode); + if (H5FD_MPIO_INDEPENDENT==xfer_mode) { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code); @@ -1860,7 +1853,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_flush(H5FD_t *_file, unsigned closing) +H5FD_mpio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; int mpi_code; /* mpi return code */ diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index de55ccb..be66735 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -25,15 +25,6 @@ typedef enum H5FD_mpio_xfer_t { H5FD_MPIO_COLLECTIVE } H5FD_mpio_xfer_t; -/* - * MPIO-specific data transfer properties. This struct is here only because - * we need it in special case code throughout the library. Applications - * please use H5Pset_dxpl_mpio() instead. - */ -typedef struct H5FD_mpio_dxpl_t { - H5FD_mpio_xfer_t xfer_mode; /*collective or independent I/O */ -} H5FD_mpio_dxpl_t; - /* Macros */ #define IS_H5FD_MPIO(f) /* (H5F_t *f) */ \ diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 783beba..ee566e7 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -179,7 +179,7 @@ static herr_t H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, size_t size, void *buf); static herr_t H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_mpiposix_flush(H5FD_t *_file, unsigned closing); +static herr_t H5FD_mpiposix_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); /* MPIPOSIX-specific file access properties */ typedef struct H5FD_mpiposix_fapl_t { @@ -1266,7 +1266,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mpiposix_flush(H5FD_t *_file, unsigned UNUSED closing) +H5FD_mpiposix_flush(H5FD_t *_file, hid_t dxpl_id, unsigned UNUSED closing) { H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; #ifdef WIN32 diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 45ee689..c16c43a 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -123,14 +123,14 @@ static haddr_t H5FD_multi_get_eoa(H5FD_t *_file); static herr_t H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa); static haddr_t H5FD_multi_get_eof(H5FD_t *_file); static herr_t H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size); -static herr_t H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, haddr_t addr, +static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +static herr_t H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); static herr_t H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/); static herr_t H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf); -static herr_t H5FD_multi_flush(H5FD_t *_file, unsigned closing); +static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); /* The class struct */ static const H5FD_class_t H5FD_multi_g = { @@ -1267,10 +1267,6 @@ H5FD_multi_close(H5FD_t *_file) /* Clear the error stack */ H5Eclear(); - /* Flush our own data */ - if (H5FD_multi_flush(_file,TRUE)<0) - nerrors++; - /* Close as many members as possible */ ALL_MEMBERS(mt) { if (file->memb[mt]) { @@ -1579,7 +1575,7 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) *------------------------------------------------------------------------- */ static haddr_t -H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size) +H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { H5FD_multi_t *file = (H5FD_multi_t*)_file; H5FD_mem_t mmt; @@ -1589,7 +1585,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size) mmt = file->fa.memb_map[type]; if (H5FD_MEM_DEFAULT==mmt) mmt = type; - if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, size))) { + if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size))) { H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF); } addr += file->fa.memb_addr[mmt]; @@ -1615,7 +1611,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size) *------------------------------------------------------------------------- */ static herr_t -H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, haddr_t addr, hsize_t size) +H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { H5FD_multi_t *file = (H5FD_multi_t*)_file; H5FD_mem_t mmt; @@ -1628,7 +1624,7 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, haddr_t addr, hsize_t size) assert(addr>=file->fa.memb_addr[mmt]); assert(addr+size<=file->memb_next[mmt]); - return H5FDfree(file->memb[mmt], type, addr-file->fa.memb_addr[mmt], size); + return H5FDfree(file->memb[mmt], type, dxpl_id, addr-file->fa.memb_addr[mmt], size); } @@ -1760,7 +1756,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si *------------------------------------------------------------------------- */ static herr_t -H5FD_multi_flush(H5FD_t *_file, unsigned closing) +H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) { H5FD_multi_t *file = (H5FD_multi_t*)_file; H5FD_mem_t mt; @@ -1806,7 +1802,7 @@ H5FD_multi_flush(H5FD_t *_file, unsigned closing) for (mt=H5FD_MEM_SUPER; mtmemb[mt]) { H5E_BEGIN_TRY { - if (H5FDflush(file->memb[mt],closing)<0) nerrors++; + if (H5FDflush(file->memb[mt],dxpl_id,closing)<0) nerrors++; } H5E_END_TRY; } } diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 187af34..f64eecb 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -20,16 +20,16 @@ H5_DLL herr_t H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) H5_DLL void *H5FD_fapl_get(H5FD_t *file); H5_DLL void *H5FD_fapl_copy(hid_t driver_id, const void *fapl); H5_DLL herr_t H5FD_fapl_free(hid_t driver_id, void *fapl); -H5_DLL void *H5FD_dxpl_copy(hid_t driver_id, const void *dxpl); +H5_DLL herr_t H5FD_dxpl_copy(hid_t driver_id, const void *dxpl, void **copied_dxpl); H5_DLL herr_t H5FD_dxpl_free(hid_t driver_id, void *dxpl); H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); H5_DLL herr_t H5FD_close(H5FD_t *file); H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2); H5_DLL int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/); -H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size); -H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size); -H5_DLL haddr_t H5FD_realloc(H5FD_t *file, H5FD_mem_t type, haddr_t old_addr, +H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); +H5_DLL haddr_t H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size); H5_DLL haddr_t H5FD_get_eoa(H5FD_t *file); H5_DLL herr_t H5FD_set_eoa(H5FD_t *file, haddr_t addr); @@ -38,7 +38,7 @@ H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t ad void *buf/*out*/); H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5FD_flush(H5FD_t *file, unsigned closing); +H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle); diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 3cf1c94..a04efc1 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -140,8 +140,8 @@ typedef struct H5FD_class_t { herr_t (*close)(H5FD_t *file); int (*cmp)(const H5FD_t *f1, const H5FD_t *f2); herr_t (*query)(const H5FD_t *f1, unsigned long *flags); - haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hsize_t size); - herr_t (*free)(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size); + haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); + herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); haddr_t (*get_eoa)(H5FD_t *file); herr_t (*set_eoa)(H5FD_t *file, haddr_t addr); haddr_t (*get_eof)(H5FD_t *file); @@ -150,7 +150,7 @@ typedef struct H5FD_class_t { void *buffer); herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, const void *buffer); - herr_t (*flush)(H5FD_t *file, unsigned closing); + herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, unsigned closing); H5FD_mem_t fl_map[H5FD_MEM_NTYPES]; } H5FD_class_t; @@ -211,9 +211,9 @@ H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, H5_DLL herr_t H5FDclose(H5FD_t *file); H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2); H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags); -H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hsize_t size); -H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size); -H5_DLL haddr_t H5FDrealloc(H5FD_t *file, H5FD_mem_t type, haddr_t addr, +H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); +H5_DLL haddr_t H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t old_size, hsize_t new_size); H5_DLL haddr_t H5FDget_eoa(H5FD_t *file); H5_DLL herr_t H5FDset_eoa(H5FD_t *file, haddr_t eof); @@ -223,7 +223,7 @@ H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t add void *buf/*out*/); H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5FDflush(H5FD_t *file, unsigned closing); +H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing); #ifdef __cplusplus } diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index ecd4d62..5b82cb4 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -143,7 +143,7 @@ static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd size_t size, void *buf); static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_sec2_flush(H5FD_t *_file,unsigned closing); +static herr_t H5FD_sec2_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static const H5FD_class_t H5FD_sec2_g = { "sec2", /*name */ @@ -780,7 +780,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_flush(H5FD_t *_file, unsigned UNUSED closing) +H5FD_sec2_flush(H5FD_t *_file, hid_t dxpl_id, unsigned UNUSED closing) { H5FD_sec2_t *file = (H5FD_sec2_t*)_file; #ifdef WIN32 diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c index 480bf45..1200f6a 100644 --- a/src/H5FDsrb.c +++ b/src/H5FDsrb.c @@ -89,7 +89,7 @@ static herr_t H5FD_srb_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd size_t size, void *buf); static herr_t H5FD_srb_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_srb_flush(H5FD_t *_file, unsigned closing); +static herr_t H5FD_srb_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); /* The description of a file belonging to this driver. */ typedef struct H5FD_srb_t { @@ -759,7 +759,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_srb_flush(H5FD_t *_file, unsigned UNUSED closing) +H5FD_srb_flush(H5FD_t *_file, hid_t dxpl_id, unsigned UNUSED closing) { H5FD_srb_t *file = (H5FD_srb_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 311fb98..3b9aa41 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -142,7 +142,7 @@ static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_ size_t size, void *buf); static herr_t H5FD_stdio_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_stdio_flush(H5FD_t *_file, unsigned closing); +static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static const H5FD_class_t H5FD_stdio_g = { "stdio", /*name */ @@ -378,8 +378,6 @@ H5FD_stdio_close(H5FD_t *_file) /* Clear the error stack */ H5Eclear(); - if (H5FD_stdio_flush(_file,1)<0) - H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "flush failed", -1); if (fclose(file->fp) < 0) H5Epush_ret(func, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1); @@ -833,7 +831,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_flush(H5FD_t *_file, unsigned closing) +H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func="H5FD_stdio_flush"; /* Function Name for error reporting */ diff --git a/src/H5Farray.c b/src/H5Farray.c index bc82cf5..d5d251e 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -92,7 +92,6 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, struct H5O_efl_t efl; /* External File List info */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; - H5P_genplist_t *plist=NULL; /* Property list */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -113,32 +112,25 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, H5V_vector_cpy(layout->ndims, hslab_size, _hslab_size); #ifdef H5_HAVE_PARALLEL - { - H5FD_mpio_dxpl_t *dx; - hid_t driver_id; /* VFL driver ID */ - - /* Get the transfer mode for MPIO transfers */ - if(IS_H5FD_MPIO(f)) { - /* Get the plist structure */ - if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get the driver ID */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - - /* Check if we are using the MPIO driver (for the DXPL) */ - if(H5FD_MPIO==driver_id) { - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &dx)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); - - /* Check if we are not using independent I/O */ - if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) - xfer_mode = dx->xfer_mode; - } /* end if */ + /* Get the transfer mode for MPIO transfers */ + if(IS_H5FD_MPIO(f)) { + hid_t driver_id; /* VFL driver ID */ + H5P_genplist_t *plist; /* Property list */ + + /* Get the plist structure */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get the driver ID */ + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + + /* Check if we are using the MPIO driver (for the DXPL) */ + if(H5FD_MPIO==driver_id) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ - } + } /* end if */ /* Collective MPIO access is unsupported for non-contiguous datasets */ if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) @@ -334,7 +326,6 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, struct H5O_efl_t efl; /* External File List info */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; - H5P_genplist_t *plist=NULL; /* Property list */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -355,32 +346,25 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, H5V_vector_cpy(layout->ndims, hslab_size, _hslab_size); #ifdef H5_HAVE_PARALLEL - { - H5FD_mpio_dxpl_t *dx; + /* Get the transfer mode for MPIO transfers */ + if(IS_H5FD_MPIO(f)) { hid_t driver_id; /* VFL driver ID */ + H5P_genplist_t *plist; /* Property list */ - /* Get the transfer mode for MPIO transfers */ - if(IS_H5FD_MPIO(f)) { - /* Get the plist structure */ - if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get the driver ID */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - - /* Check if we are using the MPIO driver (for the DXPL) */ - if(H5FD_MPIO==driver_id) { - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &dx)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); - - /* Check if we are not using independent I/O */ - if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) - xfer_mode = dx->xfer_mode; - } /* end if */ + /* Get the plist structure */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get the driver ID */ + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + + /* Check if we are using the MPIO driver (for the DXPL) */ + if(H5FD_MPIO==driver_id) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ - } + } /* end if */ if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "collective access on non-contiguous datasets not supported yet"); diff --git a/src/H5Fistore.c b/src/H5Fistore.c index eefa690..ec233bf 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -108,23 +108,23 @@ typedef H5F_rdcc_ent_t *H5F_rdcc_ent_ptr_t; /* For free lists */ /* Private prototypes */ static size_t H5F_istore_sizeof_rkey(H5F_t *f, const void *_udata); -static herr_t H5F_istore_new_node(H5F_t *f, H5B_ins_t, void *_lt_key, +static herr_t H5F_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p /*out*/); -static int H5F_istore_cmp2(H5F_t *f, void *_lt_key, void *_udata, +static int H5F_istore_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); -static int H5F_istore_cmp3(H5F_t *f, void *_lt_key, void *_udata, +static int H5F_istore_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); -static herr_t H5F_istore_found(H5F_t *f, haddr_t addr, const void *_lt_key, +static herr_t H5F_istore_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key, void *_udata, const void *_rt_key); -static H5B_ins_t H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, +static H5B_ins_t H5F_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t *rt_key_changed, haddr_t *new_node/*out*/); -static H5B_iterate_t H5F_istore_iter_allocated(H5F_t *f, void *left_key, haddr_t addr, +static H5B_iterate_t H5F_istore_iter_allocated(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr, void *right_key, void *_udata); -static H5B_iterate_t H5F_istore_iter_dump(H5F_t *f, void *left_key, haddr_t addr, +static H5B_iterate_t H5F_istore_iter_dump(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr, void *right_key, void *_udata); static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, void *_key); @@ -132,11 +132,11 @@ static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, void *_key); static herr_t H5F_istore_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata); -static haddr_t H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, +static haddr_t H5F_istore_get_addr(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const hssize_t offset[]); -static H5B_iterate_t H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t addr, +static H5B_iterate_t H5F_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr, void *_rt_key, void *_udata); -static H5B_ins_t H5F_istore_remove( H5F_t *f, haddr_t addr, void *_lt_key, +static H5B_ins_t H5F_istore_remove( H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_udata, void *_rt_key, hbool_t *rt_key_changed); @@ -387,7 +387,7 @@ done: *------------------------------------------------------------------------- */ static int -H5F_istore_cmp2(H5F_t UNUSED *f, void *_lt_key, void *_udata, +H5F_istore_cmp2(H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key; @@ -440,7 +440,7 @@ done: *------------------------------------------------------------------------- */ static int -H5F_istore_cmp3(H5F_t UNUSED *f, void *_lt_key, void *_udata, +H5F_istore_cmp3(H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5F_istore_key_t *lt_key = (H5F_istore_key_t *) _lt_key; @@ -489,7 +489,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_new_node(H5F_t *f, H5B_ins_t op, +H5F_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { @@ -511,7 +511,8 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op, /* Allocate new storage */ assert (udata->key.nbytes > 0); - if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); + if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage"); udata->addr = *addr_p; @@ -573,7 +574,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_found(H5F_t UNUSED *f, haddr_t addr, const void *_lt_key, +H5F_istore_found(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key, void *_udata, const void UNUSED *_rt_key) { H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata; @@ -641,7 +642,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, +H5F_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t UNUSED *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed, @@ -668,7 +669,7 @@ H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, assert(rt_key_changed); assert(new_node_p); - cmp = H5F_istore_cmp3(f, lt_key, udata, rt_key); + cmp = H5F_istore_cmp3(f, dxpl_id, lt_key, udata, rt_key); assert(cmp <= 0); if (cmp < 0) { @@ -698,9 +699,11 @@ H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, (hsize_t)lt_key->nbytes, (hsize_t)udata->key.nbytes))) HGOTO_ERROR (H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage"); #else /* OLD_WAY */ - if (H5MF_xfree(f, H5FD_MEM_DRAW, addr,(hsize_t)lt_key->nbytes)<0) + H5_CHECK_OVERFLOW( lt_key->nbytes ,size_t, hsize_t); + if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk"); - if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); + if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk"); #endif /* OLD_WAY */ lt_key->nbytes = udata->key.nbytes; @@ -733,7 +736,8 @@ H5F_istore_insert(H5F_t *f, haddr_t addr, void *_lt_key, /* * Allocate storage for the new chunk */ - if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); + if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed"); udata->addr = *new_node_p; ret_value = H5B_INS_RIGHT; @@ -769,7 +773,7 @@ done: *------------------------------------------------------------------------- */ static H5B_iterate_t -H5F_istore_iter_allocated (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, +H5F_istore_iter_allocated (H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr, void UNUSED *_rt_key, void *_udata) { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; @@ -805,7 +809,7 @@ H5F_istore_iter_allocated (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, *------------------------------------------------------------------------- */ static H5B_iterate_t -H5F_istore_iter_dump (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, +H5F_istore_iter_dump (H5F_t UNUSED *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr, void UNUSED *_rt_key, void *_udata) { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; @@ -890,7 +894,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) +H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ H5F_istore_ud1_t udata; /*pass through B-tree */ @@ -898,8 +902,6 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) void *buf=NULL; /*temporary buffer */ size_t alloc; /*bytes allocated for BUF */ hbool_t point_of_no_return = FALSE; - H5Z_cb_t cb_struct={NULL,NULL}; - H5Z_EDC_t edc=H5Z_ENABLE_EDC; FUNC_ENTER_NOINIT(H5F_istore_flush_entry); @@ -921,6 +923,10 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) /* Should the chunk be filtered before writing it to disk? */ if (ent->pline && ent->pline->nfilters) { + H5P_genplist_t *plist; /* Data xfer property list */ + H5Z_cb_t cb_struct; + H5Z_EDC_t edc; + if (!reset) { /* * Copy the chunk to a new buffer before running it through @@ -947,6 +953,12 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) /* Don't know whether we should involve transfer property list. So * just pass in H5Z_ENABLE_EDC and default callback setting for data * read. */ + if (NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); + if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get edc information"); + if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get filter callback struct"); if (H5Z_pipeline(f, ent->pline, 0, &(udata.key.filter_mask), edc, cb_struct, &(udata.key.nbytes), &alloc, &buf)<0) { HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, @@ -958,9 +970,9 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) * Create the chunk it if it doesn't exist, or reallocate the chunk if * its size changed. Then write the data into the file. */ - if (H5B_insert(f, H5B_ISTORE, ent->layout->addr, ent->split_ratios, &udata)<0) + if (H5B_insert(f, dxpl_id, H5B_ISTORE, ent->layout->addr, ent->split_ratios, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); - if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0) + if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, buf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); /* Mark cache entry as clean */ @@ -1018,7 +1030,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_preempt(H5F_t *f, H5F_rdcc_ent_t * ent, hbool_t flush) +H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); herr_t ret_value=SUCCEED; /* Return value */ @@ -1032,7 +1044,7 @@ H5F_istore_preempt(H5F_t *f, H5F_rdcc_ent_t * ent, hbool_t flush) if(flush) { /* Flush */ - if(H5F_istore_flush_entry(f, ent, TRUE) < 0) + if(H5F_istore_flush_entry(f, dxpl_id, ent, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); } else { @@ -1086,7 +1098,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_flush (H5F_t *f, hbool_t preempt) +H5F_istore_flush (H5F_t *f, hid_t dxpl_id, hbool_t preempt) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; @@ -1098,10 +1110,10 @@ H5F_istore_flush (H5F_t *f, hbool_t preempt) for (ent=rdcc->head; ent; ent=next) { next = ent->next; if (preempt) { - if (H5F_istore_preempt(f, ent, TRUE )<0) + if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) nerrors++; } else { - if (H5F_istore_flush_entry(f, ent, FALSE)<0) + if (H5F_istore_flush_entry(f, dxpl_id, ent, FALSE)<0) nerrors++; } } @@ -1132,7 +1144,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_dest (H5F_t *f) +H5F_istore_dest (H5F_t *f, hid_t dxpl_id) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; @@ -1147,7 +1159,7 @@ H5F_istore_dest (H5F_t *f) HDfflush(stderr); #endif next = ent->next; - if (H5F_istore_preempt(f, ent, TRUE )<0) + if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) nerrors++; } if (nerrors) @@ -1180,7 +1192,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_prune (H5F_t *f, size_t size) +H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) { int i, j, nerrors=0; H5F_rdcc_t *rdcc = &(f->shared->rdcc); @@ -1259,7 +1271,7 @@ H5F_istore_prune (H5F_t *f, size_t size) if (n[j]==cur) n[j] = cur->next; } - if (H5F_istore_preempt(f, cur, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_id, cur, TRUE)<0) nerrors++; } } @@ -1331,7 +1343,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, herr_t status; /*func return status */ void *chunk=NULL; /*the file chunk */ void *ret_value; /*return value */ - H5P_genplist_t *plist=NULL; /* Property list */ + H5P_genplist_t *plist; /* Property list */ H5Z_EDC_t edc; H5Z_cb_t cb_struct; @@ -1399,7 +1411,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, H5_ASSIGN_OVERFLOW(chunk_size,tempchunk_size,hsize_t,size_t); udata.mesg = *layout; udata.addr = HADDR_UNDEF; - status = H5B_find (f, H5B_ISTORE, layout->addr, &udata); + status = H5B_find (f, dxpl_id, H5B_ISTORE, layout->addr, &udata); H5E_clear (); if (status>=0 && H5F_addr_defined(udata.addr)) { @@ -1413,7 +1425,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, chunk_alloc = udata.key.nbytes; if (NULL==(chunk = H5MM_malloc (chunk_alloc))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); - if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, chunk)<0) + if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get edc information"); @@ -1459,11 +1471,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HDputc('#', stderr); HDfflush(stderr); #endif - if (H5F_istore_preempt(f, ent, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_id, ent, TRUE)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache"); } - - if (H5F_istore_prune(f, chunk_size)<0) + if (H5F_istore_prune(f, dxpl_id, chunk_size)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache"); /* Create a new entry */ @@ -1629,7 +1640,7 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(plist!=NULL); H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(x.split_ratios)); - H5F_istore_flush_entry (f, &x, TRUE); + H5F_istore_flush_entry (f, dxpl_id, &x, TRUE); } else { if(chunk) H5MM_xfree (chunk); @@ -1763,7 +1774,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* Get the address of this chunk on disk */ - chunk_addr=H5F_istore_get_addr(f, layout, chunk_offset); + chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_offset); /* * If the chunk is too large to load into the cache and it has no @@ -1800,8 +1811,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, for (u=l.ndims; u-- > 0; /*void*/) l.dim[u] = layout->dim[u]; l.addr = chunk_addr; - if (H5F_arr_read(f, H5P_DATASET_XFER_DEFAULT, &l, dc_plist, - sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) + if (H5F_arr_read(f, dxpl_id, &l, dc_plist, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data from file"); } /* end if */ else { @@ -1945,7 +1955,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* Get the address of this chunk on disk */ - chunk_addr=H5F_istore_get_addr(f, layout, chunk_offset); + chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_offset); /* * If the chunk is too large to load into the cache and it has no @@ -1982,8 +1992,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, for (u=l.ndims; u-- > 0; /*void*/) l.dim[u] = layout->dim[u]; l.addr = chunk_addr; - if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &l, dc_plist, - sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) + if (H5F_arr_write(f, dxpl_id, &l, dc_plist, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); } /* end if */ else { @@ -2037,7 +2046,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ ) +H5F_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) { H5F_istore_ud1_t udata; #ifndef NDEBUG @@ -2057,7 +2066,7 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ ) #endif udata.mesg.ndims = layout->ndims; - if (H5B_create(f, H5B_ISTORE, &udata, &(layout->addr)/*out*/) < 0) + if (H5B_create(f, dxpl_id, H5B_ISTORE, &udata, &(layout->addr)/*out*/) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree"); done: @@ -2085,7 +2094,7 @@ done: *------------------------------------------------------------------------- */ hsize_t -H5F_istore_allocated(H5F_t *f, unsigned ndims, haddr_t addr) +H5F_istore_allocated(H5F_t *f, hid_t dxpl_id, unsigned ndims, haddr_t addr) { H5F_istore_ud1_t udata; hsize_t ret_value; /* Return value */ @@ -2094,7 +2103,7 @@ H5F_istore_allocated(H5F_t *f, unsigned ndims, haddr_t addr) HDmemset(&udata, 0, sizeof udata); udata.mesg.ndims = ndims; - if (H5B_iterate(f, H5B_ISTORE, H5F_istore_iter_allocated, addr, &udata)<0) + if (H5B_iterate(f, dxpl_id, H5B_ISTORE, H5F_istore_iter_allocated, addr, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree"); /* Set return value */ @@ -2124,7 +2133,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_dump_btree(H5F_t *f, FILE *stream, unsigned ndims, haddr_t addr) +H5F_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, haddr_t addr) { H5F_istore_ud1_t udata; herr_t ret_value=SUCCEED; /* Return value */ @@ -2136,7 +2145,7 @@ H5F_istore_dump_btree(H5F_t *f, FILE *stream, unsigned ndims, haddr_t addr) udata.stream = stream; if(stream) HDfprintf(stream, " Address: %a\n",addr); - if(H5B_iterate(f, H5B_ISTORE, H5F_istore_iter_dump, addr, &udata)<0) + if(H5B_iterate(f, dxpl_id, H5B_ISTORE, H5F_istore_iter_dump, addr, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree"); done: @@ -2225,7 +2234,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, +H5F_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, int ndims) { H5F_istore_ud1_t udata; @@ -2236,7 +2245,7 @@ H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, HDmemset (&udata, 0, sizeof udata); udata.mesg.ndims = ndims; - H5B_debug (f, addr, stream, indent, fwidth, H5B_ISTORE, &udata); + H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2262,7 +2271,7 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, +H5F_istore_get_addr(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const hssize_t offset[]) { H5F_istore_ud1_t udata; /* Information about a chunk */ @@ -2282,7 +2291,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, udata.addr = HADDR_UNDEF; /* Go get the chunk information */ - if (H5B_find (f, H5B_ISTORE, layout->addr, &udata)<0) { + if (H5B_find (f, dxpl_id, H5B_ISTORE, layout->addr, &udata)<0) { H5E_clear(); HGOTO_ERROR(H5E_BTREE,H5E_NOTFOUND,HADDR_UNDEF,"Can't locate chunk info"); } /* end if */ @@ -2478,7 +2487,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, while (carry==0) { /* Check if the chunk exists yet on disk */ chunk_exists=1; - if(H5F_istore_get_addr(f,layout,chunk_offset)==HADDR_UNDEF) { + if(H5F_istore_get_addr(f,dxpl_id,layout,chunk_offset)==HADDR_UNDEF) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); /*raw data chunk cache */ H5F_rdcc_ent_t *ent = NULL; /*cache entry */ @@ -2512,7 +2521,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, udata.key.offset[u] = chunk_offset[u]; /* Allocate the chunk with all processes */ - if (H5B_insert(f, H5B_ISTORE, layout->addr, split_ratios, &udata)<0) + if (H5B_insert(f, dxpl_id, H5B_ISTORE, layout->addr, split_ratios, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); /* Check if fill values should be written to blocks */ @@ -2673,7 +2682,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_prune_by_extent(H5F_t *f, const H5O_layout_t *layout, const H5S_t * space) +H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); /*raw data chunk cache */ H5F_rdcc_ent_t *ent = NULL, *next = NULL; /*cache entry */ @@ -2726,7 +2735,7 @@ H5F_istore_prune_by_extent(H5F_t *f, const H5O_layout_t *layout, const H5S_t * s #endif /* Preempt the entry from the cache, but do not flush it to disk */ - if(H5F_istore_preempt(f, ent, FALSE) < 0) + if(H5F_istore_preempt(f, dxpl_id, ent, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk"); } } @@ -2744,7 +2753,7 @@ H5F_istore_prune_by_extent(H5F_t *f, const H5O_layout_t *layout, const H5S_t * s udata.mesg.dim[u] = layout->dim[u]; udata.dims = curr_dims; - if(H5B_iterate(f, H5B_ISTORE, H5F_istore_prune_extent, layout->addr, &udata) < 0) + if(H5B_iterate(f, dxpl_id, H5B_ISTORE, H5F_istore_prune_extent, layout->addr, &udata) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over B-tree"); done: @@ -2770,7 +2779,7 @@ done: *------------------------------------------------------------------------- */ static H5B_iterate_t -H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t UNUSED addr, +H5F_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr, void UNUSED *_rt_key, void *_udata) { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; @@ -2802,7 +2811,7 @@ H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t UNUSED addr, udata.mesg = bt_udata->mesg; /* Remove */ - if(H5B_remove(f, H5B_ISTORE, bt_udata->mesg.addr, &udata) < 0) + if(H5B_remove(f, dxpl_id, H5B_ISTORE, bt_udata->mesg.addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to remove entry"); break; } /* end if */ @@ -2831,7 +2840,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5F_istore_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */ , +H5F_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out */ , hbool_t *lt_key_changed /*out */ , void UNUSED * _udata /*in,out */ , void UNUSED * _rt_key /*in,out */ , @@ -2842,7 +2851,7 @@ H5F_istore_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */ , FUNC_ENTER_NOAPI(H5F_istore_remove,H5B_INS_ERROR); - H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes); + H5FD_free(f->shared->lf, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes); *lt_key_changed = FALSE; *rt_key_changed = FALSE; @@ -2876,10 +2885,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_initialize_by_extent(H5F_t *f, const H5O_layout_t *layout, +H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, H5P_genplist_t *dc_plist, const H5S_t * space) { - hid_t dxpl_id; /*dataset transfer property list */ uint8_t *chunk = NULL; /*the file chunk */ unsigned idx_hint = 0; /*input value for H5F_istore_lock */ hssize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */ @@ -2930,9 +2938,6 @@ H5F_istore_initialize_by_extent(H5F_t *f, const H5O_layout_t *layout, size[i] = curr_dims[i]; size[i] = layout->dim[i]; - /* Default dataset transfer property list */ - dxpl_id = H5P_DATASET_XFER_DEFAULT; - /* Create a data space for a chunk & set the extent */ if(NULL == (space_chunk = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 9326060..aab992a 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -176,24 +176,17 @@ H5_DLLVAR hbool_t H5_mpiposix_1_metawrite_g; #endif /* H5_HAVE_PARALLEL */ /* Private functions, not part of the publicly documented API */ -H5_DLL void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, - uint8_t *l); -H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id); -H5_DLL herr_t H5F_close(H5F_t *f); -H5_DLL herr_t H5F_close_all(void); -H5_DLL herr_t H5F_flush_all(hbool_t invalidate); -H5_DLL herr_t H5F_debug(H5F_t *f, haddr_t addr, FILE * stream, - int indent, int fwidth); -H5_DLL herr_t H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, - int indent, int fwidth, int ndims); +#ifdef NOT_YET +H5_DLL void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l); +#endif /* NOT_YET */ H5_DLL herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/); +H5_DLL herr_t H5F_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, + int indent, int fwidth); /* Functions that operate on indexed storage */ H5_DLL herr_t H5F_istore_init (H5F_t *f); -H5_DLL herr_t H5F_istore_flush (H5F_t *f, hbool_t preempt); -H5_DLL herr_t H5F_istore_dest (H5F_t *f); -H5_DLL herr_t H5F_istore_stats (H5F_t *f, hbool_t headers); +H5_DLL herr_t H5F_istore_flush (H5F_t *f, hid_t dxpl_id, hbool_t preempt); +H5_DLL herr_t H5F_istore_dest (H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5F_istore_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, struct H5P_genplist_t *dc_plist, @@ -206,14 +199,15 @@ H5_DLL herr_t H5F_istore_write(H5F_t *f, hid_t dxpl_id, const hsize_t size_m[], const hssize_t offset_m[], const hssize_t offset[], const hsize_t size[], const void *buf); +H5_DLL herr_t H5F_istore_stats (H5F_t *f, hbool_t headers); +H5_DLL herr_t H5F_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, + int indent, int fwidth, int ndims); /* Functions that operate on contiguous storage wrt boot block */ H5_DLL herr_t H5F_contig_read(H5F_t *f, hsize_t max_data, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, void *_buf/*out*/); H5_DLL herr_t H5F_contig_write(H5F_t *f, hsize_t max_data, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, const void *buf); - -/* Functions that operate on contiguous storage wrt boot block */ H5_DLL herr_t H5F_contig_readv(H5F_t *f, hsize_t max_data, H5FD_mem_t type, haddr_t addr, size_t nseq, size_t size[], hsize_t offset[], hid_t dxpl_id, void *_buf/*out*/); H5_DLL herr_t H5F_contig_writev(H5F_t *f, hsize_t max_data, H5FD_mem_t type, haddr_t addr, diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 395b5e2..746b40f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -434,17 +434,17 @@ H5_DLL herr_t H5F_contig_fill(H5F_t *f, hid_t dxpl_id, const struct H5O_fill_t *fill, size_t elmt_size); /* Functions that operate on indexed storage */ -H5_DLL herr_t H5F_istore_create(H5F_t *f, +H5_DLL herr_t H5F_istore_create(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout/*in,out*/); H5_DLL herr_t H5F_istore_allocate (H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, const hsize_t *space_dim, struct H5P_genplist_t *dc_plist, hbool_t full_overwrite); -H5_DLL hsize_t H5F_istore_allocated(H5F_t *f, unsigned ndims, haddr_t addr); -H5_DLL herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, unsigned ndims, +H5_DLL hsize_t H5F_istore_allocated(H5F_t *f, hid_t dxpl_id, unsigned ndims, haddr_t addr); +H5_DLL herr_t H5F_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, haddr_t addr); -H5_DLL herr_t H5F_istore_prune_by_extent( H5F_t *f, +H5_DLL herr_t H5F_istore_prune_by_extent( H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, const struct H5S_t *space); -H5_DLL herr_t H5F_istore_initialize_by_extent( H5F_t *f, +H5_DLL herr_t H5F_istore_initialize_by_extent( H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, struct H5P_genplist_t *dc_plist, const struct H5S_t *space ); diff --git a/src/H5Fseq.c b/src/H5Fseq.c index 15cb668..fddf48f 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -176,7 +176,6 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, int i,j; /*counters */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; - H5P_genplist_t *plist=NULL; /* Property list */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -191,32 +190,25 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL - { - H5FD_mpio_dxpl_t *dx; + /* Get the transfer mode for MPIO transfers */ + if(IS_H5FD_MPIO(f)) { hid_t driver_id; /* VFL driver ID */ + H5P_genplist_t *plist; /* Property list */ - /* Get the transfer mode for MPIO transfers */ - if(IS_H5FD_MPIO(f)) { - /* Get the plist structure */ - if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get the driver ID */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - - /* Check if we are using the MPIO driver (for the DXPL) */ - if(H5FD_MPIO==driver_id) { - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &dx)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); - - /* Check if we are not using independent I/O */ - if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) - xfer_mode = dx->xfer_mode; - } /* end if */ + /* Get the plist structure */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get the driver ID */ + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + + /* Check if we are using the MPIO driver (for the DXPL) */ + if(H5FD_MPIO==driver_id) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ - } + } /* end if */ /* Collective MPIO access is unsupported for non-contiguous datasets */ if (H5D_CHUNKED==layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) @@ -563,7 +555,6 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, int i,j; /*counters */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; - H5P_genplist_t *plist=NULL; /* Property list */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -578,32 +569,25 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL - { - H5FD_mpio_dxpl_t *dx; + /* Get the transfer mode for MPIO transfers */ + if(IS_H5FD_MPIO(f)) { hid_t driver_id; /* VFL driver ID */ + H5P_genplist_t *plist=NULL; /* Property list */ + + /* Get the plist structure */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get the driver ID */ + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - /* Get the transfer mode for MPIO transfers */ - if(IS_H5FD_MPIO(f)) { - /* Get the plist structure */ - if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get the driver ID */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); - - /* Check if we are using the MPIO driver (for the DXPL) */ - if(H5FD_MPIO==driver_id) { - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &dx)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); - - /* Check if we are not using independent I/O */ - if(H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) - xfer_mode = dx->xfer_mode; - } /* end if */ + /* Check if we are using the MPIO driver (for the DXPL) */ + if(H5FD_MPIO==driver_id) { + /* Get the transfer mode */ + xfer_mode=H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); } /* end if */ - } + } /* end if */ /* Collective MPIO access is unsupported for non-contiguous datasets */ if (H5D_CHUNKED==layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) diff --git a/src/H5G.c b/src/H5G.c index 992c639..9e7095b 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -131,9 +131,29 @@ H5FL_DEFINE(H5G_t); H5FL_BLK_EXTERN(str_buf); /* Private prototypes */ +static H5G_t *H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id); +#ifdef NOT_YET +static H5G_t *H5G_reopen(H5G_t *grp); +#endif /* NOT_YET */ +static htri_t H5G_isa(H5G_entry_t *ent, hid_t dxpl_id); +static herr_t H5G_link(H5G_entry_t *cur_loc, const char *cur_name, + H5G_entry_t *new_loc, const char *new_name, + H5G_link_t type, unsigned namei_flags, hid_t dxpl_id); +static herr_t H5G_linkval(H5G_entry_t *loc, const char *name, size_t size, + char *buf/*out*/, hid_t dxpl_id); +static herr_t H5G_move(H5G_entry_t *src_loc, const char *src_name, + H5G_entry_t *dst_loc, const char *dst_name, hid_t dxpl_it); +static herr_t H5G_unlink(H5G_entry_t *loc, const char *name, hid_t dxpl_id); +static herr_t H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs, hid_t dxpl_id); +static ssize_t H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size, hid_t dxpl_id); +static int H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id); static herr_t H5G_replace_ent(void *obj_ptr, hid_t obj_id, const void *key); static herr_t H5G_traverse_slink(H5G_entry_t *grp_ent/*in,out*/, - H5G_entry_t *obj_ent/*in,out*/, int *nlinks/*in,out*/); + H5G_entry_t *obj_ent/*in,out*/, int *nlinks/*in,out*/, hid_t dxpl_id); +static herr_t H5G_set_comment(H5G_entry_t *loc, const char *name, + const char *buf, hid_t dxpl_id); +static int H5G_get_comment(H5G_entry_t *loc, const char *name, + size_t bufsize, char *buf, hid_t dxpl_id); /*------------------------------------------------------------------------- @@ -182,7 +202,7 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); /* Create the group */ - if (NULL == (grp = H5G_create(loc, name, size_hint))) + if (NULL == (grp = H5G_create(loc, name, size_hint, H5AC_dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group"); if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group"); @@ -233,7 +253,7 @@ H5Gopen(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Open the group */ - if (NULL == (grp = H5G_open(loc, name))) + if (NULL == (grp = H5G_open(loc, name, H5AC_dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group"); /* Register an atom for the group */ if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0) @@ -341,7 +361,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx, * Open the group on which to operate. We also create a group ID which * we can pass to the application-defined operator. */ - if (NULL==(udata.group = H5G_open (loc, name))) + if (NULL==(udata.group = H5G_open (loc, name, H5AC_dxpl_id))) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to open group"); if ((udata.group_id=H5I_register (H5I_GROUP, udata.group))<0) { H5G_close(udata.group); @@ -357,7 +377,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx, udata.final_ent = 0; /* Iterate over the group members */ - if ((ret_value = H5B_iterate (H5G_fileof(udata.group), H5B_SNODE, + if ((ret_value = H5B_iterate (H5G_fileof(udata.group), H5AC_dxpl_id, H5B_SNODE, H5G_node_iterate, udata.group->ent.cache.stab.btree_addr, &udata))<0) HERROR (H5E_SYM, H5E_CANTINIT, "iteration operator failed"); @@ -404,7 +424,7 @@ H5Gget_num_objs(hid_t group_id, hsize_t *num_objs) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "nil pointer"); /* Call private function. */ - ret_value = H5G_get_num_objs(group, num_objs); + ret_value = H5G_get_num_objs(group, num_objs, H5AC_dxpl_id); done: FUNC_LEAVE_API(ret_value); @@ -451,13 +471,13 @@ H5Gget_objname_by_idx(hid_t group_id, hsize_t idx, char *name, size_t size) if (!name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "nil pointer for name"); - if (H5G_get_num_objs(group, &num_objs)<0) + if (H5G_get_num_objs(group, &num_objs, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to retrieve number of members"); if(idx >= num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound"); /*call private function*/ - ret_value = H5G_get_objname_by_idx(group, idx, name, size); + ret_value = H5G_get_objname_by_idx(group, idx, name, size, H5AC_dxpl_id); done: FUNC_LEAVE_API(ret_value); @@ -495,13 +515,13 @@ H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx) if (NULL==(group = H5I_object_verify(group_id,H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); - if (H5G_get_num_objs(group, &num_objs)<0) + if (H5G_get_num_objs(group, &num_objs, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to retrieve number of members"); if(idx >= num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound"); /*call private function*/ - ret_value = H5G_get_objtype_by_idx(group, idx); + ret_value = H5G_get_objtype_by_idx(group, idx, H5AC_dxpl_id); done: FUNC_LEAVE_API(ret_value); @@ -561,7 +581,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(src_loc->file != dst_loc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file."); - if (H5G_move(src_loc, src_name, dst_loc, dst_name)<0) + if (H5G_move(src_loc, src_name, dst_loc, dst_name, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to change object name"); done: @@ -631,7 +651,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, else if(cur_loc->file != new_loc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file."); - if (H5G_link(cur_loc, cur_name, new_loc, new_name, type, H5G_TARGET_NORMAL) <0) + if (H5G_link(cur_loc, cur_name, new_loc, new_name, type, H5G_TARGET_NORMAL, H5AC_dxpl_id) <0) HGOTO_ERROR (H5E_SYM, H5E_LINK, FAIL, "unable to create link"); done: @@ -674,7 +694,7 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Unlink */ - if (H5G_unlink(loc, name)<0) + if (H5G_unlink(loc, name, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to unlink object"); done: @@ -716,7 +736,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Get info */ - if (H5G_get_objinfo (loc, name, follow_link, statbuf)<0) + if (H5G_get_objinfo (loc, name, follow_link, statbuf, H5AC_dxpl_id)<0) HGOTO_ERROR (H5E_ARGS, H5E_CANTINIT, FAIL, "cannot stat object"); done: @@ -758,7 +778,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Get the link value */ - if (H5G_linkval (loc, name, size, buf)<0) + if (H5G_linkval (loc, name, size, buf, H5AC_dxpl_id)<0) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value"); done: @@ -797,7 +817,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); - if (H5G_set_comment(loc, name, comment)<0) + if (H5G_set_comment(loc, name, comment, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value"); done: @@ -844,7 +864,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if (bufsize>0 && !buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified"); - if ((ret_value=H5G_get_comment(loc, name, bufsize, buf))<0) + if ((ret_value=H5G_get_comment(loc, name, bufsize, buf, H5AC_dxpl_id))<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get comment value"); done: @@ -973,7 +993,7 @@ H5G_term_interface(void) *------------------------------------------------------------------------- */ herr_t -H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*), const char *_desc) +H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc) { char *desc = NULL; size_t i; @@ -1207,7 +1227,7 @@ static herr_t H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, H5G_entry_t *grp_ent/*out*/, H5G_entry_t *obj_ent/*out*/, unsigned target, int *nlinks/*out*/, H5G_namei_act_t action, - H5G_entry_t *ent) + H5G_entry_t *ent, hid_t dxpl_id) { H5G_entry_t _grp_ent; /*entry for current group */ H5G_entry_t _obj_ent; /*entry found */ @@ -1320,7 +1340,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, switch(action) { case H5G_NAMEI_TRAVERSE: - if (H5G_stab_find(grp_ent, H5G_comp_g, obj_ent/*out*/ )<0) { + if (H5G_stab_find(grp_ent, H5G_comp_g, obj_ent/*out*/, dxpl_id )<0) { /* * Component was not found in the current symbol table, possibly * because GRP_ENT isn't a symbol table. @@ -1331,7 +1351,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, case H5G_NAMEI_INSERT: if(!last_comp) { - if (H5G_stab_find(grp_ent, H5G_comp_g, obj_ent/*out*/ )<0) { + if (H5G_stab_find(grp_ent, H5G_comp_g, obj_ent/*out*/, dxpl_id )<0) { /* * Component was not found in the current symbol table, possibly * because GRP_ENT isn't a symbol table. @@ -1340,7 +1360,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, } } /* end if */ else { - if (H5G_stab_insert(grp_ent, H5G_comp_g, ent) < 0) + if (H5G_stab_insert(grp_ent, H5G_comp_g, ent, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert name"); HGOTO_DONE(SUCCEED); } /* end else */ @@ -1356,7 +1376,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, (0==(target & H5G_TARGET_SLINK) || !last_comp)) { if ((*nlinks)-- <= 0) HGOTO_ERROR (H5E_SYM, H5E_SLINK, FAIL, "too many symbolic links"); - if (H5G_traverse_slink (grp_ent, obj_ent, nlinks)<0) + if (H5G_traverse_slink (grp_ent, obj_ent, nlinks, dxpl_id)<0) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "symbolic link traversal failed"); } @@ -1414,7 +1434,7 @@ done: static herr_t H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, H5G_entry_t *obj_ent/*in,out*/, - int *nlinks/*in,out*/) + int *nlinks/*in,out*/, hid_t dxpl_id) { H5O_stab_t stab_mesg; /*info about local heap */ const char *clv = NULL; /*cached link value */ @@ -1429,9 +1449,9 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, HDmemset(&tmp_grp_ent,0,sizeof(H5G_entry_t)); /* Get the link value */ - if (NULL==H5O_read (grp_ent, H5O_STAB, 0, &stab_mesg)) + if (NULL==H5O_read (grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address"); - if (NULL==(clv=H5HL_peek (grp_ent->file, stab_mesg.heap_addr, + if (NULL==(clv=H5HL_peek (grp_ent->file, dxpl_id, stab_mesg.heap_addr, obj_ent->cache.slink.lval_offset))) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbolic link value"); linkval = H5MM_xstrdup (clv); @@ -1449,7 +1469,7 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, H5G_ent_copy(&tmp_grp_ent,grp_ent,H5G_COPY_DEEP); /* Traverse the link */ - if (H5G_namei (&tmp_grp_ent, linkval, NULL, grp_ent, obj_ent, H5G_TARGET_NORMAL, nlinks, H5G_NAMEI_TRAVERSE, NULL)) + if (H5G_namei (&tmp_grp_ent, linkval, NULL, grp_ent, obj_ent, H5G_TARGET_NORMAL, nlinks, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link"); /* Free the entry's names, we will use the original name for the object */ @@ -1500,7 +1520,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_mkroot (H5F_t *f, H5G_entry_t *ent) +H5G_mkroot (H5F_t *f, hid_t dxpl_id, H5G_entry_t *ent) { H5G_entry_t new_root; /*new root object */ H5O_stab_t stab; /*symbol table message */ @@ -1520,9 +1540,9 @@ H5G_mkroot (H5F_t *f, H5G_entry_t *ent) if (!ent) { ent = &new_root; HDmemset(ent, 0, sizeof(H5G_entry_t)); - if (H5G_stab_create (f, 256, ent/*out*/)<0) + if (H5G_stab_create (f, dxpl_id, 256, ent/*out*/)<0) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to create root group"); - if (1 != H5O_link (ent, 1)) + if (1 != H5O_link (ent, 1, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_LINK, FAIL, "internal error (wrong link count)"); } else { /* @@ -1530,7 +1550,7 @@ H5G_mkroot (H5F_t *f, H5G_entry_t *ent) */ if (H5O_open (ent)<0) HGOTO_ERROR (H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open root group"); - if (NULL==H5O_read (ent, H5O_STAB, 0, &stab)) { + if (NULL==H5O_read (ent, H5O_STAB, 0, &stab, dxpl_id)) { H5O_close(ent); HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "root object is not a group"); } @@ -1586,8 +1606,8 @@ done: * *------------------------------------------------------------------------- */ -H5G_t * -H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint) +static H5G_t * +H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id) { H5G_t *grp = NULL; /*new group */ H5F_t *file; /* File new group will be in */ @@ -1604,15 +1624,15 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* What file is the group being added to? */ - if (NULL==(file=H5G_insertion_file(loc, name))) + if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to locate insertion point"); /* Create the group entry */ - if (H5G_stab_create(file, size_hint, &(grp->ent)/*out*/) < 0) + if (H5G_stab_create(file, dxpl_id, size_hint, &(grp->ent)/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create grp"); /* insert child name into parent */ - if(H5G_insert(loc,name,&(grp->ent))<0) + if(H5G_insert(loc,name,&(grp->ent), dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group"); grp->nref = 1; @@ -1649,8 +1669,8 @@ done: * *------------------------------------------------------------------------- */ -htri_t -H5G_isa(H5G_entry_t *ent) +static htri_t +H5G_isa(H5G_entry_t *ent, hid_t dxpl_id) { htri_t ret_value; @@ -1658,7 +1678,7 @@ H5G_isa(H5G_entry_t *ent) assert(ent); - if ((ret_value=H5O_exists(ent, H5O_STAB, 0))<0) + if ((ret_value=H5O_exists(ent, H5O_STAB, 0, dxpl_id))<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); done: @@ -1688,7 +1708,7 @@ done: *------------------------------------------------------------------------- */ H5G_t * -H5G_open(H5G_entry_t *loc, const char *name) +H5G_open(H5G_entry_t *loc, const char *name, hid_t dxpl_id) { H5G_t *grp = NULL; H5G_t *ret_value = NULL; @@ -1701,11 +1721,11 @@ H5G_open(H5G_entry_t *loc, const char *name) assert(name && *name); /* Open the object, making sure it's a group */ - if (H5G_find(loc, name, NULL, &ent/*out*/) < 0) + if (H5G_find(loc, name, NULL, &ent/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found"); /* Open the group object */ - if ((grp=H5G_open_oid(&ent)) ==NULL) + if ((grp=H5G_open_oid(&ent, dxpl_id)) ==NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "not found"); /* Set return value */ @@ -1740,7 +1760,7 @@ done: *------------------------------------------------------------------------- */ H5G_t * -H5G_open_oid(H5G_entry_t *ent) +H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id) { H5G_t *grp = NULL; H5G_t *ret_value = NULL; @@ -1761,7 +1781,7 @@ H5G_open_oid(H5G_entry_t *ent) /* Grab the object header */ if (H5O_open(&(grp->ent)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group"); - if (NULL==H5O_read (&(grp->ent), H5O_STAB, 0, &mesg)) { + if (NULL==H5O_read (&(grp->ent), H5O_STAB, 0, &mesg, dxpl_id)) { H5O_close(&(grp->ent)); HGOTO_ERROR (H5E_SYM, H5E_CANTOPENOBJ, NULL, "not a group"); } @@ -1777,6 +1797,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef NOT_YET /*------------------------------------------------------------------------- * Function: H5G_reopen @@ -1812,6 +1833,7 @@ H5G_reopen(H5G_t *grp) done: FUNC_LEAVE_NOAPI(ret_value); } +#endif /* NOT_YET */ /*------------------------------------------------------------------------- @@ -1911,7 +1933,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent) +H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent, hid_t dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1925,13 +1947,13 @@ H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent) /* * Lookup and insert the name -- it shouldn't exist yet. */ - if (H5G_namei(loc, name, NULL, NULL, NULL, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_INSERT, ent)<0) + if (H5G_namei(loc, name, NULL, NULL, NULL, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_INSERT, ent, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "already exists"); /* * Insert the object into a symbol table. */ - if (H5O_link(ent, 1) < 0) + if (H5O_link(ent, 1, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "unable to increment hard link count"); done: @@ -1968,7 +1990,7 @@ done: */ herr_t H5G_find(H5G_entry_t *loc, const char *name, - H5G_entry_t *grp_ent/*out*/, H5G_entry_t *obj_ent/*out*/) + H5G_entry_t *grp_ent/*out*/, H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1978,7 +2000,7 @@ H5G_find(H5G_entry_t *loc, const char *name, assert (loc); assert (name && *name); - if (H5G_namei(loc, name, NULL, grp_ent, obj_ent, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL)<0) + if (H5G_namei(loc, name, NULL, grp_ent, obj_ent, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); done: @@ -2146,9 +2168,9 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, - const char *new_name, H5G_link_t type, unsigned namei_flags) + const char *new_name, H5G_link_t type, unsigned namei_flags, hid_t dxpl_id) { H5G_entry_t cur_obj; /*entry for the link tail */ H5G_entry_t grp_ent; /*ent for grp containing link hd*/ @@ -2174,7 +2196,7 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, * the new entry. The entry shouldn't exist yet. */ if (H5G_namei(new_loc, new_name, &rest, &grp_ent, NULL, - H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL)>=0) + H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)>=0) HGOTO_ERROR (H5E_SYM, H5E_EXISTS, FAIL, "already exists"); H5E_clear (); /*it's okay that we didn't find it*/ rest = H5G_component (rest, &nchars); @@ -2199,9 +2221,9 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, * Add the link-value to the local heap for the symbol table which * will contain the link. */ - if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg)) + if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to determine local heap address"); - if ((size_t)(-1)==(offset=H5HL_insert (grp_ent.file, + if ((size_t)(-1)==(offset=H5HL_insert (grp_ent.file, dxpl_id, stab_mesg.heap_addr, HDstrlen(cur_name)+1, cur_name))) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap"); H5O_reset (H5O_STAB, &stab_mesg); @@ -2223,14 +2245,14 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, * writable). But if it does, the only side effect is that the local * heap has some extra garbage in it. */ - if (H5G_stab_insert (&grp_ent, rest, &cur_obj)<0) + if (H5G_stab_insert (&grp_ent, rest, &cur_obj, dxpl_id)<0) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to create new name/link for object"); break; case H5G_LINK_HARD: - if (H5G_namei(cur_loc, cur_name, NULL, NULL, &cur_obj, namei_flags, NULL, H5G_NAMEI_TRAVERSE, NULL)<0) + if (H5G_namei(cur_loc, cur_name, NULL, NULL, &cur_obj, namei_flags, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found"); - if (H5G_insert (new_loc, new_name, &cur_obj)<0) + if (H5G_insert (new_loc, new_name, &cur_obj, dxpl_id)<0) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to create new name/link for object"); break; @@ -2267,7 +2289,7 @@ done: *------------------------------------------------------------------------- */ int -H5G_get_type(H5G_entry_t *ent) +H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id) { htri_t isa; size_t i; @@ -2276,7 +2298,7 @@ H5G_get_type(H5G_entry_t *ent) FUNC_ENTER_NOAPI(H5G_get_type, H5G_UNKNOWN); for (i=H5G_ntypes_g; i>0; --i) { - if ((isa=(H5G_type_g[i-1].isa)(ent))<0) { + if ((isa=(H5G_type_g[i-1].isa)(ent, dxpl_id))<0) { HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type"); } else if (isa) { HGOTO_DONE(H5G_type_g[i-1].type); @@ -2314,7 +2336,7 @@ done: */ herr_t H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf/*out*/) + H5G_stat_t *statbuf/*out*/, hid_t dxpl_id) { H5O_stab_t stab_mesg; H5G_entry_t grp_ent, obj_ent; @@ -2329,7 +2351,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, /* Find the object's symbol table entry */ if (H5G_namei(loc, name, NULL, &grp_ent/*out*/, &obj_ent/*out*/, - (unsigned)(follow_link?H5G_TARGET_NORMAL:H5G_TARGET_SLINK), NULL, H5G_NAMEI_TRAVERSE, NULL)<0) + (unsigned)(follow_link?H5G_TARGET_NORMAL:H5G_TARGET_SLINK), NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to stat object"); /* @@ -2340,8 +2362,8 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, if (statbuf) { if (H5G_CACHED_SLINK==obj_ent.type) { /* Named object is a symbolic link */ - if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg) || - NULL==(s=H5HL_peek (grp_ent.file, stab_mesg.heap_addr, + if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id) || + NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr, obj_ent.cache.slink.lval_offset))) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value"); statbuf->linklen = HDstrlen(s)+1; /*count the null terminator*/ @@ -2359,16 +2381,16 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, #else statbuf->objno[1] = 0; #endif - statbuf->nlink = H5O_link (&obj_ent, 0); + statbuf->nlink = H5O_link (&obj_ent, 0, dxpl_id); statbuf->type = H5G_LINK; - if (NULL==H5O_read(&obj_ent, H5O_MTIME, 0, &(statbuf->mtime))) { + if (NULL==H5O_read(&obj_ent, H5O_MTIME, 0, &(statbuf->mtime), dxpl_id)) { H5E_clear(); - if (NULL==H5O_read(&obj_ent, H5O_MTIME_NEW, 0, &(statbuf->mtime))) { + if (NULL==H5O_read(&obj_ent, H5O_MTIME_NEW, 0, &(statbuf->mtime), dxpl_id)) { H5E_clear(); statbuf->mtime = 0; } } - statbuf->type = H5G_get_type(&obj_ent); + statbuf->type = H5G_get_type(&obj_ent, dxpl_id); H5E_clear(); /*clear errors resulting from checking type*/ } @@ -2404,8 +2426,8 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs) +static herr_t +H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs, hid_t dxpl_id) { herr_t ret_value; @@ -2413,7 +2435,7 @@ H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs) *num_objs = 0; /* Iterate over the group members */ - if ((ret_value = H5B_iterate (H5G_fileof(grp), H5B_SNODE, + if ((ret_value = H5B_iterate (H5G_fileof(grp), dxpl_id, H5B_SNODE, H5G_node_sumup, grp->ent.cache.stab.btree_addr, num_objs))<0) HERROR (H5E_SYM, H5E_CANTINIT, "iteration operator failed"); @@ -2439,8 +2461,8 @@ done: * *------------------------------------------------------------------------- */ -ssize_t -H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size) +static ssize_t +H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size, hid_t dxpl_id) { ssize_t ret_value; H5G_bt_ud3_t udata; @@ -2453,7 +2475,7 @@ H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size) udata.name = NULL; /* Iterate over the group members */ - if ((ret_value = H5B_iterate (H5G_fileof(grp), H5B_SNODE, + if ((ret_value = H5B_iterate (H5G_fileof(grp), dxpl_id, H5B_SNODE, H5G_node_name, grp->ent.cache.stab.btree_addr, &udata))<0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed"); @@ -2489,20 +2511,20 @@ done: * *------------------------------------------------------------------------- */ -int -H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx) +static int +H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id) { int ret_value = FAIL; H5G_bt_ud3_t udata; - FUNC_ENTER_NOAPI(H5G_get_objname_by_idx, FAIL); + FUNC_ENTER_NOAPI(H5G_get_objtype_by_idx, FAIL); udata.idx = idx; udata.num_objs = 0; udata.group = grp; /* Iterate over the group members */ - if ((ret_value = H5B_iterate (H5G_fileof(grp), H5B_SNODE, + if ((ret_value = H5B_iterate (H5G_fileof(grp), dxpl_id, H5B_SNODE, H5G_node_type, grp->ent.cache.stab.btree_addr, &udata))<0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed"); @@ -2536,8 +2558,8 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/) +static herr_t +H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/, hid_t dxpl_id) { const char *s = NULL; H5G_entry_t grp_ent, obj_ent; @@ -2551,7 +2573,7 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/) * entry for the group in which the link head appears. */ if (H5G_namei(loc, name, NULL, &grp_ent/*out*/, &obj_ent/*out*/, - H5G_TARGET_SLINK, NULL, H5G_NAMEI_TRAVERSE, NULL)<0) + H5G_TARGET_SLINK, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "symbolic link was not found"); if (H5G_CACHED_SLINK!=obj_ent.type) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "object is not a symbolic link"); @@ -2560,9 +2582,9 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/) * Get the address of the local heap for the link value and a pointer * into that local heap. */ - if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg)) + if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to determine local heap address"); - if (NULL==(s=H5HL_peek (grp_ent.file, stab_mesg.heap_addr, + if (NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr, obj_ent.cache.slink.lval_offset))) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value"); @@ -2596,8 +2618,8 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf) +static herr_t +H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_id) { H5G_entry_t obj_ent; H5O_name_t comment; @@ -2607,16 +2629,17 @@ H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf) /* Get the symbol table entry for the object */ if (H5G_namei(loc, name, NULL, NULL, &obj_ent/*out*/, H5G_TARGET_NORMAL, - NULL, H5G_NAMEI_TRAVERSE, NULL)<0) + NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Remove the previous comment message if any */ - if (H5O_remove(&obj_ent, H5O_NAME, 0)<0) H5E_clear(); + if (H5O_remove(&obj_ent, H5O_NAME, 0, dxpl_id)<0) + H5E_clear(); /* Add the new message */ if (buf && *buf) { comment.s = H5MM_xstrdup(buf); - if (H5O_modify(&obj_ent, H5O_NAME, H5O_NEW_MESG, 0, 1, &comment)<0) + if (H5O_modify(&obj_ent, H5O_NAME, H5O_NEW_MESG, 0, 1, &comment, dxpl_id)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message"); H5O_reset(H5O_NAME, &comment); } @@ -2650,8 +2673,8 @@ done: * *------------------------------------------------------------------------- */ -int -H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf) +static int +H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf, hid_t dxpl_id) { H5O_name_t comment; H5G_entry_t obj_ent; @@ -2661,12 +2684,12 @@ H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf) /* Get the symbol table entry for the object */ if (H5G_namei(loc, name, NULL, NULL, &obj_ent/*out*/, H5G_TARGET_NORMAL, - NULL, H5G_NAMEI_TRAVERSE, NULL)<0) + NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Get the message */ comment.s = NULL; - if (NULL==H5O_read(&obj_ent, H5O_NAME, 0, &comment)) { + if (NULL==H5O_read(&obj_ent, H5O_NAME, 0, &comment, dxpl_id)) { if (buf && bufsize>0) buf[0] = '\0'; ret_value = 0; @@ -2702,8 +2725,8 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5G_unlink(H5G_entry_t *loc, const char *name) +static herr_t +H5G_unlink(H5G_entry_t *loc, const char *name, hid_t dxpl_id) { H5G_entry_t grp_ent, obj_ent; size_t len; @@ -2721,12 +2744,12 @@ H5G_unlink(H5G_entry_t *loc, const char *name) HDmemset(&obj_ent,0,sizeof(H5G_entry_t)); /* Get object type before unlink */ - if (H5G_get_objinfo(loc, name, FALSE, &statbuf)<0) + if (H5G_get_objinfo(loc, name, FALSE, &statbuf, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Get the entry for the group that contains the object to be unlinked */ if (H5G_namei(loc, name, NULL, &grp_ent, &obj_ent, - H5G_TARGET_SLINK|H5G_TARGET_MOUNT, NULL, H5G_NAMEI_TRAVERSE, NULL)<0) + H5G_TARGET_SLINK|H5G_TARGET_MOUNT, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); if (!H5F_addr_defined(grp_ent.header)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no containing group specified"); @@ -2734,7 +2757,7 @@ H5G_unlink(H5G_entry_t *loc, const char *name) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "problems obtaining object base name"); /* Remove the name from the symbol table */ - if (H5G_stab_remove(&grp_ent, base)<0) + if (H5G_stab_remove(&grp_ent, base, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to unlink name from symbol table"); /* Search the open IDs and replace names for unlinked object */ @@ -2773,9 +2796,9 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5G_move(H5G_entry_t *src_loc, const char *src_name, H5G_entry_t *dst_loc, - const char *dst_name) + const char *dst_name, hid_t dxpl_id) { H5G_stat_t sb; char *linkval=NULL; @@ -2791,7 +2814,7 @@ H5G_move(H5G_entry_t *src_loc, const char *src_name, H5G_entry_t *dst_loc, assert(src_name && *src_name); assert(dst_name && *dst_name); - if (H5G_get_objinfo(src_loc, src_name, FALSE, &sb)<0) + if (H5G_get_objinfo(src_loc, src_name, FALSE, &sb, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); if (H5G_LINK==sb.type) { /* @@ -2802,11 +2825,11 @@ H5G_move(H5G_entry_t *src_loc, const char *src_name, H5G_entry_t *dst_loc, if (NULL==(linkval=H5MM_realloc(linkval, 2*lv_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for symbolic link value"); linkval[lv_size-1] = '\0'; - if (H5G_linkval(src_loc, src_name, lv_size, linkval)<0) + if (H5G_linkval(src_loc, src_name, lv_size, linkval, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value"); } while (linkval[lv_size-1]); if (H5G_link(src_loc, linkval, dst_loc, dst_name, H5G_LINK_SOFT, - H5G_TARGET_NORMAL)<0) + H5G_TARGET_NORMAL, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to rename symbolic link"); H5MM_xfree(linkval); @@ -2815,7 +2838,7 @@ H5G_move(H5G_entry_t *src_loc, const char *src_name, H5G_entry_t *dst_loc, * Rename the object. */ if (H5G_link(src_loc, src_name, dst_loc, dst_name, H5G_LINK_HARD, - H5G_TARGET_MOUNT)<0) + H5G_TARGET_MOUNT, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to register new name for object"); } @@ -2823,7 +2846,7 @@ H5G_move(H5G_entry_t *src_loc, const char *src_name, H5G_entry_t *dst_loc, * This has to be done here because H5G_link and H5G_unlink have * internal object entries, and do not modify the entries list */ - if (H5G_namei(src_loc, src_name, NULL, NULL, &obj_ent, H5G_TARGET_NORMAL|H5G_TARGET_SLINK, NULL, H5G_NAMEI_TRAVERSE, NULL)) + if (H5G_namei(src_loc, src_name, NULL, NULL, &obj_ent, H5G_TARGET_NORMAL|H5G_TARGET_SLINK, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link"); src_name_r=H5RS_wrap(src_name); assert(src_name_r); @@ -2836,7 +2859,7 @@ H5G_move(H5G_entry_t *src_loc, const char *src_name, H5G_entry_t *dst_loc, H5G_free_ent_name(&obj_ent); /* Remove the old name */ - if (H5G_unlink(src_loc, src_name)<0) + if (H5G_unlink(src_loc, src_name, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to deregister old object name"); done: @@ -2866,7 +2889,7 @@ done: *------------------------------------------------------------------------- */ H5F_t * -H5G_insertion_file(H5G_entry_t *loc, const char *name) +H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id) { H5F_t *ret_value; /* Return value */ @@ -2889,7 +2912,7 @@ H5G_insertion_file(H5G_entry_t *loc, const char *name) * Look up the name to get the containing group and to make sure the name * doesn't already exist. */ - if (H5G_namei(loc, name, &rest, &grp_ent, NULL, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL)>=0) { + if (H5G_namei(loc, name, &rest, &grp_ent, NULL, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)>=0) { H5G_free_ent_name(&grp_ent); HGOTO_ERROR(H5E_SYM, H5E_EXISTS, NULL, "name already exists"); } /* end if */ diff --git a/src/H5Gent.c b/src/H5Gent.c index e8732f1..60ad89b 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -430,7 +430,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE * stream, +H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream, int indent, int fwidth, haddr_t heap) { const char *lval = NULL; @@ -471,7 +471,7 @@ H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE * stream, "Link value offset:", (unsigned long)(ent->cache.slink.lval_offset)); if (H5F_addr_defined(heap)) { - lval = H5HL_peek (ent->file, heap, ent->cache.slink.lval_offset); + lval = H5HL_peek (ent->file, dxpl_id, heap, ent->cache.slink.lval_offset); HDfprintf (stream, "%*s%-*s %s\n", indent, "", fwidth, "Link value:", lval); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index c07b8d6..25463d8 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -43,25 +43,26 @@ static herr_t H5G_node_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, static herr_t H5G_node_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, void *_key); static size_t H5G_node_size(H5F_t *f); -static herr_t H5G_node_create(H5F_t *f, H5B_ins_t op, void *_lt_key, - void *_udata, void *_rt_key, - haddr_t *addr_p/*out*/); -static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, - H5G_node_t *sym); static H5G_node_t *H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1, void *_udata2); -static int H5G_node_cmp2(H5F_t *f, void *_lt_key, void *_udata, +static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, + H5G_node_t *sym); +static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym); +static herr_t H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key, + void *_udata, void *_rt_key, + haddr_t *addr_p/*out*/); +static int H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); -static int H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, +static int H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); -static herr_t H5G_node_found(H5F_t *f, haddr_t addr, const void *_lt_key, +static herr_t H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key, void *_udata, const void *_rt_key); -static H5B_ins_t H5G_node_insert(H5F_t *f, haddr_t addr, void *_lt_key, +static H5B_ins_t H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t *rt_key_changed, haddr_t *new_node_p/*out*/); -static H5B_ins_t H5G_node_remove(H5F_t *f, haddr_t addr, void *lt_key, +static H5B_ins_t H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *lt_key, hbool_t *lt_key_changed, void *udata, void *rt_key, hbool_t *rt_key_changed); static size_t H5G_node_sizeof_rkey(H5F_t *f, const void *_udata); @@ -71,6 +72,7 @@ const H5AC_class_t H5AC_SNODE[1] = {{ H5AC_SNODE_ID, (H5AC_load_func_t)H5G_node_load, (H5AC_flush_func_t)H5G_node_flush, + (H5AC_dest_func_t)H5G_node_dest, }}; /* H5G inherits B-tree like properties from H5B */ @@ -229,74 +231,88 @@ H5G_node_size(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5G_node_create + * Function: H5G_node_load * - * Purpose: Creates a new empty symbol table node. This function is - * called by the B-tree insert function for an empty tree. It - * is also called internally to split a symbol node with LT_KEY - * and RT_KEY null pointers. + * Purpose: Loads a symbol table node from the file. * - * Return: Success: Non-negative. The address of symbol table - * node is returned through the ADDR_P argument. + * Return: Success: Ptr to the new table. * - * Failure: Negative + * Failure: NULL * * Programmer: Robb Matzke * matzke@llnl.gov * Jun 23 1997 * * Modifications: + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. * + * Quincey Koziol, 2002-7-180 + * Added dxpl parameter to allow more control over I/O from metadata + * cache. *------------------------------------------------------------------------- */ -static herr_t -H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key, - void UNUSED *_udata, void *_rt_key, haddr_t *addr_p/*out*/) +static H5G_node_t * +H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED _udata1, + void * UNUSED _udata2) { - H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; - H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; H5G_node_t *sym = NULL; - hsize_t size = 0; - herr_t ret_value=SUCCEED; /* Return value */ + size_t size = 0; + uint8_t *buf = NULL; + const uint8_t *p = NULL; + H5G_node_t *ret_value; /*for error handling */ - FUNC_ENTER_NOAPI(H5G_node_create, FAIL); + FUNC_ENTER_NOAPI(H5G_node_load, NULL); /* * Check arguments. */ assert(f); - assert(H5B_INS_FIRST == op); + assert(H5F_addr_defined(addr)); + assert(!_udata1); + assert(NULL == _udata2); - if (NULL==(sym = H5FL_CALLOC(H5G_node_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - size = H5G_node_size(f); - if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, size))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space"); - sym->dirty = TRUE; - sym->entry = H5FL_ARR_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f))); - if (NULL==sym->entry) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - if (H5AC_set(f, H5AC_SNODE, *addr_p, sym) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node"); /* - * The left and right symbols in an empty tree are both the - * empty string stored at offset zero by the H5G functions. This - * allows the comparison functions to work correctly without knowing - * that there are no symbols. + * Initialize variables. */ - if (lt_key) - lt_key->offset = 0; - if (rt_key) - rt_key->offset = 0; + size = H5G_node_size(f); + if ((buf=H5FL_BLK_MALLOC(symbol_node,size))==NULL) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for symbol table node"); + p=buf; + if (NULL==(sym = H5FL_CALLOC(H5G_node_t)) || + NULL==(sym->entry=H5FL_ARR_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f))))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read symbol table node"); + /* magic */ + if (HDmemcmp(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC)) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature"); + p += 4; + + /* version */ + if (H5G_NODE_VERS != *p++) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node version"); + /* reserved */ + p++; + + /* number of symbols */ + UINT16DECODE(p, sym->nsyms); + + /* entries */ + if (H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries"); + + /* Set return value */ + ret_value = sym; done: - if(ret_value<0) { - if(sym!=NULL) { - if(sym->entry!=NULL) - H5FL_ARR_FREE(H5G_entry_t,sym->entry); - H5FL_FREE(H5G_node_t,sym); - } /* end if */ - } /* end if */ + if (buf) + H5FL_BLK_FREE(symbol_node,buf); + if (!ret_value) { + if (sym) + if(H5G_node_dest(f, sym)<0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node"); + } FUNC_LEAVE_NOAPI(ret_value); } @@ -352,7 +368,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ for (i=0; insyms; i++) { if (sym->entry[i].dirty) { /* Set the node's dirty flag */ - sym->dirty = TRUE; + sym->cache_info.dirty = TRUE; /* Reset the entry's dirty flag */ sym->entry[i].dirty=FALSE; @@ -362,7 +378,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ /* * Write the symbol node to disk. */ - if (sym->dirty) { + if (sym->cache_info.dirty) { size = H5G_node_size(f); /* Allocate temporary buffer */ @@ -393,7 +409,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ H5FL_BLK_FREE(symbol_node,buf); /* Reset the node's dirty flag */ - sym->dirty = FALSE; + sym->cache_info.dirty = FALSE; } /* @@ -401,8 +417,8 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ * preempted from the cache. */ if (destroy) { - sym->entry = H5FL_ARR_FREE(H5G_entry_t,sym->entry); - H5FL_FREE(H5G_node_t,sym); + if(H5G_node_dest(f, sym)<0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node"); } done: @@ -411,90 +427,110 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_node_load + * Function: H5G_node_dest * - * Purpose: Loads a symbol table node from the file. + * Purpose: Destroy a symbol table node in memory. * - * Return: Success: Ptr to the new table. + * Return: Non-negative on success/Negative on failure * - * Failure: NULL + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_node_dest(H5F_t UNUSED *f, H5G_node_t *sym) +{ + FUNC_ENTER_NOINIT(H5G_node_dest); + + /* + * Check arguments. + */ + assert(sym); + + /* Verify that node is clean */ + assert (sym->cache_info.dirty==0); + + if(sym->entry) + sym->entry = H5FL_ARR_FREE(H5G_entry_t,sym->entry); + H5FL_FREE(H5G_node_t,sym); + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5G_node_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_node_create + * + * Purpose: Creates a new empty symbol table node. This function is + * called by the B-tree insert function for an empty tree. It + * is also called internally to split a symbol node with LT_KEY + * and RT_KEY null pointers. + * + * Return: Success: Non-negative. The address of symbol table + * node is returned through the ADDR_P argument. + * + * Failure: Negative * * Programmer: Robb Matzke * matzke@llnl.gov * Jun 23 1997 * * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. *------------------------------------------------------------------------- */ -static H5G_node_t * -H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED _udata1, - void * UNUSED _udata2) +static herr_t +H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, + void UNUSED *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { + H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; + H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; H5G_node_t *sym = NULL; - size_t size = 0; - uint8_t *buf = NULL; - const uint8_t *p = NULL; - H5G_node_t *ret_value; /*for error handling */ + hsize_t size = 0; + herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_node_load, NULL); + FUNC_ENTER_NOAPI(H5G_node_create, FAIL); /* * Check arguments. */ assert(f); - assert(H5F_addr_defined(addr)); - assert(!_udata1); - assert(NULL == _udata2); + assert(H5B_INS_FIRST == op); + if (NULL==(sym = H5FL_CALLOC(H5G_node_t))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + size = H5G_node_size(f); + if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space"); + sym->cache_info.dirty = TRUE; + sym->entry = H5FL_ARR_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f))); + if (NULL==sym->entry) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if (H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node"); /* - * Initialize variables. + * The left and right symbols in an empty tree are both the + * empty string stored at offset zero by the H5G functions. This + * allows the comparison functions to work correctly without knowing + * that there are no symbols. */ - size = H5G_node_size(f); - if ((buf=H5FL_BLK_MALLOC(symbol_node,size))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for symbol table node"); - p=buf; - if (NULL==(sym = H5FL_CALLOC(H5G_node_t)) || - NULL==(sym->entry=H5FL_ARR_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f))))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read symbol table node"); - /* magic */ - if (HDmemcmp(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature"); - p += 4; - - /* version */ - if (H5G_NODE_VERS != *p++) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node version"); - /* reserved */ - p++; - - /* number of symbols */ - UINT16DECODE(p, sym->nsyms); - - /* entries */ - if (H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries"); - - /* Set return value */ - ret_value = sym; + if (lt_key) + lt_key->offset = 0; + if (rt_key) + rt_key->offset = 0; done: - if (buf) - H5FL_BLK_FREE(symbol_node,buf); - if (!ret_value) { - if (sym) { - if(sym->entry) + if(ret_value<0) { + if(sym!=NULL) { + if(sym->entry!=NULL) H5FL_ARR_FREE(H5G_entry_t,sym->entry); H5FL_FREE(H5G_node_t,sym); - } - } + } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value); } @@ -524,7 +560,7 @@ done: *------------------------------------------------------------------------- */ static int -H5G_node_cmp2(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) +H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata; H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; @@ -540,7 +576,7 @@ H5G_node_cmp2(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) assert(rt_key); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, udata->heap_addr, 0))) + if (NULL == (base = H5HL_peek(f, dxpl_id, udata->heap_addr, 0))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); /* Get pointers to string names */ @@ -583,7 +619,7 @@ done: *------------------------------------------------------------------------- */ static int -H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) +H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key) { H5G_bt_ud1_t *udata = (H5G_bt_ud1_t *) _udata; H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; @@ -595,7 +631,7 @@ H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) FUNC_ENTER_NOAPI(H5G_node_cmp3, FAIL); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, udata->heap_addr, 0))) + if (NULL == (base = H5HL_peek(f, dxpl_id, udata->heap_addr, 0))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); /* left side */ @@ -643,7 +679,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_node_found(H5F_t *f, haddr_t addr, const void UNUSED *_lt_key, +H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key, void *_udata, const void UNUSED *_rt_key) { H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata; @@ -665,11 +701,11 @@ H5G_node_found(H5F_t *f, haddr_t addr, const void UNUSED *_lt_key, /* * Load the symbol table node for exclusive access. */ - if (NULL == (sn = H5AC_protect(f, H5AC_SNODE, addr, NULL, NULL))) + if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node"); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, bt_udata->heap_addr, 0))) + if (NULL == (base = H5HL_peek(f, dxpl_id, bt_udata->heap_addr, 0))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); /* @@ -700,7 +736,7 @@ H5G_node_found(H5F_t *f, haddr_t addr, const void UNUSED *_lt_key, HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "internal erorr (unknown symbol find operation)"); done: - if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn) < 0 && ret_value>=0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn) < 0 && ret_value>=0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -745,7 +781,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, +H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, hbool_t UNUSED *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed, haddr_t *new_node_p) @@ -778,11 +814,11 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, /* * Load the symbol node. */ - if (NULL == (sn = H5AC_protect(f, H5AC_SNODE, addr, NULL, NULL))) + if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node"); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, bt_udata->heap_addr, 0))) + if (NULL == (base = H5HL_peek(f, dxpl_id, bt_udata->heap_addr, 0))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to read symbol name"); /* @@ -805,7 +841,7 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, /* * Add the new name to the heap. */ - offset = H5HL_insert(f, bt_udata->heap_addr, HDstrlen(bt_udata->name)+1, + offset = H5HL_insert(f, dxpl_id, bt_udata->heap_addr, HDstrlen(bt_udata->name)+1, bt_udata->name); bt_udata->ent.name_off = offset; if (0==offset || (size_t)(-1)==offset) @@ -819,21 +855,21 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, ret_value = H5B_INS_RIGHT; /* The right node */ - if (H5G_node_create(f, H5B_INS_FIRST, NULL, NULL, NULL, + if (H5G_node_create(f, dxpl_id, H5B_INS_FIRST, NULL, NULL, NULL, new_node_p/*out*/)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node"); - if (NULL==(snrt=H5AC_find_f(f, H5AC_SNODE, *new_node_p, NULL, NULL))) + if (NULL==(snrt=H5AC_find(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node"); HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); snrt->nsyms = H5F_SYM_LEAF_K(f); - snrt->dirty = TRUE; + snrt->cache_info.dirty = TRUE; /* The left node */ HDmemset(sn->entry + H5F_SYM_LEAF_K(f), 0, H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); sn->nsyms = H5F_SYM_LEAF_K(f); - sn->dirty = TRUE; + sn->cache_info.dirty = TRUE; /* The middle key */ md_key->offset = sn->entry[sn->nsyms - 1].name_off; @@ -855,7 +891,7 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, } else { /* Where to insert the new entry? */ ret_value = H5B_INS_NOOP; - sn->dirty = TRUE; + sn->cache_info.dirty = TRUE; insert_into = sn; if (idx == sn->nsyms) { rt_key->offset = offset; @@ -872,7 +908,7 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, insert_into->nsyms += 1; done: - if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn) < 0 && ret_value!=H5B_INS_ERROR) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn) < 0 && ret_value!=H5B_INS_ERROR) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -907,7 +943,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, +H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, hbool_t UNUSED *lt_key_changed/*out*/, void *_udata/*in,out*/, void *_rt_key/*in,out*/, hbool_t *rt_key_changed/*out*/) @@ -931,11 +967,11 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, assert(bt_udata); /* Load the symbol table */ - if (NULL==(sn=H5AC_protect(f, H5AC_SNODE, addr, NULL, NULL))) + if (NULL==(sn=H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node"); /* Get base address of heap */ - if (NULL == (base = H5HL_peek(f, bt_udata->heap_addr, 0))) + if (NULL == (base = H5HL_peek(f, dxpl_id, bt_udata->heap_addr, 0))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to read symbol name"); /* Find the name with a binary search */ @@ -955,19 +991,19 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, if (H5G_CACHED_SLINK==sn->entry[idx].type) { /* Remove the symbolic link value */ - if ((s=H5HL_peek(f, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset))) - H5HL_remove(f, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset, HDstrlen(s)+1); + if ((s=H5HL_peek(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset))) + H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].cache.slink.lval_offset, HDstrlen(s)+1); H5E_clear(); /*no big deal*/ } else { /* Decrement the reference count */ assert(H5F_addr_defined(sn->entry[idx].header)); - if (H5O_link(sn->entry+idx, -1)<0) + if (H5O_link(sn->entry+idx, -1, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count"); } /* Remove the name from the local heap */ - if ((s=H5HL_peek(f, bt_udata->heap_addr, sn->entry[idx].name_off))) - H5HL_remove(f, bt_udata->heap_addr, sn->entry[idx].name_off, HDstrlen(s)+1); + if ((s=H5HL_peek(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].name_off))) + H5HL_remove(f, dxpl_id, bt_udata->heap_addr, sn->entry[idx].name_off, HDstrlen(s)+1); H5E_clear(); /*no big deal*/ /* Remove the entry from the symbol table node */ @@ -982,10 +1018,10 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, *rt_key = *lt_key; *rt_key_changed = TRUE; sn->nsyms = 0; - sn->dirty = TRUE; - if (H5AC_unprotect(f, H5AC_SNODE, addr, sn)<0 || - H5AC_flush(f, H5AC_SNODE, addr, TRUE)<0 || - H5MF_xfree(f, H5FD_MEM_BTREE, addr, (hsize_t)H5G_node_size(f))<0) { + sn->cache_info.dirty = TRUE; + if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn)<0 || + H5AC_flush(f, dxpl_id, H5AC_SNODE, addr, TRUE)<0 || + H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size(f))<0) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node"); } @@ -999,7 +1035,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, * change. */ sn->nsyms -= 1; - sn->dirty = TRUE; + sn->cache_info.dirty = TRUE; HDmemmove(sn->entry+idx, sn->entry+idx+1, (sn->nsyms-idx)*sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; @@ -1011,7 +1047,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, * should be changed to reflect the new right-most entry. */ sn->nsyms -= 1; - sn->dirty = TRUE; + sn->cache_info.dirty = TRUE; rt_key->offset = sn->entry[sn->nsyms-1].name_off; *rt_key_changed = TRUE; ret_value = H5B_INS_NOOP; @@ -1022,14 +1058,14 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, * node. */ sn->nsyms -= 1; - sn->dirty = TRUE; + sn->cache_info.dirty = TRUE; HDmemmove(sn->entry+idx, sn->entry+idx+1, (sn->nsyms-idx)*sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; } done: - if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn)<0 && ret_value!=H5B_INS_ERROR) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn)<0 && ret_value!=H5B_INS_ERROR) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -1056,7 +1092,7 @@ done: *------------------------------------------------------------------------- */ H5B_iterate_t -H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata) { H5G_bt_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata; @@ -1080,7 +1116,7 @@ H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, haddr_t addr, * Save information about the symbol table node since we can't lock it * because we're about to call an application function. */ - if (NULL == (sn = H5AC_find_f(f, H5AC_SNODE, addr, NULL, NULL))) + if (NULL == (sn = H5AC_find(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node"); nsyms = sn->nsyms; if (NULL==(name_off = H5MM_malloc (nsyms*sizeof(name_off[0])))) @@ -1096,7 +1132,7 @@ H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, haddr_t addr, if (bt_udata->skip>0) { --bt_udata->skip; } else { - name = H5HL_peek (f, bt_udata->group->ent.cache.stab.heap_addr, name_off[i]); + name = H5HL_peek (f, dxpl_id, bt_udata->group->ent.cache.stab.heap_addr, name_off[i]); assert (name); n = HDstrlen (name); if (n+1>sizeof(buf)) { @@ -1106,7 +1142,7 @@ H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, haddr_t addr, s = buf; } HDstrcpy (s, name); - ret_value = (H5B_iterate_t)(bt_udata->op)(bt_udata->group_id, s, + ret_value = (bt_udata->op)(bt_udata->group_id, s, bt_udata->op_data); if (s!=buf) H5MM_xfree (s); @@ -1141,7 +1177,7 @@ done: *------------------------------------------------------------------------- */ H5B_iterate_t -H5G_node_sumup(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5G_node_sumup(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata) { hsize_t *num_objs = (hsize_t *)_udata; @@ -1158,7 +1194,7 @@ H5G_node_sumup(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, assert(num_objs); /* Find the object node and add the number of symbol entries. */ - if (NULL == (sn = H5AC_find_f(f, H5AC_SNODE, addr, NULL, NULL))) + if (NULL == (sn = H5AC_find(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node"); *num_objs += sn->nsyms; @@ -1184,7 +1220,7 @@ done: *------------------------------------------------------------------------- */ H5B_iterate_t -H5G_node_name(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5G_node_name(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata) { H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t *)_udata; @@ -1204,14 +1240,14 @@ H5G_node_name(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, assert(bt_udata); - if (NULL == (sn = H5AC_find_f(f, H5AC_SNODE, addr, NULL, NULL))) + if (NULL == (sn = H5AC_find(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node"); /* Find the node, locate the object symbol table entry and retrieve the name */ if(bt_udata->idx >= bt_udata->num_objs && bt_udata->idx < (bt_udata->num_objs+sn->nsyms)) { loc_idx = bt_udata->idx - bt_udata->num_objs; name_off = sn->entry[loc_idx].name_off; - name = H5HL_peek (f, bt_udata->group->ent.cache.stab.heap_addr, name_off); + name = H5HL_peek (f, dxpl_id, bt_udata->group->ent.cache.stab.heap_addr, name_off); assert (name); bt_udata->name = H5MM_strdup (name); HGOTO_DONE(H5B_ITER_STOP); @@ -1240,7 +1276,7 @@ done: *------------------------------------------------------------------------- */ H5B_iterate_t -H5G_node_type(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5G_node_type(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata) { H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t*)_udata; @@ -1256,12 +1292,12 @@ H5G_node_type(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, assert(bt_udata); /* Find the node, locate the object symbol table entry and retrieve the type */ - if (NULL == (sn = H5AC_find_f(f, H5AC_SNODE, addr, NULL, NULL))) + if (NULL == (sn = H5AC_find(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node"); if(bt_udata->idx >= bt_udata->num_objs && bt_udata->idx < (bt_udata->num_objs+sn->nsyms)) { loc_idx = bt_udata->idx - bt_udata->num_objs; - bt_udata->type = H5G_get_type(&(sn->entry[loc_idx])); + bt_udata->type = H5G_get_type(&(sn->entry[loc_idx]), dxpl_id); HGOTO_DONE(H5B_ITER_STOP); } @@ -1290,7 +1326,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_node_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, +H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, haddr_t heap) { int i; @@ -1313,16 +1349,16 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, * If we couldn't load the symbol table node, then try loading the * B-tree node. */ - if (NULL == (sn = H5AC_protect(f, H5AC_SNODE, addr, NULL, NULL))) { + if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) { H5E_clear(); /*discard that error */ - if ( H5B_debug(f, addr, stream, indent, fwidth, H5B_SNODE, NULL) < 0) + if ( H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_SNODE, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to debug B-tree node"); HGOTO_DONE(SUCCEED); } fprintf(stream, "%*sSymbol Table Node...\n", indent, ""); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty:", - sn->dirty ? "Yes" : "No"); + sn->cache_info.dirty ? "Yes" : "No"); fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of Node (in bytes):", (unsigned)H5G_node_size(f)); fprintf(stream, "%*s%-*s %d of %d\n", indent, "", fwidth, @@ -1334,15 +1370,15 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, for (i = 0; i < sn->nsyms; i++) { fprintf(stream, "%*sSymbol %d:\n", indent - 3, "", i); if (H5F_addr_defined(heap) && - (s = H5HL_peek(f, heap, sn->entry[i].name_off))) { + (s = H5HL_peek(f, dxpl_id, heap, sn->entry[i].name_off))) { fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s); } - H5G_ent_debug(f, sn->entry + i, stream, indent, fwidth, heap); + H5G_ent_debug(f, dxpl_id, sn->entry + i, stream, indent, fwidth, heap); } - H5AC_unprotect(f, H5AC_SNODE, addr, sn); + H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn); done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b058ea3..5070fcc 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -34,7 +34,6 @@ typedef struct H5G_node_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ /* first field in structure */ - hbool_t dirty; /*has cache been modified? */ int nsyms; /*number of symbols */ H5G_entry_t *entry; /*array of symbol table entries */ } H5G_node_t; @@ -134,13 +133,13 @@ H5_DLLVAR const H5AC_class_t H5AC_SNODE[1]; * functions that understand names are exported to the rest of * the library and appear in H5Gprivate.h. */ -H5_DLL herr_t H5G_stab_create(H5F_t *f, size_t size_hint, +H5_DLL herr_t H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/); H5_DLL herr_t H5G_stab_find(H5G_entry_t *grp_ent, const char *name, - H5G_entry_t *obj_ent/*out*/); + H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id); H5_DLL herr_t H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, - H5G_entry_t *obj_ent); -H5_DLL herr_t H5G_stab_remove(H5G_entry_t *grp_ent, const char *name); + H5G_entry_t *obj_ent, hid_t dxpl_id); +H5_DLL herr_t H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id); /* * Functions that understand symbol table entries. @@ -151,12 +150,12 @@ H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, int n); /* Functions that understand symbol table nodes */ -H5_DLL H5B_iterate_t H5G_node_iterate (H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5_DLL H5B_iterate_t H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata); -H5_DLL H5B_iterate_t H5G_node_sumup(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5_DLL H5B_iterate_t H5G_node_sumup(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata); -H5_DLL H5B_iterate_t H5G_node_name(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5_DLL H5B_iterate_t H5G_node_name(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata); -H5_DLL H5B_iterate_t H5G_node_type(H5F_t *f, void UNUSED *_lt_key, haddr_t addr, +H5_DLL H5B_iterate_t H5G_node_type(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, void UNUSED *_rt_key, void *_udata); #endif diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index be360cb..10127dc 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -115,7 +115,7 @@ typedef struct H5G_t H5G_t; */ typedef struct H5G_typeinfo_t { int type; /*one of the public H5G_* types */ - htri_t (*isa)(H5G_entry_t*); /*function to determine type */ + htri_t (*isa)(H5G_entry_t*, hid_t); /*function to determine type */ char *desc; /*description of object type */ } H5G_typeinfo_t; @@ -139,59 +139,34 @@ typedef enum { * Library prototypes... These are the ones that other packages routinely * call. */ -H5_DLL herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*), +H5_DLL herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *desc); H5_DLL H5G_entry_t *H5G_loc(hid_t loc_id); -H5_DLL herr_t H5G_mkroot(H5F_t *f, H5G_entry_t *root_entry); +H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_entry); H5_DLL H5G_entry_t *H5G_entof(H5G_t *grp); H5_DLL H5F_t *H5G_fileof(H5G_t *grp); -H5_DLL H5G_t *H5G_create(H5G_entry_t *loc, const char *name, - size_t size_hint); -H5_DLL H5G_t *H5G_open(H5G_entry_t *loc, const char *name); -H5_DLL H5G_t *H5G_open_oid(H5G_entry_t *ent); -H5_DLL H5G_t *H5G_reopen(H5G_t *grp); +H5_DLL H5G_t *H5G_open(H5G_entry_t *loc, const char *name, hid_t dxpl_id); +H5_DLL H5G_t *H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5G_close(H5G_t *grp); H5_DLL H5G_t *H5G_rootof(H5F_t *f); -H5_DLL herr_t H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs); -H5_DLL ssize_t H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size); -H5_DLL int H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx); -H5_DLL htri_t H5G_isa(H5G_entry_t *ent); -H5_DLL herr_t H5G_link(H5G_entry_t *cur_loc, const char *cur_name, - H5G_entry_t *new_loc, const char *new_name, - H5G_link_t type, unsigned namei_flags); -H5_DLL int H5G_get_type(H5G_entry_t *ent); +H5_DLL int H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5G_get_objinfo(H5G_entry_t *loc, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf/*out*/); -H5_DLL herr_t H5G_linkval(H5G_entry_t *loc, const char *name, size_t size, - char *buf/*out*/); -H5_DLL herr_t H5G_set_comment(H5G_entry_t *loc, const char *name, - const char *buf); -H5_DLL int H5G_get_comment(H5G_entry_t *loc, const char *name, - size_t bufsize, char *buf); + H5G_stat_t *statbuf/*out*/, hid_t dxpl_id); H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name, - H5G_entry_t *ent); -H5_DLL herr_t H5G_move(H5G_entry_t *src_loc, const char *src_name, - H5G_entry_t *dst_loc, const char *dst_name); -H5_DLL herr_t H5G_unlink(H5G_entry_t *loc, const char *name); + H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5G_find(H5G_entry_t *loc, const char *name, - H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/); -H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name); -H5_DLL herr_t H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, - H5G_entry_t *ent/*out*/); + H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/, hid_t dxpl_id); +H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id); H5_DLL herr_t H5G_replace_name(int type, H5G_entry_t *loc, H5RS_str_t *src_name, H5G_entry_t *src_loc, H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op); -H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, - H5G_ent_copy_depth_t depth); H5_DLL herr_t H5G_free_grp_name(H5G_t *grp); -H5_DLL herr_t H5G_free_ent_name(H5G_entry_t *ent); /* * These functions operate on symbol table nodes. */ -H5_DLL herr_t H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, +H5_DLL herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, haddr_t heap); /* @@ -199,8 +174,14 @@ H5_DLL herr_t H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, * in the H5O package where header messages are cached in symbol table * entries. The subclasses of H5O probably don't need them though. */ +H5_DLL herr_t H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); +H5_DLL herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, + H5G_entry_t *ent/*out*/); H5_DLL H5G_cache_t *H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type); H5_DLL herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type); -H5_DLL herr_t H5G_ent_debug(H5F_t *f, const H5G_entry_t *ent, FILE * stream, +H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, + H5G_ent_copy_depth_t depth); +H5_DLL herr_t H5G_free_ent_name(H5G_entry_t *ent); +H5_DLL herr_t H5G_ent_debug(H5F_t *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream, int indent, int fwidth, haddr_t heap); #endif diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 9aa46dc..4e35771 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -55,7 +55,7 @@ static herr_t H5G_insert_name(H5G_entry_t *loc, H5G_entry_t *obj, *------------------------------------------------------------------------- */ herr_t -H5G_stab_create(H5F_t *f, size_t init, H5G_entry_t *self/*out*/) +H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/) { size_t name; /*offset of "" name */ H5O_stab_t stab; /*symbol table message */ @@ -71,9 +71,9 @@ H5G_stab_create(H5F_t *f, size_t init, H5G_entry_t *self/*out*/) init = MAX(init, H5HL_SIZEOF_FREE(f) + 2); /* Create symbol table private heap */ - if (H5HL_create(f, init, &(stab.heap_addr)/*out*/)<0) + if (H5HL_create(f, dxpl_id, init, &(stab.heap_addr)/*out*/)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap"); - name = H5HL_insert(f, stab.heap_addr, 1, ""); + name = H5HL_insert(f, dxpl_id, stab.heap_addr, 1, ""); if ((size_t)(-1)==name) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't initialize heap"); @@ -84,7 +84,7 @@ H5G_stab_create(H5F_t *f, size_t init, H5G_entry_t *self/*out*/) assert(0 == name); /* Create the B-tree */ - if (H5B_create(f, H5B_SNODE, NULL, &(stab.btree_addr)/*out*/) < 0) + if (H5B_create(f, dxpl_id, H5B_SNODE, NULL, &(stab.btree_addr)/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree"); /* @@ -92,14 +92,14 @@ H5G_stab_create(H5F_t *f, size_t init, H5G_entry_t *self/*out*/) * since nothing refers to it yet. The link count will be * incremented if the object is added to the group directed graph. */ - if (H5O_create(f, 4 + 2 * H5F_SIZEOF_ADDR(f), self/*out*/) < 0) + if (H5O_create(f, dxpl_id, 4 + 2 * H5F_SIZEOF_ADDR(f), self/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header"); /* * Insert the symbol table message into the object header and the symbol * table entry. */ - if (H5O_modify(self, H5O_STAB, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 1, &stab)<0) { + if (H5O_modify(self, H5O_STAB, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 1, &stab, dxpl_id)<0) { H5O_close(self); HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); } @@ -137,7 +137,7 @@ done: */ herr_t H5G_stab_find(H5G_entry_t *grp_ent, const char *name, - H5G_entry_t *obj_ent/*out*/) + H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id) { H5G_bt_ud1_t udata; /*data to pass through B-tree */ H5O_stab_t stab; /*symbol table message */ @@ -151,14 +151,14 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name, assert(name && *name); /* set up the udata */ - if (NULL == H5O_read(grp_ent, H5O_STAB, 0, &stab)) + if (NULL == H5O_read(grp_ent, H5O_STAB, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message"); udata.operation = H5G_OPER_FIND; udata.name = name; udata.heap_addr = stab.heap_addr; /* search the B-tree */ - if (H5B_find(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata) < 0) { + if (H5B_find(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0) { HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found"); } /* end if */ /* change OBJ_ENT only if found */ @@ -202,7 +202,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent) +H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hid_t dxpl_id) { H5O_stab_t stab; /*symbol table message */ H5G_bt_ud1_t udata; /*data to pass through B-tree */ @@ -223,7 +223,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name"); /* initialize data to pass through B-tree */ - if (NULL == H5O_read(grp_ent, H5O_STAB, 0, &stab)) + if (NULL == H5O_read(grp_ent, H5O_STAB, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); udata.operation = H5G_OPER_INSERT; udata.name = name; @@ -231,7 +231,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent) H5G_ent_copy(&(udata.ent),obj_ent,H5G_COPY_NULL); /* NULL copy here, no copies happens in H5G_node_insert() callback() */ /* insert */ - if (H5B_insert(grp_ent->file, H5B_SNODE, stab.btree_addr, split_ratios, &udata) < 0) + if (H5B_insert(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, split_ratios, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry"); /* update the name offset in the entry */ @@ -257,7 +257,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_remove(H5G_entry_t *grp_ent, const char *name) +H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id) { H5O_stab_t stab; /*symbol table message */ H5G_bt_ud1_t udata; /*data to pass through B-tree */ @@ -269,7 +269,7 @@ H5G_stab_remove(H5G_entry_t *grp_ent, const char *name) assert(name && *name); /* initialize data to pass through B-tree */ - if (NULL==H5O_read(grp_ent, H5O_STAB, 0, &stab)) + if (NULL==H5O_read(grp_ent, H5O_STAB, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); udata.operation = H5G_OPER_REMOVE; udata.name = name; @@ -277,7 +277,7 @@ H5G_stab_remove(H5G_entry_t *grp_ent, const char *name) HDmemset(&(udata.ent), 0, sizeof(udata.ent)); /* remove */ - if (H5B_remove(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata)<0) + if (H5B_remove(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata)<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry"); done: diff --git a/src/H5HG.c b/src/H5HG.c index fbe626b..7c29ce6 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -60,6 +60,7 @@ static H5HG_heap_t *H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void void *udata2); static herr_t H5HG_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HG_heap_t *heap); +static herr_t H5HG_dest(H5F_t *f, H5HG_heap_t *heap); /* * H5HG inherits cache-like properties from H5AC @@ -68,6 +69,7 @@ static const H5AC_class_t H5AC_GHEAP[1] = {{ H5AC_GHEAP_ID, (H5AC_load_func_t)H5HG_load, (H5AC_flush_func_t)H5HG_flush, + (H5AC_dest_func_t)H5HG_dest, }}; /* Interface initialization */ @@ -106,7 +108,7 @@ H5FL_BLK_DEFINE_STATIC(heap_chunk); *------------------------------------------------------------------------- */ H5HG_heap_t * -H5HG_create (H5F_t *f, size_t size) +H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) { H5HG_heap_t *heap = NULL; H5HG_heap_t *ret_value = NULL; @@ -123,26 +125,19 @@ H5HG_create (H5F_t *f, size_t size) size = H5HG_ALIGN(size); /* Create it */ - if (HADDR_UNDEF==(addr=H5MF_alloc(f, H5FD_MEM_GHEAP, (hsize_t)size))) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL, - "unable to allocate file space for global heap"); - } - if (NULL==(heap = H5FL_CALLOC (H5HG_heap_t))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + H5_CHECK_OVERFLOW(size,size_t,hsize_t); + if (HADDR_UNDEF==(addr=H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size))) + HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL, "unable to allocate file space for global heap"); + if (NULL==(heap = H5FL_CALLOC (H5HG_heap_t))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); heap->addr = addr; heap->size = size; heap->dirty = TRUE; - if (NULL==(heap->chunk = H5FL_BLK_MALLOC (heap_chunk,size))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if (NULL==(heap->chunk = H5FL_BLK_MALLOC (heap_chunk,size))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); heap->nalloc = H5HG_NOBJS (f, size); - if (NULL==(heap->obj = H5FL_ARR_CALLOC (H5HG_obj_t,heap->nalloc))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if (NULL==(heap->obj = H5FL_ARR_CALLOC (H5HG_obj_t,heap->nalloc))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Initialize the header */ HDmemcpy (heap->chunk, H5HG_MAGIC, H5HG_SIZEOF_MAGIC); @@ -173,34 +168,28 @@ H5HG_create (H5F_t *f, size_t size) HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p)); /* Add the heap to the cache */ - if (H5AC_set (f, H5AC_GHEAP, addr, heap)<0) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL, - "unable to cache global heap collection"); - } + if (H5AC_set (f, dxpl_id, H5AC_GHEAP, addr, heap)<0) + HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL, "unable to cache global heap collection"); /* Add this heap to the beginning of the CWFS list */ if (NULL==f->shared->cwfs) { f->shared->cwfs = H5MM_malloc (H5HG_NCWFS * sizeof(H5HG_heap_t*)); - if (NULL==(f->shared->cwfs)) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if (NULL==(f->shared->cwfs)) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); f->shared->cwfs[0] = heap; f->shared->ncwfs = 1; } else { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, - MIN (f->shared->ncwfs, H5HG_NCWFS-1)*sizeof(H5HG_heap_t*)); + HDmemmove (f->shared->cwfs+1, f->shared->cwfs, MIN (f->shared->ncwfs, H5HG_NCWFS-1)*sizeof(H5HG_heap_t*)); f->shared->cwfs[0] = heap; f->shared->ncwfs = MIN (H5HG_NCWFS, f->shared->ncwfs+1); } ret_value = heap; - done: +done: if (!ret_value && heap) { - H5FL_BLK_FREE(heap_chunk,heap->chunk); - H5FL_ARR_FREE (H5HG_obj_t,heap->obj); - H5FL_FREE (H5HG_heap_t,heap); + if(H5HG_dest(f,heap)<0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection"); } FUNC_LEAVE_NOAPI(ret_value); } @@ -246,33 +235,22 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, assert (!udata2); /* Read the initial 4k page */ - if (NULL==(heap = H5FL_CALLOC (H5HG_heap_t))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if (NULL==(heap = H5FL_CALLOC (H5HG_heap_t))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); heap->addr = addr; - if (NULL==(heap->chunk = H5FL_BLK_MALLOC (heap_chunk,H5HG_MINSIZE))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } - if (H5F_block_read(f, H5FD_MEM_GHEAP, addr, H5HG_MINSIZE, dxpl_id, - heap->chunk)<0) { - HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, - "unable to read global heap collection"); - } + if (NULL==(heap->chunk = H5FL_BLK_MALLOC (heap_chunk,H5HG_MINSIZE))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if (H5F_block_read(f, H5FD_MEM_GHEAP, addr, H5HG_MINSIZE, dxpl_id, heap->chunk)<0) + HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection"); /* Magic number */ - if (HDmemcmp (heap->chunk, H5HG_MAGIC, H5HG_SIZEOF_MAGIC)) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, - "bad global heap collection signature"); - } + if (HDmemcmp (heap->chunk, H5HG_MAGIC, H5HG_SIZEOF_MAGIC)) + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "bad global heap collection signature"); p = heap->chunk + H5HG_SIZEOF_MAGIC; /* Version */ - if (H5HG_VERSION!=*p++) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, - "wrong version number in global heap"); - } + if (H5HG_VERSION!=*p++) + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "wrong version number in global heap"); /* Reserved */ p += 3; @@ -287,24 +265,17 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, */ if (heap->size > H5HG_MINSIZE) { haddr_t next_addr = addr + (hsize_t)H5HG_MINSIZE; - if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, heap->size))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } - if (H5F_block_read (f, H5FD_MEM_GHEAP, next_addr, (heap->size-H5HG_MINSIZE), - dxpl_id, heap->chunk+H5HG_MINSIZE)<0) { - HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, - "unable to read global heap collection"); - } + if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, heap->size))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if (H5F_block_read (f, H5FD_MEM_GHEAP, next_addr, (heap->size-H5HG_MINSIZE), dxpl_id, heap->chunk+H5HG_MINSIZE)<0) + HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection"); } /* Decode each object */ p = heap->chunk + H5HG_SIZEOF_HDR (f); nalloc = H5HG_NOBJS (f, heap->size); - if (NULL==(heap->obj = H5FL_ARR_CALLOC (H5HG_obj_t,nalloc))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if (NULL==(heap->obj = H5FL_ARR_CALLOC (H5HG_obj_t,nalloc))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); heap->nalloc = nalloc; while (pchunk+heap->size) { if (p+H5HG_SIZEOF_OBJHDR(f)>heap->chunk+heap->size) { @@ -352,24 +323,20 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, if (heap->obj[0].size>0) { if (!f->shared->cwfs) { f->shared->cwfs = H5MM_malloc (H5HG_NCWFS*sizeof(H5HG_heap_t*)); - if (NULL==f->shared->cwfs) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if (NULL==f->shared->cwfs) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); f->shared->ncwfs = 1; f->shared->cwfs[0] = heap; } else if (H5HG_NCWFS==f->shared->ncwfs) { for (i=H5HG_NCWFS-1; i>=0; --i) { if (f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { - HDmemcpy (f->shared->cwfs+1, f->shared->cwfs, - i * sizeof(H5HG_heap_t*)); + HDmemcpy (f->shared->cwfs+1, f->shared->cwfs, i * sizeof(H5HG_heap_t*)); f->shared->cwfs[0] = heap; break; } } } else { - HDmemcpy (f->shared->cwfs+1, f->shared->cwfs, - f->shared->ncwfs*sizeof(H5HG_heap_t*)); + HDmemcpy (f->shared->cwfs+1, f->shared->cwfs, f->shared->ncwfs*sizeof(H5HG_heap_t*)); f->shared->ncwfs += 1; f->shared->cwfs[0] = heap; } @@ -377,11 +344,10 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, ret_value = heap; - done: +done: if (!ret_value && heap) { - H5FL_BLK_FREE (heap_chunk,heap->chunk); - H5FL_ARR_FREE(H5HG_obj_t,heap->obj); - H5FL_FREE (H5HG_heap_t,heap); + if(H5HG_dest(f,heap)<0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection"); } FUNC_LEAVE_NOAPI(ret_value); } @@ -410,7 +376,6 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, static herr_t H5HG_flush (H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HG_heap_t *heap) { - int i; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HG_flush, FAIL); @@ -422,24 +387,14 @@ H5HG_flush (H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HG_heap_t assert (heap); if (heap->dirty) { - if (H5F_block_write (f, H5FD_MEM_GHEAP, addr, heap->size, - dxpl_id, heap->chunk)<0) + if (H5F_block_write (f, H5FD_MEM_GHEAP, addr, heap->size, dxpl_id, heap->chunk)<0) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write global heap collection to file"); heap->dirty = 0; } if (destroy) { - for (i=0; ishared->ncwfs; i++) { - if (f->shared->cwfs[i]==heap) { - f->shared->ncwfs -= 1; - HDmemmove (f->shared->cwfs+i, f->shared->cwfs+i+1, - (f->shared->ncwfs-i) * sizeof(H5HG_heap_t*)); - break; - } - } - heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); - heap->obj = H5FL_ARR_FREE(H5HG_obj_t,heap->obj); - H5FL_FREE (H5HG_heap_t,heap); + if(H5HG_dest(f,heap)<0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection"); } done: @@ -448,6 +403,48 @@ done: /*------------------------------------------------------------------------- + * Function: H5HG_dest + * + * Purpose: Destroys a global heap collection in memory + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, January 15, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HG_dest (H5F_t *f, H5HG_heap_t *heap) +{ + int i; + + FUNC_ENTER_NOINIT(H5HG_dest); + + /* Check arguments */ + assert (heap); + + /* Verify that node is clean */ + assert (heap->cache_info.dirty==0); + + for (i=0; ishared->ncwfs; i++) { + if (f->shared->cwfs[i]==heap) { + f->shared->ncwfs -= 1; + HDmemmove (f->shared->cwfs+i, f->shared->cwfs+i+1, (f->shared->ncwfs-i) * sizeof(H5HG_heap_t*)); + break; + } + } + heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); + heap->obj = H5FL_ARR_FREE(H5HG_obj_t,heap->obj); + H5FL_FREE (H5HG_heap_t,heap); + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* H5HG_dest() */ + + +/*------------------------------------------------------------------------- * Function: H5HG_alloc * * Purpose: Given a heap with enough free space, this function will split @@ -568,7 +565,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size) *------------------------------------------------------------------------- */ herr_t -H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) +H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/) { size_t need; /*total space needed for object */ int cwfsno; @@ -609,7 +606,7 @@ H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) * new collection large enough for the message plus the collection header. */ if (cwfsno>=f->shared->ncwfs) { - if (NULL==(heap=H5HG_create (f, need+H5HG_SIZEOF_HDR (f)))) + if (NULL==(heap=H5HG_create (f, dxpl_id, need+H5HG_SIZEOF_HDR (f)))) HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL, "unable to allocate a global heap collection"); assert (f->shared->ncwfs>0); assert (f->shared->cwfs[0]==heap); @@ -658,7 +655,7 @@ done: *------------------------------------------------------------------------- */ void * -H5HG_peek (H5F_t *f, H5HG_t *hobj) +H5HG_peek (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) { H5HG_heap_t *heap = NULL; void *ret_value; @@ -671,7 +668,7 @@ H5HG_peek (H5F_t *f, H5HG_t *hobj) assert (hobj); /* Load the heap and return a pointer to the object */ - if (NULL==(heap=H5AC_find_f (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) + if (NULL==(heap=H5AC_find(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL))) HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); assert (hobj->idx>0 && hobj->idxnalloc); ret_value = heap->obj[hobj->idx].begin + H5HG_SIZEOF_OBJHDR (f); @@ -679,7 +676,7 @@ H5HG_peek (H5F_t *f, H5HG_t *hobj) /* * Advance the heap in the CWFS list. We might have done this already - * with the H5AC_find_f(), but it won't hurt to do it twice. + * with the H5AC_find(), but it won't hurt to do it twice. */ if (heap->obj[0].begin) { for (i=0; ishared->ncwfs; i++) { @@ -718,7 +715,7 @@ done: *------------------------------------------------------------------------- */ void * -H5HG_read (H5F_t *f, H5HG_t *hobj, void *object/*out*/) +H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/) { H5HG_heap_t *heap = NULL; int i; @@ -733,7 +730,7 @@ H5HG_read (H5F_t *f, H5HG_t *hobj, void *object/*out*/) assert (hobj); /* Load the heap */ - if (NULL==(heap=H5AC_find_f (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) + if (NULL==(heap=H5AC_find(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL))) HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); assert (hobj->idx>0 && hobj->idxnalloc); assert (heap->obj[hobj->idx].begin); @@ -745,7 +742,7 @@ H5HG_read (H5F_t *f, H5HG_t *hobj, void *object/*out*/) /* * Advance the heap in the CWFS list. We might have done this already - * with the H5AC_find_f(), but it won't hurt to do it twice. + * with the H5AC_find(), but it won't hurt to do it twice. */ if (heap->obj[0].begin) { for (i=0; ishared->ncwfs; i++) { @@ -788,7 +785,7 @@ done: *------------------------------------------------------------------------- */ int -H5HG_link (H5F_t *f, H5HG_t *hobj, int adjust) +H5HG_link (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, int adjust) { H5HG_heap_t *heap = NULL; int ret_value; /* Return value */ @@ -802,7 +799,7 @@ H5HG_link (H5F_t *f, H5HG_t *hobj, int adjust) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Load the heap */ - if (NULL==(heap=H5AC_find_f (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) + if (NULL==(heap=H5AC_find(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL))) HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); assert (hobj->idx>0 && hobj->idxnalloc); assert (heap->obj[hobj->idx].begin); @@ -837,7 +834,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_remove (H5F_t *f, H5HG_t *hobj) +H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) { uint8_t *p=NULL, *obj_start=NULL; H5HG_heap_t *heap = NULL; @@ -855,7 +852,7 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Load the heap */ - if (NULL==(heap=H5AC_find_f (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) + if (NULL==(heap=H5AC_find(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL))) HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); assert (hobj->idx>0 && hobj->idxnalloc); assert (heap->obj[hobj->idx].begin); @@ -893,13 +890,14 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj) * to the file free list. */ heap->dirty = FALSE; - H5MF_xfree(f, H5FD_MEM_GHEAP, heap->addr, (hsize_t)heap->size); - H5AC_flush (f, H5AC_GHEAP, heap->addr, TRUE); + H5_CHECK_OVERFLOW(heap->size,size_t,hsize_t); + H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, heap->addr, (hsize_t)heap->size); + H5AC_flush (f, dxpl_id, H5AC_GHEAP, heap->addr, TRUE); heap = NULL; } else { /* * If the heap is in the CWFS list then advance it one position. The - * H5AC_find_f() might have done that too, but that's okay. If the + * H5AC_find() might have done that too, but that's okay. If the * heap isn't on the CWFS list then add it to the end. */ for (i=0; ishared->ncwfs; i++) { @@ -939,7 +937,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, +H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { unsigned u, nused, maxobj; @@ -959,7 +957,7 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, assert(indent >= 0); assert(fwidth >= 0); - if (NULL == (h = H5AC_find_f(f, H5AC_GHEAP, addr, NULL, NULL))) + if (NULL == (h = H5AC_find(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load global heap collection"); fprintf(stream, "%*sGlobal Heap Collection...\n", indent, ""); fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 28c6736..ac42683 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -96,14 +96,14 @@ typedef struct H5HG_t { typedef struct H5HG_heap_t H5HG_heap_t; -H5_DLL H5HG_heap_t *H5HG_create(H5F_t *f, size_t size); -H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, void *obj, +H5_DLL H5HG_heap_t *H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size); +H5_DLL herr_t H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/); -H5_DLL void *H5HG_peek(H5F_t *f, H5HG_t *hobj); -H5_DLL void *H5HG_read(H5F_t *f, H5HG_t *hobj, void *object); -H5_DLL int H5HG_link(H5F_t *f, H5HG_t *hobj, int adjust); -H5_DLL herr_t H5HG_remove(H5F_t *f, H5HG_t *hobj); -H5_DLL herr_t H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, +H5_DLL void *H5HG_peek(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj); +H5_DLL void *H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object); +H5_DLL int H5HG_link(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, int adjust); +H5_DLL herr_t H5HG_remove(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj); +H5_DLL herr_t H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth); #endif diff --git a/src/H5HL.c b/src/H5HL.c index 2f77502..fcbff03 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -55,6 +55,7 @@ typedef struct H5HL_t { static H5HL_t *H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); static herr_t H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HL_t *heap); +static herr_t H5HL_dest(H5F_t *f, H5HL_t *heap); /* * H5HL inherits cache-like properties from H5AC @@ -63,6 +64,7 @@ static const H5AC_class_t H5AC_LHEAP[1] = {{ H5AC_LHEAP_ID, (H5AC_load_func_t)H5HL_load, (H5AC_flush_func_t)H5HL_flush, + (H5AC_dest_func_t)H5HL_dest, }}; /* Interface initialization */ @@ -107,7 +109,7 @@ H5FL_BLK_DEFINE_STATIC(heap_chunk); *------------------------------------------------------------------------- */ herr_t -H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) +H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) { H5HL_t *heap = NULL; hsize_t total_size; /*total heap size on disk */ @@ -120,9 +122,8 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) assert(f); assert(addr_p); - if (size_hint && size_hint < H5HL_SIZEOF_FREE(f)) { + if (size_hint && size_hint < H5HL_SIZEOF_FREE(f)) size_hint = H5HL_SIZEOF_FREE(f); - } size_hint = H5HL_ALIGN(size_hint); /* Cache this for later */ @@ -130,30 +131,22 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) /* allocate file version */ total_size = sizeof_hdr + size_hint; - if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_LHEAP, total_size))) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate file memory"); - } + if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, total_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file memory"); /* allocate memory version */ - if (NULL==(heap = H5FL_CALLOC(H5HL_t))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } + if (NULL==(heap = H5FL_CALLOC(H5HL_t))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); heap->addr = *addr_p + (hsize_t)sizeof_hdr; heap->disk_alloc = size_hint; heap->mem_alloc = size_hint; - if (NULL==(heap->chunk = H5FL_BLK_CALLOC(heap_chunk,(sizeof_hdr + size_hint)))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } + if (NULL==(heap->chunk = H5FL_BLK_CALLOC(heap_chunk,(sizeof_hdr + size_hint)))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* free list */ if (size_hint) { - if (NULL==(heap->freelist = H5FL_MALLOC(H5HL_free_t))) { - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } + if (NULL==(heap->freelist = H5FL_MALLOC(H5HL_free_t))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); heap->freelist->offset = 0; heap->freelist->size = size_hint; heap->freelist->prev = heap->freelist->next = NULL; @@ -163,25 +156,22 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) /* add to cache */ heap->dirty = 1; - if (H5AC_set(f, H5AC_LHEAP, *addr_p, heap) < 0) { - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "unable to cache heap"); - } + if (H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache heap"); ret_value = SUCCEED; - done: +done: if (ret_value<0) { - if (H5F_addr_defined(*addr_p)) { - H5MF_xfree(f, H5FD_MEM_LHEAP, *addr_p, total_size); - } + if (H5F_addr_defined(*addr_p)) + H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, *addr_p, total_size); if (heap) { - H5FL_BLK_FREE (heap_chunk,heap->chunk); - H5FL_FREE (H5HL_free_t,heap->freelist); - H5FL_FREE (H5HL_t,heap); + if(H5HL_dest(f,heap)<0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection"); } } FUNC_LEAVE_NOAPI(ret_value); } + /*------------------------------------------------------------------------- * Function: H5HL_load @@ -288,13 +278,8 @@ H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, done: if (!ret_value && heap) { - if(heap->chunk) - heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); - for (fl = heap->freelist; fl; fl = tail) { - tail = fl->next; - H5FL_FREE(H5HL_free_t,fl); - } - H5FL_FREE(H5HL_t,heap); + if(H5HL_dest(f,heap)<0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy local heap collection"); } FUNC_LEAVE_NOAPI(ret_value); @@ -352,11 +337,13 @@ H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap) */ if (heap->mem_alloc > heap->disk_alloc) { haddr_t old_addr = heap->addr, new_addr; - if (HADDR_UNDEF==(new_addr=H5MF_alloc(f, H5FD_MEM_LHEAP, + H5_CHECK_OVERFLOW(heap->mem_alloc,size_t,hsize_t); + if (HADDR_UNDEF==(new_addr=H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)heap->mem_alloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space for heap"); heap->addr = new_addr; - H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, (hsize_t)heap->disk_alloc); + H5_CHECK_OVERFLOW(heap->disk_alloc,size_t,hsize_t); + H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->disk_alloc); H5E_clear(); /*don't really care if the free failed */ heap->disk_alloc = heap->mem_alloc; } @@ -415,13 +402,8 @@ H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap) * Should we destroy the memory version? */ if (destroy) { - heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); - while (heap->freelist) { - fl = heap->freelist; - heap->freelist = fl->next; - H5FL_FREE(H5HL_free_t,fl); - } - H5FL_FREE(H5HL_t,heap); + if(H5HL_dest(f,heap)<0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection"); } done: @@ -430,6 +412,47 @@ done: /*------------------------------------------------------------------------- + * Function: H5HL_dest + * + * Purpose: Destroys a heap in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HL_dest(H5F_t UNUSED *f, H5HL_t *heap) +{ + H5HL_free_t *fl; + + FUNC_ENTER_NOINIT(H5HL_dest); + + /* check arguments */ + assert(heap); + + /* Verify that node is clean */ + assert (heap->cache_info.dirty==0); + + if(heap->chunk) + heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); + while (heap->freelist) { + fl = heap->freelist; + heap->freelist = fl->next; + H5FL_FREE(H5HL_free_t,fl); + } + H5FL_FREE(H5HL_t,heap); + + FUNC_LEAVE_NOAPI(SUCCEED); +} + + +/*------------------------------------------------------------------------- * Function: H5HL_read * * Purpose: Reads some object (or part of an object) from the heap @@ -457,7 +480,7 @@ done: *------------------------------------------------------------------------- */ void * -H5HL_read(H5F_t *f, haddr_t addr, size_t offset, size_t size, void *buf) +H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, void *buf) { H5HL_t *heap = NULL; void *ret_value; /* Return value */ @@ -468,7 +491,7 @@ H5HL_read(H5F_t *f, haddr_t addr, size_t offset, size_t size, void *buf) assert(f); assert (H5F_addr_defined(addr)); - if (NULL == (heap = H5AC_find_f(f, H5AC_LHEAP, addr, NULL, NULL))) + if (NULL == (heap = H5AC_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); assert(offset < heap->mem_alloc); assert(offset + size <= heap->mem_alloc); @@ -517,7 +540,7 @@ done: *------------------------------------------------------------------------- */ const void * -H5HL_peek(H5F_t *f, haddr_t addr, size_t offset) +H5HL_peek(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset) { H5HL_t *heap; const void *ret_value; @@ -528,7 +551,7 @@ H5HL_peek(H5F_t *f, haddr_t addr, size_t offset) assert(f); assert(H5F_addr_defined(addr)); - if (NULL == (heap = H5AC_find_f(f, H5AC_LHEAP, addr, NULL, NULL))) + if (NULL == (heap = H5AC_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); assert(offset < heap->mem_alloc); @@ -589,7 +612,7 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) *------------------------------------------------------------------------- */ size_t -H5HL_insert(H5F_t *f, haddr_t addr, size_t buf_size, const void *buf) +H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *buf) { H5HL_t *heap = NULL; H5HL_free_t *fl = NULL, *max_fl = NULL; @@ -609,7 +632,7 @@ H5HL_insert(H5F_t *f, haddr_t addr, size_t buf_size, const void *buf) if (0==(f->intent & H5F_ACC_RDWR)) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file"); - if (NULL == (heap = H5AC_find_f(f, H5AC_LHEAP, addr, NULL, NULL))) + if (NULL == (heap = H5AC_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, (size_t)(-1), "unable to load heap"); heap->dirty += 1; @@ -758,7 +781,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HL_write(H5F_t *f, haddr_t addr, size_t offset, size_t size, const void *buf) +H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, const void *buf) { H5HL_t *heap = NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -773,7 +796,7 @@ H5HL_write(H5F_t *f, haddr_t addr, size_t offset, size_t size, const void *buf) if (0==(f->intent & H5F_ACC_RDWR)) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); - if (NULL == (heap = H5AC_find_f(f, H5AC_LHEAP, addr, NULL, NULL))) + if (NULL == (heap = H5AC_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); assert(offset < heap->mem_alloc); assert(offset + size <= heap->mem_alloc); @@ -814,7 +837,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HL_remove(H5F_t *f, haddr_t addr, size_t offset, size_t size) +H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size) { H5HL_t *heap = NULL; H5HL_free_t *fl = NULL, *fl2 = NULL; @@ -831,7 +854,7 @@ H5HL_remove(H5F_t *f, haddr_t addr, size_t offset, size_t size) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); size = H5HL_ALIGN (size); - if (NULL == (heap = H5AC_find_f(f, H5AC_LHEAP, addr, NULL, NULL))) + if (NULL == (heap = H5AC_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); assert(offset < heap->mem_alloc); assert(offset + size <= heap->mem_alloc); @@ -933,7 +956,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth) +H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth) { H5HL_t *h = NULL; int i, j, overlap; @@ -952,7 +975,7 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth) assert(indent >= 0); assert(fwidth >= 0); - if (NULL == (h = H5AC_find_f(f, H5AC_LHEAP, addr, NULL, NULL))) + if (NULL == (h = H5AC_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); fprintf(stream, "%*sLocal Heap...\n", indent, ""); fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 3aa630e..70e9d71 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -50,15 +50,15 @@ /* * Library prototypes... */ -H5_DLL herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr/*out*/); -H5_DLL void *H5HL_read(H5F_t *f, haddr_t addr, size_t offset, size_t size, +H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr/*out*/); +H5_DLL void *H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, void *buf); -H5_DLL const void *H5HL_peek(H5F_t *f, haddr_t addr, size_t offset); -H5_DLL size_t H5HL_insert(H5F_t *f, haddr_t addr, size_t size, +H5_DLL const void *H5HL_peek(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset); +H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5HL_write(H5F_t *f, haddr_t addr, size_t offset, size_t size, +H5_DLL herr_t H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, const void *buf); -H5_DLL herr_t H5HL_remove(H5F_t *f, haddr_t addr, size_t offset, size_t size); -H5_DLL herr_t H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, +H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size); +H5_DLL herr_t H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth); #endif diff --git a/src/H5MF.c b/src/H5MF.c index 12fd240..4fcb23f 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -57,7 +57,7 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ haddr_t -H5MF_alloc(H5F_t *f, H5FD_mem_t type, hsize_t size) +H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { haddr_t ret_value; @@ -72,7 +72,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t type, hsize_t size) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "file is read-only"); /* Allocate space from the virtual file layer */ - if (HADDR_UNDEF==(ret_value=H5FD_alloc(f->shared->lf, type, size))) + if (HADDR_UNDEF==(ret_value=H5FD_alloc(f->shared->lf, type, dxpl_id, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed"); /* Convert absolute file address to relative file address */ @@ -107,7 +107,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size) +H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { herr_t ret_value=SUCCEED; /* Return value */ @@ -123,7 +123,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size) addr += f->shared->base_addr; /* Allow virtual file layer to free block */ - if (H5FD_free(f->shared->lf, type, addr, size)<0) { + if (H5FD_free(f->shared->lf, type, dxpl_id, addr, size)<0) { #ifdef H5MF_DEBUG if (H5DEBUG(MF)) { fprintf(H5DEBUG(MF), @@ -174,7 +174,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5MF_realloc(H5F_t *f, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size, +H5MF_realloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size) { haddr_t ret_value; @@ -185,7 +185,7 @@ H5MF_realloc(H5F_t *f, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size, old_addr += f->shared->base_addr; /* Reallocate memory from the virtual file layer */ - ret_value = H5FD_realloc(f->shared->lf, type, old_addr, old_size, + ret_value = H5FD_realloc(f->shared->lf, type, dxpl_id, old_addr, old_size, new_size); if (HADDR_UNDEF==ret_value) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "unable to allocate new file memory"); diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 1c72507..7cd5995 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -33,10 +33,10 @@ /* * Library prototypes... */ -H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hsize_t size); -H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, +H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); -H5_DLL haddr_t H5MF_realloc(H5F_t *f, H5FD_mem_t type, haddr_t old_addr, +H5_DLL haddr_t H5MF_realloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size); #endif diff --git a/src/H5O.c b/src/H5O.c index 741438c..29d1dd6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -34,10 +34,17 @@ #define PABLO_MASK H5O_mask /* PRIVATE PROTOTYPES */ -static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh); +static herr_t H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint, + H5G_entry_t *ent/*out*/, haddr_t header); static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1, void *_udata2); -static unsigned H5O_find_in_ohdr(H5F_t *f, haddr_t addr, +static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh); +static herr_t H5O_dest(H5F_t *f, H5O_t *oh); +#ifdef NOT_YET +static herr_t H5O_share(H5F_t *f, hid_t dxpl_id, const H5O_class_t *type, const void *mesg, + H5HG_t *hobj/*out*/); +#endif /* NOT_YET */ +static unsigned H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5O_class_t **type_p, int sequence); static unsigned H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size); @@ -49,6 +56,7 @@ static const H5AC_class_t H5AC_OHDR[1] = {{ H5AC_OHDR_ID, (H5AC_load_func_t)H5O_load, (H5AC_flush_func_t)H5O_flush, + (H5AC_dest_func_t)H5O_dest, }}; /* Interface initialization */ @@ -165,7 +173,7 @@ H5O_init_interface(void) *------------------------------------------------------------------------- */ herr_t -H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/) +H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/) { haddr_t header; herr_t ret_value = SUCCEED; /* return value */ @@ -179,13 +187,13 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/) size_hint = H5O_ALIGN (MAX (H5O_MIN_SIZE, size_hint)); /* allocate disk space for header and first chunk */ - if (HADDR_UNDEF == (header = H5MF_alloc(f, H5FD_MEM_OHDR, + if (HADDR_UNDEF == (header = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)H5O_SIZEOF_HDR(f) + size_hint))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header header"); /* initialize the object header */ - if (H5O_init(f, size_hint, ent, header) != SUCCEED) + if (H5O_init(f, dxpl_id, size_hint, ent, header) != SUCCEED) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to initialize object header"); done: @@ -213,14 +221,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5O_init(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/, haddr_t header) +static herr_t +H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/, haddr_t header) { H5O_t *oh = NULL; haddr_t tmp_addr; herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(H5O_init, FAIL); + FUNC_ENTER_NOINIT(H5O_init); /* check args */ assert(f); @@ -234,7 +242,7 @@ H5O_init(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/, haddr_t header) if (NULL == (oh = H5FL_MALLOC(H5O_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; oh->version = H5O_VERSION; oh->nlink = 0; @@ -268,16 +276,19 @@ H5O_init(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/, haddr_t header) oh->mesg[0].chunkno = 0; /* cache it */ - if (H5AC_set(f, H5AC_OHDR, ent->header, oh) < 0) { - H5FL_FREE(H5O_t,oh); + if (H5AC_set(f, dxpl_id, H5AC_OHDR, ent->header, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header"); - } /* open it */ if (H5O_open(ent) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header"); done: + if(ret_value<0 && oh) { + if(H5O_dest(f,oh)<0) + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data"); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value); } @@ -544,7 +555,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED _udata1, if (H5O_CONT_ID == oh->mesg[curmesg].type->id) { uint8_t *p2 = oh->mesg[curmesg].raw; - cont = (H5O_CONT->decode) (f, p2, NULL); + cont = (H5O_CONT->decode) (f, dxpl_id, p2, NULL); oh->mesg[curmesg].native = cont; chunk_addr = cont->addr; chunk_size = cont->size; @@ -558,16 +569,8 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED _udata1, done: if (!ret_value && oh) { - /* - * Free resources. - */ - unsigned u; - - for (u = 0; u < oh->nchunks; u++) - oh->chunk[u].image = H5FL_BLK_FREE(chunk_image,oh->chunk[u].image); - oh->chunk = H5FL_ARR_FREE(H5O_chunk_t,oh->chunk); - oh->mesg = H5FL_ARR_FREE(H5O_mesg_t,oh->mesg); - H5FL_FREE(H5O_t,oh); + if(H5O_dest(f,oh)<0) + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to destroy object header data"); } FUNC_LEAVE_NOAPI(ret_value); @@ -621,7 +624,7 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh) assert(oh); /* flush */ - if (oh->dirty) { + if (oh->cache_info.dirty) { p = buf; /* encode version */ @@ -679,7 +682,7 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh) assert(!H5F_addr_defined(oh->chunk[cont->chunkno].addr)); cont->size = oh->chunk[cont->chunkno].size; if (HADDR_UNDEF==(cont->addr=H5MF_alloc(f, - H5FD_MEM_OHDR, (hsize_t)cont->size))) + H5FD_MEM_OHDR, dxpl_id, (hsize_t)cont->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for object header data"); oh->chunk[cont->chunkno].addr = cont->addr; } @@ -742,27 +745,12 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh) oh->chunk[u].dirty = FALSE; } /* end if */ } /* end for */ - oh->dirty = FALSE; + oh->cache_info.dirty = FALSE; } if (destroy) { - /* destroy chunks */ - for (u = 0; u < oh->nchunks; u++) - oh->chunk[u].image = H5FL_BLK_FREE(chunk_image,oh->chunk[u].image); - oh->chunk = H5FL_ARR_FREE(H5O_chunk_t,oh->chunk); - - /* destroy messages */ - for (u = 0, curr_msg=&oh->mesg[0]; u < oh->nmesgs; u++,curr_msg++) { - if (curr_msg->flags & H5O_FLAG_SHARED) { - H5O_free(H5O_SHARED, curr_msg->native); - } else { - H5O_free(curr_msg->type, curr_msg->native); - } - } - oh->mesg = H5FL_ARR_FREE(H5O_mesg_t,oh->mesg); - - /* destroy object header */ - H5FL_FREE(H5O_t,oh); + if(H5O_dest(f,oh)<0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data"); } done: @@ -771,6 +759,62 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_dest + * + * Purpose: Destroys an object header. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_dest(H5F_t UNUSED *f, H5O_t *oh) +{ + unsigned i; + + FUNC_ENTER_NOINIT(H5O_dest); + + /* check args */ + assert(oh); + + /* Verify that node is clean */ + assert (oh->cache_info.dirty==0); + + /* destroy chunks */ + for (i = 0; i < oh->nchunks; i++) { + /* Verify that chunk is clean */ + assert (oh->chunk[i].dirty==0); + + oh->chunk[i].image = H5FL_BLK_FREE(chunk_image,oh->chunk[i].image); + } + oh->chunk = H5FL_ARR_FREE(H5O_chunk_t,oh->chunk); + + /* destroy messages */ + for (i = 0; i < oh->nmesgs; i++) { + /* Verify that message is clean */ + assert (oh->mesg[i].dirty==0); + + if (oh->mesg[i].flags & H5O_FLAG_SHARED) + H5O_free(H5O_SHARED, oh->mesg[i].native); + else + H5O_free(oh->mesg[i].type, oh->mesg[i].native); + } + oh->mesg = H5FL_ARR_FREE(H5O_mesg_t,oh->mesg); + + /* destroy object header */ + H5FL_FREE(H5O_t,oh); + + FUNC_LEAVE_NOAPI(SUCCEED); +} + + +/*------------------------------------------------------------------------- * Function: H5O_reset * * Purpose: Some message data structures have internal fields that @@ -907,7 +951,7 @@ done: *------------------------------------------------------------------------- */ int -H5O_link(H5G_entry_t *ent, int adjust) +H5O_link(H5G_entry_t *ent, int adjust, hid_t dxpl_id) { H5O_t *oh = NULL; int ret_value = FAIL; @@ -922,7 +966,7 @@ H5O_link(H5G_entry_t *ent, int adjust) HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file"); /* get header */ - if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header, + if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); @@ -931,17 +975,17 @@ H5O_link(H5G_entry_t *ent, int adjust) if (oh->nlink + adjust < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative"); oh->nlink += adjust; - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; } else if (adjust>0) { oh->nlink += adjust; - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; } /* Set return value */ ret_value = oh->nlink; done: - if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0 && ret_value>=0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh) < 0 && ret_value>=0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -966,7 +1010,7 @@ done: *------------------------------------------------------------------------- */ int -H5O_count (H5G_entry_t *ent, const H5O_class_t *type) +H5O_count (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id) { H5O_t *oh = NULL; int acc; @@ -982,7 +1026,7 @@ H5O_count (H5G_entry_t *ent, const H5O_class_t *type) assert (type); /* Load the object header */ - if (NULL==(oh=H5AC_find_f (ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL==(oh=H5AC_find(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); for (u=acc=0; unmesgs; u++) { @@ -1019,7 +1063,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, int sequence) +H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) { H5O_t *oh=NULL; unsigned u; @@ -1033,7 +1077,7 @@ H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, int sequence) assert(sequence>=0); /* Load the object header */ - if (NULL==(oh=H5AC_find_f(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL==(oh=H5AC_find(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* Scan through the messages looking for the right one */ @@ -1078,7 +1122,7 @@ done: *------------------------------------------------------------------------- */ void * -H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg) +H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg, hid_t dxpl_id) { H5O_t *oh = NULL; void *ret_value = NULL; @@ -1105,11 +1149,11 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg) } /* can we get it from the object header? */ - if ((idx = H5O_find_in_ohdr(ent->file, ent->header, &type, sequence)) < 0) + if ((idx = H5O_find_in_ohdr(ent->file, dxpl_id, ent->header, &type, sequence)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "unable to find message in object header"); /* copy the message to the user-supplied buffer */ - if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header"); if (oh->mesg[idx].flags & H5O_FLAG_SHARED) { /* @@ -1122,9 +1166,9 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg) shared = (H5O_shared_t *)(oh->mesg[idx].native); if (shared->in_gh) { - if (NULL==(tmp_buf = H5HG_read (ent->file, &(shared->u.gh), NULL))) + if (NULL==(tmp_buf = H5HG_read (ent->file, dxpl_id, &(shared->u.gh), NULL))) HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL, "unable to read shared message from global heap"); - tmp_mesg = (type->decode)(ent->file, tmp_buf, shared); + tmp_mesg = (type->decode)(ent->file, dxpl_id, tmp_buf, shared); tmp_buf = H5MM_xfree (tmp_buf); if (!tmp_mesg) HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL, "unable to decode object header shared message"); @@ -1135,7 +1179,7 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg) ret_value = tmp_mesg; } } else { - ret_value = H5O_read (&(shared->u.ent), type, 0, mesg); + ret_value = H5O_read (&(shared->u.ent), type, 0, mesg, dxpl_id); if (type->set_share && (type->set_share)(ent->file, ret_value, shared)<0) HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to set sharing information"); @@ -1152,7 +1196,7 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg) } done: - if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0 && ret_value!=NULL) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh) < 0 && ret_value!=NULL) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1179,7 +1223,7 @@ done: *------------------------------------------------------------------------- */ static unsigned -H5O_find_in_ohdr(H5F_t *f, haddr_t addr, const H5O_class_t **type_p, +H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5O_class_t **type_p, int sequence) { H5O_t *oh = NULL; @@ -1195,7 +1239,7 @@ H5O_find_in_ohdr(H5F_t *f, haddr_t addr, const H5O_class_t **type_p, assert(type_p); /* Load the object header */ - if (NULL == (oh = H5AC_find_f(f, H5AC_OHDR, addr, NULL, NULL))) + if (NULL == (oh = H5AC_find(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, UFAIL, "unable to load object header"); /* Scan through the messages looking for the right one */ @@ -1219,7 +1263,7 @@ H5O_find_in_ohdr(H5F_t *f, haddr_t addr, const H5O_class_t **type_p, } if (NULL == oh->mesg[u].native) { assert(type->decode); - oh->mesg[u].native = (type->decode) (f, oh->mesg[u].raw, NULL); + oh->mesg[u].native = (type->decode) (f, dxpl_id, oh->mesg[u].raw, NULL); if (NULL == oh->mesg[u].native) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, UFAIL, "unable to decode message"); } @@ -1281,7 +1325,7 @@ done: */ int H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, - unsigned flags, unsigned update_time, const void *mesg) + unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id) { H5O_t *oh=NULL; int sequence; @@ -1304,7 +1348,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, if (0==(ent->file->intent & H5F_ACC_RDWR)) HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file"); - if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* Count similar messages */ @@ -1345,7 +1389,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, * The shared message is stored in the global heap. * Increment the reference count on the global heap message. */ - if (H5HG_link (ent->file, &(sh_mesg.u.gh), 1)<0) + if (H5HG_link (ent->file, dxpl_id, &(sh_mesg.u.gh), 1)<0) HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL, "unable to adjust shared object link count"); size = (H5O_SHARED->raw_size)(ent->file, &sh_mesg); } else { @@ -1357,7 +1401,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, */ if (sh_mesg.u.ent.file->shared != ent->file->shared) HGOTO_ERROR(H5E_OHDR, H5E_LINK, FAIL, "interfile hard links are not allowed"); - if (H5O_link (&(sh_mesg.u.ent), 1)<0) + if (H5O_link (&(sh_mesg.u.ent), 1, dxpl_id)<0) HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL, "unable to adjust shared object link count"); size = (H5O_SHARED->raw_size)(ent->file, &sh_mesg); } @@ -1401,13 +1445,13 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, idx_msg->flags = flags; idx_msg->dirty = TRUE; - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; /* Set return value */ ret_value = sequence; done: - if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0 && ret_value!=FAIL) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh) < 0 && ret_value!=FAIL) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1435,7 +1479,7 @@ done: *------------------------------------------------------------------------- */ H5O_t * -H5O_protect(H5G_entry_t *ent) +H5O_protect(H5G_entry_t *ent, hid_t dxpl_id) { H5O_t *ret_value; /* Return value */ @@ -1449,7 +1493,7 @@ H5O_protect(H5G_entry_t *ent) if (0==(ent->file->intent & H5F_ACC_RDWR)) HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file"); - if (NULL == (ret_value = H5AC_protect(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL == (ret_value = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header"); done: @@ -1477,7 +1521,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_unprotect(H5G_entry_t *ent, H5O_t *oh) +H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1489,7 +1533,7 @@ H5O_unprotect(H5G_entry_t *ent, H5O_t *oh) assert(H5F_addr_defined(ent->header)); assert(oh); - if (H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0) + if (H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); done: @@ -1524,7 +1568,7 @@ done: *------------------------------------------------------------------------- */ int -H5O_append(H5F_t *f, H5O_t *oh, const H5O_class_t *type, +H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, unsigned flags, const void *mesg) { unsigned idx; /* Index of message to modify */ @@ -1560,7 +1604,7 @@ H5O_append(H5F_t *f, H5O_t *oh, const H5O_class_t *type, * The shared message is stored in the global heap. * Increment the reference count on the global heap message. */ - if (H5HG_link (f, &(sh_mesg.u.gh), 1)<0) + if (H5HG_link (f, dxpl_id, &(sh_mesg.u.gh), 1)<0) HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL, "unable to adjust shared object link count"); size = (H5O_SHARED->raw_size)(f, &sh_mesg); } else { @@ -1572,7 +1616,7 @@ H5O_append(H5F_t *f, H5O_t *oh, const H5O_class_t *type, */ if (sh_mesg.u.ent.file->shared != f->shared) HGOTO_ERROR(H5E_OHDR, H5E_LINK, FAIL, "interfile hard links are not allowed"); - if (H5O_link (&(sh_mesg.u.ent), 1)<0) + if (H5O_link (&(sh_mesg.u.ent), 1, dxpl_id)<0) HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL, "unable to adjust shared object link count"); size = (H5O_SHARED->raw_size)(f, &sh_mesg); } @@ -1604,7 +1648,7 @@ H5O_append(H5F_t *f, H5O_t *oh, const H5O_class_t *type, idx_msg->flags = flags; idx_msg->dirty = TRUE; - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; /* Set return value */ ret_value = idx; @@ -1674,7 +1718,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) } *((time_t*)(oh->mesg[idx].native)) = now; oh->mesg[idx].dirty = TRUE; - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; done: FUNC_LEAVE_NOAPI(ret_value); @@ -1699,7 +1743,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_touch(H5G_entry_t *ent, hbool_t force) +H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id) { H5O_t *oh = NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -1714,7 +1758,7 @@ H5O_touch(H5G_entry_t *ent, hbool_t force) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Get the object header */ - if (NULL==(oh=H5AC_protect(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL==(oh=H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* Create/Update the modification time message */ @@ -1722,7 +1766,7 @@ H5O_touch(H5G_entry_t *ent, hbool_t force) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to update object modificaton time"); done: - if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh)<0 && ret_value>=0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh)<0 && ret_value>=0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1801,7 +1845,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_bogus(H5G_entry_t *ent) +H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id) { H5O_t *oh = NULL; herr_t ret_value = SUCCEED; @@ -1818,7 +1862,7 @@ H5O_bogus(H5G_entry_t *ent) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Get the object header */ - if (NULL==(oh=H5AC_protect(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL==(oh=H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* Create the "bogus" message */ @@ -1826,7 +1870,7 @@ H5O_bogus(H5G_entry_t *ent) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to update object 'bogus' message"); done: - if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh)<0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE(ret_value); @@ -1860,7 +1904,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence) +H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) { H5O_t *oh = NULL; int seq, nfailed = 0; @@ -1880,7 +1924,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); /* load the object header */ - if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, ent->header, NULL, NULL))) + if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); for (u = seq = 0; u < oh->nmesgs; u++) { @@ -1898,16 +1942,16 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence) if (oh->mesg[u].flags & H5O_FLAG_SHARED) { if (NULL==oh->mesg[u].native) { - sh_mesg = (H5O_SHARED->decode)(ent->file, oh->mesg[u].raw, + sh_mesg = (H5O_SHARED->decode)(ent->file, dxpl_id, oh->mesg[u].raw, NULL); if (NULL==(oh->mesg[u].native = sh_mesg)) HGOTO_ERROR (H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode shared message info"); } if (sh_mesg->in_gh) { - if (H5HG_link (ent->file, &(sh_mesg->u.gh), -1)<0) + if (H5HG_link (ent->file, dxpl_id, &(sh_mesg->u.gh), -1)<0) HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL, "unable to decrement link count on shared message"); } else { - if (H5O_link (&(sh_mesg->u.ent), -1)<0) + if (H5O_link (&(sh_mesg->u.ent), -1, dxpl_id)<0) HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL, "unable to decrement link count on shared message"); } } @@ -1917,7 +1961,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence) HDmemset(oh->mesg[u].raw, 0, oh->mesg[u].raw_size); oh->mesg[u].native = H5O_free (type, oh->mesg[u].native); oh->mesg[u].dirty = TRUE; - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; H5O_touch_oh(ent->file, oh, FALSE); } } @@ -1927,7 +1971,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to remove constant message(s)"); done: - if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, ent->header, oh) < 0 && ret_value>=0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh) < 0 && ret_value>=0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -2374,7 +2418,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) msg->dirty = TRUE; msg->native = NULL; - oh->dirty = TRUE; + oh->cache_info.dirty = TRUE; /* Set return value */ ret_value=idx; @@ -2383,6 +2427,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef NOT_YET /*------------------------------------------------------------------------- * Function: H5O_share @@ -2401,15 +2446,15 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5O_share (H5F_t *f, const H5O_class_t *type, const void *mesg, +static herr_t +H5O_share (H5F_t *f, hid_t dxpl_id, const H5O_class_t *type, const void *mesg, H5HG_t *hobj/*out*/) { size_t size; void *buf = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_share, FAIL); + FUNC_ENTER_NOINIT(H5O_share); /* Check args */ assert (f); @@ -2423,7 +2468,7 @@ H5O_share (H5F_t *f, const H5O_class_t *type, const void *mesg, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); if ((type->encode)(f, buf, mesg)<0) HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message"); - if (H5HG_insert (f, size, buf, hobj)<0) + if (H5HG_insert (f, dxpl_id, size, buf, hobj)<0) HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, "unable to store message in global heap"); } @@ -2433,6 +2478,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#endif /* NOT_YET */ /*------------------------------------------------------------------------- @@ -2452,7 +2498,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) +H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { H5O_t *oh = NULL; unsigned i, chunkno; @@ -2460,8 +2506,8 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) int *sequence; haddr_t tmp_addr; herr_t ret_value = FAIL; - void *(*decode)(H5F_t*, const uint8_t*, H5O_shared_t*); - herr_t (*debug)(H5F_t*, const void*, FILE*, int, int)=NULL; + void *(*decode)(H5F_t*, hid_t, const uint8_t*, H5O_shared_t*); + herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int)=NULL; FUNC_ENTER_NOAPI(H5O_debug, FAIL); @@ -2472,7 +2518,7 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) assert(indent >= 0); assert(fwidth >= 0); - if (NULL == (oh = H5AC_protect(f, H5AC_OHDR, addr, NULL, NULL))) + if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* debug */ @@ -2480,7 +2526,7 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Dirty:", - (int) (oh->dirty)); + (int) (oh->cache_info.dirty)); HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Version:", (int) (oh->version)); @@ -2576,13 +2622,13 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) debug = oh->mesg[i].type->debug; } if (NULL==oh->mesg[i].native && oh->mesg[i].type->decode) - oh->mesg[i].native = (decode)(f, oh->mesg[i].raw, NULL); + oh->mesg[i].native = (decode)(f, dxpl_id, oh->mesg[i].raw, NULL); if (NULL==oh->mesg[i].native) debug = NULL; /* print the message */ if (debug) - (debug)(f, oh->mesg[i].native, stream, indent+3, MAX(0, fwidth-3)); + (debug)(f, dxpl_id, oh->mesg[i].native, stream, indent+3, MAX(0, fwidth-3)); else HDfprintf(stream, "%*sNo info for this message.\n", indent + 3, ""); @@ -2591,14 +2637,14 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) H5O_shared_t *shared = (H5O_shared_t*)(oh->mesg[i].native); void *mesg = NULL; if (shared->in_gh) { - void *p = H5HG_read (f, oh->mesg[i].native, NULL); - mesg = (oh->mesg[i].type->decode)(f, p, oh->mesg[i].native); + void *p = H5HG_read (f, dxpl_id, oh->mesg[i].native, NULL); + mesg = (oh->mesg[i].type->decode)(f, dxpl_id, p, oh->mesg[i].native); H5MM_xfree (p); } else { - mesg = H5O_read (&(shared->u.ent), oh->mesg[i].type, 0, NULL); + mesg = H5O_read (&(shared->u.ent), oh->mesg[i].type, 0, NULL, dxpl_id); } if (oh->mesg[i].type->debug) { - (oh->mesg[i].type->debug)(f, mesg, stream, indent+3, + (oh->mesg[i].type->debug)(f, dxpl_id, mesg, stream, indent+3, MAX (0, fwidth-3)); } H5O_free (oh->mesg[i].type, mesg); @@ -2610,7 +2656,7 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: - if (oh && H5AC_unprotect(f, H5AC_OHDR, addr, oh) < 0 && ret_value>=0) + if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh) < 0 && ret_value>=0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Oattr.c b/src/H5Oattr.c index ae227e3..ddc7cdf 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -28,11 +28,11 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_attr_encode (H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_attr_decode (H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_attr_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static void *H5O_attr_copy (const void *_mesg, void *_dest); static size_t H5O_attr_size (H5F_t *f, const void *_mesg); static herr_t H5O_attr_reset (void *_mesg); -static herr_t H5O_attr_debug (H5F_t *f, const void *_mesg, +static herr_t H5O_attr_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -89,7 +89,7 @@ H5FL_EXTERN(H5S_simple_t); * Added a version number at the beginning. --------------------------------------------------------------------------*/ static void * -H5O_attr_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5A_t *attr = NULL; H5S_simple_t *simple; /*simple dimensionality information */ @@ -129,14 +129,14 @@ H5O_attr_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) p += H5O_ALIGN(name_len); /* advance the memory pointer */ /* decode the attribute datatype */ - if((attr->dt=(H5O_DTYPE->decode)(f,p,NULL))==NULL) + if((attr->dt=(H5O_DTYPE->decode)(f,dxpl_id,p,NULL))==NULL) HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype"); p += H5O_ALIGN(attr->dt_size); /* decode the attribute dataspace */ if (NULL==(attr->ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - if((simple=(H5O_SDSPACE->decode)(f,p,NULL))!=NULL) { + if((simple=(H5O_SDSPACE->decode)(f,dxpl_id,p,NULL))!=NULL) { hsize_t nelem; /* Number of elements in extent */ unsigned u; /* Local index variable */ @@ -412,7 +412,7 @@ done: parameter. --------------------------------------------------------------------------*/ static herr_t -H5O_attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, +H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth) { const H5A_t *mesg = (const H5A_t *)_mesg; @@ -436,20 +436,20 @@ H5O_attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, "Opened:", (unsigned int)mesg->ent_opened); fprintf(stream, "%*sSymbol table entry...\n", indent, ""); - H5G_ent_debug(f, &(mesg->ent), stream, indent+3, MAX(0, fwidth-3), + H5G_ent_debug(f, dxpl_id, &(mesg->ent), stream, indent+3, MAX(0, fwidth-3), HADDR_UNDEF); fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Data type size:", (unsigned long)(mesg->dt_size)); fprintf(stream, "%*sData type...\n", indent, ""); - (H5O_DTYPE->debug)(f, mesg->dt, stream, indent+3, MAX(0, fwidth-3)); + (H5O_DTYPE->debug)(f, dxpl_id, mesg->dt, stream, indent+3, MAX(0, fwidth-3)); fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Data space size:", (unsigned long)(mesg->ds_size)); fprintf(stream, "%*sData space...\n", indent, ""); - H5S_debug(f, mesg->ds, stream, indent+3, MAX(0, fwidth-3)); + H5S_debug(f, dxpl_id, mesg->ds, stream, indent+3, MAX(0, fwidth-3)); done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Obogus.c b/src/H5Obogus.c index b25e006..9609834 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -37,10 +37,10 @@ #define PABLO_MASK H5O_bogus_mask /* PRIVATE PROTOTYPES */ -static void *H5O_bogus_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_bogus_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_bogus_size(H5F_t *f, const void *_mesg); -static herr_t H5O_bogus_debug(H5F_t *f, const void *_mesg, FILE * stream, +static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -83,7 +83,7 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ static void * -H5O_bogus_decode(H5F_t UNUSED *f, const uint8_t *p, +H5O_bogus_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_bogus_t *mesg=NULL; @@ -198,7 +198,7 @@ H5O_bogus_size(H5F_t UNUSED *f, const void UNUSED *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_bogus_debug(H5F_t UNUSED *f, const void *_mesg, FILE *stream, +H5O_bogus_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_bogus_t *mesg = (const H5O_bogus_t *)_mesg; diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 18f5a76..673cc75 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -26,9 +26,9 @@ #define PABLO_MASK H5O_cont_mask /* PRIVATE PROTOTYPES */ -static void *H5O_cont_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_cont_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static herr_t H5O_cont_debug(H5F_t *f, const void *_mesg, FILE * stream, +static herr_t H5O_cont_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -69,7 +69,7 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ static void * -H5O_cont_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_cont_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_cont_t *cont = NULL; void *ret_value; @@ -148,7 +148,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_cont_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream, +H5O_cont_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth) { const H5O_cont_t *cont = (const H5O_cont_t *) _mesg; diff --git a/src/H5Odtype.c b/src/H5Odtype.c index aea382d..8ec160e 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -26,7 +26,7 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_dtype_encode (H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_dtype_decode (H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_dtype_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static void *H5O_dtype_copy (const void *_mesg, void *_dest); static size_t H5O_dtype_size (H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset (void *_mesg); @@ -35,7 +35,7 @@ static herr_t H5O_dtype_get_share (H5F_t *f, const void *_mesg, H5O_shared_t *sh); static herr_t H5O_dtype_set_share (H5F_t *f, void *_mesg, const H5O_shared_t *sh); -static herr_t H5O_dtype_debug (H5F_t *f, const void *_mesg, +static herr_t H5O_dtype_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -783,7 +783,7 @@ done: function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_dtype_decode(H5F_t *f, const uint8_t *p, +H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5T_t *dt = NULL; @@ -1155,7 +1155,7 @@ done: parameter. --------------------------------------------------------------------------*/ static herr_t -H5O_dtype_debug(H5F_t *f, const void *mesg, FILE *stream, +H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth) { const H5T_t *dt = (const H5T_t*)mesg; @@ -1233,12 +1233,12 @@ H5O_dtype_debug(H5F_t *f, const void *mesg, FILE *stream, fprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX(0, fwidth-3), "Byte offset:", (unsigned long) (dt->u.compnd.memb[i].offset)); - H5O_dtype_debug(f, dt->u.compnd.memb[i].type, stream, + H5O_dtype_debug(f, dxpl_id, dt->u.compnd.memb[i].type, stream, indent+3, MAX(0, fwidth - 3)); } } else if (H5T_ENUM==dt->type) { fprintf(stream, "%*s%s\n", indent, "", "Base type:"); - H5O_dtype_debug(f, dt->parent, stream, indent+3, MAX(0, fwidth-3)); + H5O_dtype_debug(f, dxpl_id, dt->parent, stream, indent+3, MAX(0, fwidth-3)); fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Number of members:", dt->u.enumer.nmembs); @@ -1280,7 +1280,7 @@ H5O_dtype_debug(H5F_t *f, const void *mesg, FILE *stream, } fprintf (stream, "}\n"); fprintf(stream, "%*s%s\n", indent, "", "Base type:"); - H5O_dtype_debug(f, dt->parent, stream, indent+3, MAX(0, fwidth-3)); + H5O_dtype_debug(f, dxpl_id, dt->parent, stream, indent+3, MAX(0, fwidth-3)); } else { switch (dt->u.atomic.order) { case H5T_ORDER_LE: diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 38b2dfb..67202f3 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -17,12 +17,12 @@ #define PABLO_MASK H5O_efl_mask /* PRIVATE PROTOTYPES */ -static void *H5O_efl_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_efl_copy(const void *_mesg, void *_dest); static size_t H5O_efl_size(H5F_t *f, const void *_mesg); static herr_t H5O_efl_reset(void *_mesg); -static herr_t H5O_efl_debug(H5F_t *f, const void *_mesg, FILE * stream, +static herr_t H5O_efl_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -68,7 +68,7 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ static void * -H5O_efl_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_efl_t *mesg = NULL; int i, version; @@ -103,7 +103,7 @@ H5O_efl_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) H5F_addr_decode(f, &p, &(mesg->heap_addr)); #ifndef NDEBUG assert (H5F_addr_defined(mesg->heap_addr)); - s = H5HL_peek (f, mesg->heap_addr, 0); + s = H5HL_peek (f, dxpl_id, mesg->heap_addr, 0); assert (s && !*s); #endif @@ -114,7 +114,7 @@ H5O_efl_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) for (i=0; inused; i++) { /* Name */ H5F_DECODE_LENGTH (f, p, mesg->slot[i].name_offset); - s = H5HL_peek(f, mesg->heap_addr, mesg->slot[i].name_offset); + s = H5HL_peek(f, dxpl_id, mesg->heap_addr, mesg->slot[i].name_offset); assert (s && *s); mesg->slot[i].name = H5MM_xstrdup (s); @@ -582,7 +582,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_efl_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream, +H5O_efl_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index dd98dc1..1314433 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -18,22 +18,22 @@ #define PABLO_MASK H5O_fill_mask -static void *H5O_fill_new_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_fill_new_copy(const void *_mesg, void *_dest); static size_t H5O_fill_new_size(H5F_t *f, const void *_mesg); static herr_t H5O_fill_new_reset(void *_mesg); static herr_t H5O_fill_new_free(void *_mesg); -static herr_t H5O_fill_new_debug(H5F_t *f, const void *_mesg, FILE *stream, +static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); -static void *H5O_fill_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_fill_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_fill_copy(const void *_mesg, void *_dest); static size_t H5O_fill_size(H5F_t *f, const void *_mesg); static herr_t H5O_fill_reset(void *_mesg); static herr_t H5O_fill_free(void *_mesg); -static herr_t H5O_fill_debug(H5F_t *f, const void *_mesg, FILE *stream, +static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O, for old fill value before version 1.5 */ @@ -100,7 +100,7 @@ H5FL_DEFINE(H5O_fill_t); *------------------------------------------------------------------------- */ static void * -H5O_fill_new_decode(H5F_t UNUSED *f, const uint8_t *p, +H5O_fill_new_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_fill_new_t *mesg=NULL; @@ -170,7 +170,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_decode(H5F_t UNUSED *f, const uint8_t *p, +H5O_fill_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_fill_t *mesg=NULL; @@ -664,7 +664,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_fill_new_debug(H5F_t UNUSED *f, const void *_mesg, FILE *stream, +H5O_fill_new_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; @@ -708,7 +708,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_fill_debug(H5F_t UNUSED *f, const void *_mesg, FILE *stream, +H5O_fill_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg; @@ -755,7 +755,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_fill_convert(void *_fill, H5T_t *dset_type) +H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id) { H5O_fill_new_t *fill = _fill; H5T_path_t *tpath=NULL; /*type conversion info */ @@ -779,7 +779,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type) /* * Can we convert between source and destination data types? */ - if (NULL==(tpath=H5T_path_find(fill->type, dset_type, NULL, NULL))) { + if (NULL==(tpath=H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types"); } @@ -804,7 +804,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); /* Do the conversion */ - if (H5T_convert(tpath, src_id, dst_id, (hsize_t)1, 0, 0, buf, bkg, H5P_DATASET_XFER_DEFAULT)<0) + if (H5T_convert(tpath, src_id, dst_id, (hsize_t)1, 0, 0, buf, bkg, dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); /* Update the fill message */ diff --git a/src/H5Ofphdf5.c b/src/H5Ofphdf5.c index 23c6351..88802ab 100644 --- a/src/H5Ofphdf5.c +++ b/src/H5Ofphdf5.c @@ -37,13 +37,13 @@ #define PABLO_MASK H5O_fphdf5_mask /* local prototypes */ -static void *H5O_fphdf5_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_fphdf5_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_fphdf5_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_fphdf5_size(H5F_t *f, const void *_mesg); static herr_t H5O_fphdf5_reset(void *_mesg); static void *H5O_fphdf5_copy(const void *mesg, void *dest); static herr_t H5O_fphdf5_free(void *_mesg); -static herr_t H5O_fphdf5_debug(H5F_t *f, const void *_mesg, +static herr_t H5O_fphdf5_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O */ @@ -94,7 +94,7 @@ H5FL_ARR_EXTERN(hsize_t); * Modifications: */ static void * -H5O_fphdf5_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_fphdf5_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_fphdf5_t *fmeta = NULL; /* New FPHDF5 metadata structure */ void *ret_value; @@ -511,7 +511,7 @@ done: * Modifications: */ static herr_t -H5O_fphdf5_debug(H5F_t UNUSED *f, const void *mesg, +H5O_fphdf5_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *mesg, FILE * stream, int indent, int fwidth) { const H5O_fphdf5_t *fmeta = (const H5O_fphdf5_t *) mesg; diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 96340d1..1b353c1 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -15,13 +15,13 @@ #include "H5Oprivate.h" /* PRIVATE PROTOTYPES */ -static void *H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_layout_copy(const void *_mesg, void *_dest); static size_t H5O_layout_size(H5F_t *f, const void *_mesg); static herr_t H5O_layout_reset (void *_mesg); static herr_t H5O_layout_free (void *_mesg); -static herr_t H5O_layout_debug(H5F_t *f, const void *_mesg, FILE * stream, +static herr_t H5O_layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -78,7 +78,7 @@ H5FL_DEFINE(H5O_layout_t); *------------------------------------------------------------------------- */ static void * -H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_layout_t *mesg = NULL; int version; @@ -445,7 +445,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_layout_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream, +H5O_layout_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; diff --git a/src/H5Omtime.c b/src/H5Omtime.c index a43c47a..15caf80 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -20,17 +20,17 @@ #define PABLO_MASK H5O_mtime_mask -static void *H5O_mtime_new_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_mtime_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_mtime_new_size(H5F_t *f, const void *_mesg); -static void *H5O_mtime_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_mtime_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_mtime_copy(const void *_mesg, void *_dest); static size_t H5O_mtime_size(H5F_t *f, const void *_mesg); static herr_t H5O_mtime_reset(void *_mesg); static herr_t H5O_mtime_free(void *_mesg); -static herr_t H5O_mtime_debug(H5F_t *f, const void *_mesg, FILE *stream, +static herr_t H5O_mtime_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O */ @@ -99,7 +99,7 @@ H5FL_DEFINE(time_t); *------------------------------------------------------------------------- */ static void * -H5O_mtime_new_decode(H5F_t UNUSED *f, const uint8_t *p, +H5O_mtime_new_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { time_t *mesg, the_time; @@ -156,7 +156,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_mtime_decode(H5F_t UNUSED *f, const uint8_t *p, +H5O_mtime_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { time_t *mesg, the_time; @@ -537,7 +537,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_mtime_debug(H5F_t UNUSED *f, const void *_mesg, FILE *stream, +H5O_mtime_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const time_t *mesg = (const time_t *)_mesg; diff --git a/src/H5Oname.c b/src/H5Oname.c index a74488c..c5c47fb 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -22,12 +22,12 @@ #define PABLO_MASK H5O_name_mask /* PRIVATE PROTOTYPES */ -static void *H5O_name_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_name_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_name_copy(const void *_mesg, void *_dest); static size_t H5O_name_size(H5F_t *f, const void *_mesg); static herr_t H5O_name_reset(void *_mesg); -static herr_t H5O_name_debug(H5F_t *f, const void *_mesg, FILE * stream, +static herr_t H5O_name_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -70,7 +70,7 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ static void * -H5O_name_decode(H5F_t UNUSED *f, const uint8_t *p, +H5O_name_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_name_t *mesg; @@ -273,7 +273,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_name_debug(H5F_t UNUSED *f, const void *_mesg, FILE *stream, +H5O_name_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_name_t *mesg = (const H5O_name_t *)_mesg; diff --git a/src/H5Opline.c b/src/H5Opline.c index 11be53e..d6284b0 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -21,12 +21,12 @@ static int interface_initialize_g = 0; #define H5O_PLINE_VERSION 1 static herr_t H5O_pline_encode (H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_pline_decode (H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_pline_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static void *H5O_pline_copy (const void *_mesg, void *_dest); static size_t H5O_pline_size (H5F_t *f, const void *_mesg); static herr_t H5O_pline_reset (void *_mesg); static herr_t H5O_pline_free (void *_mesg); -static herr_t H5O_pline_debug (H5F_t *f, const void *_mesg, +static herr_t H5O_pline_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -67,7 +67,7 @@ H5FL_DEFINE(H5O_pline_t); *------------------------------------------------------------------------- */ static void * -H5O_pline_decode(H5F_t UNUSED *f, const uint8_t *p, +H5O_pline_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_pline_t *pline = NULL; @@ -437,7 +437,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_pline_debug (H5F_t UNUSED *f, const void *mesg, FILE *stream, +H5O_pline_debug (H5F_t UNUSED *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth) { const H5O_pline_t *pline = (const H5O_pline_t *)mesg; diff --git a/src/H5Oplist.c b/src/H5Oplist.c index 8f5fc39..7c36136 100644 --- a/src/H5Oplist.c +++ b/src/H5Oplist.c @@ -33,11 +33,11 @@ #define PABLO_MASK H5O_plist_mask /* local prototypes */ -static void *H5O_plist_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_plist_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_plist_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_plist_size(H5F_t *f, const void *_mesg); static herr_t H5O_plist_free(void *_mesg); -static herr_t H5O_plist_debug(H5F_t *f, const void *_mesg, +static herr_t H5O_plist_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O */ @@ -131,7 +131,7 @@ H5FL_EXTERN(H5P_genplist_t); * Modifications: */ static void * -H5O_plist_decode(H5F_t UNUSED *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_plist_decode(H5F_t UNUSED *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5P_genplist_t *new_plist = NULL; H5P_genclass_t *pclass; /* property list class to modify */ @@ -483,7 +483,7 @@ done: * Modifications: */ static herr_t -H5O_plist_debug(H5F_t UNUSED *f, const void *mesg, FILE *stream, +H5O_plist_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth) { const H5P_genplist_t *plist = (const H5P_genplist_t *)mesg; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index c384362..a8a68b8 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -84,7 +84,7 @@ typedef struct H5O_class_t { int id; /*message type ID on disk */ const char *name; /*for debugging */ size_t native_size; /*size of native message */ - void *(*decode)(H5F_t*, const uint8_t*, struct H5O_shared_t*); + void *(*decode)(H5F_t*, hid_t, const uint8_t*, struct H5O_shared_t*); herr_t (*encode)(H5F_t*, uint8_t*, const void*); void *(*copy)(const void*, void*); /*copy native value */ size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */ @@ -92,7 +92,7 @@ typedef struct H5O_class_t { herr_t (*free)(void *); /*free main data struct */ herr_t (*get_share)(H5F_t*, const void*, struct H5O_shared_t*); herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); - herr_t (*debug)(H5F_t*, const void*, FILE*, int, int); + herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int); } H5O_class_t; typedef struct H5O_mesg_t { @@ -115,7 +115,6 @@ typedef struct H5O_chunk_t { typedef struct H5O_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ /* first field in structure */ - hbool_t dirty; /*out of data wrt disk */ int version; /*version number */ int nlink; /*link count */ unsigned nmesgs; /*number of messages */ @@ -358,38 +357,34 @@ typedef struct H5O_fphdf5_t { #endif /* H5_HAVE_FPHDF5 */ /* General message operators */ -H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, +H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/); -H5_DLL herr_t H5O_init(H5F_t *f, size_t size_hint, - H5G_entry_t *ent/*out*/, haddr_t header); H5_DLL herr_t H5O_open(H5G_entry_t *ent); H5_DLL herr_t H5O_close(H5G_entry_t *ent); -H5_DLL int H5O_link(H5G_entry_t *ent, int adjust); -H5_DLL int H5O_count(H5G_entry_t *ent, const H5O_class_t *type); +H5_DLL int H5O_link(H5G_entry_t *ent, int adjust, hid_t dxpl_id); +H5_DLL int H5O_count(H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id); H5_DLL htri_t H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, - int sequence); + int sequence, hid_t dxpl_id); H5_DLL void *H5O_read(H5G_entry_t *ent, const H5O_class_t *type, - int sequence, void *mesg); + int sequence, void *mesg, hid_t dxpl_id); H5_DLL int H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, - int overwrite, unsigned flags, unsigned update_time, const void *mesg); -H5_DLL H5O_t * H5O_protect(H5G_entry_t *ent); -H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, H5O_t *oh); -H5_DLL int H5O_append(H5F_t *f, H5O_t *oh, const H5O_class_t *type, + int overwrite, unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id); +H5_DLL H5O_t * H5O_protect(H5G_entry_t *ent, hid_t dxpl_id); +H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id); +H5_DLL int H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, unsigned flags, const void *mesg); -H5_DLL herr_t H5O_touch(H5G_entry_t *ent, hbool_t force); +H5_DLL herr_t H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id); H5_DLL herr_t H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force); #ifdef H5O_ENABLE_BOGUS -H5_DLL herr_t H5O_bogus(H5G_entry_t *ent); +H5_DLL herr_t H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh); #endif /* H5O_ENABLE_BOGUS */ H5_DLL herr_t H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, - int sequence); + int sequence, hid_t dxpl_id); H5_DLL herr_t H5O_reset(const H5O_class_t *type, void *native); H5_DLL void *H5O_free(const H5O_class_t *type, void *mesg); H5_DLL void *H5O_copy(const H5O_class_t *type, const void *mesg, void *dst); -H5_DLL herr_t H5O_share(H5F_t *f, const H5O_class_t *type, const void *mesg, - H5HG_t *hobj/*out*/); -H5_DLL herr_t H5O_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, +H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth); /* Layout operators */ @@ -403,6 +398,6 @@ H5_DLL herr_t H5O_efl_write(H5F_t *f, const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *buf); /* Fill value operators */ -H5_DLL herr_t H5O_fill_convert(void *_fill, H5T_t *type); +H5_DLL herr_t H5O_fill_convert(void *_fill, H5T_t *type, hid_t dxpl_id); #endif diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 2be7b2d..ada1850 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -25,13 +25,13 @@ #define PABLO_MASK H5O_sdspace_mask /* PRIVATE PROTOTYPES */ -static void *H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_sdspace_copy(const void *_mesg, void *_dest); static size_t H5O_sdspace_size(H5F_t *f, const void *_mesg); static herr_t H5O_sdspace_reset(void *_mesg); static herr_t H5O_sdspace_free (void *_mesg); -static herr_t H5O_sdspace_debug(H5F_t *f, const void *_mesg, +static herr_t H5O_sdspace_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -90,7 +90,7 @@ H5FL_ARR_EXTERN(hsize_t); Added a version number and reformatted the message for aligment. --------------------------------------------------------------------------*/ static void * -H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */ void *ret_value; @@ -414,7 +414,7 @@ done: parameter. --------------------------------------------------------------------------*/ static herr_t -H5O_sdspace_debug(H5F_t UNUSED *f, const void *mesg, +H5O_sdspace_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *mesg, FILE * stream, int indent, int fwidth) { const H5S_simple_t *sdim = (const H5S_simple_t *) mesg; diff --git a/src/H5Oshared.c b/src/H5Oshared.c index ad1fff7..cb68ddb 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -19,10 +19,10 @@ #include "H5MMprivate.h" #include "H5Oprivate.h" -static void *H5O_shared_decode (H5F_t*, const uint8_t*, H5O_shared_t *sh); +static void *H5O_shared_decode (H5F_t*, hid_t dxpl_id, const uint8_t*, H5O_shared_t *sh); static herr_t H5O_shared_encode (H5F_t*, uint8_t*, const void*); static size_t H5O_shared_size (H5F_t*, const void*); -static herr_t H5O_shared_debug (H5F_t*, const void*, FILE*, int, int); +static herr_t H5O_shared_debug (H5F_t*, hid_t dxpl_id, const void*, FILE*, int, int); /* This message derives from H5O */ const H5O_class_t H5O_SHARED[1] = {{ @@ -66,7 +66,7 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ static void * -H5O_shared_decode (H5F_t *f, const uint8_t *buf, H5O_shared_t UNUSED *sh) +H5O_shared_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *buf, H5O_shared_t UNUSED *sh) { H5O_shared_t *mesg=NULL; unsigned flags, version; @@ -217,7 +217,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_shared_debug (H5F_t UNUSED *f, const void *_mesg, +H5O_shared_debug (H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_shared_t *mesg = (const H5O_shared_t *)_mesg; @@ -246,7 +246,7 @@ H5O_shared_debug (H5F_t UNUSED *f, const void *_mesg, HDfprintf (stream, "%*s%-*s %s\n", indent, "", fwidth, "Sharing method", "Obj Hdr"); - H5G_ent_debug (f, &(mesg->u.ent), stream, indent, fwidth, + H5G_ent_debug (f, dxpl_id, &(mesg->u.ent), stream, indent, fwidth, HADDR_UNDEF); } diff --git a/src/H5Ostab.c b/src/H5Ostab.c index bcc70fd..24bba2e 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -24,12 +24,12 @@ #define PABLO_MASK H5O_stab_mask /* PRIVATE PROTOTYPES */ -static void *H5O_stab_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh); +static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_stab_copy(const void *_mesg, void *_dest); static size_t H5O_stab_size(H5F_t *f, const void *_mesg); static herr_t H5O_stab_free (void *_mesg); -static herr_t H5O_stab_debug(H5F_t *f, const void *_mesg, +static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); /* This message derives from H5O */ @@ -75,7 +75,7 @@ H5FL_DEFINE_STATIC(H5O_stab_t); *------------------------------------------------------------------------- */ static void * -H5O_stab_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) +H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_stab_t *stab=NULL; void *ret_value; /* Return value */ @@ -315,7 +315,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_stab_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream, +H5O_stab_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index e299c56..efcd8c6 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -981,7 +981,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/) /* * Can we convert between the source and destination data types? */ - if(NULL==(tpath=H5T_path_find(fill.type, type, NULL, NULL))) + if(NULL==(tpath=H5T_path_find(fill.type, type, NULL, NULL, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types"); src_id = H5I_register(H5I_DATATYPE, H5T_copy (fill.type, H5T_COPY_TRANSIENT)); if (src_id<0) @@ -1005,7 +1005,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/) HDmemcpy(buf, fill.buf, H5T_get_size(fill.type)); /* Do the conversion */ - if (H5T_convert(tpath, src_id, type_id, (hsize_t)1, 0, 0, buf, bkg, H5P_DATASET_XFER_DEFAULT)<0) + if (H5T_convert(tpath, src_id, type_id, (hsize_t)1, 0, 0, buf, bkg, H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); if (buf!=value) HDmemcpy(value, buf, H5T_get_size(type)); diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 4b25846..fae17de 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -178,7 +178,7 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive { hid_t driver_id; /* VFL driver ID */ void *driver_info; /* VFL driver info */ - void *tmp_driver_info; /* Temporary VFL driver info */ + void *copied_driver_info; /* Temporary VFL driver info */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5P_set_driver, FAIL); @@ -230,13 +230,13 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive H5I_inc_ref(new_driver_id); /* Make a copy of the driver information */ - if((tmp_driver_info = H5FD_dxpl_copy(new_driver_id, new_driver_info))==NULL) + if(H5FD_dxpl_copy(new_driver_id, new_driver_info, &copied_driver_info)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "Can't copy VFL driver"); /* Set the driver info for the property list */ if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &new_driver_id)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver ID"); - if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &tmp_driver_info) < 0) + if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info) < 0) HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver info"); } else { diff --git a/src/H5R.c b/src/H5R.c index 57fd5b4..64fdb6a 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -35,10 +35,10 @@ static herr_t H5R_init_interface(void); /* Static functions */ static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name, - H5R_type_t ref_type, H5S_t *space); -static hid_t H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref); -static H5S_t * H5R_get_region(H5F_t *file, H5R_type_t ref_type, void *_ref); -static int H5R_get_obj_type(H5F_t *file, H5R_type_t ref_type, void *_ref); + H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id); +static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref); +static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref); +static int H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref); /*-------------------------------------------------------------------------- @@ -136,7 +136,7 @@ H5R_term_interface(void) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space) +H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id) { H5G_stat_t sb; /* Stat buffer for retrieving OID */ herr_t ret_value=SUCCEED; /* Return value */ @@ -148,7 +148,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, assert(name); assert(ref_type>H5R_BADTYPE || ref_typefile,(size_t)buf_size,buf,&hobjid)<0) + if(H5HG_insert(loc->file,dxpl_id,(size_t)buf_size,buf,&hobjid)<0) HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection"); /* Serialize the heap ID and index for storage in the file */ @@ -298,7 +298,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Create reference */ - if ((ret_value=H5R_create(ref,loc,name,ref_type,space))<0) + if ((ret_value=H5R_create(ref,loc,name,ref_type,space, H5AC_dxpl_id))<0) HGOTO_ERROR (H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to create reference"); done: @@ -329,7 +329,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hid_t -H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref) +H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref) { H5G_t *group; /* Pointer to group to open */ H5T_t *datatype; /* Pointer to datatype to open */ @@ -375,7 +375,7 @@ H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref) INT32DECODE(p,hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if((buf=H5HG_read(ent.file,&hobjid,NULL))==NULL) + if((buf=H5HG_read(ent.file,dxpl_id,&hobjid,NULL))==NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information"); /* Get the object oid for the dataset */ @@ -398,14 +398,14 @@ H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref) } /* end switch */ /* Check to make certain that this object hasn't been deleted since the reference was created */ - if(H5O_link(&ent,0)<=0) + if(H5O_link(&ent,0,dxpl_id)<=0) HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object"); /* Open the dataset object */ - oid_type=H5G_get_type(&ent); + oid_type=H5G_get_type(&ent,dxpl_id); switch(oid_type) { case H5G_GROUP: - if ((group=H5G_open_oid(&ent)) == NULL) + if ((group=H5G_open_oid(&ent,dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found"); /* Create an atom for the dataset */ @@ -416,7 +416,7 @@ H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref) break; case H5G_TYPE: - if ((datatype=H5T_open_oid(&ent)) == NULL) + if ((datatype=H5T_open_oid(&ent, dxpl_id)) == NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found"); /* Create an atom for the dataset */ @@ -428,7 +428,7 @@ H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref) case H5G_DATASET: /* Open the dataset */ - if ((ret_value=H5D_open(&ent)) < 0) + if ((ret_value=H5D_open(&ent,dxpl_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found"); break; @@ -485,7 +485,7 @@ H5Rdereference(hid_t id, H5R_type_t ref_type, void *_ref) file=loc->file; /* Create reference */ - if ((ret_value=H5R_dereference(file, ref_type, _ref))<0) + if ((ret_value=H5R_dereference(file, H5AC_dxpl_id, ref_type, _ref))<0) HGOTO_ERROR (H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object"); done: @@ -516,7 +516,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5S_t * -H5R_get_region(H5F_t *file, H5R_type_t UNUSED ref_type, void *_ref) +H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t UNUSED ref_type, void *_ref) { H5G_entry_t ent; /* Symbol table entry */ uint8_t *p; /* Pointer to OID to store */ @@ -542,7 +542,7 @@ H5R_get_region(H5F_t *file, H5R_type_t UNUSED ref_type, void *_ref) INT32DECODE(p,hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if((buf=H5HG_read(ent.file,&hobjid,NULL))==NULL) + if((buf=H5HG_read(ent.file,dxpl_id,&hobjid,NULL))==NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information"); /* Get the object oid for the dataset */ @@ -550,7 +550,7 @@ H5R_get_region(H5F_t *file, H5R_type_t UNUSED ref_type, void *_ref) H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header)); /* Open and copy the dataset's dataspace */ - if ((ret_value=H5S_read(&ent)) == NULL) + if ((ret_value=H5S_read(&ent, dxpl_id)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found"); /* Unserialize the selection */ @@ -611,7 +611,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, void *_ref) file=loc->file; /* Get the dataspace with the correct region selected */ - if ((space=H5R_get_region(file,ref_type,_ref))==NULL) + if ((space=H5R_get_region(file,H5AC_dxpl_id,ref_type,_ref))==NULL) HGOTO_ERROR (H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace"); /* Atomize */ @@ -751,7 +751,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5R_get_obj_type(H5F_t *file, H5R_type_t ref_type, void *_ref) +H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref) { H5G_entry_t ent; /* Symbol table entry */ uint8_t *p; /* Pointer to OID to store */ @@ -790,7 +790,7 @@ H5R_get_obj_type(H5F_t *file, H5R_type_t ref_type, void *_ref) INT32DECODE(p,hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if((buf=H5HG_read(ent.file,&hobjid,NULL))==NULL) + if((buf=H5HG_read(ent.file,dxpl_id,&hobjid,NULL))==NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, H5G_UNKNOWN, "Unable to read dataset region information"); /* Get the object oid for the dataset */ @@ -813,11 +813,11 @@ H5R_get_obj_type(H5F_t *file, H5R_type_t ref_type, void *_ref) } /* end switch */ /* Check to make certain that this object hasn't been deleted since the reference was created */ - if(H5O_link(&ent,0)<=0) + if(H5O_link(&ent,0,dxpl_id)<=0) HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, H5G_UNKNOWN, "dereferencing deleted object"); /* Get the OID type */ - ret_value=H5G_get_type(&ent); + ret_value=H5G_get_type(&ent,dxpl_id); done: FUNC_LEAVE_NOAPI(ret_value); @@ -869,7 +869,7 @@ H5Rget_obj_type(hid_t id, H5R_type_t ref_type, void *_ref) file=loc->file; /* Get the object information */ - if ((ret_value=H5R_get_obj_type(file,ref_type,_ref))<0) + if ((ret_value=H5R_get_obj_type(file,H5AC_dxpl_id,ref_type,_ref))<0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type"); done: diff --git a/src/H5S.c b/src/H5S.c index 980c87f..d19c71a 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1075,7 +1075,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_modify(H5G_entry_t *ent, const H5S_t *ds, hbool_t update_time) +H5S_modify(H5G_entry_t *ent, const H5S_t *ds, hbool_t update_time, hid_t dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1087,7 +1087,7 @@ H5S_modify(H5G_entry_t *ent, const H5S_t *ds, hbool_t update_time) switch (ds->extent.type) { case H5S_SCALAR: case H5S_SIMPLE: - if (H5O_modify(ent, H5O_SDSPACE, 0, 0, update_time, &(ds->extent.u.simple))<0) + if (H5O_modify(ent, H5O_SDSPACE, 0, 0, update_time, &(ds->extent.u.simple), dxpl_id)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple data space message"); break; @@ -1120,7 +1120,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_append(H5F_t *f, H5O_t *oh, const H5S_t *ds) +H5S_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5S_t *ds) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1133,7 +1133,7 @@ H5S_append(H5F_t *f, H5O_t *oh, const H5S_t *ds) switch (ds->extent.type) { case H5S_SCALAR: case H5S_SIMPLE: - if (H5O_append(f, oh, H5O_SDSPACE, 0, &(ds->extent.u.simple))<0) + if (H5O_append(f, dxpl_id, oh, H5O_SDSPACE, 0, &(ds->extent.u.simple))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple data space message"); break; @@ -1169,7 +1169,7 @@ done: *------------------------------------------------------------------------- */ H5S_t * -H5S_read(H5G_entry_t *ent) +H5S_read(H5G_entry_t *ent, hid_t dxpl_id) { H5S_t *ds = NULL; /* Dataspace to return */ H5S_t *ret_value; /* Return value */ @@ -1182,7 +1182,7 @@ H5S_read(H5G_entry_t *ent) if (NULL==(ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - if (H5O_read(ent, H5O_SDSPACE, 0, &(ds->extent.u.simple)) == NULL) + if (H5O_read(ent, H5O_SDSPACE, 0, &(ds->extent.u.simple), dxpl_id) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to load dataspace info from dataset header"); if(ds->extent.u.simple.rank != 0) { @@ -2022,7 +2022,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth) +H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5S_t *mesg = (const H5S_t*)_mesg; herr_t ret_value=SUCCEED; /* Return value */ @@ -2038,7 +2038,7 @@ H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth) case H5S_SIMPLE: fprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth, "Space class:"); - (H5O_SDSPACE->debug)(f, &(mesg->extent.u.simple), stream, + (H5O_SDSPACE->debug)(f, dxpl_id, &(mesg->extent.u.simple), stream, indent+3, MAX(0, fwidth-3)); break; diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 0c267ac..903276a 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -151,15 +151,15 @@ H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/, H5_DLL herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max); H5_DLL herr_t H5S_modify(struct H5G_entry_t *ent, const H5S_t *space, - hbool_t update_time); -H5_DLL herr_t H5S_append(H5F_t *f, H5O_t *oh, const H5S_t *ds); -H5_DLL H5S_t *H5S_read(struct H5G_entry_t *ent); + hbool_t update_time, hid_t dxpl_id); +H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5S_t *ds); +H5_DLL H5S_t *H5S_read(struct H5G_entry_t *ent, hid_t dxpl_id); H5_DLL int H5S_cmp(const H5S_t *ds1, const H5S_t *ds2); H5_DLL htri_t H5S_is_simple(const H5S_t *sdim); H5_DLL herr_t H5S_extent_release(H5S_t *space); H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size); H5_DLL int H5S_set_extent(H5S_t *space, const hsize_t *size); -H5_DLL herr_t H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, +H5_DLL herr_t H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); /* Operations on selections */ diff --git a/src/H5T.c b/src/H5T.c index 26812b4..80a4831 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -233,7 +233,7 @@ H5FL_DEFINE(H5T_path_t); /* Static local functions */ static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_t func); + H5T_t *dst, H5T_conv_t func, hid_t dxpl_id); static H5T_t * H5T_vlen_create(H5T_t *base); @@ -1662,23 +1662,23 @@ H5T_init_interface(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); status = 0; - status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T_conv_i_i); - status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T_conv_f_f); - status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T_conv_s_s); - status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T_conv_b_b); - status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T_conv_order); - status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T_conv_order_opt); - status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T_conv_order); - status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T_conv_order_opt); - status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T_conv_struct); - status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T_conv_struct_opt); - status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T_conv_enum); - status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T_conv_vlen); - status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T_conv_array); + status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T_conv_i_i, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T_conv_f_f, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T_conv_s_s, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T_conv_b_b, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T_conv_order, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T_conv_order_opt, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T_conv_order, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T_conv_order_opt, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T_conv_struct, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T_conv_struct_opt, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T_conv_enum, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T_conv_vlen, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T_conv_array, H5AC_dxpl_id); /* Custom conversion for 32-bit ints to 64-bit floats (undocumented) */ - status |= H5T_register(H5T_PERS_HARD, "u32le_f64le", std_u32le, ieee_f64le, H5T_conv_i32le_f64le); - status |= H5T_register(H5T_PERS_HARD, "i32le_f64le", std_i32le, ieee_f64le, H5T_conv_i32le_f64le); + status |= H5T_register(H5T_PERS_HARD, "u32le_f64le", std_u32le, ieee_f64le, H5T_conv_i32le_f64le, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "i32le_f64le", std_i32le, ieee_f64le, H5T_conv_i32le_f64le, H5AC_dxpl_id); /* * Native conversions should be listed last since we can use hardware to @@ -1689,115 +1689,115 @@ H5T_init_interface(void) */ /* floating point */ - status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T_conv_float_double); - status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T_conv_double_float); + status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T_conv_float_double, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T_conv_double_float, H5AC_dxpl_id); /* from long_long */ - status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T_conv_llong_ullong); - status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T_conv_ullong_llong); - status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T_conv_llong_long); - status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T_conv_llong_ulong); - status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T_conv_ullong_long); - status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T_conv_ullong_ulong); - status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T_conv_llong_short); - status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T_conv_llong_ushort); - status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T_conv_ullong_short); - status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T_conv_ullong_ushort); - status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T_conv_llong_int); - status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T_conv_llong_uint); - status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T_conv_ullong_int); - status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T_conv_ullong_uint); - status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T_conv_llong_schar); - status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T_conv_llong_uchar); - status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T_conv_ullong_schar); - status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T_conv_ullong_uchar); + status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T_conv_llong_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T_conv_ullong_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T_conv_llong_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T_conv_llong_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T_conv_ullong_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T_conv_ullong_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T_conv_llong_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T_conv_llong_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T_conv_ullong_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T_conv_ullong_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T_conv_llong_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T_conv_llong_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T_conv_ullong_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T_conv_ullong_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T_conv_llong_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T_conv_llong_uchar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T_conv_ullong_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T_conv_ullong_uchar, H5AC_dxpl_id); /* From long */ - status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T_conv_long_llong); - status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T_conv_long_ullong); - status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T_conv_ulong_llong); - status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T_conv_ulong_ullong); - status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T_conv_long_ulong); - status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T_conv_ulong_long); - status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T_conv_long_short); - status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T_conv_long_ushort); - status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T_conv_ulong_short); - status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T_conv_ulong_ushort); - status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T_conv_long_int); - status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T_conv_long_uint); - status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T_conv_ulong_int); - status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T_conv_ulong_uint); - status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T_conv_long_schar); - status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T_conv_long_uchar); - status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T_conv_ulong_schar); - status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T_conv_ulong_uchar); + status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T_conv_long_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T_conv_long_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T_conv_ulong_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T_conv_ulong_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T_conv_long_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T_conv_ulong_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T_conv_long_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T_conv_long_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T_conv_ulong_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T_conv_ulong_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T_conv_long_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T_conv_long_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T_conv_ulong_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T_conv_ulong_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T_conv_long_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T_conv_long_uchar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T_conv_ulong_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T_conv_ulong_uchar, H5AC_dxpl_id); /* From short */ - status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T_conv_short_llong); - status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T_conv_short_ullong); - status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T_conv_ushort_llong); - status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T_conv_ushort_ullong); - status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T_conv_short_long); - status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T_conv_short_ulong); - status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T_conv_ushort_long); - status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T_conv_ushort_ulong); - status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T_conv_short_ushort); - status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T_conv_ushort_short); - status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T_conv_short_int); - status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T_conv_short_uint); - status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T_conv_ushort_int); - status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T_conv_ushort_uint); - status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T_conv_short_schar); - status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T_conv_short_uchar); - status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T_conv_ushort_schar); - status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T_conv_ushort_uchar); + status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T_conv_short_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T_conv_short_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T_conv_ushort_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T_conv_ushort_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T_conv_short_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T_conv_short_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T_conv_ushort_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T_conv_ushort_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T_conv_short_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T_conv_ushort_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T_conv_short_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T_conv_short_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T_conv_ushort_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T_conv_ushort_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T_conv_short_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T_conv_short_uchar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T_conv_ushort_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T_conv_ushort_uchar, H5AC_dxpl_id); /* From int */ - status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T_conv_int_llong); - status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T_conv_int_ullong); - status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T_conv_uint_llong); - status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T_conv_uint_ullong); - status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T_conv_int_long); - status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T_conv_int_ulong); - status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T_conv_uint_long); - status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T_conv_uint_ulong); - status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T_conv_int_short); - status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T_conv_int_ushort); - status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T_conv_uint_short); - status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T_conv_uint_ushort); - status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T_conv_int_uint); - status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T_conv_uint_int); - status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T_conv_int_schar); - status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T_conv_int_uchar); - status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T_conv_uint_schar); - status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T_conv_uint_uchar); + status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T_conv_int_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T_conv_int_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T_conv_uint_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T_conv_uint_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T_conv_int_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T_conv_int_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T_conv_uint_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T_conv_uint_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T_conv_int_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T_conv_int_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T_conv_uint_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T_conv_uint_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T_conv_int_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T_conv_uint_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T_conv_int_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T_conv_int_uchar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T_conv_uint_schar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T_conv_uint_uchar, H5AC_dxpl_id); /* From char */ - status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T_conv_schar_llong); - status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T_conv_schar_ullong); - status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T_conv_uchar_llong); - status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T_conv_uchar_ullong); - status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T_conv_schar_long); - status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T_conv_schar_ulong); - status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T_conv_uchar_long); - status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T_conv_uchar_ulong); - status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T_conv_schar_short); - status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T_conv_schar_ushort); - status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T_conv_uchar_short); - status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T_conv_uchar_ushort); - status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T_conv_schar_int); - status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T_conv_schar_uint); - status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T_conv_uchar_int); - status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T_conv_uchar_uint); - status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T_conv_schar_uchar); - status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T_conv_uchar_schar); + status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T_conv_schar_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T_conv_schar_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T_conv_uchar_llong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T_conv_uchar_ullong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T_conv_schar_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T_conv_schar_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T_conv_uchar_long, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T_conv_uchar_ulong, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T_conv_schar_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T_conv_schar_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T_conv_uchar_short, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T_conv_uchar_ushort, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T_conv_schar_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T_conv_schar_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T_conv_uchar_int, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T_conv_uchar_uint, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T_conv_schar_uchar, H5AC_dxpl_id); + status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T_conv_uchar_schar, H5AC_dxpl_id); /* * The special no-op conversion is the fastest, so we list it last. The * data types we use are not important as long as the source and * destination are equal. */ - status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T_conv_noop); + status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T_conv_noop, H5AC_dxpl_id); if (status<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)"); @@ -1897,7 +1897,7 @@ H5T_term_interface(void) H5T_print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; if ((path->func)(FAIL, FAIL, &(path->cdata), - (hsize_t)0, 0, 0, NULL, NULL,H5P_DATASET_XFER_DEFAULT)<0) { + (hsize_t)0, 0, 0, NULL, NULL,H5AC_dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function " @@ -2108,7 +2108,7 @@ H5Topen(hid_t loc_id, const char *name) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Open it */ - if (NULL==(type=H5T_open (loc, name))) + if (NULL==(type=H5T_open (loc, name, H5AC_dxpl_id))) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named data type"); /* Register the type and return the ID */ @@ -2159,7 +2159,7 @@ H5Tcommit(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); /* Commit the type */ - if (H5T_commit (loc, name, type)<0) + if (H5T_commit (loc, name, type, H5AC_dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit data type"); done: @@ -5722,7 +5722,7 @@ done: */ static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, - H5T_conv_t func) + H5T_conv_t func, hid_t dxpl_id) { hid_t tmp_sid=-1, tmp_did=-1;/*temporary data type IDs */ H5T_path_t *old_path=NULL; /*existing conversion path */ @@ -5743,7 +5743,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if (H5T_PERS_HARD==pers) { /* Locate or create a new conversion path */ - if (NULL==(new_path=H5T_path_find(src, dst, name, func))) + if (NULL==(new_path=H5T_path_find(src, dst, name, func, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path"); /* @@ -5796,7 +5796,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data types for conv query"); HDmemset(&cdata, 0, sizeof cdata); cdata.command = H5T_CONV_INIT; - if ((func)(tmp_sid, tmp_did, &cdata, (hsize_t)0, 0, 0, NULL, NULL, H5P_DATASET_XFER_DEFAULT)<0) { + if ((func)(tmp_sid, tmp_did, &cdata, (hsize_t)0, 0, 0, NULL, NULL, dxpl_id)<0) { H5I_dec_ref(tmp_sid); H5I_dec_ref(tmp_did); tmp_sid = tmp_did = -1; @@ -5823,7 +5823,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, /* Free old path */ H5T_print_stats(old_path, &nprint); old_path->cdata.command = H5T_CONV_FREE; - if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata), (hsize_t)0, 0, 0, NULL, NULL, H5P_DATASET_XFER_DEFAULT)<0) { + if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata), (hsize_t)0, 0, 0, NULL, NULL, dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " @@ -5910,7 +5910,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified"); /* Go register the function */ - if(H5T_register(pers,name,src,dst,func)<0) + if(H5T_register(pers,name,src,dst,func,H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function"); done: @@ -5939,7 +5939,7 @@ done: */ herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, - H5T_conv_t func) + H5T_conv_t func, hid_t dxpl_id) { H5T_path_t *path = NULL; /*conversion path */ H5T_soft_t *soft = NULL; /*soft conversion information */ @@ -5985,7 +5985,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_print_stats(path, &nprint); path->cdata.command = H5T_CONV_FREE; if ((path->func)(FAIL, FAIL, &(path->cdata), (hsize_t)0, 0, 0, NULL, NULL, - H5P_DATASET_XFER_DEFAULT)<0) { + dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " @@ -6040,7 +6040,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, if (dst_id>0 && (NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type"); - if (H5T_unregister(pers,name,src,dst,func)<0) + if (H5T_unregister(pers,name,src,dst,func,H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed"); done: @@ -6086,7 +6086,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer"); /* Find it */ - if (NULL==(path=H5T_path_find(src, dst, NULL, NULL))) + if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found"); if (pcdata) @@ -6129,30 +6129,30 @@ done: */ herr_t H5Tconvert(hid_t src_id, hid_t dst_id, hsize_t nelmts, void *buf, - void *background, hid_t plist_id) + void *background, hid_t dxpl_id) { H5T_path_t *tpath=NULL; /*type conversion info */ H5T_t *src=NULL, *dst=NULL; /*unatomized types */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tconvert, FAIL); - H5TRACE6("e","iihxxi",src_id,dst_id,nelmts,buf,background,plist_id); + H5TRACE6("e","iihxxi",src_id,dst_id,nelmts,buf,background,dxpl_id); /* Check args */ if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) || NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if(H5P_DEFAULT == plist_id) - plist_id = H5P_DATASET_XFER_DEFAULT; + if(H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; else - if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset transfer property list"); /* Find the conversion function */ - if (NULL==(tpath=H5T_path_find(src, dst, NULL, NULL))) + if (NULL==(tpath=H5T_path_find(src, dst, NULL, NULL, dxpl_id))) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types"); - if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, buf, background, plist_id)<0) + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, buf, background, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); done: @@ -6347,14 +6347,14 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T_isa(H5G_entry_t *ent) +H5T_isa(H5G_entry_t *ent, hid_t dxpl_id) { htri_t ret_value; FUNC_ENTER_NOAPI(H5T_isa, FAIL); assert(ent); - if ((ret_value=H5O_exists(ent, H5O_DTYPE, 0))<0) + if ((ret_value=H5O_exists(ent, H5O_DTYPE, 0, dxpl_id))<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to read object header"); done: @@ -6380,7 +6380,7 @@ done: *------------------------------------------------------------------------- */ H5T_t * -H5T_open (H5G_entry_t *loc, const char *name) +H5T_open (H5G_entry_t *loc, const char *name, hid_t dxpl_id) { H5T_t *dt; H5G_entry_t ent; @@ -6395,11 +6395,11 @@ H5T_open (H5G_entry_t *loc, const char *name) * Find the named data type object header and read the data type message * from it. */ - if (H5G_find (loc, name, NULL, &ent/*out*/)<0) + if (H5G_find (loc, name, NULL, &ent/*out*/, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found"); /* Open the datatype object */ - if ((dt=H5T_open_oid(&ent)) ==NULL) + if ((dt=H5T_open_oid(&ent, dxpl_id)) ==NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found"); /* Set return value */ @@ -6427,7 +6427,7 @@ done: *------------------------------------------------------------------------- */ H5T_t * -H5T_open_oid (H5G_entry_t *ent) +H5T_open_oid (H5G_entry_t *ent, hid_t dxpl_id) { H5T_t *dt=NULL; H5T_t *ret_value; @@ -6438,7 +6438,7 @@ H5T_open_oid (H5G_entry_t *ent) if (H5O_open (ent)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named data type"); - if (NULL==(dt=H5O_read (ent, H5O_DTYPE, 0, NULL))) + if (NULL==(dt=H5O_read (ent, H5O_DTYPE, 0, NULL, dxpl_id))) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header"); /* Mark the type as named and open */ @@ -6693,7 +6693,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type) +H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id) { H5F_t *file = NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -6719,18 +6719,18 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible"); /* Find the insertion file */ - if (NULL==(file=H5G_insertion_file(loc, name))) + if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to find insertion point"); /* * Create the object header and open it for write access. Insert the data * type message and then give the object header a name. */ - if (H5O_create (file, 64, &(type->ent))<0) + if (H5O_create (file, dxpl_id, 64, &(type->ent))<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create data type object header"); - if (H5O_modify (&(type->ent), H5O_DTYPE, 0, H5O_FLAG_CONSTANT, 1, type)<0) + if (H5O_modify (&(type->ent), H5O_DTYPE, 0, H5O_FLAG_CONSTANT, 1, type, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message"); - if (H5G_insert (loc, name, &(type->ent))<0) + if (H5G_insert (loc, name, &(type->ent), dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name data type"); type->state = H5T_STATE_OPEN; @@ -8280,7 +8280,7 @@ done: */ H5T_path_t * H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, - H5T_conv_t func) + H5T_conv_t func, hid_t dxpl_id) { int lt, rt; /*left and right edges */ int md; /*middle */ @@ -8310,7 +8310,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_g.path[0]->func = H5T_conv_noop; H5T_g.path[0]->cdata.command = H5T_CONV_INIT; if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), (hsize_t)0, 0, 0, - NULL, NULL, H5P_DATASET_XFER_DEFAULT)<0) { + NULL, NULL, dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: unable to initialize no-op " @@ -8397,7 +8397,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register destination conversion type for query"); path->cdata.command = H5T_CONV_INIT; if ((func)(src_id, dst_id, &(path->cdata), (hsize_t)0, 0, 0, NULL, NULL, - H5P_DATASET_XFER_DEFAULT)<0) + dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function"); if (src_id>=0) H5I_dec_ref(src_id); if (dst_id>=0) H5I_dec_ref(dst_id); @@ -8425,7 +8425,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register conversion types for query"); path->cdata.command = H5T_CONV_INIT; if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata), - (hsize_t)0, 0, 0, NULL, NULL, H5P_DATASET_XFER_DEFAULT)<0) { + (hsize_t)0, 0, 0, NULL, NULL, dxpl_id)<0) { HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t)); H5E_clear(); /*ignore the error*/ } else { @@ -8469,7 +8469,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_print_stats(table, &nprint/*in,out*/); table->cdata.command = H5T_CONV_FREE; if ((table->func)(FAIL, FAIL, &(table->cdata), (hsize_t)0, 0, 0, NULL, NULL, - H5P_DATASET_XFER_DEFAULT)<0) { + dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free " diff --git a/src/H5Tconv.c b/src/H5Tconv.c index a6f8dbb..c2a9691 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -426,7 +426,7 @@ herr_t H5T_conv_noop(hid_t UNUSED src_id, hid_t UNUSED dst_id, H5T_cdata_t *cdata, hsize_t UNUSED nelmts, size_t UNUSED buf_stride, size_t UNUSED bkg_stride, void UNUSED *buf, - void UNUSED *background, hid_t UNUSED dset_xfer_plist) + void UNUSED *background, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -475,7 +475,7 @@ herr_t H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *_buf, - void UNUSED *background, hid_t UNUSED dset_xfer_plist) + void UNUSED *background, hid_t UNUSED dxpl_id) { uint8_t *buf = (uint8_t*)_buf; H5T_t *src = NULL; @@ -858,7 +858,7 @@ done: herr_t H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *_buf, - void UNUSED *background, hid_t UNUSED dset_xfer_plist) + void UNUSED *background, hid_t UNUSED dxpl_id) { uint8_t *buf = (uint8_t*)_buf; H5T_t *src = NULL; @@ -955,7 +955,7 @@ done: herr_t H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *_buf, - void UNUSED *background, hid_t UNUSED dset_xfer_plist) + void UNUSED *background, hid_t UNUSED dxpl_id) { uint8_t *buf = (uint8_t*)_buf; H5T_t *src=NULL, *dst=NULL; /*source and dest data types */ @@ -1171,7 +1171,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) +H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id) { H5T_conv_struct_t *priv = (H5T_conv_struct_t*)(cdata->priv); int i, j, *src2dst = NULL; @@ -1245,7 +1245,7 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) for (i=0; iu.compnd.nmembs; i++) { if (src2dst[i]>=0) { H5T_path_t *tpath = H5T_path_find(src->u.compnd.memb[i].type, - dst->u.compnd.memb[src2dst[i]].type, NULL, NULL); + dst->u.compnd.memb[src2dst[i]].type, NULL, NULL, dxpl_id); if (NULL==(priv->memb_path[i] = tpath)) { H5MM_xfree(priv->src2dst); @@ -1312,7 +1312,7 @@ done: herr_t H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf, void *_bkg, - hid_t dset_xfer_plist) + hid_t dxpl_id) { uint8_t *buf = (uint8_t *)_buf; /*cast for pointer arithmetic */ uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */ @@ -1345,7 +1345,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, assert (H5T_COMPOUND==src->type); assert (H5T_COMPOUND==dst->type); - if (H5T_conv_struct_init (src, dst, cdata)<0) + if (H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); break; @@ -1370,7 +1370,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, assert (priv); assert (bkg && cdata->need_bkg); - if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata)<0) + if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); /* @@ -1417,7 +1417,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, priv->dst_memb_id[src2dst[i]], (hsize_t)1, 0, 0, /*no striding (packed array)*/ xbuf+src_memb->offset, xbkg+dst_memb->offset, - dset_xfer_plist)<0) + dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); HDmemmove (xbuf+offset, xbuf+src_memb->offset, dst_memb->size); @@ -1447,7 +1447,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, priv->src_memb_id[i], priv->dst_memb_id[src2dst[i]], (hsize_t)1, 0, 0, /*no striding (packed array)*/ xbuf+offset, xbkg+dst_memb->offset, - dset_xfer_plist)<0) + dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); } else { offset -= dst_memb->size; @@ -1544,7 +1544,7 @@ done: herr_t H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf, - void *_bkg, hid_t dset_xfer_plist) + void *_bkg, hid_t dxpl_id) { uint8_t *buf = (uint8_t *)_buf; /*cast for pointer arithmetic */ uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */ @@ -1578,7 +1578,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, assert (H5T_COMPOUND==dst->type); /* Initialize data which is relatively constant */ - if (H5T_conv_struct_init (src, dst, cdata)<0) + if (H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); priv = (H5T_conv_struct_t *)(cdata->priv); src2dst = priv->src2dst; @@ -1643,7 +1643,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); /* Update cached data if necessary */ - if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata)<0) + if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); priv = (H5T_conv_struct_t *)(cdata->priv); src2dst = priv->src2dst; @@ -1688,7 +1688,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, priv->dst_memb_id[src2dst[i]], nelmts, buf_stride ? buf_stride : src->size, bkg_stride, xbuf, xbkg, - dset_xfer_plist)<0) + dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); for (elmtno=0; elmtnosize); @@ -1726,7 +1726,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, priv->dst_memb_id[src2dst[i]], nelmts, buf_stride ? buf_stride : src->size, bkg_stride, xbuf, xbkg, - dset_xfer_plist)<0) + dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member"); for (elmtno=0; elmtnosize); @@ -1913,7 +1913,7 @@ done: herr_t H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *_buf, - void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void UNUSED *bkg, hid_t UNUSED dxpl_id) { uint8_t *buf = (uint8_t*)_buf; /*cast for pointer arithmetic */ H5T_t *src=NULL, *dst=NULL; /*src and dst data types */ @@ -2094,7 +2094,7 @@ done: herr_t H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf, - void *_bkg, hid_t dset_xfer_plist) + void *_bkg, hid_t dxpl_id) { H5T_path_t *tpath; /* Type conversion path */ hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ @@ -2213,7 +2213,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); /* Set up conversion path for base elements */ - if (NULL==(tpath=H5T_path_find(src->parent, dst->parent, NULL, NULL))) { + if (NULL==(tpath=H5T_path_find(src->parent, dst->parent, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes"); } else if (!H5T_IS_NOOP(tpath)) { if ((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->parent, H5T_COPY_ALL)))<0 || @@ -2253,7 +2253,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, } /* end if */ /* Read in VL sequence */ - if((*(src->u.vlen.read))(src->u.vlen.f,s,conv_buf,src_size)<0) + if((*(src->u.vlen.read))(src->u.vlen.f,dxpl_id,s,conv_buf,src_size)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data"); /* Check if temporary buffer is large enough, resize if necessary */ @@ -2280,7 +2280,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, } H5F_addr_decode(dst->u.vlen.f, (const uint8_t **)&tmp, &(bg_hobjid.addr)); INT32DECODE(tmp, bg_hobjid.idx); - if(H5HG_read(dst->u.vlen.f,&bg_hobjid,tmp_buf)==NULL) + if(H5HG_read(dst->u.vlen.f,dxpl_id,&bg_hobjid,tmp_buf)==NULL) HGOTO_ERROR (H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL sequence into background buffer"); } /* end if */ @@ -2294,11 +2294,11 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, /* Convert VL sequence */ H5_CHECK_OVERFLOW(seq_len,hssize_t,hsize_t); - if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)seq_len, 0, bkg_stride, conv_buf, tmp_buf, dset_xfer_plist)<0) + if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)seq_len, 0, bkg_stride, conv_buf, tmp_buf, dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Write sequence to destination location */ - if((*(dst->u.vlen.write))(dset_xfer_plist,dst->u.vlen.f,d,conv_buf, bg_ptr, (hsize_t)seq_len,(hsize_t)dst_base_size)<0) + if((*(dst->u.vlen.write))(dst->u.vlen.f,dxpl_id,d,conv_buf, bg_ptr, (hsize_t)seq_len,(hsize_t)dst_base_size)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data"); /* For nested VL case, free leftover heap objects from the deeper level if the length of new data elements is shorted than the old data elements.*/ @@ -2311,7 +2311,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, if(parent_seq_len>0) { H5F_addr_decode(dst->u.vlen.f, (const uint8_t **)&tmp_p, &(parent_hobjid.addr)); INT32DECODE(tmp_p, parent_hobjid.idx); - if(H5HG_remove(dst->u.vlen.f, &parent_hobjid)<0) + if(H5HG_remove(dst->u.vlen.f, dxpl_id,&parent_hobjid)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object"); } } @@ -2378,7 +2378,7 @@ done: herr_t H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf, - void UNUSED *_bkg, hid_t dset_xfer_plist) + void UNUSED *_bkg, hid_t dxpl_id) { H5T_path_t *tpath; /* Type conversion path */ hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ @@ -2462,7 +2462,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, dst_delta = direction * (buf_stride ? buf_stride : dst->size); /* Set up conversion path for base elements */ - if (NULL==(tpath=H5T_path_find(src->parent, dst->parent, NULL, NULL))) { + if (NULL==(tpath=H5T_path_find(src->parent, dst->parent, NULL, NULL, dxpl_id))) { HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes"); } else if (!H5T_IS_NOOP(tpath)) { if ((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->parent, H5T_COPY_ALL)))<0 || @@ -2484,7 +2484,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, HDmemmove(dp, sp, src->size); /* Convert array */ - if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)src->u.array.nelem, 0, bkg_stride, dp, bkg_buf, dset_xfer_plist)<0) + if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)src->u.array.nelem, 0, bkg_stride, dp, bkg_buf, dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Advance the source & destination pointers */ @@ -2538,7 +2538,7 @@ done: herr_t H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, - void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void UNUSED *bkg, hid_t UNUSED dxpl_id) { H5T_t *src = NULL; /*source data type */ H5T_t *dst = NULL; /*destination data type */ @@ -2865,7 +2865,7 @@ done: herr_t H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { /* Traversal-related variables */ H5T_t *src_p; /*source data type */ @@ -3289,7 +3289,7 @@ done: herr_t H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, - void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void UNUSED *bkg, hid_t UNUSED dxpl_id) { H5T_t *src=NULL; /*source data type */ H5T_t *dst=NULL; /*destination data type */ @@ -3512,7 +3512,7 @@ herr_t H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3545,7 +3545,7 @@ herr_t H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3578,7 +3578,7 @@ herr_t H5T_conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3611,7 +3611,7 @@ herr_t H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3644,7 +3644,7 @@ herr_t H5T_conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3677,7 +3677,7 @@ herr_t H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3709,7 +3709,7 @@ done: herr_t H5T_conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3741,7 +3741,7 @@ done: herr_t H5T_conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3773,7 +3773,7 @@ done: herr_t H5T_conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3805,7 +3805,7 @@ done: herr_t H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3837,7 +3837,7 @@ done: herr_t H5T_conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3870,7 +3870,7 @@ herr_t H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3902,7 +3902,7 @@ done: herr_t H5T_conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3935,7 +3935,7 @@ herr_t H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3968,7 +3968,7 @@ herr_t H5T_conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4001,7 +4001,7 @@ herr_t H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4034,7 +4034,7 @@ herr_t H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4067,7 +4067,7 @@ herr_t H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4100,7 +4100,7 @@ herr_t H5T_conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4133,7 +4133,7 @@ herr_t H5T_conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4166,7 +4166,7 @@ herr_t H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4199,7 +4199,7 @@ herr_t H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4232,7 +4232,7 @@ herr_t H5T_conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4265,7 +4265,7 @@ herr_t H5T_conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4298,7 +4298,7 @@ herr_t H5T_conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4331,7 +4331,7 @@ herr_t H5T_conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4364,7 +4364,7 @@ herr_t H5T_conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4397,7 +4397,7 @@ herr_t H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4430,7 +4430,7 @@ herr_t H5T_conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4463,7 +4463,7 @@ herr_t H5T_conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4496,7 +4496,7 @@ herr_t H5T_conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4529,7 +4529,7 @@ herr_t H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4562,7 +4562,7 @@ herr_t H5T_conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4595,7 +4595,7 @@ herr_t H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4628,7 +4628,7 @@ herr_t H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4661,7 +4661,7 @@ herr_t H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4694,7 +4694,7 @@ herr_t H5T_conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4727,7 +4727,7 @@ herr_t H5T_conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4760,7 +4760,7 @@ herr_t H5T_conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4793,7 +4793,7 @@ herr_t H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4826,7 +4826,7 @@ herr_t H5T_conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4859,7 +4859,7 @@ herr_t H5T_conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4892,7 +4892,7 @@ herr_t H5T_conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4925,7 +4925,7 @@ herr_t H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4957,7 +4957,7 @@ done: herr_t H5T_conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -4989,7 +4989,7 @@ done: herr_t H5T_conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5021,7 +5021,7 @@ done: herr_t H5T_conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5053,7 +5053,7 @@ done: herr_t H5T_conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5085,7 +5085,7 @@ done: herr_t H5T_conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5117,7 +5117,7 @@ done: herr_t H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5149,7 +5149,7 @@ done: herr_t H5T_conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5181,7 +5181,7 @@ done: herr_t H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5213,7 +5213,7 @@ done: herr_t H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5246,7 +5246,7 @@ herr_t H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5278,7 +5278,7 @@ done: herr_t H5T_conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5310,7 +5310,7 @@ done: herr_t H5T_conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5343,7 +5343,7 @@ herr_t H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5376,7 +5376,7 @@ herr_t H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5408,7 +5408,7 @@ done: herr_t H5T_conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5441,7 +5441,7 @@ herr_t H5T_conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5473,7 +5473,7 @@ done: herr_t H5T_conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5506,7 +5506,7 @@ herr_t H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5538,7 +5538,7 @@ done: herr_t H5T_conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5570,7 +5570,7 @@ done: herr_t H5T_conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5602,7 +5602,7 @@ done: herr_t H5T_conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5634,7 +5634,7 @@ done: herr_t H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5666,7 +5666,7 @@ done: herr_t H5T_conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5698,7 +5698,7 @@ done: herr_t H5T_conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5730,7 +5730,7 @@ done: herr_t H5T_conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5763,7 +5763,7 @@ herr_t H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5796,7 +5796,7 @@ herr_t H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5829,7 +5829,7 @@ herr_t H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5862,7 +5862,7 @@ herr_t H5T_conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5895,7 +5895,7 @@ herr_t H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5928,7 +5928,7 @@ herr_t H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5961,7 +5961,7 @@ herr_t H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -5994,7 +5994,7 @@ herr_t H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6027,7 +6027,7 @@ herr_t H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6060,7 +6060,7 @@ herr_t H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6093,7 +6093,7 @@ herr_t H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6125,7 +6125,7 @@ done: herr_t H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6157,7 +6157,7 @@ done: herr_t H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6189,7 +6189,7 @@ done: herr_t H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6222,7 +6222,7 @@ herr_t H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6254,7 +6254,7 @@ done: herr_t H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, - void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist) + void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6287,7 +6287,7 @@ herr_t H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6320,7 +6320,7 @@ herr_t H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6353,7 +6353,7 @@ herr_t H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6386,7 +6386,7 @@ herr_t H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6419,7 +6419,7 @@ herr_t H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { herr_t ret_value=SUCCEED; /* Return value */ @@ -6455,7 +6455,7 @@ herr_t H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { hsize_t elmtno; /*element number */ uint8_t *src, *s; /*source buffer */ @@ -6575,7 +6575,7 @@ herr_t H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { hsize_t elmtno; /*element number */ uint8_t *src, *s; /*source buffer */ @@ -6701,7 +6701,7 @@ herr_t H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, - hid_t UNUSED dset_xfer_plist) + hid_t UNUSED dxpl_id) { uint8_t *s=NULL, *d=NULL; /*src and dst buf pointers */ uint8_t tmp[8]; /*temporary destination buffer */ diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index c3a9703..5b4cf09 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -91,8 +91,8 @@ typedef struct H5T_enum_t { /* VL function pointers */ typedef hssize_t (*H5T_vlen_getlenfunc_t)(H5F_t *f, void *vl_addr); -typedef herr_t (*H5T_vlen_readfunc_t)(H5F_t *f, void *vl_addr, void *buf, size_t len); -typedef herr_t (*H5T_vlen_writefunc_t)(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); +typedef herr_t (*H5T_vlen_readfunc_t)(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *buf, size_t len); +typedef herr_t (*H5T_vlen_writefunc_t)(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); /* A VL datatype */ typedef struct H5T_vlen_t { @@ -779,14 +779,14 @@ H5_DLL htri_t H5T_bit_inc(uint8_t *buf, size_t start, size_t size); /* VL functions */ H5_DLL hssize_t H5T_vlen_seq_mem_getlen(H5F_t *f, void *vl_addr); -H5_DLL herr_t H5T_vlen_seq_mem_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -H5_DLL herr_t H5T_vlen_seq_mem_write(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *_buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); +H5_DLL herr_t H5T_vlen_seq_mem_read(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *_buf, size_t len); +H5_DLL herr_t H5T_vlen_seq_mem_write(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *_buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); H5_DLL hssize_t H5T_vlen_str_mem_getlen(H5F_t *f, void *vl_addr); -H5_DLL herr_t H5T_vlen_str_mem_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -H5_DLL herr_t H5T_vlen_str_mem_write(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *_buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); +H5_DLL herr_t H5T_vlen_str_mem_read(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *_buf, size_t len); +H5_DLL herr_t H5T_vlen_str_mem_write(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *_buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); H5_DLL hssize_t H5T_vlen_disk_getlen(H5F_t *f, void *vl_addr); -H5_DLL herr_t H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -H5_DLL herr_t H5T_vlen_disk_write(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *_buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); +H5_DLL herr_t H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *_buf, size_t len); +H5_DLL herr_t H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *_buf, void *bg_addr, hsize_t seq_len, hsize_t base_size); /* Array functions */ H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims, diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 7491749..fd35f28 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -94,17 +94,17 @@ typedef struct { /* Private functions */ H5_DLL herr_t H5TN_init_interface(void); H5_DLL herr_t H5T_init(void); -H5_DLL htri_t H5T_isa(H5G_entry_t *ent); -H5_DLL H5T_t *H5T_open(H5G_entry_t *loc, const char *name); -H5_DLL H5T_t *H5T_open_oid(H5G_entry_t *ent); +H5_DLL htri_t H5T_isa(H5G_entry_t *ent, hid_t dxpl_id); +H5_DLL H5T_t *H5T_open(H5G_entry_t *loc, const char *name, hid_t dxpl_id); +H5_DLL H5T_t *H5T_open_oid(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL H5T_t *H5T_create(H5T_class_t type, size_t size); H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method); -H5_DLL herr_t H5T_commit(H5G_entry_t *loc, const char *name, H5T_t *type); +H5_DLL herr_t H5T_commit(H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_free(H5T_t *dt); H5_DLL herr_t H5T_close(H5T_t *dt); H5_DLL herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_t func); + H5T_t *dst, H5T_conv_t func, hid_t dxpl_id); H5_DLL herr_t H5T_path_force_reinit(H5T_t *dt); H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt); H5_DLL htri_t H5T_detect_class (const H5T_t *dt, H5T_class_t cls); @@ -139,7 +139,7 @@ H5_DLL H5G_entry_t *H5T_entof(H5T_t *dt); H5_DLL htri_t H5T_is_immutable(H5T_t *dt); H5_DLL htri_t H5T_is_named(H5T_t *dt); H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst, - const char *name, H5T_conv_t func); + const char *name, H5T_conv_t func, hid_t dxpl_id); H5_DLL herr_t H5T_sort_value(H5T_t *dt, int *map); H5_DLL herr_t H5T_sort_name(H5T_t *dt, int *map); H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index fa65056..c1f9926 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -179,7 +179,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_vlen_seq_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t len) +H5T_vlen_seq_mem_read(H5F_t UNUSED *f, hid_t dxpl_id, void *vl_addr, void *buf, size_t len) { hvl_t *vl=(hvl_t *)vl_addr; /* Pointer to the user's hvl_t information */ herr_t ret_value=SUCCEED; /* Return value */ @@ -212,7 +212,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_vlen_seq_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf, void UNUSED *bg_addr, hsize_t seq_len, hsize_t base_size) +H5T_vlen_seq_mem_write(H5F_t UNUSED *f, hid_t dxpl_id, void *vl_addr, void *buf, void UNUSED *bg_addr, hsize_t seq_len, hsize_t base_size) { H5MM_allocate_t alloc_func; /* Vlen allocation function */ void *alloc_info; /* Vlen allocation information */ @@ -233,7 +233,7 @@ H5T_vlen_seq_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf /* Use the user's memory allocation routine is one is defined */ /* Get the allocation function & info */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); @@ -316,7 +316,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_vlen_str_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t len) +H5T_vlen_str_mem_read(H5F_t UNUSED *f, hid_t dxpl_id, void *vl_addr, void *buf, size_t len) { char *s=*(char **)vl_addr; /* Pointer to the user's hvl_t information */ herr_t ret_value=SUCCEED; /* Return value */ @@ -352,7 +352,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_vlen_str_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf, void UNUSED *bg_addr, hsize_t seq_len, hsize_t base_size) +H5T_vlen_str_mem_write(H5F_t UNUSED *f, hid_t dxpl_id, void *vl_addr, void *buf, void UNUSED *bg_addr, hsize_t seq_len, hsize_t base_size) { H5MM_allocate_t alloc_func; /* Vlen allocation function */ void *alloc_info; /* Vlen allocation information */ @@ -370,7 +370,7 @@ H5T_vlen_str_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf /* Use the user's memory allocation routine if one is defined */ /* Get the allocation function & info */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); @@ -442,7 +442,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *buf, size_t UNUSED len) +H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *buf, size_t UNUSED len) { uint8_t *vl=(uint8_t *)vl_addr; /* Pointer to the user's hvl_t information */ H5HG_t hobjid; @@ -466,7 +466,7 @@ H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *buf, size_t UNUSED len) INT32DECODE(vl,hobjid.idx); /* Read the VL information from disk */ - if(H5HG_read(f,&hobjid,buf)==NULL) + if(H5HG_read(f,dxpl_id, &hobjid,buf)==NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information"); } /* end if */ @@ -494,7 +494,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_vlen_disk_write(hid_t UNUSED plist_id, H5F_t *f, void *vl_addr, void *buf, void *bg_addr, hsize_t seq_len, hsize_t base_size) +H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, void *vl_addr, void *buf, void *bg_addr, hsize_t seq_len, hsize_t base_size) { uint8_t *vl=(uint8_t *)vl_addr; /*Pointer to the user's hvl_t information*/ uint8_t *bg=(uint8_t *)bg_addr; /*Pointer to the old data hvl_t */ @@ -523,7 +523,7 @@ H5T_vlen_disk_write(hid_t UNUSED plist_id, H5F_t *f, void *vl_addr, void *buf, v H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr)); INT32DECODE(bg, bg_hobjid.idx); /* Free heap object */ - if(H5HG_remove(f, &bg_hobjid)<0) + if(H5HG_remove(f, dxpl_id, &bg_hobjid)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object"); } /* end if */ } /* end if */ @@ -536,7 +536,7 @@ H5T_vlen_disk_write(hid_t UNUSED plist_id, H5F_t *f, void *vl_addr, void *buf, v if(seq_len!=0) { /* Write the VL information to disk (allocates space also) */ H5_ASSIGN_OVERFLOW(len,(seq_len*base_size),hsize_t,size_t); - if(H5HG_insert(f,len,buf,&hobjid)<0) + if(H5HG_insert(f,dxpl_id, len,buf,&hobjid)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to write VL information"); } /* end if */ else diff --git a/test/gheap.c b/test/gheap.c index 16bd0e5..7ed5b46 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -79,7 +79,7 @@ test_1 (hid_t fapl) size = i+1; memset (out, 'A'+i%26, size); H5Eclear (); - status = H5HG_insert (f, size, out, obj+i); + status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -98,7 +98,7 @@ test_1 (hid_t fapl) size = i+1; memset (out, 'A'+i%26, size); H5Eclear (); - if (NULL==H5HG_read (f, obj+i, in)) { + if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -171,7 +171,7 @@ test_2 (hid_t fapl) size = 1024-i; memset (out, 'A'+i%26, size); H5Eclear (); - if (H5HG_insert (f, size, out, obj+i)<0) { + if (H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i)<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); nerrors++; @@ -185,7 +185,7 @@ test_2 (hid_t fapl) size = 1024-i; memset (out, 'A'+i%26, size); H5Eclear (); - if (NULL==H5HG_read (f, obj+i, in)) { + if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -256,7 +256,7 @@ test_3 (hid_t fapl) size = i%30+100; memset (out, 'A'+i%26, size); H5Eclear (); - status = H5HG_insert (f, size, out, obj+i); + status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -266,7 +266,7 @@ test_3 (hid_t fapl) /* Remove everything */ for (i=0; i<1024; i++) { - status = H5HG_remove (f, obj+i); + status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); @@ -335,7 +335,7 @@ test_4 (hid_t fapl) size = i%30+100; memset (out, 'A'+i%26, size); H5Eclear (); - status = H5HG_insert (f, size, out, obj+i); + status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -349,7 +349,7 @@ test_4 (hid_t fapl) */ if (1==i%3) { H5Eclear (); - status = H5HG_remove (f, obj+i-1); + status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i-1); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); diff --git a/test/istore.c b/test/istore.c index 3dfb8cf..3f1e16e 100644 --- a/test/istore.c +++ b/test/istore.c @@ -101,7 +101,7 @@ new_object(H5F_t *f, const char *name, unsigned ndims, H5G_entry_t *ent/*out*/) /* Create the object header */ HDmemset(ent,0,sizeof(H5G_entry_t)); - if (H5O_create(f, 64, ent)) { + if (H5O_create(f, H5P_DATASET_XFER_DEFAULT, 64, ent)) { H5_FAILED(); puts(" H5O_create() = NULL"); goto error; @@ -118,15 +118,15 @@ new_object(H5F_t *f, const char *name, unsigned ndims, H5G_entry_t *ent/*out*/) } } /* Create the root of the B-tree that describes chunked storage */ - H5F_istore_create (f, &layout/*in,out*/); - if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, 1, &layout) < 0) { + H5F_istore_create (f, H5P_DATASET_XFER_DEFAULT, &layout/*in,out*/); + if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, 1, &layout, H5P_DATASET_XFER_DEFAULT) < 0) { H5_FAILED(); puts(" H5O_modify istore message failure."); goto error; } /* Give the object header a name */ - if (H5G_insert(H5G_entof(H5G_rootof(f)), name, ent) < 0) { + if (H5G_insert(H5G_entof(H5G_rootof(f)), name, ent, H5P_DATASET_XFER_DEFAULT) < 0) { H5_FAILED(); printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name); goto error; @@ -247,7 +247,7 @@ test_extend(H5F_t *f, const char *prefix, printf(" Cannot create %u-d object `%s'\n", ndims, name); goto error; } - if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) { + if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" Unable to read istore message."); goto error; @@ -456,7 +456,7 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks, printf(" Cannot create %u-d object `%s'\n", ndims, name); goto error; } - if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) { + if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); printf(" Unable to read istore message\n"); goto error; diff --git a/test/lheap.c b/test/lheap.c index 44fb615..98b741e 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -66,7 +66,7 @@ main(void) H5Eprint(stdout); goto error; } - if (H5HL_create(f, 0, &heap_addr/*out*/)<0) { + if (H5HL_create(f, H5P_DATASET_XFER_DEFAULT, 0, &heap_addr/*out*/)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -76,7 +76,7 @@ main(void) for (j=4; j4) buf[j] = '\0'; - if ((size_t)(-1)==(obj[i]=H5HL_insert(f, heap_addr, strlen(buf)+1, + if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap_addr, strlen(buf)+1, buf))) { H5_FAILED(); H5Eprint(stdout); @@ -102,7 +102,7 @@ main(void) sprintf(buf, "%03d-", i); for (j=4; j4) buf[j] = '\0'; - if (NULL==(s=H5HL_peek(f, heap_addr, obj[i]))) { + if (NULL==(s=H5HL_peek(f, H5P_DATASET_XFER_DEFAULT, heap_addr, obj[i]))) { H5_FAILED(); H5Eprint(stdout); goto error; diff --git a/test/ohdr.c b/test/ohdr.c index 3884e1a..143146d 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -69,7 +69,7 @@ main(void) */ TESTING("object header creation"); HDmemset(&oh_ent,0,sizeof(H5G_entry_t)); - if (H5O_create(f, 64, &oh_ent/*out*/)<0) { + if (H5O_create(f, H5P_DATASET_XFER_DEFAULT, 64, &oh_ent/*out*/)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -80,17 +80,17 @@ main(void) TESTING("message creation"); stab.btree_addr = 11111111; stab.heap_addr = 22222222; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab)<0) { + if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (H5AC_flush(f, NULL, HADDR_UNDEF, TRUE)<0) { + if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 0, &ro)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -112,17 +112,17 @@ main(void) TESTING("message modification"); stab.btree_addr = 33333333; stab.heap_addr = 44444444; - if (H5O_modify(&oh_ent, H5O_STAB, 0, 0, 1, &stab)<0) { + if (H5O_modify(&oh_ent, H5O_STAB, 0, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (H5AC_flush(f, NULL, HADDR_UNDEF, TRUE)<0) { + if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 0, &ro)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -145,17 +145,17 @@ main(void) TESTING("duplicate message creation"); stab.btree_addr = 55555555; stab.heap_addr = 66666666; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab)<0) { + if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (H5AC_flush(f, NULL, HADDR_UNDEF, TRUE)<0) { + if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 1, &ro)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -177,17 +177,17 @@ main(void) TESTING("duplicate message modification"); stab.btree_addr = 77777777; stab.heap_addr = 88888888; - if (H5O_modify(&oh_ent, H5O_STAB, 1, 0, 1, &stab)<0) { + if (H5O_modify(&oh_ent, H5O_STAB, 1, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (H5AC_flush(f, NULL, HADDR_UNDEF, TRUE)<0) { + if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 1, &ro)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -211,13 +211,13 @@ main(void) for (i=0; i<40; i++) { stab.btree_addr = (i+1)*1000+1; stab.heap_addr = (i+1)*1000+2; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab)<0) { + if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } } - if (H5AC_flush(f, NULL, HADDR_UNDEF, TRUE)<0) { + if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -232,12 +232,12 @@ main(void) for (i=0; i<10; i++) { stab.btree_addr = (i + 1) * 1000 + 10; stab.heap_addr = (i + 1) * 1000 + 20; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab)<0) { + if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (H5AC_flush(f, NULL, HADDR_UNDEF, TRUE)<0) { + if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -249,12 +249,12 @@ main(void) * Delete all symbol table messages. */ TESTING("message deletion"); - if (H5O_remove(&oh_ent, H5O_STAB, H5O_ALL)<0) { + if (H5O_remove(&oh_ent, H5O_STAB, H5O_ALL, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (H5O_read(&oh_ent, H5O_STAB, 0, &ro)) { + if (H5O_read(&oh_ent, H5O_STAB, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" H5O_read() should have failed but didn't"); H5Eclear(); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index a65a3ae..eea1bd3 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -589,9 +589,9 @@ dataset_writeAll(char *filename) /* set up the collective transfer properties list */ xfer_plist = H5Pcreate (H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), ""); + VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); ret=H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); /* write data collectively */ MESG("writeAll by Row"); @@ -1097,6 +1097,23 @@ extend_writeInd(char *filename) acc_tpl = create_faccess_plist(comm, info, facc_type); VRFY((acc_tpl >= 0), ""); +/* Reduce the number of metadata cache slots, so that there are cache + * collisions during the raw data I/O on the chunked dataset. This stresses + * the metadata cache and tests for cache bugs. -QAK + */ +{ + int mdc_nelmts; + size_t rdcc_nelmts; + size_t rdcc_nbytes; + double rdcc_w0; + + ret=H5Pget_cache(acc_tpl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0); + VRFY((ret >= 0), "H5Pget_cache succeeded"); + mdc_nelmts=4; + ret=H5Pset_cache(acc_tpl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0); + VRFY((ret >= 0), "H5Pset_cache succeeded"); +} + /* create the file collectively */ fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); VRFY((fid >= 0), "H5Fcreate succeeded"); diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 1f606fb..09b8c7f 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -104,25 +104,25 @@ main(int argc, char *argv[]) /* * Debug the boot block. */ - status = H5F_debug(f, addr, stdout, 0, VCOL); + status = H5F_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); } else if (!HDmemcmp(sig, H5HL_MAGIC, H5HL_SIZEOF_MAGIC)) { /* * Debug a local heap. */ - status = H5HL_debug(f, addr, stdout, 0, VCOL); + status = H5HL_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); } else if (!HDmemcmp (sig, H5HG_MAGIC, H5HG_SIZEOF_MAGIC)) { /* * Debug a global heap collection. */ - status = H5HG_debug (f, addr, stdout, 0, VCOL); + status = H5HG_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); } else if (!HDmemcmp(sig, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC)) { /* * Debug a symbol table node. */ - status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); } else if (!HDmemcmp(sig, H5B_MAGIC, H5B_SIZEOF_MAGIC)) { /* @@ -134,17 +134,16 @@ main(int argc, char *argv[]) switch (subtype) { case H5B_SNODE_ID: - status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); break; case H5B_ISTORE_ID: ndims = (int)extra; - status = H5F_istore_debug (f, addr, stdout, 0, VCOL, ndims); + status = H5F_istore_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims); break; default: - fprintf(stderr, "Unknown B-tree subtype %u\n", - (unsigned)(subtype)); + fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype)); HDexit(4); } @@ -153,7 +152,7 @@ main(int argc, char *argv[]) * This could be an object header. Since they don't have a signature * it's a somewhat "ify" detection. */ - status = H5O_debug(f, addr, stdout, 0, VCOL); + status = H5O_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); } else { /* -- cgit v0.12