From 95862451f78960cab031031011e5c6a131e0d026 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 10 Aug 2001 15:47:05 -0500 Subject: [svn-r4324] Purpose: New Features! Description: Start migrating the internal use of property lists in the library from the older implementation to the new generic property lists. Currently, only the dataset transfer property lists are migrated to the new architecture, all the rest of the property list types are still using the older architecture. Also, the backward compatibility features are not implemented yet, so applications which use dataset transfer properties may need to make the following changes: H5Pcreate(H5P_DATASET_XFER) -> H5Pcreate_list(H5P_DATASET_XFER_NEW) and H5Pclose() -> H5Pclose_list(id) This still may have some bugs in it, especially with Fortran, but I should be wrapping up those later today. Platforms tested: FreeBSD 4.4 (hawkwind) --- c++/src/H5DxferProp.cpp | 2 +- c++/src/H5PropList.cpp | 26 +- src/.indent.pro | 1 - src/H5.c | 14 +- src/H5B.c | 4 +- src/H5D.c | 405 ++++++++++----- src/H5Distore.c | 29 +- src/H5Dprivate.h | 92 +++- src/H5Dseq.c | 60 ++- src/H5E.c | 8 +- src/H5Epublic.h | 6 + src/H5F.c | 16 +- src/H5FD.c | 91 ++-- src/H5Farray.c | 84 ++-- src/H5Fistore.c | 29 +- src/H5Fseq.c | 60 ++- src/H5Gnode.c | 4 +- src/H5HG.c | 6 +- src/H5HL.c | 10 +- src/H5Ipublic.h | 12 +- src/H5O.c | 10 +- src/H5P.c | 1174 ++++++++++++++++++++++++++++++++++---------- src/H5Pprivate.h | 18 +- src/H5Ppublic.h | 62 ++- src/H5Shyper.c | 94 ++-- src/H5Smpio.c | 29 +- src/H5Tconv.c | 11 +- src/H5Tpkg.h | 8 +- src/H5Tvlen.c | 45 +- test/cmpd_dset.c | 4 +- test/dsets.c | 8 +- test/istore.c | 8 +- test/tarray.c | 12 +- test/tgenprop.c | 157 ++++-- test/tselect.c | 10 +- test/tvlstr.c | 4 +- test/tvltypes.c | 16 +- tools/h4toh5/h4toh5image.c | 54 +- tools/h4toh5/h4toh5sds.c | 19 +- tools/lib/talign.c | 4 +- 40 files changed, 1890 insertions(+), 816 deletions(-) diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index a3247d0..389db89 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -14,7 +14,7 @@ namespace H5 { const DSetMemXferPropList DSetMemXferPropList::DEFAULT( H5P_DEFAULT ); // Creates a dataset memory and transfer property list -DSetMemXferPropList::DSetMemXferPropList() : PropList( H5P_DATASET_XFER ) {} +DSetMemXferPropList::DSetMemXferPropList() : PropList( H5P_DATASET_XFER_NEW ) {} // Copy constructor: makes a copy of the original DSetMemXferPropList object; DSetMemXferPropList::DSetMemXferPropList( const DSetMemXferPropList& orig ) : PropList( orig ) {} diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 2da84e9..985d895 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -39,7 +39,20 @@ Description: the identifier still has reference counter; the p_close function will take care of not to call H5Pclose on the default id. */ -PropList::PropList( const hid_t plist_id ) : IdComponent( plist_id ) { } +PropList::PropList( const hid_t plist_id ) : IdComponent() +{ + if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) { + // call C routine to create the new property + id = H5Pcreate_list(plist_id); + if( id <= 0 ) + { + throw PropListIException("PropList constructor", "H5Pcreate_list failed"); + } + } + else { + id=plist_id; + } +} // Makes a copy of an existing property list void PropList::copy( const PropList& like_plist ) @@ -77,10 +90,17 @@ void PropList::p_close() const { if( id != H5P_DEFAULT ) // not a constant, should call H5Pclose { - herr_t ret_value = H5Pclose( id ); + herr_t ret_value; + + if (H5I_GENPROP_LST == H5Iget_type(id)) { + ret_value = H5Pclose_list( id ); + } else { + ret_value = H5Pclose( id ); + } + if( ret_value < 0 ) { - throw PropListIException(NULL, "H5Pclose failed" ); + throw PropListIException(NULL, "property list close failed" ); } } } diff --git a/src/.indent.pro b/src/.indent.pro index da9eadb..eec56da 100644 --- a/src/.indent.pro +++ b/src/.indent.pro @@ -65,7 +65,6 @@ -T H5D_create_t -T H5D_layout_t -T H5D_t --T H5D_xfer_t -T H5E_error_t -T H5E_major_mesg_t -T H5E_major_t diff --git a/src/H5.c b/src/H5.c index c1ae745..bdb9fb7 100644 --- a/src/H5.c +++ b/src/H5.c @@ -111,24 +111,26 @@ H5_init_library(void) * Initialize interfaces that might not be able to initialize themselves * soon enough. The file & dataset interfaces must be initialized because * calling H5Pcreate() might require the file/dataset property classes to be - * initialized. + * initialized. The property interface must be initialized before the file + * & dataset interfaces though, in order to provide them with the proper + * property classes. */ + if (H5P_init()<0) { + HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, + "unable to initialize property list interface"); + } if (H5F_init()<0) { HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize file interface"); } if (H5T_init()<0) { HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, - "unable to initialize type interface"); + "unable to initialize datatype interface"); } if (H5D_init()<0) { HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataset interface"); } - if (H5P_init()<0) { - HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, - "unable to initialize property list interface"); - } /* Debugging? */ H5_debug_mask("-all"); diff --git a/src/H5B.c b/src/H5B.c index 1d066fd..1c3bfe1 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -338,7 +338,7 @@ H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } - if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, H5P_DEFAULT, bt->page)<0) { + if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, H5P_DATASET_XFER_DEFAULT, bt->page)<0) { HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node"); } @@ -487,7 +487,7 @@ H5B_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5B_t *bt) if (IS_H5FD_MPIO(f)) H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /* only p0 will write */ #endif /* H5_HAVE_PARALLEL */ - if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, H5P_DEFAULT, bt->page)<0) { + if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, H5P_DATASET_XFER_DEFAULT, bt->page)<0) { HRETURN_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk"); } diff --git a/src/H5D.c b/src/H5D.c index c613915..256da83 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -16,7 +16,8 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Dprivate.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /*Free Lists */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Gprivate.h" /* Group headers */ #include "H5HLprivate.h" /* Name heap */ #include "H5MMprivate.h" /* Memory management */ @@ -72,33 +73,6 @@ const H5D_create_t H5D_create_dflt = { {0, 0, NULL} /* No filters in pipeline */ }; -/* Default data transfer property list */ -/* Not const anymore because some of the VFL drivers modify this struct - QAK */ -H5D_xfer_t H5D_xfer_dflt = { - 1024*1024, /*Temporary buffer size */ - NULL, /*Type conversion buffer or NULL */ - NULL, /*Background buffer or NULL */ - H5T_BKG_NO, /*Type of background buffer needed */ - {0.1, 0.5, 0.9}, /*B-tree node splitting ratios */ -#ifndef H5_HAVE_PARALLEL - 1, /*Cache the hyperslab blocks */ -#else - 0, /*Don't cache the hyperslab blocks */ -#endif /* H5_HAVE_PARALLEL */ - 0, /*No limit on hyperslab block size to cache */ - 1024, /*Number of I/O vectors for hyperslabs */ - NULL, /*Use malloc() for VL data allocations */ - NULL, /*No information needed for malloc() calls */ - NULL, /*Use free() for VL data frees */ - NULL, /*No information needed for free() calls */ - H5FD_VFD_DEFAULT, /*See H5Pget_driver() */ - NULL, /*No file driver-specific information yet */ -#ifdef COALESCE_READS - 0, /*coalesce single reads into a read */ - /*transaction */ -#endif -}; - /* Interface initialization? */ static intn interface_initialize_g = 0; #define INTERFACE_INIT H5D_init_interface @@ -165,18 +139,110 @@ DESCRIPTION static herr_t H5D_init_interface(void) { + H5P_genclass_t *pclass; /* Property list class to modify */ + hsize_t def_max_temp_buf=H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */ + void *def_tconv_buf=H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */ + void *def_bkgr_buf=H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */ + H5T_bkg_t def_bkgr_buf_type=H5D_XFER_BKGR_BUF_TYPE_DEF; /* Default value for background buffer type */ + double def_btree_split_ratio[3]=H5D_XFER_BTREE_SPLIT_RATIO_DEF; /* Default value for B-tree node split ratios */ + uintn def_hyper_cache=H5D_XFER_HYPER_CACHE_DEF; /* Default value for hyperslab caching */ + uintn def_hyper_cache_lim=H5D_XFER_HYPER_CACHE_LIM_DEF; /* Default value for hyperslab cache limit */ + H5MM_allocate_t def_vlen_alloc=H5D_XFER_VLEN_ALLOC_DEF; /* Default value for vlen allocation function */ + void *def_vlen_alloc_info=H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */ + H5MM_free_t def_vlen_free=H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */ + void *def_vlen_free_info=H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */ + hid_t def_vfl_id=H5D_XFER_VFL_ID_DEF; /* Default value for file driver ID */ + void *def_vfl_info=H5D_XFER_VFL_INFO_DEF; /* Default value for file driver info */ +#ifdef COALESCE_READS + uintn def_gather_reads=H5D_XFER_GATHER_READS_DEF; /* Default value for 'gather reads' property */ +#endif /* COALESCE_READS */ + size_t def_hyp_vec_size=H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */ + herr_t ret_value=SUCCEED; /* Return value */ + FUNC_ENTER(H5D_init_interface, FAIL); /* Initialize the atom group for the dataset IDs */ if (H5I_init_group(H5I_DATASET, H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<0) { - HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface"); } -/* Register the default dataset creation & data xfer properties */ - - FUNC_LEAVE(SUCCEED); + /* Register the default dataset creation properties */ + assert(H5P_CLS_DATASET_XFER_g!=(-1)); + + /* Get the pointer to the dataset creation class */ + if (H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_DATASET_XFER_g) || NULL == (pclass = H5I_object(H5P_CLS_DATASET_XFER_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); + + /* Register the max. temp buffer size property */ + if(H5P_register(pclass,H5D_XFER_MAX_TEMP_BUF_NAME,H5D_XFER_MAX_TEMP_BUF_SIZE,&def_max_temp_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the type conversion buffer property */ + if(H5P_register(pclass,H5D_XFER_TCONV_BUF_NAME,H5D_XFER_TCONV_BUF_SIZE,&def_tconv_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the background buffer property */ + if(H5P_register(pclass,H5D_XFER_BKGR_BUF_NAME,H5D_XFER_BKGR_BUF_SIZE,&def_bkgr_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the background buffer type property */ + if(H5P_register(pclass,H5D_XFER_BKGR_BUF_TYPE_NAME,H5D_XFER_BKGR_BUF_TYPE_SIZE,&def_bkgr_buf_type,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the B-Tree node splitting ratios property */ + if(H5P_register(pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,&def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the hyperslab caching property */ + if(H5P_register(pclass,H5D_XFER_HYPER_CACHE_NAME,H5D_XFER_HYPER_CACHE_SIZE,&def_hyper_cache,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the hyperslab cache limit property */ + if(H5P_register(pclass,H5D_XFER_HYPER_CACHE_LIM_NAME,H5D_XFER_HYPER_CACHE_LIM_SIZE,&def_hyper_cache_lim,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the vlen allocation function property */ + if(H5P_register(pclass,H5D_XFER_VLEN_ALLOC_NAME,H5D_XFER_VLEN_ALLOC_SIZE,&def_vlen_alloc,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the vlen allocation information property */ + if(H5P_register(pclass,H5D_XFER_VLEN_ALLOC_INFO_NAME,H5D_XFER_VLEN_ALLOC_INFO_SIZE,&def_vlen_alloc_info,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the vlen free function property */ + if(H5P_register(pclass,H5D_XFER_VLEN_FREE_NAME,H5D_XFER_VLEN_FREE_SIZE,&def_vlen_free,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the vlen free information property */ + if(H5P_register(pclass,H5D_XFER_VLEN_FREE_INFO_NAME,H5D_XFER_VLEN_FREE_INFO_SIZE,&def_vlen_free_info,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the file driver ID property */ + if(H5P_register(pclass,H5D_XFER_VFL_ID_NAME,H5D_XFER_VFL_ID_SIZE,&def_vfl_id,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the file driver info property */ + if(H5P_register(pclass,H5D_XFER_VFL_INFO_NAME,H5D_XFER_VFL_INFO_SIZE,&def_vfl_info,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + +#ifdef COALESCE_READS + /* Register the 'gather reads' property */ + if(H5P_register(pclass,H5D_XFER_GATHER_READS_NAME,H5D_XFER_GATHER_READS_SIZE,&def_gather_reads,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); +#endif /* COALESCE_READS */ + + /* Register the vector size property */ + if(H5P_register(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 default data transfer property list */ + if ((H5P_LST_DATASET_XFER_g = H5Pcreate_list (H5P_CLS_DATASET_XFER_g))<0) + HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list"); + +done: + FUNC_LEAVE(ret_value); } @@ -216,6 +282,108 @@ H5D_term_interface(void) /*------------------------------------------------------------------------- + * Function: H5D_xfer_create + * + * Purpose: Callback routine which is called whenever any dataset transfer + * property list is created. This routine performs any generic + * initialization needed on the properties the library put into + * the list. + * Right now, it's just allocating the driver-specific dataset + * transfer information. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, August 2, 2001 + * + * Notes: This same routine is currently used for the 'copy' callback. + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5D_xfer_create(hid_t dxpl_id, void UNUSED *create_data) +{ + hid_t driver_id; /* VFL driver ID */ + void *driver_info; /* VFL driver info */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER(H5D_xfer_create, FAIL); + + /* Get the driver information */ + if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); + + /* Check if we have a valid driver ID */ + if(driver_id>0) { + /* 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) + HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "Can't copy VFL driver"); + + /* Set the driver information for the new property list */ + if(H5P_set(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver ID"); + if(H5P_set(dxpl_id, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver info"); + } /* end if */ + +done: + FUNC_LEAVE(ret_value); +} /* end H5D_xfer_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5D_xfer_close + * + * Purpose: Callback routine which is called whenever any dataset transfer + * property list is closed. This routine performs any generic + * cleanup needed on the properties the library put into the list. + * Right now, it's just freeing the driver-specific dataset + * transfer information. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, July 11, 2001 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5D_xfer_close(hid_t dxpl_id, void UNUSED *close_data) +{ + hid_t driver_id; /* VFL driver ID */ + void *driver_info; /* VFL driver info */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER(H5D_xfer_close, FAIL); + + if(H5Pget(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + if(H5Pget(dxpl_id, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); + if(driver_id>0) { + if(H5FD_dxpl_free(driver_id, driver_info)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't free VFL driver"); + if(H5I_dec_ref(driver_id)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement VFL driver ID"); + } /* end if */ + +done: + FUNC_LEAVE(ret_value); +} /* end H5D_xfer_close() */ + + +/*------------------------------------------------------------------------- * Function: H5Dcreate * * Purpose: Creates a new dataset named NAME at LOC_ID, opens the @@ -671,17 +839,17 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* check arguments */ if (H5I_DATASET != H5I_get_type(dset_id) || - NULL == (dset = H5I_object(dset_id)) || - NULL == dset->ent.file) { + NULL == (dset = H5I_object(dset_id)) || + NULL == dset->ent.file) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } if (H5I_DATATYPE != H5I_get_type(mem_type_id) || - NULL == (mem_type = H5I_object(mem_type_id))) { + NULL == (mem_type = H5I_object(mem_type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (H5S_ALL != mem_space_id) { if (H5I_DATASPACE != H5I_get_type(mem_space_id) || - NULL == (mem_space = H5I_object(mem_space_id))) { + NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } /* Check for valid selection */ @@ -692,7 +860,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, } if (H5S_ALL != file_space_id) { if (H5I_DATASPACE != H5I_get_type(file_space_id) || - NULL == (file_space = H5I_object(file_space_id))) { + NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } /* Check for valid selection */ @@ -701,18 +869,21 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, "selection+offset not within extent"); } } - if (H5P_DEFAULT != plist_id && H5P_DATASET_XFER != H5P_get_class(plist_id)) { + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == plist_id) + plist_id= H5P_DATASET_XFER_DEFAULT; + + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); - } - if (!buf) { + if (!buf) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer"); - } /* read raw data */ - if (H5D_read(dset, mem_type, mem_space, file_space, plist_id, - buf/*out*/) < 0) { + if (H5D_read(dset, mem_type, mem_space, file_space, plist_id, buf/*out*/) < 0) HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); - } + FUNC_LEAVE(SUCCEED); } @@ -766,17 +937,17 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* check arguments */ if (H5I_DATASET != H5I_get_type(dset_id) || - NULL == (dset = H5I_object(dset_id)) || - NULL == dset->ent.file) { + NULL == (dset = H5I_object(dset_id)) || + NULL == dset->ent.file) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } if (H5I_DATATYPE != H5I_get_type(mem_type_id) || - NULL == (mem_type = H5I_object(mem_type_id))) { + NULL == (mem_type = H5I_object(mem_type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (H5S_ALL != mem_space_id) { if (H5I_DATASPACE != H5I_get_type(mem_space_id) || - NULL == (mem_space = H5I_object(mem_space_id))) { + NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } /* Check for valid selection */ @@ -787,7 +958,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, } if (H5S_ALL != file_space_id) { if (H5I_DATASPACE != H5I_get_type(file_space_id) || - NULL == (file_space = H5I_object(file_space_id))) { + NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } /* Check for valid selection */ @@ -796,18 +967,21 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, "selection+offset not within extent"); } } - if (H5P_DEFAULT != plist_id && H5P_DATASET_XFER != H5P_get_class(plist_id)) { + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == plist_id) + plist_id= H5P_DATASET_XFER_DEFAULT; + + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); - } - if (!buf) { + if (!buf) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer"); - } /* write raw data */ - if (H5D_write(dset, mem_type, mem_space, file_space, plist_id, - buf) < 0) { + if (H5D_write(dset, mem_type, mem_space, file_space, plist_id, buf) < 0) HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data"); - } + FUNC_LEAVE(SUCCEED); } @@ -1572,7 +1746,6 @@ herr_t H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, void *buf/*out*/) { - const H5D_xfer_t *xfer_parms = NULL; hssize_t nelmts; /*number of elements */ hsize_t smine_start; /*strip mine start loc */ hsize_t n, smine_nelmts; /*elements per strip */ @@ -1609,20 +1782,14 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, assert(dataset && dataset->ent.file); assert(mem_type); assert(buf); + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); /* Initialize these before any errors can occur */ HDmemset(&mem_iter,0,sizeof(H5S_sel_iter_t)); HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t)); HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t)); - /* Get the dataset transfer property list */ - if (H5P_DEFAULT == dxpl_id) { - xfer_parms = &H5D_xfer_dflt; - } else if (H5P_DATASET_XFER != H5P_get_class(dxpl_id) || - NULL == (xfer_parms = H5I_object(dxpl_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); - } - if (!file_space) { if (NULL==(free_this_space=H5S_read (&(dataset->ent)))) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, @@ -1636,13 +1803,12 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5_HAVE_PARALLEL /* Collect Parallel I/O information for possible later use */ - if (H5FD_MPIO==xfer_parms->driver_id){ + if (H5FD_MPIO==H5P_peek_hid_t(dxpl_id,H5D_XFER_VFL_ID_NAME)) { doing_mpio++; - if (dx=xfer_parms->driver_info){ + if (dx=H5P_peek_voidp(dxpl_id,H5D_XFER_VFL_INFO_NAME)) xfer_mode = dx->xfer_mode; - }else - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to retrieve data xfer info"); + else + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to retrieve data xfer info"); } /* Collective access is not permissible without the MPIO driver */ if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && @@ -1790,7 +1956,7 @@ printf("%s: check 1.2, \n",FUNC); src_type_size = H5T_get_size(dataset->type); dst_type_size = H5T_get_size(mem_type); - target_size = xfer_parms->buf_size; + target_size = H5P_peek_hsize_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME); #ifdef QAK printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size); #endif /* QAK */ @@ -1812,11 +1978,14 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN * same size over and over. */ if (tpath->cdata.need_bkg) { - need_bkg = MAX(tpath->cdata.need_bkg, xfer_parms->need_bkg); + /* Retrieve the bkgr buffer property */ + if(H5Pget(dxpl_id, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type"); + need_bkg = MAX(tpath->cdata.need_bkg, need_bkg); } else { need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } - if (NULL==(tconv_buf=xfer_parms->tconv_buf)) { + if (NULL==(tconv_buf=H5P_peek_voidp(dxpl_id,H5D_XFER_TCONV_BUF_NAME))) { #ifdef QAK printf("%s: check 3.1, allocating conversion buffer\n",FUNC); #endif @@ -1825,7 +1994,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); } - if (need_bkg && NULL==(bkg_buf=xfer_parms->bkg_buf)) { + if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dxpl_id,H5D_XFER_BKGR_BUF_NAME))) { #ifdef QAK printf("%s: check 3.2, allocating conversion buffer\n",FUNC); #endif @@ -1974,13 +2143,16 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN H5S_sel_iter_release(mem_space,&mem_iter); H5S_sel_iter_release(mem_space,&bkg_iter); - if (src_id >= 0) H5I_dec_ref(src_id); - if (dst_id >= 0) H5I_dec_ref(dst_id); - if (tconv_buf && NULL==xfer_parms->tconv_buf) + if (src_id >= 0) + H5I_dec_ref(src_id); + if (dst_id >= 0) + H5I_dec_ref(dst_id); + if (tconv_buf && NULL==H5P_peek_voidp(dxpl_id,H5D_XFER_TCONV_BUF_NAME)) H5FL_BLK_FREE(type_conv,tconv_buf); - if (bkg_buf && NULL==xfer_parms->bkg_buf) + if (bkg_buf && NULL==H5P_peek_voidp(dxpl_id,H5D_XFER_BKGR_BUF_NAME)) H5FL_BLK_FREE(bkgr_conv,bkg_buf); - if (free_this_space) H5S_close(free_this_space); + if (free_this_space) + H5S_close(free_this_space); FUNC_LEAVE(ret_value); } @@ -2021,7 +2193,6 @@ herr_t H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf) { - const H5D_xfer_t *xfer_parms = NULL; hssize_t nelmts; /*total number of elmts */ hsize_t smine_start; /*strip mine start loc */ hsize_t n, smine_nelmts; /*elements per strip */ @@ -2058,6 +2229,8 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, assert(dataset && dataset->ent.file); assert(mem_type); assert(buf); + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); #ifdef H5_HAVE_PARALLEL /* If MPIO is used, no VL datatype support yet. */ @@ -2089,14 +2262,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, printf("%s: check 0.3, buf=%p\n", FUNC,buf); #endif /* QAK */ - /* Get the dataset transfer property list */ - if (H5P_DEFAULT == dxpl_id) { - xfer_parms = &H5D_xfer_dflt; - } else if (H5P_DATASET_XFER != H5P_get_class(dxpl_id) || - NULL == (xfer_parms = H5I_object(dxpl_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); - } - if (0==(H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR)) { HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file"); @@ -2114,13 +2279,12 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5_HAVE_PARALLEL /* Collect Parallel I/O information for possible later use */ - if (H5FD_MPIO==xfer_parms->driver_id){ + if (H5FD_MPIO==H5P_peek_hid_t(dxpl_id,H5D_XFER_VFL_ID_NAME)) { doing_mpio++; - if (dx=xfer_parms->driver_info){ + if (dx=H5P_peek_voidp(dxpl_id,H5D_XFER_VFL_INFO_NAME)) xfer_mode = dx->xfer_mode; - }else - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to retrieve data xfer info"); + else + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to retrieve data xfer info"); } /* Collective access is not permissible without the MPIO driver */ if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && @@ -2268,7 +2432,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, src_type_size = H5T_get_size(mem_type); dst_type_size = H5T_get_size(dataset->type); - target_size = xfer_parms->buf_size; + target_size = H5P_peek_hsize_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME); #ifdef QAK printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size); #endif /* QAK */ @@ -2290,17 +2454,20 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN * same size over and over. */ if (tpath->cdata.need_bkg) { - need_bkg = MAX (tpath->cdata.need_bkg, xfer_parms->need_bkg); + /* Retrieve the bkgr buffer property */ + if(H5Pget(dxpl_id, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type"); + need_bkg = MAX (tpath->cdata.need_bkg, need_bkg); } else { need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } - if (NULL==(tconv_buf=xfer_parms->tconv_buf)) { + if (NULL==(tconv_buf=H5P_peek_voidp(dxpl_id,H5D_XFER_TCONV_BUF_NAME))) { /* Allocate temporary buffer */ if((tconv_buf=H5FL_BLK_ALLOC(type_conv,target_size,0))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); } - if (need_bkg && NULL==(bkg_buf=xfer_parms->bkg_buf)) { + if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dxpl_id,H5D_XFER_BKGR_BUF_NAME))) { /* Allocate temporary buffer */ H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t); if((bkg_buf=H5FL_BLK_ALLOC(bkgr_conv,(size_t)(request_nelmts*dst_type_size),0))==NULL) @@ -2462,13 +2629,16 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN H5S_sel_iter_release(mem_space,&mem_iter); H5S_sel_iter_release(file_space,&bkg_iter); - if (src_id >= 0) H5I_dec_ref(src_id); - if (dst_id >= 0) H5I_dec_ref(dst_id); - if (tconv_buf && NULL==xfer_parms->tconv_buf) + if (src_id >= 0) + H5I_dec_ref(src_id); + if (dst_id >= 0) + H5I_dec_ref(dst_id); + if (tconv_buf && NULL==H5P_peek_voidp(dxpl_id,H5D_XFER_TCONV_BUF_NAME)) H5FL_BLK_FREE(type_conv,tconv_buf); - if (bkg_buf && NULL==xfer_parms->bkg_buf) + if (bkg_buf && NULL==H5P_peek_voidp(dxpl_id,H5D_XFER_BKGR_BUF_NAME)) H5FL_BLK_FREE(bkgr_conv,bkg_buf); - if (free_this_space) H5S_close(free_this_space); + if (free_this_space) + H5S_close(free_this_space); FUNC_LEAVE(ret_value); } @@ -2706,7 +2876,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) } } else { if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, addr, - size, H5P_DEFAULT, buf)<0) { + size, H5P_DATASET_XFER_DEFAULT, buf)<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset"); } @@ -2741,7 +2911,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) dim[ndims] = dset->layout.dim[ndims]; ndims++; - if (H5F_istore_allocate(dset->ent.file, H5P_DEFAULT, + if (H5F_istore_allocate(dset->ent.file, H5P_DATASET_XFER_DEFAULT, &(dset->layout), dim, &(dset->create_parms->pline), &(dset->create_parms->fill))<0) { @@ -2946,8 +3116,6 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) { - H5D_xfer_t tmp_xfer_parms; /* Temporary copy of the default xfer parms */ - H5D_xfer_t *xfer_parms = NULL; /* xfer parms as iterator op_data */ herr_t ret_value=FAIL; FUNC_ENTER(H5Dvlen_reclaim, FAIL); @@ -2955,22 +3123,21 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) /* Check args */ if (H5I_DATATYPE!=H5I_get_type(type_id) || - H5I_DATASPACE!=H5I_get_type(space_id) || - buf==NULL) { + H5I_DATASPACE!=H5I_get_type(space_id) || + buf==NULL) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); } - /* Retrieve dataset transfer property list */ - if (H5P_DEFAULT == plist_id) { - HDmemcpy(&tmp_xfer_parms,&H5D_xfer_dflt,sizeof(H5D_xfer_t)); - xfer_parms = &tmp_xfer_parms; - } else if (H5P_DATASET_XFER != H5P_get_class(plist_id) || - NULL == (xfer_parms = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); - } + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == plist_id) + plist_id= H5P_DATASET_XFER_DEFAULT; + + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Call H5Diterate with args, etc. */ - ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,xfer_parms); + ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,&plist_id); FUNC_LEAVE(ret_value); } /* end H5Dvlen_reclaim() */ @@ -3132,7 +3299,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available"); /* Change to the custom memory allocation routines for reading VL data */ - if((vlen_bufsize.xfer_pid=H5Pcreate(H5P_DATASET_XFER))<0) + if((vlen_bufsize.xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW))<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "no dataset xfer plists available"); if(H5Pset_vlen_mem_manager(vlen_bufsize.xfer_pid,H5D_vlen_get_buf_size_alloc,&vlen_bufsize,NULL,NULL)<0) @@ -3159,7 +3326,7 @@ done: if(vlen_bufsize.vl_tbuf!=NULL) H5FL_BLK_FREE(vlen_vl_buf,vlen_bufsize.vl_tbuf); if(vlen_bufsize.xfer_pid>0) - H5Pclose(vlen_bufsize.xfer_pid); + H5Pclose_list(vlen_bufsize.xfer_pid); FUNC_LEAVE(ret_value); } /* end H5Dvlen_get_buf_size() */ diff --git a/src/H5Distore.c b/src/H5Distore.c index d37c474..ebdeda9 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1001,7 +1001,7 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) 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_DEFAULT, + if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0) { HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); @@ -1421,7 +1421,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* * The chunk exists on disk. */ - if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DEFAULT, + if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, chunk)<0) { HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); @@ -1500,13 +1500,9 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->wr_count = chunk_size; ent->chunk = chunk; - { - H5D_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); - ent->split_ratios[0] = dxpl->split_ratios[0]; - ent->split_ratios[1] = dxpl->split_ratios[1]; - ent->split_ratios[2] = dxpl->split_ratios[2]; - } + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); + H5Pget(dxpl_id,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(ent->split_ratios)); /* Add it to the cache */ assert(NULL==rdcc->slot[idx]); @@ -1646,13 +1642,10 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } x.alloc_size = x.chunk_size; x.chunk = chunk; - { - H5D_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); - x.split_ratios[0] = dxpl->split_ratios[0]; - x.split_ratios[1] = dxpl->split_ratios[1]; - x.split_ratios[2] = dxpl->split_ratios[2]; - } + + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); + H5Pget(dxpl_id,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(x.split_ratios)); H5F_istore_flush_entry (f, &x, TRUE); } else { @@ -1800,7 +1793,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 = udata.addr; - if (H5F_arr_read(f, H5P_DEFAULT, &l, pline, fill, NULL/*no efl*/, + if (H5F_arr_read(f, H5P_DATASET_XFER_DEFAULT, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data from file"); @@ -1976,7 +1969,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 = udata.addr; - if (H5F_arr_write(f, H5P_DEFAULT, &l, pline, fill, NULL/*no efl*/, + if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 3254dde..ef942f7 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -51,32 +51,82 @@ typedef struct H5D_create_t { H5O_pline_t pline; /*data filter pipeline */ } H5D_create_t; -/* Data transfer property list */ -typedef struct H5D_xfer_t { - size_t buf_size; /*max temp buffer size */ - void *tconv_buf; /*type conversion buffer or null */ - void *bkg_buf; /*background buffer or null */ - H5T_bkg_t need_bkg; /*type of background buffer needed */ - double split_ratios[3];/*B-tree node splitting ratios */ - uintn cache_hyper; /*cache hyperslab blocks during I/O? */ - uintn block_limit; /*largest hyperslab block to cache */ - size_t vector_size; /*Max. # of I/O vectors for hyperslabs */ - H5MM_allocate_t vlen_alloc; /*VL datatype allocation function */ - void *alloc_info; /*VL datatype allocation information */ - H5MM_free_t vlen_free; /*VL datatype free function */ - void *free_info; /*VL datatype free information */ - hid_t driver_id; /*File driver ID */ - void *driver_info; /*File driver specific information */ -#ifdef COALESCE_READS - uintn gather_reads; /*coalesce single reads into a read transaction */ +/* Data transfer properties */ +/* Definitions for maximum temp buffer size property */ +#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" +#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(hsize_t) +#define H5D_XFER_MAX_TEMP_BUF_DEF (1024*1024) +/* Definitions for type conversion buffer property */ +#define H5D_XFER_TCONV_BUF_NAME "tconv_buf" +#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *) +#define H5D_XFER_TCONV_BUF_DEF NULL +/* Definitions for background buffer property */ +#define H5D_XFER_BKGR_BUF_NAME "bkgr_buf" +#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *) +#define H5D_XFER_BKGR_BUF_DEF NULL +/* Definitions for background buffer type property */ +#define H5D_XFER_BKGR_BUF_TYPE_NAME "bkgr_buf_type" +#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t) +#define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO +/* Definitions for B-tree node splitting ratio property */ +#define H5D_XFER_BTREE_SPLIT_RATIO_NAME "btree_split_ratio" +#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3]) +#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9} +/* Definitions for hyperslab caching property */ +#define H5D_XFER_HYPER_CACHE_NAME "hyper_cache" +#define H5D_XFER_HYPER_CACHE_SIZE sizeof(uintn) +#ifndef H5_HAVE_PARALLEL +#define H5D_XFER_HYPER_CACHE_DEF 1 +#else +#define H5D_XFER_HYPER_CACHE_DEF 0 #endif -} H5D_xfer_t; +/* Definitions for hyperslab cache limit property */ +#define H5D_XFER_HYPER_CACHE_LIM_NAME "hyper_cache_limit" +#define H5D_XFER_HYPER_CACHE_LIM_SIZE sizeof(uintn) +#define H5D_XFER_HYPER_CACHE_LIM_DEF 0 +/* Definitions for hyperslab cache limit property */ +#define H5D_XFER_HYPER_CACHE_LIM_NAME "hyper_cache_limit" +#define H5D_XFER_HYPER_CACHE_LIM_SIZE sizeof(uintn) +#define H5D_XFER_HYPER_CACHE_LIM_DEF 0 +/* Definitions for vlen allocation function property */ +#define H5D_XFER_VLEN_ALLOC_NAME "vlen_alloc" +#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t) +#define H5D_XFER_VLEN_ALLOC_DEF NULL +/* Definitions for vlen allocation info property */ +#define H5D_XFER_VLEN_ALLOC_INFO_NAME "vlen_alloc_info" +#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *) +#define H5D_XFER_VLEN_ALLOC_INFO_DEF NULL +/* Definitions for vlen free function property */ +#define H5D_XFER_VLEN_FREE_NAME "vlen_free" +#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t) +#define H5D_XFER_VLEN_FREE_DEF NULL +/* Definitions for vlen free info property */ +#define H5D_XFER_VLEN_FREE_INFO_NAME "vlen_free_info" +#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *) +#define H5D_XFER_VLEN_FREE_INFO_DEF NULL +/* Definitions for file driver ID property */ +#define H5D_XFER_VFL_ID_NAME "vfl_id" +#define H5D_XFER_VFL_ID_SIZE sizeof(hid_t) +#define H5D_XFER_VFL_ID_DEF H5FD_VFD_DEFAULT +/* Definitions for file driver info property */ +#define H5D_XFER_VFL_INFO_NAME "vfl_info" +#define H5D_XFER_VFL_INFO_SIZE sizeof(void *) +#define H5D_XFER_VFL_INFO_DEF NULL +#ifdef COALESCE_READS +/* Definitions for 'gather reads' property */ +#define H5D_XFER_GATHER_READS_NAME "gather_reads" +#define H5D_XFER_GATHER_READS_SIZE sizeof(uintn) +#define H5D_XFER_GATHER_READS_DEF 0 +#endif /* COALESCE_READS */ +/* Definitions for hyperslab vector size property */ +#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 typedef struct H5D_t H5D_t; /* library variables */ __DLLVAR__ const H5D_create_t H5D_create_dflt; -__DLLVAR__ H5D_xfer_t H5D_xfer_dflt; /* Functions defined in H5D.c */ __DLL__ herr_t H5D_init(void); @@ -101,5 +151,7 @@ __DLL__ H5F_t * H5D_get_file(const H5D_t *dset); __DLL__ hsize_t H5D_get_storage_size(H5D_t *dset); __DLL__ void *H5D_vlen_get_buf_size_alloc(size_t size, void *info); __DLL__ herr_t H5D_vlen_get_buf_size(void *elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *op_data); +__DLL__ herr_t H5D_xfer_create(hid_t dxpl_id, void *create_data); +__DLL__ herr_t H5D_xfer_close(hid_t dxpl_id, void *close_data); #endif diff --git a/src/H5Dseq.c b/src/H5Dseq.c index 1c05dcf..f33005a 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -172,18 +172,30 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(f); assert(layout); assert(real_buf); + /* Make certain we have the correct type of property list */ + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); #ifdef H5_HAVE_PARALLEL { - /* Get the transfer mode */ - H5D_xfer_t *dxpl; - H5FD_mpio_dxpl_t *dx; - - if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && - H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && - H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { - xfer_mode = dx->xfer_mode; - } + /* Get the transfer mode */ + H5FD_mpio_dxpl_t *dx; + hid_t driver_id; /* VFL driver ID */ + + /* Get the driver ID */ + if(H5P_get(dxpl_id, 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 */ + if(H5FD_MPIO==driver_id) { + /* Get the driver information */ + if(H5P_get(dxpl_id, 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 */ } /* Collective MPIO access is unsupported for non-contiguous datasets */ @@ -534,18 +546,30 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(f); assert(layout); assert(real_buf); + /* Make certain we have the correct type of property list */ + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); #ifdef H5_HAVE_PARALLEL { - /* Get the transfer mode */ - H5D_xfer_t *dxpl; - H5FD_mpio_dxpl_t *dx; - - if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && - H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && - H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { - xfer_mode = dx->xfer_mode; - } + /* Get the transfer mode */ + H5FD_mpio_dxpl_t *dx; + hid_t driver_id; /* VFL driver ID */ + + /* Get the driver ID */ + if(H5P_get(dxpl_id, 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 */ + if(H5FD_MPIO==driver_id) { + /* Get the driver information */ + if(H5P_get(dxpl_id, 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 */ } /* Collective MPIO access is unsupported for non-contiguous datasets */ diff --git a/src/H5E.c b/src/H5E.c index cb45a9a..e1a830a 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -101,7 +101,9 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = { /* Object atom related errors */ {H5E_BADATOM, "Unable to find atom information (already closed?)"}, - {H5E_CANTREGISTER, "Unable to register new atom"}, + {H5E_CANTREGISTER, "Unable to register new atom"}, + {H5E_CANTINC, "Unable to increment reference count"}, + {H5E_CANTDEC, "Unable to decrement reference count"}, /* Cache related errors */ {H5E_CANTFLUSH, "Unable to flush data from cache"}, @@ -135,6 +137,10 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = { /* Datatype conversion errors */ {H5E_CANTCONVERT, "Can't convert datatypes"}, + /* Property list errors */ + {H5E_CANTGET, "Can't get value"}, + {H5E_CANTSET, "Can't set value"}, + /* Datatype conversion errors */ {H5E_MPI, "Some MPI function failed"} }; diff --git a/src/H5Epublic.h b/src/H5Epublic.h index f0b59c8..1118302 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -142,6 +142,8 @@ typedef enum H5E_minor_t { /* Object atom related errors */ H5E_BADATOM, /*Can't find atom information */ H5E_CANTREGISTER, /*Can't register new atom */ + H5E_CANTINC, /*Can't increment reference count */ + H5E_CANTDEC, /*Can't decrement reference count */ /* Cache related errors */ H5E_CANTFLUSH, /*Can't flush object from cache */ @@ -175,6 +177,10 @@ typedef enum H5E_minor_t { /* Datatype conversion errors */ H5E_CANTCONVERT, /*Can't convert datatypes */ + /* Property list errors */ + H5E_CANTGET, /*Can't get value */ + H5E_CANTSET, /*Can't set value */ + /* Parallel errors */ H5E_MPI /*some MPI function failed */ } H5E_minor_t; diff --git a/src/H5F.c b/src/H5F.c index 349f926..5a606c3 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -596,7 +596,7 @@ H5F_locate_signature(H5FD_t *file) HRETURN_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature"); } - if (H5FD_read(file, H5FD_MEM_SUPER, H5P_DEFAULT, addr, H5F_SIGNATURE_LEN, buf)<0) { + if (H5FD_read(file, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, addr, H5F_SIGNATURE_LEN, buf)<0) { HRETURN_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature"); } @@ -1110,7 +1110,7 @@ H5F_open(const char *name, uintn flags, hid_t fcpl_id, hid_t fapl_id) "unable to find file signature"); } if (H5FD_set_eoa(lf, shared->boot_addr+fixed_size)<0 || - H5FD_read(lf, H5FD_MEM_SUPER, H5P_DEFAULT, shared->boot_addr, fixed_size, buf)<0) { + H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, shared->boot_addr, fixed_size, buf)<0) { HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock"); } @@ -1198,7 +1198,7 @@ H5F_open(const char *name, uintn 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_DEFAULT, shared->boot_addr+fixed_size, + H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, shared->boot_addr+fixed_size, variable_size, buf)<0) { HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read superblock"); @@ -1217,7 +1217,7 @@ H5F_open(const char *name, uintn 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_DEFAULT, drv_addr, 16, buf)<0) { + H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, drv_addr, 16, buf)<0) { HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read driver information block"); } @@ -1241,7 +1241,7 @@ H5F_open(const char *name, uintn 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_DEFAULT, drv_addr+16, driver_size, buf)<0) { + H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, drv_addr+16, driver_size, buf)<0) { HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read file driver information"); } @@ -1660,7 +1660,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(!alloc_only && 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_DEFAULT, f->shared->sieve_buf)<0) { + 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) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } @@ -1769,7 +1769,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, if (IS_H5FD_MPIO(f)) H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif - if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, H5P_DEFAULT, f->shared->boot_addr, + if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, f->shared->boot_addr, superblock_size, sbuf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock"); @@ -1781,7 +1781,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, if (IS_H5FD_MPIO(f)) H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif - if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, H5P_DEFAULT, + if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, f->shared->base_addr+superblock_size, driver_size, dbuf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, diff --git a/src/H5FD.c b/src/H5FD.c index f8538ae..fd24594 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -284,7 +284,6 @@ H5FD_get_class(hid_t id) { H5FD_class_t *ret_value=NULL; H5F_access_t *fapl=NULL; - H5D_xfer_t *dxpl=NULL; FUNC_ENTER(H5FD_get_class, NULL); @@ -292,28 +291,23 @@ H5FD_get_class(hid_t id) ret_value = H5FD_get_class(H5F_access_dflt.driver_id); } else if (H5I_VFL==H5I_get_type(id)) { ret_value = H5I_object(id); + } else if (H5I_GENPROP_LST == H5I_get_type(id) && + TRUE==H5Pisa_class(id,H5P_DATASET_XFER_NEW)) { + ret_value = H5FD_get_class(H5P_peek_hid_t(id,H5D_XFER_VFL_ID_NAME)); } else { switch (H5P_get_class(id)) { - case H5P_FILE_ACCESS: - if (NULL==(fapl=H5I_object(id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, - "not a file access property list"); - } - ret_value = H5FD_get_class(fapl->driver_id); - break; - - case H5P_DATASET_XFER: - if (NULL==(dxpl=H5I_object(id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, - "not a data transfer property list"); - } - ret_value = H5FD_get_class(dxpl->driver_id); - break; - - default: - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, - "not a driver id, file access property list or " - "data transfer property list"); + case H5P_FILE_ACCESS: + if (NULL==(fapl=H5I_object(id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, + "not a file access property list"); + } + ret_value = H5FD_get_class(fapl->driver_id); + break; + + default: + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, + "not a driver id, file access property list or " + "data transfer property list"); } } FUNC_LEAVE(ret_value); @@ -1968,23 +1962,20 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf); /* Check args */ - if (!file || !file->cls) { + if (!file || !file->cls) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer"); - } - if (H5P_DEFAULT!=dxpl_id && - (H5P_DATASET_XFER!=H5P_get_class(dxpl_id) || - NULL==H5I_object(dxpl_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a data transfer property list"); - } - if (!buf) { + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; + if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) || + TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); + if (!buf) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer"); - } /* Do the real work */ - if (H5FD_read(file, type, dxpl_id, addr, size, buf)<0) { + if (H5FD_read(file, type, dxpl_id, addr, size, buf)<0) HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file read request failed"); - } FUNC_LEAVE(SUCCEED); } @@ -2016,8 +2007,8 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz { FUNC_ENTER(H5FD_read, FAIL); assert(file && file->cls); - assert(H5P_DEFAULT==dxpl_id || - (H5P_DATASET_XFER==H5P_get_class(dxpl_id) || H5I_object(dxpl_id))); + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); assert(buf); #ifndef H5_HAVE_PARALLEL @@ -2124,24 +2115,20 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf); /* Check args */ - if (!file || !file->cls) { + if (!file || !file->cls) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer"); - } - if (H5P_DEFAULT!=dxpl_id && - (H5P_DATASET_XFER!=H5P_get_class(dxpl_id) || - NULL==H5I_object(dxpl_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a data transfer property list"); - } - if (!buf) { + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; + if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) || + TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); + if (!buf) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer"); - } /* The real work */ - if (H5FD_write(file, type, dxpl_id, addr, size, buf)<0) { - HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "file write request failed"); - } + if (H5FD_write(file, type, dxpl_id, addr, size, buf)<0) + HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file write request failed"); FUNC_LEAVE(SUCCEED); } @@ -2176,8 +2163,8 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si FUNC_ENTER(H5FD_write, FAIL); assert(file && file->cls); - assert(H5P_DEFAULT==dxpl_id || - (H5P_DATASET_XFER==H5P_get_class(dxpl_id) && H5I_object(dxpl_id))); + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); assert(buf); #ifndef H5_HAVE_PARALLEL @@ -2427,7 +2414,7 @@ H5FD_flush(H5FD_t *file) 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_DEFAULT, file->accum_loc, file->accum_size, file->meta_accum)<0) + if ((file->cls->write)(file, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, file->accum_loc, file->accum_size, file->meta_accum)<0) HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver write request failed"); /* Reset the dirty flag */ diff --git a/src/H5Farray.c b/src/H5Farray.c index c1922fa..03b5751 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -152,7 +152,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; #endif #ifdef COALESCE_READS - H5D_xfer_t *xfer_parms; /*transfer property list*/ + uintn gather_reads; /* # of MPIO reads to gather */ #endif FUNC_ENTER(H5F_arr_read, FAIL); @@ -165,6 +165,9 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(mem_offset); assert(mem_size); assert(buf); + /* Make certain we have the correct type of property list */ + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); /* Make a local copy of size so we can modify it */ H5V_vector_cpy(layout->ndims, hslab_size, _hslab_size); @@ -172,17 +175,25 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL { /* Get the transfer mode */ - H5D_xfer_t *dxpl; H5FD_mpio_dxpl_t *dx; - if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && - H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && - H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { - xfer_mode = dx->xfer_mode; - } + hid_t driver_id; /* VFL driver ID */ + + /* Get the driver ID */ + if(H5P_get(dxpl_id, 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 */ + if(H5FD_MPIO==driver_id) { + /* Get the driver information */ + if(H5P_get(dxpl_id, 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 */ } -#endif -#ifdef H5_HAVE_PARALLEL /* Collective MPIO access is unsupported for non-contiguous datasets */ if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) { HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, @@ -282,30 +293,25 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); #endif if (max != min) - HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, + HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "collective access with unequal number of " "blocks not supported yet"); } #endif -#ifdef COALESCE_READS - /* Get the dataset transfer property list */ - if (H5P_DEFAULT == dxpl_id) { - xfer_parms = &H5D_xfer_dflt; - } else if (H5P_DATASET_XFER != H5P_get_class (dxpl_id) || - NULL == (xfer_parms = H5I_object (dxpl_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); - } - - for (z=0, xfer_parms->gather_reads = nelmts - 1; - zgather_reads--) { -#else #ifdef QAK printf("%s: nelmts=%d, addr=%lu, elmt_size=%lu\n",FUNC,(int)nelmts,(unsigned long)addr,(unsigned long)elmt_size); printf("%s: sieve_buf=%p, sieve_loc=%lu, sieve_size=%lu, sieve_buf_size=%lu, sieve_dirty=%u\n",FUNC,f->shared->sieve_buf,(unsigned long)f->shared->sieve_loc,(unsigned long)f->shared->sieve_size,(unsigned long)f->shared->sieve_buf_size,(unsigned)f->shared->sieve_dirty); printf("%s: feature_flags=%lx\n",FUNC,(unsigned long)f->shared->lf->feature_flags); #endif /* QAK */ +#ifdef COALESCE_READS + for (z=0, gather_reads = nelmts - 1; zndims, hslab_size, _hslab_size); @@ -453,17 +462,25 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL { /* Get the transfer mode */ - H5D_xfer_t *dxpl; H5FD_mpio_dxpl_t *dx; - if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && - H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && - H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { - xfer_mode = dx->xfer_mode; - } + hid_t driver_id; /* VFL driver ID */ + + /* Get the driver ID */ + if(H5P_get(dxpl_id, 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 */ + if(H5FD_MPIO==driver_id) { + /* Get the driver information */ + if(H5P_get(dxpl_id, 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 */ } -#endif -#ifdef H5_HAVE_PARALLEL if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) { HRETURN_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "collective access on non-contiguous datasets not " @@ -566,7 +583,7 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); #endif if (max != min) { - HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, + HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "collective access with unequal number of " "blocks not supported yet"); } @@ -614,8 +631,7 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ if (efl && efl->nused>0) { HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, - "chunking and external files are mutually " - "exclusive"); + "chunking and external files are mutually exclusive"); } for (u=0; undims; u++) { if (0!=mem_offset[u] || hslab_size[u]!=mem_size[u]) { diff --git a/src/H5Fistore.c b/src/H5Fistore.c index d37c474..ebdeda9 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1001,7 +1001,7 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) 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_DEFAULT, + if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0) { HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); @@ -1421,7 +1421,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* * The chunk exists on disk. */ - if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DEFAULT, + if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DATASET_XFER_DEFAULT, chunk)<0) { HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); @@ -1500,13 +1500,9 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->wr_count = chunk_size; ent->chunk = chunk; - { - H5D_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); - ent->split_ratios[0] = dxpl->split_ratios[0]; - ent->split_ratios[1] = dxpl->split_ratios[1]; - ent->split_ratios[2] = dxpl->split_ratios[2]; - } + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); + H5Pget(dxpl_id,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(ent->split_ratios)); /* Add it to the cache */ assert(NULL==rdcc->slot[idx]); @@ -1646,13 +1642,10 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } x.alloc_size = x.chunk_size; x.chunk = chunk; - { - H5D_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); - x.split_ratios[0] = dxpl->split_ratios[0]; - x.split_ratios[1] = dxpl->split_ratios[1]; - x.split_ratios[2] = dxpl->split_ratios[2]; - } + + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); + H5Pget(dxpl_id,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(x.split_ratios)); H5F_istore_flush_entry (f, &x, TRUE); } else { @@ -1800,7 +1793,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 = udata.addr; - if (H5F_arr_read(f, H5P_DEFAULT, &l, pline, fill, NULL/*no efl*/, + if (H5F_arr_read(f, H5P_DATASET_XFER_DEFAULT, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data from file"); @@ -1976,7 +1969,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 = udata.addr; - if (H5F_arr_write(f, H5P_DEFAULT, &l, pline, fill, NULL/*no efl*/, + if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); diff --git a/src/H5Fseq.c b/src/H5Fseq.c index 1c05dcf..f33005a 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -172,18 +172,30 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(f); assert(layout); assert(real_buf); + /* Make certain we have the correct type of property list */ + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); #ifdef H5_HAVE_PARALLEL { - /* Get the transfer mode */ - H5D_xfer_t *dxpl; - H5FD_mpio_dxpl_t *dx; - - if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && - H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && - H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { - xfer_mode = dx->xfer_mode; - } + /* Get the transfer mode */ + H5FD_mpio_dxpl_t *dx; + hid_t driver_id; /* VFL driver ID */ + + /* Get the driver ID */ + if(H5P_get(dxpl_id, 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 */ + if(H5FD_MPIO==driver_id) { + /* Get the driver information */ + if(H5P_get(dxpl_id, 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 */ } /* Collective MPIO access is unsupported for non-contiguous datasets */ @@ -534,18 +546,30 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(f); assert(layout); assert(real_buf); + /* Make certain we have the correct type of property list */ + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); #ifdef H5_HAVE_PARALLEL { - /* Get the transfer mode */ - H5D_xfer_t *dxpl; - H5FD_mpio_dxpl_t *dx; - - if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && - H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && - H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { - xfer_mode = dx->xfer_mode; - } + /* Get the transfer mode */ + H5FD_mpio_dxpl_t *dx; + hid_t driver_id; /* VFL driver ID */ + + /* Get the driver ID */ + if(H5P_get(dxpl_id, 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 */ + if(H5FD_MPIO==driver_id) { + /* Get the driver information */ + if(H5P_get(dxpl_id, 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 */ } /* Collective MPIO access is unsupported for non-contiguous datasets */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 69777b5..cf090da 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -373,7 +373,7 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym) if (IS_H5FD_MPIO(f)) H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif /* H5_HAVE_PARALLEL */ - status = H5F_block_write(f, H5FD_MEM_BTREE, addr, size, H5P_DEFAULT, buf); + status = H5F_block_write(f, H5FD_MEM_BTREE, addr, size, H5P_DATASET_XFER_DEFAULT, buf); if (status < 0) HRETURN_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "unable to write symbol table node to the file"); @@ -443,7 +443,7 @@ H5G_node_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } - if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, H5P_DEFAULT, buf) < 0) { + if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, H5P_DATASET_XFER_DEFAULT, buf) < 0) { HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unabel to read symbol table node"); } diff --git a/src/H5HG.c b/src/H5HG.c index 83e7b78..7aec212 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -257,7 +257,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } - if (H5F_block_read(f, H5FD_MEM_GHEAP, addr, H5HG_MINSIZE, H5P_DEFAULT, + if (H5F_block_read(f, H5FD_MEM_GHEAP, addr, H5HG_MINSIZE, H5P_DATASET_XFER_DEFAULT, heap->chunk)<0) { HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection"); @@ -294,7 +294,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, "memory allocation failed"); } if (H5F_block_read (f, H5FD_MEM_GHEAP, next_addr, (heap->size-H5HG_MINSIZE), - H5P_DEFAULT, heap->chunk+H5HG_MINSIZE)<0) { + H5P_DATASET_XFER_DEFAULT, heap->chunk+H5HG_MINSIZE)<0) { HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection"); } @@ -420,7 +420,7 @@ H5HG_flush (H5F_t *f, hbool_t destroy, haddr_t addr, H5HG_heap_t *heap) if (heap->dirty) { if (H5F_block_write (f, H5FD_MEM_GHEAP, addr, heap->size, - H5P_DEFAULT, heap->chunk)<0) { + H5P_DATASET_XFER_DEFAULT, heap->chunk)<0) { HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write global heap collection to file"); } diff --git a/src/H5HL.c b/src/H5HL.c index 4a36104..b3b98f3 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -219,7 +219,7 @@ H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1, assert(!udata1); assert(!udata2); - if (H5F_block_read(f, H5FD_MEM_LHEAP, addr, H5HL_SIZEOF_HDR(f), H5P_DEFAULT, + if (H5F_block_read(f, H5FD_MEM_LHEAP, addr, H5HL_SIZEOF_HDR(f), H5P_DATASET_XFER_DEFAULT, hdr) < 0) { HRETURN_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read heap header"); @@ -260,7 +260,7 @@ H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1, } if (heap->disk_alloc && H5F_block_read(f, H5FD_MEM_LHEAP, heap->addr, heap->disk_alloc, - H5P_DEFAULT, heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) { + H5P_DATASET_XFER_DEFAULT, heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) { HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to read heap data"); } @@ -400,7 +400,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, H5FD_MEM_LHEAP, addr, (H5HL_SIZEOF_HDR(f)+heap->disk_alloc), - H5P_DEFAULT, heap->chunk) < 0) { + H5P_DATASET_XFER_DEFAULT, heap->chunk) < 0) { HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file"); } @@ -410,7 +410,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, H5FD_MEM_LHEAP, addr, H5HL_SIZEOF_HDR(f), - H5P_DEFAULT, heap->chunk)<0) { + H5P_DATASET_XFER_DEFAULT, heap->chunk)<0) { HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header to file"); } @@ -419,7 +419,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, H5FD_MEM_LHEAP, heap->addr, heap->disk_alloc, - H5P_DEFAULT, + H5P_DATASET_XFER_DEFAULT, heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) { HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data to file"); diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 118ce98..2c82cfa 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -30,7 +30,7 @@ typedef enum { H5I_BADID = (-1), /*invalid Group */ H5I_FILE = 1, /*group ID for File objects */ H5I_FILE_CLOSING, /*files pending close due to open objhdrs */ - H5I_TEMPLATE_0, /*group ID for Template objects */ + H5I_TEMPLATE_0, /*group ID for Template objects */ H5I_TEMPLATE_1, /*group ID for Template objects */ H5I_TEMPLATE_2, /*group ID for Template objects */ H5I_TEMPLATE_3, /*group ID for Template objects */ @@ -38,17 +38,17 @@ typedef enum { H5I_TEMPLATE_5, /*group ID for Template objects */ H5I_TEMPLATE_6, /*group ID for Template objects */ H5I_TEMPLATE_7, /*group ID for Template objects */ - H5I_TEMPLATE_MAX, /*not really a group ID */ + H5I_TEMPLATE_MAX, /*not really a group ID */ H5I_GROUP, /*group ID for Group objects */ H5I_DATATYPE, /*group ID for Datatype objects */ H5I_DATASPACE, /*group ID for Dataspace objects */ H5I_DATASET, /*group ID for Dataset objects */ H5I_ATTR, /*group ID for Attribute objects */ - H5I_TEMPBUF, /*group ID for Temporary buffer objects */ + H5I_TEMPBUF, /*group ID for Temporary buffer objects */ H5I_REFERENCE, /*group ID for Reference objects */ - H5I_VFL, /*group ID for virtual file layer */ - H5I_GENPROP_CLS, /*group ID for generic property list classes */ - H5I_GENPROP_LST, /*group ID for generic property lists */ + H5I_VFL, /*group ID for virtual file layer */ + H5I_GENPROP_CLS, /*group ID for generic property list classes */ + H5I_GENPROP_LST, /*group ID for generic property lists */ H5I_NGROUPS /*number of valid groups, MUST BE LAST! */ } H5I_type_t; diff --git a/src/H5O.c b/src/H5O.c index a917ad7..b354231 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -379,7 +379,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, /* read fixed-lenth part of object header */ hdr_size = H5O_SIZEOF_HDR(f); - if (H5F_block_read(f, H5FD_MEM_OHDR, addr, hdr_size, H5P_DEFAULT, buf) < 0) { + if (H5F_block_read(f, H5FD_MEM_OHDR, addr, hdr_size, H5P_DATASET_XFER_DEFAULT, buf) < 0) { HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header"); } @@ -437,7 +437,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } - if (H5F_block_read(f, H5FD_MEM_OHDR, chunk_addr, chunk_size, H5P_DEFAULT, + if (H5F_block_read(f, H5FD_MEM_OHDR, chunk_addr, chunk_size, H5P_DATASET_XFER_DEFAULT, oh->chunk[chunkno].image) < 0) { HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header data"); @@ -593,7 +593,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh) H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, H5FD_MEM_OHDR, addr, H5O_SIZEOF_HDR(f), - H5P_DEFAULT, buf) < 0) { + H5P_DATASET_XFER_DEFAULT, buf) < 0) { HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header hdr to disk"); } @@ -680,7 +680,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh) #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, H5FD_MEM_OHDR, addr, (H5O_SIZEOF_HDR(f)+oh->chunk[u].size), - H5P_DEFAULT, p) < 0) { + H5P_DATASET_XFER_DEFAULT, p) < 0) { HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header data to disk"); } /* end if */ @@ -695,7 +695,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh) #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, H5FD_MEM_OHDR, oh->chunk[u].addr, (oh->chunk[u].size), - H5P_DEFAULT, oh->chunk[u].image) < 0) { + H5P_DATASET_XFER_DEFAULT, oh->chunk[u].image) < 0) { HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header data to disk"); } /* end if */ diff --git a/src/H5P.c b/src/H5P.c index 7aa71bb..c95e2ac 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -35,23 +35,39 @@ static intn interface_initialize_g = 0; static herr_t H5P_init_interface(void); /* - * Predefined data types. These are initialized at runtime by + * Predefined property list classes. These are initialized at runtime by * H5P_init_interface() in this source file. */ -hid_t H5P_NO_CLASS_g = FAIL; -hid_t H5P_FILE_CREATE_g = FAIL; -hid_t H5P_FILE_ACCESS_g = FAIL; -hid_t H5P_DATASET_CREATE_g = FAIL; -hid_t H5P_DATASET_XFER_g = FAIL; -hid_t H5P_MOUNT_g = FAIL; +hid_t H5P_CLS_NO_CLASS_g = FAIL; +hid_t H5P_CLS_FILE_CREATE_g = FAIL; +hid_t H5P_CLS_FILE_ACCESS_g = FAIL; +hid_t H5P_CLS_DATASET_CREATE_g = FAIL; +hid_t H5P_CLS_DATASET_XFER_g = FAIL; +hid_t H5P_CLS_MOUNT_g = FAIL; + +/* + * Predefined property lists for each predefined class. These are initialized + * at runtime by H5P_init_interface() in this source file. + */ +hid_t H5P_LST_NO_CLASS_g = FAIL; +hid_t H5P_LST_FILE_CREATE_g = FAIL; +hid_t H5P_LST_FILE_ACCESS_g = FAIL; +hid_t H5P_LST_DATASET_CREATE_g = FAIL; +hid_t H5P_LST_DATASET_XFER_g = FAIL; +hid_t H5P_LST_MOUNT_g = FAIL; /* Local static functions */ static H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, const char *name, uintn hashsize, uintn internal, H5P_cls_create_func_t cls_create, void *create_data, + H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data); static herr_t H5P_close_list(void *_plist); static herr_t H5P_close_class(void *_pclass); +static H5P_genprop_t *H5P_copy_prop(H5P_genprop_t *oprop); +static herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); +static herr_t H5P_add_prop(H5P_genprop_t *hash[], uintn hashsize, H5P_genprop_t *prop); +static herr_t H5P_free_prop(H5P_genprop_t *prop); /* Declare a free list to manage the H5P_t struct */ H5FL_DEFINE_STATIC(H5P_t); @@ -173,61 +189,56 @@ H5P_init_interface(void) * Initialize the Generic Property class & object groups. */ if (H5I_init_group(H5I_GENPROP_CLS, H5I_GENPROPCLS_HASHSIZE, 0, (H5I_free_t)H5P_close_class) < 0) - HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, - "unable to initialize atom group"); + HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize atom group"); if (H5I_init_group(H5I_GENPROP_LST, H5I_GENPROPOBJ_HASHSIZE, 0, (H5I_free_t)H5P_close_list) < 0) - HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, - "unable to initialize atom group"); + HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize atom group"); /* Create root property list class */ /* Allocate the root class */ - if (NULL==(root_class = H5P_create_class (NULL,"none",H5P_NO_CLASS_HASH_SIZE,1,NULL,NULL,NULL,NULL))) + if (NULL==(root_class = H5P_create_class (NULL,"none",H5P_NO_CLASS_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL))) HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); /* Register the root class */ - if ((H5P_NO_CLASS_g = H5I_register (H5I_GENPROP_CLS, root_class))<0) + if ((H5P_CLS_NO_CLASS_g = H5I_register (H5I_GENPROP_CLS, root_class))<0) HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); /* Register the file creation and file access property classes */ /* Allocate the file creation class */ - if (NULL==(pclass = H5P_create_class (root_class,"file create",H5P_FILE_CREATE_HASH_SIZE,1,NULL,NULL,NULL,NULL))) + if (NULL==(pclass = H5P_create_class (root_class,"file create",H5P_FILE_CREATE_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL))) HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); /* Register the dataset creation class */ - if ((H5P_FILE_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) + if ((H5P_CLS_FILE_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); /* Allocate the file access class */ - if (NULL==(pclass = H5P_create_class (root_class,"file access",H5P_FILE_ACCESS_HASH_SIZE,1,NULL,NULL,NULL,NULL))) + if (NULL==(pclass = H5P_create_class (root_class,"file access",H5P_FILE_ACCESS_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL))) HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); /* Register the file access class */ - if ((H5P_DATASET_XFER_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) + if ((H5P_CLS_FILE_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); /* Register the dataset creation and data xfer property classes */ /* Allocate the dataset creation class */ - if (NULL==(pclass = H5P_create_class (root_class,"dataset create",H5P_DATASET_CREATE_HASH_SIZE,1,NULL,NULL,NULL,NULL))) + if (NULL==(pclass = H5P_create_class (root_class,"dataset create",H5P_DATASET_CREATE_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL))) HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); /* Register the dataset creation class */ - if ((H5P_DATASET_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) + if ((H5P_CLS_DATASET_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); /* Allocate the data xfer class */ - if (NULL==(pclass = H5P_create_class (root_class,"data xfer",H5P_DATASET_XFER_HASH_SIZE,1,NULL,NULL,NULL,NULL))) + if (NULL==(pclass = H5P_create_class (root_class,"data xfer",H5P_DATASET_XFER_HASH_SIZE,1,H5D_xfer_create,NULL,H5D_xfer_create,NULL,H5D_xfer_close,NULL))) HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); /* Register the data xfer class */ - if ((H5P_DATASET_XFER_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) + if ((H5P_CLS_DATASET_XFER_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); -/* When do the "basic" properties for each of the library classes get added? */ -/* Who adds them? */ - FUNC_LEAVE(ret_value); } @@ -254,17 +265,22 @@ H5P_term_interface(void) intn i, n=0; if (interface_initialize_g) { -/* Destroy HDF5 library property classes */ + /* Destroy HDF5 library property classes & lists */ + + /* Check if there are any open property list classes or lists */ for (i=0; iu.faccess); - H5D_xfer_t *dx_list = &(plist->u.dxfer); H5D_create_t *dc_list = &(plist->u.dcreate); FUNC_ENTER (H5P_close, FAIL); @@ -475,15 +487,6 @@ H5P_close(void *_plist) H5O_reset(H5O_PLINE, &(dc_list->pline)); break; - case H5P_DATASET_XFER: - if (dx_list->driver_id>=0) { - H5FD_dxpl_free(dx_list->driver_id, dx_list->driver_info); - H5I_dec_ref(dx_list->driver_id); - dx_list->driver_info = NULL; - dx_list->driver_id = -1; - } - break; - case H5P_MOUNT: break; @@ -564,6 +567,246 @@ H5P_get_class(hid_t plist_id) } +/*-------------------------------------------------------------------------- + NAME + H5P_copy_pclass + PURPOSE + Internal routine to copy a generic property class + USAGE + hid_t H5P_copy_pclass(pclass) + H5P_genclass_t *pclass; IN: Property class to copy + RETURNS + Success: valid property class ID on success (non-negative) + Failure: negative + DESCRIPTION + Copy a property class and return the ID. This routine does not make + any callbacks. (They are only make when operating on property lists). + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static hid_t H5P_copy_pclass(H5P_genclass_t *pclass) +{ + H5P_genclass_t *new_pclass = NULL; /* Property list class copied */ + H5P_genprop_t *tmp; /* Temporary pointer to parent class properties */ + H5P_genprop_t *pcopy; /* Copy of property to insert into class */ + uintn u; /* Local index variable */ + hid_t ret_value=FAIL; /* return value */ + + FUNC_ENTER (H5P_copy_pclass, FAIL); + + assert(pclass); + + /* + * Create new property class object + */ + + /* Create the new property list class */ + if (NULL==(new_pclass=H5P_create_class(pclass->parent, pclass->name, pclass->hashsize, 0, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class"); + + /* Copy the properties registered for this class */ + if(pclass->nprops>0) { + /* Walk through the hash table */ + for(u=0; uhashsize; u++) { + tmp=pclass->props[u]; + + /* Walk through the list of properties at each hash location */ + while(tmp!=NULL) { + /* Make a copy of the class's property */ + if((pcopy=H5P_copy_prop(tmp))==NULL) + HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property"); + + /* Insert the initialized property into the property list */ + if(H5P_add_prop(new_pclass->props,new_pclass->hashsize,pcopy)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class"); + + /* Increment property count for class */ + new_pclass->nprops++; + + /* Go to next registered property in class */ + tmp=tmp->next; + } /* end while */ + } /* end for */ + } /* end if */ + + /* Increment parent class's derived class value */ + if(new_pclass->parent!=NULL) + if(H5P_access_class(new_pclass->parent,H5P_MOD_INC_CLS)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment parent class ref count"); + + /* Get an atom for the class */ + if ((ret_value = H5I_register(H5I_GENPROP_CLS, new_pclass))<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + +done: + if (ret_value<0 && new_pclass) + H5P_close_class(new_pclass); + + FUNC_LEAVE (ret_value); +} /* H5P_copy_pclass() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_copy_plist + PURPOSE + Internal routine to copy a generic property lists + USAGE + hid_t H5P_copy_plist(plist) + H5P_genplist_t *plist; IN: Property list to copy + RETURNS + Success: valid property list ID on success (non-negative) + Failure: negative + DESCRIPTION + Copy a property list or class and return the ID. This routine calls the + class 'copy' callback after any property 'copy' callbacks are called + (assuming all property 'copy' callbacks return successfully). + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static hid_t H5P_copy_plist(H5P_genplist_t *plist) +{ + H5P_genplist_t *new_plist; /* New property list generated from copy */ + H5P_genprop_t *tprop; /* Temporary pointer to properties */ + H5P_genprop_t *new_prop; /* New property created for copy */ + hid_t plist_id; /* Property list ID of new list created */ + uintn u; /* Local index variable */ + hid_t ret_value=FAIL; /* return value */ + + FUNC_ENTER (H5P_copy_plist, FAIL); + + assert(plist); + + /* + * Create new property list object + */ + + /* Allocate room for the property list & it's hash table of properties */ + if (NULL==(new_plist = H5MM_calloc (sizeof(H5P_genplist_t)+((plist->pclass->hashsize-1)*sizeof(H5P_genprop_t *))))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,"memory allocation failed"); + + /* Set class state */ + new_plist->pclass = plist->pclass; + new_plist->nprops = 0; /* Initially the plist has the same number of properties as the class */ + new_plist->class_init = 0; /* Initially, wait until the class callback finishes to set */ + + /* Cycle through the properties and copy them also */ + for(u=0; upclass->hashsize; u++) { + tprop=plist->props[u]; + + /* Walk through the list of properties at each hash location */ + while(tprop!=NULL) { + /* Make a copy of the class's property */ + if((new_prop=H5P_copy_prop(tprop))==NULL) + HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property"); + + /* Call property copy callback, if it exists */ + if(new_prop->copy) { + if((new_prop->copy)(new_prop->name,new_prop->size,new_prop->value)<0) { + H5P_free_prop(new_prop); + HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, NULL,"Can't copy property"); + } /* end if */ + } /* end if */ + + /* Insert the initialized property into the property list */ + if(H5P_add_prop(new_plist->props,new_plist->pclass->hashsize,new_prop)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into list"); + + /* Increment the number of properties in list */ + new_plist->nprops++; + + /* Go to next registered property in class */ + tprop=tprop->next; + } /* end while */ + } /* end for */ + + /* Increment the number of property lists derived from class */ + if(H5P_access_class(new_plist->pclass,H5P_MOD_INC_LST)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment class ref count"); + + /* Get an atom for the property list */ + if ((plist_id = H5I_register(H5I_GENPROP_LST, new_plist))<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list"); + + /* Call the class callback (if it exists) now that we have the property list ID */ + if(new_plist->pclass->copy_func!=NULL) { + if((new_plist->pclass->copy_func)(plist_id,plist->pclass->copy_data)<0) { + /* Delete ID, ignore return value */ + H5I_remove(plist_id); + HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property"); + } /* end if */ + } /* end if */ + + /* Set the class initialization flag */ + new_plist->class_init=1; + + /* Set the return value */ + ret_value=plist_id; + +done: + if (ret_value<0 && new_plist) + H5P_close_list(new_plist); + + FUNC_LEAVE (ret_value); +} /* H5P_copy_plist() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_copy_new + PURPOSE + Routine to copy a property list or class + USAGE + hid_t H5P_copy_new(id) + hid_t id; IN: Property list or class ID to copy + RETURNS + Success: valid property list ID on success (non-negative) + Failure: negative + DESCRIPTION + Copy a property list or class and return the ID. This routine calls the + class 'copy' callback after any property 'copy' callbacks are called + (assuming all property 'copy' callbacks return successfully). + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static hid_t H5P_copy_new(hid_t id) +{ + void *obj; /* Property object to copy */ + hid_t ret_value=FALSE; /* return value */ + + FUNC_ENTER (H5P_copy_new, FAIL); + + /* Check arguments. */ + if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property object"); + if(NULL == (obj = H5I_object(id))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); + + /* Compare property lists */ + if(H5I_GENPROP_LST == H5I_get_type(id)) { + if((ret_value=H5P_copy_plist(obj))<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list"); + } /* end if */ + /* Must be property classes */ + else { + if((ret_value=H5P_copy_pclass(obj))<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property class"); + } /* end else */ + +done: + FUNC_LEAVE (ret_value); +} /* H5P_copy_new() */ + + /*------------------------------------------------------------------------- * Function: H5Pcopy * @@ -600,24 +843,39 @@ H5Pcopy(hid_t plist_id) HRETURN(H5P_DEFAULT); /* Check args */ - if (NULL == (plist = H5I_object(plist_id)) || - (type = H5P_get_class(plist_id)) < 0 || - (group = H5I_get_type(plist_id)) < 0) { - HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, - "unable to unatomize property list"); - } - - /* Copy it */ - if (NULL==(new_plist=H5P_copy (type, plist))) { - HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL, - "unable to copy property list"); - } + if ((group = H5I_get_type(plist_id)) < 0) + HRETURN_ERROR(H5E_ATOM, H5E_BADTYPE, FAIL, + "unable to retrieve ID type"); + + /* Copy generic property lists and classes in new way */ + if(group==H5I_GENPROP_CLS || group==H5I_GENPROP_LST) { + /* Copy it */ + if ((ret_value=H5P_copy_new (plist_id))<0) + HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL, + "unable to copy property list"); + } /* end if */ + /* Use old way to copy old-style property lists */ + else { + /* Further arg checking... */ + if (NULL == (plist = H5I_object(plist_id))) + HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, + "unable to unatomize property list"); + if ((type = H5P_get_class(plist_id)) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, + "unable to retrieve property list type"); + + /* Copy it */ + if (NULL==(new_plist=H5P_copy (type, plist))) + HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL, + "unable to copy property list"); + + /* Register the atom for the new property list */ + if ((ret_value = H5I_register(group, new_plist)) < 0) { + HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, + "unable to atomize property list pointer"); + } + } /* end else */ - /* Register the atom for the new property list */ - if ((ret_value = H5I_register(group, new_plist)) < 0) { - HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, - "unable to atomize property list pointer"); - } FUNC_LEAVE(ret_value); } @@ -648,7 +906,6 @@ H5P_copy (H5P_class_t type, const void *src) const H5D_create_t *dc_src = NULL; H5D_create_t *dc_dst = NULL; H5F_access_t *fa_dst = NULL; - H5D_xfer_t *dx_dst = NULL; FUNC_ENTER (H5P_copy, NULL); @@ -666,10 +923,6 @@ H5P_copy (H5P_class_t type, const void *src) size = sizeof(H5D_create_t); break; - case H5P_DATASET_XFER: - size = sizeof(H5D_xfer_t); - break; - case H5P_MOUNT: size = sizeof(H5F_mprop_t); break; @@ -730,16 +983,6 @@ H5P_copy (H5P_class_t type, const void *src) } break; - case H5P_DATASET_XFER: - dx_dst = (H5D_xfer_t*)dst; - - if (dx_dst->driver_id>=0) { - H5I_inc_ref(dx_dst->driver_id); - dx_dst->driver_info = H5FD_dxpl_copy(dx_dst->driver_id, - dx_dst->driver_info); - } - break; - case H5P_MOUNT: /* Nothing to do */ break; @@ -1650,18 +1893,19 @@ H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/, *------------------------------------------------------------------------- */ herr_t -H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info) +H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info) { H5F_access_t *fapl=NULL; - H5D_xfer_t *dxpl=NULL; + hid_t driver_id; /* VFL driver ID */ + void *driver_info; /* VFL driver info */ + void *tmp_driver_info; /* Temporary VFL driver info */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER(H5Pset_driver, FAIL); - H5TRACE3("e","iix",plist_id,driver_id,driver_info); + H5TRACE3("e","iix",plist_id,new_driver_id,new_driver_info); - if (H5I_VFL!=H5I_get_type(driver_id) || - NULL==H5I_object(driver_id)) { + if (H5I_VFL!=H5I_get_type(new_driver_id) || NULL==H5I_object(new_driver_id)) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID"); - } if (H5P_FILE_ACCESS==H5P_get_class(plist_id)) { if (NULL==(fapl=H5I_object(plist_id))) { @@ -1675,32 +1919,50 @@ H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info) H5I_dec_ref(fapl->driver_id); /* Add new driver */ - H5I_inc_ref(driver_id); - fapl->driver_id = driver_id; - fapl->driver_info = H5FD_fapl_copy(driver_id, driver_info); + H5I_inc_ref(new_driver_id); + fapl->driver_id = new_driver_id; + fapl->driver_info = H5FD_fapl_copy(new_driver_id, new_driver_info); - } else if (H5P_DATASET_XFER==H5P_get_class(plist_id)) { - if (NULL==(dxpl=H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - } + } else if (H5I_GENPROP_LST==H5I_get_type(plist_id)) { + /* Get the current driver information */ + if(H5P_get(plist_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + if(H5P_get(plist_id, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); /* Remove old driver */ - assert(dxpl->driver_id>=0); - H5FD_dxpl_free(dxpl->driver_id, dxpl->driver_info); - H5I_dec_ref(dxpl->driver_id); + + /* Double-check value... */ + assert(driver_id>=0); + + /* Free any driver information stored */ + H5FD_dxpl_free(driver_id, driver_info); + + /* Decrement reference count for old driver */ + H5I_dec_ref(driver_id); /* Add new driver */ - H5I_inc_ref(driver_id); - dxpl->driver_id = driver_id; - dxpl->driver_info = H5FD_dxpl_copy(driver_id, driver_info); + + /* Increment reference count for new driver */ + 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) + HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "Can't copy VFL driver"); + + /* Set the driver info for the property list */ + if(H5P_set(plist_id, 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_id, H5D_XFER_VFL_INFO_NAME, &tmp_driver_info)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver info"); } else { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list"); } - FUNC_LEAVE(SUCCEED); +done: + FUNC_LEAVE(ret_value); } @@ -1778,20 +2040,17 @@ hid_t H5P_get_driver(hid_t plist_id) { H5F_access_t *fapl=NULL; - H5D_xfer_t *dxpl=NULL; hid_t ret_value=-1; FUNC_ENTER (H5P_get_driver, FAIL); H5TRACE1("i","i",plist_id); - if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && - (fapl=H5I_object(plist_id))) { + if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && (fapl=H5I_object(plist_id))) { ret_value = fapl->driver_id; - - } else if (H5P_DATASET_XFER==H5P_get_class(plist_id) && - (dxpl=H5I_object(plist_id))) { - ret_value = dxpl->driver_id; - + } else if (H5I_GENPROP_LST==H5I_get_type(plist_id)) { + /* Get the current driver ID */ + if(H5P_get(plist_id, H5D_XFER_VFL_ID_NAME, &ret_value)<0) + HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); } else { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list"); @@ -1802,6 +2061,7 @@ H5P_get_driver(hid_t plist_id) FUNC_LEAVE(ret_value); } + /*------------------------------------------------------------------------- * Function: H5Pget_driver_info @@ -1828,19 +2088,16 @@ void * H5Pget_driver_info(hid_t plist_id) { H5F_access_t *fapl=NULL; - H5D_xfer_t *dxpl=NULL; void *ret_value=NULL; FUNC_ENTER(H5Pget_driver_info, NULL); - if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && - (fapl=H5I_object(plist_id))) { + if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && (fapl=H5I_object(plist_id))) { ret_value = fapl->driver_info; - - } else if (H5P_DATASET_XFER==H5P_get_class(plist_id) && - (dxpl=H5I_object(plist_id))) { - ret_value = dxpl->driver_info; - + } else if (H5I_GENPROP_LST==H5I_get_type(plist_id)) { + /* Get the current driver info */ + if(H5P_get(plist_id, H5D_XFER_VFL_INFO_NAME, &ret_value)<0) + HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, NULL, "Can't retrieve VFL driver ID"); } else { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access or data transfer property list"); @@ -1984,26 +2241,22 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) { - H5D_xfer_t *plist = NULL; - FUNC_ENTER (H5Pset_buffer, FAIL); H5TRACE4("e","izxx",plist_id,size,tconv,bkg); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } - if (size<=0) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, - "buffer size must not be zero"); - } + if (H5I_GENPROP_LST != H5I_get_type (plist_id)) + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); + if (size<=0) + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero"); /* Update property list */ - plist->buf_size = size; - plist->tconv_buf = tconv; - plist->bkg_buf = bkg; + if(H5P_set(plist_id, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0) + HRETURN_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size"); + if(H5P_set(plist_id, H5D_XFER_TCONV_BUF_NAME, &tconv)<0) + HRETURN_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer"); + if(H5P_set(plist_id, H5D_XFER_BKGR_BUF_NAME, &bkg)<0) + HRETURN_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer"); FUNC_LEAVE (SUCCEED); } @@ -2028,25 +2281,36 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) hsize_t H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) { - H5D_xfer_t *plist = NULL; - + size_t size; /* Type conversion buffer size */ + size_t ret_value=0; /* Type conversion buffer size */ + FUNC_ENTER (H5Pget_buffer, 0); H5TRACE3("h","ixx",plist_id,tconv,bkg); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, 0, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, 0, "not a dataset transfer property list"); /* Return values */ - if (tconv) - *tconv = plist->tconv_buf; - if (bkg) - *bkg = plist->bkg_buf; + if (tconv) { + if(H5P_get(plist_id, H5D_XFER_TCONV_BUF_NAME, tconv)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer"); + } /* end if */ + if (bkg) { + if(H5P_get(plist_id, H5D_XFER_BKGR_BUF_NAME, bkg)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer"); + } /* end if */ - FUNC_LEAVE (plist->buf_size); + /* Get the size */ + if(H5P_set(plist_id, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size"); + + /* Set the return value */ + ret_value=size; + +done: + FUNC_LEAVE(ret_value); } @@ -2076,23 +2340,25 @@ H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) herr_t H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit) { - H5D_xfer_t *plist = NULL; - + herr_t ret_value=SUCCEED; + FUNC_ENTER (H5Pset_hyper_cache, FAIL); H5TRACE3("e","iIuIu",plist_id,cache,limit); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Update property list */ - plist->cache_hyper = (cache>0) ? 1 : 0; - plist->block_limit = limit; + cache = (cache>0) ? 1 : 0; + if (H5P_set(plist_id,H5D_XFER_HYPER_CACHE_NAME,&cache)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value"); + if (H5P_set(plist_id,H5D_XFER_HYPER_CACHE_LIM_NAME,&limit)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value"); - FUNC_LEAVE (SUCCEED); +done: + FUNC_LEAVE (ret_value); } @@ -2114,23 +2380,23 @@ herr_t H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/, unsigned *limit/*out*/) { - H5D_xfer_t *plist = NULL; - FUNC_ENTER (H5Pget_hyper_cache, FAIL); H5TRACE3("e","ixx",plist_id,cache,limit); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); /* Return values */ - if (cache) - *cache = plist->cache_hyper; - if (limit) - *limit = plist->block_limit; + if (cache) { + if (H5P_get(plist_id,H5D_XFER_HYPER_CACHE_NAME,cache)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + } /* end if */ + if (limit) { + if (H5P_get(plist_id,H5D_XFER_HYPER_CACHE_LIM_NAME,limit)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + } /* end if */ FUNC_LEAVE (SUCCEED); } @@ -2157,20 +2423,20 @@ H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/, herr_t H5Pset_preserve(hid_t plist_id, hbool_t status) { - H5D_xfer_t *plist = NULL; + H5T_bkg_t need_bkg; /* Value for background buffer type */ FUNC_ENTER (H5Pset_preserve, FAIL); H5TRACE2("e","ib",plist_id,status); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); /* Update property list */ - plist->need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO; + need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO; + if (H5P_set(plist_id,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); FUNC_LEAVE (SUCCEED); } @@ -2195,19 +2461,21 @@ H5Pset_preserve(hid_t plist_id, hbool_t status) int H5Pget_preserve(hid_t plist_id) { - H5D_xfer_t *plist = NULL; + H5T_bkg_t need_bkg; /* Return value */ FUNC_ENTER (H5Pget_preserve, FAIL); H5TRACE1("Is","i",plist_id); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); - } - FUNC_LEAVE (plist->need_bkg?TRUE:FALSE); + if (H5P_get(plist_id,H5D_XFER_BKGR_BUF_NAME,&need_bkg)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + + FUNC_LEAVE (need_bkg ? TRUE : FALSE); } @@ -2514,25 +2782,27 @@ herr_t H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/, double *right/*out*/) { - H5D_xfer_t *plist = NULL; + double btree_split_ratio[3]; /* B-tree node split ratios */ FUNC_ENTER(H5Pget_btree_ratios, FAIL); H5TRACE4("e","ixxx",plist_id,left,middle,right); /* Check arguments */ - if (H5P_DATASET_XFER!=H5P_get_class(plist_id) || - NULL==(plist=H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); + + /* Get the split ratios */ + if (H5P_get(plist_id,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); /* Get values */ if (left) - *left = plist->split_ratios[0]; + *left = btree_split_ratio[0]; if (middle) - *middle = plist->split_ratios[1]; + *middle = btree_split_ratio[1]; if (right) - *right = plist->split_ratios[2]; + *right = btree_split_ratio[2]; FUNC_LEAVE(SUCCEED); } @@ -2564,27 +2834,27 @@ herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) { - H5D_xfer_t *plist = NULL; + double split_ratio[3]; /* B-tree node split ratios */ - FUNC_ENTER(H5Pget_btree_ratios, FAIL); + FUNC_ENTER(H5Pset_btree_ratios, FAIL); H5TRACE4("e","iddd",plist_id,left,middle,right); /* Check arguments */ - if (H5P_DATASET_XFER!=H5P_get_class(plist_id) || - NULL==(plist=H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 || - right<0.0 || right>1.0) { - HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "split ratio must satisfy 0.0<=X<=1.0"); - } + right<0.0 || right>1.0) + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0"); /* Set values */ - plist->split_ratios[0] = left; - plist->split_ratios[1] = middle; - plist->split_ratios[2] = right; + split_ratio[0] = left; + split_ratio[1] = middle; + split_ratio[2] = right; + + /* Set the split ratios */ + if (H5P_set(plist_id,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); FUNC_LEAVE(SUCCEED); } @@ -2871,23 +3141,23 @@ herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info) { - H5D_xfer_t *plist = NULL; - FUNC_ENTER(H5Pset_vlen_mem_manager, FAIL); H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info); /* Check arguments */ - if (H5P_DATASET_XFER!=H5P_get_class(plist_id) || - NULL==(plist=H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); /* Update property list */ - plist->vlen_alloc = alloc_func; - plist->alloc_info = alloc_info; - plist->vlen_free = free_func; - plist->free_info = free_info; + if (H5P_set(plist_id,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); + if (H5P_set(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); + if (H5P_set(plist_id,H5D_XFER_VLEN_FREE_NAME,&free_func)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); + if (H5P_set(plist_id,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); FUNC_LEAVE (SUCCEED); } @@ -2913,26 +3183,30 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/, H5MM_free_t *free_func/*out*/, void **free_info/*out*/) { - H5D_xfer_t *plist = NULL; - FUNC_ENTER(H5Pget_vlen_mem_manager, FAIL); H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info); /* Check arguments */ - if (H5P_DATASET_XFER!=H5P_get_class(plist_id) || - NULL==(plist=H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); - if(alloc_func!=NULL) - *alloc_func= plist->vlen_alloc; - if(alloc_info!=NULL) - *alloc_info= plist->alloc_info; - if(free_func!=NULL) - *free_func= plist->vlen_free; - if(free_info!=NULL) - *free_info= plist->free_info; + if(alloc_func!=NULL) { + if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + } /* end if */ + if(alloc_info!=NULL) { + if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + } /* end if */ + if(free_func!=NULL) { + if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_NAME,free_func)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + } /* end if */ + if(free_info!=NULL) { + if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + } /* end if */ FUNC_LEAVE (SUCCEED); } @@ -3132,25 +3406,20 @@ H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size/*out*/) herr_t H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size) { - H5D_xfer_t *plist = NULL; - FUNC_ENTER (H5Pset_hyper_vector_size, FAIL); H5TRACE2("e","iz",plist_id,vector_size); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); - if (vector_size<1) { - HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "vector size too small"); - } + if (vector_size<1) + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small"); /* Update property list */ - plist->vector_size = vector_size; + if (H5P_set(plist_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); FUNC_LEAVE (SUCCEED); } /* end H5Pset_hyper_vector_size() */ @@ -3173,21 +3442,19 @@ H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size) herr_t H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/) { - H5D_xfer_t *plist = NULL; - FUNC_ENTER (H5Pget_hyper_vector_size, FAIL); H5TRACE2("e","ix",plist_id,vector_size); /* Check arguments */ - if (H5P_DATASET_XFER != H5P_get_class (plist_id) || - NULL == (plist = H5I_object (plist_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, - "not a dataset transfer property list"); - } + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || + TRUE!=H5Pisa_class(plist_id,H5P_DATASET_XFER_NEW)) + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); /* Return values */ - if (vector_size) - *vector_size = plist->vector_size; + if (vector_size) { + if (H5P_get(plist_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + } /* end if */ FUNC_LEAVE (SUCCEED); } /* end H5Pget_hyper_vector_size() */ @@ -3233,6 +3500,7 @@ H5P_copy_prop(H5P_genprop_t *oprop) /* Duplicate current value, if it exists */ if(oprop->value!=NULL) { + assert(prop->size>0); if (NULL==(prop->value = H5MM_malloc (prop->size))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); HDmemcpy(prop->value,oprop->value,prop->size); @@ -3240,6 +3508,7 @@ H5P_copy_prop(H5P_genprop_t *oprop) /* Duplicate default value, if it exists */ if(oprop->def_value!=NULL) { + assert(prop->size>0); if (NULL==(prop->def_value = H5MM_malloc (prop->size))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); HDmemcpy(prop->def_value,oprop->def_value,prop->size); @@ -3286,6 +3555,7 @@ done: H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback + H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -3302,7 +3572,7 @@ static H5P_genprop_t * H5P_create_prop(const char *name, size_t size, void *def_value, void *value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, - H5P_prp_close_func_t prp_close) + H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) { H5P_genprop_t *prop=NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value=NULL; /* Return value */ @@ -3344,6 +3614,7 @@ H5P_create_prop(const char *name, size_t size, void *def_value, void *value, prop->set=prp_set; prop->get=prp_get; prop->del=prp_delete; + prop->copy=prp_copy; prop->close=prp_close; /* Reset the link to the next property */ @@ -3442,7 +3713,7 @@ H5P_find_prop(H5P_genprop_t *hash[], uintn hashsize, const char *name) uintn loc; /* Hash table location */ uintn xor_val; /* XOR'ed value of the name to look for */ - FUNC_ENTER (H5P_add_prop, NULL); + FUNC_ENTER (H5P_find_prop, NULL); assert(hash); assert(hashsize>0); @@ -3460,6 +3731,9 @@ H5P_find_prop(H5P_genprop_t *hash[], uintn hashsize, const char *name) /* Check for name matching */ if(ret_value->xor_val==xor_val && HDstrcmp(ret_value->name,name)==0) break; + + /* Advance to the next property */ + ret_value=ret_value->next; } /* end while */ FUNC_LEAVE (ret_value); @@ -3551,7 +3825,7 @@ H5P_free_all_prop(H5P_genprop_t *hash[], uintn hashsize, uintn make_cb) /* Call the close callback and ignore the return value, there's nothing we can do about it */ if(make_cb && tprop->close!=NULL) - (tprop->close)(tprop->name,tprop->value); + (tprop->close)(tprop->name,tprop->size,tprop->value); /* Free the property, ignoring return value, nothing we can do */ H5P_free_prop(tprop); @@ -3666,6 +3940,10 @@ done: property list in this class is created. void *create_data; IN: Pointer to user data to pass along to class creation callback. + H5P_cls_copy_func_t; IN: The callback function to call when each + property list in this class is copied. + void *copy_data; IN: Pointer to user data to pass along to class + copy callback. H5P_cls_close_func_t; IN: The callback function to call when each property list in this class is closed. void *close_data; IN: Pointer to user data to pass along to class @@ -3683,6 +3961,7 @@ done: static H5P_genclass_t * H5P_create_class(H5P_genclass_t *par_class, const char *name, uintn hashsize, uintn internal, H5P_cls_create_func_t cls_create, void *create_data, + H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data ) { @@ -3717,6 +3996,8 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, uintn hashsize, ui /* Set callback functions and pass-along data */ pclass->create_func = cls_create; pclass->create_data = create_data; + pclass->copy_func = cls_copy; + pclass->copy_data = copy_data; pclass->close_func = cls_close; pclass->close_data = close_data; @@ -3755,6 +4036,11 @@ done: created. void *create_data; IN: Pointer to user data to pass along to class creation callback. + H5P_cls_copy_func_t cls_copy; IN: The callback function to call + when each property list in this class is + copied. + void *copy_data; IN: Pointer to user data to pass along to class + copy callback. H5P_cls_close_func_t cls_close; IN: The callback function to call when each property list in this class is closed. @@ -3772,12 +4058,13 @@ done: hid_t H5Pcreate_class(hid_t parent, const char *name, unsigned hashsize, H5P_cls_create_func_t cls_create, void *create_data, + H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data ) { H5P_genclass_t *par_class = NULL; /* Pointer to the parent class */ H5P_genclass_t *pclass = NULL; /* Property list class created */ - hid_t ret_value = FAIL; /* Return value */ + hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER(H5Pcreate_class, FAIL); @@ -3788,7 +4075,9 @@ H5Pcreate_class(hid_t parent, const char *name, unsigned hashsize, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name"); if (hashsize==0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hashsize too small"); - if ((create_data!=NULL && cls_create==NULL) || (close_data!=NULL && cls_close==NULL)) + if ((create_data!=NULL && cls_create==NULL) + || (copy_data!=NULL && cls_copy==NULL) + || (close_data!=NULL && cls_close==NULL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data specified, but no callback provided"); /* Get the pointer to the parent class */ @@ -3798,7 +4087,7 @@ H5Pcreate_class(hid_t parent, const char *name, unsigned hashsize, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class"); /* Create the new property list class */ - if (NULL==(pclass=H5P_create_class(par_class, name, hashsize, 0, cls_create, create_data, cls_close, close_data))) + if (NULL==(pclass=H5P_create_class(par_class, name, hashsize, 0, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class"); /* Get an atom for the class */ @@ -3897,7 +4186,7 @@ static H5P_genplist_t *H5P_create_list(H5P_genclass_t *pclass) /* Call property creation callback, if it exists */ if(pcopy->create) { - if((pcopy->create)(pcopy->name,pcopy->value)<0) { + if((pcopy->create)(pcopy->name,pcopy->size,pcopy->value)<0) { H5P_free_prop(pcopy); HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, NULL,"Can't initialize property"); } /* end if */ @@ -4027,6 +4316,7 @@ done: H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback + H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -4099,6 +4389,17 @@ done: 'delete' routine returns a negative value, the property list deletion routine returns an error value but the property is still deleted. + The 'copy' callback is called when a property list with this + property is copied. H5P_prp_copy_func_t is defined as: + typedef herr_t (*H5P_prp_copy_func_t)(const char *name, void *value); + where the parameters to the callback function are: + const char *name; IN: The name of the property being closed. + void *value; IN: The value of the property being closed. + The 'copy' routine may modify the value to be copied and those changes will be + stored as the value of the property. If the 'copy' routine returns a + negative value, the new property value is not copied into the property and + the property list copy routine returns an error value. + The 'close' callback is called when a property list with this property is being destroyed. H5P_prp_close_func_t is defined as: typedef herr_t (*H5P_prp_close_func_t)(const char *name, void *value); @@ -4129,9 +4430,10 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, +herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_close_func_t prp_close) + H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) { H5P_genclass_t *new_class; /* New class pointer */ H5P_genprop_t *tmp_prop; /* Temporary property pointer */ @@ -4156,6 +4458,7 @@ static herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size if(pclass->plists>0 || pclass->classes>0) { if((new_class=H5P_create_class(pclass->parent,pclass->name,pclass->hashsize, (uintn)pclass->internal,pclass->create_func,pclass->create_data, + pclass->copy_func,pclass->copy_data, pclass->close_func,pclass->close_data))==NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class"); @@ -4181,7 +4484,7 @@ static herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size } /* end if */ /* Create property object from parameters */ - if((new_prop=H5P_create_prop(name,size,def_value,NULL,prp_create,prp_set,prp_get,prp_delete,prp_close))==NULL) + if((new_prop=H5P_create_prop(name,size,def_value,NULL,prp_create,prp_set,prp_get,prp_delete,prp_copy,prp_close))==NULL) HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); /* Insert property into property list class */ @@ -4227,6 +4530,7 @@ done: H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback + H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -4299,6 +4603,17 @@ done: 'delete' routine returns a negative value, the property list deletion routine returns an error value but the property is still deleted. + The 'copy' callback is called when a property list with this + property is copied. H5P_prp_copy_func_t is defined as: + typedef herr_t (*H5P_prp_copy_func_t)(const char *name, void *value); + where the parameters to the callback function are: + const char *name; IN: The name of the property being closed. + void *value; IN: The value of the property being closed. + The 'copy' routine may modify the value to be copied and those changes will be + stored as the value of the property. If the 'copy' routine returns a + negative value, the new property value is not copied into the property and + the property list copy routine returns an error value. + The 'close' callback is called when a property list with this property is being destroyed. H5P_prp_close_func_t is defined as: typedef herr_t (*H5P_prp_close_func_t)(const char *name, void *value); @@ -4331,7 +4646,8 @@ done: --------------------------------------------------------------------------*/ herr_t H5Pregister(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_close_func_t prp_close) + H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) { H5P_genclass_t *pclass; /* Property list class to modify */ herr_t ret_value=FAIL; /* return value */ @@ -4347,7 +4663,7 @@ herr_t H5Pregister(hid_t cls_id, const char *name, size_t size, void *def_value, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); /* Create the new property list class */ - if ((ret_value=H5P_register(pclass,name,size,def_value,prp_create,prp_set,prp_get,prp_delete,prp_close))<0) + if ((ret_value=H5P_register(pclass,name,size,def_value,prp_create,prp_set,prp_get,prp_delete,prp_copy,prp_close))<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); done: @@ -4463,7 +4779,8 @@ done: --------------------------------------------------------------------------*/ static herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_delete, H5P_prp_close_func_t prp_close) + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close) { H5P_genprop_t *new_prop=NULL; /* Temporary property pointer */ herr_t ret_value=FAIL; /* return value */ @@ -4479,7 +4796,7 @@ static herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); /* Create property object from parameters */ - if((new_prop=H5P_create_prop(name,size,NULL,value,NULL,prp_set,prp_get,prp_delete,prp_close))==NULL) + if((new_prop=H5P_create_prop(name,size,NULL,value,NULL,prp_set,prp_get,prp_delete,prp_copy,prp_close))==NULL) HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); /* Insert property into property list class */ @@ -4615,7 +4932,8 @@ done: --------------------------------------------------------------------------*/ herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_delete, H5P_prp_close_func_t prp_close) + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close) { H5P_genplist_t *plist; /* Property list to modify */ herr_t ret_value=FAIL; /* return value */ @@ -4631,7 +4949,7 @@ herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); /* Create the new property list class */ - if ((ret_value=H5P_insert(plist,name,size,value,prp_set,prp_get,prp_delete,prp_close))<0) + if ((ret_value=H5P_insert(plist,name,size,value,prp_set,prp_get,prp_delete,prp_copy,prp_close))<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); done: @@ -4670,7 +4988,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_set(hid_t plist_id, const char *name, void *value) +herr_t H5P_set(hid_t plist_id, const char *name, void *value) { H5P_genplist_t *plist; /* Property list to modify */ H5P_genprop_t *prop; /* Temporary property pointer */ @@ -4703,7 +5021,7 @@ static herr_t H5P_set(hid_t plist_id, const char *name, void *value) HDmemcpy(tmp_value,value,prop->size); /* Call user's callback */ - if((*(prop->set))(plist_id,name,tmp_value)<0) + if((*(prop->set))(plist_id,name,prop->size,tmp_value)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); /* Copy new [possibly unchanged] value into property value */ @@ -5355,6 +5673,16 @@ static intn H5P_cmp_prop(H5P_genprop_t *prop1, H5P_genprop_t *prop2) if(prop1->get!=NULL && prop2->get==NULL) HGOTO_DONE(1); if(prop1->get!=prop2->get) HGOTO_DONE(-1); + /* Check if they both have the same 'delete' callback */ + if(prop1->del==NULL && prop2->del!=NULL) HGOTO_DONE(-1); + if(prop1->del!=NULL && prop2->del==NULL) HGOTO_DONE(1); + if(prop1->del!=prop2->del) HGOTO_DONE(-1); + + /* Check if they both have the same 'copy' callback */ + if(prop1->copy==NULL && prop2->copy!=NULL) HGOTO_DONE(-1); + if(prop1->copy!=NULL && prop2->copy==NULL) HGOTO_DONE(1); + if(prop1->copy!=prop2->copy) HGOTO_DONE(-1); + /* Check if they both have the same 'close' callback */ if(prop1->close==NULL && prop2->close!=NULL) HGOTO_DONE(-1); if(prop1->close!=NULL && prop2->close==NULL) HGOTO_DONE(1); @@ -5672,7 +6000,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hid_t H5Pisa_class(hid_t plist_id, hid_t pclass_id) +htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id) { H5P_genplist_t *plist; /* Property list to query */ H5P_genclass_t *pclass=NULL; /* Property list class */ @@ -6020,12 +6348,332 @@ done: /*-------------------------------------------------------------------------- NAME + H5P_peek_uintn + PURPOSE + Internal routine to quickly retrieve the value of a property in a property list. + USAGE + intn H5P_peek_uintn(plist_id, name) + hid_t plist_id; IN: Property list to check + const char *name; IN: Name of property to query + RETURNS + Directly returns the value of the property in the list + DESCRIPTION + This function directly returns the value of a property in a property + list. Because this function is only able to just copy a particular property + value to the return value, there is no way to check for errors. We attempt + to make certain that bad things don't happen by validating that the size of + the property is the same as the size of the return type, but that can't + catch all errors. + This function does call the user's 'get' callback routine still. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + No error checking! + Use with caution! + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +uintn H5P_peek_uintn(hid_t plist_id, const char *name) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5P_genprop_t *prop; /* Temporary property pointer */ + uintn ret_value; /* return value */ + + FUNC_ENTER (H5P_peek_uintn, UFAIL); + + assert(name); + + /* Check arguments. */ + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id))) + assert(0 && "not a property list"); + + /* Find property */ + if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL) + assert(0 && "property doesn't exist"); + + /* Check for property size >0 */ + if(prop->size==0) + assert(0 && "property has zero size"); + + /* Check for property size not the same as the return type */ + if(prop->size!=sizeof(uintn)) + assert(0 && "property has incorrect size"); + + /* Make a copy of the value and pass to 'get' callback */ + if(prop->get!=NULL) { + void *tmp_value; /* Temporary value for property */ + + /* Make a copy of the current value, in case the callback fails */ + if (NULL==(tmp_value=H5MM_malloc(prop->size))) + assert(0 && "memory allocation failed temporary property value"); + HDmemcpy(tmp_value,prop->value,prop->size); + + /* Call user's callback */ + if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0) + assert(0 && "can't get property value"); + + /* Copy new [possibly unchanged] value into return value */ + HDmemcpy(&ret_value,tmp_value,sizeof(uintn)); + + /* Free the temporary value buffer */ + H5MM_xfree(tmp_value); + } /* end if */ + /* No 'get' callback, just copy value */ + else + HDmemcpy(&ret_value,prop->value,sizeof(uintn)); + + FUNC_LEAVE (ret_value); +} /* H5P_peek_uintn() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_peek_hid_t + PURPOSE + Internal routine to quickly retrieve the value of a property in a property list. + USAGE + hid_t H5P_peek_hid_t(plist_id, name) + hid_t plist_id; IN: Property list to check + const char *name; IN: Name of property to query + RETURNS + Directly returns the value of the property in the list + DESCRIPTION + This function directly returns the value of a property in a property + list. Because this function is only able to just copy a particular property + value to the return value, there is no way to check for errors. We attempt + to make certain that bad things don't happen by validating that the size of + the property is the same as the size of the return type, but that can't + catch all errors. + This function does call the user's 'get' callback routine still. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + No error checking! + Use with caution! + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hid_t H5P_peek_hid_t(hid_t plist_id, const char *name) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5P_genprop_t *prop; /* Temporary property pointer */ + hid_t ret_value; /* return value */ + + FUNC_ENTER (H5P_peek_hid_t, FAIL); + + assert(name); + + /* Check arguments. */ + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id))) + assert(0 && "not a property list"); + + /* Find property */ + if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL) + assert(0 && "property doesn't exist"); + + /* Check for property size >0 */ + if(prop->size==0) + assert(0 && "property has zero size"); + + /* Check for property size not the same as the return type */ + if(prop->size!=sizeof(hid_t)) + assert(0 && "property has incorrect size"); + + /* Make a copy of the value and pass to 'get' callback */ + if(prop->get!=NULL) { + void *tmp_value; /* Temporary value for property */ + + /* Make a copy of the current value, in case the callback fails */ + if (NULL==(tmp_value=H5MM_malloc(prop->size))) + assert(0 && "memory allocation failed temporary property value"); + HDmemcpy(tmp_value,prop->value,prop->size); + + /* Call user's callback */ + if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0) + assert(0 && "can't get property value"); + + /* Copy new [possibly unchanged] value into return value */ + HDmemcpy(&ret_value,tmp_value,sizeof(hid_t)); + + /* Free the temporary value buffer */ + H5MM_xfree(tmp_value); + } /* end if */ + /* No 'get' callback, just copy value */ + else + HDmemcpy(&ret_value,prop->value,sizeof(hid_t)); + + FUNC_LEAVE (ret_value); +} /* H5P_peek_hid_t() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_peek_voidp + PURPOSE + Internal routine to quickly retrieve the value of a property in a property list. + USAGE + void *H5P_peek_voidp(plist_id, name) + hid_t plist_id; IN: Property list to check + const char *name; IN: Name of property to query + RETURNS + Directly returns the value of the property in the list + DESCRIPTION + This function directly returns the value of a property in a property + list. Because this function is only able to just copy a particular property + value to the return value, there is no way to check for errors. We attempt + to make certain that bad things don't happen by validating that the size of + the property is the same as the size of the return type, but that can't + catch all errors. + This function does call the user's 'get' callback routine still. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + No error checking! + Use with caution! + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +void *H5P_peek_voidp(hid_t plist_id, const char *name) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5P_genprop_t *prop; /* Temporary property pointer */ + void * ret_value; /* return value */ + + FUNC_ENTER (H5P_peek_hid_t, NULL); + + assert(name); + + /* Check arguments. */ + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id))) + assert(0 && "not a property list"); + + /* Find property */ + if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL) + assert(0 && "property doesn't exist"); + + /* Check for property size >0 */ + if(prop->size==0) + assert(0 && "property has zero size"); + + /* Check for property size not the same as the return type */ + if(prop->size!=sizeof(void *)) + assert(0 && "property has incorrect size"); + + /* Make a copy of the value and pass to 'get' callback */ + if(prop->get!=NULL) { + void *tmp_value; /* Temporary value for property */ + + /* Make a copy of the current value, in case the callback fails */ + if (NULL==(tmp_value=H5MM_malloc(prop->size))) + assert(0 && "memory allocation failed temporary property value"); + HDmemcpy(tmp_value,prop->value,prop->size); + + /* Call user's callback */ + if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0) + assert(0 && "can't get property value"); + + /* Copy new [possibly unchanged] value into return value */ + HDmemcpy(&ret_value,tmp_value,sizeof(void *)); + + /* Free the temporary value buffer */ + H5MM_xfree(tmp_value); + } /* end if */ + /* No 'get' callback, just copy value */ + else + HDmemcpy(&ret_value,prop->value,sizeof(void *)); + + FUNC_LEAVE (ret_value); +} /* H5P_peek_voidp() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_peek_hsize_t + PURPOSE + Internal routine to quickly retrieve the value of a property in a property list. + USAGE + hsize_t H5P_peek_hsize_t(plist_id, name) + hid_t plist_id; IN: Property list to check + const char *name; IN: Name of property to query + RETURNS + Directly returns the value of the property in the list + DESCRIPTION + This function directly returns the value of a property in a property + list. Because this function is only able to just copy a particular property + value to the return value, there is no way to check for errors. We attempt + to make certain that bad things don't happen by validating that the size of + the property is the same as the size of the return type, but that can't + catch all errors. + This function does call the user's 'get' callback routine still. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + No error checking! + Use with caution! + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hsize_t H5P_peek_hsize_t(hid_t plist_id, const char *name) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5P_genprop_t *prop; /* Temporary property pointer */ + hsize_t ret_value; /* return value */ + + FUNC_ENTER (H5P_peek_hid_t, UFAIL); + + assert(name); + + /* Check arguments. */ + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id))) + assert(0 && "not a property list"); + + /* Find property */ + if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL) + assert(0 && "property doesn't exist"); + + /* Check for property size >0 */ + if(prop->size==0) + assert(0 && "property has zero size"); + + /* Check for property size not the same as the return type */ + if(prop->size!=sizeof(hsize_t)) + assert(0 && "property has incorrect size"); + + /* Make a copy of the value and pass to 'get' callback */ + if(prop->get!=NULL) { + void *tmp_value; /* Temporary value for property */ + + /* Make a copy of the current value, in case the callback fails */ + if (NULL==(tmp_value=H5MM_malloc(prop->size))) + assert(0 && "memory allocation failed temporary property value"); + HDmemcpy(tmp_value,prop->value,prop->size); + + /* Call user's callback */ + if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0) + assert(0 && "can't get property value"); + + /* Copy new [possibly unchanged] value into return value */ + HDmemcpy(&ret_value,tmp_value,sizeof(hsize_t)); + + /* Free the temporary value buffer */ + H5MM_xfree(tmp_value); + } /* end if */ + /* No 'get' callback, just copy value */ + else + HDmemcpy(&ret_value,prop->value,sizeof(hsize_t)); + + FUNC_LEAVE (ret_value); +} /* H5P_peek_hsize_t() */ + + +/*-------------------------------------------------------------------------- + NAME H5P_get PURPOSE Internal routine to query the value of a property in a property list. USAGE herr_t H5P_get(plist, name, value) - H5P_genplist_t *plist; IN: Property list to check + hid_t plist_id; IN: Property list to check const char *name; IN: Name of property to query void *value; OUT: Pointer to the buffer for the property value RETURNS @@ -6046,7 +6694,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_get(hid_t plist_id, const char *name, void *value) +herr_t H5P_get(hid_t plist_id, const char *name, void *value) { H5P_genplist_t *plist; /* Property list pointer */ H5P_genprop_t *prop; /* Temporary property pointer */ @@ -6079,7 +6727,7 @@ static herr_t H5P_get(hid_t plist_id, const char *name, void *value) HDmemcpy(tmp_value,prop->value,prop->size); /* Call user's callback */ - if((*(prop->get))(plist_id,name,tmp_value)<0) + if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't get property value"); /* Copy new [possibly unchanged] value into return value */ @@ -6144,7 +6792,7 @@ herr_t H5Pget(hid_t plist_id, const char *name, void * value) /* Create the new property list class */ if ((ret_value=H5P_get(plist_id,name,value))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to query property value"); done: FUNC_LEAVE (ret_value); @@ -6196,7 +6844,7 @@ static herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name /* Pass value to 'close' callback, if it exists */ if(prop->del!=NULL) { /* Call user's callback */ - if((*(prop->del))(plist_id,name,prop->value)<0) + if((*(prop->del))(plist_id,name,prop->size,prop->value)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value"); } /* end if */ @@ -6491,7 +7139,7 @@ herr_t H5Pclose_list(hid_t plist_id) FUNC_ENTER (H5Pclose_list, FAIL); /* Check arguments. */ - if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_remove(plist_id))) + if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Make call to property list class close callback, if needed */ @@ -6504,6 +7152,10 @@ herr_t H5Pclose_list(hid_t plist_id) if ((ret_value=H5P_close_list(plist)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close"); + /* Remove the property list from the ID manager now */ + if (NULL == H5I_remove(plist_id)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTDELETE, FAIL, "can't delete property list"); + done: FUNC_LEAVE (ret_value); } /* H5Pclose_list() */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 906826e..93c8beb 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -50,6 +50,7 @@ typedef struct H5P_genprop_tag { H5P_prp_set_func_t set; /* Function to call when a property value is set */ H5P_prp_get_func_t get; /* Function to call when a property value is retrieved */ H5P_prp_delete_func_t del; /* Function to call when a property is deleted */ + H5P_prp_copy_func_t copy; /* Function to call when a property is copied */ H5P_prp_close_func_t close; /* Function to call when a property is closed */ struct H5P_genprop_tag *next; /* Pointer to the next property in this list */ @@ -70,8 +71,10 @@ typedef struct H5P_genclass_tag { /* Callback function pointers & info */ H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ void *create_data; /* Pointer to user data to pass along to create callback */ + H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ + void *copy_data; /* Pointer to user data to pass along to copy callback */ H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ - void *close_data; /* Pointer to user data to pass along to close callback */ + void *close_data; /* Pointer to user data to pass along to close callback */ H5P_genprop_t *props[1]; /* Hash table of pointers to properties in the class */ } H5P_genclass_t; @@ -93,7 +96,6 @@ typedef struct { H5F_create_t fcreate; /* File creation properties */ H5F_access_t faccess; /* File access properties */ H5D_create_t dcreate; /* Dataset creation properties */ - H5D_xfer_t dxfer; /* Data transfer properties */ H5F_mprop_t mount; /* Mounting properties */ } u; H5P_class_t cls; /* Property list class */ @@ -104,7 +106,19 @@ __DLL__ herr_t H5P_init(void); __DLL__ hid_t H5P_create(H5P_class_t type, H5P_t *plist); __DLL__ void *H5P_copy(H5P_class_t type, const void *src); __DLL__ herr_t H5P_close(void *plist); +__DLL__ herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, + void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, + H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); +__DLL__ herr_t H5P_get(hid_t plist_id, const char *name, void *value); +__DLL__ herr_t H5P_set(hid_t plist_id, const char *name, void *value); __DLL__ H5P_class_t H5P_get_class(hid_t tid); __DLL__ hid_t H5P_get_driver(hid_t plist_id); +/* Private functions to "peek" at properties of a certain type */ +__DLL__ uintn H5P_peek_uintn(hid_t plist_id, const char *name); +__DLL__ hid_t H5P_peek_hid_t(hid_t plist_id, const char *name); +__DLL__ void *H5P_peek_voidp(hid_t plist_id, const char *name); +__DLL__ hsize_t H5P_peek_hsize_t(hid_t plist_id, const char *name); + #endif diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index ee925dc..ded0a0b 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -57,14 +57,16 @@ typedef enum H5P_class_t { /* Define property list class callback function pointer types */ typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data); +typedef herr_t (*H5P_cls_copy_func_t)(hid_t prop_id, void *copy_data); typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data); /* Define property list callback function pointer types */ -typedef herr_t (*H5P_prp_create_func_t)(const char *name, void *def_value); -typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, void *value); -typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, void *value); -typedef herr_t (*H5P_prp_delete_func_t)(hid_t prop_id, const char *name, void *value); -typedef herr_t (*H5P_prp_close_func_t)(const char *name, void *value); +typedef herr_t (*H5P_prp_create_func_t)(const char *name, size_t size, void *def_value); +typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, size_t size, void *value); +typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, size_t size, void *value); +typedef herr_t (*H5P_prp_delete_func_t)(hid_t prop_id, const char *name, size_t size, void *value); +typedef herr_t (*H5P_prp_copy_func_t)(const char *name, size_t size, void *value); +typedef herr_t (*H5P_prp_close_func_t)(const char *name, size_t size, void *value); /* Define property list iteration function type */ typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); @@ -76,38 +78,58 @@ extern "C" { /* * The library created property list classes */ -#define H5P_NO_CLASS_NEW (H5open(), H5P_NO_CLASS_g) +#define H5P_NO_CLASS_NEW (H5open(), H5P_CLS_NO_CLASS_g) #define H5P_NO_CLASS_HASH_SIZE 1 /* 1, not 0, otherwise allocations get weird */ -#define H5P_FILE_CREATE_NEW (H5open(), H5P_FILE_CREATE_g) +#define H5P_FILE_CREATE_NEW (H5open(), H5P_CLS_FILE_CREATE_g) #define H5P_FILE_CREATE_HASH_SIZE 17 -#define H5P_FILE_ACCESS_NEW (H5open(), H5P_FILE_ACCESS_g) +#define H5P_FILE_ACCESS_NEW (H5open(), H5P_CLS_FILE_ACCESS_g) #define H5P_FILE_ACCESS_HASH_SIZE 17 -#define H5P_DATASET_CREATE_NEW (H5open(), H5P_DATASET_CREATE_g) +#define H5P_DATASET_CREATE_NEW (H5open(), H5P_CLS_DATASET_CREATE_g) #define H5P_DATASET_CREATE_HASH_SIZE 17 -#define H5P_DATASET_XFER_NEW (H5open(), H5P_DATASET_XFER_g) +#define H5P_DATASET_XFER_NEW (H5open(), H5P_CLS_DATASET_XFER_g) #define H5P_DATASET_XFER_HASH_SIZE 17 -#define H5P_MOUNT_NEW (H5open(), H5P_MOUNT_g) +#define H5P_MOUNT_NEW (H5open(), H5P_CLS_MOUNT_g) #define H5P_MOUNT_HASH_SIZE 17 -__DLLVAR__ hid_t H5P_NO_CLASS_g; -__DLLVAR__ hid_t H5P_FILE_CREATE_g; -__DLLVAR__ hid_t H5P_FILE_ACCESS_g; -__DLLVAR__ hid_t H5P_DATASET_CREATE_g; -__DLLVAR__ hid_t H5P_DATASET_XFER_g; -__DLLVAR__ hid_t H5P_MOUNT_g; +__DLLVAR__ hid_t H5P_CLS_NO_CLASS_g; +__DLLVAR__ hid_t H5P_CLS_FILE_CREATE_g; +__DLLVAR__ hid_t H5P_CLS_FILE_ACCESS_g; +__DLLVAR__ hid_t H5P_CLS_DATASET_CREATE_g; +__DLLVAR__ hid_t H5P_CLS_DATASET_XFER_g; +__DLLVAR__ hid_t H5P_CLS_MOUNT_g; +/* + * The library created default property lists + */ +#define H5P_NO_CLASS_DEFAULT (H5open(), H5P_LST_NO_CLASS_g) +#define H5P_FILE_CREATE_DEFAULT (H5open(), H5P_LST_FILE_CREATE_g) +#define H5P_FILE_ACCESS_DEFAULT (H5open(), H5P_LST_FILE_ACCESS_g) +#define H5P_DATASET_CREATE_DEFAULT (H5open(), H5P_LST_DATASET_CREATE_g) +#define H5P_DATASET_XFER_DEFAULT (H5open(), H5P_LST_DATASET_XFER_g) +#define H5P_MOUNT_DEFAULT (H5open(), H5P_LST_MOUNT_g) +__DLLVAR__ hid_t H5P_LST_NO_CLASS_g; +__DLLVAR__ hid_t H5P_LST_FILE_CREATE_g; +__DLLVAR__ hid_t H5P_LST_FILE_ACCESS_g; +__DLLVAR__ hid_t H5P_LST_DATASET_CREATE_g; +__DLLVAR__ hid_t H5P_LST_DATASET_XFER_g; +__DLLVAR__ hid_t H5P_LST_MOUNT_g; /* Public functions */ __DLL__ hid_t H5Pcreate_class(hid_t parent, const char *name, unsigned hashsize, H5P_cls_create_func_t cls_create, void *create_data, + H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data); __DLL__ char *H5Pget_class_name(hid_t pclass_id); __DLL__ hid_t H5Pcreate_list(hid_t cls_id); __DLL__ herr_t H5Pregister(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_del, H5P_prp_close_func_t prp_close); + H5P_prp_delete_func_t prp_del, + H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close); __DLL__ herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_delete, H5P_prp_close_func_t prp_close); + H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close); __DLL__ herr_t H5Pset(hid_t plist_id, const char *name, void *value); __DLL__ htri_t H5Pexist(hid_t plist_id, const char *name); __DLL__ herr_t H5Pget_size(hid_t id, const char *name, size_t *size); @@ -116,7 +138,7 @@ __DLL__ hid_t H5Pget_class_new(hid_t plist_id); __DLL__ hid_t H5Pget_class_parent(hid_t pclass_id); __DLL__ herr_t H5Pget(hid_t plist_id, const char *name, void * value); __DLL__ htri_t H5Pequal(hid_t id1, hid_t id2); -__DLL__ hid_t H5Pisa_class(hid_t plist_id, hid_t pclass_id); +__DLL__ htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id); __DLL__ int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data); __DLL__ herr_t H5Premove(hid_t plist_id, const char *name); diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 6b59f24..06c7f08 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -609,17 +609,18 @@ H5S_hyper_fread (intn dim, H5S_hyper_io_info_t *io_info) uintn u; #endif /* QAK */ hsize_t num_read=0; /* Number of elements read */ - const H5D_xfer_t *xfer_parms;/* Data transfer property list */ + uintn cache_hyper; /* Hyperslab caching turned on? */ + uintn block_limit; /* Hyperslab cache limit */ FUNC_ENTER (H5S_hyper_fread, 0); assert(io_info); - if (H5P_DEFAULT==io_info->dxpl_id) { - xfer_parms = &H5D_xfer_dflt; - } else { - xfer_parms = H5I_object(io_info->dxpl_id); - assert(xfer_parms); - } + + /* Get the hyperslab cache setting and limit */ + if (H5P_get(io_info->dxpl_id,H5D_XFER_HYPER_CACHE_NAME,&cache_hyper)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); + if (H5P_get(io_info->dxpl_id,H5D_XFER_HYPER_CACHE_LIM_NAME,&block_limit)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); #ifdef QAK printf("%s: check 1.0, dim=%d\n",FUNC,dim); @@ -672,9 +673,8 @@ H5S_hyper_fread (intn dim, H5S_hyper_io_info_t *io_info) #endif /* QAK */ /* Check if this hyperslab block is cached or could be cached */ if(!regions[i].node->cinfo.cached && - (xfer_parms->cache_hyper && - (xfer_parms->block_limit==0 || - xfer_parms->block_limit>=(regions[i].node->cinfo.size*io_info->elmt_size)))) { + (cache_hyper && + (block_limit==0 || block_limit>=(regions[i].node->cinfo.size*io_info->elmt_size)))) { /* if we aren't cached, attempt to cache the block */ #ifdef QAK printf("%s: check 2.1.3, caching block\n",FUNC); @@ -992,7 +992,7 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout, #ifndef NO_DUFFS_DEVICE size_t duffs_index; /* Counting index for Duff's device */ #endif /* NO_DUFFS_DEVICE */ - const H5D_xfer_t *xfer_parms;/* Data transfer property list */ + size_t vector_size; /* Value for vector size */ hsize_t ret_value=0; /* Return value */ FUNC_ENTER (H5S_hyper_fread_opt, 0); @@ -1011,18 +1011,14 @@ for(i=0; iextent.u.simple.rank; i++) printf("%s: file_file->hyp.pos[%d]=%d\n",FUNC,(int)i,(int)file_iter->hyp.pos[i]); #endif /* QAK */ - /* Get the data transfer properties */ - if (H5P_DEFAULT==dxpl_id) { - xfer_parms = &H5D_xfer_dflt; - } else { - xfer_parms = H5I_object(dxpl_id); - assert(xfer_parms); - } /* end else */ + /* Get the hyperslab vector size */ + if (H5P_get(dxpl_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); /* Allocate the vector I/O arrays */ - if((seq_len_arr = H5FL_ARR_ALLOC(size_t,xfer_parms->vector_size,0))==NULL) + if((seq_len_arr = H5FL_ARR_ALLOC(size_t,vector_size,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate vector I/O array"); - if((buf_off_arr = H5FL_ARR_ALLOC(hsize_t,xfer_parms->vector_size,0))==NULL) + if((buf_off_arr = H5FL_ARR_ALLOC(hsize_t,vector_size,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate vector I/O array"); /* Set the rank of the fastest changing dimension */ @@ -1186,7 +1182,7 @@ for(i=0; iextent.u.simple.rank; i++) skip[i]=(tdiminfo[i].stride-tdiminfo[i].block)*slab[i]; /* Fill the sequence length array (since they will all be the same for optimized hyperslabs) */ - for(u=0; uvector_size; u++) + for(u=0; uextent.u.simple.rank; i++) /* Gather the sequence */ /* Compute the number of sequences to fill */ - tot_seq=MIN(xfer_parms->vector_size-nseq,fast_dim_count); + tot_seq=MIN(vector_size-nseq,fast_dim_count); /* Get a copy of the number of sequences to fill */ seq_count=tot_seq; @@ -1308,7 +1304,7 @@ for(i=0; iextent.u.simple.rank; i++) fast_dim_count -= tot_seq; /* If the sequence & offset arrays are full, read them in */ - if(nseq>=xfer_parms->vector_size) { + if(nseq>=vector_size) { /* Read in the sequences */ if (H5F_seq_readv(f, dxpl_id, layout, pline, fill, efl, file_space, elmt_size, nseq, seq_len_arr, buf_off_arr, buf/*out*/)<0) { @@ -1350,7 +1346,7 @@ for(i=0; iextent.u.simple.rank; i++) /* Gather the sequence */ /* Compute the number of sequences to fill */ - tot_seq=MIN(xfer_parms->vector_size-nseq,fast_dim_count); + tot_seq=MIN(vector_size-nseq,fast_dim_count); /* Get a copy of the number of sequences to fill */ seq_count=tot_seq; @@ -1380,7 +1376,7 @@ for(i=0; iextent.u.simple.rank; i++) fast_dim_count -= tot_seq; /* If the sequence & offset arrays are full, read them in */ - if(nseq>=xfer_parms->vector_size) { + if(nseq>=vector_size) { /* Read in the sequences */ if (H5F_seq_readv(f, dxpl_id, layout, pline, fill, efl, file_space, elmt_size, nseq, seq_len_arr, buf_off_arr, buf/*out*/)<0) { @@ -1424,7 +1420,7 @@ for(i=0; iextent.u.simple.rank; i++) nseq++; /* If the sequence & offset arrays are full, read them in */ - if(nseq>=xfer_parms->vector_size) { + if(nseq>=vector_size) { /* Read in the sequences */ if (H5F_seq_readv(f, dxpl_id, layout, pline, fill, efl, file_space, elmt_size, nseq, seq_len_arr, buf_off_arr, buf/*out*/)<0) { @@ -1638,17 +1634,19 @@ H5S_hyper_fwrite (intn dim, H5S_hyper_io_info_t *io_info) size_t i; /* Counters */ intn j; hsize_t num_written=0; /* Number of elements read */ - const H5D_xfer_t *xfer_parms; /* Data transfer properties */ + uintn cache_hyper; /* Hyperslab caching turned on? */ + uintn block_limit; /* Hyperslab cache limit */ FUNC_ENTER (H5S_hyper_fwrite, 0); assert(io_info); - if (H5P_DEFAULT==io_info->dxpl_id) { - xfer_parms = &H5D_xfer_dflt; - } else { - xfer_parms = H5I_object(io_info->dxpl_id); - assert(xfer_parms); - } + + /* Get the hyperslab cache setting and limit */ + if (H5P_get(io_info->dxpl_id,H5D_XFER_HYPER_CACHE_NAME,&cache_hyper)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); + if (H5P_get(io_info->dxpl_id,H5D_XFER_HYPER_CACHE_LIM_NAME,&block_limit)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); + #ifdef QAK printf("%s: check 1.0\n", FUNC); @@ -1682,7 +1680,7 @@ H5S_hyper_fwrite (intn dim, H5S_hyper_io_info_t *io_info) region_size=MIN((hssize_t)io_info->nelmts, (regions[i].end-regions[i].start)+1); /* Check if this hyperslab block is cached or could be cached */ - if(!regions[i].node->cinfo.cached && (xfer_parms->cache_hyper && (xfer_parms->block_limit==0 || xfer_parms->block_limit>=(regions[i].node->cinfo.size*io_info->elmt_size)))) { + if(!regions[i].node->cinfo.cached && (cache_hyper && (block_limit==0 || block_limit>=(regions[i].node->cinfo.size*io_info->elmt_size)))) { /* if we aren't cached, attempt to cache the block */ H5S_hyper_block_cache(regions[i].node,io_info,0); } /* end if */ @@ -1837,7 +1835,7 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout, #ifndef NO_DUFFS_DEVICE size_t duffs_index; /* Counting index for Duff's device */ #endif /* NO_DUFFS_DEVICE */ - const H5D_xfer_t *xfer_parms;/* Data transfer property list */ + size_t vector_size; /* Value for vector size */ hsize_t ret_value=0; /* Return value */ FUNC_ENTER (H5S_hyper_fwrite_opt, 0); @@ -1856,18 +1854,14 @@ for(i=0; iextent.u.simple.rank; i++) printf("%s: file_file->hyp.pos[%d]=%d\n",FUNC,(int)i,(int)file_iter->hyp.pos[i]); #endif /* QAK */ - /* Get the data transfer properties */ - if (H5P_DEFAULT==dxpl_id) { - xfer_parms = &H5D_xfer_dflt; - } else { - xfer_parms = H5I_object(dxpl_id); - assert(xfer_parms); - } /* end else */ + /* Get the hyperslab vector size */ + if (H5P_get(dxpl_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); /* Allocate the vector I/O arrays */ - if((seq_len_arr = H5FL_ARR_ALLOC(size_t,xfer_parms->vector_size,0))==NULL) + if((seq_len_arr = H5FL_ARR_ALLOC(size_t,vector_size,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate vector I/O array"); - if((buf_off_arr = H5FL_ARR_ALLOC(hsize_t,xfer_parms->vector_size,0))==NULL) + if((buf_off_arr = H5FL_ARR_ALLOC(hsize_t,vector_size,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate vector I/O array"); /* Set the rank of the fastest changing dimension */ @@ -2031,7 +2025,7 @@ for(i=0; iextent.u.simple.rank; i++) skip[i]=(tdiminfo[i].stride-tdiminfo[i].block)*slab[i]; /* Fill the sequence length array (since they will all be the same for optimized hyperslabs) */ - for(u=0; uvector_size; u++) + for(u=0; uextent.u.simple.rank; i++) /* Gather the sequence */ /* Compute the number of sequences to fill */ - tot_seq=MIN(xfer_parms->vector_size-nseq,fast_dim_count); + tot_seq=MIN(vector_size-nseq,fast_dim_count); /* Get a copy of the number of sequences to fill */ seq_count=tot_seq; @@ -2153,7 +2147,7 @@ for(i=0; iextent.u.simple.rank; i++) fast_dim_count -= tot_seq; /* If the sequence & offset arrays are full, write them out */ - if(nseq>=xfer_parms->vector_size) { + if(nseq>=vector_size) { /* Write out the sequences */ if (H5F_seq_writev(f, dxpl_id, layout, pline, fill, efl, file_space, elmt_size, nseq, seq_len_arr, buf_off_arr, buf)<0) { @@ -2195,7 +2189,7 @@ for(i=0; iextent.u.simple.rank; i++) /* Gather the sequence */ /* Compute the number of sequences to fill */ - tot_seq=MIN(xfer_parms->vector_size-nseq,fast_dim_count); + tot_seq=MIN(vector_size-nseq,fast_dim_count); /* Get a copy of the number of sequences to fill */ seq_count=tot_seq; @@ -2225,7 +2219,7 @@ for(i=0; iextent.u.simple.rank; i++) fast_dim_count -= tot_seq; /* If the sequence & offset arrays are full, write them out */ - if(nseq>=xfer_parms->vector_size) { + if(nseq>=vector_size) { /* Write out the sequences */ if (H5F_seq_writev(f, dxpl_id, layout, pline, fill, efl, file_space, elmt_size, nseq, seq_len_arr, buf_off_arr, buf)<0) { @@ -2269,7 +2263,7 @@ for(i=0; iextent.u.simple.rank; i++) nseq++; /* If the sequence & offset arrays are full, write them out */ - if(nseq>=xfer_parms->vector_size) { + if(nseq>=vector_size) { /* Write out the sequences */ if (H5F_seq_writev(f, dxpl_id, layout, pline, fill, efl, file_space, elmt_size, nseq, seq_len_arr, buf_off_arr, buf)<0) { diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 63a1347..16bbda7 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -575,6 +575,9 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, assert (mem_space); assert (buf); assert (IS_H5FD_MPIO(f)); + /* Make certain we have the correct type of property list */ + assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); + assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW)); /* INCOMPLETE!!! rky 980816 */ /* Currently can only handle H5D_CONTIGUOUS layout */ @@ -601,18 +604,24 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, * the following block of code, though with the right idea, is not * correct yet. */ - { /* Get the transfer mode */ - H5D_xfer_t *dxpl; - H5FD_mpio_dxpl_t *dx; - - if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && - H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && - H5FD_MPIO_COLLECTIVE==dx->xfer_mode) { - /* let it fall through */ - }else{ + { + /* Get the transfer mode */ + H5FD_mpio_dxpl_t *dx; + hid_t driver_id; /* VFL driver ID */ + + /* Get the driver ID */ + if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); + + /* Get the driver information */ + if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); + + /* Check if we are using the MPIO driver */ + if(H5FD_MPIO!=driver_id || H5FD_MPIO_COLLECTIVE!=dx->xfer_mode) { *must_convert = 1; /* can't do optimized xfer; do the old way */ HGOTO_DONE(SUCCEED); - } + } /* end if */ } #endif diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 070c63b..e65e03a 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1809,7 +1809,6 @@ 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) { - const H5D_xfer_t *xfer_parms = NULL; H5T_path_t *tpath; /* Type conversion path */ hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ H5T_t *src = NULL; /*source data type */ @@ -1867,14 +1866,6 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } - /* Get the dataset transfer property list */ - if (H5P_DEFAULT == dset_xfer_plist) { - xfer_parms = &H5D_xfer_dflt; - } else if (H5P_DATASET_XFER != H5P_get_class(dset_xfer_plist) || - NULL == (xfer_parms = H5I_object(dset_xfer_plist))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); - } - /* * Do we process the values from beginning to end or vice * versa? Also, how many of the elements have the source and @@ -1972,7 +1963,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, "datatype conversion failed"); /* Write sequence to destination location */ - if((*(dst->u.vlen.write))(xfer_parms,dst->u.vlen.f,d,conv_buf, + if((*(dst->u.vlen.write))(dset_xfer_plist,dst->u.vlen.f,d,conv_buf, (hsize_t)seq_len,(hsize_t)dst_base_size)<0) HRETURN_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data"); diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 64ebc0f..8d92d5c 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -92,7 +92,7 @@ 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)(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size); +typedef herr_t (*H5T_vlen_writefunc_t)(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size); /* A VL datatype */ typedef struct H5T_vlen_t { @@ -751,13 +751,13 @@ __DLL__ htri_t H5T_bit_inc(uint8_t *buf, size_t start, size_t size); /* VL functions */ __DLL__ hssize_t H5T_vlen_seq_mem_getlen(H5F_t *f, void *vl_addr); __DLL__ herr_t H5T_vlen_seq_mem_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -__DLL__ herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); +__DLL__ herr_t H5T_vlen_seq_mem_write(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); __DLL__ hssize_t H5T_vlen_str_mem_getlen(H5F_t *f, void *vl_addr); __DLL__ herr_t H5T_vlen_str_mem_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -__DLL__ herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); +__DLL__ herr_t H5T_vlen_str_mem_write(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); __DLL__ hssize_t H5T_vlen_disk_getlen(H5F_t *f, void *vl_addr); __DLL__ herr_t H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -__DLL__ herr_t H5T_vlen_disk_write(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); +__DLL__ herr_t H5T_vlen_disk_write(hid_t dxpl_id, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); /* Array functions */ __DLL__ H5T_t * H5T_array_create(H5T_t *base, int ndims, diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index e1515ab..6932d70 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -18,6 +18,7 @@ #include "H5Eprivate.h" /* Errors */ #include "H5HGprivate.h" /* Global Heaps */ #include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property Lists */ #include "H5MMprivate.h" /* Memory Allocation */ #include "H5Tpkg.h" /* Datatypes */ @@ -202,8 +203,10 @@ herr_t H5T_vlen_seq_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t l * *------------------------------------------------------------------------- */ -herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) +herr_t H5T_vlen_seq_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) { + H5MM_allocate_t alloc_func; /* Vlen allocation function */ + void *alloc_info; /* Vlen allocation information */ hvl_t *vl=(hvl_t *)vl_addr; /* Pointer to the user's hvl_t information */ size_t len=seq_len*base_size; @@ -216,8 +219,15 @@ herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, voi if(seq_len!=0) { /* Use the user's memory allocation routine is one is defined */ assert((seq_len*base_size)==(hsize_t)((size_t)(seq_len*base_size))); /*check for overflow*/ - if(xfer_parms->vlen_alloc!=NULL) { - if(NULL==(vl->p=(xfer_parms->vlen_alloc)((size_t)(seq_len*base_size),xfer_parms->alloc_info))) + + /* Get the allocation function & info */ + if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + + if(alloc_func!=NULL) { + if(NULL==(vl->p=(alloc_func)((size_t)(seq_len*base_size),alloc_info))) HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data"); } /* end if */ else { /* Default to system malloc */ @@ -313,8 +323,10 @@ herr_t H5T_vlen_str_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t l * *------------------------------------------------------------------------- */ -herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) +herr_t H5T_vlen_str_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) { + H5MM_allocate_t alloc_func; /* Vlen allocation function */ + void *alloc_info; /* Vlen allocation information */ char **s=(char **)vl_addr; /* Pointer to the user's hvl_t information */ size_t len=seq_len*base_size; @@ -325,8 +337,15 @@ herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, voi /* Use the user's memory allocation routine is one is defined */ assert(((seq_len+1)*base_size)==(hsize_t)((size_t)((seq_len+1)*base_size))); /*check for overflow*/ - if(xfer_parms->vlen_alloc!=NULL) { - if(NULL==(*s=(xfer_parms->vlen_alloc)((size_t)((seq_len+1)*base_size),xfer_parms->alloc_info))) + + /* Get the allocation function & info */ + if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + + if(alloc_func!=NULL) { + if(NULL==(*s=(alloc_func)((size_t)((seq_len+1)*base_size),alloc_info))) HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data"); } /* end if */ else { /* Default to system malloc */ @@ -430,7 +449,7 @@ herr_t H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *buf, size_t UNUSED len) * *------------------------------------------------------------------------- */ -herr_t H5T_vlen_disk_write(const H5D_xfer_t UNUSED *xfer_parms, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) +herr_t H5T_vlen_disk_write(hid_t plist_id, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) { uint8_t *vl=(uint8_t *)vl_addr; /* Pointer to the user's hvl_t information */ H5HG_t hobjid; @@ -600,7 +619,9 @@ done: herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *op_data) { - H5D_xfer_t *xfer_parms = (H5D_xfer_t *)op_data; /* Dataset transfer plist from iterator */ + hid_t plist_id = *(hid_t *)op_data; /* Dataset transfer plist from iterator */ + H5MM_free_t free_func; /* Vlen free function */ + void *free_info=NULL; /* Vlen free information */ H5T_t *dt = NULL; herr_t ret_value = FAIL; @@ -613,8 +634,14 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED if (H5I_DATATYPE!=H5I_get_type(type_id) || NULL==(dt=H5I_object(type_id))) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + /* Get the free func & information */ + if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_NAME,&free_func)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + /* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */ - ret_value=H5T_vlen_reclaim_recurse(elem,dt,xfer_parms->vlen_free,xfer_parms->free_info); + ret_value=H5T_vlen_reclaim_recurse(elem,dt,free_func,free_info); #ifdef LATER done: diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 0fbb346..ee00e50 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -157,7 +157,7 @@ main (int argc, char *argv[]) if ((space = H5Screate_simple (2, dim, NULL))<0) goto error; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto error; + if ((PRESERVE = H5Pcreate_list (H5P_DATASET_XFER_NEW))<0) goto error; if (H5Pset_preserve (PRESERVE, 1)<0) goto error; /* @@ -703,7 +703,7 @@ main (int argc, char *argv[]) /* * Release resources. */ - H5Pclose (PRESERVE); + H5Pclose_list (PRESERVE); H5Dclose (dataset); H5Fclose (file); diff --git a/test/dsets.c b/test/dsets.c index 798d9fe..c55e25f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -198,7 +198,7 @@ test_simple_io(hid_t file) /* Create a small conversion buffer to test strip mining */ tconv_buf = malloc (1000); - xfer = H5Pcreate (H5P_DATASET_XFER); + xfer = H5Pcreate_list (H5P_DATASET_XFER_NEW); assert (xfer>=0); if (H5Pset_buffer (xfer, 1000, tconv_buf, NULL)<0) goto error; @@ -226,7 +226,7 @@ test_simple_io(hid_t file) } } - H5Pclose (xfer); + i=H5Pclose_list (xfer); H5Dclose(dataset); free (tconv_buf); PASSED(); @@ -383,7 +383,7 @@ test_compression(hid_t file) * Create a small conversion buffer to test strip mining. We * might as well test all we can! */ - if ((xfer = H5Pcreate (H5P_DATASET_XFER))<0) goto error; + if ((xfer = H5Pcreate_list (H5P_DATASET_XFER_NEW))<0) goto error; tconv_buf = malloc (1000); if (H5Pset_buffer (xfer, 1000, tconv_buf, NULL)<0) goto error; @@ -637,7 +637,7 @@ test_compression(hid_t file) * Cleanup *---------------------------------------------------------------------- */ - if (H5Pclose (xfer)<0) goto error; + if (H5Pclose_list (xfer)<0) goto error; if (H5Pclose (dc)<0) goto error; if (H5Dclose(dataset)<0) goto error; free (tconv_buf); diff --git a/test/istore.c b/test/istore.c index 78142f7..4fddbe3 100644 --- a/test/istore.c +++ b/test/istore.c @@ -299,7 +299,7 @@ test_extend(H5F_t *f, const char *prefix, memset(buf, (signed)(128+ctr), (size_t)nelmts); /* Write to disk */ - if (H5F_arr_write(f, H5P_DEFAULT, &layout, NULL, NULL, NULL, size, + if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &layout, NULL, NULL, NULL, size, size, zero, offset, buf)<0) { H5_FAILED(); printf(" Write failed: ctr=%lu\n", (unsigned long)ctr); @@ -308,7 +308,7 @@ test_extend(H5F_t *f, const char *prefix, /* Read from disk */ memset(check, 0xff, (size_t)nelmts); - if (H5F_arr_read(f, H5P_DEFAULT, &layout, NULL, NULL, NULL, size, + if (H5F_arr_read(f, H5P_DATASET_XFER_DEFAULT, &layout, NULL, NULL, NULL, size, size, zero, offset, check)<0) { H5_FAILED(); printf(" Read failed: ctr=%lu\n", (unsigned long)ctr); @@ -339,7 +339,7 @@ test_extend(H5F_t *f, const char *prefix, /* Now read the entire array back out and check it */ memset(buf, 0xff, nx * ny * nz); - if (H5F_arr_read(f, H5P_DEFAULT, &layout, NULL, NULL, NULL, whole_size, + if (H5F_arr_read(f, H5P_DATASET_XFER_DEFAULT, &layout, NULL, NULL, NULL, whole_size, whole_size, zero, zero, buf)<0) { H5_FAILED(); puts(" Read failed for whole array."); @@ -452,7 +452,7 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks, memset(buf, (signed)(128+ctr), nx * ny * nz); /* write to disk */ - if (H5F_arr_write(f, H5P_DEFAULT, &layout, NULL, NULL, NULL, size, + if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &layout, NULL, NULL, NULL, size, size, zero, offset, buf)<0) { H5_FAILED(); printf(" Write failed: ctr=%lu\n", (unsigned long)ctr); diff --git a/test/tarray.c b/test/tarray.c index 9e5853b..306b706 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1141,7 +1141,7 @@ test_array_vlen_atomic(void) CHECK(ret, FAIL, "H5Tclose"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(xfer_pid, FAIL, "H5Pcreate"); ret=H5Pset_vlen_mem_manager(xfer_pid,test_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used); @@ -1195,6 +1195,10 @@ test_array_vlen_atomic(void) ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); CHECK(ret, FAIL, "H5Dvlen_reclaim"); + /* Close dataset transfer property list */ + ret = H5Pclose_list(xfer_pid); + CHECK(ret, FAIL, "H5Pclose"); + /* Close Datatype */ ret = H5Tclose(tid1); CHECK(ret, FAIL, "H5Tclose"); @@ -1391,7 +1395,7 @@ test_array_vlen_array(void) CHECK(ret, FAIL, "H5Tclose"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(xfer_pid, FAIL, "H5Pcreate"); ret=H5Pset_vlen_mem_manager(xfer_pid,test_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used); @@ -1447,6 +1451,10 @@ test_array_vlen_array(void) ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); CHECK(ret, FAIL, "H5Dvlen_reclaim"); + /* Close dataset transfer property list */ + ret = H5Pclose_list(xfer_pid); + CHECK(ret, FAIL, "H5Pclose"); + /* Close Datatype */ ret = H5Tclose(tid1); CHECK(ret, FAIL, "H5Tclose"); diff --git a/test/tgenprop.c b/test/tgenprop.c index 7a4fdf5..1a0b75f 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -72,7 +72,7 @@ test_genprop_basic_class(void) MESSAGE(5, ("Testing Basic Generic Property List Class Creation Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Check class name */ @@ -105,7 +105,7 @@ test_genprop_basic_class(void) CHECK_I(ret, "H5Pclose_class"); /* Create another new generic class, derived from file creation class */ - cid1 = H5Pcreate_class(H5P_FILE_CREATE_NEW,CLASS2_NAME,CLASS2_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_FILE_CREATE_NEW,CLASS2_NAME,CLASS2_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Check class name */ @@ -164,7 +164,7 @@ test_genprop_basic_class_prop(void) MESSAGE(5, ("Testing Basic Generic Property List Class Properties Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Check the number of properties in class */ @@ -177,11 +177,11 @@ test_genprop_basic_class_prop(void) VERIFY(ret, 0, "H5Pexist"); /* Insert first property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Try to insert the first property again (should fail) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); VERIFY(ret, FAIL, "H5Pregister"); /* Check the existance of the first property */ @@ -199,11 +199,11 @@ test_genprop_basic_class_prop(void) VERIFY(nprops, 1, "H5Pget_nprops"); /* Insert second property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Try to insert the second property again (should fail) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); VERIFY(ret, FAIL, "H5Pregister"); /* Check the existance of the second property */ @@ -221,7 +221,7 @@ test_genprop_basic_class_prop(void) VERIFY(nprops, 2, "H5Pget_nprops"); /* Insert third property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Check the existance of the third property */ @@ -320,23 +320,23 @@ test_genprop_class_iter(void) MESSAGE(5, ("Testing Basic Generic Property List Class Property Iteration Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -403,23 +403,23 @@ test_genprop_class_callback(void) MESSAGE(5, ("Testing Basic Generic Property List Class Callback Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,test_genprop_cls_cb1,&crt_cb_struct,test_genprop_cls_cb1,&cls_cb_struct); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,test_genprop_cls_cb1,&crt_cb_struct,NULL,NULL,test_genprop_cls_cb1,&cls_cb_struct); CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert fourth property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -502,17 +502,17 @@ test_genprop_basic_list(void) MESSAGE(5, ("Testing Basic Generic Property List Creation Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Add several properties (w/default values) */ /* Insert first property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -604,17 +604,17 @@ test_genprop_basic_list_prop(void) MESSAGE(5, ("Testing Basic Generic Property List Property Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Add several properties (several w/default values) */ /* Insert first property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Create a property list from the class */ @@ -629,11 +629,11 @@ test_genprop_basic_list_prop(void) /* Add temporary properties */ /* Insert first temporary property into class (with no callbacks) */ - ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL); + ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pinsert"); /* Insert second temporary property into class (with no callbacks) */ - ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL); + ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pinsert"); /* Check the number of properties in list */ @@ -761,17 +761,17 @@ test_genprop_list_iter(void) MESSAGE(5, ("Testing Generic Property List Iteration Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Add several properties (several w/default values) */ /* Insert first property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Create a property list from the class */ @@ -786,11 +786,11 @@ test_genprop_list_iter(void) /* Add temporary properties */ /* Insert first temporary property into class (with no callbacks) */ - ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL); + ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pinsert"); /* Insert second temporary property into class (with no callbacks) */ - ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL); + ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pinsert"); /* Check the number of properties in list */ @@ -844,6 +844,11 @@ typedef struct { char *del_name; void *del_value; + /* Copy information */ + int cop_count; + char *cop_name; + void *cop_value; + /* Close information */ int cls_count; char *cls_name; @@ -860,13 +865,13 @@ prop_cb_info prop2_cb_info; /* Callback statistics for property #2 */ ** ****************************************************************/ static herr_t -test_genprop_prop_crt_cb1(const char *name, void *def_value) +test_genprop_prop_crt_cb1(const char *name, size_t size, void *def_value) { /* Set the information from the creation call */ prop1_cb_info.crt_count++; prop1_cb_info.crt_name=HDstrdup(name); - prop1_cb_info.crt_value=HDmalloc(PROP1_SIZE); - HDmemcpy(prop1_cb_info.crt_value,def_value,PROP1_SIZE); + prop1_cb_info.crt_value=HDmalloc(size); + HDmemcpy(prop1_cb_info.crt_value,def_value,size); return(SUCCEED); } @@ -877,7 +882,7 @@ test_genprop_prop_crt_cb1(const char *name, void *def_value) ** ****************************************************************/ static herr_t -test_genprop_prop_set_cb1(hid_t plist_id, const char *name, void *value) +test_genprop_prop_set_cb1(hid_t plist_id, const char *name, size_t size, void *value) { /* Set the information from the set call */ prop1_cb_info.set_count++; @@ -885,8 +890,8 @@ test_genprop_prop_set_cb1(hid_t plist_id, const char *name, void *value) if(prop1_cb_info.set_name==NULL) prop1_cb_info.set_name=HDstrdup(name); if(prop1_cb_info.set_value==NULL) - prop1_cb_info.set_value=HDmalloc(PROP1_SIZE); - HDmemcpy(prop1_cb_info.set_value,value,PROP1_SIZE); + prop1_cb_info.set_value=HDmalloc(size); + HDmemcpy(prop1_cb_info.set_value,value,size); return(SUCCEED); } @@ -897,7 +902,7 @@ test_genprop_prop_set_cb1(hid_t plist_id, const char *name, void *value) ** ****************************************************************/ static herr_t -test_genprop_prop_get_cb1(hid_t plist_id, const char *name, void *value) +test_genprop_prop_get_cb1(hid_t plist_id, const char *name, size_t size, void *value) { /* Set the information from the get call */ prop1_cb_info.get_count++; @@ -905,8 +910,27 @@ test_genprop_prop_get_cb1(hid_t plist_id, const char *name, void *value) if(prop1_cb_info.get_name==NULL) prop1_cb_info.get_name=HDstrdup(name); if(prop1_cb_info.get_value==NULL) - prop1_cb_info.get_value=HDmalloc(PROP1_SIZE); - HDmemcpy(prop1_cb_info.get_value,value,PROP1_SIZE); + prop1_cb_info.get_value=HDmalloc(size); + HDmemcpy(prop1_cb_info.get_value,value,size); + + return(SUCCEED); +} + +/**************************************************************** +** +** test_genprop_prop_cop_cb1(): Property copy callback for test_genprop_list_callback +** +****************************************************************/ +static herr_t +test_genprop_prop_cop_cb1(const char *name, size_t size, void *value) +{ + /* Set the information from the get call */ + prop1_cb_info.cop_count++; + if(prop1_cb_info.cop_name==NULL) + prop1_cb_info.cop_name=HDstrdup(name); + if(prop1_cb_info.cop_value==NULL) + prop1_cb_info.cop_value=HDmalloc(size); + HDmemcpy(prop1_cb_info.cop_value,value,size); return(SUCCEED); } @@ -917,13 +941,13 @@ test_genprop_prop_get_cb1(hid_t plist_id, const char *name, void *value) ** ****************************************************************/ static herr_t -test_genprop_prop_cls_cb1(const char *name, void *value) +test_genprop_prop_cls_cb1(const char *name, size_t size, void *value) { /* Set the information from the close call */ prop1_cb_info.cls_count++; prop1_cb_info.cls_name=HDstrdup(name); - prop1_cb_info.cls_value=HDmalloc(PROP1_SIZE); - HDmemcpy(prop1_cb_info.cls_value,value,PROP1_SIZE); + prop1_cb_info.cls_value=HDmalloc(size); + HDmemcpy(prop1_cb_info.cls_value,value,size); return(SUCCEED); } @@ -934,14 +958,14 @@ test_genprop_prop_cls_cb1(const char *name, void *value) ** ****************************************************************/ static herr_t -test_genprop_prop_del_cb2(hid_t plist_id, const char *name, void *value) +test_genprop_prop_del_cb2(hid_t plist_id, const char *name, size_t size, void *value) { /* Set the information from the delete call */ prop2_cb_info.del_count++; prop2_cb_info.del_plist_id=plist_id; prop2_cb_info.del_name=HDstrdup(name); - prop2_cb_info.del_value=HDmalloc(PROP2_SIZE); - HDmemcpy(prop2_cb_info.del_value,value,PROP2_SIZE); + prop2_cb_info.del_value=HDmalloc(size); + HDmemcpy(prop2_cb_info.del_value,value,size); return(SUCCEED); } @@ -957,35 +981,40 @@ test_genprop_list_callback(void) { hid_t cid1; /* Generic Property class ID */ hid_t lid1; /* Generic Property list ID */ + hid_t lid2; /* 2nd Generic Property list ID */ size_t nprops; /* Number of properties in class */ int prop1_value; /* Value for property #1 */ int prop1_new_value=20; /* Property #1 new value */ float prop2_value; /* Value for property #2 */ char prop3_value[10];/* Property #3 value */ double prop4_value; /* Property #4 value */ + struct { /* Struct for callbacks */ + int count; + hid_t id; + } cop_cb_struct; herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Generic Property List Property Callback Functionality\n")); /* Create a new generic class, derived from the root of the class hierarchy */ - cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL); + cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,test_genprop_cls_cb1,&cop_cb_struct,NULL,NULL); CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with callbacks) */ - ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,test_genprop_prop_crt_cb1,test_genprop_prop_set_cb1,test_genprop_prop_get_cb1,NULL,test_genprop_prop_cls_cb1); + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,test_genprop_prop_crt_cb1,test_genprop_prop_set_cb1,test_genprop_prop_get_cb1,NULL,test_genprop_prop_cop_cb1,test_genprop_prop_cls_cb1); CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with only delete callback) */ - ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,test_genprop_prop_del_cb2,NULL); + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,test_genprop_prop_del_cb2,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Insert fourth property into class (with no callbacks) */ - ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); + ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -993,8 +1022,13 @@ test_genprop_list_callback(void) CHECK_I(ret, "H5Pget_nprops"); VERIFY(nprops, 4, "H5Pget_nprops"); + /* Initialize class callback structs */ + cop_cb_struct.count=0; + cop_cb_struct.id=(-1); + /* Initialize callback information for properties tracked */ HDmemset(&prop1_cb_info,0,sizeof(prop_cb_info)); + HDmemset(&prop2_cb_info,0,sizeof(prop_cb_info)); /* Create a property list from the class */ lid1 = H5Pcreate_list(cid1); @@ -1091,6 +1125,25 @@ test_genprop_list_callback(void) printf("Property #2 value doesn't match!, line=%d\n",__LINE__); } /* end if */ + /* Copy first list */ + lid2 = H5Pcopy(lid1); + CHECK_I(lid2, "H5Pcopy"); + + /* Verify copy callback information for properties tracked */ + VERIFY(prop1_cb_info.cop_count, 1, "H5Pcopy"); + if(HDstrcmp(prop1_cb_info.cop_name,PROP1_NAME)!=0) { + num_errs++; + printf("Property #1 name doesn't match!, line=%d\n",__LINE__); + } /* end if */ + if(HDmemcmp(prop1_cb_info.cop_value,&prop1_new_value,PROP1_SIZE)!=0) { + num_errs++; + printf("Property #1 value doesn't match!, line=%d\n",__LINE__); + } /* end if */ + + /* Verify that the class creation callback occurred */ + VERIFY(cop_cb_struct.count, 1, "H5Pcopy"); + VERIFY(cop_cb_struct.id, lid2, "H5Pcopy"); + /* Close first list */ ret = H5Pclose_list(lid1); CHECK_I(ret, "H5Pclose_list"); @@ -1113,6 +1166,8 @@ test_genprop_list_callback(void) HDfree(prop1_cb_info.get_value); HDfree(prop1_cb_info.set_name); HDfree(prop1_cb_info.set_value); + HDfree(prop1_cb_info.cop_name); + HDfree(prop1_cb_info.cop_value); HDfree(prop1_cb_info.cls_name); HDfree(prop1_cb_info.cls_value); HDfree(prop2_cb_info.del_name); diff --git a/test/tselect.c b/test/tselect.c index 3dcd1d3..69472d8 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -2227,8 +2227,8 @@ test_select_hyper_union(void) dataset=H5Dcreate(fid1,"Dataset4",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate"); - xfer = H5Pcreate (H5P_DATASET_XFER); - CHECK(xfer, FAIL, "H5Pcreate"); + xfer = H5Pcreate_list (H5P_DATASET_XFER_NEW); + CHECK(xfer, FAIL, "H5Pcreate_list"); ret = H5Pset_hyper_cache(xfer,0,1); CHECK(ret, FAIL, "H5Pset_hyper_cache"); @@ -2258,7 +2258,7 @@ test_select_hyper_union(void) CHECK(ret, FAIL, "H5Dread"); /* Close transfer property list */ - ret = H5Pclose(xfer); + ret = H5Pclose_list(xfer); CHECK(ret, FAIL, "H5Pclose"); /* Compare data read with data written out */ @@ -3170,7 +3170,7 @@ test_select(void) MESSAGE(5, ("Testing Selections\n")); /* Create a dataset transfer property list */ - plist_id=H5Pcreate(H5P_DATASET_XFER); + plist_id=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(plist_id, FAIL, "H5Pcreate"); /* test I/O with a very small buffer for reads */ @@ -3231,7 +3231,7 @@ test_select(void) CHECK(ret, FAIL, "H5Pclose"); /* Close dataset transfer property list */ - ret=H5Pclose(plist_id); + ret=H5Pclose_list(plist_id); CHECK(ret, FAIL, "H5Pclose"); } /* test_select() */ diff --git a/test/tvlstr.c b/test/tvlstr.c index 2ed5bb7..ccf51d3 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -154,7 +154,7 @@ test_vlstrings_basic(void) CHECK(ret, FAIL, "H5Dwrite"); /* Change to the custom memory allocation routines for reading VL string */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(xfer_pid, FAIL, "H5Pcreate"); ret=H5Pset_vlen_mem_manager(xfer_pid,test_vlstr_alloc_custom,&mem_used,test_vlstr_free_custom,&mem_used); @@ -212,7 +212,7 @@ test_vlstrings_basic(void) CHECK(ret, FAIL, "H5Sclose"); /* Close dataset transfer property list */ - ret = H5Pclose(xfer_pid); + ret = H5Pclose_list(xfer_pid); CHECK(ret, FAIL, "H5Pclose"); /* Close file */ diff --git a/test/tvltypes.c b/test/tvltypes.c index 8fb6b9a..00179e4 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -149,7 +149,7 @@ test_vltypes_vlen_atomic(void) CHECK(ret, FAIL, "H5Dwrite"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(xfer_pid, FAIL, "H5Pcreate"); ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); @@ -210,7 +210,7 @@ test_vltypes_vlen_atomic(void) CHECK(ret, FAIL, "H5Sclose"); /* Close dataset transfer property list */ - ret = H5Pclose(xfer_pid); + ret = H5Pclose_list(xfer_pid); CHECK(ret, FAIL, "H5Pclose"); /* Close file */ @@ -289,7 +289,7 @@ test_vltypes_vlen_compound(void) CHECK(ret, FAIL, "H5Dwrite"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(xfer_pid, FAIL, "H5Pcreate"); ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); @@ -359,7 +359,7 @@ test_vltypes_vlen_compound(void) CHECK(ret, FAIL, "H5Sclose"); /* Close dataset transfer property list */ - ret = H5Pclose(xfer_pid); + ret = H5Pclose_list(xfer_pid); CHECK(ret, FAIL, "H5Pclose"); /* Close file */ @@ -441,7 +441,7 @@ test_vltypes_compound_vlen_atomic(void) CHECK(ret, FAIL, "H5Dwrite"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(xfer_pid, FAIL, "H5Pcreate"); ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); @@ -516,7 +516,7 @@ test_vltypes_compound_vlen_atomic(void) CHECK(ret, FAIL, "H5Sclose"); /* Close dataset transfer property list */ - ret = H5Pclose(xfer_pid); + ret = H5Pclose_list(xfer_pid); CHECK(ret, FAIL, "H5Pclose"); /* Close file */ @@ -658,7 +658,7 @@ test_vltypes_vlen_vlen_atomic(void) CHECK(dataset, FAIL, "H5Dopen"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid=H5Pcreate_list(H5P_DATASET_XFER_NEW); CHECK(xfer_pid, FAIL, "H5Pcreate"); ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); @@ -732,7 +732,7 @@ test_vltypes_vlen_vlen_atomic(void) CHECK(ret, FAIL, "H5Sclose"); /* Close dataset transfer property list */ - ret = H5Pclose(xfer_pid); + ret = H5Pclose_list(xfer_pid); CHECK(ret, FAIL, "H5Pclose"); /* Close file */ diff --git a/tools/h4toh5/h4toh5image.c b/tools/h4toh5/h4toh5image.c index 47c5363..b34f4af 100644 --- a/tools/h4toh5/h4toh5image.c +++ b/tools/h4toh5/h4toh5image.c @@ -322,7 +322,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in By default, we will compress HDF5 dataset by using gzip compression if HDF5 file is compressed. */ - write_plist = H5Pcreate(H5P_DATASET_XFER); + write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW); bufsize = h4memsize *h5dims[1]*ncomp; if(H5Pset_buffer(write_plist,bufsize,NULL,NULL)<0) { @@ -330,7 +330,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -343,7 +343,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -354,7 +354,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -364,7 +364,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -378,7 +378,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -388,7 +388,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -404,7 +404,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -414,7 +414,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -424,7 +424,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -434,7 +434,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -444,7 +444,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -454,7 +454,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } } @@ -465,7 +465,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -476,7 +476,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } @@ -486,7 +486,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); return FAIL; } ret = H5Tclose(h5_ctype); @@ -512,7 +512,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -523,7 +523,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(h5cimage_name); free(image_data); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -534,7 +534,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(h5cimage_name); free(image_data); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -549,7 +549,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in printf(" cannot obtain attributes. \n"); free(image_data); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -573,7 +573,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transpredattrs(h5dset,HDF4_OBJECT_TYPE,grlabel)==FAIL){ printf("error in getting hdf4 image type attribute \n"); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -585,7 +585,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transpredattrs(h5dset,HDF4_OBJECT_NAME,image_name)==FAIL){ printf("error in getting hdf4 image name attribute. \n"); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -596,7 +596,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transpredattrs(h5dset,HDF4_IMAGE_CLASS,image_class)==FAIL){ printf("error in getting hdf4 image class attribute. \n"); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -611,7 +611,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(gr_ref == 0) { printf("error in obtaining reference number of GR.\n"); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -622,7 +622,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transnumattr(h5dset,HDF4_REF_NUM,gr_ref)==FAIL) { printf("error in getting hdf4 image number attribute.\n"); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -635,7 +635,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(gr_palette(file_id,ri_id,h5dset,h5_palgroup,h4_attr)== FAIL) { printf("error in translating palette into h5 dataset.\n"); H5Pclose(create_plist); - H5Pclose(write_plist); + H5Pclose_list(write_plist); H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -644,7 +644,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in } ret = H5Pclose(create_plist); - ret = H5Pclose(write_plist); + ret = H5Pclose_list(write_plist); ret = H5Sclose(h5d_sid); ret = H5Dclose(h5dset); istat = GRendaccess(ri_id); diff --git a/tools/h4toh5/h4toh5sds.c b/tools/h4toh5/h4toh5sds.c index a4d9e3b..58bca68 100644 --- a/tools/h4toh5/h4toh5sds.c +++ b/tools/h4toh5/h4toh5sds.c @@ -420,7 +420,7 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int return FAIL; } - write_plist = H5Pcreate(H5P_DATASET_XFER); + write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW); bufsize = h4memsize; for(i=1;i