From 8e27e7357506958128d087c4e93e3dcb4fb52ace Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 4 May 2021 19:01:23 -0700 Subject: Brings atom-->ID and other ID-related changes from develop --- MANIFEST | 2 + c++/src/H5PropList.cpp | 1 + java/src/jni/exceptionImp.c | 4 +- java/src/jni/h5Constants.c | 8 +- src/CMakeLists.txt | 2 + src/H5Aint.c | 27 +- src/H5CX.c | 2 +- src/H5Dchunk.c | 56 +- src/H5Dcompact.c | 6 +- src/H5Dcontig.c | 6 +- src/H5Dint.c | 21 +- src/H5Doh.c | 2 +- src/H5Dvirtual.c | 14 +- src/H5E.c | 54 +- src/H5FD.c | 24 +- src/H5FDcore.c | 33 +- src/H5FDfamily.c | 4 +- src/H5FDlog.h | 405 +++++- src/H5FDmpi.h | 8 +- src/H5FDmpio.h | 225 +++- src/H5FDmulti.h | 219 +++- src/H5FDros3.h | 14 +- src/H5FDsplitter.h | 14 +- src/H5FDstdio.h | 16 +- src/H5FDtest.c | 3 +- src/H5FDwindows.h | 30 + src/H5Fint.c | 14 +- src/H5Gdeprec.c | 2 +- src/H5Gint.c | 7 +- src/H5Goh.c | 2 +- src/H5Gtraverse.c | 11 +- src/H5I.c | 1878 +++------------------------ src/H5Idbg.c | 192 +++ src/H5Iint.c | 1744 +++++++++++++++++++++++++ src/H5Imodule.h | 2 +- src/H5Ipkg.h | 47 + src/H5Iprivate.h | 6 +- src/H5Ipublic.h | 752 ++++++++++- src/H5Itest.c | 10 +- src/H5Lexternal.c | 15 +- src/H5Oflush.c | 18 +- src/H5Oint.c | 49 +- src/H5P.c | 30 +- src/H5Pdapl.c | 96 +- src/H5Pdcpl.c | 130 +- src/H5Pdeprec.c | 8 +- src/H5Pdxpl.c | 71 +- src/H5Pencdec.c | 2 +- src/H5Pfapl.c | 96 +- src/H5Pfcpl.c | 115 +- src/H5Pfmpl.c | 14 +- src/H5Pgcpl.c | 18 +- src/H5Pint.c | 22 +- src/H5Plapl.c | 40 +- src/H5Plcpl.c | 18 +- src/H5Pmapl.c | 8 +- src/H5Pmodule.h | 5 +- src/H5Pocpl.c | 125 +- src/H5Pocpypl.c | 18 +- src/H5Pstrcpl.c | 6 +- src/H5Ptest.c | 6 +- src/H5S.c | 26 +- src/H5Sall.c | 2 +- src/H5Sdbg.c | 1 - src/H5Sdeprec.c | 1 - src/H5Shyper.c | 54 +- src/H5Sselect.c | 26 +- src/H5T.c | 66 +- src/H5Toh.c | 2 +- src/H5VLint.c | 4 +- src/H5VLnative_file.c | 4 +- src/H5Z.c | 8 +- src/H5Znbit.c | 22 +- src/H5Zscaleoffset.c | 8 +- src/H5Zshuffle.c | 22 +- src/H5Zszip.c | 10 +- src/H5err.txt | 18 +- src/Makefile.am | 2 +- test/tid.c | 382 ++++-- tools/test/h5dump/errfiles/tall-1.err | 2 +- tools/test/h5dump/errfiles/tall-2A.err | 2 +- tools/test/h5dump/errfiles/tall-2A0.err | 2 +- tools/test/h5dump/errfiles/tall-2B.err | 2 +- tools/test/h5dump/errfiles/textlink.err | 4 +- tools/test/h5dump/errfiles/textlinkfar.err | 18 +- tools/test/h5dump/errfiles/textlinksrc.err | 18 +- tools/test/h5dump/errfiles/torderlinks1.err | 2 +- tools/test/h5dump/errfiles/torderlinks2.err | 2 +- 88 files changed, 4699 insertions(+), 2788 deletions(-) create mode 100644 src/H5Idbg.c create mode 100644 src/H5Iint.c diff --git a/MANIFEST b/MANIFEST index bb3a15a..da0f66c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -897,6 +897,8 @@ ./src/H5HP.c ./src/H5HPprivate.h ./src/H5I.c +./src/H5Idbg.c +./src/H5Iint.c ./src/H5Imodule.h ./src/H5Ipkg.h ./src/H5Iprivate.h diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 3df403b..8b45f79 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -154,6 +154,7 @@ PropList::PropList(const hid_t plist_id) : IdComponent() case H5I_UNINIT: case H5I_MAP: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: default: id = H5P_DEFAULT; break; diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c index e62caee..6e08023 100644 --- a/java/src/jni/exceptionImp.c +++ b/java/src/jni/exceptionImp.c @@ -442,8 +442,8 @@ defineHDF5LibraryException(hid_t maj_num) return "hdf/hdf5lib/exceptions/HDF5LowLevelIOException"; else if (H5E_FUNC == err_num) return "hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException"; - else if (H5E_ATOM == err_num) - return "hdf/hdf5lib/exceptions/HDF5AtomException"; + else if (H5E_ID == err_num) + return "hdf/hdf5lib/exceptions/HDF5IdException"; else if (H5E_CACHE == err_num) return "hdf/hdf5lib/exceptions/HDF5MetaDataCacheException"; else if (H5E_BTREE == err_num) diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 7c6405d..4b9a276 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -330,9 +330,9 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1ARGS(JNIEnv *env, jclass cls) return H5E_ARGS; } JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5E_1ATOM(JNIEnv *env, jclass cls) +Java_hdf_hdf5lib_HDF5Constants_H5E_1ID(JNIEnv *env, jclass cls) { - return H5E_ATOM; + return H5E_ID; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ATTR(JNIEnv *env, jclass cls) @@ -340,9 +340,9 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1ATTR(JNIEnv *env, jclass cls) return H5E_ATTR; } JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5E_1BADATOM(JNIEnv *env, jclass cls) +Java_hdf_hdf5lib_HDF5Constants_H5E_1BADID(JNIEnv *env, jclass cls) { - return H5E_BADATOM; + return H5E_BADID; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADFILE(JNIEnv *env, jclass cls) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5dee0f3..a364452 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -385,6 +385,8 @@ IDE_GENERATED_PROPERTIES ("H5HP" "${H5HP_HDRS}" "${H5HP_SOURCES}" ) set (H5I_SOURCES ${HDF5_SRC_DIR}/H5I.c + ${HDF5_SRC_DIR}/H5Idbg.c + ${HDF5_SRC_DIR}/H5Iint.c ${HDF5_SRC_DIR}/H5Itest.c ) set (H5I_HDRS diff --git a/src/H5Aint.c b/src/H5Aint.c index f323494..9bbf031 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -14,8 +14,8 @@ /*------------------------------------------------------------------------- * * Created: H5Aint.c - * Dec 18 2006 - * Quincey Koziol + * Dec 18 2006 + * Quincey Koziol * * Purpose: Internal routines for managing attributes. * @@ -589,7 +589,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) hssize_t snelmts; /* elements in attribute */ size_t nelmts; /* elements in attribute*/ H5T_path_t *tpath = NULL; /* type conversion info */ - hid_t src_id = -1, dst_id = -1; /* temporary type atoms*/ + hid_t src_id = -1, dst_id = -1; /* temporary type IDs*/ size_t src_type_size; /* size of source type */ size_t dst_type_size; /* size of destination type */ size_t buf_size; /* desired buffer size */ @@ -698,7 +698,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) hssize_t snelmts; /* elements in attribute */ size_t nelmts; /* elements in attribute */ H5T_path_t *tpath = NULL; /* conversion information*/ - hid_t src_id = -1, dst_id = -1; /* temporary type atoms */ + hid_t src_id = -1, dst_id = -1; /* temporary type IDs */ size_t src_type_size; /* size of source type */ size_t dst_type_size; /* size of destination type*/ size_t buf_size; /* desired buffer size */ @@ -856,9 +856,9 @@ H5A_get_space(H5A_t *attr) if (NULL == (ds = H5S_copy(attr->shared->ds, FALSE, TRUE))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") done: if (H5I_INVALID_HID == ret_value && ds && H5S_close(ds) < 0) @@ -906,18 +906,18 @@ H5A__get_type(H5A_t *attr) if (H5T_lock(dt, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype") - /* Atomize */ + /* Register */ if (H5T_is_named(dt)) { /* If this is a committed datatype, we need to recreate the * two level IDs, where the VOL object is a copy of the * returned datatype */ if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") } else { if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") } done: @@ -2189,10 +2189,10 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace") - /* Atomize */ + /* Register */ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { H5S_close(buf_space); - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, NULL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, NULL, "unable to register dataspace ID") } /* end if */ /* Allocate memory for recclaim buf */ @@ -2380,7 +2380,6 @@ done: * Failure: Negative * * Programmer: Peter Cao - * xcao@hdfgroup.org * July 20, 2007 * *------------------------------------------------------------------------- @@ -2498,7 +2497,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na FUNC_ENTER_PACKAGE /* Avoid thrashing things if the names are the same */ - if (HDstrcmp(old_attr_name, new_attr_name)) { + if (HDstrcmp(old_attr_name, new_attr_name) != 0) { /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; @@ -2601,7 +2600,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 /* Get an ID for the object */ if ((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype"); /* Call internal attribute iteration routine */ if ((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) diff --git a/src/H5CX.c b/src/H5CX.c index cff06f6..c304548 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -1371,7 +1371,7 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, /* Get the plist structure for the access property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADID, FAIL, "can't find object for ID") /* Get the collective metadata read flag */ if (H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &md_coll_read) < 0) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 5783a72..1ca6e9f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, April 24, 2008 * * Purpose: Abstract indexed (chunked) I/O functions. The logical @@ -278,25 +278,23 @@ static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chun hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); -/* format convert cb */ +/* Format convert cb */ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); /* Helper routines */ -static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, - const hsize_t *max_dims); -static void * H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); -static void * H5D__chunk_mem_xfree(void *chk, const void *pline); -static void * H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline); -static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); -static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *udata); -static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udata); -static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata); -static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); -static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); -static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); - -static herr_t H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm); - +static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, + const hsize_t *max_dims); +static void * H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); +static void * H5D__chunk_mem_xfree(void *chk, const void *pline); +static void * H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline); +static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); +static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *udata); +static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udata); +static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata); +static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); +static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); +static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); +static herr_t H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm); static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm); static herr_t H5D__chunk_file_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords, void *fm); @@ -319,6 +317,7 @@ static herr_t H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_ static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2); #endif /* H5_HAVE_PARALLEL */ +/* Debugging helper routine callback */ static int H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); /*********************/ @@ -917,7 +916,7 @@ H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id) H5D_CHUNK_STORAGE_INDEX_CHK(sc); if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for fapl ID") /* Use the properties in dapl_id if they have been set, otherwise use the properties from the file */ if (H5P_get(dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc->nslots) < 0) @@ -3605,10 +3604,10 @@ H5D__chunk_cache_prune(const H5D_t *dset, size_t size) { const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); size_t total = rdcc->nbytes_max; - const int nmeth = 2; /*number of methods */ - int w[1]; /*weighting as an interval */ - H5D_rdcc_ent_t * p[2], *cur; /*list pointers */ - H5D_rdcc_ent_t * n[2]; /*list next pointers */ + const int nmeth = 2; /* Number of methods */ + int w[1]; /* Weighting as an interval */ + H5D_rdcc_ent_t * p[2], *cur; /* List pointers */ + H5D_rdcc_ent_t * n[2]; /* List next pointers */ int nerrors = 0; /* Accumulated error count during preemptions */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4546,9 +4545,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ - if (H5D_CHUNK_IDX_NONE != sc->idx_type) { + if (H5D_CHUNK_IDX_NONE != sc->idx_type) HDassert(!H5F_addr_defined(udata.chunk_block.offset)); - } /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -5122,8 +5120,8 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2) * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * March 26, 2002 + * Programmer: Pedro Vicente + * March 26, 2002 * *------------------------------------------------------------------------- */ @@ -5244,7 +5242,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * Algorithm: Robb Matzke * March 27, 2002 * @@ -6338,10 +6336,10 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") - /* Atomize */ + /* Register */ if ((sid_buf = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { (void)H5S_close(buf_space); - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* end if */ /* Set initial buffer sizes */ diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 7d11b61..fe41298 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * August 5, 2002 * * Purpose: Compact dataset I/O functions. These routines are similar @@ -493,10 +493,10 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") - /* Atomize */ + /* Register */ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { H5S_close(buf_space); - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* end if */ /* Allocate memory for recclaim buf */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index ed4ac93..4dc6f72 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: @@ -1414,10 +1414,10 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f if (NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") - /* Atomize */ + /* Register */ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { H5S_close(buf_space); - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* end if */ /* Set flag to do type conversion */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 781e36d..e146068 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -191,7 +191,7 @@ H5D__init_package(void) FUNC_ENTER_PACKAGE - /* Initialize the atom group for the dataset IDs */ + /* Initialize the ID group for the dataset IDs */ if (H5I_register_type(H5I_DATASET_CLS) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface") @@ -343,11 +343,6 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); done: - /* XXX: (MSC) Weird thing for datasets and filters: - * Always decrement the ref count on the VOL for datasets, since - * the ID is removed even if the close fails. - */ - /* Free the VOL object */ if (H5VL_free_object(dset_vol_obj) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object"); @@ -1004,7 +999,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) if (TRUE == use_minimized_header) { if (H5D__prepare_minimized_oh(file, dset, oloc) == FAIL) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header") - } + } /* end if */ else { /* Add the dataset's raw data size to the size of the header, if the * raw data will be stored as compact @@ -1668,7 +1663,7 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) /* Get dataset access property list */ if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for dapl ID"); /* Check if append flush property exists */ if (H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) { @@ -3863,9 +3858,9 @@ H5D__get_space(const H5D_t *dset) if (NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") - /* Create an atom */ + /* Create an ID */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace") done: if (ret_value < 0) @@ -3910,17 +3905,17 @@ H5D__get_type(const H5D_t *dset) if (H5T_lock(dt, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype") - /* Create an atom */ + /* Create an ID */ if (H5T_is_named(dt)) { /* If this is a committed datatype, we need to recreate the * two-level IDs, where the VOL object is a copy of the * returned datatype. */ if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype") } /* end if */ else if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype") done: if (ret_value < 0) diff --git a/src/H5Doh.c b/src/H5Doh.c index f6245d5..a991831 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -328,7 +328,7 @@ H5O__dset_get_oloc(hid_t obj_id) /* Get the dataset */ if (NULL == (dset = (H5D_t *)H5VL_object(obj_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID") /* Get the dataset's object header location */ if (NULL == (ret_value = H5D_oloc(dset))) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 5f3d45e..235665f 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Wednesday, January 28, 2015 * * Purpose: @@ -395,8 +395,8 @@ done: * Purpose: Store virtual dataset layout information, for new dataset * * Note: We assume here that the contents of the heap block cannot - * change! If this ever stops being the case we must change - * this code to allow overwrites of the heap block. -NAF + * change! If this ever stops being the case we must change + * this code to allow overwrites of the heap block. -NAF * * Return: Success: SUCCEED * Failure: FAIL @@ -895,7 +895,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir HDassert(source_dset->dset_name); /* Check if we need to open the source file */ - if (HDstrcmp(source_dset->file_name, ".")) { + if (HDstrcmp(source_dset->file_name, ".") != 0) { unsigned intent; /* File access permissions */ /* Get the virtual dataset's file open flags ("intent") */ @@ -2228,7 +2228,7 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) /* Get dataset access property list */ if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for dapl ID") /* Get view option */ if (H5P_get(dapl, H5D_ACS_VDS_VIEW_NAME, &storage->view) < 0) @@ -2277,7 +2277,7 @@ done: hbool_t H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2361,7 +2361,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, cons hssize_t select_nelmts; /* Number of elements in selection */ hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */ hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */ - int rank; + int rank = 0; hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */ size_t i, j, k; /* Local index variables */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5E.c b/src/H5E.c index 7fc4559..0f0c511 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -181,17 +181,17 @@ H5E__init_package(void) FUNC_ENTER_PACKAGE - /* Initialize the atom group for the error class IDs */ + /* Initialize the ID group for the error class IDs */ if (H5I_register_type(H5I_ERRCLS_CLS) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") - /* Initialize the atom group for the major error IDs */ + /* Initialize the ID group for the major error IDs */ if (H5I_register_type(H5I_ERRMSG_CLS) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") - /* Initialize the atom group for the error stacks */ + /* Initialize the ID group for the error stacks */ if (H5I_register_type(H5I_ERRSTK_CLS) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") #ifndef H5_HAVE_THREADSAFE H5E_stack_g[0].nused = 0; @@ -837,13 +837,13 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size) +H5Eget_msg(hid_t msg_id, H5E_type_t *type /*out*/, char *msg_str /*out*/, size_t size) { H5E_msg_t *msg; /* Pointer to error message */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API_NOCLEAR((-1)) - H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size); + H5TRACE4("Zs", "ixxz", msg_id, type, msg_str, size); /* Get the message object */ if (NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG))) @@ -1014,9 +1014,9 @@ done: * Purpose: Replaces current stack with specified stack. This closes the * stack ID also. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 15, 2003 * *------------------------------------------------------------------------- @@ -1119,9 +1119,9 @@ done: * * Purpose: Closes an error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 14, 2003 * *------------------------------------------------------------------------- @@ -1254,9 +1254,9 @@ H5E__get_num(const H5E_t *estack) * * Purpose: Deletes some error messages from the top of error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1309,9 +1309,9 @@ done: * function name, file name, and error description strings must * be statically allocated. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, October 18, 1999 * * Notes: Basically a new public API wrapper around the H5E__push_stack @@ -1409,9 +1409,9 @@ done: * * Purpose: Clears the error stack for the specified error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1453,9 +1453,9 @@ done: * prints error messages. Users are encouraged to write their * own more specific error handlers. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1498,9 +1498,9 @@ done: * Purpose: Walks the error stack for the current thread and calls some * function for each error along the way. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1548,7 +1548,7 @@ done: * Either (or both) arguments may be null in which case the * value is not returned. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Robb Matzke * Saturday, February 28, 1998 @@ -1556,14 +1556,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) +H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*out*/) { H5E_t * estack; /* Error stack to operate on */ H5E_auto_op_t op; /* Error stack function */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*EA**x", estack_id, func, client_data); + H5TRACE3("e", "ixx", estack_id, func, client_data); if (estack_id == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in @@ -1605,7 +1605,7 @@ done: * Automatic stack traversal is always in the H5E_WALK_DOWNWARD * direction. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1663,7 +1663,7 @@ done: * or the H5E_auto_t typedef. The IS_STACK parameter is set * to 1 for the first case and 0 for the latter case. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Quincey Koziol * Wednesday, September 8, 2004 diff --git a/src/H5FD.c b/src/H5FD.c index 1e9274f..a802cc6 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -248,7 +248,7 @@ H5FDregister(const H5FD_class_t *cls) /* Create the new class ID */ if ((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: FUNC_LEAVE_API(ret_value) @@ -298,7 +298,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) /* Create the new class ID */ if ((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: if (H5I_INVALID_HID == ret_value) @@ -371,7 +371,7 @@ H5FD_get_class(hid_t id) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID") if (TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ @@ -504,9 +504,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. */ - if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family")) + if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used") - if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi")) + if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used") /* Decode driver information */ @@ -1715,7 +1715,7 @@ H5FDlock(H5FD_t *file, hbool_t rw) /* Call private function */ if (H5FD_lock(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "file lock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1743,7 +1743,7 @@ H5FD_lock(H5FD_t *file, hbool_t rw) /* Dispatch to driver */ if (file->cls->lock && (file->cls->lock)(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "driver lock request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1774,7 +1774,7 @@ H5FDunlock(H5FD_t *file) /* Call private function */ if (H5FD_unlock(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "file unlock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1802,7 +1802,7 @@ H5FD_unlock(H5FD_t *file) /* Dispatch to driver */ if (file->cls->unlock && (file->cls->unlock)(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "driver unlock request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1845,12 +1845,12 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) *-------------------------------------------------------------------------- */ herr_t -H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) +H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle /*out*/) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*#i**x", file, fapl_id, file_handle); + H5TRACE3("e", "*#ix", file, fapl_id, file_handle); /* Check arguments */ if (!file) @@ -2000,7 +2000,7 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/) /* Check for the driver to query and then query it */ if (NULL == (driver = (H5FD_class_t *)H5I_object_verify(driver_id, H5I_VFL))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a VFL ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a VFL ID") if (H5FD_driver_query(driver, flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "driver flag query failed") diff --git a/src/H5FDcore.c b/src/H5FDcore.c index b50f71a..8af5065 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -523,7 +523,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") if (H5FD_CORE != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") if (NULL == (old_fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) @@ -558,18 +558,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_size) +H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled /*out*/, size_t *page_size /*out*/) { H5P_genplist_t * plist; /* Property list pointer */ const H5FD_core_fapl_t *fa; /* Core VFD info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*b*z", plist_id, is_enabled, page_size); + H5TRACE3("e", "ixx", plist_id, is_enabled, page_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") if (H5FD_CORE != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) @@ -1131,23 +1131,24 @@ H5FD__core_query(const H5FD_t *_file, unsigned long *flags /* out */) FUNC_ENTER_STATIC_NOERR + /* clang-format off */ /* Set the VFL feature flags that this driver supports */ - if (flags) { + if(flags) { *flags = 0; - *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ - *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ - *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ - *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */ - *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */ + *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */ + *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */ /* These feature flags are only applicable if the backing store is enabled */ - if (file && file->fd >= 0 && file->backing_store) { - *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE; /* get_handle callback returns a POSIX file descriptor */ - *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the - default VFD */ + if(file && file->fd >= 0 && file->backing_store) { + *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE; /* get_handle callback returns a POSIX file descriptor */ + *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */ } } /* end if */ + /* clang-format on */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__core_query() */ @@ -1525,7 +1526,7 @@ done: * If we are not closing, we realloc the buffer to size equal * to the smallest multiple of the allocation increment that * equals or exceeds the eoa and set the eof accordingly. - * Note that we no longer truncate the backing store to the + * Note that we no longer truncate the backing store to the * new eof if applicable. * -- JRM * diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index d09d25e..9ffecf9 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -1055,12 +1055,12 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) /* Get the plist structure and family offset */ if (NULL == (plist = H5P_object_verify(fapl, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get offset for family driver") if (offset > (file->memb_size * file->nmembs)) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "offset is bigger than file size") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "offset is bigger than file size") memb = (int)(offset / file->memb_size); ret_value = H5FD_get_vfd_handle(file->memb[memb], fapl, file_handle); diff --git a/src/H5FDlog.h b/src/H5FDlog.h index aa1f3cb..969c091 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -65,7 +65,410 @@ extern "C" { #endif -H5_DLL hid_t H5FD_log_init(void); +H5_DLL hid_t H5FD_log_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up the logging virtual file driver (#H5FD_LOG) for use + * + * \fapl_id + * \param[in] logfile Name of the log file + * \param[in] flags Flags specifying the types of logging activity + * \param[in] buf_size The size of the logging buffers, in bytes (see description) + * \returns \herr_t + * + * \details H5Pset_fapl_log() modifies the file access property list to use the + * logging driver, #H5FD_LOG. The logging virtual file driver (VFD) is + * a clone of the standard SEC2 (#H5FD_SEC2) driver with additional + * facilities for logging VFD metrics and activity to a file. + * + * \p logfile is the name of the file in which the logging entries are + * to be recorded. + * + * The actions to be logged are specified in the parameter \p flags + * using the pre-defined constants described in the following + * table. Multiple flags can be set through the use of a logical \c OR + * contained in parentheses. For example, logging read and write + * locations would be specified as + * \Code{(H5FD_LOG_LOC_READ|H5FD_LOG_LOC_WRITE)}. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table1: Logging Flags
+ * #H5FD_LOG_LOC_READ + * + * Track the location and length of every read, write, or seek operation. + *
#H5FD_LOG_LOC_WRITE
#H5FD_LOG_LOC_SEEK
+ * #H5FD_LOG_LOC_IO + * + * Track all I/O locations and lengths. The logical equivalent of the following: + * \Code{(#H5FD_LOG_LOC_READ | #H5FD_LOG_LOC_WRITE | #H5FD_LOG_LOC_SEEK)} + *
+ * #H5FD_LOG_FILE_READ + * + * Track the number of times each byte is read or written. + *
#H5FD_LOG_FILE_WRITE
+ * #H5FD_LOG_FILE_IO + * + * Track the number of times each byte is read and written. The logical + * equivalent of the following: + * \Code{(#H5FD_LOG_FILE_READ | #H5FD_LOG_FILE_WRITE)} + *
+ * #H5FD_LOG_FLAVOR + * + * Track the type, or flavor, of information stored at each byte. + *
+ * #H5FD_LOG_NUM_READ + * + * Track the total number of read, write, seek, or truncate operations that occur. + *
#H5FD_LOG_NUM_WRITE
#H5FD_LOG_NUM_SEEK
#H5FD_LOG_NUM_TRUNCATE
+ * #H5FD_LOG_NUM_IO + * + * Track the total number of all types of I/O operations. The logical equivalent + * of the following: + * \Code{(#H5FD_LOG_NUM_READ | #H5FD_LOG_NUM_WRITE | #H5FD_LOG_NUM_SEEK | #H5FD_LOG_NUM_TRUNCATE)} + *
+ * #H5FD_LOG_TIME_OPEN + * + * Track the time spent in open, stat, read, write, seek, or close operations. + *
#H5FD_LOG_TIME_STAT
#H5FD_LOG_TIME_READ
#H5FD_LOG_TIME_WRITE
#H5FD_LOG_TIME_SEEK
#H5FD_LOG_TIME_CLOSE
+ * #H5FD_LOG_TIME_IO + * + * Track the time spent in each of the above operations. The logical equivalent + * of the following: + * \Code{(#H5FD_LOG_TIME_OPEN | #H5FD_LOG_TIME_STAT | #H5FD_LOG_TIME_READ | #H5FD_LOG_TIME_WRITE | + * #H5FD_LOG_TIME_SEEK | #H5FD_LOG_TIME_CLOSE)} + *
+ * #H5FD_LOG_ALLOC + * + * Track the allocation of space in the file. + *
+ * #H5FD_LOG_ALL + * + * Track everything. The logical equivalent of the following: + * \Code{(#H5FD_LOG_ALLOC | #H5FD_LOG_TIME_IO | #H5FD_LOG_NUM_IO | #H5FD_LOG_FLAVOR | #H5FD_LOG_FILE_IO | + * #H5FD_LOG_LOC_IO)} + *
+ * The logging driver can track the number of times each byte in the file is + * read from or written to (using #H5FD_LOG_FILE_READ and #H5FD_LOG_FILE_WRITE) + * and what kind of data is at that location (e.g., metadata, raw data; using + * #H5FD_LOG_FLAVOR). This information is tracked in internal buffers of size + * buf_size, which must be at least the maximum size in bytes of the file to be + * logged while the log driver is in use.\n + * One buffer of size buf_size will be created for each of #H5FD_LOG_FILE_READ, + * #H5FD_LOG_FILE_WRITE and #H5FD_LOG_FLAVOR when those flags are set; these + * buffers will not grow as the file increases in size. + * + * \par Output: + * This section describes the logging driver (LOG VFD) output.\n + * The table, immediately below, describes output of the various logging driver + * flags and function calls. A list of valid flavor values, describing the type + * of data stored, follows the table. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table2: Logging Output
FlagVFD CallOutput and Comments
#H5FD_LOG_LOC_READRead + * \Code{%10a-%10a (%10Zu bytes) (%s) Read}\n\n + * Start position\n + * End position\n + * Number of bytes\n + * Flavor of read\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + *
#H5FD_LOG_LOC_READRead Error + * \Code{Error! Reading: %10a-%10a (%10Zu bytes)}\n\n + * Same parameters as non-error entry. + *
#H5FD_LOG_LOC_WRITEWrite + * \Code{%10a-%10a (%10Zu bytes) (%s) Written}\n\n + * Start position\n + * End position\n + * Number of bytes\n + * Flavor of write\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + *
#H5FD_LOG_LOC_WRITEWrite Error + * \Code{Error! Writing: %10a-%10a (%10Zu bytes)}\n\n + * Same parameters as non-error entry. + *
#H5FD_LOG_LOC_SEEKRead, Write + * \Code{Seek: From %10a-%10a}\n\n + * Start position\n + * End position\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + *
#H5FD_LOG_FILE_READClose + * Begins with:\n + * Dumping read I/O information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) read from %3d times}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Number of times read\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + *
#H5FD_LOG_FILE_WRITEClose + * Begins with:\n + * Dumping read I/O information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) written to %3d times}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Number of times written\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + *
#H5FD_LOG_FLAVORClose + * Begins with:\n + * Dumping I/O flavor information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) flavor is %s}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Flavor\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + *
#H5FD_LOG_NUM_READClose + * Total number of read operations: \Code{%11u} + *
#H5FD_LOG_NUM_WRITEClose + * Total number of write operations: \Code{%11u} + *
#H5FD_LOG_NUM_SEEKClose + * Total number of seek operations: \Code{%11u} + *
#H5FD_LOG_NUM_TRUNCATEClose + * Total number of truncate operations: \Code{%11u} + *
#H5FD_LOG_TIME_OPENOpen + * Open took: \Code{(\%f s)} + *
#H5FD_LOG_TIME_READClose, Read + * Total time in read operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_READ + *
#H5FD_LOG_TIME_WRITEClose, Write + * Total time in write operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_WRITE + *
#H5FD_LOG_TIME_SEEKClose, Read, Write + * Total time in write operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_SEEK or #H5FD_LOG_LOC_WRITE + *
#H5FD_LOG_TIME_CLOSEClose + * Close took: \Code{(\%f s)} + *
#H5FD_LOG_TIME_STATOpen + * Stat took: \Code{(\%f s)} + *
#H5FD_LOG_ALLOCAlloc + * \Code{%10-%10 (%10Hu bytes) (\%s) Allocated}\n\n + * Start of address space\n + * End of address space\n + * Total size allocation\n + * Flavor of allocation + *
+ * + * \par Flavors: + * The \Emph{flavor} describes the type of stored information. The following + * table lists the flavors that appear in log output and briefly describes each. + * These terms are provided here to aid in the construction of log message + * parsers; a full description is beyond the scope of this document. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table3: Flavors of logged data
FlavorDescription
#H5FD_MEM_NOLISTError value
#H5FD_MEM_DEFAULTValue not yet set.\n + * May also be a datatype set in a larger allocation that will be + * suballocated by the library.
#H5FD_MEM_SUPERSuperblock data
#H5FD_MEM_BTREEB-tree data
#H5FD_MEM_DRAWRaw data (for example, contents of a dataset)
#H5FD_MEM_GHEAPGlobal heap data
#H5FD_MEM_LHEAPLocal heap data
#H5FD_MEM_OHDRObject header data
+ * + * \version 1.8.7 The flags parameter has been changed from \Code{unsigned int} + * to \Code{unsigned long long}. + * The implementation of the #H5FD_LOG_TIME_OPEN, #H5FD_LOG_TIME_READ, + * #H5FD_LOG_TIME_WRITE, and #H5FD_LOG_TIME_SEEK flags has been finished. + * New flags were added: #H5FD_LOG_NUM_TRUNCATE and #H5FD_LOG_TIME_STAT. + * \version 1.6.0 The \c verbosity parameter has been removed. + * Two new parameters have been added: \p flags of type \Code{unsigned} and + * \p buf_size of type \Code{size_t}. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, size_t buf_size); #ifdef __cplusplus diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index 3af5e41..cf49301 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -34,10 +34,12 @@ */ #define H5D_MULTI_CHUNK_IO_COL_THRESHOLD 60 -/* Type of I/O for data transfer properties */ +/** + * Type of I/O for data transfer properties + */ typedef enum H5FD_mpio_xfer_t { - H5FD_MPIO_INDEPENDENT = 0, /*zero is the default*/ - H5FD_MPIO_COLLECTIVE + H5FD_MPIO_INDEPENDENT = 0, /**< Use independent I/O access */ + H5FD_MPIO_COLLECTIVE /**< Use collective I/O access */ } H5FD_mpio_xfer_t; /* Type of chunked dataset I/O */ diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 79b52c7..8caf11c 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -44,14 +44,237 @@ H5_DLLVAR hbool_t H5FD_mpi_opt_types_g; #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_mpio_init(void); +H5_DLL hid_t H5FD_mpio_init(void); + +/** + * \ingroup FAPL + * + * \brief Stores MPI IO communicator information to the file access property list + * + * \fapl_id + * \param[in] comm MPI-2 communicator + * \param[in] info MPI-2 info object + * \returns \herr_t + * + * \details H5Pset_fapl_mpio() stores the user-supplied MPI IO parameters \p + * comm, for communicator, and \p info, for information, in the file + * access property list \p fapl_id. That property list can then be used + * to create and/or open a file. + * + * H5Pset_fapl_mpio() is available only in the parallel HDF5 library + * and is not a collective function. + * + * \p comm is the MPI communicator to be used for file open, as defined + * in \c MPI_File_open of MPI-2. This function makes a duplicate of the + * communicator, so modifications to \p comm after this function call + * returns have no effect on the file access property list. + * + * \p info is the MPI Info object to be used for file open, as defined + * in MPI_File_open() of MPI-2. This function makes a duplicate copy of + * the Info object, so modifications to the Info object after this + * function call returns will have no effect on the file access + * property list. + * + * If the file access property list already contains previously-set + * communicator and Info values, those values will be replaced and the + * old communicator and Info object will be freed. + * + * \note Raw dataset chunk caching is not currently supported when using this + * file driver in read/write mode. All calls to H5Dread() and H5Dwrite() + * will access the disk directly, and H5Pset_cache() and + * H5Pset_chunk_cache() will have no effect on performance.\n + * Raw dataset chunk caching is supported when this driver is used in + * read-only mode. + * + * \version 1.4.5 Handling of the MPI Communicator and Info object changed at + * this release. A duplicate of each of these is now stored in the property + * list instead of pointers to each. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info); + +/** + * \ingroup FAPL + * + * \brief Returns MPI IO communicator information + * + * \fapl_id + * \param[out] comm MPI-2 communicator + * \param[out] info MPI-2 info object + * \returns \herr_t + * + * \details If the file access property list is set to the #H5FD_MPIO driver, + * H5Pget_fapl_mpio() returns duplicates of the stored MPI communicator + * and Info object through the \p comm and \p info pointers, if those + * values are non-null. + * + * Since the MPI communicator and Info object are duplicates of the + * stored information, future modifications to the access property list + * will not affect them. It is the responsibility of the application to + * free these objects. + * + * \version 1.4.5 Handling of the MPI Communicator and Info object changed at + * this release. A duplicate of each of these is now stored in the + * property list instead of pointers to each. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/); + +/** + * \ingroup DXPL + * + * \brief Sets data transfer mode + * + * \dxpl_id + * \param[in] xfer_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id + * to use transfer mode \p xfer_mode. The property list can then be + * used to control the I/O transfer mode during data I/O operations. + * + * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and + * #H5FD_MPIO_COLLECTIVE. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode); + +/** + * \ingroup DXPL + * + * \brief Returns the data transfer mode + * + * \dxpl_id + * \param[out] xfer_mode Transfer mode + * \returns \herr_t + * + * \details H5Pget_dxpl_mpio() queries the data transfer mode currently set in + * the data transfer property list \p dxpl_id. + * + * Upon return, \p xfer_mode contains the data transfer mode, if it is + * non-null. + * + * H5Pget_dxpl_mpio() is not a collective function. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/); + +/** + * \ingroup DXPL + * + * \brief Sets data transfer mode + * + * \dxpl_id + * \param[in] opt_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id + * to use transfer mode xfer_mode. The property list can then be used + * to control the I/O transfer mode during data I/O operations. + * + * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and + * #H5FD_MPIO_COLLECTIVE. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode); + +/** + * \ingroup DXPL + * + * \brief Sets a flag specifying linked-chunk I/O or multi-chunk I/O + * + * \dxpl_id + * \param[in] opt_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt() specifies whether I/O is to be + * performed as linked-chunk I/O or as multi-chunk I/O. This function + * overrides the HDF5 library's internal algorithm for determining + * which mechanism to use. + * + * When an application uses collective I/O with chunked storage, the + * HDF5 library normally uses an internal algorithm to determine + * whether that I/O activity should be conducted as one linked-chunk + * I/O or as multi-chunk I/O. H5Pset_dxpl_mpio_chunk_opt() is provided + * so that an application can override the library's algorithm in + * circumstances where the library might lack the information needed to + * make an optimal decision. + * + * H5Pset_dxpl_mpio_chunk_opt() works by setting one of the following + * flags in the parameter \p opt_mode: + * - #H5FD_MPIO_CHUNK_ONE_IO - Do one-link chunked I/O + * - #H5FD_MPIO_CHUNK_MULTI_IO - Do multi-chunked I/O + * + * This function works by setting a corresponding property in the + * dataset transfer property list \p dxpl_id. + * + * The library performs I/O in the specified manner unless it + * determines that the low-level MPI IO package does not support the + * requested behavior; in such cases, the HDF5 library will internally + * use independent I/O. + * + * Use of this function is optional. + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode); + +/** + * \ingroup DXPL + * + * \brief Sets a numeric threshold for linked-chunk I/O + * + * \dxpl_id + * \param[in] num_chunk_per_proc + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt_num() sets a numeric threshold for the + * use of linked-chunk I/O. + * + * The library will calculate the average number of chunks selected by + * each process when doing collective access with chunked storage. If + * the number is greater than the threshold set in \p + * num_chunk_per_proc, the library will use linked-chunk I/O; + * otherwise, a separate I/O process will be invoked for each chunk + * (multi-chunk I/O). + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc); + +/** + * \ingroup DXPL + * + * \brief Sets a ratio threshold for collective I/O + * + * \dxpl_id + * \param[in] percent_num_proc_per_chunk + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt_ratio() sets a threshold for the use of + * collective I/O based on the ratio of processes with collective + * access to a dataset with chunked storage. The decision whether to + * use collective I/O is made on a per-chunk basis. + * + * The library will calculate the percentage of the total number of + * processes, the ratio, that hold selections in each chunk. If that + * percentage is greater than the threshold set in \p + * percent_proc_per_chunk, the library will do collective I/O for this + * chunk; otherwise, independent I/O will be done for the chunk. + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_chunk); #ifdef __cplusplus } diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 9e04d8d..62cc9c8 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -25,11 +25,228 @@ #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_multi_init(void); +H5_DLL hid_t H5FD_multi_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up use of the multi-file driver + * + * \fapl_id + * \param[in] memb_map Maps memory usage types to other memory usage types + * \param[in] memb_fapl Property list for each memory usage type + * \param[in] memb_name Name generator for names of member files + * \param[in] memb_addr The offsets within the virtual address space, from 0 + * (zero) to #HADDR_MAX, at which each type of data storage begins + * \param[in] relax Allows read-only access to incomplete file sets when \c TRUE + * \returns \herr_t + * + * \details H5Pset_fapl_multi() sets the file access property list \p fapl_id to + * use the multi-file driver. + * + * The multi-file driver enables different types of HDF5 data and + * metadata to be written to separate files. These files are viewed by + * the HDF5 library and the application as a single virtual HDF5 file + * with a single HDF5 file address space. The types of data that can be + * broken out into separate files include raw data, the superblock, + * B-tree data, global heap data, local heap data, and object + * headers. At the programmer's discretion, two or more types of data + * can be written to the same file while other types of data are + * written to separate files. + * + * The array \p memb_map maps memory usage types to other memory usage + * types and is the mechanism that allows the caller to specify how + * many files are created. The array contains #H5FD_MEM_NTYPES entries, + * which are either the value #H5FD_MEM_DEFAULT or a memory usage + * type. The number of unique values determines the number of files + * that are opened. + * + * The array \p memb_fapl contains a property list for each memory + * usage type that will be associated with a file. + * + * The array \p memb_name should be a name generator (a + * \Code{printf}-style format with a \Code{%s} which will be replaced + * with the name passed to H5FDopen(), usually from H5Fcreate() or + * H5Fopen()). + * + * The array \p memb_addr specifies the offsets within the virtual + * address space, from 0 (zero) to #HADDR_MAX, at which each type of + * data storage begins. + * + * If \p relax is set to 1 (TRUE), then opening an existing file for + * read-only access will not fail if some file members are + * missing. This allows a file to be accessed in a limited sense if + * just the meta data is available. + * + * Default values for each of the optional arguments are as follows: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
\p memb_mapThe default member map contains the value #H5FD_MEM_DEFAULT for each element.
+ * \p memb_fapl + * + * The default value is #H5P_DEFAULT for each element. + *
+ * \p memb_name + * + * The default string is \Code{%s-X.h5} where \c X is one of the following letters: + * - \c s for #H5FD_MEM_SUPER + * - \c b for #H5FD_MEM_BTREE + * - \c r for #H5FD_MEM_DRAW + * - \c g for #H5FD_MEM_GHEAP + * - \c l for #H5FD_MEM_LHEAP + * - \c o for #H5FD_MEM_OHDR + *
+ * \p memb_addr + * + * The default setting is that the address space is equally divided + * among all of the elements: + * - #H5FD_MEM_SUPER \Code{-> 0 * (HADDR_MAX/6)} + * - #H5FD_MEM_BTREE \Code{-> 1 * (HADDR_MAX/6)} + * - #H5FD_MEM_DRAW \Code{-> 2 * (HADDR_MAX/6)} + * - #H5FD_MEM_GHEAP \Code{-> 3 * (HADDR_MAX/6)} + * - #H5FD_MEM_LHEAP \Code{-> 4 * (HADDR_MAX/6)} + * - #H5FD_MEM_OHDR \Code{-> 5 * (HADDR_MAX/6)} + *
+ * + * \par Example: + * The following code sample sets up a multi-file access property list that + * partitions data into meta and raw files, each being one-half of the address:\n + * \code + * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + * hid_t memb_fapl[H5FD_MEM_NTYPES]; + * const char *memb[H5FD_MEM_NTYPES]; + * haddr_t memb_addr[H5FD_MEM_NTYPES]; + * + * // The mapping... + * for (mt=0; mtid_exists = TRUE; } else { /* Increment reference count on existing ID */ if (H5I_inc_ref(ret_value, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed") + HGOTO_ERROR(H5E_ID, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ done: @@ -3791,7 +3791,7 @@ H5F__start_swmr_write(H5F_t *f) /* Close the object */ if (H5I_dec_ref(obj_ids[u]) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "decrementing object ID failed") + HGOTO_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, FAIL, "decrementing object ID failed") } /* end for */ } /* end if */ @@ -3856,7 +3856,7 @@ H5F__start_swmr_write(H5F_t *f) * going to sweat it, now. */ if (H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], NULL, vol_connector, TRUE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") + HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't refresh-close object") done: if (ret_value < 0 && setup) { @@ -4010,7 +4010,7 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) vol_wrapper_set = TRUE; if ((file_id = H5VL_wrap_register(H5I_FILE, vol_obj_file, app_ref)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") } /* end if */ else { /* Increment ref count on existing ID */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 04bd2b5..45065e8 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -828,7 +828,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *o /* Get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier") /* Call private iteration function, through VOL callback */ if ((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, diff --git a/src/H5Gint.c b/src/H5Gint.c index d11e8ed..57a6144 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -15,7 +15,7 @@ * * Created: H5Gint.c * April 5 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: General use, "internal" routines for groups. * @@ -167,7 +167,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -782,7 +781,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter if (NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") if ((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group") /* Set up user data for callback */ udata.gid = gid; @@ -1045,7 +1044,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o /* Register an ID for the starting group */ if ((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group") /* Get the location of the starting group */ if (H5G_loc(gid, &start_loc) < 0) diff --git a/src/H5Goh.c b/src/H5Goh.c index 621456c..ada4887 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -291,7 +291,7 @@ H5O__group_get_oloc(hid_t obj_id) /* Get the group */ if (NULL == (grp = (H5G_t *)H5VL_object(obj_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID") /* Get the group's object header location */ if (NULL == (ret_value = H5G_oloc(grp))) diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index d88d121..480d5da 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -15,7 +15,7 @@ * * Created: H5Gtraverse.c * Sep 13 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for traversing group hierarchy * @@ -218,7 +218,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G } /* end if */ /* else, we really needed to open the object */ else - HGOTO_ERROR(H5E_SYM, H5E_BADATOM, FAIL, "traversal callback returned invalid ID") + HGOTO_ERROR(H5E_SYM, H5E_BADID, FAIL, "traversal callback returned invalid ID") } /* end if */ /* Get the object location information from the ID the user callback returned */ @@ -241,16 +241,16 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G * Close the open ID the user passed back. */ if (H5I_dec_ref(cb_return) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") cb_return = (hid_t)(-1); done: /* Close location given to callback. */ if (cur_grp > 0 && H5I_dec_ref(cur_grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom for current location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID for current location") if (ret_value < 0 && cb_return > 0 && H5I_dec_ref(cb_return) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__traverse_ud() */ @@ -797,7 +797,6 @@ done: * traversed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 13 2005 * *------------------------------------------------------------------------- diff --git a/src/H5I.c b/src/H5I.c index c9bad09..1973354 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -12,61 +12,32 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * FILE: H5I.c - Internal storage routines for handling "IDs" - * - * REMARKS: IDs which allow objects (void * currently) to be bundled - * into "types" for more general storage. - * - * DESIGN: The types are stored in an array of pointers to store each - * type in an element. Each "type" node contains a link to a - * hash table to manage the IDs in each type. Allowed types are - * values within the range 1 to H5I_MAX_NUM_TYPES and are given out - * at run-time. Types used by the library are stored in global - * variables defined in H5Ipublic.h. + * H5I.c - Public routines for handling IDs */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Imodule.h" /* This source code file is part of the H5I module */ -#define H5T_FRIEND /* Suppress error about including H5Tpkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Gprivate.h" /* Groups */ +#include "H5Fprivate.h" /* Files */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip Lists */ -#include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5Pprivate.h" /* Property lists */ +/****************/ /* Local Macros */ +/****************/ -/* Combine a Type number and an atom index into an atom */ -#define H5I_MAKE(g, i) ((((hid_t)(g)&TYPE_MASK) << ID_BITS) | ((hid_t)(i)&ID_MASK)) - -/* Local typedefs */ - -/* Atom information structure used */ -typedef struct H5I_id_info_t { - hid_t id; /* ID for this info */ - unsigned count; /* ref. count for this atom */ - unsigned app_count; /* ref. count of application visible atoms */ - const void *obj_ptr; /* pointer associated with the atom */ -} H5I_id_info_t; - -/* ID type structure used */ -typedef struct { - const H5I_class_t *cls; /* Pointer to ID class */ - unsigned init_count; /* # of times this type has been initialized*/ - uint64_t id_count; /* Current number of IDs held */ - uint64_t nextid; /* ID to use for the next atom */ - H5I_id_info_t * last_info; /* Info for most recent ID looked up */ - H5SL_t * ids; /* Pointer to skip list that stores IDs */ -} H5I_id_type_t; +/******************/ +/* Local Typedefs */ +/******************/ typedef struct { H5I_search_func_t app_cb; /* Application's callback routine */ @@ -79,119 +50,28 @@ typedef struct { void * op_data; /* Application's user data */ } H5I_iterate_pub_ud_t; -/* User data for iterator callback for retrieving an ID corresponding to an object pointer */ -typedef struct { - const void *object; /* object pointer to search for */ - H5I_type_t obj_type; /* type of object we are searching for */ - hid_t ret_id; /* ID returned */ -} H5I_get_id_ud_t; +/********************/ +/* Package Typedefs */ +/********************/ -/* User data for iterator callback for ID iteration */ -typedef struct { - H5I_search_func_t user_func; /* 'User' function to invoke */ - void * user_udata; /* User data to pass to 'user' function */ - hbool_t app_ref; /* Whether this is an appl. ref. call */ - H5I_type_t obj_type; /* Type of object we are iterating over */ -} H5I_iterate_ud_t; +/********************/ +/* Local Prototypes */ +/********************/ -/* User data for H5I__clear_type_cb */ -typedef struct { - H5I_id_type_t *type_ptr; /* Pointer to the type being cleard */ - hbool_t force; /* Whether to always remove the id */ - hbool_t app_ref; /* Whether this is an appl. ref. call */ -} H5I_clear_type_ud_t; - -/* Package initialization variable */ -hbool_t H5_PKG_INIT_VAR = FALSE; - -/*-------------------- Locally scoped variables -----------------------------*/ - -/* Array of pointers to atomic types */ -static H5I_id_type_t *H5I_id_type_list_g[H5I_MAX_NUM_TYPES]; - -/* Variable to keep track of the number of types allocated. Its value is the */ -/* next type ID to be handed out, so it is always one greater than the number */ -/* of types. */ -/* Starts at 1 instead of 0 because it makes trace output look nicer. If more */ -/* types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h */ -/* and/or increase size of hid_t */ -static int H5I_next_type = (int)H5I_NTYPES; - -/* Declare a free list to manage the H5I_id_info_t struct */ -H5FL_DEFINE_STATIC(H5I_id_info_t); - -/* Declare a free list to manage the H5I_id_type_t struct */ -H5FL_DEFINE_STATIC(H5I_id_type_t); - -/* Declare a free list to manage the H5I_class_t struct */ -H5FL_DEFINE_STATIC(H5I_class_t); - -H5FL_EXTERN(H5VL_object_t); - -/*--------------------- Local function prototypes ---------------------------*/ -static void * H5I__unwrap(void *obj_ptr, H5I_type_t type); -static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); -static int H5I__destroy_type(H5I_type_t type); -static void * H5I__remove_verify(hid_t id, H5I_type_t id_type); -static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id); -static int H5I__inc_type_ref(H5I_type_t type); -static int H5I__get_type_ref(H5I_type_t type); -static int H5I__search_cb(void *obj, hid_t id, void *_udata); -static H5I_id_info_t *H5I__find_id(hid_t id); -static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); -static int H5I__find_id_cb(void *_item, void *_key, void *_udata); -static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); +static int H5I__search_cb(void *obj, hid_t id, void *_udata); +static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); -/*------------------------------------------------------------------------- - * Function: H5I_term_package - * - * Purpose: Terminate the H5I interface: release all memory, reset all - * global variables to initial values. This only happens if all - * types have been destroyed from other interfaces. - * - * Return: Success: Positive if any action was taken that might - * affect some other interface; zero otherwise. - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -int -H5I_term_package(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (H5_PKG_INIT_VAR) { - H5I_id_type_t *type_ptr; /* Pointer to ID type */ - int type; /* Type of ID */ - - /* How many types are still being used? */ - for (type = 0; type < H5I_next_type; type++) - if ((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) - n++; - - /* If no types are used then clean up */ - if (0 == n) { - for (type = 0; type < H5I_next_type; type++) { - type_ptr = H5I_id_type_list_g[type]; - if (type_ptr) { - HDassert(NULL == type_ptr->ids); - type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); - H5I_id_type_list_g[type] = NULL; - n++; - } /* end if */ - } /* end for */ - - /* Mark interface closed */ - if (0 == n) - H5_PKG_INIT_VAR = FALSE; - } /* end if */ - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* end H5I_term_package() */ +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ /*------------------------------------------------------------------------- * Function: H5Iregister_type @@ -213,8 +93,8 @@ H5I_term_package(void) H5I_type_t H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, H5I_free_t free_func) { - H5I_class_t *cls = NULL; /* New ID class */ - H5I_type_t new_type; /* New ID type value */ + H5I_class_t *cls = NULL; /* New ID class */ + H5I_type_t new_type = H5I_BADID; /* New ID type value */ H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) @@ -223,42 +103,42 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, H5I /* Generate a new H5I_type_t value */ /* Increment the number of types */ - if (H5I_next_type < H5I_MAX_NUM_TYPES) { - new_type = (H5I_type_t)H5I_next_type; - H5I_next_type++; - } /* end if */ + if (H5I_next_type_g < H5I_MAX_NUM_TYPES) { + new_type = (H5I_type_t)H5I_next_type_g; + H5I_next_type_g++; + } else { hbool_t done; /* Indicate that search was successful */ - int i; /* Local index variable */ + int i; /* Look for a free type to give out */ done = FALSE; for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == FALSE; i++) { - if (NULL == H5I_id_type_list_g[i]) { + if (NULL == H5I_type_info_array_g[i]) { /* Found a free type ID */ new_type = (H5I_type_t)i; done = TRUE; - } /* end if */ - } /* end for */ + } + } /* Verify that we found a type to give out */ if (done == FALSE) - HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded") - } /* end else */ + HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded") + } /* Allocate new ID class */ - if (NULL == (cls = H5FL_CALLOC(H5I_class_t))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed") + if (NULL == (cls = H5MM_calloc(sizeof(H5I_class_t)))) + HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed") /* Initialize class fields */ - cls->type_id = new_type; + cls->type = new_type; cls->flags = H5I_CLASS_IS_APPLICATION; cls->reserved = reserved; cls->free_func = free_func; /* Register the new ID class */ if (H5I_register_type(cls) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_BADID, "can't initialize ID class") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class") /* Set return value */ ret_value = new_type; @@ -267,72 +147,12 @@ done: /* Clean up on error */ if (ret_value < 0) if (cls) - cls = H5FL_FREE(H5I_class_t, cls); + cls = H5MM_xfree(cls); FUNC_LEAVE_API(ret_value) } /* end H5Iregister_type() */ /*------------------------------------------------------------------------- - * Function: H5I_register_type - * - * Purpose: Creates a new type of ID's to give out. - * The class is initialized or its reference count is incremented - * (if it is already initialized). - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5I_register_type(const H5I_class_t *cls) -{ - H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(cls); - HDassert(cls->type_id > 0 && (int)cls->type_id < H5I_MAX_NUM_TYPES); - - /* Initialize the type */ - if (NULL == H5I_id_type_list_g[cls->type_id]) { - /* Allocate the type information for new type */ - if (NULL == (type_ptr = (H5I_id_type_t *)H5FL_CALLOC(H5I_id_type_t))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "ID type allocation failed") - H5I_id_type_list_g[cls->type_id] = type_ptr; - } /* end if */ - else { - /* Get the pointer to the existing type */ - type_ptr = H5I_id_type_list_g[cls->type_id]; - } /* end else */ - - /* Initialize the ID type structure for new types */ - if (type_ptr->init_count == 0) { - type_ptr->cls = cls; - type_ptr->id_count = 0; - type_ptr->nextid = cls->reserved; - type_ptr->last_info = NULL; - if (NULL == (type_ptr->ids = H5SL_create(H5SL_TYPE_HID, NULL))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTCREATE, FAIL, "skip list creation failed") - } /* end if */ - - /* Increment the count of the times this type has been initialized */ - type_ptr->init_count++; - -done: - if (ret_value < 0) { /* Clean up on error */ - if (type_ptr) { - if (type_ptr->ids) - H5SL_close(type_ptr->ids); - (void)H5FL_FREE(H5I_id_type_t, type_ptr); - } /* end if */ - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_register_type() */ - -/*------------------------------------------------------------------------- * Function: H5Itype_exists * * Purpose: Query function to inform the user if a given type is @@ -352,11 +172,11 @@ H5Itype_exists(H5I_type_t type) /* Validate parameter */ if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - if (type <= H5I_BADID || (int)type >= H5I_next_type) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if (NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_type_info_array_g[type]) ret_value = FALSE; done: @@ -373,8 +193,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * Friday, April 23, 2004 * *------------------------------------------------------------------------- @@ -382,116 +202,37 @@ done: herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members) { - int ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "It*h", type, num_members); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Validate parameters. This needs to be done here, instead of letting * the private interface handle it, because the public interface throws * an error when the supplied type does not exist. */ - if (type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if (NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_type_info_array_g[type]) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") if (num_members) { int64_t members; if ((members = H5I_nmembers(type)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members") + HGOTO_ERROR(H5E_ID, H5E_CANTCOUNT, FAIL, "can't compute number of members") H5_CHECKED_ASSIGN(*num_members, hsize_t, members, int64_t); - } /* end if */ + } done: FUNC_LEAVE_API(ret_value) } /* end H5Inmembers() */ /*------------------------------------------------------------------------- - * Function: H5I_nmembers - * - * Purpose: Returns the number of members in a type. - * - * Return: Success: Number of members; zero if the type is empty - * or has been deleted. - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, March 24, 1999 - * - *------------------------------------------------------------------------- - */ -int64_t -H5I_nmembers(H5I_type_t type) -{ - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - int64_t ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Validate parameter */ - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if (NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) - HGOTO_DONE(0); - - /* Set return value */ - H5_CHECKED_ASSIGN(ret_value, int64_t, type_ptr->id_count, uint64_t); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_nmembers() */ - -/*------------------------------------------------------------------------- - * Function: H5I__unwrap - * - * Purpose: Unwraps the object pointer for the 'item' that corresponds - * to an ID. - * - * Return: Pointer to the unwrapped pointer (can't fail) - * - * Programmer: Quincey Koziol - * Friday, October 19, 2018 - * - *------------------------------------------------------------------------- - */ -static void * -H5I__unwrap(void *obj_ptr, H5I_type_t type) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC_NOERR - - /* Sanity checks */ - HDassert(obj_ptr); - - /* The stored object pointer might be an H5VL_object_t, in which - * case we'll need to get the wrapped object struct (H5F_t *, etc.). - */ - if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - const H5VL_object_t *vol_obj; - - vol_obj = (const H5VL_object_t *)obj_ptr; - ret_value = H5VL_object_data(vol_obj); - } /* end if */ - else if (H5I_DATATYPE == type) { - H5T_t *dt = (H5T_t *)obj_ptr; - - ret_value = (void *)H5T_get_actual_type(dt); - } /* end if */ - else - ret_value = obj_ptr; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__unwrap() */ - -/*------------------------------------------------------------------------- * Function: H5Iclear_type * * Purpose: Removes all objects from the type, calling the free @@ -500,8 +241,8 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * Friday, April 23, 2004 * *------------------------------------------------------------------------- @@ -515,7 +256,7 @@ H5Iclear_type(H5I_type_t type, hbool_t force) H5TRACE2("e", "Itb", type, force); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I_clear_type(type, force, TRUE); @@ -524,116 +265,9 @@ done: } /* end H5Iclear_type() */ /*------------------------------------------------------------------------- - * Function: H5I_clear_type - * - * Purpose: Removes all objects from the type, calling the free - * function for each object regardless of the reference count. - * - * Return: SUCCEED/FAIL - * - * Programmer: Robb Matzke - * Wednesday, March 24, 1999 - * - *------------------------------------------------------------------------- - */ -herr_t -H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) -{ - H5I_clear_type_ud_t udata; /* udata struct for callback */ - int ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Validate parameters */ - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - - udata.type_ptr = H5I_id_type_list_g[type]; - if (udata.type_ptr == NULL || udata.type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - - /* Finish constructing udata */ - udata.force = force; - udata.app_ref = app_ref; - - /* Attempt to free all ids in the type */ - if (H5SL_try_free_safe(udata.type_ptr->ids, H5I__clear_type_cb, &udata) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't free ids in type") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_clear_type() */ - -/*------------------------------------------------------------------------- - * Function: H5I__clear_type_cb - * - * Purpose: Attempts to free the specified ID, calling the free - * function for the object. - * - * Return: TRUE/FALSE/FAIL - * - * Programmer: Neil Fortner - * Friday, July 10, 2015 - * - *------------------------------------------------------------------------- - */ -static htri_t -H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) -{ - H5I_id_info_t * id = (H5I_id_info_t *)_id; /* Current ID being worked with */ - H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ - htri_t ret_value = FALSE; /* Return value */ - - FUNC_ENTER_STATIC_NOERR - - /* Sanity checks */ - HDassert(id); - HDassert(udata); - HDassert(udata->type_ptr); - - /* Do nothing to the object if the reference count is larger than - * one and forcing is off. - */ - if (udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { - /* Check for a 'free' function and call it, if it exists */ - if (udata->type_ptr->cls->free_func && - (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ - if (udata->force) { -#ifdef H5I_DEBUG - if (H5DEBUG(I)) { - HDfprintf(H5DEBUG(I), - "H5I: free type=%d obj=0x%08lx " - "failure ignored\n", - (int)udata->type_ptr->cls->type_id, (unsigned long)(id->obj_ptr)); - } /* end if */ -#endif /*H5I_DEBUG*/ - - /* Indicate node should be removed from list */ - ret_value = TRUE; - } /* end if */ - } /* end if */ - else { - /* Indicate node should be removed from list */ - ret_value = TRUE; - } /* end else */ - - /* Remove ID if requested */ - if (ret_value) { - /* Free ID info */ - id = H5FL_FREE(H5I_id_info_t, id); - - /* Decrement the number of IDs in the type */ - udata->type_ptr->id_count--; - } /* end if */ - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__clear_type_cb() */ - -/*------------------------------------------------------------------------- * Function: H5Idestroy_type * - * Purpose: Destroys a type along with all atoms in that type + * Purpose: Destroys a type along with all IDs in that type * regardless of their reference counts. Destroying IDs * involves calling the free-func for each ID's object and * then adding the ID struct to the ID free list. Public @@ -641,8 +275,8 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Nathaniel Furrer - * James Laird + * Programmer: Nathaniel Furrer + * James Laird * *------------------------------------------------------------------------- */ @@ -655,7 +289,7 @@ H5Idestroy_type(H5I_type_t type) H5TRACE1("e", "It", type); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I__destroy_type(type); @@ -664,62 +298,9 @@ done: } /* end H5Idestroy_type() */ /*------------------------------------------------------------------------- - * Function: H5I__destroy_type - * - * Purpose: Destroys a type along with all atoms in that type - * regardless of their reference counts. Destroying IDs - * involves calling the free-func for each ID's object and - * then adding the ID struct to the ID free list. - * - * Return: SUCCEED/FAIL - * - * Programmer: Nathaniel Furrer - * James Laird - * - *------------------------------------------------------------------------- - */ -static herr_t -H5I__destroy_type(H5I_type_t type) -{ - H5I_id_type_t *type_ptr; /* ptr to the atomic type */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Validate parameter */ - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - - type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - - /* Close/clear/destroy all IDs for this type */ - H5E_BEGIN_TRY - { - H5I_clear_type(type, TRUE, FALSE); - } - H5E_END_TRY /*don't care about errors*/ - - /* Check if we should release the ID class */ - if (type_ptr->cls->flags & H5I_CLASS_IS_APPLICATION) - type_ptr->cls = H5FL_FREE(H5I_class_t, (void *)type_ptr->cls); - - if (H5SL_close(type_ptr->ids) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") - type_ptr->ids = NULL; - - type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); - H5I_id_type_list_g[type] = NULL; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__destroy_type() */ - -/*------------------------------------------------------------------------- * Function: H5Iregister * - * Purpose: Public interface to H5I_register. + * Purpose: Register an object. * * Return: Success: New object ID * Failure: H5I_INVALID_HID @@ -735,209 +316,48 @@ H5Iregister(H5I_type_t type, const void *object) H5TRACE2("i", "It*x", type, object); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, H5I_INVALID_HID, "cannot call public function on library type") - ret_value = H5I_register(type, object, TRUE); + /* Register the object */ + if ((ret_value = H5I__register(type, object, TRUE, NULL, NULL)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") done: FUNC_LEAVE_API(ret_value) } /* end H5Iregister() */ /*------------------------------------------------------------------------- - * Function: H5I_register + * Function: H5Iregister_future * - * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. - * This routine does _not_ check for unique-ness of the objects, - * if you register an object twice, you will get two different - * IDs for it. This routine does make certain that each ID in a - * type is unique. IDs are created by getting a unique number - * for the type the ID is in and incorporating the type into - * the ID which is returned to the user. + * Purpose: Register a "future" object. * - * Return: Success: New object ID + * Return: Success: New future object ID * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) +H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_t realize_cb, + H5I_future_discard_func_t discard_cb) { - H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ - H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ - hid_t new_id = -1; /* new ID */ - hid_t ret_value = H5I_INVALID_HID; /* return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments */ - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") - type_ptr = H5I_id_type_list_g[type]; - if ((NULL == type_ptr) || (type_ptr->init_count <= 0)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, H5I_INVALID_HID, "invalid type") - if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) - HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") - - /* Create the struct & its ID */ - new_id = H5I_MAKE(type, type_ptr->nextid); - id_ptr->id = new_id; - id_ptr->count = 1; /* initial reference count */ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; - - /* Insert into the type */ - if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert ID node into skip list") - type_ptr->id_count++; - type_ptr->nextid++; - - /* Sanity check for the 'nextid' getting too large and wrapping around */ - HDassert(type_ptr->nextid <= ID_MASK); - - /* Set the most recent ID to this object */ - type_ptr->last_info = id_ptr; - - /* Set return value */ - ret_value = new_id; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_register() */ - -/*------------------------------------------------------------------------- - * Function: H5I_register_using_existing_id - * - * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. - * This routine will check to ensure the supplied ID is not already - * in use, and ensure that it is a valid ID for the given type, - * but will NOT check to ensure the OBJECT is not already - * registered (thus, it is possible to register one object under - * multiple IDs). - * - * NOTE: Intended for use in refresh calls, where we have to close - * and re-open the underlying data, then hook the object back - * up to the original ID. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id) -{ - H5I_id_type_t *type_ptr; /* ptr to the type */ - H5I_id_info_t *id_ptr; /* ptr to the new ID information */ - herr_t ret_value = SUCCEED; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE4("i", "It*xIRID", type, object, realize_cb, discard_cb); /* Check arguments */ - HDassert(object); - - /* Make sure ID is not already in use */ - if (NULL != (id_ptr = H5I__find_id(existing_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") - - /* Make sure type number is valid */ - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - - /* Get type pointer from list of types */ - type_ptr = H5I_id_type_list_g[type]; - - if (NULL == type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - - /* Make sure requested ID belongs to object's type */ - if (H5I_TYPE(existing_id) != type) - HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID") + if (NULL == realize_cb) + HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed") + if (NULL == discard_cb) + HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed") - /* Allocate new structure to house this ID */ - if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) - HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Create the struct & insert requested ID */ - id_ptr->id = existing_id; - id_ptr->count = 1; /* initial reference count*/ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; - - /* Insert into the type */ - if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") - type_ptr->id_count++; - - /* Set the most recent ID to this object */ - type_ptr->last_info = id_ptr; + /* Register the future object */ + if ((ret_value = H5I__register(type, object, TRUE, realize_cb, discard_cb)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_register_using_existing_id() */ - -/*------------------------------------------------------------------------- - * Function: H5I_subst - * - * Purpose: Substitute a new object pointer for the specified ID. - * - * Return: Success: Non-NULL previous object pointer associated - * with the specified ID. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Saturday, February 27, 2010 - * - *------------------------------------------------------------------------- - */ -void * -H5I_subst(hid_t id, const void *new_object) -{ - H5I_id_info_t *id_ptr; /* Pointer to the atom */ - void * ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* General lookup of the ID */ - if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") - - /* Get the old object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ - - /* Set the new object pointer for the ID */ - id_ptr->obj_ptr = new_object; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_subst() */ - -/*------------------------------------------------------------------------- - * Function: H5I_object - * - * Purpose: Find an object pointer for the specified ID. - * - * Return: Success: Non-NULL object pointer associated with the - * specified ID - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5I_object(hid_t id) -{ - H5I_id_info_t *id_ptr; /* Pointer to the new atom */ - void * ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI_NOERR - - /* General lookup of the ID */ - if (NULL != (id_ptr = H5I__find_id(id))) { - /* Get the object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ - } - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_object() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Iregister_future() */ /*------------------------------------------------------------------------- * Function: H5Iobject_verify @@ -953,93 +373,26 @@ H5I_object(hid_t id) *------------------------------------------------------------------------- */ void * -H5Iobject_verify(hid_t id, H5I_type_t id_type) +H5Iobject_verify(hid_t id, H5I_type_t type) { void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - H5TRACE2("*x", "iIt", id, id_type); + H5TRACE2("*x", "iIt", id, type); /* Validate parameters */ - if (H5I_IS_LIB_TYPE(id_type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - if (id_type < 1 || (int)id_type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") + if (H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type") + if (type < 1 || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "identifier has invalid type") - ret_value = H5I_object_verify(id, id_type); + ret_value = H5I_object_verify(id, type); done: FUNC_LEAVE_API(ret_value) } /* end H5Iobject_verify() */ /*------------------------------------------------------------------------- - * Function: H5I_object_verify - * - * Purpose: Find an object pointer for the specified ID, verifying that - * its in a particular type. - * - * Return: Success: Non-NULL object pointer associated with the - * specified ID. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Wednesday, July 31, 2002 - * - *------------------------------------------------------------------------- - */ -void * -H5I_object_verify(hid_t id, H5I_type_t id_type) -{ - H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ - void * ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI_NOERR - - HDassert(id_type >= 1 && (int)id_type < H5I_next_type); - - /* Verify that the type of the ID is correct & lookup the ID */ - if (id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { - /* Get the object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ - } - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5I_object_verify() */ - -/*------------------------------------------------------------------------- - * Function: H5I_get_type - * - * Purpose: Given an object ID return the type to which it - * belongs. The ID need not be the ID of an object which - * currently exists because the type number is encoded - * in the object ID. - * - * Return: Success: A positive integer (corresponding to an H5I_type_t - * enum value for library ID types, but not for user - * ID types). - * Failure: H5I_BADID - * - * Programmer: Robb Matzke - * Friday, February 19, 1999 - * - *------------------------------------------------------------------------- - */ -H5I_type_t -H5I_get_type(hid_t id) -{ - H5I_type_t ret_value = H5I_BADID; /* Return value */ - - FUNC_ENTER_NOAPI_NOERR - - if (id > 0) - ret_value = H5I_TYPE(id); - - HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_type() */ - -/*------------------------------------------------------------------------- * Function: H5Iget_type * * Purpose: The public version of H5I_get_type(), obtains a type number @@ -1064,7 +417,7 @@ H5Iget_type(hid_t id) ret_value = H5I_get_type(id); - if (ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) + if (ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type_g || NULL == H5I_object(id)) HGOTO_DONE(H5I_BADID); done: @@ -1072,56 +425,6 @@ done: } /* end H5Iget_type() */ /*------------------------------------------------------------------------- - * Function: H5I_is_file_object - * - * Purpose: Convenience function to determine if an ID represents - * a file object. - * - * In H5O calls, you can't use object_verify to ensure - * the ID was of the correct class since there's no - * H5I_OBJECT ID class. - * - * Return: Success: TRUE/FALSE - * Failure: FAIL - * - *------------------------------------------------------------------------- - */ -htri_t -H5I_is_file_object(hid_t id) -{ - H5I_type_t id_type = H5I_get_type(id); - htri_t ret_value = FAIL; - - FUNC_ENTER_NOAPI(FAIL); - - /* Fail if the ID type is out of range */ - if (id_type < 1 || id_type >= H5I_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID type out of range"); - - /* Return TRUE if the ID is a file object (dataset, group, map, or committed - * datatype), FALSE otherwise. - */ - if (H5I_DATASET == id_type || H5I_GROUP == id_type || H5I_MAP == id_type) { - ret_value = TRUE; - } - else if (H5I_DATATYPE == id_type) { - - H5T_t *dt = NULL; - - if (NULL == (dt = (H5T_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get underlying datatype struct"); - - ret_value = H5T_is_named(dt); - } - else { - ret_value = FALSE; - } - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* H5I_is_file_object() */ - -/*------------------------------------------------------------------------- * Function: H5Iremove_verify * * Purpose: Removes the specified ID from its type, first checking that the @@ -1133,145 +436,30 @@ done: * calling H5I_object(). * Failure: NULL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * *------------------------------------------------------------------------- */ void * -H5Iremove_verify(hid_t id, H5I_type_t id_type) +H5Iremove_verify(hid_t id, H5I_type_t type) { void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - H5TRACE2("*x", "iIt", id, id_type); + H5TRACE2("*x", "iIt", id, type); - if (H5I_IS_LIB_TYPE(id_type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") + if (H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Remove the id */ - ret_value = H5I__remove_verify(id, id_type); + ret_value = H5I__remove_verify(id, type); done: FUNC_LEAVE_API(ret_value) } /* end H5Iremove_verify() */ /*------------------------------------------------------------------------- - * Function: H5I__remove_verify - * - * Purpose: Removes the specified ID from its type, first checking that - * the ID's type is the same as the ID type supplied as an argument - * - * Return: Success: A pointer to the object that was removed, the - * same pointer which would have been found by - * calling H5I_object(). - * Failure: NULL - * - * Programmer: James Laird - * Nat Furrer - * - *------------------------------------------------------------------------- - */ -static void * -H5I__remove_verify(hid_t id, H5I_type_t id_type) -{ - void *ret_value = NULL; /*return value */ - - FUNC_ENTER_STATIC_NOERR - - /* Argument checking will be performed by H5I_remove() */ - - /* Verify that the type of the ID is correct */ - if (id_type == H5I_TYPE(id)) - ret_value = H5I_remove(id); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__remove_verify() */ - -/*------------------------------------------------------------------------- - * Function: H5I__remove_common - * - * Purpose: Common code to remove a specified ID from its type. - * - * Return: Success: A pointer to the object that was removed, the - * same pointer which would have been found by - * calling H5I_object(). - * Failure: NULL - * - * Programmer: Quincey Koziol - * October 3, 2013 - * - *------------------------------------------------------------------------- - */ -static void * -H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) -{ - H5I_id_info_t *curr_id; /* Pointer to the current atom */ - void * ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(type_ptr); - - /* Get the ID node for the ID */ - if (NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") - - /* Check if this ID was the last one accessed */ - if (type_ptr->last_info == curr_id) - type_ptr->last_info = NULL; - - ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */ - curr_id = H5FL_FREE(H5I_id_info_t, curr_id); - - /* Decrement the number of IDs in the type */ - (type_ptr->id_count)--; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__remove_common() */ - -/*------------------------------------------------------------------------- - * Function: H5I_remove - * - * Purpose: Removes the specified ID from its type. - * - * Return: Success: A pointer to the object that was removed, the - * same pointer which would have been found by - * calling H5I_object(). - * Failure: NULL - * - * Programmer: Unknown - * - *------------------------------------------------------------------------- - */ -void * -H5I_remove(hid_t id) -{ - H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ - H5I_type_t type; /* Atom's atomic type */ - void * ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* Check arguments */ - type = H5I_TYPE(id); - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") - type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") - - /* Remove the node from the type */ - if (NULL == (ret_value = H5I__remove_common(type_ptr, id))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_remove() */ - -/*------------------------------------------------------------------------- * Function: H5Idec_ref * * Purpose: Decrements the number of references outstanding for an ID. @@ -1296,174 +484,17 @@ H5Idec_ref(hid_t id) /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID") /* Do actual decrement operation */ if ((ret_value = H5I_dec_app_ref(id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Idec_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_dec_ref - * - * Purpose: Decrements the number of references outstanding for an ID. - * This will fail if the type is not a reference counted type. - * The ID type's 'free' function will be called for the ID - * if the reference count for the ID reaches 0 and a free - * function has been defined at type creation time. - * - * Return: Success: New reference count - * - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -int -H5I_dec_ref(hid_t id) -{ - H5I_id_info_t *id_ptr; /* Pointer to the new ID */ - int ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI((-1)) - - /* Sanity check */ - HDassert(id >= 0); - - /* General lookup of the ID */ - if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") - - /* If this is the last reference to the object then invoke the type's - * free method on the object. If the free method is undefined or - * successful then remove the object from the type; otherwise leave - * the object in the type without decrementing the reference - * count. If the reference count is more than one then decrement the - * reference count without calling the free method. - * - * Beware: the free method may call other H5I functions. - * - * If an object is closing, we can remove the ID even though the free - * method might fail. This can happen when a mandatory filter fails to - * write when a dataset is closed and the chunk cache is flushed to the - * file. We have to close the dataset anyway. (SLU - 2010/9/7) - */ - if (1 == id_ptr->count) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - - /* Get the ID's type */ - type_ptr = H5I_id_type_list_g[H5I_TYPE(id)]; - - /* (Casting away const OK -QAK) */ - if (!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) { - /* Remove the node from the type */ - if (NULL == H5I__remove_common(type_ptr, id)) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, (-1), "can't remove ID node") - ret_value = 0; - } /* end if */ - else - ret_value = -1; - } /* end if */ - else { - --(id_ptr->count); - ret_value = (int)id_ptr->count; - } /* end else */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_dec_ref() */ - -/*------------------------------------------------------------------------- - * Function: H5I_dec_app_ref - * - * Purpose: H5I_dec_ref wrapper for case of modifying the application ref. - * count for an ID as well as normal reference count. - * - * Return: Success: New app. reference count - * Failure: -1 - * - * Programmer: Quincey Koziol - * Sept 16, 2010 - * - *------------------------------------------------------------------------- - */ -int -H5I_dec_app_ref(hid_t id) -{ - H5I_id_info_t *id_ptr; /* Pointer to the new ID */ - int ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI((-1)) - - /* Sanity check */ - HDassert(id >= 0); - - /* Call regular decrement reference count routine */ - if ((ret_value = H5I_dec_ref(id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") - - /* Check if the ID still exists */ - if (ret_value > 0) { - /* General lookup of the ID */ - if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") - - /* Adjust app_ref */ - --(id_ptr->app_count); - HDassert(id_ptr->count >= id_ptr->app_count); - - /* Set return value */ - ret_value = (int)id_ptr->app_count; - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_dec_app_ref() */ - -/*------------------------------------------------------------------------- - * Function: H5I_dec_app_ref_always_close - * - * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID, - * even when the free routine fails - * - * Return: Success: New app. reference count - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -int -H5I_dec_app_ref_always_close(hid_t id) -{ - int ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI((-1)) - - /* Sanity check */ - HDassert(id >= 0); - - /* Call application decrement reference count routine */ - ret_value = H5I_dec_app_ref(id); - - /* Check for failure */ - if (ret_value < 0) { - /* - * If an object is closing, we can remove the ID even though the free - * method might fail. This can happen when a mandatory filter fails to - * write when a dataset is closed and the chunk cache is flushed to the - * file. We have to close the dataset anyway. (SLU - 2010/9/7) - */ - H5I_remove(id); - - HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_dec_app_ref_always_close() */ - -/*------------------------------------------------------------------------- * Function: H5Iinc_ref * * Purpose: Increments the number of references outstanding for an ID. @@ -1476,61 +507,24 @@ done: int H5Iinc_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID") /* Do actual increment operation */ if ((ret_value = H5I_inc_ref(id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_inc_ref - * - * Purpose: Increment the reference count for an object. - * - * Return: Success: The new reference count - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -int -H5I_inc_ref(hid_t id, hbool_t app_ref) -{ - H5I_id_info_t *id_ptr; /* Pointer to the ID */ - int ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI((-1)) - - /* Sanity check */ - HDassert(id >= 0); - - /* General lookup of the ID */ - if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") - - /* Adjust reference counts */ - ++(id_ptr->count); - if (app_ref) - ++(id_ptr->app_count); - - /* Set return value */ - ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_inc_ref() */ - -/*------------------------------------------------------------------------- * Function: H5Iget_ref * * Purpose: Retrieves the number of references outstanding for an ID. @@ -1543,56 +537,24 @@ done: int H5Iget_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID") /* Do actual retrieve operation */ if ((ret_value = H5I_get_ref(id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_get_ref - * - * Purpose: Retrieve the reference count for an object. - * - * Return: Success: The reference count - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -int -H5I_get_ref(hid_t id, hbool_t app_ref) -{ - H5I_id_info_t *id_ptr; /* Pointer to the ID */ - int ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI((-1)) - - /* Sanity check */ - HDassert(id >= 0); - - /* General lookup of the ID */ - if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") - - /* Set return value */ - ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_ref() */ - -/*------------------------------------------------------------------------- * Function: H5Iinc_type_ref * * Purpose: Increments the number of references outstanding for an ID type. @@ -1602,67 +564,34 @@ done: * *------------------------------------------------------------------------- */ -int -H5Iinc_type_ref(H5I_type_t type) -{ - int ret_value; /* Return value */ - - FUNC_ENTER_API((-1)) - H5TRACE1("Is", "It", type); - - /* Check arguments */ - if (type <= 0 || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") - - /* Do actual increment operation */ - if ((ret_value = H5I__inc_type_ref(type)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID type ref count") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Iinc_ref() */ - -/*------------------------------------------------------------------------- - * Function: H5I__inc_type_ref - * - * Purpose: Increment the reference count for an ID type. - * - * Return: Success: The new reference count - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -static int -H5I__inc_type_ref(H5I_type_t type) +int +H5Iinc_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the type */ - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(type > 0 && (int)type < H5I_next_type); + FUNC_ENTER_API((-1)) + H5TRACE1("Is", "It", type); /* Check arguments */ - type_ptr = H5I_id_type_list_g[type]; - if (NULL == type_ptr) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") + if (type <= 0 || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type") + if (H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type") - /* Set return value */ - ret_value = (int)(++(type_ptr->init_count)); + /* Do actual increment operation */ + if ((ret_value = H5I__inc_type_ref(type)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID type ref count") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__inc_type_ref() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Iinc_ref() */ /*------------------------------------------------------------------------- * Function: H5Idec_type_ref * * Purpose: Decrements the reference count on an entire type of IDs. * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of + * destroyed along with all IDs in that type regardless of * their reference counts. Destroying IDs involves calling * the free-func for each ID's object and then adding the ID * struct to the ID free list. Public interface to @@ -1690,7 +619,7 @@ H5Idec_type_ref(H5I_type_t type) H5TRACE1("e", "It", type); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type") ret_value = H5I_dec_type_ref(type); @@ -1699,58 +628,6 @@ done: } /* end H5Idec_type_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_dec_type_ref - * - * Purpose: Decrements the reference count on an entire type of IDs. - * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling - * the free-func for each ID's object and then adding the ID - * struct to the ID free list. - * Returns the number of references to the type on success; a - * return value of 0 means that the type will have to be - * re-initialized before it can be used again (and should probably - * be set to H5I_UNINIT). - * - * Return: Success: Number of references to type - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -int -H5I_dec_type_ref(H5I_type_t type) -{ - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - herr_t ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI((-1)) - - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number") - - type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") - - /* Decrement the number of users of the atomic type. If this is the - * last user of the type then release all atoms from the type and - * free all memory it used. The free function is invoked for each atom - * being freed. - */ - if (1 == type_ptr->init_count) { - H5I__destroy_type(type); - ret_value = 0; - } /* end if */ - else { - --(type_ptr->init_count); - ret_value = (herr_t)type_ptr->init_count; - } /* end else */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_dec_type_ref() */ - -/*------------------------------------------------------------------------- * Function: H5Iget_type_ref * * Purpose: Retrieves the number of references outstanding for a type. @@ -1763,60 +640,26 @@ done: int H5Iget_type_ref(H5I_type_t type) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "It", type); /* Check arguments */ - if (type <= 0 || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") + if (type <= 0 || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type") if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual retrieve operation */ if ((ret_value = H5I__get_type_ref(type)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID type ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID type ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ /*------------------------------------------------------------------------- - * Function: H5I__get_type_ref - * - * Purpose: Retrieve the reference count for an ID type. - * - * Return: Success: The reference count - * - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -static int -H5I__get_type_ref(H5I_type_t type) -{ - H5I_id_type_t *type_ptr; /* Pointer to the type */ - int ret_value = -1; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(type >= 0); - - /* Check arguments */ - type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - - /* Set return value */ - ret_value = (int)type_ptr->init_count; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__get_type_ref() */ - -/*------------------------------------------------------------------------- * Function: H5Iis_valid * * Purpose: Check if the given id is valid. An id is valid if it is in @@ -1829,16 +672,16 @@ done: htri_t H5Iis_valid(hid_t id) { - H5I_id_info_t *id_ptr; /* ptr to the ID */ + H5I_id_info_t *info = NULL; /* Pointer to the ID info */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "i", id); /* Find the ID */ - if (NULL == (id_ptr = H5I__find_id(id))) + if (NULL == (info = H5I__find_id(id))) ret_value = FALSE; - else if (!id_ptr->app_count) /* Check if the found id is an internal id */ + else if (!info->app_count) /* Check if the found id is an internal id */ ret_value = FALSE; done: @@ -1902,15 +745,15 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) void * H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) { - H5I_search_ud_t udata; /* Context for iteration */ - void * ret_value; /* Return value */ + H5I_search_ud_t udata; /* Context for iteration */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE3("*x", "ItIS*x", type, func, key); /* Check arguments */ if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Set up udata struct */ udata.app_cb = func; @@ -1948,9 +791,9 @@ done: static int H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) { - H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ - herr_t cb_ret_val; /* User callback return value */ - int ret_value = H5_ITER_ERROR; /* Callback return value */ + H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ + herr_t cb_ret_val = FAIL; /* User callback return value */ + int ret_value = H5_ITER_ERROR; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -1994,8 +837,8 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data) { - H5I_iterate_pub_ud_t int_udata; /* Internal user data */ - herr_t ret_value; /* Return value */ + H5I_iterate_pub_ud_t int_udata; /* Internal user data */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ItII*x", type, op, op_data); @@ -2008,161 +851,55 @@ H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data) * here, as we can't do anything with it without revising the API. */ if ((ret_value = H5I_iterate(type, H5I__iterate_pub_cb, &int_udata, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "can't iterate over ids") + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "can't iterate over ids") done: FUNC_LEAVE_API(ret_value) } /* end H5Iiterate() */ /*------------------------------------------------------------------------- - * Function: H5I__iterate_cb - * - * Purpose: Callback routine for H5I_iterate, invokes "user" callback - * function, and then sets return value, based on the result of - * that callback. - * - * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) - * Failure: H5_ITER_ERROR (-1) - * - *------------------------------------------------------------------------- - */ -static int -H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) -{ - H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */ - int ret_value = H5_ITER_CONT; /* Callback return value */ - - FUNC_ENTER_STATIC_NOERR - - /* Only invoke the callback function if this ID is visible externally and - * its reference count is positive. - */ - if ((!udata->app_ref) || (item->app_count > 0)) { - H5I_type_t type = udata->obj_type; - void * obj_ptr; - herr_t cb_ret_val; - - /* The stored object pointer might be an H5VL_object_t, in which - * case we'll need to get the wrapped object struct (H5F_t *, etc.). - */ - obj_ptr = H5I__unwrap((void *)item->obj_ptr, type); - - /* Invoke callback function */ - cb_ret_val = - (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ - - /* Set the return value based on the callback's return value */ - if (cb_ret_val > 0) - ret_value = H5_ITER_STOP; /* terminate iteration early */ - else if (cb_ret_val < 0) - ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__iterate_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5I_iterate - * - * Purpose: Apply function FUNC to each member of type TYPE (with - * non-zero application reference count if app_ref is TRUE). - * Stop if FUNC returns a non zero value (i.e. anything - * other than H5_ITER_CONT). - * - * If FUNC returns a positive value (i.e. H5_ITER_STOP), - * return SUCCEED. - * - * If FUNC returns a negative value (i.e. H5_ITER_ERROR), - * return FAIL. + * Function: H5Iget_file_id * - * The FUNC should take a pointer to the object and the - * udata as arguments and return non-zero to terminate - * siteration, and zero to continue. + * Purpose: Obtains the file ID given an object ID. The user has to + * close this ID. * - * Limitation: Currently there is no way to start the iteration from - * where a previous iteration left off. + * Return: Success: The file ID associated with the object * - * Return: SUCCEED/FAIL + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ -herr_t -H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) +hid_t +H5Iget_file_id(hid_t obj_id) { - H5I_id_type_t *type_ptr; /* Pointer to the type */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments */ - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - type_ptr = H5I_id_type_list_g[type]; - - /* Only iterate through ID list if it is initialized and there are IDs in type */ - if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { - H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ - herr_t iter_status; /* Iteration status */ - - /* Set up iterator user data */ - iter_udata.user_func = func; - iter_udata.user_udata = udata; - iter_udata.app_ref = app_ref; - iter_udata.obj_type = type; - - /* Iterate over IDs */ - if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - } /* end if */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_iterate() */ + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "i", obj_id); -/*------------------------------------------------------------------------- - * Function: H5I__find_id - * - * Purpose: Given an object ID find the info struct that describes the - * object. - * - * Return: Success: A pointer to the object's info struct. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -static H5I_id_info_t * -H5I__find_id(hid_t id) -{ - H5I_type_t type; /*ID's type */ - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *ret_value = NULL; /* Return value */ + /* Get object type */ + type = H5I_TYPE(obj_id); - FUNC_ENTER_STATIC_NOERR + /* Call internal function */ + if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || + H5I_ATTR == type) { + H5VL_object_t *vol_obj; /* Object of obj_id */ - /* Check arguments */ - type = H5I_TYPE(id); - if (type <= H5I_BADID || (int)type >= H5I_next_type) - HGOTO_DONE(NULL) - type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->init_count <= 0) - HGOTO_DONE(NULL) - - /* Check for same ID as we have looked up last time */ - if (type_ptr->last_info && type_ptr->last_info->id == id) - ret_value = type_ptr->last_info; - else { - /* Locate the ID node for the ID */ - ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id); + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Remember this ID */ - type_ptr->last_info = ret_value; - } /* end else */ + /* Get the file ID */ + if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__find_id() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Iget_file_id() */ /*------------------------------------------------------------------------- * Function: H5Iget_name @@ -2173,10 +910,7 @@ done: * * Failure: -1 * - * NOTE: Not safe for arbitrary VOL connectors as it relies on - * private H5G calls. - * - * Comments: Public function + * Notes: * If 'name' is non-NULL then write up to 'size' bytes into that * buffer and always return the length of the entry name. * Otherwise 'size' is ignored and the function does not store the name, @@ -2191,16 +925,16 @@ done: ssize_t H5Iget_name(hid_t id, char *name /*out*/, size_t size) { - H5VL_object_t * vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj = NULL; /* Object stored in ID */ H5VL_loc_params_t loc_params; - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); /* Get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier") /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -2209,260 +943,8 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size) /* Retrieve object's name */ if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ - -/*------------------------------------------------------------------------- - * Function: H5Iget_file_id - * - * Purpose: Obtains the file ID given an object ID. The user has to - * close this ID. - * - * Return: Success: The file ID associated with the object - * - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -hid_t -H5Iget_file_id(hid_t obj_id) -{ - H5I_type_t type; /* ID type */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("i", "i", obj_id); - - /* Get object type */ - type = H5I_TYPE(obj_id); - - /* Call internal function */ - if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || - H5I_ATTR == type) { - H5VL_object_t *vol_obj; /* Object of obj_id */ - - /* Get the VOL object */ - if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - - /* Get the file ID */ - if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") - } /* end if */ - else - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Iget_file_id() */ - -/*------------------------------------------------------------------------- - * Function: H5I__find_id_cb - * - * Purpose: Callback for searching for an ID with a specific pointer - * - * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) - * Failure: H5_ITER_ERROR (-1) - * - *------------------------------------------------------------------------- - */ -static int -H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) -{ - H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ - H5I_type_t type = udata->obj_type; - const void * obj_ptr = NULL; - int ret_value = H5_ITER_CONT; /* Return value */ - - FUNC_ENTER_STATIC_NOERR - - /* Sanity check */ - HDassert(item); - HDassert(udata); - - /* Get a pointer to the VOL connector's data */ - obj_ptr = H5I__unwrap(item->obj_ptr, type); - - /* Check for a match */ - if (obj_ptr == udata->object) { - udata->ret_id = item->id; - ret_value = H5_ITER_STOP; - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__find_id_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5I_find_id - * - * Purpose: Return the ID of an object by searching through the ID list - * for the type. - * - * Return: SUCCEED/FAIL - * (id will be set to H5I_INVALID_HID on errors or not found) - * - *------------------------------------------------------------------------- - */ -herr_t -H5I_find_id(const void *object, H5I_type_t type, hid_t *id) -{ - H5I_id_type_t *type_ptr; /* Pointer to the type */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(id); - - *id = H5I_INVALID_HID; - - type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - - /* Only iterate through ID list if it is initialized and there are IDs in type */ - if (type_ptr->init_count > 0 && type_ptr->id_count > 0) { - H5I_get_id_ud_t udata; /* User data */ - herr_t iter_status; /* Iteration status */ - - /* Set up iterator user data */ - udata.object = object; - udata.obj_type = type; - udata.ret_id = H5I_INVALID_HID; - - /* Iterate over IDs for the ID type */ - if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__find_id_cb, &udata)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - - *id = udata.ret_id; - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_find_id() */ - -/*------------------------------------------------------------------------- - * Function: H5I__id_dump_cb - * - * Purpose: Dump the contents of an ID to stderr for debugging. - * - * Return: H5_ITER_CONT (always) - * - *------------------------------------------------------------------------- - */ -static int -H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) -{ - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ - H5G_name_t * path = NULL; /* Path to file object */ - const void * obj_ptr = NULL; /* Pointer to VOL connector object */ - - FUNC_ENTER_STATIC_NOERR - - HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); - HDfprintf(stderr, " count = %u\n", item->count); - HDfprintf(stderr, " obj = 0x%08p\n", item->obj_ptr); - - /* Get the group location, so we get get the name */ - switch (type) { - case H5I_GROUP: { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - - obj_ptr = H5VL_object_data(vol_obj); - if (H5_VOL_NATIVE == vol_obj->connector->cls->value) - path = H5G_nameof((const H5G_t *)obj_ptr); - break; - } - - case H5I_DATASET: { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - - obj_ptr = H5VL_object_data(vol_obj); - if (H5_VOL_NATIVE == vol_obj->connector->cls->value) - path = H5D_nameof((const H5D_t *)obj_ptr); - break; - } - - case H5I_DATATYPE: { - const H5T_t *dt = (const H5T_t *)item->obj_ptr; - - obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ - path = H5T_nameof((const H5T_t *)obj_ptr); - break; - } - - /* TODO: Maps will have to be added when they are supported in the - * native VOL connector. - */ - case H5I_MAP: - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - case H5I_VFL: - case H5I_VOL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_SPACE_SEL_ITER: - case H5I_NTYPES: - default: - break; /* Other types of IDs are not stored in files */ - } - - if (path) { - if (path->user_path_r) - HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); - if (path->full_path_r) - HDfprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); - } - - FUNC_LEAVE_NOAPI(H5_ITER_CONT) -} /* end H5I__id_dump_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5I_dump_ids_for_type - * - * Purpose: Dump the contents of a type to stderr for debugging. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5I_dump_ids_for_type(H5I_type_t type) -{ - H5I_id_type_t *type_ptr = NULL; - - FUNC_ENTER_NOAPI_NOERR - - HDfprintf(stderr, "Dumping ID type %d\n", (int)type); - type_ptr = H5I_id_type_list_g[type]; - - if (type_ptr) { - - /* Header */ - HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); - HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); - HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); - - /* List */ - if (type_ptr->id_count > 0) { - HDfprintf(stderr, " List:\n"); - H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); - } - } - else - HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n"); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5I_dump_ids_for_type() */ diff --git a/src/H5Idbg.c b/src/H5Idbg.c new file mode 100644 index 0000000..8894230 --- /dev/null +++ b/src/H5Idbg.c @@ -0,0 +1,192 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * H5Idbg.c - Debugging routines for handling IDs + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Imodule.h" /* This source code file is part of the H5I module */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Ipkg.h" /* IDs */ +#include "H5RSprivate.h" /* Reference-counted strings */ +#include "H5SLprivate.h" /* Skip Lists */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Package Typedefs */ +/********************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/*------------------------------------------------------------------------- + * Function: H5I__id_dump_cb + * + * Purpose: Dump the contents of an ID to stderr for debugging. + * + * Return: H5_ITER_CONT (always) + * + *------------------------------------------------------------------------- + */ +static int +H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) +{ + H5I_id_info_t * info = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ + const H5G_name_t *path = NULL; /* Path to file object */ + const void * object = NULL; /* Pointer to VOL connector object */ + + FUNC_ENTER_STATIC_NOERR + + HDfprintf(stderr, " id = %" PRIdHID "\n", info->id); + HDfprintf(stderr, " count = %u\n", info->count); + HDfprintf(stderr, " obj = 0x%8p\n", info->object); + + /* Get the group location, so we get get the name */ + switch (type) { + case H5I_GROUP: { + const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->object; + + object = H5VL_object_data(vol_obj); + if (H5_VOL_NATIVE == vol_obj->connector->cls->value) + path = H5G_nameof((const H5G_t *)object); + break; + } + + case H5I_DATASET: { + const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->object; + + object = H5VL_object_data(vol_obj); + if (H5_VOL_NATIVE == vol_obj->connector->cls->value) + path = H5D_nameof((const H5D_t *)object); + break; + } + + case H5I_DATATYPE: { + const H5T_t *dt = (const H5T_t *)info->object; + + H5_GCC_DIAG_OFF("cast-qual") + object = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ + H5_GCC_DIAG_ON("cast-qual") + + path = H5T_nameof((const H5T_t *)object); + break; + } + + /* TODO: Maps will have to be added when they are supported in the + * native VOL connector. + */ + case H5I_MAP: + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: + case H5I_NTYPES: + default: + break; /* Other types of IDs are not stored in files */ + } + + if (path) { + if (path->user_path_r) + HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); + if (path->full_path_r) + HDfprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); + } + + FUNC_LEAVE_NOAPI(H5_ITER_CONT) +} /* end H5I__id_dump_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5I_dump_ids_for_type + * + * Purpose: Dump the contents of a type to stderr for debugging. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_dump_ids_for_type(H5I_type_t type) +{ + H5I_type_info_t *type_info = NULL; + + FUNC_ENTER_NOAPI_NOERR + + HDfprintf(stderr, "Dumping ID type %d\n", (int)type); + type_info = H5I_type_info_array_g[type]; + + if (type_info) { + + /* Header */ + HDfprintf(stderr, " init_count = %u\n", type_info->init_count); + HDfprintf(stderr, " reserved = %u\n", type_info->cls->reserved); + HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_info->id_count); + HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_info->nextid); + + /* List */ + if (type_info->id_count > 0) { + HDfprintf(stderr, " List:\n"); + H5SL_iterate(type_info->ids, H5I__id_dump_cb, &type); + } + } + else + HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n"); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5I_dump_ids_for_type() */ diff --git a/src/H5Iint.c b/src/H5Iint.c new file mode 100644 index 0000000..41c6316 --- /dev/null +++ b/src/H5Iint.c @@ -0,0 +1,1744 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * H5Iint.c - Private routines for handling IDs + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Imodule.h" /* This source code file is part of the H5I module */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5SLprivate.h" /* Skip Lists */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + +/****************/ +/* Local Macros */ +/****************/ + +/* Combine a Type number and an ID index into an ID */ +#define H5I_MAKE(g, i) ((((hid_t)(g)&TYPE_MASK) << ID_BITS) | ((hid_t)(i)&ID_MASK)) + +/******************/ +/* Local Typedefs */ +/******************/ + +/* User data for iterator callback for retrieving an ID corresponding to an object pointer */ +typedef struct { + const void *object; /* object pointer to search for */ + H5I_type_t obj_type; /* type of object we are searching for */ + hid_t ret_id; /* ID returned */ +} H5I_get_id_ud_t; + +/* User data for iterator callback for ID iteration */ +typedef struct { + H5I_search_func_t user_func; /* 'User' function to invoke */ + void * user_udata; /* User data to pass to 'user' function */ + hbool_t app_ref; /* Whether this is an appl. ref. call */ + H5I_type_t obj_type; /* Type of object we are iterating over */ +} H5I_iterate_ud_t; + +/* User data for H5I__clear_type_cb */ +typedef struct { + H5I_type_info_t *type_info; /* Pointer to the type's info to be cleared */ + hbool_t force; /* Whether to always remove the ID */ + hbool_t app_ref; /* Whether this is an appl. ref. call */ +} H5I_clear_type_ud_t; + +/********************/ +/* Package Typedefs */ +/********************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +static void * H5I__unwrap(void *object, H5I_type_t type); +static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); +static void * H5I__remove_common(H5I_type_info_t *type_info, hid_t id); +static int H5I__dec_ref(hid_t id, void **request); +static int H5I__dec_app_ref(hid_t id, void **request); +static int H5I__dec_app_ref_always_close(hid_t id, void **request); +static int H5I__find_id_cb(void *_item, void *_key, void *_udata); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + +/* Declared extern in H5Ipkg.h and documented there */ +H5I_type_info_t *H5I_type_info_array_g[H5I_MAX_NUM_TYPES]; +int H5I_next_type_g = (int)H5I_NTYPES; + +/* Declare a free list to manage the H5I_id_info_t struct */ +H5FL_DEFINE_STATIC(H5I_id_info_t); + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/*------------------------------------------------------------------------- + * Function: H5I_term_package + * + * Purpose: Terminate the H5I interface: release all memory, reset all + * global variables to initial values. This only happens if all + * types have been destroyed from other interfaces. + * + * Return: Success: Positive if any action was taken that might + * affect some other interface; zero otherwise. + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +int +H5I_term_package(void) +{ + int in_use = 0; /* Number of ID types still in use */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (H5_PKG_INIT_VAR) { + H5I_type_info_t *type_info = NULL; /* Pointer to ID type */ + int i; + + /* Count the number of types still in use */ + for (i = 0; i < H5I_next_type_g; i++) + if ((type_info = H5I_type_info_array_g[i]) && type_info->ids) + in_use++; + + /* If no types are still being used then clean up */ + if (0 == in_use) { + for (i = 0; i < H5I_next_type_g; i++) { + type_info = H5I_type_info_array_g[i]; + if (type_info) { + HDassert(NULL == type_info->ids); + type_info = H5MM_xfree(type_info); + H5I_type_info_array_g[i] = NULL; + in_use++; + } + } + + /* Mark interface closed */ + if (0 == in_use) + H5_PKG_INIT_VAR = FALSE; + } + } + + FUNC_LEAVE_NOAPI(in_use) +} /* end H5I_term_package() */ + +/*------------------------------------------------------------------------- + * Function: H5I_register_type + * + * Purpose: Creates a new type of ID's to give out. + * The class is initialized or its reference count is incremented + * (if it is already initialized). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_register_type(const H5I_class_t *cls) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the ID type*/ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(cls); + HDassert(cls->type > 0 && (int)cls->type < H5I_MAX_NUM_TYPES); + + /* Initialize the type */ + if (NULL == H5I_type_info_array_g[cls->type]) { + /* Allocate the type information for new type */ + if (NULL == (type_info = (H5I_type_info_t *)H5MM_calloc(sizeof(H5I_type_info_t)))) + HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, FAIL, "ID type allocation failed") + H5I_type_info_array_g[cls->type] = type_info; + } + else { + /* Get the pointer to the existing type */ + type_info = H5I_type_info_array_g[cls->type]; + } + + /* Initialize the ID type structure for new types */ + if (type_info->init_count == 0) { + type_info->cls = cls; + type_info->id_count = 0; + type_info->nextid = cls->reserved; + type_info->last_id_info = NULL; + if (NULL == (type_info->ids = H5SL_create(H5SL_TYPE_HID, NULL))) + HGOTO_ERROR(H5E_ID, H5E_CANTCREATE, FAIL, "skip list creation failed") + } + + /* Increment the count of the times this type has been initialized */ + type_info->init_count++; + +done: + /* Clean up on error */ + if (ret_value < 0) { + if (type_info) { + if (type_info->ids) + H5SL_close(type_info->ids); + H5MM_free(type_info); + } + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_register_type() */ + +/*------------------------------------------------------------------------- + * Function: H5I_nmembers + * + * Purpose: Returns the number of members in a type. + * + * Return: Success: Number of members; zero if the type is empty + * or has been deleted. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Wednesday, March 24, 1999 + * + *------------------------------------------------------------------------- + */ +int64_t +H5I_nmembers(H5I_type_t type) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */ + int64_t ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Validate parameter */ + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (NULL == (type_info = H5I_type_info_array_g[type]) || type_info->init_count <= 0) + HGOTO_DONE(0); + + /* Set return value */ + H5_CHECKED_ASSIGN(ret_value, int64_t, type_info->id_count, uint64_t); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_nmembers() */ + +/*------------------------------------------------------------------------- + * Function: H5I__unwrap + * + * Purpose: Unwraps the object pointer for the 'item' that corresponds + * to an ID. + * + * Return: Pointer to the unwrapped pointer (can't fail) + * + * Programmer: Quincey Koziol + * Friday, October 19, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5I__unwrap(void *object, H5I_type_t type) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(object); + + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + const H5VL_object_t *vol_obj; + + vol_obj = (const H5VL_object_t *)object; + ret_value = H5VL_object_data(vol_obj); + } + else if (H5I_DATATYPE == type) { + H5T_t *dt = (H5T_t *)object; + + ret_value = (void *)H5T_get_actual_type(dt); + } + else + ret_value = object; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__unwrap() */ + +/*------------------------------------------------------------------------- + * Function: H5I_clear_type + * + * Purpose: Removes all objects from the type, calling the free + * function for each object regardless of the reference count. + * + * Return: SUCCEED/FAIL + * + * Programmer: Robb Matzke + * Wednesday, March 24, 1999 + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) +{ + H5I_clear_type_ud_t udata; /* udata struct for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Validate parameters */ + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + + udata.type_info = H5I_type_info_array_g[type]; + if (udata.type_info == NULL || udata.type_info->init_count <= 0) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + + /* Finish constructing udata */ + udata.force = force; + udata.app_ref = app_ref; + + /* Attempt to free all ids in the type */ + if (H5SL_try_free_safe(udata.type_info->ids, H5I__clear_type_cb, &udata) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, FAIL, "can't free ids in type") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_clear_type() */ + +/*------------------------------------------------------------------------- + * Function: H5I__clear_type_cb + * + * Purpose: Attempts to free the specified ID, calling the free + * function for the object. + * + * Return: TRUE/FALSE/FAIL + * + * Programmer: Neil Fortner + * Friday, July 10, 2015 + * + *------------------------------------------------------------------------- + */ +static htri_t +H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata) +{ + H5I_id_info_t * info = (H5I_id_info_t *)_info; /* Current ID info being worked with */ + H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(info); + HDassert(udata); + HDassert(udata->type_info); + + /* Do nothing to the object if the reference count is larger than + * one and forcing is off. + */ + if (udata->force || (info->count - (!udata->app_ref * info->app_count)) <= 1) { + /* Check if this is an un-realized future object */ + H5_GCC_DIAG_OFF("cast-qual") + if (info->is_future) { + /* Discard the future object */ + if ((info->discard_cb)((void *)info->object) < 0) { + if (udata->force) { +#ifdef H5I_DEBUG + if (H5DEBUG(I)) { + HDfprintf(H5DEBUG(I), + "H5I: discard type=%d obj=0x%08lx " + "failure ignored\n", + (int)udata->type_info->cls->type, (unsigned long)(info->object)); + } +#endif /* H5I_DEBUG */ + + /* Indicate node should be removed from list */ + ret_value = TRUE; + } + } + else { + /* Indicate node should be removed from list */ + ret_value = TRUE; + } + } + else { + /* Check for a 'free' function and call it, if it exists */ + if (udata->type_info->cls->free_func && + (udata->type_info->cls->free_func)((void *)info->object, H5_REQUEST_NULL) < 0) { + if (udata->force) { +#ifdef H5I_DEBUG + if (H5DEBUG(I)) { + HDfprintf(H5DEBUG(I), + "H5I: free type=%d obj=0x%08lx " + "failure ignored\n", + (int)udata->type_info->cls->type, (unsigned long)(info->object)); + } +#endif /* H5I_DEBUG */ + + /* Indicate node should be removed from list */ + ret_value = TRUE; + } + } + else { + /* Indicate node should be removed from list */ + ret_value = TRUE; + } + } + H5_GCC_DIAG_ON("cast-qual") + + /* Remove ID if requested */ + if (ret_value) { + /* Free ID info */ + info = H5FL_FREE(H5I_id_info_t, info); + + /* Decrement the number of IDs in the type */ + udata->type_info->id_count--; + } + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__clear_type_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5I__destroy_type + * + * Purpose: Destroys a type along with all IDs in that type + * regardless of their reference counts. Destroying IDs + * involves calling the free-func for each ID's object and + * then adding the ID struct to the ID free list. + * + * Return: SUCCEED/FAIL + * + * Programmer: Nathaniel Furrer + * James Laird + * + *------------------------------------------------------------------------- + */ +herr_t +H5I__destroy_type(H5I_type_t type) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Validate parameter */ + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + + type_info = H5I_type_info_array_g[type]; + if (type_info == NULL || type_info->init_count <= 0) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + + /* Close/clear/destroy all IDs for this type */ + H5E_BEGIN_TRY + { + H5I_clear_type(type, TRUE, FALSE); + } + H5E_END_TRY /* don't care about errors */ + + /* Check if we should release the ID class */ + if (type_info->cls->flags & H5I_CLASS_IS_APPLICATION) + type_info->cls = H5MM_xfree_const(type_info->cls); + + if (H5SL_close(type_info->ids) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") + type_info->ids = NULL; + + type_info = H5MM_xfree(type_info); + + H5I_type_info_array_g[type] = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__destroy_type() */ + +/*------------------------------------------------------------------------- + * Function: H5I__register + * + * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. + * This routine does _not_ check for unique-ness of the objects, + * if you register an object twice, you will get two different + * IDs for it. This routine does make certain that each ID in a + * type is unique. IDs are created by getting a unique number + * for the type the ID is in and incorporating the TYPE into + * the ID which is returned to the user. + * + * IDs are marked as "future" if the realize_cb and discard_cb + * parameters are non-NULL. + * + * Return: Success: New object ID + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5I__register(H5I_type_t type, const void *object, hbool_t app_ref, H5I_future_realize_func_t realize_cb, + H5I_future_discard_func_t discard_cb) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the type */ + H5I_id_info_t * info = NULL; /* Pointer to the new ID information */ + hid_t new_id = H5I_INVALID_HID; /* New ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + type_info = H5I_type_info_array_g[type]; + if ((NULL == type_info) || (type_info->init_count <= 0)) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, H5I_INVALID_HID, "invalid type") + if (NULL == (info = H5FL_CALLOC(H5I_id_info_t))) + HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") + + /* Create the struct & its ID */ + new_id = H5I_MAKE(type, type_info->nextid); + info->id = new_id; + info->count = 1; /* initial reference count */ + info->app_count = !!app_ref; + info->object = object; + info->is_future = (NULL != realize_cb); + info->realize_cb = realize_cb; + info->discard_cb = discard_cb; + + /* Insert into the type */ + if (H5SL_insert(type_info->ids, info, &info->id) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert ID node into skip list") + type_info->id_count++; + type_info->nextid++; + + /* Sanity check for the 'nextid' getting too large and wrapping around */ + HDassert(type_info->nextid <= ID_MASK); + + /* Set the most recent ID to this object */ + type_info->last_id_info = info; + + /* Set return value */ + ret_value = new_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__register() */ + +/*------------------------------------------------------------------------- + * Function: H5I_register + * + * Purpose: Library-private wrapper for H5I__register. + * + * Return: Success: New object ID + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) +{ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Sanity checks */ + HDassert(type >= H5I_FILE && type < H5I_NTYPES); + HDassert(object); + + /* Retrieve ID for object */ + if (H5I_INVALID_HID == (ret_value = H5I__register(type, object, app_ref, NULL, NULL))) + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_register() */ + +/*------------------------------------------------------------------------- + * Function: H5I_register_using_existing_id + * + * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. + * This routine will check to ensure the supplied ID is not already + * in use, and ensure that it is a valid ID for the given type, + * but will NOT check to ensure the OBJECT is not already + * registered (thus, it is possible to register one object under + * multiple IDs). + * + * NOTE: Intended for use in refresh calls, where we have to close + * and re-open the underlying data, then hook the object back + * up to the original ID. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the type */ + H5I_id_info_t * info = NULL; /* Pointer to the new ID information */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(object); + + /* Make sure ID is not already in use */ + if (NULL != (info = H5I__find_id(existing_id))) + HGOTO_ERROR(H5E_ID, H5E_BADRANGE, FAIL, "ID already in use") + + /* Make sure type number is valid */ + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + + /* Get type pointer from list of types */ + type_info = H5I_type_info_array_g[type]; + + if (NULL == type_info || type_info->init_count <= 0) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + + /* Make sure requested ID belongs to object's type */ + if (H5I_TYPE(existing_id) != type) + HGOTO_ERROR(H5E_ID, H5E_BADRANGE, FAIL, "invalid type for provided ID") + + /* Allocate new structure to house this ID */ + if (NULL == (info = H5FL_CALLOC(H5I_id_info_t))) + HGOTO_ERROR(H5E_ID, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Create the struct & insert requested ID */ + info->id = existing_id; + info->count = 1; /* initial reference count*/ + info->app_count = !!app_ref; + info->object = object; + /* This API call is only used by the native VOL connector, which is + * not asynchronous. + */ + info->is_future = FALSE; + info->realize_cb = NULL; + info->discard_cb = NULL; + + /* Insert into the type */ + if (H5SL_insert(type_info->ids, info, &info->id) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") + type_info->id_count++; + + /* Set the most recent ID to this object */ + type_info->last_id_info = info; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_register_using_existing_id() */ + +/*------------------------------------------------------------------------- + * Function: H5I_subst + * + * Purpose: Substitute a new object pointer for the specified ID. + * + * Return: Success: Non-NULL previous object pointer associated + * with the specified ID. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Saturday, February 27, 2010 + * + *------------------------------------------------------------------------- + */ +void * +H5I_subst(hid_t id, const void *new_object) +{ + H5I_id_info_t *info = NULL; /* Pointer to the ID's info */ + void * ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* General lookup of the ID */ + if (NULL == (info = H5I__find_id(id))) + HGOTO_ERROR(H5E_ID, H5E_NOTFOUND, NULL, "can't get ID ref count") + + /* Get the old object pointer to return */ + H5_GCC_DIAG_OFF("cast-qual") + ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + H5_GCC_DIAG_ON("cast-qual") + + /* Set the new object pointer for the ID */ + info->object = new_object; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_subst() */ + +/*------------------------------------------------------------------------- + * Function: H5I_object + * + * Purpose: Find an object pointer for the specified ID. + * + * Return: Success: Non-NULL object pointer associated with the + * specified ID + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5I_object(hid_t id) +{ + H5I_id_info_t *info = NULL; /* Pointer to the ID info */ + void * ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOERR + + /* General lookup of the ID */ + if (NULL != (info = H5I__find_id(id))) { + /* Get the object pointer to return */ + H5_GCC_DIAG_OFF("cast-qual") + ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + H5_GCC_DIAG_ON("cast-qual") + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_object() */ + +/*------------------------------------------------------------------------- + * Function: H5I_object_verify + * + * Purpose: Find an object pointer for the specified ID, verifying that + * its in a particular type. + * + * Return: Success: Non-NULL object pointer associated with the + * specified ID. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Wednesday, July 31, 2002 + * + *------------------------------------------------------------------------- + */ +void * +H5I_object_verify(hid_t id, H5I_type_t type) +{ + H5I_id_info_t *info = NULL; /* Pointer to the ID info */ + void * ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOERR + + HDassert(type >= 1 && (int)type < H5I_next_type_g); + + /* Verify that the type of the ID is correct & lookup the ID */ + if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id))) { + /* Get the object pointer to return */ + H5_GCC_DIAG_OFF("cast-qual") + ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + H5_GCC_DIAG_ON("cast-qual") + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5I_object_verify() */ + +/*------------------------------------------------------------------------- + * Function: H5I_get_type + * + * Purpose: Given an object ID return the type to which it + * belongs. The ID need not be the ID of an object which + * currently exists because the type number is encoded + * in the object ID. + * + * Return: Success: A positive integer (corresponding to an H5I_type_t + * enum value for library ID types, but not for user + * ID types). + * Failure: H5I_BADID + * + * Programmer: Robb Matzke + * Friday, February 19, 1999 + * + *------------------------------------------------------------------------- + */ +H5I_type_t +H5I_get_type(hid_t id) +{ + H5I_type_t ret_value = H5I_BADID; /* Return value */ + + FUNC_ENTER_NOAPI_NOERR + + if (id > 0) + ret_value = H5I_TYPE(id); + + HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type_g); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_get_type() */ + +/*------------------------------------------------------------------------- + * Function: H5I_is_file_object + * + * Purpose: Convenience function to determine if an ID represents + * a file object. + * + * In H5O calls, you can't use object_verify to ensure + * the ID was of the correct class since there's no + * H5I_OBJECT ID class. + * + * Return: Success: TRUE/FALSE + * Failure: FAIL + * + *------------------------------------------------------------------------- + */ +htri_t +H5I_is_file_object(hid_t id) +{ + H5I_type_t type = H5I_get_type(id); + htri_t ret_value = FAIL; + + FUNC_ENTER_NOAPI(FAIL); + + /* Fail if the ID type is out of range */ + if (type < 1 || type >= H5I_NTYPES) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID type out of range"); + + /* Return TRUE if the ID is a file object (dataset, group, map, or committed + * datatype), FALSE otherwise. + */ + if (H5I_DATASET == type || H5I_GROUP == type || H5I_MAP == type) + ret_value = TRUE; + else if (H5I_DATATYPE == type) { + + H5T_t *dt = NULL; + + if (NULL == (dt = (H5T_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get underlying datatype struct"); + + ret_value = H5T_is_named(dt); + } + else + ret_value = FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5I_is_file_object() */ + +/*------------------------------------------------------------------------- + * Function: H5I__remove_verify + * + * Purpose: Removes the specified ID from its type, first checking that + * the ID's type is the same as the ID type supplied as an argument + * + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL + * + * Programmer: James Laird + * Nat Furrer + * + *------------------------------------------------------------------------- + */ +void * +H5I__remove_verify(hid_t id, H5I_type_t type) +{ + void *ret_value = NULL; /*return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Argument checking will be performed by H5I_remove() */ + + /* Verify that the type of the ID is correct */ + if (type == H5I_TYPE(id)) + ret_value = H5I_remove(id); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__remove_verify() */ + +/*------------------------------------------------------------------------- + * Function: H5I__remove_common + * + * Purpose: Common code to remove a specified ID from its type. + * + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL + * + * Programmer: Quincey Koziol + * October 3, 2013 + * + *------------------------------------------------------------------------- + */ +static void * +H5I__remove_common(H5I_type_info_t *type_info, hid_t id) +{ + H5I_id_info_t *info = NULL; /* Pointer to the current ID */ + void * ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(type_info); + + /* Get the ID node for the ID */ + if (NULL == (info = (H5I_id_info_t *)H5SL_remove(type_info->ids, &id))) + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") + + /* Check if this ID was the last one accessed */ + if (type_info->last_id_info == info) + type_info->last_id_info = NULL; + + H5_GCC_DIAG_OFF("cast-qual") + ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + H5_GCC_DIAG_ON("cast-qual") + + info = H5FL_FREE(H5I_id_info_t, info); + + /* Decrement the number of IDs in the type */ + (type_info->id_count)--; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__remove_common() */ + +/*------------------------------------------------------------------------- + * Function: H5I_remove + * + * Purpose: Removes the specified ID from its type. + * + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5I_remove(hid_t id) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */ + H5I_type_t type = H5I_BADID; /* ID's type */ + void * ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check arguments */ + type = H5I_TYPE(id); + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") + type_info = H5I_type_info_array_g[type]; + if (type_info == NULL || type_info->init_count <= 0) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "invalid type") + + /* Remove the node from the type */ + if (NULL == (ret_value = H5I__remove_common(type_info, id))) + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_remove() */ + +/*------------------------------------------------------------------------- + * Function: H5I__dec_ref + * + * Purpose: This will fail if the type is not a reference counted type. + * The ID type's 'free' function will be called for the ID + * if the reference count for the ID reaches 0 and a free + * function has been defined at type creation time. + * + * Note: Allows for asynchronous 'close' operation on object, with + * request != H5_REQUEST_NULL. + * + * Return: Success: New reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static int +H5I__dec_ref(hid_t id, void **request) +{ + H5I_id_info_t *info = NULL; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(id >= 0); + + /* General lookup of the ID */ + if (NULL == (info = H5I__find_id(id))) + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + + /* If this is the last reference to the object then invoke the type's + * free method on the object. If the free method is undefined or + * successful then remove the object from the type; otherwise leave + * the object in the type without decrementing the reference + * count. If the reference count is more than one then decrement the + * reference count without calling the free method. + * + * Beware: the free method may call other H5I functions. + * + * If an object is closing, we can remove the ID even though the free + * method might fail. This can happen when a mandatory filter fails to + * write when a dataset is closed and the chunk cache is flushed to the + * file. We have to close the dataset anyway. (SLU - 2010/9/7) + */ + if (1 == info->count) { + H5I_type_info_t *type_info; /*ptr to the type */ + + /* Get the ID's type */ + type_info = H5I_type_info_array_g[H5I_TYPE(id)]; + + H5_GCC_DIAG_OFF("cast-qual") + /* (Casting away const OK -QAK) */ + if (!type_info->cls->free_func || (type_info->cls->free_func)((void *)info->object, request) >= 0) { + /* Remove the node from the type */ + if (NULL == H5I__remove_common(type_info, id)) + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, (-1), "can't remove ID node") + ret_value = 0; + } /* end if */ + else + ret_value = -1; + H5_GCC_DIAG_ON("cast-qual") + } /* end if */ + else { + --(info->count); + ret_value = (int)info->count; + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__dec_ref */ + +/*------------------------------------------------------------------------- + * Function: H5I_dec_ref + * + * Purpose: Decrements the number of references outstanding for an ID. + * + * Return: Success: New reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I_dec_ref(hid_t id) +{ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Sanity check */ + HDassert(id >= 0); + + /* Synchronously decrement refcount on ID */ + if ((ret_value = H5I__dec_ref(id, H5_REQUEST_NULL)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I__dec_app_ref + * + * Purpose: Wrapper for case of modifying the application ref. + * count for an ID as well as normal reference count. + * + * Note: Allows for asynchronous 'close' operation on object, with + * request != H5_REQUEST_NULL. + * + * Return: Success: New app. reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static int +H5I__dec_app_ref(hid_t id, void **request) +{ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(id >= 0); + + /* Call regular decrement reference count routine */ + if ((ret_value = H5I__dec_ref(id, request)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + + /* Check if the ID still exists */ + if (ret_value > 0) { + H5I_id_info_t *info = NULL; /* Pointer to the ID info */ + + /* General lookup of the ID */ + if (NULL == (info = H5I__find_id(id))) + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + + /* Adjust app_ref */ + --(info->app_count); + HDassert(info->count >= info->app_count); + + /* Set return value */ + ret_value = (int)info->app_count; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__dec_app_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I_dec_app_ref + * + * Purpose: Wrapper for case of modifying the application ref. count for + * an ID as well as normal reference count. + * + * Return: Success: New app. reference count + * Failure: -1 + * + * Programmer: Quincey Koziol + * Sept 16, 2010 + * + *------------------------------------------------------------------------- + */ +int +H5I_dec_app_ref(hid_t id) +{ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Sanity check */ + HDassert(id >= 0); + + /* Synchronously decrement refcount on ID */ + if ((ret_value = H5I__dec_app_ref(id, H5_REQUEST_NULL)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_app_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I_dec_app_ref_async + * + * Purpose: Asynchronous wrapper for case of modifying the application ref. + * count for an ID as well as normal reference count. + * + * Note: Allows for asynchronous 'close' operation on object, with + * token != H5_REQUEST_NULL. + * + * Return: Success: New app. reference count + * Failure: -1 + * + * Programmer: Houjun Tang + * Oct 21, 2019 + * + *------------------------------------------------------------------------- + */ +int +H5I_dec_app_ref_async(hid_t id, void **token) +{ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Sanity check */ + HDassert(id >= 0); + + /* [Possibly] aynchronously decrement refcount on ID */ + if ((ret_value = H5I__dec_app_ref(id, token)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_app_ref_async() */ + +/*------------------------------------------------------------------------- + * Function: H5I__dec_app_ref_always_close + * + * Purpose: Wrapper for case of always closing the ID, even when the free + * routine fails + * + * Note: Allows for asynchronous 'close' operation on object, with + * request != H5_REQUEST_NULL. + * + * Return: Success: New app. reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static int +H5I__dec_app_ref_always_close(hid_t id, void **request) +{ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(id >= 0); + + /* Call application decrement reference count routine */ + ret_value = H5I__dec_app_ref(id, request); + + /* Check for failure */ + if (ret_value < 0) { + /* + * If an object is closing, we can remove the ID even though the free + * method might fail. This can happen when a mandatory filter fails to + * write when a dataset is closed and the chunk cache is flushed to the + * file. We have to close the dataset anyway. (SLU - 2010/9/7) + */ + H5I_remove(id); + + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__dec_app_ref_always_close() */ + +/*------------------------------------------------------------------------- + * Function: H5I_dec_app_ref_always_close + * + * Purpose: Wrapper for case of always closing the ID, even when the free + * routine fails. + * + * Return: Success: New app. reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I_dec_app_ref_always_close(hid_t id) +{ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Sanity check */ + HDassert(id >= 0); + + /* Synchronously decrement refcount on ID */ + if ((ret_value = H5I__dec_app_ref_always_close(id, H5_REQUEST_NULL)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_app_ref_always_close() */ + +/*------------------------------------------------------------------------- + * Function: H5I_dec_app_ref_always_close_async + * + * Purpose: Asynchronous wrapper for case of always closing the ID, even + * when the free routine fails + * + * Note: Allows for asynchronous 'close' operation on object, with + * token != H5_REQUEST_NULL. + * + * Return: Success: New app. reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I_dec_app_ref_always_close_async(hid_t id, void **token) +{ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Sanity check */ + HDassert(id >= 0); + + /* [Possibly] aynchronously decrement refcount on ID */ + if ((ret_value = H5I__dec_app_ref_always_close(id, token)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_app_ref_always_close_async() */ + +/*------------------------------------------------------------------------- + * Function: H5I_inc_ref + * + * Purpose: Increment the reference count for an object. + * + * Return: Success: The new reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I_inc_ref(hid_t id, hbool_t app_ref) +{ + H5I_id_info_t *info = NULL; /* Pointer to the ID info */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Sanity check */ + HDassert(id >= 0); + + /* General lookup of the ID */ + if (NULL == (info = H5I__find_id(id))) + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + + /* Adjust reference counts */ + ++(info->count); + if (app_ref) + ++(info->app_count); + + /* Set return value */ + ret_value = (int)(app_ref ? info->app_count : info->count); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_inc_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I_get_ref + * + * Purpose: Retrieve the reference count for an object. + * + * Return: Success: The reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I_get_ref(hid_t id, hbool_t app_ref) +{ + H5I_id_info_t *info = NULL; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + /* Sanity check */ + HDassert(id >= 0); + + /* General lookup of the ID */ + if (NULL == (info = H5I__find_id(id))) + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + + /* Set return value */ + ret_value = (int)(app_ref ? info->app_count : info->count); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_get_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I__inc_type_ref + * + * Purpose: Increment the reference count for an ID type. + * + * Return: Success: The new reference count + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I__inc_type_ref(H5I_type_t type) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the type */ + int ret_value = -1; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(type > 0 && (int)type < H5I_next_type_g); + + /* Check arguments */ + type_info = H5I_type_info_array_g[type]; + if (NULL == type_info) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type") + + /* Set return value */ + ret_value = (int)(++(type_info->init_count)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__inc_type_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I_dec_type_ref + * + * Purpose: Decrements the reference count on an entire type of IDs. + * If the type reference count becomes zero then the type is + * destroyed along with all IDs in that type regardless of + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. + * Returns the number of references to the type on success; a + * return value of 0 means that the type will have to be + * re-initialized before it can be used again (and should probably + * be set to H5I_UNINIT). + * + * Return: Success: Number of references to type + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I_dec_type_ref(H5I_type_t type) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI((-1)) + + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number") + + type_info = H5I_type_info_array_g[type]; + if (type_info == NULL || type_info->init_count <= 0) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type") + + /* Decrement the number of users of the ID type. If this is the + * last user of the type then release all IDs from the type and + * free all memory it used. The free function is invoked for each ID + * being freed. + */ + if (1 == type_info->init_count) { + H5I__destroy_type(type); + ret_value = 0; + } + else { + --(type_info->init_count); + ret_value = (herr_t)type_info->init_count; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_type_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I__get_type_ref + * + * Purpose: Retrieve the reference count for an ID type. + * + * Return: Success: The reference count + * + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +int +H5I__get_type_ref(H5I_type_t type) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the type */ + int ret_value = -1; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(type >= 0); + + /* Check arguments */ + type_info = H5I_type_info_array_g[type]; + if (!type_info) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type") + + /* Set return value */ + ret_value = (int)type_info->init_count; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__get_type_ref() */ + +/*------------------------------------------------------------------------- + * Function: H5I__iterate_cb + * + * Purpose: Callback routine for H5I_iterate, invokes "user" callback + * function, and then sets return value, based on the result of + * that callback. + * + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) + * + *------------------------------------------------------------------------- + */ +static int +H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) +{ + H5I_id_info_t * info = (H5I_id_info_t *)_item; /* Pointer to the ID info */ + H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */ + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Only invoke the callback function if this ID is visible externally and + * its reference count is positive. + */ + if ((!udata->app_ref) || (info->app_count > 0)) { + H5I_type_t type = udata->obj_type; + void * object; + herr_t cb_ret_val; + + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + H5_GCC_DIAG_OFF("cast-qual") + object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */ + H5_GCC_DIAG_ON("cast-qual") + + /* Invoke callback function */ + cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_udata); + + /* Set the return value based on the callback's return value */ + if (cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if (cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__iterate_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5I_iterate + * + * Purpose: Apply function FUNC to each member of type TYPE (with + * non-zero application reference count if app_ref is TRUE). + * Stop if FUNC returns a non zero value (i.e. anything + * other than H5_ITER_CONT). + * + * If FUNC returns a positive value (i.e. H5_ITER_STOP), + * return SUCCEED. + * + * If FUNC returns a negative value (i.e. H5_ITER_ERROR), + * return FAIL. + * + * The FUNC should take a pointer to the object and the + * udata as arguments and return non-zero to terminate + * siteration, and zero to continue. + * + * Limitation: Currently there is no way to start the iteration from + * where a previous iteration left off. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + type_info = H5I_type_info_array_g[type]; + + /* Only iterate through ID list if it is initialized and there are IDs in type */ + if (type_info && type_info->init_count > 0 && type_info->id_count > 0) { + H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ + herr_t iter_status; /* Iteration status */ + + /* Set up iterator user data */ + iter_udata.user_func = func; + iter_udata.user_udata = udata; + iter_udata.app_ref = app_ref; + iter_udata.obj_type = type; + + /* Iterate over IDs */ + if ((iter_status = H5SL_iterate(type_info->ids, H5I__iterate_cb, &iter_udata)) < 0) + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_iterate() */ + +/*------------------------------------------------------------------------- + * Function: H5I__find_id + * + * Purpose: Given an object ID find the info struct that describes the + * object. + * + * Return: Success: A pointer to the object's info struct. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5I_id_info_t * +H5I__find_id(hid_t id) +{ + H5I_type_t type; /* ID's type */ + H5I_type_info_t *type_info = NULL; /* Pointer to the type */ + H5I_id_info_t * id_info = NULL; /* ID's info */ + H5I_id_info_t * ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Check arguments */ + type = H5I_TYPE(id); + if (type <= H5I_BADID || (int)type >= H5I_next_type_g) + HGOTO_DONE(NULL) + type_info = H5I_type_info_array_g[type]; + if (!type_info || type_info->init_count <= 0) + HGOTO_DONE(NULL) + + /* Check for same ID as we have looked up last time */ + if (type_info->last_id_info && type_info->last_id_info->id == id) + id_info = type_info->last_id_info; + else { + /* Locate the ID node for the ID */ + id_info = (H5I_id_info_t *)H5SL_search(type_info->ids, &id); + + /* Remember this ID */ + type_info->last_id_info = id_info; + } + + /* Check if this is a future ID */ + H5_GCC_DIAG_OFF("cast-qual") + if (id_info && id_info->is_future) { + hid_t actual_id = H5I_INVALID_HID; /* ID for actual object */ + void *future_object; /* Pointer to the future object */ + void *actual_object; /* Pointer to the actual object */ + + /* Invoke the realize callback, to get the actual object */ + if ((id_info->realize_cb)((void *)id_info->object, &actual_id) < 0) + HGOTO_DONE(NULL) + + /* Verify that we received a valid ID, of the same type */ + if (H5I_INVALID_HID == actual_id) + HGOTO_DONE(NULL) + if (H5I_TYPE(id) != H5I_TYPE(actual_id)) + HGOTO_DONE(NULL) + + /* Swap the actual object in for the future object */ + future_object = (void *)id_info->object; + actual_object = H5I__remove_common(type_info, actual_id); + HDassert(actual_object); + id_info->object = actual_object; + + /* Discard the future object */ + if ((id_info->discard_cb)(future_object) < 0) + HGOTO_DONE(NULL) + future_object = NULL; + + /* Change the ID from 'future' to 'actual' */ + id_info->is_future = FALSE; + id_info->realize_cb = NULL; + id_info->discard_cb = NULL; + } + H5_GCC_DIAG_ON("cast-qual") + + /* Set return value */ + ret_value = id_info; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__find_id() */ + +/*------------------------------------------------------------------------- + * Function: H5I__find_id_cb + * + * Purpose: Callback for searching for an ID with a specific pointer + * + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) + * + *------------------------------------------------------------------------- + */ +static int +H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) +{ + H5I_id_info_t * info = (H5I_id_info_t *)_item; /* Pointer to the ID info */ + H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ + H5I_type_t type = udata->obj_type; + const void * object = NULL; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(info); + HDassert(udata); + + /* Get a pointer to the VOL connector's data */ + H5_GCC_DIAG_OFF("cast-qual") + object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */ + H5_GCC_DIAG_ON("cast-qual") + + /* Check for a match */ + if (object == udata->object) { + udata->ret_id = info->id; + ret_value = H5_ITER_STOP; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__find_id_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5I_find_id + * + * Purpose: Return the ID of an object by searching through the ID list + * for the type. + * + * Return: SUCCEED/FAIL + * (id will be set to H5I_INVALID_HID on errors or not found) + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_find_id(const void *object, H5I_type_t type, hid_t *id) +{ + H5I_type_info_t *type_info = NULL; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(id); + + *id = H5I_INVALID_HID; + + type_info = H5I_type_info_array_g[type]; + if (!type_info || type_info->init_count <= 0) + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + + /* Only iterate through ID list if it is initialized and there are IDs in type */ + if (type_info->init_count > 0 && type_info->id_count > 0) { + H5I_get_id_ud_t udata; /* User data */ + herr_t iter_status; /* Iteration status */ + + /* Set up iterator user data */ + udata.object = object; + udata.obj_type = type; + udata.ret_id = H5I_INVALID_HID; + + /* Iterate over IDs for the ID type */ + if ((iter_status = H5SL_iterate(type_info->ids, H5I__find_id_cb, &udata)) < 0) + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + + *id = udata.ret_id; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_find_id() */ diff --git a/src/H5Imodule.h b/src/H5Imodule.h index a2174d7..8db31c8 100644 --- a/src/H5Imodule.h +++ b/src/H5Imodule.h @@ -26,7 +26,7 @@ */ #define H5I_MODULE #define H5_MY_PKG H5I -#define H5_MY_PKG_ERR H5E_ATOM +#define H5_MY_PKG_ERR H5E_ID #define H5_MY_PKG_INIT NO /**\defgroup H5I H5I diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 5461aa2..0a7215b 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -30,6 +30,7 @@ #include "H5Iprivate.h" /* Other private headers needed by this file */ +#include "H5SLprivate.h" /* Skip Lists */ /**************************/ /* Package Private Macros */ @@ -60,10 +61,56 @@ /* Package Private Typedefs */ /****************************/ +/* ID information structure used */ +typedef struct H5I_id_info_t { + hid_t id; /* ID for this info */ + unsigned count; /* Ref. count for this ID */ + unsigned app_count; /* Ref. count of application visible IDs */ + const void *object; /* Pointer associated with the ID */ + + /* Future ID info */ + hbool_t is_future; /* Whether this ID represents a future object */ + H5I_future_realize_func_t realize_cb; /* 'realize' callback for future object */ + H5I_future_discard_func_t discard_cb; /* 'discard' callback for future object */ +} H5I_id_info_t; + +/* Type information structure used */ +typedef struct H5I_type_info_t { + const H5I_class_t *cls; /* Pointer to ID class */ + unsigned init_count; /* # of times this type has been initialized */ + uint64_t id_count; /* Current number of IDs held */ + uint64_t nextid; /* ID to use for the next object */ + H5I_id_info_t * last_id_info; /* Info for most recent ID looked up */ + H5SL_t * ids; /* Pointer to skip list that stores IDs */ +} H5I_type_info_t; + +/*****************************/ +/* Package Private Variables */ +/*****************************/ + +/* Array of pointers to ID types */ +H5_DLLVAR H5I_type_info_t *H5I_type_info_array_g[H5I_MAX_NUM_TYPES]; + +/* Variable to keep track of the number of types allocated. Its value is the */ +/* next type ID to be handed out, so it is always one greater than the number */ +/* of types. */ +/* Starts at 1 instead of 0 because it makes trace output look nicer. If more */ +/* types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h */ +/* and/or increase size of hid_t */ +H5_DLLVAR int H5I_next_type_g; + /******************************/ /* Package Private Prototypes */ /******************************/ +H5_DLL hid_t H5I__register(H5I_type_t type, const void *object, hbool_t app_ref, + H5I_future_realize_func_t realize_cb, H5I_future_discard_func_t discard_cb); +H5_DLL int H5I__destroy_type(H5I_type_t type); +H5_DLL void *H5I__remove_verify(hid_t id, H5I_type_t type); +H5_DLL int H5I__inc_type_ref(H5I_type_t type); +H5_DLL int H5I__get_type_ref(H5I_type_t type); +H5_DLL H5I_id_info_t *H5I__find_id(hid_t id); + /* Testing functions */ #ifdef H5I_TESTING H5_DLL ssize_t H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached); diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 78fd84d..d1b6248 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -42,7 +42,7 @@ /****************************/ typedef struct H5I_class_t { - H5I_type_t type_id; /* Class ID for the type */ + H5I_type_t type; /* Class "value" for the type */ unsigned flags; /* Class behavior flags */ unsigned reserved; /* Number of reserved IDs for this type */ /* [A specific number of type entries may be @@ -70,7 +70,9 @@ H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref); H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref); H5_DLL int H5I_dec_ref(hid_t id); H5_DLL int H5I_dec_app_ref(hid_t id); +H5_DLL int H5I_dec_app_ref_async(hid_t id, void **token); H5_DLL int H5I_dec_app_ref_always_close(hid_t id); +H5_DLL int H5I_dec_app_ref_always_close_async(hid_t id, void **token); H5_DLL int H5I_dec_type_ref(H5I_type_t type); H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*out*/); @@ -86,7 +88,7 @@ H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*o /* Functions that manipulate objects */ H5_DLL void * H5I_object(hid_t id); -H5_DLL void * H5I_object_verify(hid_t id, H5I_type_t id_type); +H5_DLL void * H5I_object_verify(hid_t id, H5I_type_t type); H5_DLL void * H5I_remove(hid_t id); H5_DLL void * H5I_subst(hid_t id, const void *new_object); H5_DLL htri_t H5I_is_file_object(hid_t id); diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 69aa455..8e5e167 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -21,57 +21,97 @@ /* Public headers needed by this file */ #include "H5public.h" -/* - * Library type values. Start with `1' instead of `0' because it makes the - * tracing output look better when hid_t values are large numbers. Change the - * TYPE_BITS in H5I.c if the MAXID gets larger than 32 (an assertion will - * fail otherwise). +/** + * Library type values. + * \internal Library type values. Start with `1' instead of `0' because it + * makes the tracing output look better when hid_t values are large + * numbers. Change the TYPE_BITS in H5I.c if the MAXID gets larger + * than 32 (an assertion will fail otherwise). * - * When adding types here, add a section to the 'misc19' test in test/tmisc.c - * to verify that the H5I{inc|dec|get}_ref() routines work correctly with it. + * When adding types here, add a section to the 'misc19' test in + * test/tmisc.c to verify that the H5I{inc|dec|get}_ref() routines + * work correctly with it. \endinternal */ +//! typedef enum H5I_type_t { - H5I_UNINIT = (-2), /* uninitialized type */ - H5I_BADID = (-1), /* invalid Type */ - H5I_FILE = 1, /* type ID for File objects */ - H5I_GROUP, /* type ID for Group objects */ - H5I_DATATYPE, /* type ID for Datatype objects */ - H5I_DATASPACE, /* type ID for Dataspace objects */ - H5I_DATASET, /* type ID for Dataset objects */ - H5I_MAP, /* type ID for Map objects */ - H5I_ATTR, /* type ID for Attribute objects */ - H5I_VFL, /* type ID for virtual file layer */ - H5I_VOL, /* type ID for virtual object layer */ - H5I_GENPROP_CLS, /* type ID for generic property list classes */ - H5I_GENPROP_LST, /* type ID for generic property lists */ - H5I_ERROR_CLASS, /* type ID for error classes */ - H5I_ERROR_MSG, /* type ID for error messages */ - H5I_ERROR_STACK, /* type ID for error stacks */ - H5I_SPACE_SEL_ITER, /* type ID for dataspace selection iterator */ - H5I_NTYPES /* number of library types, MUST BE LAST! */ + H5I_UNINIT = (-2), /**< uninitialized type */ + H5I_BADID = (-1), /**< invalid Type */ + H5I_FILE = 1, /**< type ID for File objects */ + H5I_GROUP, /**< type ID for Group objects */ + H5I_DATATYPE, /**< type ID for Datatype objects */ + H5I_DATASPACE, /**< type ID for Dataspace objects */ + H5I_DATASET, /**< type ID for Dataset objects */ + H5I_MAP, /**< type ID for Map objects */ + H5I_ATTR, /**< type ID for Attribute objects */ + H5I_VFL, /**< type ID for virtual file layer */ + H5I_VOL, /**< type ID for virtual object layer */ + H5I_GENPROP_CLS, /**< type ID for generic property list classes */ + H5I_GENPROP_LST, /**< type ID for generic property lists */ + H5I_ERROR_CLASS, /**< type ID for error classes */ + H5I_ERROR_MSG, /**< type ID for error messages */ + H5I_ERROR_STACK, /**< type ID for error stacks */ + H5I_SPACE_SEL_ITER, /**< type ID for dataspace selection iterator */ + H5I_EVENTSET, /**< type ID for event sets */ + H5I_NTYPES /**< number of library types, MUST BE LAST! */ } H5I_type_t; +//! -/* Type of atoms to return to users */ +/** + * Type of IDs to return to users + */ typedef int64_t hid_t; + +#define PRIdHID PRId64 +#define PRIxHID PRIx64 +#define PRIXHID PRIX64 +#define PRIoHID PRIo64 + +/** + * The size of identifiers + */ #define H5_SIZEOF_HID_T H5_SIZEOF_INT64_T -/* An invalid object ID. This is also negative for error return. */ +/** + * An invalid object ID. This is also negative for error return. + */ #define H5I_INVALID_HID (-1) -/* - * Function for freeing objects. This function will be called with an object +/** + * A function for freeing objects. This function will be called with an object * ID type number and a pointer to the object. The function should free the * object and return non-negative to indicate that the object * can be removed from the ID type. If the function returns negative * (failure) then the object will remain in the ID type. */ -typedef herr_t (*H5I_free_t)(void *); +typedef herr_t (*H5I_free_t)(void *, void **); -/* Type of the function to compare objects & keys */ +/** + * The type of a function to compare objects & keys + */ +//! typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); +//! -/* Type of the H5Iiterate callback function */ +/** + * The type of H5Iiterate() callback functions + */ +//! typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); +//! + +/** + * The type of the realize_cb callback for H5Iregister_future + */ +//! +typedef herr_t (*H5I_future_realize_func_t)(void *future_object, hid_t *actual_object_id); +//! + +/** + * The type of the discard_cb callback for H5Iregister_future + */ +//! +typedef herr_t (*H5I_future_discard_func_t)(void *future_object); +//! #ifdef __cplusplus extern "C" { @@ -79,26 +119,638 @@ extern "C" { /* Public API functions */ -H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object); -H5_DLL void * H5Iobject_verify(hid_t id, H5I_type_t id_type); -H5_DLL void * H5Iremove_verify(hid_t id, H5I_type_t id_type); +/** + * \ingroup H5I + * + * \brief Registers an object under a type and returns an ID for it + * + * \param[in] type The identifier of the type of the new ID + * \param[in] object Pointer to object for which a new ID is created + * + * \return \hid_t{object} + * + * \details H5Iregister() creates and returns a new ID for an object. + * + * \details The \p type parameter is the identifier for the ID type to which + * this new ID will belong. This identifier must have been created by + * a call to H5Iregister_type(). + * + * \details The \p object parameter is a pointer to the memory which the new ID + * will be a reference to. This pointer will be stored by the library + * and returned via a call to H5Iobject_verify(). + * + */ +H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object); +/** + * \ingroup H5I + * + * \brief Registers a "future" object under a type and returns an ID for it + * + * \param[in] type The identifier of the type of the new ID + * \param[in] object Pointer to "future" object for which a new ID is created + * \param[in] realize_cb Function pointer to realize a future object + * \param[in] discard_cb Function pointer to destroy a future object + * + * \return \hid_t{object} + * + * \details H5Iregister_future() creates and returns a new ID for a "future" object. + * Future objects are a special kind of object and represent a + * placeholder for an object that has not yet been created or opened. + * The \p realize_cb will be invoked by the HDF5 library to 'realize' + * the future object as an actual object. A call to H5Iobject_verify() + * will invoke the \p realize_cb callback and if it successfully + * returns, will return the actual object, not the future object. + * + * \details The \p type parameter is the identifier for the ID type to which + * this new future ID will belong. This identifier may have been created + * by a call to H5Iregister_type() or may be one of the HDF5 pre-defined + * ID classes (e.g. H5I_FILE, H5I_GROUP, H5I_DATASPACE, etc). + * + * \details The \p object parameter is a pointer to the memory which the new ID + * will be a reference to. This pointer will be stored by the library, + * but will not be returned to a call to H5Iobject_verify() until the + * \p realize_cb callback has returned the actual pointer for the object. + * + * A NULL value for \p object is allowed. + * + * \details The \p realize_cb parameter is a function pointer that will be + * invoked by the HDF5 library to convert a future object into an + * actual object. The \p realize_cb function may be invoked by + * H5Iobject_verify() to return the actual object for a user-defined + * ID class (i.e. an ID class registered with H5Iregister_type()) or + * internally by the HDF5 library in order to use or get information + * from an HDF5 pre-defined ID type. For example, the \p realize_cb + * for a future dataspace object will be called during the process + * of returning information from H5Sget_simple_extent_dims(). + * + * Note that although the \p realize_cb routine returns + * an ID (as a parameter) for the actual object, the HDF5 library + * will swap the actual object in that ID for the future object in + * the future ID. This ensures that the ID value for the object + * doesn't change for the user when the object is realized. + * + * Note that the \p realize_cb callback could receive a NULL value + * for a future object pointer, if one was used when H5Iregister_future() + * was initially called. This is permitted as a means of allowing + * the \p realize_cb to act as a generator of new objects, without + * requiring creation of unnecessary future objects. + * + * It is an error to pass NULL for \p realize_cb. + * + * \details The \p discard_cb parameter is a function pointer that will be + * invoked by the HDF5 library to destroy a future object. This + * callback will always be invoked for _every_ future object, whether + * the \p realize_cb is invoked on it or not. It's possible that + * the \p discard_cb is invoked on a future object without the + * \p realize_cb being invoked, e.g. when a future ID is closed without + * requiring the future object to be realized into an actual one. + * + * Note that the \p discard_cb callback could receive a NULL value + * for a future object pointer, if one was used when H5Iregister_future() + * was initially called. + * + * It is an error to pass NULL for \p discard_cb. + * + * \note The H5Iregister_future() function is primarily targeted at VOL connector + * authors and is _not_ designed for general-purpose application use. + * + */ +H5_DLL hid_t H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_t realize_cb, + H5I_future_discard_func_t discard_cb); +/** + * \ingroup H5I + * + * \brief Returns the object referenced by an ID + * + * \param[in] id ID to be dereferenced + * \param[in] type The identifier type + + * + * \return Pointer to the object referenced by \p id on success, NULL on failure. + * + * \details H5Iobject_verify() returns a pointer to the memory referenced by id + * after verifying that \p id is of type \p type. This function is + * analogous to dereferencing a pointer in C with type checking. + * + * \note H5Iobject_verify() does not change the ID it is called on in any way + * (as opposed to H5Iremove_verify(), which removes the ID from its + * type’s hash table). + * + * \see H5Iregister() + * + */ +H5_DLL void *H5Iobject_verify(hid_t id, H5I_type_t type); +/** + * \ingroup H5I + * + * \brief Removes an ID from its type + * + * \param[in] id The ID to be removed from its type + * \param[in] type The identifier type + + * + * \return Returns a pointer to the memory referred to by \p id on success, + * NULL on failure. + * + * \details H5Iremove_verify() first ensures that \p id belongs to \p type. + * If so, it removes \p id from its type and returns the pointer + * to the memory it referred to. This pointer is the same pointer that + * was placed in storage by H5Iregister(). If id does not belong to + * \p type, then NULL is returned. + * + * The \p id parameter is the ID which is to be removed from its type. + * + * The \p type parameter is the identifier for the ID type which \p id + * is supposed to belong to. This identifier must have been created by + * a call to H5Iregister_type(). + * + * \note This function does NOT deallocate the memory that \p id refers to. + * The pointer returned by H5Iregister() must be deallocated by the user + * to avoid memory leaks. + * + */ +H5_DLL void *H5Iremove_verify(hid_t id, H5I_type_t type); +/** + * \ingroup H5I + * + * \brief Retrieves the type of an object + * + * \obj_id{id} + * + * \return Returns the object type if successful; otherwise #H5I_BADID. + * + * \details H5Iget_type() retrieves the type of the object identified by + * \p id. + * + * Valid types returned by the function are: + * \id_types + * + * If no valid type can be determined or the identifier submitted is + * invalid, the function returns #H5I_BADID. + * + * This function is of particular use in determining the type of + * object closing function (H5Dclose(), H5Gclose(), etc.) to call + * after a call to H5Rdereference(). + * + * \note Note that this function returns only the type of object that \p id + * would identify if it were valid; it does not determine whether \p id + * is valid identifier. Validity can be determined with a call to + * H5Iis_valid(). + * + */ H5_DLL H5I_type_t H5Iget_type(hid_t id); -H5_DLL hid_t H5Iget_file_id(hid_t id); -H5_DLL ssize_t H5Iget_name(hid_t id, char *name /*out*/, size_t size); -H5_DLL int H5Iinc_ref(hid_t id); -H5_DLL int H5Idec_ref(hid_t id); -H5_DLL int H5Iget_ref(hid_t id); +/** + * \ingroup H5I + * + * \brief Retrieves an identifier for the file containing the specified object + * + * \obj_id{id} + * + * \return \hid_t{file} + * + * \details H5Iget_file_id() returns the identifier of the file associated with + * the object referenced by \p id. + * + * \note Note that the HDF5 library permits an application to close a file + * while objects within the file remain open. If the file containing the + * object \p id is still open, H5Iget_file_id() will retrieve the + * existing file identifier. If there is no existing file identifier for + * the file, i.e., the file has been closed, H5Iget_file_id() will reopen + * the file and return a new file identifier. In either case, the file + * identifier must eventually be released using H5Fclose(). + * + * \since 1.6.3 + * + */ +H5_DLL hid_t H5Iget_file_id(hid_t id); +/** + * \ingroup H5I + * + * \brief Retrieves a name of an object based on the object identifier + * + * \obj_id{id} + * \param[out] name A buffer for thename associated with the identifier + * \param[in] size The size of the \p name buffer; usually the size of + * the name in bytes plus 1 for a NULL terminator + * + * \return ssize_t + * + * \details H5Iget_name() retrieves a name for the object identified by \p id. + * + * \details Up to size characters of the name are returned in \p name; + * additional characters, if any, are not returned to the user + * application. + * + * If the length of the name, which determines the required value of + * \p size, is unknown, a preliminary H5Iget_name() call can be made. + * The return value of this call will be the size in bytes of the + * object name. That value, plus 1 for a NULL terminator, is then + * assigned to size for a second H5Iget_name() call, which will + * retrieve the actual name. + * + * If the object identified by \p id is an attribute, as determined + * via H5Iget_type(), H5Iget_name() retrieves the name of the object + * to which that attribute is attached. To retrieve the name of the + * attribute itself, use H5Aget_name(). + * + * If there is no name associated with the object identifier or if the + * name is NULL, H5Iget_name() returns 0 (zero). + * + * \note Note that an object in an HDF5 file may have multiple paths if there + * are multiple links pointing to it. This function may return any one of + * these paths. When possible, H5Iget_name() returns the path with which + * the object was opened. + * + * \since 1.6.0 + * + */ +H5_DLL ssize_t H5Iget_name(hid_t id, char *name /*out*/, size_t size); +/** + * \ingroup H5I + * + * \brief Increments the reference count for an object + * + * \obj_id{id} + * + * \return Returns a non-negative reference count of the object ID after + * incrementing it if successful; otherwise a negative value is + * returned. + * + * \details H5Iinc_ref() increments the reference count of the object + * identified by \p id. + * + * The reference count for an object ID is attached to the information + * about an object in memory and has no relation to the number of + * links to an object on disk. + * + * The reference count for a newly created object will be 1. Reference + * counts for objects may be explicitly modified with this function or + * with H5Idec_ref(). When an object ID's reference count reaches + * zero, the object will be closed. Calling an object ID's \c close + * function decrements the reference count for the ID which normally + * closes the object, but if the reference count for the ID has been + * incremented with this function, the object will only be closed when + * the reference count reaches zero with further calls to H5Idec_ref() + * or the object ID's \c close function. + * + * If the object ID was created by a collective parallel call (such as + * H5Dcreate(), H5Gopen(), etc.), the reference count should be + * modified by all the processes which have copies of the ID. + * Generally this means that group, dataset, attribute, file and named + * datatype IDs should be modified by all the processes and that all + * other types of IDs are safe to modify by individual processes. + * + * This function is of particular value when an application is + * maintaining multiple copies of an object ID. The object ID can be + * incremented when a copy is made. Each copy of the ID can then be + * safely closed or decremented and the HDF5 object will be closed + * when the reference count for that that object drops to zero. + * + * \since 1.6.2 + * + */ +H5_DLL int H5Iinc_ref(hid_t id); +/** + * \ingroup H5I + * + * \brief Decrements the reference count for an object + * + * \obj_id{id} + * + * \return Returns a non-negative reference count of the object ID after + * decrementing it, if successful; otherwise a negative value is + * returned. + * + * \details H5Idec_ref() decrements the reference count of the object + * identified by \p id. + * + * The reference count for an object ID is attached to the information + * about an object in memory and has no relation to the number of + * links to an object on disk. + * + * The reference count for a newly created object will be 1. Reference + * counts for objects may be explicitly modified with this function or + * with H5Iinc_ref(). When an object identifier’s reference count + * reaches zero, the object will be closed. Calling an object + * identifier’s \c close function decrements the reference count for + * the identifier which normally closes the object, but if the + * reference count for the identifier has been incremented with + * H5Iinc_ref(), the object will only be closed when the reference + * count reaches zero with further calls to this function or the + * object identifier’s \c close function. + * + * If the object ID was created by a collective parallel call (such as + * H5Dcreate(), H5Gopen(), etc.), the reference count should be + * modified by all the processes which have copies of the ID. + * Generally this means that group, dataset, attribute, file and named + * datatype IDs should be modified by all the processes and that all + * other types of IDs are safe to modify by individual processes. + * + * This function is of particular value when an application is + * maintaining multiple copies of an object ID. The object ID can be + * incremented when a copy is made. Each copy of the ID can then be + * safely closed or decremented and the HDF5 object will be closed + * when the reference count for that that object drops to zero. + * + * \since 1.6.2 + * + */ +H5_DLL int H5Idec_ref(hid_t id); +/** + * \ingroup H5I + * + * \brief Retrieves the reference count for an object + * + * \obj_id{id} + * + * \return Returns a non-negative current reference count of the object + * identifier if successful; otherwise a negative value is returned. + * + * \details H5Iget_ref() retrieves the reference count of the object identified + * by \p id. + * + * The reference count for an object identifier is attached to the + * information about an object in memory and has no relation to the + * number of links to an object on disk. + * + * The function H5Iis_valid() is used to determine whether a specific + * object identifier is valid. + * + * \since 1.6.2 + * + */ +H5_DLL int H5Iget_ref(hid_t id); +/** + * \ingroup H5I + * + * \brief Creates and returns a new ID type + * + * \param[in] hash_size Minimum hash table size (in entries) used to store IDs + * for the new type + * \param[in] reserved Number of reserved IDs for the new type + * \param[in] free_func Function used to deallocate space for a single ID + * + * \return Returns the type identifier on success, negative on failure. + * + * \details H5Iregister_type() allocates space for a new ID type and returns an + * identifier for it. + * + * The \p hash_size parameter indicates the minimum size of the hash + * table used to store IDs in the new type. + * + * The \p reserved parameter indicates the number of IDs in this new + * type to be reserved. Reserved IDs are valid IDs which are not + * associated with any storage within the library. + * + * The \p free_func parameter is a function pointer to a function + * which returns an herr_t and accepts a \c void*. The purpose of this + * function is to deallocate memory for a single ID. It will be called + * by H5Iclear_type() and H5Idestroy_type() on each ID. This function + * is NOT called by H5Iremove_verify(). The \c void* will be the same + * pointer which was passed in to the H5Iregister() function. The \p + * free_func function should return 0 on success and -1 on failure. + * + */ H5_DLL H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func); -H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force); -H5_DLL herr_t H5Idestroy_type(H5I_type_t type); -H5_DLL int H5Iinc_type_ref(H5I_type_t type); -H5_DLL int H5Idec_type_ref(H5I_type_t type); -H5_DLL int H5Iget_type_ref(H5I_type_t type); -H5_DLL void * H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); -H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data); -H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members); -H5_DLL htri_t H5Itype_exists(H5I_type_t type); -H5_DLL htri_t H5Iis_valid(hid_t id); +/** + * \ingroup H5I + * + * \brief Deletes all identifiers of the given type + * + * \param[in] type Identifier of identifier type which is to be cleared of identifiers + * \param[in] force Whether or not to force deletion of all identifiers + * + * \return \herr_t + * + * \details H5Iclear_type() deletes all identifiers of the type identified by + * the argument \p type. + * + * The identifier type's free function is first called on all of these + * identifiers to free their memory, then they are removed from the + * type. + * + * If the \p force flag is set to false, only those identifiers whose + * reference counts are equal to 1 will be deleted, and all other + * identifiers will be entirely unchanged. If the force flag is true, + * all identifiers of this type will be deleted. + * + */ +H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force); +/** + * \ingroup H5I + * + * \brief Removes an identifier type and all identifiers within that type + * + * \param[in] type Identifier of identifier type which is to be destroyed + * + * \return \herr_t + * + * \details H5Idestroy_type deletes an entire identifier type \p type. All + * identifiers of this type are destroyed and no new identifiers of + * this type can be registered. + * + * The type’s free function is called on all of the identifiers which + * are deleted by this function, freeing their memory. In addition, + * all memory used by this type’s hash table is freed. + * + * Since the H5I_type_t values of destroyed identifier types are + * reused when new types are registered, it is a good idea to set the + * variable holding the value of the destroyed type to #H5I_UNINIT. + * + */ +H5_DLL herr_t H5Idestroy_type(H5I_type_t type); +/** + * \ingroup H5I + * + * \brief Increments the reference count on an ID type + * + * \param[in] type The identifier of the type whose reference count is to be incremented + * + * \return Returns the current reference count on success, negative on failure. + * + * \details H5Iinc_type_ref() increments the reference count on an ID type. The + * reference count is used by the library to indicate when an ID type + * can be destroyed. + * + * The type parameter is the identifier for the ID type whose + * reference count is to be incremented. This identifier must have + * been created by a call to H5Iregister_type(). + * + */ +H5_DLL int H5Iinc_type_ref(H5I_type_t type); +/** + * \ingroup H5I + * + * \brief Decrements the reference count on an identifier type + * + * \param[in] type The identifier of the type whose reference count is to be decremented + * + * \return Returns the current reference count on success, negative on failure. + * + * \details H5Idec_type_ref() decrements the reference count on an identifier + * type. The reference count is used by the library to indicate when + * an identifier type can be destroyed. If the reference count reaches + * zero, this function will destroy it. + * + * The type parameter is the identifier for the identifier type whose + * reference count is to be decremented. This identifier must have + * been created by a call to H5Iregister_type(). + * + */ +H5_DLL int H5Idec_type_ref(H5I_type_t type); +/** + * \ingroup H5I + * + * \brief Retrieves the reference count on an ID type + * + * \param[in] type The identifier of the type whose reference count is to be retieved + * + * \return Returns the current reference count on success, negative on failure. + * + * \details H5Iget_type_ref() retrieves the reference count on an ID type. The + * reference count is used by the library to indicate when an ID type + * can be destroyed. + * + * The type parameter is the identifier for the ID type whose + * reference count is to be retrieved. This identifier must have been + * created by a call to H5Iregister_type(). + * + */ +H5_DLL int H5Iget_type_ref(H5I_type_t type); +/** + * \ingroup H5I + * + * \brief Finds the memory referred to by an ID within the given ID type such + * that some criterion is satisfied + * + * \param[in] type The identifier of the type to be searched + * \param[in] func The function defining the search criteria + * \param[in] key A key for the search function + * + * \return Returns a pointer to the object which satisfies the search function + * on success, NULL on failure. + * + * \details H5Isearch() searches through a given ID type to find an object that + * satisfies the criteria defined by \p func. If such an object is + * found, the pointer to the memory containing this object is + * returned. Otherwise, NULL is returned. To do this, \p func is + * called on every member of type \p type. The first member to satisfy + * \p func is returned. + * + * The \p type parameter is the identifier for the ID type which is to + * be searched. This identifier must have been created by a call to + * H5Iregister_type(). + * + * The parameter \p func is a function pointer to a function which + * takes three parameters. The first parameter is a \c void* and will + * be a pointer to the object to be tested. This is the same object + * that was placed in storage using H5Iregister(). The second + * parameter is a hid_t and is the ID of the object to be tested. The + * last parameter is a \c void*. This is the \p key parameter and can + * be used however the user finds helpful, or it can be ignored if it + * is not needed. \p func returns 0 if the object it is testing does + * not pass its criteria. A non-zero value should be returned if the + * object does pass its criteria. H5I_search_func_t is defined in + * H5Ipublic.h and is shown below. + * \snippet this H5I_search_func_t_snip + * The \p key parameter will be passed to the search function as a + * parameter. It can be used to further define the search at run-time. + * + */ +H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); +/** + * \ingroup H5I + * + * \brief Calls a callback for each member of the identifier type specified + * + * \param[in] type The identifier type + * \param[in] op The callback function + * \param[in,out] op_data The data for the callback function + * + * \return The last value returned by \p op + * + * \details H5Iiterate() calls the callback function \p op for each member of + * the identifier type \p type. The callback function type for \p op, + * H5I_iterate_func_t, is defined in H5Ipublic.h as: + * \snippet this H5I_iterate_func_t_snip + * \p op takes as parameters the identifier and a pass through of + * \p op_data, and returns an herr_t. + * + * A positive return from op will cause the iteration to stop and + * H5Iiterate() will return the value returned by \p op. A negative + * return from \p op will cause the iteration to stop and H5Iiterate() + * will return failure. A zero return from \p op will allow iteration + * to continue, as long as there are other identifiers remaining in + * type. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data); +/** + * \ingroup H5I + * + * \brief Returns the number of identifiers in a given identifier type + * + * \param[in] type The identifier type + * \param[out] num_members Number of identifiers of the specified identifier type + * + * \return \herr_t + * + * \details H5Inmembers() returns the number of identifiers of the identifier + * type specified in \p type. + * + * The number of identifiers is returned in \p num_members. If no + * identifiers of this type have been registered, the type does not + * exist, or it has been destroyed, \p num_members is returned with + * the value 0. + * + */ +H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members); +/** + * \ingroup H5I + * + * \brief Determines whether an identifier type is registered + * + * \param[in] type Identifier type + * + * \return \htri_t + * + * \details H5Itype_exists() determines whether the given identifier type, + * \p type, is registered with the library. + * + * \since 1.8.0 + * + */ +H5_DLL htri_t H5Itype_exists(H5I_type_t type); +/** + * \ingroup H5I + * + * \brief Determines whether an identifier is valid + * + * \obj_id{id} + * + * \return \htri_t + * + * \details H5Iis_valid() determines whether the identifier \p id is valid. + * + * \details Valid identifiers are those that have been obtained by an + * application and can still be used to access the original target. + * Examples of invalid identifiers include: + * \li Out of range values: negative, for example + * \li Previously-valid identifiers that have been released: + * for example, a dataset identifier for which the dataset has + * been closed + * + * H5Iis_valid() can be used with any type of identifier: object + * identifier, property list identifier, attribute identifier, error + * message identifier, etc. When necessary, a call to H5Iget_type() + * can determine the type of the object that \p id identifies. + * + * \since 1.8.3 + * + */ +H5_DLL htri_t H5Iis_valid(hid_t id); #ifdef __cplusplus } diff --git a/src/H5Itest.c b/src/H5Itest.c index 6f2c03a..71ef3f8 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -82,25 +82,25 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached) /* Get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier") /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_ID, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Get object location */ if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object location") /* Call internal group routine to retrieve object's name */ if ((ret_value = H5G_get_name(&loc, name, size, cached)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name") done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_ID, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") if (api_ctx_pushed && H5CX_pop(FALSE) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context") diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 9cc8ffa..c1bd83f 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -147,7 +147,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID") /* Get the fapl_id set for lapl_id if any */ if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) @@ -175,7 +175,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons /* Get file access property list */ if (NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID") /* Make callback if it exists */ if (cb_info.func) { @@ -239,7 +239,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons /* Get an ID for the external link's object */ if ((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") /* Set return value */ ret_value = ext_obj_id; @@ -248,8 +248,8 @@ done: /* XXX (VOL MERGE): Probably also want to consider closing ext_obj here on failures */ /* Release resources */ if (fapl_id > 0 && H5I_dec_ref(fapl_id) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, - "unable to close atom for file access property list") + HDONE_ERROR(H5E_ID, H5E_CANTRELEASE, H5I_INVALID_HID, + "unable to close ID for file access property list") if (ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0) HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file") if (parent_group_name && parent_group_name != local_group_name) @@ -257,8 +257,7 @@ done: if (ret_value < 0) { /* Close object if it's open and something failed */ if (ext_obj_id >= 0 && H5I_dec_ref(ext_obj_id) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, - "unable to close atom for external object") + HDONE_ERROR(H5E_ID, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close ID for external object") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -288,7 +287,7 @@ H5L__extern_query(const char H5_ATTR_UNUSED *link_name, const void *_udata, size const uint8_t *udata = (const uint8_t *)_udata; /* Pointer to external link buffer */ ssize_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check external link version & flags */ if (((*udata >> 4) & 0x0F) != H5L_EXT_VERSION) diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 336f356..e1fa5e9 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -15,7 +15,7 @@ * * Created: H5Oflush.c * Aug 19, 2010 - * Mike McGreevy + * Mike McGreevy * * Purpose: Object flush/refresh routines. * @@ -166,7 +166,7 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) /* Flush metadata based on tag value of the object */ if (H5F_flush_tagged_metadata(oloc->file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Check to invoke callback */ if (H5F_object_flush_cb(oloc->file, obj_id) < 0) @@ -410,32 +410,32 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Handle close for multiple dataset opens */ if (H5I_get_type(oid) == H5I_DATASET) if (H5D_mult_refresh_close(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") /* Retrieve tag for object */ if (H5O__oh_tag(&oloc, &tag) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to get object header address") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to get object header address") /* Get cork status of the object with tag */ if (H5AC_cork(oloc.file, tag, H5AC__GET_CORKED, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") /* Close the object */ if (H5I_dec_ref(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to close object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to close object") /* Flush metadata based on tag value of the object */ if (H5F_flush_tagged_metadata(oloc.file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Evict the object's tagged metadata */ if (H5F_evict_tagged_metadata(oloc.file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to evict metadata") /* Re-cork object with tag */ if (corked) if (H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object") done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Oint.c b/src/H5Oint.c index 6246e9a..42a66c4 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -264,17 +264,8 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * - * Changes: 2018 August 17 - * Jacob Smith - * Refactor out the operations into two separate steps -- - * preparation and application -- to facilitate overriding the - * library-default size allocated for the object header. This - * function is retained as a wrapper, to minimize changes to - * unaffected calling functions. - * *------------------------------------------------------------------------- */ herr_t @@ -846,7 +837,6 @@ done: * Failure: -1 * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -962,7 +952,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -1010,7 +999,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -1198,7 +1186,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -1244,7 +1231,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -1279,7 +1265,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -1475,7 +1460,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * * Tuesday, January 21, 2003 * *------------------------------------------------------------------------- @@ -1513,7 +1497,7 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) else if (bogus_id == H5O_BOGUS_INVALID_ID) type = H5O_MSG_BOGUS_INVALID; else - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "invalid ID for 'bogus' message") /* Allocate space in the object header for bogus message */ if (H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) @@ -1546,7 +1530,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 19 2003 * *------------------------------------------------------------------------- @@ -1608,7 +1591,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 19 2003 * *------------------------------------------------------------------------- @@ -1708,10 +1690,9 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) /* Set type to "unknown" */ *obj_type = H5O_TYPE_UNKNOWN; } - else { + else /* Set object type */ *obj_type = obj_class->type; - } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__obj_type_real() */ @@ -1892,7 +1873,6 @@ H5O_loc_reset(H5O_loc_t *loc) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Monday, September 19, 2005 * *------------------------------------------------------------------------- @@ -2232,7 +2212,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) /* Set the object's reference count */ oinfo->rc = oh->nlink; - } /* end if */ + } /* Get time information, if requested */ if (fields & H5O_INFO_TIME) { @@ -2526,8 +2506,8 @@ H5O_get_oh_addr(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_flags * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2542,12 +2522,12 @@ H5O_get_oh_flags(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_mtime * - * Purpose: Retrieve an object's modification time. Assumes that the + * Purpose: Retrieve an object's modification time. Assumes that the * caller has verified that accessing this variable is appropriate * to the header in question. * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2563,8 +2543,8 @@ H5O_get_oh_mtime(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_version * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2812,7 +2792,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or /* Get an ID for the visited object */ if ((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register visited object") /* Make callback for starting object */ if ((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0) @@ -2896,7 +2876,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -2931,7 +2910,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -2944,7 +2922,8 @@ H5O__dec_rc(H5O_t *oh) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); + if (!oh) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object header") /* Decrement reference count */ oh->rc--; @@ -2967,7 +2946,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 08 2010 * *------------------------------------------------------------------------- @@ -3031,7 +3009,6 @@ H5O_get_proxy(const H5O_t *oh) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- diff --git a/src/H5P.c b/src/H5P.c index 5774f55..a2d9cfc 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ @@ -117,11 +117,11 @@ H5Pcopy(hid_t id) if ((copy_class = H5P__copy_pclass((H5P_genclass_t *)obj)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property class"); - /* Get an atom for the copied class */ + /* Get an ID for the copied class */ if ((ret_value = H5I_register(H5I_GENPROP_CLS, copy_class, TRUE)) < 0) { H5P__close_class(copy_class); HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, - "unable to atomize property list class"); + "unable to register property list class"); } /* end if */ } /* end else */ @@ -196,9 +196,9 @@ H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t cls_create copy_data, cls_close, close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list class") - /* Get an atom for the class */ + /* Get an ID for the class */ if ((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class") done: if (H5I_INVALID_HID == ret_value && pclass) @@ -756,14 +756,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Pget_size(hid_t id, const char *name, size_t *size) +H5Pget_size(hid_t id, const char *name, size_t *size /*out*/) { H5P_genclass_t *pclass; /* Property class to query */ H5P_genplist_t *plist; /* Property list to query */ herr_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*s*z", id, name, size); + H5TRACE3("e", "i*sx", id, name, size); /* Check arguments. */ if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) @@ -926,9 +926,9 @@ H5Pget_class(hid_t plist_id) if (H5P__access_class(pclass, H5P_MOD_INC_REF) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ID ref count"); - /* Get an atom for the class */ + /* Get an ID for the class */ if ((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class"); done: if (H5I_INVALID_HID == ret_value && pclass) @@ -961,14 +961,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Pget_nprops(hid_t id, size_t *nprops) +H5Pget_nprops(hid_t id, size_t *nprops /*out*/) { H5P_genplist_t *plist; /* Property list to query */ H5P_genclass_t *pclass; /* Property class to query */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*z", id, nprops); + H5TRACE2("e", "ix", id, nprops); /* Check arguments. */ if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) @@ -1262,13 +1262,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Pget(hid_t plist_id, const char *name, void *value) +H5Pget(hid_t plist_id, const char *name, void *value /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*s*x", plist_id, name, value); + H5TRACE3("e", "i*sx", plist_id, name, value); /* Check arguments. */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) @@ -1580,9 +1580,9 @@ H5Pget_class_parent(hid_t pclass_id) if (H5P__access_class(parent, H5P_MOD_INC_REF) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ID ref count") - /* Get an atom for the class */ + /* Get an ID for the class */ if ((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class") done: if (H5I_INVALID_HID == ret_value && parent) diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index a7a541c..c8a97c2 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -15,7 +15,7 @@ * * Created: H5Pdapl.c * October 27, 2008 - * Neil Fortner + * Neil Fortner * * Purpose: Dataset access property list class routines * @@ -36,7 +36,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Ppkg.h" /* Property lists */ /****************/ @@ -320,7 +320,7 @@ H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -371,7 +371,7 @@ H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -414,7 +414,7 @@ static herr_t H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -434,7 +434,7 @@ H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU static herr_t H5P__dapl_vds_file_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -460,7 +460,7 @@ H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t H5_AT const char *pref2 = *(const char *const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if (NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -484,7 +484,7 @@ done: static herr_t H5P__dapl_vds_file_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -560,7 +560,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -611,7 +611,7 @@ H5P__dapl_efile_pref_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -654,7 +654,7 @@ static herr_t H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -674,7 +674,7 @@ H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED static herr_t H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -700,7 +700,7 @@ H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_ const char *pref2 = *(const char *const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if (NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -724,7 +724,7 @@ done: static herr_t H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -775,7 +775,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set sizes */ if (H5P_set(plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0) @@ -804,22 +804,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) +H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, + double *rdcc_w0 /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ H5P_genplist_t *def_plist; /* Default file access property list */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*z*z*d", dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); + H5TRACE4("e", "ixxx", dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get default file access plist */ if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for default fapl ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for default fapl ID"); /* Get the properties. If a property is set to the default value, the value * from the default fapl is used. */ @@ -865,11 +866,11 @@ done: static herr_t H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) { - uint64_t enc_value; /* Property value to encode */ - uint8_t **pp = (uint8_t **)_pp; + uint64_t enc_value = 0; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -924,7 +925,7 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) uint64_t enc_value; /* Decoded property value */ unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -965,11 +966,11 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) { - uint64_t enc_value; /* Property value to encode */ - uint8_t **pp = (uint8_t **)_pp; + uint64_t enc_value = 0; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -1024,7 +1025,7 @@ H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value) uint64_t enc_value; /* Decoded property value */ unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -1081,7 +1082,7 @@ H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ if (H5P_set(plist, H5D_ACS_VDS_VIEW_NAME, &view) < 0) @@ -1103,17 +1104,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view) +H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Dv", plist_id, view); + H5TRACE2("e", "ix", plist_id, view); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value from property list */ if (view) @@ -1223,7 +1224,7 @@ H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ if (H5P_set(plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &gap_size) < 0) @@ -1246,17 +1247,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size) +H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*h", plist_id, gap_size); + H5TRACE2("e", "ix", plist_id, gap_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value from property list */ if (gap_size) @@ -1309,7 +1310,7 @@ H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set up values */ info.ndims = ndims; @@ -1345,7 +1346,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_append_cb_t *func, void **udata) +H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_append_cb_t *func /*out*/, + void **udata /*out*/) { H5P_genplist_t * plist; /* property list pointer */ H5D_append_flush_t info; @@ -1353,11 +1355,11 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "iIu*h*DA**x", plist_id, ndims, boundary, func, udata); + H5TRACE5("e", "iIu*hxx", plist_id, ndims, boundary, func, udata); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve info for append flush */ if (H5P_get(plist, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) @@ -1407,7 +1409,7 @@ H5Pset_efile_prefix(hid_t plist_id, const char *prefix) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set prefix */ if (H5P_set(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) @@ -1428,7 +1430,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size) +H5Pget_efile_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) { H5P_genplist_t *plist; /* Property list pointer */ char * my_prefix; /* Library's copy of the prefix */ @@ -1436,11 +1438,11 @@ H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "i*sz", plist_id, prefix, size); + H5TRACE3("Zs", "ixz", plist_id, prefix, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the current prefix */ if (H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &my_prefix) < 0) @@ -1495,7 +1497,7 @@ H5Pset_virtual_prefix(hid_t plist_id, const char *prefix) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set prefix */ if (H5P_set(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0) @@ -1518,7 +1520,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Pget_virtual_prefix(hid_t plist_id, char *prefix, size_t size) +H5Pget_virtual_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) { H5P_genplist_t *plist; /* Property list pointer */ char * my_prefix; /* Library's copy of the prefix */ @@ -1526,11 +1528,11 @@ H5Pget_virtual_prefix(hid_t plist_id, char *prefix, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "i*sz", plist_id, prefix, size); + H5TRACE3("Zs", "ixz", plist_id, prefix, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the current prefix */ if (H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &my_prefix) < 0) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 63402e2..d08d892 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1977,13 +1977,6 @@ H5P__init_def_layout(void) * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -2002,7 +1995,7 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") #ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER /* If the compiler doesn't support C99 designated initializers, check if @@ -2057,13 +2050,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and get property for - * generic property list. - * *------------------------------------------------------------------------- */ H5D_layout_t @@ -2078,7 +2064,7 @@ H5Pget_layout(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5D_LAYOUT_ERROR, "can't find object for ID") /* Peek at layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2106,13 +2092,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -2161,7 +2140,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set chunk information in property list */ chunk_layout.u.chunk.ndims = (unsigned)ndims; @@ -2187,13 +2166,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ int @@ -2208,7 +2180,7 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Peek at the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2255,7 +2227,7 @@ herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const char *src_dset_name, hid_t src_space_id) { - H5P_genplist_t * plist; /* Property list pointer */ + H5P_genplist_t * plist = NULL; /* Property list pointer */ H5O_layout_t virtual_layout; /* Layout information for setting virtual info */ H5S_t * vspace; /* Virtual dataset space selection */ H5S_t * src_space; /* Source dataset space selection */ @@ -2293,7 +2265,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the current layout */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0) @@ -2447,7 +2419,7 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/) if (count) { /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2492,7 +2464,7 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2509,7 +2481,7 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx) /* Register ID */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace") done: /* Free space on failure */ @@ -2549,7 +2521,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2600,7 +2572,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) /* Register ID */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace") done: /* Free space on failure */ @@ -2652,7 +2624,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2713,7 +2685,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2773,7 +2745,7 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2813,14 +2785,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_chunk_opts(hid_t plist_id, unsigned *options) +H5Pget_chunk_opts(hid_t plist_id, unsigned *options /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ H5O_layout_t layout; /* Layout information for setting chunk info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", plist_id, options); + H5TRACE2("e", "ix", plist_id, options); #ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER /* If the compiler doesn't support C99 designated initializers, check if @@ -2833,7 +2805,7 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) @@ -2896,7 +2868,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") @@ -2947,13 +2919,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ int @@ -2968,7 +2933,7 @@ H5Pget_external_count(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) @@ -3003,13 +2968,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and get property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -3025,7 +2983,7 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) @@ -3088,7 +3046,7 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Always set K13 compression (and un-set CHIP compression) */ options_mask &= (unsigned)(~H5_SZIP_CHIP_OPTION_MASK); @@ -3129,8 +3087,6 @@ done: * Programmer: Kent Yang * Wednesday, November 13, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3149,7 +3105,7 @@ H5Pset_shuffle(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Add the filter */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -3173,9 +3129,6 @@ done: * Programmer: Xiaowen Wu * Wednesday, December 22, 2004 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3194,7 +3147,7 @@ H5Pset_nbit(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Add the nbit filter */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -3234,9 +3187,6 @@ done: * Programmer: Xiaowen Wu * Thursday, April 14, 2005 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3261,7 +3211,7 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set parameters for the filter * scale_type = 0: floating-point type, filter uses variable-minimum-bits method, @@ -3315,7 +3265,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the current fill value */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -3504,7 +3454,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the fill value */ if (H5P_get_fill_value(plist, type, value) < 0) @@ -3613,7 +3563,7 @@ H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the fill-value status */ if (H5P_fill_value_defined(plist, status) < 0) @@ -3635,9 +3585,6 @@ done: * Programmer: Raymond Lu * Wednesday, January 16, 2002 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3657,7 +3604,7 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Check for resetting to default for layout type */ if (alloc_time == H5D_ALLOC_TIME_DEFAULT) { @@ -3744,7 +3691,7 @@ H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/) /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve fill value settings */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -3787,7 +3734,7 @@ H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time) /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve previous fill value settings */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -3815,9 +3762,6 @@ done: * Programmer: Raymond Lu * Wednesday, January 16, 2002 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3835,7 +3779,7 @@ H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/) /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve fill value settings */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -3865,26 +3809,24 @@ done: * Programmer: Jacob Smith * 2018 August 14 * - * Modifications: None. - * *----------------------------------------------------------------------------- */ herr_t -H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize) +H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize /*out*/) { hbool_t setting = FALSE; H5P_genplist_t *plist = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*b", dcpl_id, minimize); + H5TRACE2("e", "ix", dcpl_id, minimize); if (NULL == minimize) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "receiving pointer cannot be NULL") plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE); if (NULL == plist) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &setting) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset oh minimize flag value") @@ -3911,8 +3853,6 @@ done: * Programmer: Jacob Smith * 2018 August 14 * - * Modifications: None. - * *----------------------------------------------------------------------------- */ herr_t @@ -3927,7 +3867,7 @@ H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize) plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE); if (NULL == plist) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &prev_set) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get extant dset oh minimize flag value") diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 41eb05e..90c6c5d 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Pdeprec.c * October 11 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5P interface. These * functions are here for compatibility purposes and may be @@ -459,7 +459,7 @@ H5Pget_version(hid_t plist_id, unsigned *super /*out*/, unsigned *freelist /*out /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (super) @@ -606,7 +606,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold) +H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy /*out*/, hsize_t *threshold /*out*/) { H5F_fspace_strategy_t new_strategy; /* File space strategy type */ hbool_t new_persist; /* Persisting free-space or not */ @@ -614,7 +614,7 @@ H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *thre herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Ft*h", plist_id, strategy, threshold); + H5TRACE3("e", "ixx", plist_id, strategy, threshold); /* Get current file space info */ if (H5Pget_file_space_strategy(plist_id, &new_strategy, &new_persist, &new_threshold) < 0) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 9c08727..70fc982 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -15,7 +15,7 @@ * * Created: H5Pdxpl.c * March 16 1998 - * Robb Matzke + * Robb Matzke * * Purpose: Data transfer property list class routines * @@ -782,7 +782,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -813,7 +813,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -903,7 +903,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -953,7 +953,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* See if a data transform is already set, and free it if it is */ if (H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) @@ -1015,7 +1015,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") @@ -1077,7 +1077,7 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ if (H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0) @@ -1117,7 +1117,7 @@ H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, 0, "can't find object for ID") /* Return values */ if (tconv) @@ -1166,7 +1166,7 @@ H5Pset_preserve(hid_t plist_id, hbool_t status) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO; @@ -1203,7 +1203,7 @@ H5Pget_preserve(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (H5P_get(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0) @@ -1246,7 +1246,7 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ if (H5P_set(plist, H5D_XFER_EDC_NAME, &check) < 0) @@ -1282,7 +1282,7 @@ H5Pget_edc_check(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_ERROR_EDC, "can't find object for ID") /* Update property list */ if (H5P_get(plist, H5D_XFER_EDC_NAME, &ret_value) < 0) @@ -1304,8 +1304,6 @@ done: * Programmer: Raymond Lu * Jan 14, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1320,7 +1318,7 @@ H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ cb_struct.func = func; @@ -1345,8 +1343,6 @@ done: * Programmer: Raymond Lu * April 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1361,7 +1357,7 @@ H5Pset_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t op, void *operate_dat /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ cb_struct.func = op; @@ -1386,23 +1382,21 @@ done: * Programmer: Raymond Lu * April 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op, void **operate_data) +H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op /*out*/, void **operate_data /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ H5T_conv_cb_t cb_struct; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*TE**x", plist_id, op, operate_data); + H5TRACE3("e", "ixx", plist_id, op, operate_data); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get property */ if (H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) @@ -1443,7 +1437,7 @@ H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the split ratios */ if (H5P_get(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &btree_split_ratio) < 0) @@ -1498,7 +1492,7 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ split_ratio[0] = left; @@ -1621,7 +1615,7 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func /*out*/, voi /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (alloc_func) if (H5P_get(plist, H5D_XFER_VLEN_ALLOC_NAME, alloc_func) < 0) @@ -1676,7 +1670,7 @@ H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ if (H5P_set(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &vector_size) < 0) @@ -1709,7 +1703,7 @@ H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Return values */ if (vector_size) @@ -1951,17 +1945,18 @@ H5P__dxfr_mpio_chunk_opt_hard_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ herr_t -H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode) +H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, + H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode /*out*/) { H5P_genplist_t *plist; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Do", plist_id, actual_chunk_opt_mode); + H5TRACE2("e", "ix", plist_id, actual_chunk_opt_mode); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Return values */ if (actual_chunk_opt_mode) @@ -1986,17 +1981,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode) +H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode /*out*/) { H5P_genplist_t *plist; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Di", plist_id, actual_io_mode); + H5TRACE2("e", "ix", plist_id, actual_io_mode); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Return values */ if (actual_io_mode) @@ -2019,18 +2014,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, - uint32_t *global_no_collective_cause) +H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause /*out*/, + uint32_t *global_no_collective_cause /*out*/) { H5P_genplist_t *plist; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Iu*Iu", plist_id, local_no_collective_cause, global_no_collective_cause); + H5TRACE3("e", "ixx", plist_id, local_no_collective_cause, global_no_collective_cause); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Return values */ if (local_no_collective_cause) diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index b045210..5b0ecb6 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index f413bec..6f3884f 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -869,7 +869,7 @@ H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_ALIGN_THRHD_NAME, &threshold) < 0) @@ -906,7 +906,7 @@ H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment / /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (threshold) @@ -1547,7 +1547,7 @@ H5Pset_family_offset(hid_t fapl_id, hsize_t offset) if (H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value */ if (H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) @@ -1585,7 +1585,7 @@ H5Pget_family_offset(hid_t fapl_id, hsize_t *offset /*out*/) if (H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (offset) { @@ -1625,7 +1625,7 @@ H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) if (H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value */ if (H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0) @@ -1663,7 +1663,7 @@ H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type /*out*/) if (H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (type) { @@ -1714,7 +1714,7 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots, /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set sizes */ if (H5P_set(plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0) @@ -1756,7 +1756,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots /*out*/, size_ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get sizes */ @@ -1802,7 +1802,7 @@ H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* validate the new configuration */ if (H5AC_validate_cache_image_config(config_ptr) < 0) @@ -1849,7 +1849,7 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config /*out* /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* validate the config ptr */ if (config == NULL) @@ -1894,7 +1894,7 @@ H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* validate the new configuration */ if (H5AC_validate_config(config_ptr) < 0) @@ -1941,7 +1941,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* validate the config ptr */ if (config == NULL) @@ -1997,7 +1997,7 @@ H5Pset_gc_references(hid_t plist_id, unsigned gc_ref) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_GARBG_COLCT_REF_NAME, &gc_ref) < 0) @@ -2031,7 +2031,7 @@ H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (gc_ref) @@ -2065,7 +2065,7 @@ H5Pset_fclose_degree(hid_t plist_id, H5F_close_degree_t degree) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_CLOSE_DEGREE_NAME, °ree) < 0) @@ -2098,7 +2098,7 @@ H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (degree && H5P_get(plist, H5F_ACS_CLOSE_DEGREE_NAME, degree) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree") @@ -2140,7 +2140,7 @@ H5Pset_meta_block_size(hid_t plist_id, hsize_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0) @@ -2174,7 +2174,7 @@ H5Pget_meta_block_size(hid_t plist_id, hsize_t *size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (size) { @@ -2219,7 +2219,7 @@ H5Pset_sieve_buf_size(hid_t plist_id, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0) @@ -2253,7 +2253,7 @@ H5Pget_sieve_buf_size(hid_t plist_id, size_t *size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (size) @@ -2297,7 +2297,7 @@ H5Pset_small_data_block_size(hid_t plist_id, hsize_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &size) < 0) @@ -2331,7 +2331,7 @@ H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (size) { @@ -2472,7 +2472,7 @@ H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low) < 0) @@ -2507,7 +2507,7 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low /*out*/, H5F_libver_t *hi /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (low) @@ -2549,7 +2549,7 @@ H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value */ if (H5P_set(plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) @@ -2586,7 +2586,7 @@ H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (efc_size) @@ -2626,7 +2626,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get old image info */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) @@ -2719,7 +2719,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/) /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) @@ -2794,7 +2794,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get old info */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) @@ -2870,7 +2870,7 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get old info */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) @@ -4198,7 +4198,7 @@ H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &attempts) < 0) @@ -4233,7 +4233,7 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the # of read attempts set */ if (H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, attempts) < 0) @@ -4277,7 +4277,7 @@ H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Update property list */ flush_info.func = func; @@ -4315,7 +4315,7 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func /*out*/, void **udat /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Retrieve the callback function and user data */ if (H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &flush_info) < 0) @@ -4663,7 +4663,7 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t H5_ATTR_PARALLEL_UNUSED evict_on_cl /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") #ifndef H5_HAVE_PARALLEL /* Set value */ @@ -4711,7 +4711,7 @@ H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close /*out*/) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_get(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, evict_on_close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close property") @@ -4756,7 +4756,7 @@ H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_USE_FILE_LOCKING_NAME, &use_file_locking) < 0) @@ -4798,7 +4798,7 @@ H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking /*out*/, hbool_t *i /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (H5P_get(plist, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0) @@ -4929,7 +4929,7 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) @@ -4981,7 +4981,7 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &internal_flag) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") @@ -5024,7 +5024,7 @@ H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &is_collective) < 0) @@ -5061,7 +5061,7 @@ H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/ /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the properties */ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, comm) < 0) @@ -5104,7 +5104,7 @@ H5Pset_mpi_params(hid_t plist_id, MPI_Comm comm, MPI_Info info) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set values */ if (H5P_set(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) @@ -5511,7 +5511,7 @@ H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective /*out*/) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, is_collective) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get collective metadata write flag") @@ -5546,7 +5546,7 @@ H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_perc, /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (min_meta_perc > 100) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -5595,7 +5595,7 @@ H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size /*out*/, unsigned *min_ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get size */ @@ -5679,7 +5679,7 @@ H5Pset_vfd_swmr_config(hid_t plist_id, H5F_vfd_swmr_config_t *config_ptr) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Validate the input configuration */ @@ -5859,7 +5859,7 @@ H5Pget_vfd_swmr_config(hid_t plist_id, H5F_vfd_swmr_config_t *config_ptr) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Validate the config_ptr */ if (config_ptr == NULL) diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 47a3cf7..b33fda2 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pfcpl.c * January 6 1998 - * Robb Matzke + * Robb Matzke * * Purpose: File creation property list class routines * @@ -132,7 +132,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__fcrt_reg_prop(H5P_genclass_t *pclass); /* property callbacks */ static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size); @@ -157,7 +157,7 @@ const H5P_libclass_t H5P_CLS_FCRT[1] = {{ &H5P_CLS_FILE_CREATE_g, /* Pointer to class */ &H5P_CLS_FILE_CREATE_ID_g, /* Pointer to class ID */ &H5P_LST_FILE_CREATE_ID_g, /* Pointer to default property list ID */ - H5P_fcrt_reg_prop, /* Default property registration routine */ + H5P__fcrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -197,7 +197,7 @@ static const hsize_t H5F_def_free_space_threshold_g = H5F_CRT_FREE static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE_SPACE_PAGE_SIZE_DEF; /*------------------------------------------------------------------------- - * Function: H5P_fcrt_reg_prop + * Function: H5P__fcrt_reg_prop * * Purpose: Register the file creation property list class's properties * @@ -208,11 +208,11 @@ static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE *------------------------------------------------------------------------- */ static herr_t -H5P_fcrt_reg_prop(H5P_genclass_t *pclass) +H5P__fcrt_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register the user block size */ if (H5P__register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, @@ -303,7 +303,7 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_fcrt_reg_prop() */ +} /* end H5P__fcrt_reg_prop() */ /*------------------------------------------------------------------------- * Function: H5Pset_userblock @@ -340,7 +340,7 @@ H5Pset_userblock(hid_t plist_id, hsize_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value */ if (H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0) @@ -363,25 +363,20 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t -H5Pget_userblock(hid_t plist_id, hsize_t *size) +H5Pget_userblock(hid_t plist_id, hsize_t *size /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*h", plist_id, size); + H5TRACE2("e", "ix", plist_id, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (size) @@ -427,7 +422,7 @@ H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value */ if (sizeof_addr) { @@ -463,17 +458,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr, size_t *sizeof_size) +H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*z*z", plist_id, sizeof_addr, sizeof_size); + H5TRACE3("e", "ixx", plist_id, sizeof_addr, sizeof_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (sizeof_addr) { @@ -518,11 +513,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -537,7 +527,7 @@ H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (ik > 0) { @@ -571,15 +561,10 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t -H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */, unsigned *lk /*out */) +H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/) { unsigned btree_k[H5B_NUM_BTREE_ID]; H5P_genplist_t *plist; /* Property list pointer */ @@ -590,7 +575,7 @@ H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */, unsigned *lk /*out */) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (ik) { @@ -618,11 +603,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -644,7 +624,7 @@ H5Pset_istore_k(hid_t plist_id, unsigned ik) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ if (H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) @@ -671,15 +651,10 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t -H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */) +H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out*/) { unsigned btree_k[H5B_NUM_BTREE_ID]; H5P_genplist_t *plist; /* Property list pointer */ @@ -690,7 +665,7 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (ik) { @@ -827,7 +802,7 @@ H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_set(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set number of indexes"); @@ -850,17 +825,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes) +H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", plist_id, nindexes); + H5TRACE2("e", "ix", plist_id, nindexes); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, nindexes) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes"); @@ -904,7 +879,7 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Read the current number of indexes */ if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0) @@ -949,8 +924,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags, - unsigned *min_mesg_size) +H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags /*out*/, + unsigned *min_mesg_size /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ unsigned nindexes; /* Number of SOHM indexes */ @@ -959,11 +934,11 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "iIu*Iu*Iu", plist_id, index_num, mesg_type_flags, min_mesg_size); + H5TRACE4("e", "iIuxx", plist_id, index_num, mesg_type_flags, min_mesg_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Read the current number of indexes */ if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0) @@ -1219,7 +1194,7 @@ H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_set(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &max_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set list maximum in property list"); @@ -1244,17 +1219,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree) +H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list /*out*/, unsigned *min_btree /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Iu*Iu", plist_id, max_list, min_btree); + H5TRACE3("e", "ixx", plist_id, max_list, min_btree); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value(s) */ if (max_list) @@ -1297,7 +1272,7 @@ H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value(s), if non-zero */ if (H5P_set(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &strategy) < 0) @@ -1329,18 +1304,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist, - hsize_t *threshold) +H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy /*out*/, hbool_t *persist /*out*/, + hsize_t *threshold /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*Ff*b*h", plist_id, strategy, persist, threshold); + H5TRACE4("e", "ixxx", plist_id, strategy, persist, threshold); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value(s) */ if (strategy) @@ -1451,13 +1426,13 @@ H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (fsp_size < H5F_FILE_SPACE_PAGE_SIZE_MIN) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "cannot set file space page size to less than 512") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to less than 512") if (fsp_size > H5F_FILE_SPACE_PAGE_SIZE_MAX) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "cannot set file space page size to more than 1GB") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to more than 1GB") /* Set the value*/ if (H5P_set(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &fsp_size) < 0) @@ -1480,17 +1455,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size) +H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*h", plist_id, fsp_size); + H5TRACE2("e", "ix", plist_id, fsp_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (fsp_size) diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index 78c4d56..b8dab90 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -15,7 +15,7 @@ * * Created: H5Pmtpl.c * November 1 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: File mount property list class routines * @@ -59,7 +59,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__fmnt_reg_prop(H5P_genclass_t *pclass); /*********************/ /* Package Variables */ @@ -74,7 +74,7 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{ &H5P_CLS_FILE_MOUNT_g, /* Pointer to class */ &H5P_CLS_FILE_MOUNT_ID_g, /* Pointer to class ID */ &H5P_LST_FILE_MOUNT_ID_g, /* Pointer to default property list ID */ - H5P_fmnt_reg_prop, /* Default property registration routine */ + H5P__fmnt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -96,7 +96,7 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{ static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlinks are local to file */ /*------------------------------------------------------------------------- - * Function: H5P_fmnt_reg_prop + * Function: H5P__fmnt_reg_prop * * Purpose: Register the file mount property list class's properties * @@ -107,11 +107,11 @@ static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlink *------------------------------------------------------------------------- */ static herr_t -H5P_fmnt_reg_prop(H5P_genclass_t *pclass) +H5P__fmnt_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register property of whether symlinks is local to file */ if (H5P__register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, NULL, @@ -120,4 +120,4 @@ H5P_fmnt_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_fmnt_reg_prop() */ +} /* end H5P__fmnt_reg_prop() */ diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index c27ee9d..7d671c6 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pgcpl.c * August 29 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Group creation property list class routines * @@ -161,7 +161,7 @@ H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) @@ -204,7 +204,7 @@ H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) @@ -255,7 +255,7 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) @@ -304,7 +304,7 @@ H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) @@ -357,7 +357,7 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) @@ -406,7 +406,7 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) @@ -449,7 +449,7 @@ H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get link info */ if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) @@ -497,7 +497,7 @@ H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get link info */ if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) diff --git a/src/H5Pint.c b/src/H5Pint.c index 5fd811c..4215ccb 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ @@ -459,9 +459,9 @@ H5P__init_package(void) * Initialize the Generic Property class & object groups. */ if (H5I_register_type(H5I_GENPROPCLS_CLS) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") if (H5I_register_type(H5I_GENPROPLST_CLS) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") /* Repeatedly pass over the list of property list classes for the library, * initializing each class if its parent class is initialized, until no @@ -533,7 +533,7 @@ done: RETURNS Non-negative on success/Negative on failure DESCRIPTION - Release the atom group and any other resources allocated. + Release the ID group and any other resources allocated. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -950,9 +950,9 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) if (H5P__access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ref count") - /* Get an atom for the property list */ + /* Get an ID for the property list */ if ((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ @@ -1855,9 +1855,9 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) if ((plist = H5P__create(pclass)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") - /* Get an atom for the property list */ + /* Get an ID for the property list */ if ((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ @@ -3992,7 +3992,7 @@ H5P_object_verify(hid_t plist_id, hid_t pclass_id) /* Get the plist structure */ if (NULL == (ret_value = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5560,7 +5560,7 @@ done: * Return: Success: Non-negative ID of property list. * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * April 22, 2014 * *------------------------------------------------------------------------- @@ -5587,7 +5587,7 @@ H5P_get_plist_id(const H5P_genplist_t *plist) * Return: Success: Non-NULL class of property list. * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * April 22, 2014 * *------------------------------------------------------------------------- diff --git a/src/H5Plapl.c b/src/H5Plapl.c index b1722bc..879e6ed 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -15,7 +15,7 @@ * * Created: H5Plapl.c * July 14 2006 - * James Laird + * James Laird * * Purpose: Link access property list class routines * @@ -478,7 +478,7 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED /* Close the FAPL */ if (l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -604,7 +604,7 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE /* Close the FAPL */ if ((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -919,7 +919,7 @@ H5Pset_nlinks(hid_t plist_id, size_t nlinks) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set number of links */ if (H5P_set(plist, H5L_ACS_NLINKS_NAME, &nlinks) < 0) @@ -946,20 +946,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_nlinks(hid_t plist_id, size_t *nlinks) +H5Pget_nlinks(hid_t plist_id, size_t *nlinks /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*z", plist_id, nlinks); + H5TRACE2("e", "ix", plist_id, nlinks); if (!nlinks) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer passed in"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the current number of links */ if (H5P_get(plist, H5L_ACS_NLINKS_NAME, nlinks) < 0) @@ -994,7 +994,7 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set prefix */ if (H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0) @@ -1021,7 +1021,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size) +H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) { H5P_genplist_t *plist; /* Property list pointer */ char * my_prefix; /* Library's copy of the prefix */ @@ -1029,11 +1029,11 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "i*sz", plist_id, prefix, size); + H5TRACE3("Zs", "ixz", plist_id, prefix, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the current prefix */ if (H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) @@ -1116,7 +1116,7 @@ H5Pget_elink_fapl(hid_t lapl_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") @@ -1156,7 +1156,7 @@ H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set flags */ if (H5P_set(plist, H5L_ACS_ELINK_FLAGS_NAME, &flags) < 0) @@ -1180,17 +1180,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags) +H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", lapl_id, flags); + H5TRACE2("e", "ix", lapl_id, flags); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get flags */ if (flags) @@ -1232,7 +1232,7 @@ H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Populate the callback info struct */ cb_info.func = func; @@ -1260,18 +1260,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data) +H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func /*out*/, void **op_data /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ H5L_elink_cb_t cb_info; /* Callback info struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Lt**x", lapl_id, func, op_data); + H5TRACE3("e", "ixx", lapl_id, func, op_data); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get callback_info */ if (H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 9261244..92077d1 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -59,7 +59,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__lcrt_reg_prop(H5P_genclass_t *pclass); /*********************/ /* Package Variables */ @@ -74,7 +74,7 @@ const H5P_libclass_t H5P_CLS_LCRT[1] = {{ &H5P_CLS_LINK_CREATE_g, /* Pointer to class */ &H5P_CLS_LINK_CREATE_ID_g, /* Pointer to class ID */ &H5P_LST_LINK_CREATE_ID_g, /* Pointer to default property list ID */ - H5P_lcrt_reg_prop, /* Default property registration routine */ + H5P__lcrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -97,7 +97,7 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; /* Default setting for creating intermediate groups */ /*------------------------------------------------------------------------- - * Function: H5P_lcrt_reg_prop + * Function: H5P__lcrt_reg_prop * * Purpose: Register the dataset creation property list class's properties * @@ -107,12 +107,12 @@ static const unsigned H5L_def_intmd_group_g = * October 31, 2006 *------------------------------------------------------------------------- */ -herr_t -H5P_lcrt_reg_prop(H5P_genclass_t *pclass) +static herr_t +H5P__lcrt_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Register create intermediate groups property */ if (H5P__register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, @@ -122,7 +122,7 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lcrt_reg_prop() */ +} /* end H5P__lcrt_reg_prop() */ /*------------------------------------------------------------------------- * Function: H5Pset_create_intermediate_group @@ -149,7 +149,7 @@ H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd_group) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value */ crt_intmd_group = (unsigned)(crt_intmd_group > 0 ? 1 : 0); @@ -183,7 +183,7 @@ H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd_group /*out /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (crt_intmd_group) diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c index 8fdf610..2ce1ec0 100644 --- a/src/H5Pmapl.c +++ b/src/H5Pmapl.c @@ -160,7 +160,7 @@ H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_all /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set sizes */ if (H5P_set(plist, H5M_ACS_KEY_PREFETCH_SIZE_NAME, &key_prefetch_size) < 0) @@ -182,17 +182,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_alloc_size) +H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, size_t *key_alloc_size /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*z*z", mapl_id, key_prefetch_size, key_alloc_size); + H5TRACE3("e", "ixx", mapl_id, key_prefetch_size, key_alloc_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the properties */ if (key_prefetch_size) { diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h index 130cb90..18f30c6 100644 --- a/src/H5Pmodule.h +++ b/src/H5Pmodule.h @@ -44,7 +44,6 @@ * and compressed. * * \todo Describe concisely what the functions in this module are about. - * \todo Clicking on "more" after "Property List Interface" at the top does not work * * \defgroup GPLO General Property List Operations * \ingroup H5P @@ -70,6 +69,10 @@ * \ingroup H5P * \defgroup OCPPL Object Copy Properties * \ingroup H5P + * \defgroup GACPL General Access Properties + * \ingroup H5P + * \defgroup MAPL Map Access Properties + * \ingroup H5P */ #endif /* H5Pmodule_H */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index b977a35..edb0cca 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -15,7 +15,7 @@ * * Created: H5Pocpl.c * Nov 28 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object creation property list class routines * @@ -226,7 +226,7 @@ H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set property values */ if (H5P_set(plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &max_compact) < 0) @@ -251,17 +251,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, unsigned *min_dense) +H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Iu*Iu", plist_id, max_compact, min_dense); + H5TRACE3("e", "ixx", plist_id, max_compact, min_dense); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (max_compact) { @@ -305,7 +305,7 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) @@ -342,12 +342,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags) +H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) { herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", plist_id, crt_order_flags); + H5TRACE2("e", "ix", plist_id, crt_order_flags); /* Get values */ if (crt_order_flags) { @@ -359,7 +359,7 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) @@ -412,7 +412,7 @@ H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) @@ -445,12 +445,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times) +H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times /*out*/) { herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*b", plist_id, track_times); + H5TRACE2("e", "ix", plist_id, track_times); /* Get values */ if (track_times) { @@ -459,7 +459,7 @@ H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) @@ -568,13 +568,6 @@ done: * Programmer: Quincey Koziol * Friday, April 5, 2003 * - * Modifications: - * - * Neil Fortner - * Thursday, March 26, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -597,7 +590,7 @@ H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Modify the filter parameters of the I/O pipeline */ if (H5P_modify_filter(plist, filter, flags, cd_nelmts, cd_values) < 0) @@ -637,18 +630,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * - * Neil Fortner - * Wednesday, May 20, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -671,7 +652,7 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Call the private function */ if (H5P__set_filter(plist, filter, flags, cd_nelmts, cd_values) < 0) @@ -764,13 +745,6 @@ done: * Programmer: Robb Matzke * Tuesday, August 4, 1998 * - * Modifications: - * - * Neil Fortner - * Wednesday, May 20, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ int @@ -785,7 +759,7 @@ H5Pget_nfilters(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the pipeline property to query */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -820,13 +794,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * - * Neil Fortner - * Wednesday, May 20, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ H5Z_filter_t @@ -866,7 +833,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID") /* Get the pipeline property to query */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -959,25 +926,18 @@ done: * Programmer: Quincey Koziol * Friday, April 5, 2003 * - * Modifications: - * - * Neil Fortner - * Thursday, May 21, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, size_t *cd_nelmts /*in_out*/, unsigned cd_values[] /*out*/, size_t namelen, - char name[] /*out*/, unsigned *filter_config) + char name[] /*out*/, unsigned *filter_config /*out*/) { H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "iZfx*zxzx*Iu", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config); + H5TRACE8("e", "iZfx*zxzxx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config); /* Check args */ if (cd_nelmts || cd_values) { @@ -1002,7 +962,7 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get filter information */ if (H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) @@ -1025,13 +985,6 @@ done: * Programmer: Quincey Koziol * Tuesday, April 8, 2003 * - * Modifications: - * - * Neil Fortner - * Thursday, May 21, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ htri_t @@ -1046,7 +999,7 @@ H5Pall_filters_avail(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the pipeline property to query */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -1106,13 +1059,6 @@ done: * Programmer: Pedro Vicente * January 26, 2004 * - * Modifications: - * - * Neil Fortner - * Thursday, May 21, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -1127,7 +1073,7 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the pipeline property to modify */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -1164,18 +1110,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * - * Neil Fortner - * Thursday, March 26, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -1194,7 +1128,7 @@ H5Pset_deflate(hid_t plist_id, unsigned level) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the pipeline property to append to */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -1223,13 +1157,6 @@ done: * Programmer: Raymond Lu * Dec 19, 2002 * - * Modifications: - * - * Neil Fortner - * Wednesday, May 6, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -1244,7 +1171,7 @@ H5Pset_fletcher32(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the pipeline property to append to */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -1854,7 +1781,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID") /* Get pipeline info */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) @@ -1933,7 +1860,7 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get filter info */ if (H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 3007ce6..d77e69d 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -15,7 +15,7 @@ * * Created: H5Pocpypl.c * Mar 13 2006 - * Peter Cao + * Peter Cao * * Purpose: Object copying property list class routines * @@ -656,7 +656,7 @@ H5Pset_copy_object(hid_t plist_id, unsigned cpy_option) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set value */ if (H5P_set(plist, H5O_CPY_OPTION_NAME, &cpy_option) < 0) @@ -689,7 +689,7 @@ H5Pget_copy_object(hid_t plist_id, unsigned *cpy_option /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get values */ if (cpy_option) @@ -739,7 +739,7 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get dtype list */ if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0) @@ -794,7 +794,7 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get dtype list */ if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) @@ -846,7 +846,7 @@ H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Populate the callback info struct */ cb_info.func = func; @@ -878,18 +878,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data) +H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func /*out*/, void **op_data /*out*/) { H5P_genplist_t * plist; /* Property list pointer */ H5O_mcdt_cb_info_t cb_info; /* Callback info struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Os**x", plist_id, func, op_data); + H5TRACE3("e", "ixx", plist_id, func, op_data); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get callback info */ if (H5P_get(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0) diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index fb187ad..d121d08 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pstrcpl.c * October 26 2005 - * James Laird + * James Laird * * Purpose: String creation property list class routines * @@ -156,7 +156,7 @@ H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Set the character encoding */ if (H5P_set(plist, H5P_STRCRT_CHAR_ENCODING_NAME, &encoding) < 0) @@ -188,7 +188,7 @@ H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get value */ if (encoding) diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 1c1c06c..645988a 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Saturday May 31, 2003 * * Purpose: Generic Property Testing Functions @@ -109,9 +109,9 @@ H5P__open_class_path_test(const char *path) if (NULL == (pclass = H5P__open_class_path(path))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path"); - /* Get an atom for the class */ + /* Get an ID for the class */ if ((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class"); done: if (H5I_INVALID_HID == ret_value && pclass) diff --git a/src/H5S.c b/src/H5S.c index feeefbb..ad47201 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -115,11 +115,11 @@ H5S__init_package(void) FUNC_ENTER_PACKAGE - /* Initialize the atom group for the dataspace IDs */ + /* Initialize the ID group for the dataspace IDs */ if (H5I_register_type(H5I_DATASPACE_CLS) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") - /* Initialize the atom group for the dataspace selction iterator IDs */ + /* Initialize the ID group for the dataspace selction iterator IDs */ if (H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace selection iterator ID class") @@ -141,7 +141,7 @@ done: RETURNS Non-negative on success/Negative on failure DESCRIPTION - Release IDs for the atom group, deferring full interface shutdown + Release IDs for the ID group, deferring full interface shutdown until later (in H5S_term_package). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -185,7 +185,7 @@ H5S_top_term_package(void) RETURNS Non-negative on success/Negative on failure DESCRIPTION - Release the atom group and any other resources allocated. + Release the ID group and any other resources allocated. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -382,9 +382,9 @@ H5Screate(H5S_class_t type) if (NULL == (new_ds = H5S_create(type))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") done: if (ret_value < 0) @@ -531,9 +531,9 @@ H5Scopy(hid_t space_id) if (NULL == (dst = H5S_copy(src, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, dst, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") done: if (ret_value < 0) @@ -1230,7 +1230,7 @@ H5Sis_simple(hid_t space_id) /* Check args and all the boring stuff. */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") ret_value = H5S__is_simple(space); @@ -1276,7 +1276,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") if (rank > 0 && dims == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") if (rank < 0 || rank > H5S_MAX_RANK) @@ -1432,9 +1432,9 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/ if (NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") done: if (ret_value < 0) @@ -1804,7 +1804,7 @@ H5Sset_extent_none(hid_t space_id) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") /* Clear the previous extent from the dataspace */ if (H5S__extent_release(&space->extent) < 0) diff --git a/src/H5Sall.c b/src/H5Sall.c index 8eeebbc..35ddf3d 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * * Purpose: "All" selection dataspace I/O functions. diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index b4ead95..d20916b 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -17,7 +17,6 @@ * Quincey Koziol * Jul 24 2007 * - * * Purpose: Dump debugging information about a dataspace * *------------------------------------------------------------------------- diff --git a/src/H5Sdeprec.c b/src/H5Sdeprec.c index 3e3909c..d050102 100644 --- a/src/H5Sdeprec.c +++ b/src/H5Sdeprec.c @@ -78,7 +78,6 @@ * Failure: negative * * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu * July 14, 2004 * *------------------------------------------------------------------------- diff --git a/src/H5Shyper.c b/src/H5Shyper.c index f081468..307ded9 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1104,10 +1104,10 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) } /* end if */ /* Must be an irregular hyperslab selection */ else { - H5S_hyper_span_t * curr_span; /* Current hyperslab span node */ - H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hsize_t * abs_arr; /* Absolute hyperslab span position */ - int curr_dim; /* Temporary rank holder */ + H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */ + H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ + hsize_t * abs_arr; /* Absolute hyperslab span position */ + int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ ndims = iter->rank; @@ -1296,10 +1296,10 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) } /* end if */ /* Must be an irregular hyperslab selection */ else { - H5S_hyper_span_t * curr_span; /* Current hyperslab span node */ - H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hsize_t * abs_arr; /* Absolute hyperslab span position */ - int curr_dim; /* Temporary rank holder */ + H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */ + H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ + hsize_t * abs_arr; /* Absolute hyperslab span position */ + int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ ndims = iter->rank; @@ -2138,24 +2138,31 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max case 0: do { DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS @@ -4766,13 +4773,13 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblo --------------------------------------------------------------------------*/ herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, - hsize_t buf[/*numblocks*/]) + hsize_t buf[/*numblocks*/] /*out*/) { H5S_t *space; /* Dataspace to modify selection of */ herr_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ihh*[a2]h", spaceid, startblock, numblocks, buf); + H5TRACE4("e", "ihhx", spaceid, startblock, numblocks, buf); /* Check args */ if (buf == NULL) @@ -5388,7 +5395,7 @@ H5S__hyper_spans_shape_same_helper(const H5S_hyper_span_info_t *span_info1, { hbool_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(span_info1); @@ -7004,9 +7011,8 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset) { hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */ unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(space); @@ -7053,8 +7059,7 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset) } /* end if */ } -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_adjust_s() */ /*-------------------------------------------------------------------------- @@ -9666,7 +9671,7 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], const h unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -10103,7 +10108,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons case H5S_SEL_POINTS: /* Can't combine hyperslab operations and point selections currently */ if (op == H5S_SELECT_SET) /* Allow only "set" operation to proceed */ break; - /* Else fall through to error */ + /* FALLTHROUGH (to error) */ H5_ATTR_FALLTHROUGH case H5S_SEL_ERROR: @@ -10268,7 +10273,7 @@ done: Specify a hyperslab to combine with the current hyperslab selection, and store the result in the new hyperslab selection. USAGE - herr_t H5S_combine_hyperslab(new_space, old_space, op, start, stride, count, block) + herr_t H5S_combine_hyperslab(old_space, op, start, stride, count, block, new_space) H5S_t *old_space; IN: The old space the selection is performed on H5S_seloper_t op; IN: Operation to perform on current selection const hsize_t start[]; IN: Offset of start of hyperslab @@ -10573,9 +10578,9 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], co if (H5S_combine_hyperslab(space, op, start, stride, count, block, &new_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to set hyperslab selection") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") done: if (ret_value < 0 && new_space) @@ -10715,9 +10720,9 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) if (NULL == (new_space = H5S__combine_select(space1, op, space2))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to create hyperslab selection") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") done: if (ret_value < 0 && new_space) @@ -12353,14 +12358,15 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[]) +H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[] /*out*/, hsize_t stride[] /*out*/, + hsize_t count[] /*out*/, hsize_t block[] /*out*/) { H5S_t * space; /* Dataspace to query */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*h*h*h*h", spaceid, start, stride, count, block); + H5TRACE5("e", "ixxxx", spaceid, start, stride, count, block); /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index f7e4a5e..d6244b8 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Friday, May 29, 1998 * * Purpose: Dataspace selection functions. @@ -142,10 +142,10 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") if (space->extent.rank == 0 || (H5S_GET_EXTENT_TYPE(space) == H5S_SCALAR || H5S_GET_EXTENT_TYPE(space) == H5S_NULL)) - HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace") + HGOTO_ERROR(H5E_ID, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace") if (offset == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified") @@ -602,13 +602,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]) +H5Sget_select_bounds(hid_t spaceid, hsize_t start[] /*out*/, hsize_t end[] /*out*/) { H5S_t *space; /* Dataspace to modify selection of */ herr_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*h*h", spaceid, start, end); + H5TRACE3("e", "ixx", spaceid, start, end); /* Check args */ if (start == NULL || end == NULL) @@ -1671,7 +1671,7 @@ H5Sget_select_type(hid_t space_id) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5S_SEL_ERROR, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5S_SEL_ERROR, "not a dataspace") /* Set return value */ ret_value = H5S_GET_SELECT_TYPE(space); @@ -2851,9 +2851,9 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, hid_t src if (H5S_select_project_intersection(src_space, dst_space, src_intersect_space, &proj_space, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, proj_space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") done: if (ret_value < 0) @@ -3000,10 +3000,10 @@ H5Ssel_iter_create(hid_t space_id, size_t elmt_size, unsigned flags) if (H5S_select_iter_init(sel_iter, space, elmt_size, flags) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to initialize selection iterator") - /* Atomize */ + /* Register */ if ((ret_value = H5I_register(H5I_SPACE_SEL_ITER, sel_iter, TRUE)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, - "unable to register dataspace selection iterator atom") + "unable to register dataspace selection iterator ID") done: FUNC_LEAVE_API(ret_value) @@ -3056,14 +3056,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, - hsize_t *off, size_t *len) +H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq /*out*/, + size_t *nbytes /*out*/, hsize_t *off /*out*/, size_t *len /*out*/) { H5S_sel_iter_t *sel_iter; /* Dataspace selection iterator to operate on */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "izz*z*z*h*z", sel_iter_id, maxseq, maxbytes, nseq, nbytes, off, len); + H5TRACE7("e", "izzxxxx", sel_iter_id, maxseq, maxbytes, nseq, nbytes, off, len); /* Check args */ if (NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER))) diff --git a/src/H5T.c b/src/H5T.c index ce3fbd8..1a3d61f 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -325,7 +325,7 @@ /* Adjust information for this type */ \ H5_GLUE3(H5T_INIT_TYPE_, GUTS, _CORE) \ \ - /* Atomize result */ \ + /* Register result */ \ if ((GLOBAL = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") \ } @@ -802,7 +802,7 @@ H5T__init_package(void) FUNC_ENTER_NOAPI_NOINIT - /* Initialize the atom group for the file IDs */ + /* Initialize the ID group for the file IDs */ if (H5I_register_type(H5I_DATATYPE_CLS) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") @@ -1820,7 +1820,7 @@ done: * Errors: * ARGS BADVALUE Invalid size. * DATATYPE CANTINIT Can't create type. - * DATATYPE CANTREGISTER Can't register datatype atom. + * DATATYPE CANTREGISTER Can't register datatype ID. * * Programmer: Robb Matzke * Friday, December 5, 1997 @@ -1923,6 +1923,7 @@ H5Tcopy(hid_t obj_id) case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset") @@ -1941,7 +1942,7 @@ done: /* If we got a type ID from a passed-in dataset, we need to close that */ if (dset_tid != H5I_INVALID_HID) if (H5I_dec_app_ref(dset_tid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADATOM, FAIL, "problem freeing temporary dataset type ID") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADID, FAIL, "problem freeing temporary dataset type ID") /* Close the new datatype on errors */ if (H5I_INVALID_HID == ret_value) @@ -1954,12 +1955,12 @@ done: /*------------------------------------------------------------------------- * Function: H5Tclose * - * Purpose: Frees a datatype and all associated memory. + * Purpose: Frees a datatype and all associated memory. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 *------------------------------------------------------------------------- */ herr_t @@ -1979,7 +1980,7 @@ H5Tclose(hid_t type_id) /* When the reference count reaches zero the resources are freed */ if (H5I_dec_app_ref(type_id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "problem freeing id") done: FUNC_LEAVE_API(ret_value) @@ -2037,12 +2038,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * - * Robb Matzke, 1 Jun 1998 - * It is illegal to lock a named datatype since we must allow named - * types to be closed (to release file resources) but locking a type - * prevents that. *------------------------------------------------------------------------- */ herr_t @@ -2113,9 +2108,6 @@ done: * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * Broke out from H5Tget_class - QAK - 6/4/99 - * *------------------------------------------------------------------------- */ H5T_class_t @@ -2779,7 +2771,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c for (i = H5T_g.nsoft - 1; i >= 0; --i) { soft = H5T_g.soft + i; HDassert(soft); - if (name && *name && HDstrcmp(name, soft->name)) + if (name && *name && HDstrcmp(name, soft->name) != 0) continue; if (src && src->shared->type != soft->src) continue; @@ -2801,7 +2793,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c /* Not a match */ if (((H5T_PERS_SOFT == pers && path->is_hard) || (H5T_PERS_HARD == pers && !path->is_hard)) || - (name && *name && HDstrcmp(name, path->name)) || (src && H5T_cmp(src, path->src, FALSE)) || + (name && *name && HDstrcmp(name, path->name) != 0) || (src && H5T_cmp(src, path->src, FALSE)) || (dst && H5T_cmp(dst, path->dst, FALSE)) || (func && func != path->conv.u.app_func)) { /* * Notify all other functions to recalculate private data since some @@ -2910,14 +2902,14 @@ done: *------------------------------------------------------------------------- */ H5T_conv_t -H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata) +H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata /*out*/) { H5T_t * src, *dst; H5T_path_t *path; H5T_conv_t ret_value; /* Return value */ FUNC_ENTER_API(NULL) - H5TRACE3("TC", "ii**!", src_id, dst_id, pcdata); + H5TRACE3("TC", "iix", src_id, dst_id, pcdata); /* Check args */ if (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || @@ -3006,7 +2998,7 @@ herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background, hid_t dxpl_id) { H5T_path_t *tpath; /* type conversion info */ - H5T_t * src, *dst; /* unatomized types */ + H5T_t * src, *dst; /* unregistered types */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -3134,10 +3126,6 @@ done: * Programmer: Raymond Lu * July 14, 2004 * - * Modification:Raymond Lu - * 17 February 2011 - * I changed the value for the APP_REF parameter of H5I_register - * from FALSE to TRUE. *------------------------------------------------------------------------- */ hid_t @@ -3297,10 +3285,6 @@ done: * Programmer: Robb Matzke * Friday, December 5, 1997 * - * Modifications: - * Raymond Lu - * 19 May 2011 - * We support fixed size or variable-length string now. *------------------------------------------------------------------------- */ H5T_t * @@ -3422,8 +3406,8 @@ done: * Note: Common code for both H5T_copy and H5T_copy_reopen, as part of * the const-correct datatype copying routines. * - * Programmer: David Young - * January 18, 2020 + * Programmer: David Young + * January 18, 2020 * *------------------------------------------------------------------------- */ @@ -3470,8 +3454,8 @@ done: * Return: Success: Pointer to a new copy of the OLD_DT argument. * Failure: NULL * - * Programmer: David Young - * January 18, 2020 + * Programmer: David Young + * January 18, 2020 * *------------------------------------------------------------------------- */ @@ -3498,8 +3482,8 @@ done: * Return: Success: Pointer to a new copy of the OLD_DT argument. * Failure: NULL * - * Programmer: David Young - * January 18, 2020 + * Programmer: David Young + * January 18, 2020 * *------------------------------------------------------------------------- */ @@ -3529,8 +3513,8 @@ done: * * Note: Common code for both H5T_copy and H5T_copy_reopen. * - * Programmer: David Young - * January 18, 2020 + * Programmer: David Young + * January 18, 2020 * *------------------------------------------------------------------------- */ @@ -3800,8 +3784,8 @@ done: * Return: Success: Pointer to a new copy of the OLD_DT argument. * Failure: NULL * - * Programmer: David Young - * January 18, 2020 + * Programmer: David Young + * January 18, 2020 * *------------------------------------------------------------------------- */ diff --git a/src/H5Toh.c b/src/H5Toh.c index de011e4..8d1ac63 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -209,7 +209,7 @@ H5O__dtype_get_oloc(hid_t obj_id) /* Get the datatype */ if (NULL == (dt = (H5T_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID") /* If this is a named datatype, get the VOL driver pointer to the datatype */ type = (H5T_t *)H5T_get_actual_type(dt); diff --git a/src/H5VLint.c b/src/H5VLint.c index 289dfef..804031e 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -453,7 +453,7 @@ H5VL__set_def_conn(void) /* Get default file access pclass */ if (NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default file access property class ID") + HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default file access property class ID") /* Change the default VOL for the default file access pclass */ if (H5P_reset_vol_class(def_fapclass, &H5VL_def_conn_s) < 0) @@ -462,7 +462,7 @@ H5VL__set_def_conn(void) /* Get default file access plist */ if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default fapl ID") + HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default fapl ID") /* Change the default VOL for the default FAPL */ if (H5P_set_vol(def_fapl, H5VL_def_conn_s.connector_id, H5VL_def_conn_s.connector_info) < 0) diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 8a8bfc2..55cd1db 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -847,11 +847,11 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U if ((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { /* Get the file ID corresponding to the H5F_t struct */ if (H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "invalid ID") /* Get the number of references outstanding for this file ID */ if ((nref = H5I_get_ref(file_id, FALSE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "can't get ID ref count") if (nref == 1) if (H5F__flush(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") diff --git a/src/H5Z.c b/src/H5Z.c index fc7b113..cf397d2 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -334,8 +334,8 @@ done: * * Purpose: This function unregisters a filter. * - * Return: SUCCEED/FAIL - * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -452,7 +452,7 @@ H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id) /* Get the plist structure of object creation */ if (NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_PLINE, H5E_BADID, FAIL, "can't find object for ID") /* Check if the object creation property list uses the filter */ if ((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0) @@ -840,7 +840,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get ID for dataspace to pass to filter routines */ if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { (void)H5S_close(space); - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* Make the callbacks */ diff --git a/src/H5Znbit.c b/src/H5Znbit.c index aa7f507..cb94945 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -119,8 +119,6 @@ H5Z_class2_t H5Z_NBIT[1] = {{ * Programmer: Xiaowen Wu * Tuesday, December 21, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -157,8 +155,6 @@ done: * Programmer: Xiaowen Wu * Thursday, March 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -181,8 +177,6 @@ H5Z_calc_parms_nooptype(size_t *cd_values_actual_nparms) * Programmer: Xiaowen Wu * Saturday, January 29, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -217,8 +211,6 @@ H5Z_calc_parms_atomic(size_t *cd_values_actual_nparms) * Programmer: Xiaowen Wu * Wednesday, January 19, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -301,8 +293,6 @@ done: * Programmer: Xiaowen Wu * Wednesday, January 19, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -407,8 +397,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -446,8 +434,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, January 11, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -539,8 +525,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -644,8 +628,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -792,8 +774,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, January 11, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -873,7 +853,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get the filter's current parameters */ if (H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_NBIT, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 6577f73..281bb7f 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -748,8 +748,6 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ * Programmer: Xiaowen Wu * Friday, February 4, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -802,8 +800,6 @@ done: * Programmer: Xiaowen Wu * Wednesday, April 13, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static enum H5Z_scaleoffset_t @@ -931,8 +927,6 @@ H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum * Programmer: Xiaowen Wu * Friday, February 4, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -957,7 +951,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index 619fe2f..5786b5f 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -53,8 +53,6 @@ const H5Z_class2_t H5Z_SHUFFLE[1] = {{ * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -71,7 +69,7 @@ H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_i /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get datatype */ if (NULL == (type = (const H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -111,10 +109,6 @@ done: * Programmer: Kent Yang * Wednesday, November 13, 2002 * - * Modifications: - * Quincey Koziol, November 13, 2002 - * Cleaned up code. - * *------------------------------------------------------------------------- */ static size_t @@ -183,24 +177,31 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], case 0: do { DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS @@ -247,24 +248,31 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], case 0: do { DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + /* FALLTHROUGH */ H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 031487e..a2da0c4 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -115,14 +115,6 @@ done: * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: Used new logic to set the size of the scanline parameter. - * Now SZIP compression can be applied to the chunk - * of any shape and size with only one restriction: the number - * of elements in the chunk has to be not less than number - * of elements (pixels) in the block (cd_values[H5Z_SZIP_PARM_PPB] - * parameter). - * Elena Pourmal, July 20, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -147,7 +139,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) diff --git a/src/H5err.txt b/src/H5err.txt index 24e9b2a..63d6702 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -50,7 +50,7 @@ MAJOR, H5E_LIB, General library infrastructure MAJOR, H5E_FILE, File accessibility MAJOR, H5E_IO, Low-level I/O MAJOR, H5E_FUNC, Function entry/exit -MAJOR, H5E_ATOM, Object atom +MAJOR, H5E_ID, Object ID MAJOR, H5E_CACHE, Object cache MAJOR, H5E_LINK, Links MAJOR, H5E_BTREE, B-Tree node @@ -88,7 +88,7 @@ SECTION, RESOURCE, Resource errors SECTION, FILEACC, File accessibility errors SECTION, FILE, Generic low-level file I/O errors SECTION, FUNC, Function entry/exit interface errors -SECTION, ATOM, Object atom related errors +SECTION, ID, Object ID related errors SECTION, CACHE, Cache related errors SECTION, LINK, Link related errors SECTION, BTREE, B-tree related errors @@ -154,13 +154,13 @@ MINOR, FUNC, H5E_CANTINIT, Unable to initialize object MINOR, FUNC, H5E_ALREADYINIT, Object already initialized MINOR, FUNC, H5E_CANTRELEASE, Unable to release object -# Object atom related errors -MINOR, ATOM, H5E_BADATOM, Unable to find atom information (already closed?) -MINOR, ATOM, H5E_BADGROUP, Unable to find ID group information -MINOR, ATOM, H5E_CANTREGISTER, Unable to register new atom -MINOR, ATOM, H5E_CANTINC, Unable to increment reference count -MINOR, ATOM, H5E_CANTDEC, Unable to decrement reference count -MINOR, ATOM, H5E_NOIDS, Out of IDs for group +# Object ID related errors +MINOR, ID, H5E_BADID, Unable to find ID information (already closed?) +MINOR, ID, H5E_BADGROUP, Unable to find ID group information +MINOR, ID, H5E_CANTREGISTER, Unable to register new ID +MINOR, ID, H5E_CANTINC, Unable to increment reference count +MINOR, ID, H5E_CANTDEC, Unable to decrement reference count +MINOR, ID, H5E_NOIDS, Out of IDs for group # Cache related errors MINOR, CACHE, H5E_CANTFLUSH, Unable to flush data from cache diff --git a/src/Makefile.am b/src/Makefile.am index fc9cbe2..19d358d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -79,7 +79,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c H5HGtrap.c \ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \ H5HP.c \ - H5I.c H5Itest.c \ + H5I.c H5Idbg.c H5Iint.c H5Itest.c \ H5L.c H5Ldeprec.c H5Lexternal.c \ H5M.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ diff --git a/test/tid.c b/test/tid.c index 0c7c4ab..62ad7ea 100644 --- a/test/tid.c +++ b/test/tid.c @@ -569,197 +569,301 @@ out: /* There was a rare bug where, if an id free callback being called by * H5I_clear_type() removed another id in that type, a segfault could occur. * This test tests for that error (and freeing ids "out of order" within - * H5Iclear_type() in general). */ + * H5Iclear_type() in general). + * + * NB: RCT = "remove clear type" + */ + /* Macro definitions */ -#define TEST_RCT_MAX_NOBJS 25 -#define TEST_RCT_MIN_NOBJS 5 -#define TEST_RCT_NITER 50 +#define RCT_MAX_NOBJS 25 /* Maximum number of objects in the list */ +#define RCT_MIN_NOBJS 5 +#define RCT_NITER 50 /* Number of times we cycle through object creation and deletion */ + +/* Structure to hold the master list of objects */ +typedef struct rct_obj_list_t { + + /* Pointer to the objects */ + struct rct_obj_t *objects; + + /* The number of objects in the list */ + long count; -/* Structure to hold the list of objects */ -typedef struct { - struct test_rct_obj_t *list; /* List of objects */ - long nobjs; /* Number of objects in list */ - long nobjs_rem; /* Number of objects in list that have not been freed */ -} test_rct_list_t; + /* The number of objects in the list that have not been freed */ + long remaining; +} rct_obj_list_t; /* Structure for an object */ -typedef struct test_rct_obj_t { - hid_t id; /* ID for this object */ - int nfrees; /* Number of times this object has been freed */ - hbool_t freeing; /* Whether we are currently freeing this object directly (through H5Idec_ref()) */ - test_rct_list_t *obj_list; /* List of all objects */ -} test_rct_obj_t; - -/* Free callback */ +typedef struct rct_obj_t { + /* The ID for this object */ + hid_t id; + + /* The number of times this object has been freed */ + int nfrees; + + /* Whether we are currently freeing this object directly + * through H5Idec_ref(). + */ + hbool_t freeing; + + /* Pointer to the master list of all objects */ + rct_obj_list_t *list; +} rct_obj_t; + +/* Free callback passed to H5Iclear_type() + * + * When invoked on a closing object, frees a random unfreed ID in the + * master list of objects. + */ static herr_t -test_rct_free(void *_obj) +rct_free_cb(void *_obj, void H5_ATTR_UNUSED **_ctx) { - test_rct_obj_t *obj = (test_rct_obj_t *)_obj; - long rem_idx, i; - herr_t ret; /* return value */ + rct_obj_t *obj = (rct_obj_t *)_obj; + long remove_nth; + long i; + herr_t ret; /* Mark this object as freed */ obj->nfrees++; - obj->obj_list->nobjs_rem--; - - /* Check freeing and nobjs_rem */ - if (!obj->freeing && (obj->obj_list->nobjs_rem > 0)) { - /* Remove a random object from the list */ - rem_idx = HDrandom() % obj->obj_list->nobjs_rem; - - /* Scan the list, finding the rem_idx'th object that has not been - * freed */ - for (i = 0; i < obj->obj_list->nobjs; i++) - if (obj->obj_list->list[i].nfrees == 0) { - if (rem_idx == 0) + + /* Decrement the number of objects in the list that have not been freed */ + obj->list->remaining--; + + /* If this object isn't already being freed by a callback free call and + * the master object list still contains objects to free, pick another + * object and free it. + */ + if (!obj->freeing && (obj->list->remaining > 0)) { + + /* Pick a random object from the list. This is done by picking a + * random number between 0 and the # of remaining unfreed objects + * and then scanning through the list to find that nth unfreed + * object. + */ + remove_nth = HDrandom() % obj->list->remaining; + for (i = 0; i < obj->list->count; i++) + if (obj->list->objects[i].nfrees == 0) { + if (remove_nth == 0) break; else - rem_idx--; - } /* end if */ - if (i == obj->obj_list->nobjs) { + remove_nth--; + } + + /* Badness if we scanned through the list and didn't manage to + * select one to delete (the list stats were probably updated + * incorrectly). + */ + if (i == obj->list->count) { ERROR("invalid obj_list"); - goto out; - } /* end if */ - else { - /* Remove the object. Mark as "freeing" so its own callback does - * not free another object. */ - obj->obj_list->list[i].freeing = TRUE; - ret = H5Idec_ref(obj->obj_list->list[i].id); - CHECK(ret, FAIL, "H5Idec_ref"); - if (ret == FAIL) - goto out; - obj->obj_list->list[i].freeing = FALSE; - } /* end else */ - } /* end if */ - - /* Verify nobjs_rem is non-negative */ - if (obj->obj_list->nobjs_rem < 0) { - ERROR("invalid nobjs_rem"); - goto out; - } /* end if */ + goto error; + } + + /* Mark the object we're about to free so its own callback does + * not free another object. We don't want to recursively free the + * entire list when we free the first ID. + */ + obj->list->objects[i].freeing = TRUE; + + /* Decrement the reference count on the object */ + ret = H5Idec_ref(obj->list->objects[i].id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (ret == FAIL) + goto error; + + /* Unset the "freeing" flag */ + obj->list->objects[i].freeing = FALSE; + } + + /* Verify the number of objects remaining in the master list is non-negative */ + if (obj->list->remaining < 0) { + ERROR("invalid number of objects remaining"); + goto error; + } return 0; -out: +error: return -1; -} /* end test_rct_free() */ +} /* end rct_free_cb() */ /* Test function */ static int test_remove_clear_type(void) { - H5I_type_t obj_type; - test_rct_list_t obj_list; - test_rct_obj_t list[TEST_RCT_MAX_NOBJS]; - long i, j; - long nobjs_found; - hsize_t nmembers; - herr_t ret; /* return value */ - - /* Register type */ - obj_type = H5Iregister_type((size_t)8, 0, test_rct_free); + H5I_type_t obj_type; + rct_obj_list_t obj_list; + rct_obj_t * objects = NULL; /* Convenience pointer to objects stored in master list */ + size_t list_size; + long i, j; + herr_t ret; /* return value */ + + /* Register a user-defined type with our custom ID-deleting callback */ + obj_type = H5Iregister_type((size_t)8, 0, rct_free_cb); CHECK(obj_type, H5I_BADID, "H5Iregister_type"); if (obj_type == H5I_BADID) - goto out; + goto error; + + /* Create an array to hold the objects in the master list */ + list_size = RCT_MAX_NOBJS * sizeof(rct_obj_t); + obj_list.objects = HDmalloc(list_size); + CHECK_PTR(obj_list.objects, "HDcalloc"); + if (NULL == obj_list.objects) + goto error; + + /* Set a convenience pointer to the object array */ + objects = obj_list.objects; + + for (i = 0; i < RCT_NITER; i++) { + + /* The number of members in the type, according to the HDF5 library */ + hsize_t nmembers = 1234567; + + /* The number of objects found while scanning through the object list */ + int found; + + /********************* + * Build object list * + *********************/ + + HDmemset(obj_list.objects, 0, list_size); - /* Init obj_list.list */ - obj_list.list = list; - - for (i = 0; i < TEST_RCT_NITER; i++) { - /* Build object list */ - obj_list.nobjs = obj_list.nobjs_rem = - TEST_RCT_MIN_NOBJS + (HDrandom() % (long)(TEST_RCT_MAX_NOBJS - TEST_RCT_MIN_NOBJS + 1)); - for (j = 0; j < obj_list.nobjs; j++) { - list[j].nfrees = 0; - list[j].freeing = FALSE; - list[j].obj_list = &obj_list; - list[j].id = H5Iregister(obj_type, &list[j]); - CHECK(list[j].id, FAIL, "H5Iregister"); - if (list[j].id == FAIL) - goto out; + /* The number of objects used is a random number between the min and max */ + obj_list.count = obj_list.remaining = + RCT_MIN_NOBJS + (HDrandom() % (long)(RCT_MAX_NOBJS - RCT_MIN_NOBJS + 1)); + + /* Create the actual objects */ + for (j = 0; j < obj_list.count; j++) { + + /* Object setup */ + objects[j].nfrees = 0; + objects[j].freeing = FALSE; + objects[j].list = &obj_list; + + /* Register an ID for it */ + objects[j].id = H5Iregister(obj_type, &objects[j]); + CHECK(objects[j].id, FAIL, "H5Iregister"); + if (objects[j].id == FAIL) + goto error; + + /* Bump the reference count by 1 (to 2) 50% of the time */ if (HDrandom() % 2) { - ret = H5Iinc_ref(list[j].id); + ret = H5Iinc_ref(objects[j].id); CHECK(ret, FAIL, "H5Iinc_ref"); if (ret == FAIL) - goto out; - } /* end if */ - } /* end for */ + goto error; + } + } - /* Clear the type */ + /****************************************** + * Clear the type with force set to FALSE * + ******************************************/ + + /* Clear the type. Since force is FALSE, only + * IDs with a reference count of 1 will be cleared. + */ ret = H5Iclear_type(obj_type, FALSE); CHECK(ret, FAIL, "H5Iclear_type"); if (ret == FAIL) - goto out; - - /* Verify list */ - nobjs_found = 0; - for (j = 0; j < obj_list.nobjs; j++) { - if (list[j].nfrees == 0) - nobjs_found++; + goto error; + + /* Verify that the object struct fields are sane and count the + * number of unfreed objects + */ + found = 0; + for (j = 0; j < obj_list.count; j++) { + + if (objects[j].nfrees == 0) { + /* Count unfreed objects */ + found++; + } else { - VERIFY(list[j].nfrees, (long)1, "list[j].nfrees"); - if (list[j].nfrees != (long)1) - goto out; - } /* end else */ - VERIFY(list[j].freeing, FALSE, "list[j].freeing"); - if (list[j].freeing != FALSE) - goto out; - } /* end for */ - - /* Verify number of objects */ - VERIFY(obj_list.nobjs_rem, nobjs_found, "obj_list.nobjs_rem"); - if (obj_list.nobjs_rem != nobjs_found) - goto out; + /* Every freed object should have been freed exactly once */ + VERIFY(objects[j].nfrees, 1, "object freed more than once"); + if (objects[j].nfrees != 1) + goto error; + } + + /* No object should still be marked as "freeing" */ + VERIFY(objects[j].freeing, FALSE, "object marked as freeing"); + if (objects[j].freeing != FALSE) + goto error; + } + + /* Verify the number of unfreed objects we found during our scan + * matches the number stored in the list + */ + VERIFY(obj_list.remaining, found, "incorrect number of objects remaining"); + if (obj_list.remaining != found) + goto error; + + /* Make sure the HDF5 library confirms our count */ ret = H5Inmembers(obj_type, &nmembers); CHECK(ret, FAIL, "H5Inmembers"); if (ret == FAIL) - goto out; - VERIFY(nmembers, (size_t)nobjs_found, "H5Inmembers"); - if (nmembers != (size_t)nobjs_found) - goto out; + goto error; + VERIFY(nmembers, found, "The number of members remaining in the type did not match our count"); + if (nmembers != found) + goto error; - /* Clear the type with force set to TRUE */ + /***************************************** + * Clear the type with force set to TRUE * + *****************************************/ + + /* Clear the type. Since force is TRUE, all IDs will be cleared. */ ret = H5Iclear_type(obj_type, TRUE); CHECK(ret, FAIL, "H5Iclear_type"); if (ret == FAIL) - goto out; + goto error; - /* Verify list */ - for (j = 0; j < obj_list.nobjs; j++) { - VERIFY(list[j].nfrees, (long)1, "list[j].nfrees"); - if (list[j].nfrees != (long)1) - goto out; - VERIFY(list[j].freeing, FALSE, "list[j].freeing"); - if (list[j].freeing != FALSE) - goto out; - } /* end for */ - - /* Verify number of objects is 0 */ - VERIFY(obj_list.nobjs_rem, (long)0, "obj_list.nobjs_rem"); - if (obj_list.nobjs_rem != (long)0) - goto out; + /* Verify that the object struct fields are sane */ + for (j = 0; j < obj_list.count; j++) { + + /* Every object should have been freed exactly once */ + VERIFY(objects[j].nfrees, 1, "object freed more than once"); + if (objects[j].nfrees != 1) + goto error; + + /* No object should still be marked as "freeing" */ + VERIFY(objects[j].freeing, FALSE, "object marked as freeing"); + if (objects[j].freeing != FALSE) + goto error; + } + + /* Verify the number of objects is 0 */ + VERIFY(obj_list.remaining, 0, "objects remaining was not zero"); + if (obj_list.remaining != 0) + goto error; + + /* Make sure the HDF5 library confirms zero members in the type */ ret = H5Inmembers(obj_type, &nmembers); CHECK(ret, FAIL, "H5Inmembers"); if (ret == FAIL) - goto out; - VERIFY(nmembers, (size_t)0, "H5Inmembers"); - if (nmembers != (size_t)0) - goto out; - } /* end for */ + goto error; + VERIFY(nmembers, 0, "The number of members remaining in the type was not zero"); + if (nmembers != 0) + goto error; + } - /* Destroy type */ + /* Destroy the type */ ret = H5Idestroy_type(obj_type); CHECK(ret, FAIL, "H5Idestroy_type"); if (ret == FAIL) - goto out; + goto error; + + /* Free the object array */ + HDfree(obj_list.objects); return 0; -out: - /* Cleanup. For simplicity, just destroy the types and ignore errors. */ +error: + /* Cleanup. For simplicity, just destroy the types and ignore errors. */ H5E_BEGIN_TRY - H5Idestroy_type(obj_type); + { + H5Idestroy_type(obj_type); + } H5E_END_TRY + + HDfree(obj_list.objects); + return -1; } /* end test_remove_clear_type() */ diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 84140f2..2269c97 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 84140f2..2269c97 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 84140f2..2269c97 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 84140f2..2269c97 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 3f77f38..5ca94a8 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file @@ -62,7 +62,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index 8245291..92bad14 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -71,7 +71,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #004: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #005: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -92,7 +92,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #011: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #012: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -113,7 +113,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #018: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #019: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -134,7 +134,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #025: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #026: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -168,7 +168,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #004: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #005: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -189,7 +189,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #011: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #012: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -210,7 +210,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #018: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #019: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -231,7 +231,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #025: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #026: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index 8245291..92bad14 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -71,7 +71,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #004: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #005: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -92,7 +92,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #011: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #012: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -113,7 +113,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #018: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #019: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -134,7 +134,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #025: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #026: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -168,7 +168,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #004: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #005: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -189,7 +189,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #011: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #012: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -210,7 +210,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #018: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #019: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object @@ -231,7 +231,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #025: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #026: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index caeef27..1fbd47e 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index caeef27..1fbd47e 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -28,7 +28,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Link traversal failure #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table - minor: Unable to find atom information (already closed?) + minor: Unable to find ID information (already closed?) #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file -- cgit v0.12