summaryrefslogtreecommitdiffstats
path: root/src/H5Oint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Oint.c')
-rw-r--r--src/H5Oint.c1047
1 files changed, 599 insertions, 448 deletions
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 44809e1..ecf347c 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -38,10 +38,9 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MFprivate.h" /* File memory management */
-#ifdef H5O_ENABLE_BOGUS
#include "H5MMprivate.h" /* Memory management */
-#endif /* H5O_ENABLE_BOGUS */
#include "H5Opkg.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -56,7 +55,7 @@
/* User data for recursive traversal over objects from a group */
typedef struct {
hid_t obj_id; /* The ID for the starting group */
- H5G_loc_t *start_loc; /* Location of starting group */
+ H5G_loc_t *start_loc; /* Location of starting group */
H5SL_t *visited; /* Skip list for tracking visited nodes */
H5O_iterate_t op; /* Application callback */
void *op_data; /* Application's op data */
@@ -82,7 +81,6 @@ static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info_t *lin
void *_udata);
static const H5O_obj_class_t *H5O__obj_class_real(const H5O_t *oh);
-
/*********************/
/* Package Variables */
/*********************/
@@ -96,47 +94,44 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
* message.
*/
const H5O_msg_class_t *const H5O_msg_class_g[] = {
- H5O_MSG_NULL, /*0x0000 Null */
- H5O_MSG_SDSPACE, /*0x0001 Dataspace */
- H5O_MSG_LINFO, /*0x0002 Link information */
- H5O_MSG_DTYPE, /*0x0003 Datatype */
- H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
- H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */
- H5O_MSG_LINK, /*0x0006 Link */
- H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
- H5O_MSG_LAYOUT, /*0x0008 Data Layout */
+ H5O_MSG_NULL, /*0x0000 Null */
+ H5O_MSG_SDSPACE, /*0x0001 Dataspace */
+ H5O_MSG_LINFO, /*0x0002 Link information */
+ H5O_MSG_DTYPE, /*0x0003 Datatype */
+ H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
+ H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */
+ H5O_MSG_LINK, /*0x0006 Link */
+ H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
+ H5O_MSG_LAYOUT, /*0x0008 Data Layout */
#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */
+ H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */
#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x0009 "Bogus valid" (for testing) */
+ NULL, /*0x0009 "Bogus valid" (for testing) */
#endif /* H5O_ENABLE_BOGUS */
- H5O_MSG_GINFO, /*0x000A Group information */
- H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
- H5O_MSG_ATTR, /*0x000C Attribute */
- H5O_MSG_NAME, /*0x000D Object name */
- H5O_MSG_MTIME, /*0x000E Object modification date and time */
- H5O_MSG_SHMESG, /*0x000F File-wide shared message table */
- H5O_MSG_CONT, /*0x0010 Object header continuation */
- H5O_MSG_STAB, /*0x0011 Symbol table */
- H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */
- H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */
- H5O_MSG_DRVINFO, /*0x0014 Driver info settings */
- H5O_MSG_AINFO, /*0x0015 Attribute information */
- H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
- H5O_MSG_FSINFO, /*0x0017 Free-space manager info */
+ H5O_MSG_GINFO, /*0x000A Group information */
+ H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
+ H5O_MSG_ATTR, /*0x000C Attribute */
+ H5O_MSG_NAME, /*0x000D Object name */
+ H5O_MSG_MTIME, /*0x000E Object modification date and time */
+ H5O_MSG_SHMESG, /*0x000F File-wide shared message table */
+ H5O_MSG_CONT, /*0x0010 Object header continuation */
+ H5O_MSG_STAB, /*0x0011 Symbol table */
+ H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */
+ H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */
+ H5O_MSG_DRVINFO, /*0x0014 Driver info settings */
+ H5O_MSG_AINFO, /*0x0015 Attribute information */
+ H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
+ H5O_MSG_FSINFO, /*0x0017 Free-space manager info */
H5O_MSG_MDCI, /*0x0018 Metadata cache image */
- H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */
-#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS_INVALID, /*0x001A "Bogus invalid" (for testing) */
-#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x001A "Bogus invalid" (for testing) */
-#endif /* H5O_ENABLE_BOGUS */
+ H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */
};
/* Format version bounds for object header */
const unsigned H5O_obj_ver_bounds[] = {
H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_VERSION_2, /* H5F_LIBVER_V110 */
+ H5O_VERSION_2, /* H5F_LIBVER_V112 */
H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -178,20 +173,20 @@ H5FL_EXTERN(H5_obj_t);
* datatype message is a datatype but only some of them are datasets.
*/
static const H5O_obj_class_t *const H5O_obj_class_g[] = {
- H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
- H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
- H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
+ H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
+ H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
+ H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
};
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__init_package
+ * Function: H5O__init_package
*
- * Purpose: Initialize information specific to H5O interface.
+ * Purpose: Initialize information specific to H5O interface.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, January 18, 2007
*
*-------------------------------------------------------------------------
@@ -210,7 +205,7 @@ H5O__init_package(void)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__init_package() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_set_version
*
@@ -257,118 +252,202 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_set_version() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_create
+ * Function: H5O_create
*
- * Purpose: Creates a new object header. Allocates space for it and
+ * Purpose: Creates a new object header. Allocates space for it and
* then calls an initialization function. The object header
* is opened for write access and should eventually be
* closed by calling H5O_close().
*
- * Return: Success: Non-negative, the ENT argument contains
- * information about the object header,
- * including its address.
+ * Return: Success: Non-negative, the ENT argument contains
+ * information about the object header,
+ * including its address.
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
+ * 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
-H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
- H5O_loc_t *loc/*out*/)
+H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc /*out*/)
{
- H5P_genplist_t *oc_plist; /* Object creation property list */
- H5O_t *oh = NULL; /* Object header created */
- haddr_t oh_addr; /* Address of initial object header */
- size_t oh_size; /* Size of initial object header */
- uint8_t oh_flags; /* Object header's initial status flags */
- unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting object header into cache */
- hbool_t store_msg_crt_idx; /* Whether to always store message creation indices for this file */
- herr_t ret_value = SUCCEED; /* return value */
+ H5O_t *oh = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
- /* check args */
HDassert(f);
HDassert(loc);
HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+ /* create object header in freelist
+ * header version is set internally
+ */
+ oh = H5O__create_ohdr(f, ocpl_id);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't instantiate object header")
+
+ /* apply object header information to file
+ */
+ if(H5O__apply_ohdr(f, oh, ocpl_id, size_hint, initial_rc, loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't apply object header to file")
+
+done:
+ if((FAIL == ret_value) && (NULL != oh) && (H5O__free(oh) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "can't delete object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_create() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5O__create_ohdr
+ *
+ * Purpose: Create the object header, set version and flags.
+ *
+ * Return: Success: Pointer to the newly-crated header object.
+ * Failure: NULL
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-----------------------------------------------------------------------------
+ */
+H5O_t *
+H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
+{
+ H5P_genplist_t *oc_plist;
+ H5O_t *oh = NULL; /* Object header in Freelist */
+ uint8_t oh_flags; /* Initial status flags */
+ H5O_t *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ HDassert(f);
+ HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+
/* Check for invalid access request */
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
- /* Make certain we allocate at least a reasonable size for the object header */
- size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
+ oh = H5FL_CALLOC(H5O_t);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the property list */
- if(NULL == (oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
+ oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id);
+ if(NULL == oc_plist)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list")
/* Get any object header status flags set by properties */
if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
- /* Allocate the object header and zero out header fields */
- if(NULL == (oh = H5FL_CALLOC(H5O_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header")
- /* Initialize file-specific information for object header */
- store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
+ oh->flags = oh_flags;
- if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
+ ret_value = oh;
+
+done:
+ if((NULL == ret_value) && (NULL != oh) && (H5O__free(oh) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "can't delete object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5O__create_ohdr() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5O__apply_ohdr
+ *
+ * Purpose: Initialize and set the object header in the file.
+ * Record some information at `loc_out`.
+ *
+ * Return: Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out)
+{
+ haddr_t oh_addr;
+ size_t oh_size;
+ H5P_genplist_t *oc_plist = NULL;
+ unsigned insert_flags = H5AC__NO_FLAGS_SET;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(f);
+ HDassert(loc_out);
+ HDassert(oh);
+ HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+
+ /* Allocate at least a reasonable size for the object header */
+ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
- oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
+ oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE); /* funky cast */
+
#ifdef H5O_ENABLE_BAD_MESG_COUNT
/* Check whether the "bad message count" property is set */
- if(H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME) > 0) {
- /* Retrieve bad message count flag */
+ if(0 < H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME))
+ /* Get bad message count flag -- from property list */
if(H5P_get(oc_plist, H5O_BAD_MESG_COUNT_NAME, &oh->store_bad_mesg_count) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get bad message count flag")
- }
#endif /* H5O_ENABLE_BAD_MESG_COUNT */
/* Create object header proxy if doing SWMR writes */
if(oh->swmr_write) {
- /* Create virtual entry, for use as proxy */
- if(NULL == (oh->proxy = H5AC_proxy_entry_create()))
+ oh->proxy = H5AC_proxy_entry_create();
+ if(NULL == oh->proxy)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy")
- }
- else
+ } else {
oh->proxy = NULL;
+ }
- /* Set initial status flags */
- oh->flags = oh_flags;
+ oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id);
+ if(NULL == oc_plist)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
/* Initialize version-specific fields */
if(oh->version > H5O_VERSION_1) {
- /* Initialize all time fields with current time, if we are storing them */
+ /* Initialize all time fields */
if(oh->flags & H5O_HDR_STORE_TIMES)
oh->atime = oh->mtime = oh->ctime = oh->btime = H5_now();
else
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
- /* Make certain attribute creation order tracking is enabled if
- * attributes can be shared in this file.
- */
- if(store_msg_crt_idx)
+ if(H5F_STORE_MSG_CRT_IDX(f))
+ /* flag to record message creation indices */
oh->flags |= H5O_HDR_ATTR_CRT_ORDER_TRACKED;
- /* Retrieve attribute storage phase change values from property list */
+ /* Get attribute storage phase change values -- from property list */
if(H5P_get(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes")
if(H5P_get(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes")
/* Check for non-default attribute storage phase change values */
- if(oh->max_compact != H5O_CRT_ATTR_MAX_COMPACT_DEF || oh->min_dense != H5O_CRT_ATTR_MIN_DENSE_DEF)
+ if(H5O_CRT_ATTR_MAX_COMPACT_DEF != oh->max_compact || H5O_CRT_ATTR_MIN_DENSE_DEF != oh->min_dense )
oh->flags |= H5O_HDR_ATTR_STORE_PHASE_CHANGE;
/* Determine correct value for chunk #0 size bits */
@@ -382,23 +461,25 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
oh->flags |= H5O_HDR_CHUNK0_4;
else if(size_hint > 255)
oh->flags |= H5O_HDR_CHUNK0_2;
- } /* end if */
- else {
+ } else {
/* Reset unused time fields */
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
- } /* end else */
+ } /* end if/else header version >1 */
/* Compute total size of initial object header */
/* (i.e. object header prefix and first chunk) */
oh_size = (size_t)H5O_SIZEOF_HDR(oh) + size_hint;
/* Allocate disk space for header and first chunk */
- if(HADDR_UNDEF == (oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)oh_size)))
+ oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)oh_size);
+ if(HADDR_UNDEF == oh_addr)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header")
/* Create the chunk list */
- oh->nchunks = oh->alloc_nchunks = 1;
- if(NULL == (oh->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->alloc_nchunks)))
+ oh->nchunks = 1;
+ oh->alloc_nchunks = 1;
+ oh->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->alloc_nchunks);
+ if(NULL == oh->chunk)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the first chunk */
@@ -408,25 +489,27 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
/* Allocate enough space for the first chunk */
/* (including space for serializing the object header prefix */
- if(NULL == (oh->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, oh_size)))
+ oh->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, oh_size);
+ if(NULL == oh->chunk[0].image)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
oh->chunk[0].chunk_proxy = NULL;
/* Put magic # for object header in first chunk */
- if(oh->version > H5O_VERSION_1)
- HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ if(H5O_VERSION_1 < oh->version)
+ H5MM_memcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
/* Create the message list */
oh->nmesgs = 1;
oh->alloc_nmesgs = H5O_NMESGS;
- if(NULL == (oh->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh->alloc_nmesgs)))
+ oh->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh->alloc_nmesgs);
+ if(NULL == oh->mesg)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- /* Initialize the initial "null" message, covering the entire first chunk */
+ /* Initialize the initial "null" message; covers the entire first chunk */
oh->mesg[0].type = H5O_MSG_NULL;
oh->mesg[0].dirty = TRUE;
oh->mesg[0].native = NULL;
- oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].raw = oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh) + H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[0].chunkno = 0;
@@ -451,32 +534,27 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
H5_END_TAG
/* Set up object location */
- loc->file = f;
- loc->addr = oh_addr;
+ loc_out->file = f;
+ loc_out->addr = oh_addr;
- /* Open it */
- if(H5O_open(loc) < 0)
+ if(H5O_open(loc_out) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header")
done:
- if(ret_value < 0 && oh)
- if(H5O__free(oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5O__apply_ohdr() */
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_create() */
-
/*-------------------------------------------------------------------------
- * Function: H5O_open
+ * Function: H5O_open
*
- * Purpose: Opens an object header which is described by the symbol table
- * entry OBJ_ENT.
+ * Purpose: Opens an object header which is described by the symbol table
+ * entry OBJ_ENT.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Monday, January 5, 1998
+ * Programmer: Robb Matzke
+ * Monday, January 5, 1998
*
* Modification:
* Raymond Lu
@@ -503,7 +581,7 @@ H5O_open(H5O_loc_t *loc)
/* Turn off the variable for holding file or increment open-lock counters */
if(loc->holding_file)
- loc->holding_file = FALSE;
+ loc->holding_file = FALSE;
else
H5F_INCR_NOPEN_OBJS(loc->file);
@@ -511,30 +589,30 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_open() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_open_name
*
- * Purpose: Opens an object within an HDF5 file.
+ * Purpose: Opens an object by name
*
- * Return: Success: Open object identifier
- * Failure: H5I_INVALID_HID
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * March 5 2007
+ * Programmer: Quincey Koziol
+ * March 5 2007
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref)
+void *
+H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type)
{
H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
- hid_t ret_value = H5I_INVALID_HID;
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+ FUNC_ENTER_NOAPI(NULL)
/* Check args */
HDassert(loc);
@@ -547,46 +625,46 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref)
/* Find the object's location */
if(H5G_loc_find(loc, name, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "object not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "object not found")
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O_open_by_loc(&obj_loc, app_ref)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
- if(ret_value < 0 && loc_found)
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location")
+ if(NULL == ret_value)
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_open_name() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_open_by_idx
*
* Purpose: Internal routine to open an object by index within group
*
- * Return: Success: Open object identifier
- * Failure: H5I_INVALID_HID
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * December 28, 2017
+ * Programmer: Quincey Koziol
+ * December 28, 2017
*
*-------------------------------------------------------------------------
*/
-hid_t
+void *
H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n)
+ H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type)
{
H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+ FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
HDassert(loc);
@@ -598,45 +676,45 @@ H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
/* Find the object's location, according to the order in the index */
if(H5G_loc_find_by_idx(loc, name, idx_type, order, n, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "group not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "group not found")
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
/* Release the object location if we failed after copying it */
- if(ret_value < 0 && loc_found)
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location")
+ if(NULL == ret_value)
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_open_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_open_by_addr
*
* Purpose: Internal routine to open an object by its address
*
- * Return: Success: Open object identifier
- * Failure: H5I_INVALID_HID
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * December 28, 2017
+ * Programmer: Quincey Koziol
+ * December 28, 2017
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr)
+void *
+H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type)
{
H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+ FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
HDassert(loc);
@@ -650,60 +728,60 @@ H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr)
H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */
/* Open the object */
- if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_open_by_addr() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_open_by_loc
*
- * Purpose: Opens an object and returns an ID given its group loction.
+ * Purpose: Opens an object
*
- * Return: Success: Open object identifier
- * Failure: H5I_INVALID_HID
+ * Return: Success: Pointer to object data
+ * Failure: NULL
*
- * Programmer: James Laird
- * July 25 2006
+ * Programmer: James Laird
+ * July 25 2006
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref)
+void *
+H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type)
{
const H5O_obj_class_t *obj_class; /* Class of object for location */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+ FUNC_ENTER_NOAPI(NULL)
HDassert(obj_loc);
/* Get the object class for this location */
if(NULL == (obj_class = H5O__obj_class(obj_loc->oloc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "unable to determine object class")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object class")
/* Call the object class's 'open' routine */
HDassert(obj_class->open);
- if((ret_value = obj_class->open(obj_loc, app_ref)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
+ if(NULL == (ret_value = obj_class->open(obj_loc, opened_type)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_open_by_loc() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_close
+ * Function: H5O_close
*
- * Purpose: Closes an object header that was previously open.
+ * Purpose: Closes an object header that was previously open.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Monday, January 5, 1998
+ * Programmer: Robb Matzke
+ * Monday, January 5, 1998
*
*-------------------------------------------------------------------------
*/
@@ -733,7 +811,7 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
#ifdef H5O_DEBUG
if(H5DEBUG(O)) {
- if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file))
+ if(FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file))
HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
else
HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
@@ -757,7 +835,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O__link_oh
*
@@ -768,9 +846,9 @@ done:
*
* Failure: -1
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 5 1997
*
*-------------------------------------------------------------------------
*/
@@ -778,7 +856,7 @@ int
H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted)
{
haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */
- int ret_value = -1; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_PACKAGE
@@ -872,29 +950,29 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__link_oh() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_link
+ * Function: H5O_link
*
- * Purpose: Adjust the link count for an object header by adding
- * ADJUST to the link count.
+ * Purpose: Adjust the link count for an object header by adding
+ * ADJUST to the link count.
*
- * Return: Success: New link count
+ * Return: Success: New link count
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 5 1997
*
*-------------------------------------------------------------------------
*/
int
H5O_link(const H5O_loc_t *loc, int adjust)
{
- H5O_t *oh = NULL;
+ H5O_t *oh = NULL;
hbool_t deleted = FALSE; /* Whether the object was deleted */
- int ret_value = -1; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL)
@@ -920,21 +998,21 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_link() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_protect
+ * Function: H5O_protect
*
- * Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
+ * Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
* H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
* during an object's creation.
*
- * Return: Success: Pointer to the object header structure for the
+ * Return: Success: Pointer to the object header structure for the
* object.
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Dec 31 2002
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Dec 31 2002
*
*-------------------------------------------------------------------------
*/
@@ -1106,21 +1184,21 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_protect() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_pin
+ * Function: H5O_pin
*
- * Purpose: Pin an object header down for use during a sequence of message
+ * Purpose: Pin an object header down for use during a sequence of message
* operations, which prevents the object header from being
* evicted from the cache.
*
- * Return: Success: Pointer to the object header structure for the
+ * Return: Success: Pointer to the object header structure for the
* object.
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
*
*-------------------------------------------------------------------------
*/
@@ -1155,19 +1233,19 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_pin() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_unpin
+ * Function: H5O_unpin
*
- * Purpose: Unpin an object header, allowing it to be evicted from the
+ * Purpose: Unpin an object header, allowing it to be evicted from the
* metadata cache.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
*
*-------------------------------------------------------------------------
*/
@@ -1190,20 +1268,20 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_unpin() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_unprotect
+ * Function: H5O_unprotect
*
- * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect->
+ * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect->
* H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
* during an object's creation.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Dec 31 2002
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Dec 31 2002
*
*-------------------------------------------------------------------------
*/
@@ -1247,17 +1325,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_unprotect() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_touch_oh
+ * Function: H5O_touch_oh
*
- * Purpose: If FORCE is non-zero then create a modification time message
- * unless one already exists. Then update any existing
- * modification time message with the current time.
+ * Purpose: If FORCE is non-zero then create a modification time message
+ * unless one already exists. Then update any existing
+ * modification time message with the current time.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, July 27, 1998
*
*-------------------------------------------------------------------------
@@ -1267,7 +1345,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
- time_t now; /* Current time */
+ time_t now; /* Current time */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1282,7 +1360,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
/* Check version, to determine how to store time information */
if(oh->version == H5O_VERSION_1) {
- size_t idx; /* Index of modification time message to update */
+ size_t idx; /* Index of modification time message to update */
/* Look for existing message */
for(idx = 0; idx < oh->nmesgs; idx++)
@@ -1342,18 +1420,18 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_touch_oh() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_touch
+ * Function: H5O_touch
*
- * Purpose: Touch an object by setting the modification time to the
- * current time and marking the object as dirty. Unless FORCE
- * is non-zero, nothing happens if there is no MTIME message in
- * the object header.
+ * Purpose: Touch an object by setting the modification time to the
+ * current time and marking the object as dirty. Unless FORCE
+ * is non-zero, nothing happens if there is no MTIME message in
+ * the object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, July 27, 1998
*
*-------------------------------------------------------------------------
@@ -1361,8 +1439,8 @@ done:
herr_t
H5O_touch(const H5O_loc_t *loc, hbool_t force)
{
- H5O_t *oh = NULL; /* Object header to modify */
- unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
+ H5O_t *oh = NULL; /* Object header to modify */
+ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1389,15 +1467,15 @@ done:
} /* end H5O_touch() */
#ifdef H5O_ENABLE_BOGUS
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_bogus_oh
+ * Function: H5O_bogus_oh
*
- * Purpose: Create a "bogus" message unless one already exists.
+ * Purpose: Create a "bogus" message unless one already exists.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* <koziol@ncsa.uiuc.edu>
* Tuesday, January 21, 2003
*
@@ -1406,8 +1484,8 @@ done:
herr_t
H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
{
- size_t idx; /* Local index variable */
- H5O_msg_class_t *type; /* Message class type */
+ size_t idx; /* Local index variable */
+ H5O_msg_class_t *type; /* Message class type */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1458,20 +1536,20 @@ done:
} /* end H5O_bogus_oh() */
#endif /* H5O_ENABLE_BOGUS */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_delete
+ * Function: H5O_delete
*
- * Purpose: Delete an object header from a file. This frees the file
+ * Purpose: Delete an object header from a file. This frees the file
* space used for the object header (and it's continuation blocks)
* and also walks through each header message and asks it to
* remove all the pieces of the file referenced by the header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 19 2003
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 19 2003
*
*-------------------------------------------------------------------------
*/
@@ -1520,21 +1598,21 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_delete() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__delete_oh
+ * Function: H5O__delete_oh
*
- * Purpose: Internal function to:
+ * Purpose: Internal function to:
* Delete an object header from a file. This frees the file
* space used for the object header (and it's continuation blocks)
* and also walks through each header message and asks it to
* remove all the pieces of the file referenced by the header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 19 2003
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 19 2003
*
*-------------------------------------------------------------------------
*/
@@ -1542,7 +1620,7 @@ static herr_t
H5O__delete_oh(H5F_t *f, H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
- unsigned u;
+ unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1564,16 +1642,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__delete_oh() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_obj_type
+ * Function: H5O_obj_type
*
- * Purpose: Retrieves the type of object pointed to by `loc'.
+ * Purpose: Retrieves the type of object pointed to by `loc'.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, November 4, 1998
*
*-------------------------------------------------------------------------
@@ -1581,7 +1659,7 @@ done:
herr_t
H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type)
{
- H5O_t *oh = NULL; /* Object header for location */
+ H5O_t *oh = NULL; /* Object header for location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL)
@@ -1596,21 +1674,21 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_obj_type() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__obj_type_real
+ * Function: H5O__obj_type_real
*
- * Purpose: Returns the type of object pointed to by `oh'.
+ * Purpose: Returns the type of object pointed to by `oh'.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 21, 2005
*
*-------------------------------------------------------------------------
@@ -1642,7 +1720,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__obj_type_real() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O__obj_class
*
@@ -1651,7 +1729,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type)
* Return: Success: An object class
* Failure: NULL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 6, 2006
*
*-------------------------------------------------------------------------
@@ -1659,7 +1737,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type)
const H5O_obj_class_t *
H5O__obj_class(const H5O_loc_t *loc)
{
- H5O_t *oh = NULL; /* Object header for location */
+ H5O_t *oh = NULL; /* Object header for location */
const H5O_obj_class_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE_TAG(loc->addr)
@@ -1679,16 +1757,16 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O__obj_class() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__obj_class_real
+ * Function: H5O__obj_class_real
*
- * Purpose: Returns the class of object pointed to by `oh'.
+ * Purpose: Returns the class of object pointed to by `oh'.
*
- * Return: Success: An object class
- * Failure: NULL
+ * Return: Success: An object class
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 21, 2005
*
*-------------------------------------------------------------------------
@@ -1696,7 +1774,7 @@ done:
static const H5O_obj_class_t *
H5O__obj_class_real(const H5O_t *oh)
{
- size_t i; /* Local index variable */
+ size_t i; /* Local index variable */
const H5O_obj_class_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -1707,7 +1785,7 @@ H5O__obj_class_real(const H5O_t *oh)
/* Test whether entry qualifies as a particular type of object */
/* (Note: loop is in reverse order, to test specific objects first) */
for(i = NELMTS(H5O_obj_class_g); i > 0; --i) {
- htri_t isa; /* Is entry a particular type? */
+ htri_t isa; /* Is entry a particular type? */
if((isa = (H5O_obj_class_g[i - 1]->isa)(oh)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
@@ -1722,17 +1800,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__obj_class_real() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_get_loc
+ * Function: H5O_get_loc
*
- * Purpose: Gets the object location for an object given its ID.
+ * Purpose: Gets the object location for an object given its ID.
*
- * Return: Success: Pointer to H5O_loc_t
- * Failure: NULL
+ * Return: Success: Pointer to H5O_loc_t
+ * Failure: NULL
*
- * Programmer: James Laird
- * July 25 2006
+ * Programmer: James Laird
+ * July 25 2006
*
*-------------------------------------------------------------------------
*/
@@ -1759,18 +1837,22 @@ H5O_get_loc(hid_t object_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID")
break;
+ case H5I_MAP:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "maps not supported in native VOL connector")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
case H5I_DATASPACE:
case H5I_ATTR:
- case H5I_REFERENCE:
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:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type")
@@ -1780,16 +1862,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_loc() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_loc_reset
+ * Function: H5O_loc_reset
*
- * Purpose: Reset a object location to an empty state
+ * Purpose: Reset a object location to an empty state
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, September 19, 2005
*
*-------------------------------------------------------------------------
@@ -1809,16 +1891,16 @@ H5O_loc_reset(H5O_loc_t *loc)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_loc_reset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_loc_copy
*
* Purpose: Copy object location information
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Monday, September 19, 2005
*
@@ -1843,7 +1925,7 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5O_loc_t));
+ H5MM_memcpy(dst, src, sizeof(H5O_loc_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
@@ -1860,17 +1942,17 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_loc_copy() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_loc_hold_file
+ * Function: H5O_loc_hold_file
*
- * Purpose: Have this object header hold a file open until it is
+ * Purpose: Have this object header hold a file open until it is
* released.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Wednesday, August 16, 2006
*
*-------------------------------------------------------------------------
@@ -1893,18 +1975,18 @@ H5O_loc_hold_file(H5O_loc_t *loc)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_loc_hold_file() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_loc_free
+ * Function: H5O_loc_free
*
- * Purpose: Release resources used by this object header location.
+ * Purpose: Release resources used by this object header location.
* Not to be confused with H5O_close; this is used on
* locations that don't correspond to open objects.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Wednesday, August 16, 2006
*
*-------------------------------------------------------------------------
@@ -1933,17 +2015,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_loc_free() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_get_hdr_info
+ * Function: H5O_get_hdr_info
*
- * Purpose: Retrieve the object header information for an object
+ * Purpose: Retrieve the object header information for an object
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * September 22 2009
+ * Programmer: Quincey Koziol
+ * September 22 2009
*
*-------------------------------------------------------------------------
*/
@@ -1972,22 +2054,22 @@ H5O_get_hdr_info(const H5O_loc_t *loc, H5O_hdr_info_t *hdr)
done:
if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_hdr_info() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__get_hdr_info_real
+ * Function: H5O__get_hdr_info_real
*
- * Purpose: Internal routine to retrieve the object header information for an object
+ * Purpose: Internal routine to retrieve the object header information for an object
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * September 22 2009
+ * Programmer: Quincey Koziol
+ * September 22 2009
*
*-------------------------------------------------------------------------
*/
@@ -1995,7 +2077,7 @@ static herr_t
H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
{
const H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
- const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
+ const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -2058,16 +2140,16 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__get_hdr_info_real() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_get_info
*
* Purpose: Retrieve the information for an object
*
* Note: Add a parameter "fields" to indicate selection of object info.
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* November 21 2006
@@ -2111,7 +2193,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_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) {
@@ -2188,7 +2270,7 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O_get_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O__get_info_by_idx
*
@@ -2198,8 +2280,8 @@ done:
*
* Note: Add a parameter "fields" to indicate selection of object info.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* December 28, 2017
@@ -2211,10 +2293,10 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id
H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields)
{
H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2245,17 +2327,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__get_info_by_idx() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_get_create_plist
+ * Function: H5O_get_create_plist
*
- * Purpose: Retrieve the object creation properties for an object
+ * Purpose: Retrieve the object creation properties for an object
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * November 28 2006
+ * Programmer: Quincey Koziol
+ * November 28 2006
*
*-------------------------------------------------------------------------
*/
@@ -2300,17 +2382,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_create_plist() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_get_nlinks
+ * Function: H5O_get_nlinks
*
- * Purpose: Retrieve the number of link messages read in from the file
+ * Purpose: Retrieve the number of link messages read in from the file
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * March 11 2007
+ * Programmer: Quincey Koziol
+ * March 11 2007
*
*-------------------------------------------------------------------------
*/
@@ -2340,17 +2422,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_nlinks() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_obj_create
+ * Function: H5O_obj_create
*
- * Purpose: Creates an object, in an abstract manner.
+ * Purpose: Creates an object, in an abstract manner.
*
- * Return: Success: Pointer to object opened
- * Failure: NULL
+ * Return: Success: Pointer to object opened
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * April 9 2007
+ * Programmer: Quincey Koziol
+ * April 9 2007
*
*-------------------------------------------------------------------------
*/
@@ -2371,7 +2453,7 @@ H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc
/* Iterate through the object classes */
for(u = 0; u < NELMTS(H5O_obj_class_g); u++) {
/* Check for correct type of object to create */
- if(H5O_obj_class_g[u]->type == obj_type) {
+ if(H5O_obj_class_g[u]->type == obj_type) {
/* Call the object class's 'create' routine */
HDassert(H5O_obj_class_g[u]->create);
if(NULL == (ret_value = H5O_obj_class_g[u]->create(f, crt_info, obj_loc)))
@@ -2387,21 +2469,21 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_obj_create() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_get_oh_addr
+ * Function: H5O_get_oh_addr
*
- * Purpose: Retrieve the address of the object header
+ * Purpose: Retrieve the address of the object header
*
- * Note: This routine participates in the "Inlining C struct access"
- * pattern, don't call it directly, use the appropriate macro
- * defined in H5Oprivate.h.
+ * Note: This routine participates in the "Inlining C struct access"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Oprivate.h.
*
- * Return: Success: Valid haddr_t
- * Failure: HADDR_UNDEF
+ * Return: Success: Valid haddr_t
+ * Failure: HADDR_UNDEF
*
- * Programmer: Quincey Koziol
- * March 15 2007
+ * Programmer: Quincey Koziol
+ * March 15 2007
*
*-------------------------------------------------------------------------
*/
@@ -2417,17 +2499,74 @@ H5O_get_oh_addr(const H5O_t *oh)
FUNC_LEAVE_NOAPI(oh->chunk[0].addr)
} /* end H5O_get_oh_addr() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_get_rc_and_type
+ * Function: H5O_get_oh_flags
*
- * Purpose: Retrieve an object's reference count and type
+ * Programmer: Jacob Smith
+ * 2018 August 17
*
- * Return: Success: Non-negative
- * Failure: Negative
+ *-------------------------------------------------------------------------
+ */
+uint8_t
+H5O_get_oh_flags(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ FUNC_LEAVE_NOAPI(oh->flags); /* flags can be 0 */
+} /* H5O_get_oh_flags() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_mtime
+ *
+ * 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
+ *
+ *-------------------------------------------------------------------------
+ */
+time_t
+H5O_get_oh_mtime(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ HDassert(oh->mtime);
+ FUNC_LEAVE_NOAPI(oh->mtime);
+} /* H5O_get_oh_mtime() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_version
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-------------------------------------------------------------------------
+ */
+uint8_t
+H5O_get_oh_version(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ HDassert(oh->version);
+ FUNC_LEAVE_NOAPI(oh->version);
+} /* H5O_get_oh_version() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_rc_and_type
+ *
+ * Purpose: Retrieve an object's reference count and type
*
- * Programmer: Quincey Koziol
- * November 4 2007
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 4 2007
*
*-------------------------------------------------------------------------
*/
@@ -2462,7 +2601,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_rc_and_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O__free_visit_visited
*
@@ -2471,7 +2610,7 @@ done:
* Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
- * Nov 25, 2007
+ * Nov 25, 2007
*
*-------------------------------------------------------------------------
*/
@@ -2485,17 +2624,17 @@ H5O__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__free_visit_visited() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__visit_cb
+ * Function: H5O__visit_cb
*
* Purpose: Callback function for recursively visiting objects from a group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * Nov 25, 2007
+ * Programmer: Quincey Koziol
+ * Nov 25, 2007
*
*-------------------------------------------------------------------------
*/
@@ -2505,8 +2644,8 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li
{
H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */
H5G_loc_t obj_loc; /* Location of object */
- H5G_name_t obj_path; /* Object's group hier. path */
- H5O_loc_t obj_oloc; /* Object's object location */
+ H5G_name_t obj_path; /* Object's group hier. path */
+ H5O_loc_t obj_oloc; /* Object's object location */
hbool_t obj_found = FALSE; /* Object at 'name' found */
herr_t ret_value = H5_ITER_CONT; /* Return value */
@@ -2577,7 +2716,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__visit_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O__visit
*
@@ -2607,7 +2746,7 @@ done:
* library, or the negative value returned by one
* of the operators.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 24 2007
*
*-------------------------------------------------------------------------
@@ -2622,6 +2761,8 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
H5O_info_t oinfo; /* Object info struct */
+ void *obj = NULL; /* Object */
+ H5I_type_t opened_type; /* ID type of object */
hid_t obj_id = H5I_INVALID_HID; /* ID of object */
herr_t ret_value = FAIL; /* Return value */
@@ -2649,9 +2790,13 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
/* Open the object */
/* (Takes ownership of the obj_loc information) */
- if((obj_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0)
+ if(NULL == (obj = H5O_open_by_loc(&obj_loc, &opened_type)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ /* 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")
+
/* Make callback for starting object */
if((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects")
@@ -2662,7 +2807,8 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
/* Check for object being a group */
if(oinfo.type == H5O_TYPE_GROUP) {
- H5G_loc_t start_loc; /* Location of starting group */
+ H5G_loc_t start_loc; /* Location of starting group */
+ H5G_loc_t vis_loc; /* Location of visited group */
/* Get the location of the starting group */
if(H5G_loc(obj_id, &start_loc) < 0)
@@ -2697,12 +2843,17 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list")
}
+ /* Get the location of the visited group */
+ if(H5G_loc(obj_id, &vis_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
/* Call internal group visitation routine */
- if((ret_value = H5G_visit(&start_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
+ if((ret_value = H5G_visit(&vis_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end if */
done:
+/* XXX (VOL MERGE): Probably also want to consider closing obj here on failures */
if(obj_id != H5I_INVALID_HID) {
if(H5I_dec_app_ref(obj_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
@@ -2716,17 +2867,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__visit() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__inc_rc
+ * Function: H5O__inc_rc
*
- * Purpose: Increments the reference count on an object header
+ * Purpose: Increments the reference count on an object header
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
*
*-------------------------------------------------------------------------
*/
@@ -2752,17 +2903,17 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__inc_rc() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__dec_rc
+ * Function: H5O__dec_rc
*
- * Purpose: Decrements the reference count on an object header
+ * Purpose: Decrements the reference count on an object header
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
*
*-------------------------------------------------------------------------
*/
@@ -2788,7 +2939,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dec_rc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_dec_rc_by_loc
*
@@ -2831,16 +2982,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_dec_rc_by_loc() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O_get_proxy
+ * Function: H5O_get_proxy
*
- * Purpose: Retrieve the proxy for the object header.
+ * Purpose: Retrieve the proxy for the object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * July 24 2016
+ * Programmer: Quincey Koziol
+ * July 24 2016
*
*-------------------------------------------------------------------------
*/
@@ -2855,24 +3006,24 @@ H5O_get_proxy(const H5O_t *oh)
FUNC_LEAVE_NOAPI(oh->proxy)
} /* end H5O_get_proxy() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5O__free
+ * Function: H5O__free
*
- * Purpose: Destroys an object header.
+ * Purpose: Destroys an object header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jan 15 2003
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jan 15 2003
*
*-------------------------------------------------------------------------
*/
herr_t
H5O__free(H5O_t *oh)
{
- unsigned u; /* Local index variable */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE