From a556665ad19e7a97ace5449673a26a4b581940b3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 11 Jun 1999 17:04:42 -0500 Subject: [svn-r1332] Fixes to get the VL datatypes working. The only function currently working is H5Tvlen_create(). --- src/H5D.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/H5Dpublic.h | 1 + src/H5R.c | 1 + src/H5T.c | 39 ++++++++++++++++++++++++++++++++++++ src/H5TB.c | 2 +- src/H5Tpkg.h | 3 +++ 6 files changed, 106 insertions(+), 2 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index d84a856..1739f47 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -929,7 +929,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, new_dset->layout.type = new_dset->create_parms->layout; new_dset->layout.ndims = H5S_get_simple_extent_ndims(space) + 1; assert((unsigned)(new_dset->layout.ndims) <= NELMTS(new_dset->layout.dim)); - new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size(type); + new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size(new_dset->type); switch (new_dset->create_parms->layout) { case H5D_CONTIGUOUS: @@ -1856,6 +1856,28 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, assert(xfer_parms); assert(buf); +#ifdef HAVE_PARALLEL + /* If MPIO is used, no VL datatype support yet. */ + /* This is because they use the global heap in the file and we don't */ + /* support parallel access of that yet */ + if (f->shared->access_parms->driver == H5F_LOW_MPIO && + H5T_get_class(mem_type)==H5T_VLEN) { + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, + "Parallel IO does not support writing VL datatypes yet"); + } +#endif +#ifdef HAVE_PARALLEL + /* If MPIO is used, no dataset region reference support yet. */ + /* This is because they use the global heap in the file and we don't */ + /* support parallel access of that yet */ + if (f->shared->access_parms->driver == H5F_LOW_MPIO && + H5T_get_class(mem_type)==H5T_REFERENCE && + H5R_get_ref_type(mem_type)==H5R_DATASET_REGION) { + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, + "Parallel IO does not support writing VL datatypes yet"); + } +#endif + /* 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)); @@ -2552,6 +2574,44 @@ H5D_get_storage_size(H5D_t *dset) /*------------------------------------------------------------------------- + * Function: H5Dvlen_reclaim + * + * Purpose: Frees the buffers allocated for storing variable-length data + * in memory. Only frees the VL data in the selection defined in the + * dataspace. The dataset transfer property list is required to find the + * correct allocation/free methods for the VL data in the buffer. + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Quincey Koziol + * Thursday, June 10, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) +{ + herr_t ret_value=FAIL; + + FUNC_ENTER(H5Dvlen_reclaim, FAIL); + + /* Check args */ + if (H5I_DATATYPE!=H5I_get_type(type_id) || + H5I_DATASPACE!=H5I_get_type(space_id) || + (H5I_TEMPLATE_0<=H5I_get_type(plist_id) && H5I_TEMPLATE_MAX>H5I_get_type(plist_id)) || + buf==NULL) { + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); + } + +/* Call H5Diterate with args, etc. */ + + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5Ddebug * * Purpose: Prints various information about a dataset. This function is diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 89caad6..74c6549 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -56,6 +56,7 @@ __DLL__ herr_t H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, __DLL__ herr_t H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf); __DLL__ herr_t H5Dextend (hid_t dset_id, const hsize_t *size); +__DLL__ herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf); __DLL__ herr_t H5Ddebug(hid_t dset_id, unsigned int flags); #ifdef __cplusplus diff --git a/src/H5R.c b/src/H5R.c index 6535ebf..bb4b869 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -741,3 +741,4 @@ H5Rget_object_type(hid_t dataset, void *_ref) done: FUNC_LEAVE(ret_value); } /* end H5Rget_object_type() */ + diff --git a/src/H5T.c b/src/H5T.c index 17c9739..696f4ff 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -3903,6 +3903,7 @@ H5Tvlen_create(hid_t base_id) if (NULL==(dt=H5MM_calloc(sizeof(H5T_t)))) { HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } + H5F_addr_undef (&(dt->ent.header)); dt->type = H5T_VLEN; dt->parent = H5T_copy(base, H5T_COPY_ALL); @@ -6942,3 +6943,41 @@ H5T_debug(H5T_t *dt, FILE *stream) FUNC_LEAVE(SUCCEED); } + +/*-------------------------------------------------------------------------- + NAME + H5R_get_ref_type + PURPOSE + Retrieves the type of reference for a datatype + USAGE + H5R_type_t H5Tget_ref_type(dt) + H5T_t *dt; IN: datatype pointer for the reference datatype + + RETURNS + Success: A reference type defined in H5Rpublic.h + Failure: H5R_BADTYPE + DESCRIPTION + Given a reference datatype object, this function returns the reference type + of the datatype. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +H5R_type_t +H5T_get_ref_type(H5T_t *dt) +{ + H5R_type_t ret_value = H5R_BADTYPE; + + FUNC_ENTER(H5T_get_ref_type, H5R_BADTYPE); + + assert(dt); + + if(dt->type==H5T_REFERENCE) + ret_value=dt->u.atomic.u.r.rtype; + +#ifdef LATER +done: +#endif /* LATER */ + FUNC_LEAVE(ret_value); +} /* end H5T_get_ref_type() */ diff --git a/src/H5TB.c b/src/H5TB.c index 2b401b1..88103c6 100644 --- a/src/H5TB.c +++ b/src/H5TB.c @@ -436,7 +436,7 @@ H5TB_resize_buf(hid_t tbuf_id, hsize_t size, void **ptr) if(ptr!=NULL) *ptr=tbuf->buf; - FUNC_LEAVE(ret_value); + FUNC_LEAVE(SUCCEED); } /* H5TB_resize_buf() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 3ceeeab..c3facc0 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -535,4 +535,7 @@ __DLL__ herr_t H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *_buf, size_t le __DLL__ herr_t H5T_vlen_disk_alloc(H5F_t *f, void *vl_addr, hsize_t seq_len, hsize_t base_size); __DLL__ herr_t H5T_vlen_disk_write(H5F_t *f, void *vl_addr, void *_buf, size_t len); +/* Reference specific functions */ +__DLL__ H5R_type_t H5T_get_ref_type(H5T_t *dt); + #endif -- cgit v0.12