summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c++/src/H5IdComponent.cpp2
-rw-r--r--c++/src/H5PropList.cpp18
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java3
-rw-r--r--java/src/jni/h5Constants.c2
-rw-r--r--src/H5.c1
-rw-r--r--src/H5Adeprec.c1
-rw-r--r--src/H5F.c1
-rw-r--r--src/H5Fint.c1
-rw-r--r--src/H5Gloc.c3
-rw-r--r--src/H5Gname.c1
-rw-r--r--src/H5Gtest.c1
-rw-r--r--src/H5I.c4
-rw-r--r--src/H5Ipublic.h3
-rw-r--r--src/H5O.c2
-rw-r--r--src/H5Oflush.c1
-rw-r--r--src/H5R.c76
-rw-r--r--src/H5T.c1
-rw-r--r--src/H5private.h1
-rw-r--r--src/H5trace.c8
-rw-r--r--test/links.c2
-rw-r--r--test/tfile.c1
-rw-r--r--test/tmisc.c29
22 files changed, 157 insertions, 5 deletions
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 457f594..284c6c5 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -174,6 +174,7 @@ H5I_type_t IdComponent::getHDFObjType() const
/// \li \c H5I_DATASPACE
/// \li \c H5I_DATASET
/// \li \c H5I_ATTR
+/// \li \c H5I_REFERENCE (DEPRECATED)
/// \li \c H5I_VFL
/// \li \c H5I_GENPROP_CLS
/// \li \c H5I_GENPROP_LST
@@ -226,6 +227,7 @@ bool IdComponent::isValid(hid_t an_id)
/// \li \c H5I_DATASPACE
/// \li \c H5I_DATASET
/// \li \c H5I_ATTR
+/// \li \c H5I_REFERENCE (DEPRECATED)
/// \li \c H5I_VFL
/// \li \c H5I_GENPROP_CLS
/// \li \c H5I_GENPROP_LST
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index dd7b21a..16a6316 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -138,6 +138,24 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
throw PropListIException("PropList constructor", "H5Pcopy failed");
}
break;
+ /* These should really be error cases, but changing that breaks
+ * the stated behavior and causes test failures.
+ * (DER, July 2017)
+ */
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_GROUP:
+ case H5I_DATATYPE:
+ case H5I_DATASPACE:
+ case H5I_DATASET:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
+ case H5I_UNINIT:
default:
id = H5P_DEFAULT;
break;
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index b216d03..8a3d6c8 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -309,6 +309,7 @@ public class HDF5Constants {
public static final int H5I_GROUP = H5I_GROUP();
public static final int H5I_INVALID_HID = H5I_INVALID_HID();
public static final int H5I_NTYPES = H5I_NTYPES();
+ public static final int H5I_REFERENCE = H5I_REFERENCE();
public static final int H5I_UNINIT = H5I_UNINIT();
public static final int H5I_VFL = H5I_VFL();
@@ -1195,6 +1196,8 @@ public class HDF5Constants {
private static native final int H5I_NTYPES();
+ private static native final int H5I_REFERENCE();
+
private static native final int H5I_UNINIT();
private static native final int H5I_VFL();
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index 1b97655..d4511e1 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -590,6 +590,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls) { return H5
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls) { return H5I_ATTR; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return H5I_REFERENCE; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; }
diff --git a/src/H5.c b/src/H5.c
index f7826d4..59984dc 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -306,6 +306,7 @@ H5_term_library(void)
pending += DOWN(A_top);
pending += DOWN(D_top);
pending += DOWN(G_top);
+ pending += DOWN(R_top);
pending += DOWN(S_top);
pending += DOWN(T_top);
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index c37dc3c..9221254 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -318,6 +318,7 @@ H5Aget_num_attrs(hid_t loc_id)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5F.c b/src/H5F.c
index 8131f53..78fce2a 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -679,6 +679,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
case H5I_UNINIT:
case H5I_BADID:
case H5I_DATASPACE:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 512439f..e52d539 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -452,6 +452,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_BADID:
case H5I_FILE:
case H5I_DATASPACE:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 8548b92..c011cdf 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -240,6 +240,9 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc)
} /* end case */
break;
+ case H5I_REFERENCE:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_VFL:
diff --git a/src/H5Gname.c b/src/H5Gname.c
index a90821c..7b53668 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -835,6 +835,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 8a7f8c4..7271cdc 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -553,6 +553,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5I.c b/src/H5I.c
index 42edf58..b8e47a2 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -451,9 +451,9 @@ H5I_nmembers(H5I_type_t type)
FUNC_ENTER_NOAPI(FAIL)
if(type <= H5I_BADID || type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+ 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);
+ HGOTO_DONE(0);
/* Set return value */
H5_CHECKED_ASSIGN(ret_value, int64_t, type_ptr->id_count, uint64_t);
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 3ac2257..c737bbe 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -30,6 +30,8 @@
* 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.
*
+ * NOTE: H5I_REFERENCE is not used by the library and has been deprecated
+ * with a tentative removal version of 1.12.0. (DER, July 2017)
*/
typedef enum H5I_type_t {
H5I_UNINIT = (-2), /* uninitialized type */
@@ -40,6 +42,7 @@ typedef enum H5I_type_t {
H5I_DATASPACE, /* type ID for Dataspace objects */
H5I_DATASET, /* type ID for Dataset objects */
H5I_ATTR, /* type ID for Attribute objects */
+ H5I_REFERENCE, /* *DEPRECATED* type ID for Reference objects */
H5I_VFL, /* type ID for virtual file layer */
H5I_GENPROP_CLS, /* type ID for generic property list classes */
H5I_GENPROP_LST, /* type ID for generic property lists */
diff --git a/src/H5O.c b/src/H5O.c
index 79aaddf..152e6cc 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1081,6 +1081,7 @@ H5Oclose(hid_t object_id)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
@@ -2627,6 +2628,7 @@ H5O_get_loc(hid_t object_id)
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index 387e0ff..9764f56 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -396,6 +396,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id, hbool_
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5R.c b/src/H5R.c
index dc012e8..c2a10ce 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -71,6 +71,17 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Local Variables */
/*******************/
+/* Reference ID class */
+static const H5I_class_t H5I_REFERENCE_CLS[1] = {{
+ H5I_REFERENCE, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ NULL /* Callback routine for closing objects of this class */
+}};
+
+/* Flag indicating "top" of interface has been initialized */
+static hbool_t H5R_top_package_initialize_s = FALSE;
+
/*--------------------------------------------------------------------------
@@ -92,6 +103,13 @@ H5R__init_package(void)
FUNC_ENTER_NOAPI_NOINIT
+/* Initialize the atom group for the file IDs */
+ if(H5I_register_type(H5I_REFERENCE_CLS) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface")
+
+ /* Mark "top" of interface as initialized, too */
+ H5R_top_package_initialize_s = TRUE;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__init_package() */
@@ -99,6 +117,46 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5R_top_term_package
+ PURPOSE
+ Terminate various H5R objects
+ USAGE
+ void H5R_top_term_package()
+ RETURNS
+ void
+ DESCRIPTION
+ Release IDs for the atom group, deferring full interface shutdown
+ until later (in H5R_term_package).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Can't report errors...
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int
+H5R_top_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(H5R_top_package_initialize_s) {
+ if(H5I_nmembers(H5I_REFERENCE) > 0) {
+ (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE);
+ n++; /*H5I*/
+ } /* end if */
+
+ /* Mark closed */
+ if(0 == n)
+ H5R_top_package_initialize_s = FALSE;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(n)
+} /* end H5R__init_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5R_term_package
PURPOSE
Terminate various H5R objects
@@ -120,12 +178,24 @@ done:
int
H5R_term_package(void)
{
+ int n = 0;
+
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR)
- H5_PKG_INIT_VAR = FALSE;
+ if(H5_PKG_INIT_VAR) {
+ /* Sanity checks */
+ HDassert(0 == H5I_nmembers(H5I_REFERENCE));
+ HDassert(FALSE == H5R_top_package_initialize_s);
+
+ /* Destroy the reference id group */
+ n += (H5I_dec_type_ref(H5I_REFERENCE) > 0);
+
+ /* Mark closed */
+ if(0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ }
- FUNC_LEAVE_NOAPI(0)
+ FUNC_LEAVE_NOAPI(n)
} /* end H5R_term_package() */
diff --git a/src/H5T.c b/src/H5T.c
index 2f59767..a525cd5 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1673,6 +1673,7 @@ H5Tcopy(hid_t type_id)
case H5I_GROUP:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/src/H5private.h b/src/H5private.h
index ff45cec..ca4ebcf 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -2593,6 +2593,7 @@ H5_DLL int H5L_term_package(void);
H5_DLL int H5P_term_package(void);
H5_DLL int H5PL_term_package(void);
H5_DLL int H5R_term_package(void);
+H5_DLL int H5R_top_term_package(void);
H5_DLL int H5S_term_package(void);
H5_DLL int H5S_top_term_package(void);
H5_DLL int H5SL_term_package(void);
diff --git a/src/H5trace.c b/src/H5trace.c
index e2a746b..9fb8a72 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1320,6 +1320,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "%ld (attr)", (long)obj);
break;
+ case H5I_REFERENCE:
+ fprintf(out, "%ld (reference)", (long)obj);
+ break;
+
case H5I_VFL:
fprintf(out, "%ld (file driver)", (long)obj);
break;
@@ -1497,6 +1501,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "H5I_ATTR");
break;
+ case H5I_REFERENCE:
+ fprintf(out, "H5I_REFERENCE");
+ break;
+
case H5I_VFL:
fprintf(out, "H5I_VFL");
break;
diff --git a/test/links.c b/test/links.c
index 2d9bb0d..7b3e37d 100644
--- a/test/links.c
+++ b/test/links.c
@@ -7743,6 +7743,7 @@ done:
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
@@ -7829,6 +7830,7 @@ done:
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/test/tfile.c b/test/tfile.c
index 20b41e0..533bb24 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1393,6 +1393,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
case H5I_DATATYPE:
case H5I_DATASPACE:
case H5I_ATTR:
+ case H5I_REFERENCE:
case H5I_VFL:
case H5I_GENPROP_CLS:
case H5I_GENPROP_LST:
diff --git a/test/tmisc.c b/test/tmisc.c
index bec80b2..22ae558 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -30,6 +30,7 @@
#include "testhdf5.h"
#include "H5srcdir.h"
#include "H5Dpkg.h" /* Datasets */
+#include "H5Iprivate.h" /* IDs, can be removed when H5I_REFERENCE is gone */
/* Definitions for misc. test #1 */
#define MISC1_FILE "tmisc1.h5"
@@ -3447,6 +3448,34 @@ test_misc19(void)
HDfree(vfd_cls);
+/* Check H5I operations on references */
+
+ /* Reference IDs are not used by the library so there's no
+ * way of testing if incr/decr, etc. work. Instead, just
+ * do a quick smoke check to ensure that a couple of basic
+ * calls return sane values.
+ *
+ * H5I_REFERENCE has been declared deprecated with a tentative
+ * removal version of HDF5 1.12.0.
+ *
+ * Delete this entire block when H5I_REFERENCE no longer exists.
+ *
+ * The H5Iprivate.h header was included to support H5I_nmembers()
+ * so that can also probably be removed as well.
+ */
+{
+ htri_t tf; /* Boolean generic return */
+ int64_t num_members; /* Number of members in type */
+
+ tf = H5Itype_exists(H5I_REFERENCE);
+ VERIFY(tf, TRUE, "H5Itype_exists");
+
+ num_members = 999;
+ num_members = H5I_nmembers(H5I_REFERENCE);
+ VERIFY(num_members, 0, "H5Inmembers");
+
+} /* end block */
+
} /* end test_misc19() */
/****************************************************************