summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c4
-rw-r--r--src/H5Apublic.h2
-rw-r--r--src/H5B2int.c50
-rw-r--r--src/H5B2private.h6
-rw-r--r--src/H5Dio.c477
-rw-r--r--src/H5Edefin.h1
-rw-r--r--src/H5Einit.h5
-rw-r--r--src/H5Epubgen.h2
-rw-r--r--src/H5Eterm.h3
-rw-r--r--src/H5F.c152
-rw-r--r--src/H5FD.c608
-rw-r--r--src/H5FDpublic.h20
-rw-r--r--src/H5FS.c11
-rw-r--r--src/H5FScache.c8
-rw-r--r--src/H5G.c70
-rw-r--r--src/H5Gbtree2.c376
-rw-r--r--src/H5Gdense.c1374
-rw-r--r--src/H5Gdeprec.c22
-rw-r--r--src/H5Gent.c112
-rw-r--r--src/H5Glink.c351
-rw-r--r--src/H5Gloc.c21
-rw-r--r--src/H5Gnode.c451
-rw-r--r--src/H5Gobj.c888
-rw-r--r--src/H5Goh.c8
-rw-r--r--src/H5Gpkg.h152
-rw-r--r--src/H5Gprivate.h18
-rw-r--r--src/H5Gpublic.h15
-rw-r--r--src/H5Gstab.c155
-rw-r--r--src/H5Gtest.c142
-rw-r--r--src/H5Gtraverse.c60
-rw-r--r--src/H5HFcache.c2
-rw-r--r--src/H5HL.c125
-rw-r--r--src/H5L.c158
-rw-r--r--src/H5Lexternal.c8
-rw-r--r--src/H5Lpkg.h2
-rw-r--r--src/H5Lprivate.h6
-rw-r--r--src/H5Lpublic.h58
-rw-r--r--src/H5O.c173
-rw-r--r--src/H5Oginfo.c44
-rw-r--r--src/H5Olinfo.c237
-rw-r--r--src/H5Olink.c340
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Oprivate.h51
-rw-r--r--src/H5Ostab.c26
-rw-r--r--src/H5Pgcpl.c83
-rw-r--r--src/H5Plcpl.c3
-rw-r--r--src/H5Ppublic.h7
-rw-r--r--src/H5Pstrcpl.c3
-rw-r--r--src/H5S.c113
-rw-r--r--src/H5T.c36
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--src/H5api_adpt.h1
-rw-r--r--src/H5config.h.in3
-rw-r--r--src/H5err.txt1
-rw-r--r--src/H5public.h8
-rw-r--r--src/H5trace.c264
-rwxr-xr-xsrc/Makefile.am4
-rw-r--r--src/Makefile.in53
58 files changed, 4755 insertions, 2622 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 24e27b4..e8540cf 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1008,7 +1008,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
-#ifdef H5_GROUP_REVISION
/*--------------------------------------------------------------------------
NAME
@@ -1063,8 +1062,7 @@ H5Aget_create_plist(hid_t attr_id)
done:
FUNC_LEAVE_API(ret_value)
-}
-#endif /* H5_GROUP_REVISION */
+} /* end H5Aget_create_plist() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index c932e54..ec9904a 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -38,9 +38,7 @@ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
H5_DLL herr_t H5Aclose(hid_t attr_id);
H5_DLL hid_t H5Aget_space(hid_t attr_id);
H5_DLL hid_t H5Aget_type(hid_t attr_id);
-#ifdef H5_GROUP_REVISION
H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
-#endif /* H5_GROUP_REVISION */
H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id);
H5_DLL int H5Aget_num_attrs(hid_t loc_id);
diff --git a/src/H5B2int.c b/src/H5B2int.c
index e974583..e97487d 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -2115,12 +2115,13 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data)
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
- void *node=NULL; /* Pointers to current node */
- uint8_t *native; /* Pointers to node's native records */
- H5B2_node_ptr_t *node_ptrs=NULL; /* Pointers to node's node pointers */
+ const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
+ void *node = NULL; /* Pointers to current node */
+ uint8_t *node_native; /* Pointers to node's native records */
+ uint8_t *native = NULL; /* Pointers to copy of node's native records */
+ H5B2_node_ptr_t *node_ptrs = NULL; /* Pointers to node's node pointers */
unsigned u; /* Local index */
- herr_t ret_value = H5B2_ITER_CONT;
+ herr_t ret_value = H5B2_ITER_CONT; /* Iterator return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_iterate_node)
@@ -2145,8 +2146,14 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_INT;
node = internal;
- native = internal->int_native;
- node_ptrs = internal->node_ptrs;
+ node_native = internal->int_native;
+
+ /* Allocate space for the node pointers in memory */
+ if((node_ptrs = H5FL_FAC_MALLOC(shared->node_info[depth].node_ptr_fac)) == NULL)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
+
+ /* Copy the node pointers */
+ HDmemcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (curr_node->node_nrec + 1)));
} /* end if */
else {
H5B2_leaf_t *leaf; /* Pointer to leaf node */
@@ -2158,9 +2165,21 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_LEAF;
node = leaf;
- native = leaf->leaf_native;
+ node_native = leaf->leaf_native;
} /* end else */
+ /* Allocate space for the native keys in memory */
+ if((native = H5FL_FAC_MALLOC(shared->node_info[depth].nat_rec_fac)) == NULL)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
+
+ /* Copy the native keys */
+ HDmemcpy(native, node_native, (shared->type->nrec_size * curr_node->node_nrec));
+
+ /* Unlock the node */
+ if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
+ node = NULL;
+
/* Iterate through records, in order */
for(u = 0; u < curr_node->node_nrec && !ret_value; u++) {
/* Descend into child node, if current node is an internal node */
@@ -2170,8 +2189,10 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
} /* end if */
/* Make callback for current record */
- if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
+ if(!ret_value) {
+ if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
+ } /* end if */
} /* end for */
/* Descend into last child node, if current node is an internal node */
@@ -2181,10 +2202,11 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
} /* end if */
done:
- /* Unlock current node */
- if(node)
- if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
+ /* Release the node pointers & native records, if they were copied */
+ if(node_ptrs)
+ H5FL_FAC_FREE(shared->node_info[depth].node_ptr_fac, node_ptrs);
+ if(native)
+ H5FL_FAC_FREE(shared->node_info[depth].nat_rec_fac, native);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_iterate_node() */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 82c90f4..2ed9555 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -56,13 +56,15 @@ typedef enum H5B2_subid_t {
H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */
H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */
+ H5B2_GRP_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" link storage in groups */
+ H5B2_GRP_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" link storage in groups */
H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
} H5B2_subid_t;
/* Define the operator callback function pointer for H5B2_iterate() */
typedef int (*H5B2_operator_t)(const void *record, void *op_data);
-/* Define the 'found' callback function pointer for H5B2_find() & H5B2_neighbor() */
+/* Define the 'found' callback function pointer for H5B2_find(), H5B2_neighbor() & H5B2_index() */
typedef herr_t (*H5B2_found_t)(const void *record, void *op_data);
/* Define the 'modify' callback function pointer for H5B2_modify() */
@@ -106,7 +108,7 @@ struct H5B2_class_t {
/* v2 B-tree metadata statistics info */
typedef struct H5B2_stat_t {
unsigned depth; /* Depth of B-tree */
- unsigned nrecords; /* Number of records */
+ hsize_t nrecords; /* Number of records */
} H5B2_stat_t;
/*****************************/
diff --git a/src/H5Dio.c b/src/H5Dio.c
index b615f44..333852e 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -196,7 +196,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
/* Fill the selection in the memory buffer */
- if(H5D_fill(fill,fill_type,buf,buf_type,space, H5AC_dxpl_id)<0)
+ if(H5D_fill(fill,fill_type,buf,buf_type,space, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
done:
@@ -258,8 +258,8 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t
/* Get the maximum buffer size needed and allocate it */
buf_size=MAX(src_type_size,dst_type_size);
- if (NULL==(tconv_buf = H5FL_BLK_MALLOC(type_elem,buf_size)) || NULL==(bkg_buf = H5FL_BLK_CALLOC(type_elem,buf_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if(NULL == (tconv_buf = H5FL_BLK_MALLOC(type_elem,buf_size)) || NULL==(bkg_buf = H5FL_BLK_CALLOC(type_elem,buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Check for actual fill value to replicate */
if(fill==NULL)
@@ -270,23 +270,23 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t
HDmemcpy(tconv_buf,fill,src_type_size);
/* Set up type conversion function */
- if (NULL == (tpath = H5T_path_find(fill_type, buf_type, NULL, NULL, dxpl_id, FALSE)))
+ if(NULL == (tpath = H5T_path_find(fill_type, buf_type, NULL, NULL, dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Convert memory buffer into disk buffer */
- if (!H5T_path_noop(tpath)) {
- if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL)))<0 ||
- (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(buf_type, H5T_COPY_ALL)))<0)
+ if(!H5T_path_noop(tpath)) {
+ if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL))) < 0 ||
+ (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(buf_type, H5T_COPY_ALL))) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
/* Perform data type conversion */
- if (H5T_convert(tpath, src_id, dst_id, 1, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
} /* end if */
} /* end if */
/* Fill the selection in the memory buffer */
- if(H5S_select_fill(tconv_buf, dst_type_size, space, buf)<0)
+ if(H5S_select_fill(tconv_buf, dst_type_size, space, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
done:
@@ -333,48 +333,48 @@ H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Get maximum temporary buffer size */
- if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size")
+ if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size")
/* Get temporary buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &cache->tconv_buf)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer")
+ if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &cache->tconv_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer")
/* Get background buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &cache->bkgr_buf)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer")
+ if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &cache->bkgr_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer")
/* Get background buffer type */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &cache->bkgr_buf_type)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+ if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &cache->bkgr_buf_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
/* Get B-tree split ratios */
- if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
+ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
/* Get I/O vector size */
- if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size")
+ if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size")
#ifdef H5_HAVE_PARALLEL
/* Collect Parallel I/O information for possible later use */
- if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &cache->xfer_mode)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
- if(H5P_get(dx_plist, H5D_XFER_IO_XFER_OPT_MODE_NAME, &cache->xfer_opt_mode)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
+ if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &cache->xfer_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
+ if(H5P_get(dx_plist, H5D_XFER_IO_XFER_OPT_MODE_NAME, &cache->xfer_opt_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
#endif /*H5_HAVE_PARALLEL*/
/* Get error detection properties */
- if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &cache->err_detect)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve error detection info")
+ if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &cache->err_detect) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve error detection info")
/* Get filter callback function */
- if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function")
+ if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function")
/* Get the data transform property */
- if(H5P_get(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve data transform info")
+ if(H5P_get(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve data transform info")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -417,8 +417,8 @@ H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache)
if(dxpl_id==H5P_DATASET_XFER_DEFAULT)
*cache=&H5D_def_dxpl_cache;
else
- if(H5D_get_dxpl_cache_real(dxpl_id,*cache)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTGET, FAIL, "Can't retrieve DXPL values")
+ if(H5D_get_dxpl_cache_real(dxpl_id,*cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't retrieve DXPL values")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -634,23 +634,23 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
file_space = dataset->shared->space;
if(!mem_space)
mem_space = file_space;
- if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
/* Fill the DXPL cache values for later use */
- if(H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ if(H5D_get_dxpl_cache(dxpl_id,&dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
#ifdef H5_HAVE_PARALLEL
/* Collective access is not permissible without a MPI based VFD */
if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->oloc.file))
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only")
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Make sure that both selections have their extents set */
if( !(H5S_has_extent(file_space)) )
@@ -673,7 +673,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
- if(H5P_is_fill_value_defined(&dataset->shared->dcpl_cache.fill, &fill_status)<0)
+ if(H5P_is_fill_value_defined(&dataset->shared->dcpl_cache.fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* Should be impossible, but check anyway... */
@@ -686,7 +686,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_DONE(SUCCEED)
/* Go fill the user's selection with the dataset's fill value */
- if(H5D_fill(dataset->shared->dcpl_cache.fill.buf,dataset->shared->type,buf,mem_type,mem_space,dxpl_id)<0)
+ if(H5D_fill(dataset->shared->dcpl_cache.fill.buf,dataset->shared->type,buf,mem_type,mem_space,dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed")
else
HGOTO_DONE(SUCCEED)
@@ -704,8 +704,8 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Set up I/O operation */
- if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
+ if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
#ifdef H5_HAVE_PARALLEL
io_info_init = TRUE;
#endif /*H5_HAVE_PARALLEL*/
@@ -713,12 +713,12 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Determine correct I/O routine to invoke */
if(dataset->shared->layout.type!=H5D_CHUNKED) {
if(H5D_contig_read(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- dataset->shared->type_id, mem_type_id, buf)<0)
+ dataset->shared->type_id, mem_type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end if */
else {
if(H5D_chunk_read(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- dataset->shared->type_id, mem_type_id, buf)<0)
+ dataset->shared->type_id, mem_type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end else */
@@ -794,7 +794,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* This is because they use the global heap in the file and we don't */
/* support parallel access of that yet */
if(H5T_detect_class(mem_type, H5T_VLEN)>0)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet")
/* If MPI based VFD is used, no VL datatype support yet. */
/* This is because they use the global heap in the file and we don't */
@@ -804,13 +804,13 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
*/
if (H5T_get_class(mem_type, TRUE)==H5T_REFERENCE &&
H5T_get_ref_type(mem_type)==H5R_DATASET_REGION)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet")
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
/* Collective access is not permissible without a MPI based VFD */
if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only")
} /* end else */
#endif /*H5_HAVE_PARALLEL*/
@@ -818,13 +818,13 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
file_space = dataset->shared->space;
if (!mem_space)
mem_space = file_space;
- if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
/* Make certain that the number of elements in each selection is the same */
if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Make sure that both selections have their extents set */
if( !(H5S_has_extent(file_space)) )
@@ -844,7 +844,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Get the number of elements in file dataset's dataspace */
if((file_nelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, FAIL, "can't retrieve number of elements in file dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "can't retrieve number of elements in file dataset")
/* Always allow fill values to be written if the dataset has a VL datatype */
if(H5T_detect_class(dataset->shared->type, H5T_VLEN))
@@ -853,7 +853,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
full_overwrite = (hsize_t)file_nelmts==nelmts ? TRUE : FALSE;
/* Allocate storage */
- if(H5D_alloc_storage(dataset->oloc.file, dxpl_id, dataset, H5D_ALLOC_WRITE, TRUE, full_overwrite)<0)
+ if(H5D_alloc_storage(dataset->oloc.file, dxpl_id, dataset, H5D_ALLOC_WRITE, TRUE, full_overwrite) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
} /* end if */
@@ -869,8 +869,8 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Set up I/O operation */
- if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
+ if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
#ifdef H5_HAVE_PARALLEL
io_info_init = TRUE;
#endif /*H5_HAVE_PARALLEL*/
@@ -878,12 +878,12 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Determine correct I/O routine to invoke */
if(dataset->shared->layout.type!=H5D_CHUNKED) {
if(H5D_contig_write(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- mem_type_id, dataset->shared->type_id, buf)<0)
+ mem_type_id, dataset->shared->type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end if */
else {
if(H5D_chunk_write(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- mem_type_id, dataset->shared->type_id, buf)<0)
+ mem_type_id, dataset->shared->type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end else */
@@ -898,7 +898,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* Update modification time. We have to do this explicitly because
* writing to a dataset doesn't necessarily change the object header.
*/
- if (H5O_touch(&(dataset->oloc), FALSE, dxpl_id)<0)
+ if (H5O_touch(&(dataset->oloc), FALSE, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time")
#endif /* OLD_WAY */
@@ -989,7 +989,7 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
#ifdef H5_HAVE_PARALLEL
if(io_info->dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,FALSE)<0)
+ if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous read failed in collective mode");
}
else
@@ -1038,17 +1038,17 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/* Figure out the strip mine size. */
- if (H5S_select_iter_init(&file_iter, file_space, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, file_space, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, mem_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, mem_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, mem_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, mem_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/*
@@ -1071,13 +1071,13 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Need calloc()-like call since memory needs to be initialized) */
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Start strip mining... */
@@ -1123,13 +1123,13 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0, tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the conversion (since we're using type mem_type) */
@@ -1151,23 +1151,22 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
-
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end for */
done:
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -1247,7 +1246,7 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
H5_CHECK_OVERFLOW(nelmts,hsize_t,size_t);
#ifdef H5_HAVE_PARALLEL
if(io_info->dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,TRUE)<0)
+ if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous write failed in collective mode");
}
else
@@ -1296,17 +1295,17 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/* Figure out the strip mine size. */
- if (H5S_select_iter_init(&file_iter, file_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, file_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, mem_space, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, mem_space, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, file_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, file_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/*
@@ -1333,13 +1332,13 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Don't need calloc()-like call since file data is already initialized) */
if((bkg_buf=H5FL_BLK_MALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Start strip mining... */
@@ -1364,7 +1363,7 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].gath_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
if (H5T_BKG_YES==need_bkg) {
#ifdef H5S_DEBUG
@@ -1380,13 +1379,13 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0, tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the type conversion (since we're using dataset->shared->type). */
@@ -1409,22 +1408,22 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
done:
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -1484,7 +1483,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_read)
/* Map elements between file and memory for each chunk*/
- if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm)<0)
+ if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't build chunk mapping")
/* Set dataset storage for I/O info */
@@ -1583,7 +1582,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/*
* Get a temporary buffer for type conversion unless the app has already
@@ -1605,13 +1604,13 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Need calloc()-like call since memory needs to be initialized) */
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Loop over all the chunks, performing I/O on each */
@@ -1627,14 +1626,14 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
chunk_info=H5SL_item(chunk_node);
/* initialize selection iterator */
- if (H5S_select_iter_init(&file_iter, chunk_info->fspace, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, chunk_info->fspace, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, chunk_info->mspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, chunk_info->mspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/* Pass in chunk's coordinates in a union*/
@@ -1682,14 +1681,13 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0,
- tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the conversion (since we're using type mem_type) */
@@ -1711,23 +1709,23 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end for */
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
file_iter_init=0;
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
mem_iter_init=0;
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
bkg_iter_init=0;
} /* end if */
@@ -1738,16 +1736,16 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
done:
/* Release selection iterators, if necessary */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -1812,7 +1810,7 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_write)
/* Map elements between file and memory for each chunk*/
- if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm)<0)
+ if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't build chunk mapping")
/* Set dataset storage for I/O info */
@@ -1905,7 +1903,7 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/*
* Get a temporary buffer for type conversion unless the app has already
@@ -1931,13 +1929,13 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Don't need calloc()-like call since file data is already initialized) */
if((bkg_buf=H5FL_BLK_MALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Loop over all the chunks, performing I/O on each */
@@ -1953,14 +1951,14 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
chunk_info=H5SL_item(chunk_node);
/* initialize selection iterator */
- if (H5S_select_iter_init(&file_iter, chunk_info->fspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, chunk_info->fspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, chunk_info->fspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, chunk_info->fspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/*pass in chunk's coordinates in a union*/
@@ -2005,14 +2003,13 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0,
- tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the type conversion (since we're using dataset->shared->type) */
@@ -2036,23 +2033,23 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
file_iter_init=0;
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
mem_iter_init=0;
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
bkg_iter_init=0;
} /* end if */
@@ -2063,16 +2060,16 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
done:
/* Release selection iterators, if necessary */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -2128,8 +2125,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Check if the memory space is scalar & make equivalent memory space */
- if((sm_ndims = H5S_GET_EXTENT_NDIMS(mem_space))<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number")
+ if((sm_ndims = H5S_GET_EXTENT_NDIMS(mem_space)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number")
if(sm_ndims==0) {
hsize_t dims[H5O_LAYOUT_NDIMS]; /* Temporary dimension information */
@@ -2137,7 +2134,7 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
for(u=0; u<dataset->shared->layout.u.chunk.ndims-1; u++)
dims[u]=1;
if((equiv_mspace = H5S_create_simple(dataset->shared->layout.u.chunk.ndims-1,dims,NULL))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create equivalent dataspace for scalar space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create equivalent dataspace for scalar space")
/* Indicate that this space needs to be released */
equiv_mspace_init=1;
@@ -2155,8 +2152,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Get dim number and dimensionality for each dataspace */
fm->f_ndims=f_ndims=dataset->shared->layout.u.chunk.ndims-1;
- if(H5S_get_simple_extent_dims(file_space, fm->f_dims, NULL)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
+ if(H5S_get_simple_extent_dims(file_space, fm->f_dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
/* Normalize hyperslab selections by adjusting them by the offset */
/* (It might be worthwhile to normalize both the file and memory dataspaces
@@ -2164,8 +2161,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
* speed up hyperslab calculations by removing the extra checks and/or
* additions involving the offset and the hyperslab selection -QAK)
*/
- if(H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
+ if(H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
file_space_normalized = TRUE;
/* Decide the number of chunks in each dimension*/
@@ -2178,8 +2175,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
} /* end for */
/* Compute the "down" size of 'chunks' information */
- if(H5V_array_down(f_ndims,fm->chunks,fm->down_chunks)<0)
- HGOTO_ERROR (H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
+ if(H5V_array_down(f_ndims,fm->chunks,fm->down_chunks) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
/* calculate total chunk in file map*/
fm->select_chunk = NULL;
@@ -2189,14 +2186,14 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
if(IS_H5FD_MPI(dataset->oloc.file)) {
H5_CHECK_OVERFLOW(fm->total_chunks, hsize_t, size_t);
if(NULL == (fm->select_chunk = (hbool_t *) H5MM_calloc((size_t)fm->total_chunks * sizeof(hbool_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
}
/* Initialize skip list for chunk selections */
- if((fm->fsel=H5SL_create(H5SL_TYPE_HSIZE,0.5,H5D_DEFAULT_SKIPLIST_HEIGHT))==NULL)
+ if((fm->fsel = H5SL_create(H5SL_TYPE_HSIZE, 0.5, (size_t)H5D_DEFAULT_SKIPLIST_HEIGHT))==NULL)
HGOTO_ERROR(H5E_DATASET,H5E_CANTCREATE,FAIL,"can't create skip list for chunk selections")
/* Initialize "last chunk" information */
@@ -2210,9 +2207,9 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Get type of selection on disk & in memory */
if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<H5S_SEL_NONE)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<H5S_SEL_NONE)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
/* If the selection is NONE or POINTS, set the flag to FALSE */
if(fsel_type == H5S_SEL_POINTS || fsel_type == H5S_SEL_NONE)
@@ -2222,12 +2219,12 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Check if file selection is a point selection */
if(!sel_hyper_flag) {
/* Create temporary datatypes for selection iteration */
- if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL)))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL))) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
/* Spaces aren't the same shape, iterate over the memory selection directly */
- if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_file_cb, fm)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
+ if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_file_cb, fm) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
/* Reset "last chunk" info */
fm->last_index=(hsize_t)-1;
@@ -2235,8 +2232,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
} /* end if */
else {
/* Build the file selection for each chunk */
- if(H5D_create_chunk_file_map_hyper(fm,dataset)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
+ if(H5D_create_chunk_file_map_hyper(fm,dataset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
/* Clean file chunks' hyperslab span "scratch" information */
curr_node=H5SL_first(fm->fsel);
@@ -2248,8 +2245,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
assert(chunk_info);
/* Clean hyperslab span's "scratch" information */
- if(H5S_hyper_reset_scratch(chunk_info->fspace)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
+ if(H5S_hyper_reset_scratch(chunk_info->fspace) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
/* Get the next chunk node in the skip list */
curr_node=H5SL_next(curr_node);
@@ -2264,39 +2261,39 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* If the selections are the same shape, use the file chunk information
* to generate the memory chunk information quickly.
*/
- if(H5D_create_chunk_mem_map_hyper(fm)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
+ if(H5D_create_chunk_mem_map_hyper(fm) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
} /* end if */
else {
size_t elmt_size; /* Memory datatype size */
/* Make a copy of equivalent memory space */
if((tmp_mspace = H5S_copy(equiv_mspace,TRUE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* De-select the mem space copy */
- if(H5S_select_none(tmp_mspace)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select memory space")
+ if(H5S_select_none(tmp_mspace) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select memory space")
/* Save chunk template information */
fm->mchunk_tmpl=tmp_mspace;
/* Create temporary datatypes for selection iteration */
if(f_tid<0) {
- if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL)))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL))) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
} /* end if */
/* Create selection iterator for memory selection */
if((elmt_size=H5T_get_size(mem_type))==0)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
- if (H5S_select_iter_init(&(fm->mem_iter), equiv_mspace, elmt_size)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
+ if (H5S_select_iter_init(&(fm->mem_iter), equiv_mspace, elmt_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init=1; /* Selection iteration info has been initialized */
/* Spaces aren't the same shape, iterate over the memory selection directly */
- if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_mem_cb, fm)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
+ if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_mem_cb, fm) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
/* Clean up hyperslab stuff, if necessary */
if(fm->msel_type!=H5S_SEL_POINTS) {
@@ -2310,8 +2307,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
assert(chunk_info);
/* Clean hyperslab span's "scratch" information */
- if(H5S_hyper_reset_scratch(chunk_info->mspace)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
+ if(H5S_hyper_reset_scratch(chunk_info->mspace) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
/* Get the next chunk node in the skip list */
curr_node=H5SL_next(curr_node);
@@ -2323,12 +2320,12 @@ done:
/* Release the [potentially partially built] chunk mapping information if an error occurs */
if(ret_value<0) {
if(tmp_mspace && !fm->mchunk_tmpl) {
- if(H5S_close(tmp_mspace)<0)
+ if(H5S_close(tmp_mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
} /* end if */
- if (H5D_destroy_chunk_map(fm)<0)
- HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping")
+ if (H5D_destroy_chunk_map(fm) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping")
} /* end if */
/* Reset the global dataspace info */
@@ -2336,20 +2333,20 @@ done:
fm->mem_space=NULL;
if(equiv_mspace_init && equiv_mspace) {
- if(H5S_close(equiv_mspace)<0)
+ if(H5S_close(equiv_mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
} /* end if */
if(iter_init) {
- if (H5S_SELECT_ITER_RELEASE(&(fm->mem_iter))<0)
- HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if (H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
}
if(f_tid!=(-1)) {
- if(H5I_dec_ref(f_tid)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
+ if(H5I_dec_ref(f_tid) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
} /* end if */
if(file_space_normalized) {
- if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
+ if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -2418,7 +2415,7 @@ H5D_destroy_chunk_map(const fm_map *fm)
/* Free the chunk info skip list */
if(fm->fsel) {
if(H5SL_count(fm->fsel)>0)
- if(H5SL_iterate(fm->fsel,H5D_free_chunk_info,NULL)<0)
+ if(H5SL_iterate(fm->fsel,H5D_free_chunk_info,NULL) < 0)
HGOTO_ERROR(H5E_PLIST,H5E_CANTNEXT,FAIL,"can't iterate over chunks")
H5SL_close(fm->fsel);
@@ -2426,7 +2423,7 @@ H5D_destroy_chunk_map(const fm_map *fm)
/* Free the memory chunk dataspace template */
if(fm->mchunk_tmpl)
- if(H5S_close(fm->mchunk_tmpl)<0)
+ if(H5S_close(fm->mchunk_tmpl) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
if(fm->select_chunk) H5MM_xfree(fm->select_chunk);
done:
@@ -2467,12 +2464,12 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
assert(fm->f_ndims>0);
/* Get number of elements selected in file */
- if((ssel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0)
+ if((ssel_points=H5S_GET_SELECT_NPOINTS(fm->file_space)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_ASSIGN_OVERFLOW(sel_points,ssel_points,hssize_t,hsize_t);
/* Get bounding box for selection (to reduce the number of chunks to iterate over) */
- if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Set initial chunk location & hyperslab size */
@@ -2485,8 +2482,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
/* Calculate the index of this chunk */
- if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Iterate through each chunk in the dataset */
while(sel_points) {
@@ -2499,28 +2496,28 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
/* Create "temporary" chunk for selection operations (copy file space) */
if((tmp_fchunk = H5S_copy(fm->file_space,TRUE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */
- if(H5S_hyper_convert(tmp_fchunk)<0) {
+ if(H5S_hyper_convert(tmp_fchunk) < 0) {
(void)H5S_close(tmp_fchunk);
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees")
} /* end if */
/* "AND" temporary chunk and current chunk */
- if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL)<0) {
+ if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create chunk selection")
} /* end if */
/* Resize chunk's dataspace dimensions to size of chunk */
- if(H5S_set_extent_real(tmp_fchunk,fm->chunk_dim)<0) {
+ if(H5S_set_extent_real(tmp_fchunk,fm->chunk_dim) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions")
} /* end if */
/* Move selection back to have correct offset in chunk */
- if(H5S_hyper_adjust_u(tmp_fchunk,coords)<0) {
+ if(H5S_hyper_adjust_u(tmp_fchunk,coords) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
} /* end if */
@@ -2530,7 +2527,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
/* Allocate the file & memory chunk information */
if (NULL==(new_chunk_info = H5FL_MALLOC (H5D_chunk_info_t))) {
(void)H5S_close(tmp_fchunk);
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
} /* end if */
/* Initialize the chunk information */
@@ -2555,13 +2552,13 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
new_chunk_info->coords[fm->f_ndims]=0;
/* Insert the new chunk into the skip list */
- if(H5SL_insert(fm->fsel,new_chunk_info,&new_chunk_info->index)<0) {
+ if(H5SL_insert(fm->fsel,new_chunk_info,&new_chunk_info->index) < 0) {
H5D_free_chunk_info(new_chunk_info,NULL,NULL);
HGOTO_ERROR(H5E_DATASPACE,H5E_CANTINSERT,FAIL,"can't insert chunk into skip list")
} /* end if */
/* Get number of elements selected in chunk */
- if((schunk_points=H5S_GET_SELECT_NPOINTS(tmp_fchunk))<0)
+ if((schunk_points=H5S_GET_SELECT_NPOINTS(tmp_fchunk)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_ASSIGN_OVERFLOW(new_chunk_info->chunk_points,schunk_points,hssize_t,size_t);
@@ -2601,8 +2598,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
} while(coords[curr_dim]>sel_end[curr_dim]);
/* Re-Calculate the index of this chunk */
- if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
} /* end if */
} /* end while */
@@ -2660,7 +2657,7 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
if(fm->mem_space_copy) {
/* Copy the memory dataspace & selection to be the chunk's dataspace & selection */
if((chunk_info->mspace = H5S_copy(fm->mem_space,FALSE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
} /* end if */
else {
/* Just point at the memory dataspace & selection */
@@ -2673,11 +2670,11 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
} /* end if */
else {
/* Get bounding box for file selection */
- if(H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Get bounding box for memory selection */
- if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Calculate the adjustment for memory selection from file selection */
@@ -2701,15 +2698,15 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
/* Copy the memory dataspace */
if((chunk_info->mspace = H5S_copy(fm->mem_space,TRUE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Release the current selection */
- if(H5S_SELECT_RELEASE(chunk_info->mspace)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
+ if(H5S_SELECT_RELEASE(chunk_info->mspace) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
/* Copy the file chunk's selection */
- if(H5S_select_copy(chunk_info->mspace,chunk_info->fspace,FALSE)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
+ if(H5S_select_copy(chunk_info->mspace,chunk_info->fspace,FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
/* Compensate for the chunk offset */
for(u=0; u<fm->f_ndims; u++) {
@@ -2718,7 +2715,7 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
} /* end for */
/* Adjust the selection */
- if(H5S_hyper_adjust_s(chunk_info->mspace,chunk_adjust)<0) /*lint !e772 The chunk_adjust array will always be initialized */
+ if(H5S_hyper_adjust_s(chunk_info->mspace,chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
/* Get the next chunk node in the skip list */
@@ -2757,8 +2754,8 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_file_cb)
/* Calculate the index of this chunk */
- if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Find correct chunk in file & memory skip list */
if(chunk_index==fm->last_index) {
@@ -2777,7 +2774,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
/* Allocate the file & memory chunk information */
if (NULL==(chunk_info = H5FL_MALLOC (H5D_chunk_info_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
@@ -2787,14 +2784,14 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
/* Create a dataspace for the chunk */
if((fspace = H5S_create_simple(fm->f_ndims,fm->chunk_dim,NULL))==NULL) {
H5FL_FREE(H5D_chunk_info_t,chunk_info);
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
} /* end if */
/* De-select the chunk space */
- if(H5S_select_none(fspace)<0) {
+ if(H5S_select_none(fspace) < 0) {
(void)H5S_close(fspace);
H5FL_FREE(H5D_chunk_info_t,chunk_info);
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace")
} /* end if */
/* Set the file chunk dataspace */
@@ -2815,7 +2812,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
chunk_info->coords[fm->f_ndims]=0;
/* Insert the new chunk into the skip list */
- if(H5SL_insert(fm->fsel,chunk_info,&chunk_info->index)<0) {
+ if(H5SL_insert(fm->fsel,chunk_info,&chunk_info->index) < 0) {
H5D_free_chunk_info(chunk_info,NULL,NULL);
HGOTO_ERROR(H5E_DATASPACE,H5E_CANTINSERT,FAIL,"can't insert chunk into skip list")
} /* end if */
@@ -2831,8 +2828,8 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
coords_in_chunk[u]=coords[u]%fm->layout->u.chunk.dim[u];
/* Add point to file selection for chunk */
- if(H5S_select_elements(chunk_info->fspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_chunk)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, (const hsize_t **)coords_in_chunk) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
/* Increment the number of elemented selected in chunk */
chunk_info->chunk_points++;
@@ -2868,8 +2865,8 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_mem_cb)
/* Calculate the index of this chunk */
- if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Find correct chunk in file & memory skip list */
if(chunk_index==fm->last_index) {
@@ -2890,7 +2887,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
if(chunk_info->mspace==NULL) {
/* Copy the template memory chunk dataspace */
if((chunk_info->mspace = H5S_copy(fm->mchunk_tmpl,FALSE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space")
} /* end else */
/* Update the "last chunk seen" information */
@@ -2899,22 +2896,22 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
} /* end else */
/* Get coordinates of selection iterator for memory */
- if(H5S_SELECT_ITER_COORDS(&fm->mem_iter,coords_in_mem)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates")
+ if(H5S_SELECT_ITER_COORDS(&fm->mem_iter,coords_in_mem) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates")
/* Add point to memory selection for chunk */
if(fm->msel_type==H5S_SEL_POINTS) {
- if(H5S_select_elements(chunk_info->mspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_mem)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, (const hsize_t **)coords_in_mem) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
} /* end if */
else {
- if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
} /* end else */
/* Move memory selection iterator to next element in selection */
- if(H5S_SELECT_ITER_NEXT(&fm->mem_iter,1)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location")
+ if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3042,7 +3039,7 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
if(check_prop > 0) {
int prop_value = 0;
- if(H5Pset(dxpl_id,H5D_XFER_COLL_CHUNK_NAME,&prop_value)<0)
+ if(H5Pset(dxpl_id,H5D_XFER_COLL_CHUNK_NAME,&prop_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "unable to set property value");
} /* end if */
} /* end if */
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index b785882..4a4a98c 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -103,6 +103,7 @@ hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */
hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */
hid_t H5E_BADITER_g = FAIL; /* Iteration failed */
hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */
+hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */
/* System level errors */
hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index 28ede80..1ac6a99 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -377,6 +377,11 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTRESET_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* System level errors */
assert(H5E_SYSERRSTR_g==(-1));
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 3e0ca3a..c705ddc 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -168,6 +168,7 @@ H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */
#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g)
#define H5E_BADITER (H5OPEN H5E_BADITER_g)
#define H5E_CANTPACK (H5OPEN H5E_CANTPACK_g)
+#define H5E_CANTRESET (H5OPEN H5E_CANTRESET_g)
H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */
H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */
H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */
@@ -175,6 +176,7 @@ H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */
H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */
H5_DLLVAR hid_t H5E_BADITER_g; /* Iteration failed */
H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */
+H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */
/* System level errors */
#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g)
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index 43191bc..2f0028a 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -104,7 +104,8 @@ H5E_ALIGNMENT_g=
H5E_BADMESG_g=
H5E_CANTDELETE_g=
H5E_BADITER_g=
-H5E_CANTPACK_g=
+H5E_CANTPACK_g=
+H5E_CANTRESET_g=
/* System level errors */
H5E_SYSERRSTR_g=
diff --git a/src/H5F.c b/src/H5F.c
index 455c658..dfb6d94 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -232,52 +232,52 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE)<0)
+ if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the user block size */
- if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for symbol table leaf nodes */
- if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for btree internal nodes */
- if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for an address */
- if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for object size */
- if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the superblock version number */
- if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free-space version number */
- if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the object directory version number */
- if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared-header version number */
- if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_FILE_CREATE_g==(-1)) {
/* Register the default file creation property list */
- if((H5P_LST_FILE_CREATE_g = H5P_create_id(crt_pclass))<0)
+ if((H5P_LST_FILE_CREATE_g = H5P_create_id(crt_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@@ -289,78 +289,78 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE)<0)
+ if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the initial metadata cache resize configuration */
- if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_INIT_CONFIG_NAME,H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_INIT_CONFIG_NAME,H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache (elements) */
- if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
- if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
- if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the threshold for alignment */
- if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the alignment */
- if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum metadata allocation block size */
- if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the maximum sieve buffer size */
- if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum "small data" allocation block size */
- if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the garbage collection reference */
- if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver ID */
- if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver info */
- if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file close degree */
- if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the offset of family driver info */
- if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of new family file size. It's used by h5repart only. */
- if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */
- if(H5P_register(acs_pclass,H5F_ACS_FAMILY_TO_SEC2_NAME,H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FAMILY_TO_SEC2_NAME,H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data type of multi driver info */
- if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 'use the latest version of the format' flag */
@@ -371,7 +371,7 @@ H5F_init_interface(void)
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_FILE_ACCESS_g==(-1)) {
/* Register the default file access property list */
- if((H5P_LST_FILE_ACCESS_g = H5P_create_id(acs_pclass))<0)
+ if((H5P_LST_FILE_ACCESS_g = H5P_create_id(acs_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@@ -383,20 +383,20 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE)<0)
+ if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register property of whether symlinks is local to file */
- if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_MOUNT_g==(-1)) {
/* Register the default file mount property list */
- if((H5P_LST_MOUNT_g = H5P_create_id(mnt_pclass))<0)
+ if((H5P_LST_MOUNT_g = H5P_create_id(mnt_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@@ -489,7 +489,7 @@ H5F_acs_create(hid_t fapl_id, void UNUSED *copy_data)
if(driver_id > 0) {
/* Set the driver for the property list */
- if(H5FD_fapl_open(plist, driver_id, driver_info)<0)
+ if(H5FD_fapl_open(plist, driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
@@ -539,7 +539,7 @@ H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, void UNUSED *copy_data)
if(driver_id > 0) {
/* Set the driver for the property list */
- if(H5FD_fapl_open(new_plist, driver_id, driver_info)<0)
+ if(H5FD_fapl_open(new_plist, driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
@@ -588,7 +588,7 @@ H5F_acs_close(hid_t fapl_id, void UNUSED *close_data)
if(driver_id > 0) {
/* Close the driver for the property list */
- if(H5FD_fapl_close(driver_id, driver_info)<0)
+ if(H5FD_fapl_close(driver_id, driver_info) < 0)
HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */
}
@@ -885,7 +885,7 @@ H5F_get_access_plist(H5F_t *f)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information")
/* Increment the reference count on the driver ID and insert it into the property list */
- if(H5I_inc_ref(f->shared->lf->driver_id)<0)
+ if(H5I_inc_ref(f->shared->lf->driver_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver")
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID")
@@ -936,7 +936,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
if( (types&H5F_OBJ_ALL)==0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type")
- if((ret_value = H5F_get_obj_count(f, types))<0)
+ if((ret_value = H5F_get_obj_count(f, types)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOUNT, FAIL, "can't get object count")
done:
@@ -1328,9 +1328,9 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id)
*/
for (n=8; n<maxpow; n++) {
addr = (8==n) ? 0 : (haddr_t)1 << n;
- if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN)<0)
+ if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature")
- if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf)<0)
+ if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature")
if (!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
break;
@@ -1396,7 +1396,7 @@ H5Fis_hdf5(const char *name)
done:
/* Close the file */
if (file)
- if(H5FD_close(file)<0 && ret_value>=0)
+ if(H5FD_close(file) < 0 && ret_value>=0)
HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
FUNC_LEAVE_API(ret_value)
@@ -1475,13 +1475,13 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
f->shared->fcpl_id = H5P_copy_plist(plist);
/* Get the FCPL values to cache */
- if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &f->shared->sizeof_addr)<0)
+ if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &f->shared->sizeof_addr) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for address")
- if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size)<0)
+ if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size")
- if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &f->shared->sym_leaf_k)<0)
+ if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &f->shared->sym_leaf_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size")
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &f->shared->btree_k[0])<0)
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &f->shared->btree_k[0]) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get rank for btree internal nodes")
/* Check for non-default indexed storage B-tree internal 'K' value
@@ -1510,11 +1510,11 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get preempt read chunk")
- if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold))<0)
+ if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold")
if(H5P_get(plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment")
- if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME,&(f->shared->gc_ref))<0)
+ if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME,&(f->shared->gc_ref)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference")
if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
@@ -1530,7 +1530,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache")
/* Create the file's "open object" information */
- if(H5FO_create(f)<0)
+ if(H5FO_create(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Add new "shared" struct to list of open files */
@@ -1541,7 +1541,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
f->shared->nrefs++;
/* Create the file's "top open object" information */
- if(H5FO_top_create(f)<0)
+ if(H5FO_top_create(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Set return value */
@@ -1614,12 +1614,12 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
*/
if (f->shared->root_grp) {
/* Free the ID to name buffer */
- if(H5G_free_grp_name(f->shared->root_grp)<0)
+ if(H5G_free_grp_name(f->shared->root_grp) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
/* Free the memory for the root group */
- if(H5G_free(f->shared->root_grp)<0)
+ if(H5G_free(f->shared->root_grp) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
f->shared->root_grp=NULL;
@@ -1627,11 +1627,11 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
if (H5AC_dest(f, dxpl_id))
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
- if (H5FO_dest(f)<0)
+ if (H5FO_dest(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
f->shared->cwfs = H5MM_xfree (f->shared->cwfs);
- if (H5G_node_close(f)<0)
+ if (H5G_node_close(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
@@ -1644,7 +1644,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list")
/* Close low-level file */
- if (H5FD_close(f->shared->lf)<0)
+ if (H5FD_close(f->shared->lf) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file")
@@ -1823,7 +1823,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* exists), or if the new request adds write access (since the
* readers don't expect the file to change under them).
*/
- if(H5FD_close(lf)<0)
+ if(H5FD_close(lf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
if (flags & H5F_ACC_TRUNC)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to truncate a file which is already open")
@@ -1843,7 +1843,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* open it are different than the desired flags. Close the tentative
* file and open it for real.
*/
- if(H5FD_close(lf)<0) {
+ if(H5FD_close(lf) < 0) {
file = NULL; /*to prevent destruction of wrong file*/
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
} /* end if */
@@ -1911,7 +1911,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
/* (This must be after the space for the superblock is allocated in
* the file)
*/
- if (H5G_mkroot(file, dxpl_id, NULL)<0)
+ if (H5G_mkroot(file, dxpl_id, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group")
/* Write the superblock to the file */
@@ -1927,7 +1927,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
/* Make sure we can open the root group */
- if (H5G_mkroot(file, dxpl_id, &root_loc)<0)
+ if (H5G_mkroot(file, dxpl_id, &root_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group")
}
@@ -1957,7 +1957,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
done:
if (!ret_value && file)
- if(H5F_dest(file, dxpl_id)<0)
+ if(H5F_dest(file, dxpl_id) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2065,7 +2065,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
/* Get an atom for the file */
- if ((ret_value = H5I_register(H5I_FILE, new_file))<0)
+ if ((ret_value = H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
/* Keep this ID in file object structure */
@@ -2073,7 +2073,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
done:
if (ret_value<0 && new_file)
- if(H5F_close(new_file)<0)
+ if(H5F_close(new_file) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
FUNC_LEAVE_API(ret_value)
}
@@ -2145,7 +2145,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file")
/* Get an atom for the file */
- if ((ret_value = H5I_register(H5I_FILE, new_file))<0)
+ if ((ret_value = H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
/* Keep this ID in file object structure */
@@ -2153,7 +2153,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
done:
if (ret_value<0 && new_file)
- if(H5F_close(new_file)<0)
+ if(H5F_close(new_file) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
FUNC_LEAVE_API(ret_value)
}
@@ -2673,7 +2673,7 @@ H5Fclose(hid_t file_id)
* Decrement reference count on atom. When it reaches zero the file will
* be closed.
*/
- if(H5I_dec_ref (file_id) < 0)
+ if(H5I_dec_ref(file_id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
@@ -2726,7 +2726,7 @@ H5Freopen(hid_t file_id)
/* Duplicate old file's name */
new_file->name = H5MM_xstrdup(old_file->name);
- if ((ret_value=H5I_register(H5I_FILE, new_file))<0)
+ if ((ret_value=H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
/* Keep this ID in file object structure */
@@ -2734,7 +2734,7 @@ H5Freopen(hid_t file_id)
done:
if (ret_value<0 && new_file)
- if(H5F_dest(new_file, H5AC_dxpl_id)<0)
+ if(H5F_dest(new_file, H5AC_dxpl_id) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
FUNC_LEAVE_API(ret_value)
}
@@ -3135,7 +3135,7 @@ H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
assert(filenum);
/* Retrieve the file's serial number */
- if(H5FD_get_fileno(f->shared->lf,filenum)<0)
+ if(H5FD_get_fileno(f->shared->lf,filenum) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno")
done:
@@ -3171,7 +3171,7 @@ H5F_get_id(H5F_t *file)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
} else {
/* Increment reference count on atom. */
- if(H5I_inc_ref(file->file_id)<0)
+ if(H5I_inc_ref(file->file_id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
} /* end else */
@@ -3271,7 +3271,7 @@ H5F_mpi_get_rank(const H5F_t *f)
assert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value=H5FD_mpi_get_rank(f->shared->lf))<0)
+ if ((ret_value=H5FD_mpi_get_rank(f->shared->lf)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed")
done:
@@ -3339,7 +3339,7 @@ H5F_mpi_get_size(const H5F_t *f)
assert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value=H5FD_mpi_get_size(f->shared->lf))<0)
+ if ((ret_value=H5FD_mpi_get_size(f->shared->lf)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed")
done:
@@ -3522,7 +3522,7 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t
abs_addr = f->shared->base_addr + addr;
/* Read the data */
- if (H5FD_read(f->shared->lf, type, dxpl_id, abs_addr, size, buf)<0)
+ if(H5FD_read(f->shared->lf, type, dxpl_id, abs_addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
done:
@@ -3682,9 +3682,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
/*-------------------------------------------------------------------------
* Function: H5Fget_freespace
*
- * Purpose: Retrieves the amount of free space (of a given type) in the
- * file. If TYPE is 'H5FD_MEM_DEFAULT', then the amount of free
- * space for all types is returned.
+ * Purpose: Retrieves the amount of free space in the file.
*
* Return: Success: Amount of free space for type
* Failure: Negative
@@ -3693,8 +3691,6 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
* koziol@ncsa.uiuc.edu
* Oct 6, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -3707,11 +3703,11 @@ H5Fget_freespace(hid_t file_id)
H5TRACE1("Hs","i",file_id);
/* Check args */
- if(NULL==(file=H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (file = H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Go get the actual amount of free space in the file */
- if((ret_value = H5FD_get_freespace(file->shared->lf))<0)
+ if((ret_value = H5FD_get_freespace(file->shared->lf)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
done:
diff --git a/src/H5FD.c b/src/H5FD.c
index 84066f2..3388492 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -73,6 +73,9 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
#define H5FD_ACCUM_THROTTLE 8
#define H5FD_ACCUM_THRESHOLD 2048
+/* Define this to display information about file allocations */
+/* #define H5FD_ALLOC_DEBUG */
+
/* Static local variables */
/*
@@ -113,7 +116,7 @@ H5FD_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT(H5FD_init_interface)
- if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE)
+ if(H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the file serial numbers */
@@ -151,8 +154,8 @@ H5FD_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface)
- if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_VFL))!=0) {
+ if(H5_interface_initialize_g) {
+ if((n=H5I_nmembers(H5I_VFL))!=0) {
H5I_clear_type(H5I_VFL, FALSE);
/* Reset the VFL drivers, if they've been closed */
@@ -244,22 +247,22 @@ H5FDregister(const H5FD_class_t *cls)
H5TRACE1("i","x",cls);
/* Check arguments */
- if (!cls)
+ if(!cls)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed")
- if (!cls->open || !cls->close)
+ if(!cls->open || !cls->close)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined")
- if (!cls->get_eoa || !cls->set_eoa)
+ if(!cls->get_eoa || !cls->set_eoa)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined")
- if (!cls->get_eof)
+ if(!cls->get_eof)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined")
- if (!cls->read || !cls->write)
+ if(!cls->read || !cls->write)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined")
for (type=H5FD_MEM_DEFAULT; type<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type))
- if (cls->fl_map[type]<H5FD_MEM_NOLIST || cls->fl_map[type]>=H5FD_MEM_NTYPES)
+ if(cls->fl_map[type]<H5FD_MEM_NOLIST || cls->fl_map[type]>=H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping")
/* Create the new class ID */
- if ((ret_value=H5FD_register(cls, sizeof(H5FD_class_t)))<0)
+ if((ret_value=H5FD_register(cls, sizeof(H5FD_class_t))) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
done:
@@ -314,12 +317,12 @@ H5FD_register(const void *_cls, size_t size)
assert(cls->fl_map[type]>=H5FD_MEM_NOLIST && cls->fl_map[type]<H5FD_MEM_NTYPES);
/* Copy the class structure so the caller can reuse or free it */
- if (NULL==(saved=H5MM_malloc(size)))
+ if(NULL==(saved=H5MM_malloc(size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct")
HDmemcpy(saved,cls,size);
/* Create the new class ID */
- if ((ret_value=H5I_register(H5I_VFL, saved))<0)
+ if((ret_value=H5I_register(H5I_VFL, saved)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
done:
@@ -359,11 +362,11 @@ H5FDunregister(hid_t driver_id)
H5TRACE1("e","i",driver_id);
/* Check arguments */
- if (NULL==H5I_object_verify(driver_id,H5I_VFL))
+ if(NULL==H5I_object_verify(driver_id,H5I_VFL))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver")
/* The H5FD_class_t struct will be freed by this function */
- if (H5I_dec_ref(driver_id)<0)
+ if(H5I_dec_ref(driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to unregister file driver")
done:
@@ -407,18 +410,18 @@ H5FD_get_class(hid_t id)
FUNC_ENTER_NOAPI(H5FD_get_class, NULL)
- if (H5I_VFL==H5I_get_type(id)) {
+ if(H5I_VFL==H5I_get_type(id)) {
ret_value = H5I_object(id);
} else {
/* Get the plist structure */
if(NULL == (plist = H5I_object(id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
- if (TRUE==H5P_isa_class(id,H5P_FILE_ACCESS)) {
+ if(TRUE==H5P_isa_class(id,H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
- } else if (TRUE==H5P_isa_class(id,H5P_DATASET_XFER)) {
+ } else if(TRUE==H5P_isa_class(id,H5P_DATASET_XFER)) {
if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
@@ -459,7 +462,7 @@ H5FD_sb_size(H5FD_t *file)
assert(file && file->cls);
- if (file->cls->sb_size)
+ if(file->cls->sb_size)
ret_value = (file->cls->sb_size)(file);
done:
@@ -496,8 +499,8 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf)
FUNC_ENTER_NOAPI(H5FD_sb_encode, FAIL)
assert(file && file->cls);
- if (file->cls->sb_encode &&
- (file->cls->sb_encode)(file, name/*out*/, buf/*out*/)<0)
+ if(file->cls->sb_encode &&
+ (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed")
done:
@@ -529,8 +532,8 @@ H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
FUNC_ENTER_NOAPI(H5FD_sb_decode, FAIL)
assert(file && file->cls);
- if (file->cls->sb_decode &&
- (file->cls->sb_decode)(file, name, buf)<0)
+ if(file->cls->sb_decode &&
+ (file->cls->sb_decode)(file, name, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed")
done:
@@ -567,13 +570,13 @@ H5FD_pl_copy(void *(*copy_func)(const void *), size_t pl_size, const void *old_p
FUNC_ENTER_NOAPI_NOINIT(H5FD_pl_copy)
/* Copy old pl, if one exists */
- if (old_pl) {
+ if(old_pl) {
/* Allow the driver to copy or do it ourselves */
- if (copy_func) {
+ if(copy_func) {
new_pl = (copy_func)(old_pl);
if(new_pl==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list copy failed")
- } else if (pl_size>0) {
+ } else if(pl_size>0) {
if((new_pl = H5MM_malloc(pl_size))==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list allocation failed")
HDmemcpy(new_pl, old_pl, pl_size);
@@ -614,14 +617,14 @@ H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl)
FUNC_ENTER_NOAPI_NOINIT(H5FD_pl_close)
/* Allow driver to free or do it ourselves */
- if (pl && free_func) {
- if ((free_func)(pl)<0)
+ if(pl && free_func) {
+ if((free_func)(pl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed")
} else
H5MM_xfree(pl);
/* Decrement reference count for driver */
- if(H5I_dec_ref(driver_id)<0)
+ if(H5I_dec_ref(driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver")
done:
@@ -664,7 +667,7 @@ H5FD_fapl_get(H5FD_t *file)
assert(file);
- if (file->cls->fapl_get)
+ if(file->cls->fapl_get)
ret_value = (file->cls->fapl_get)(file);
done:
@@ -697,9 +700,9 @@ H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
FUNC_ENTER_NOAPI(H5FD_fapl_open, FAIL)
/* Increment the reference count on driver and copy driver info */
- if(H5I_inc_ref(driver_id)<0)
+ if(H5I_inc_ref(driver_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver")
- if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info)<0)
+ if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info) < 0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VFL driver info")
/* Set the driver properties for the list */
@@ -739,11 +742,11 @@ H5FD_fapl_copy(hid_t driver_id, const void *old_fapl, void **copied_fapl)
FUNC_ENTER_NOAPI(H5FD_fapl_copy, FAIL)
/* Check args */
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Copy the file access property list */
- if(H5FD_pl_copy(driver->fapl_copy,driver->fapl_size,old_fapl,copied_fapl)<0)
+ if(H5FD_pl_copy(driver->fapl_copy,driver->fapl_size,old_fapl,copied_fapl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver file access property list")
done:
@@ -776,11 +779,11 @@ H5FD_fapl_close(hid_t driver_id, void *fapl)
/* Check args */
if(driver_id>0) {
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Close the driver for the property list */
- if(H5FD_pl_close(driver_id,driver->fapl_free,fapl)<0)
+ if(H5FD_pl_close(driver_id,driver->fapl_free,fapl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed")
} /* end if */
@@ -814,15 +817,15 @@ H5FD_dxpl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
FUNC_ENTER_NOAPI(H5FD_dxpl_open, FAIL)
/* Increment the reference count on the driver and copy the driver info */
- if(H5I_inc_ref(driver_id)<0)
+ if(H5I_inc_ref(driver_id) < 0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "can't increment VFL driver ID")
- if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info)<0)
+ if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info) < 0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy VFL driver")
/* Set the driver information for the new property list */
- if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
+ if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver ID")
- if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info)<0)
+ if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info) < 0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver info")
done:
@@ -856,11 +859,11 @@ H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl)
FUNC_ENTER_NOAPI(H5FD_dxpl_copy, FAIL)
/* Check args */
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Copy the file access property list */
- if(H5FD_pl_copy(driver->dxpl_copy,driver->dxpl_size,old_dxpl,copied_dxpl)<0)
+ if(H5FD_pl_copy(driver->dxpl_copy,driver->dxpl_size,old_dxpl,copied_dxpl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver data transfer property list")
done:
@@ -893,11 +896,11 @@ H5FD_dxpl_close(hid_t driver_id, void *dxpl)
/* Check args */
if(driver_id>0) {
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Close the driver for the property list */
- if(H5FD_pl_close(driver_id,driver->dxpl_free,dxpl)<0)
+ if(H5FD_pl_close(driver_id,driver->dxpl_free,dxpl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed")
} /* end if */
@@ -972,10 +975,10 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if(H5P_DEFAULT == fapl_id)
fapl_id = H5P_FILE_ACCESS_DEFAULT;
else
- if (TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS))
+ if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr)))
+ if(NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file")
done:
@@ -1021,22 +1024,22 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if(NULL == (plist = H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (0==maxaddr)
+ if(0==maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range")
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
/* Get driver info */
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list")
- if (NULL==driver->open)
+ if(NULL==driver->open)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method")
/* Dispatch to file driver */
- if (HADDR_UNDEF==maxaddr)
+ if(HADDR_UNDEF==maxaddr)
maxaddr = driver->maxaddr;
- if (NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr)))
+ if(NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed")
/*
@@ -1044,7 +1047,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
* driver ID to prevent it from being freed while this file is open.
*/
file->driver_id = driver_id;
- if(H5I_inc_ref(file->driver_id)<0)
+ if(H5I_inc_ref(file->driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
file->cls = driver;
file->maxaddr = maxaddr;
@@ -1062,7 +1065,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment")
/* Retrieve the VFL driver feature flags */
- if (H5FD_query(file, &(file->feature_flags))<0)
+ if(H5FD_query(file, &(file->feature_flags)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver")
/* Increment the global serial number & assign it to this H5FD_t object */
@@ -1109,10 +1112,10 @@ H5FDclose(H5FD_t *file)
FUNC_ENTER_API(H5FDclose, FAIL)
H5TRACE1("e","x",file);
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (H5FD_close(file)<0)
+ if(H5FD_close(file) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to close file")
done:
@@ -1160,7 +1163,7 @@ H5FD_close(H5FD_t *file)
/* Prepare to close file by clearing all public fields */
driver = file->cls;
- if(H5I_dec_ref(file->driver_id)<0)
+ if(H5I_dec_ref(file->driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
/*
@@ -1169,7 +1172,7 @@ H5FD_close(H5FD_t *file)
*/
assert(driver->close);
- if ((driver->close)(file) < 0)
+ if((driver->close)(file) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "close failed")
done:
@@ -1224,16 +1227,16 @@ H5FD_free_freelist(H5FD_t *file)
}
#ifdef H5F_DEBUG
- if (nblocks && H5DEBUG(F))
+ if(nblocks && H5DEBUG(F))
HDfprintf(H5DEBUG(F),
"H5F: leaked %Hu bytes of file memory in %u blocks\n",
nbytes, nblocks);
#endif /* H5F_DEBUG */
/* Check if we need to reset the metadata accumulator information */
- if (file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
+ if(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
/* Free the buffer */
- if (file->meta_accum)
+ if(file->meta_accum)
file->meta_accum = H5FL_BLK_FREE(meta_accum, file->meta_accum);
/* Reset the buffer sizes & location */
@@ -1309,22 +1312,22 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
FUNC_ENTER_NOAPI(H5FD_cmp, -1) /*return value is arbitrary*/
- if ((!f1 || !f1->cls) && (!f2 || !f2->cls))
+ if((!f1 || !f1->cls) && (!f2 || !f2->cls))
HGOTO_DONE(0)
- if (!f1 || !f1->cls)
+ if(!f1 || !f1->cls)
HGOTO_DONE(-1)
- if (!f2 || !f2->cls)
+ if(!f2 || !f2->cls)
HGOTO_DONE(1)
- if (f1->cls < f2->cls)
+ if(f1->cls < f2->cls)
HGOTO_DONE(-1)
- if (f1->cls > f2->cls)
+ if(f1->cls > f2->cls)
HGOTO_DONE(1)
/* Files are same driver; no cmp callback */
- if (!f1->cls->cmp) {
- if (f1<f2)
+ if(!f1->cls->cmp) {
+ if(f1<f2)
HGOTO_DONE(-1)
- if (f1>f2)
+ if(f1>f2)
HGOTO_DONE(1)
HGOTO_DONE(0)
}
@@ -1397,7 +1400,7 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
assert(flags);
/* Check for query driver and call it */
- if (f->cls->query)
+ if(f->cls->query)
ret_value = (f->cls->query)(f, flags);
else
*flags=0;
@@ -1457,20 +1460,20 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
H5TRACE4("a","xMtih",file,type,dxpl_id,size);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
- if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES)
+ if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type")
- if (size==0)
+ if(size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
/* Do the real work */
- if (HADDR_UNDEF==(ret_value=H5FD_alloc(file, type, dxpl_id, size)))
+ if(HADDR_UNDEF == (ret_value = H5FD_alloc(file, type, dxpl_id, size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory")
done:
@@ -1507,6 +1510,9 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -1515,33 +1521,36 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
assert(size > 0);
#ifdef H5F_DEBUG
- if (H5DEBUG(F))
+ if(H5DEBUG(F))
HDfprintf(H5DEBUG(F), "%s: alignment=%Hd, threshold=%Hd, size=%Hd\n",
FUNC, file->alignment, file->threshold, size);
#endif /* H5F_DEBUG */
/* Try to allocate from the free list first */
- if ((ret_value = H5FD_alloc_from_free_list(file, type, size)) != HADDR_UNDEF)
+ if((ret_value = H5FD_alloc_from_free_list(file, type, size)) != HADDR_UNDEF)
HGOTO_DONE(ret_value)
#ifdef H5F_DEBUG
- if (H5DEBUG(F))
+ if(H5DEBUG(F))
HDfprintf(H5DEBUG(F), "%s: Could not allocate from freelists\n", FUNC);
#endif /* H5F_DEBUG */
- if (type != H5FD_MEM_DRAW) {
+ if(type != H5FD_MEM_DRAW) {
/* Handle metadata differently from "raw" data */
- if ((ret_value = H5FD_alloc_metadata(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if((ret_value = H5FD_alloc_metadata(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for metadata")
} else {
/* Allocate "raw" data */
- if ((ret_value = H5FD_alloc_raw(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if((ret_value = H5FD_alloc_raw(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for raw data")
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_alloc() */
/*-------------------------------------------------------------------------
@@ -1564,13 +1573,16 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc_from_free_list, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
assert(file);
assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/* Map the allocation request to a free list */
- if (H5FD_MEM_DEFAULT == file->cls->fl_map[type])
+ if(H5FD_MEM_DEFAULT == file->cls->fl_map[type])
mapped_type = type;
else
mapped_type = file->cls->fl_map[type];
@@ -1594,26 +1606,26 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* 2. block address is aligned with smallest size > requested size;
* 3. block address is not aligned with smallest size >= requested size.
*/
- if (mapped_type >= H5FD_MEM_DEFAULT && (file->maxsize == 0 || size <= file->maxsize)) {
+ if(mapped_type >= H5FD_MEM_DEFAULT && (file->maxsize == 0 || size <= file->maxsize)) {
H5FD_free_t *prev = NULL, *best = NULL;
H5FD_free_t *cur = file->fl[mapped_type];
- int found_aligned = 0;
- int need_aligned;
+ hbool_t found_aligned = FALSE;
+ hbool_t need_aligned;
hsize_t head;
need_aligned = file->alignment > 1 && size >= file->threshold;
- while (cur) {
+ while(cur) {
if(cur->size > file->maxsize)
file->maxsize = cur->size;
- if (need_aligned) {
- if ((head = cur->addr % file->alignment) == 0) {
+ if(need_aligned) {
+ if((head = cur->addr % file->alignment) == 0) {
/*
* Aligned address
*/
- if (cur->size >= size) {
- if (cur->size == size) {
+ if(cur->size >= size) {
+ if(cur->size == size) {
/* exact match */
ret_value = cur->addr;
@@ -1622,29 +1634,31 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size,
file->accum_loc, file->accum_size)) {
ret_value = HADDR_UNDEF;
} else {
- if (prev)
+ if(prev)
prev->next = cur->next;
else
file->fl[mapped_type] = cur->next;
H5FL_FREE(H5FD_free_t, cur);
- if (size == file->maxsize)
+ if(size == file->maxsize)
file->maxsize = 0; /*unknown*/
HGOTO_DONE(ret_value)
}
}
else
- if (!best || !found_aligned || cur->size < best->size) {
+ /* Favor smallest block, that's closest to the beginning of the file */
+ if(!best || !found_aligned || cur->size < best->size ||
+ (cur->size == best->size && H5F_addr_lt(cur->addr, best->addr))) {
best = cur;
- found_aligned = 1;
+ found_aligned = TRUE;
}
} /* end if */
} else {
@@ -1653,22 +1667,25 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
*
* Check to see if this block is big enough to skip
* to the next aligned address and is still big
- * enough for the requested size. the extra
- * cur->size>head is for preventing unsigned
- * underflow. (this can be improved by checking for
- * an exact match after excluding the head. Such
+ * enough for the requested size. The extra
+ * (cur->size > head) is for preventing unsigned
+ * underflow. (This could be improved by checking for
+ * an exact match after excluding the head. Such
* match is as good as the found_aligned case above.)
*/
head = file->alignment - head; /* actual head size */
- if (!found_aligned && cur->size > head && cur->size-head >= size &&
- (!best || cur->size < best->size))
- best = cur;
- }
+ if(!found_aligned && cur->size > head && cur->size-head >= size) {
+ /* Favor smallest block, that's closest to the beginning of the file */
+ if(!best || cur->size < best->size ||
+ (cur->size == best->size && H5F_addr_lt(cur->addr, best->addr)))
+ best = cur;
+ } /* end if */
+ } /* end else */
} else {
/* !need_aligned */
- if (cur->size >= size) {
- if (cur->size == size) {
+ if(cur->size >= size) {
+ if(cur->size == size) {
/* exact match */
ret_value = cur->addr;
@@ -1677,42 +1694,44 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size, file->accum_loc,
file->accum_size)) {
ret_value = HADDR_UNDEF;
} else {
- if (prev)
+ if(prev)
prev->next = cur->next;
else
file->fl[mapped_type] = cur->next;
H5FL_FREE(H5FD_free_t, cur);
- if (size == file->maxsize)
+ if(size == file->maxsize)
file->maxsize = 0; /*unknown*/
HGOTO_DONE(ret_value)
}
- }
+ } /* end if */
else {
- if (!best || cur->size < best->size)
+ /* Favor smallest block, that's closest to the beginning of the file */
+ if(!best || cur->size < best->size ||
+ (cur->size == best->size && H5F_addr_lt(cur->addr, best->addr)))
best = cur;
- }
+ } /* end else */
} /* end if */
- }
+ } /* end else */
prev = cur;
cur = cur->next;
- }
+ } /* end while */
/* Couldn't find exact match, use best fitting piece found */
- if (best) {
- if (best->size == file->maxsize)
+ if(best) {
+ if(best->size == file->maxsize)
file->maxsize = 0; /*unknown*/
- if (!need_aligned || found_aligned) {
+ if(!need_aligned || found_aligned) {
/* free only tail */
ret_value = best->addr;
@@ -1721,7 +1740,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size, file->accum_loc,
file->accum_size)) {
@@ -1746,7 +1765,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size, file->accum_loc, file->accum_size)) {
ret_value = HADDR_UNDEF;
@@ -1755,7 +1774,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
if((tmp = H5FL_MALLOC(H5FD_free_t))==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "free block allocation failed")
- if ((tmp->size = (best->size - (head + size)))!=0) {
+ if((tmp->size = (best->size - (head + size)))!=0) {
tmp->addr = best->addr + (head + size);
tmp->next = best->next;
best->next = tmp;
@@ -1772,8 +1791,11 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
} /* end if */
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_alloc_from_free_list() */
/*-------------------------------------------------------------------------
@@ -1796,6 +1818,9 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc_metadata, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -1812,19 +1837,19 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/*
* Allocate all types of metadata out of the metadata block
*/
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
/*
* Check if the space requested is larger than the space left in
* the block
*/
- if (size > file->cur_meta_block_size) {
+ if(size > file->cur_meta_block_size) {
haddr_t new_meta; /* Address for new metadata */
/*
* Check if the block asked for is too large for a metadata
* block
*/
- if (size >= file->def_meta_block_size) {
+ if(size >= file->def_meta_block_size) {
/* Allocate more room for this new block the regular way */
new_meta = H5FD_real_alloc(file, type, dxpl_id, size);
@@ -1832,7 +1857,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new metadata is at the end of the current
* metadata block
*/
- if (file->eoma + file->cur_meta_block_size == new_meta) {
+ if(file->eoma + file->cur_meta_block_size == new_meta) {
/*
* Treat the allocation request as if the current
* metadata block grew by the amount allocated and
@@ -1855,15 +1880,15 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new metadata is at the end of the current
* metadata block
*/
- if (file->eoma + file->cur_meta_block_size == new_meta) {
+ if(file->eoma + file->cur_meta_block_size == new_meta) {
file->cur_meta_block_size += file->def_meta_block_size;
} else {
/*
* Return the unused portion of the metadata block to
* a free list
*/
- if (file->eoma != 0)
- if (H5FD_free(file, H5FD_MEM_DEFAULT, dxpl_id, file->eoma,
+ if(file->eoma != 0)
+ if(H5FD_free(file, H5FD_MEM_DEFAULT, dxpl_id, file->eoma,
file->cur_meta_block_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free metadata block")
@@ -1889,6 +1914,9 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_alloc_metadata() */
@@ -1911,6 +1939,9 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc_raw, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -1922,16 +1953,16 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* allocate "small data" space and sub-allocate out of that, if
* possible. Otherwise just allocate through H5FD_real_alloc()
*/
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
/*
* Check if the space requested is larger than the space left in
* the block
*/
- if (size > file->cur_sdata_block_size) {
+ if(size > file->cur_sdata_block_size) {
haddr_t new_data; /* Address for new raw data block */
/* Check if the block asked for is too large for the "small data" block */
- if (size >= file->def_sdata_block_size) {
+ if(size >= file->def_sdata_block_size) {
/* Allocate more room for this new block the regular way */
new_data = H5FD_real_alloc(file, type, dxpl_id, size);
@@ -1939,7 +1970,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new raw data is at the end of the current
* "small data" block
*/
- if (file->eosda + file->cur_sdata_block_size == new_data) {
+ if(file->eosda + file->cur_sdata_block_size == new_data) {
/*
* Treat the allocation request as if the current
* "small data" block grew by the amount allocated
@@ -1962,15 +1993,15 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new raw data is at the end of the current
* "small data" block
*/
- if (file->eosda + file->cur_sdata_block_size == new_data) {
+ if(file->eosda + file->cur_sdata_block_size == new_data) {
file->cur_sdata_block_size += file->def_sdata_block_size;
} else {
/*
* Return the unused portion of the "small data"
* block to a free list
*/
- if (file->eosda != 0)
- if (H5FD_free(file, H5FD_MEM_DRAW, dxpl_id, file->eosda,
+ if(file->eosda != 0)
+ if(H5FD_free(file, H5FD_MEM_DRAW, dxpl_id, file->eosda,
file->cur_sdata_block_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free 'small data' block")
@@ -1999,6 +2030,9 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_alloc_raw() */
@@ -2027,6 +2061,9 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI_NOINIT(H5FD_real_alloc)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -2038,15 +2075,18 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Dispatch to driver `alloc' callback or extend the end-of-address
* marker
*/
- if (file->cls->alloc) {
- if ((ret_value = (file->cls->alloc)(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if(file->cls->alloc) {
+ if((ret_value = (file->cls->alloc)(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed")
} else {
- if ((ret_value = H5FD_update_eoa(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if((ret_value = H5FD_update_eoa(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed")
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_real_alloc() */
@@ -2083,50 +2123,46 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
eoa = file->cls->get_eoa(file);
#ifdef H5F_DEBUG
- if (file->alignment * file->threshold != 1 && H5DEBUG(F))
+ if(file->alignment * file->threshold != 1 && H5DEBUG(F))
HDfprintf(H5DEBUG(F),
"%s: alignment=%Hd, threshold=%Hd, size=%Hd, Begin eoa=%a\n",
FUNC, file->alignment, file->threshold, size, eoa);
#endif /* H5F_DEBUG */
- /*
- * Wasted is 0 if not exceeding threshold or eoa happens to be
- * aligned
- */
+ /* Wasted is 0 if not exceeding threshold or eoa happens to be aligned */
wasted = (size >= file->threshold) ? (eoa % file->alignment) : 0;
-
- if (wasted) {
+ if(wasted) {
wasted = file->alignment - wasted; /* actual waste */
oldeoa = eoa; /* save it for later freeing */
- /* Advance eoa to the next alignment by allocating the wasted */
- if (H5F_addr_overflow(eoa, size) || eoa + wasted > file->maxaddr)
+ /* Advance eoa to the next alignment by allocating the wasted */
+ if(H5F_addr_overflow(eoa, size) || (eoa + wasted) > file->maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
eoa += wasted;
- if (file->cls->set_eoa(file, eoa) < 0)
+ if(file->cls->set_eoa(file, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
- }
+ } /* end if */
/* allocate the aligned memory */
- if (H5F_addr_overflow(eoa, size) || eoa + size > file->maxaddr)
+ if(H5F_addr_overflow(eoa, size) || eoa + size > file->maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
ret_value = eoa;
eoa += size;
- if (file->cls->set_eoa(file, eoa) < 0)
+ if(file->cls->set_eoa(file, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
/* Free the wasted memory */
- if (wasted) {
- if(H5FD_free(file, type, dxpl_id, oldeoa, wasted)<0)
+ if(wasted) {
+ if(H5FD_free(file, type, dxpl_id, oldeoa, wasted) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
} /* end if */
#ifdef H5F_DEBUG
- if (file->alignment * file->threshold != 1 && H5DEBUG(F))
+ if(file->alignment * file->threshold != 1 && H5DEBUG(F))
HDfprintf(H5DEBUG(F),
"%s: ret_value=%a, wasted=%Hd, Ended eoa=%a\n",
FUNC, ret_value, wasted, eoa);
@@ -2167,23 +2203,23 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
H5TRACE5("e","xMtiah",file,type,dxpl_id,addr,size);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES)
+ if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type")
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
- if (H5FD_free(file, type, dxpl_id, addr, size)<0)
+ if(H5FD_free(file, type, dxpl_id, addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5FDfree() */
/*-------------------------------------------------------------------------
@@ -2210,50 +2246,52 @@ herr_t
H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size)
{
H5FD_mem_t mapped_type;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_free, FAIL)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, addr, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* Check args */
assert(file);
assert(file->cls);
assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
- if (!H5F_addr_defined(addr) || addr>file->maxaddr ||
- H5F_addr_overflow(addr, size) || addr+size>file->maxaddr)
+ if(!H5F_addr_defined(addr) || addr > file->maxaddr ||
+ H5F_addr_overflow(addr, size) || (addr + size) > file->maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid region")
/* Allow 0-sized free's to occur without penalty */
- if(0==size)
+ if(0 == size)
HGOTO_DONE(SUCCEED)
/* Map request type to free list */
- if (H5FD_MEM_DEFAULT==file->cls->fl_map[type]) {
+ if(H5FD_MEM_DEFAULT==file->cls->fl_map[type])
mapped_type = type;
- } else {
+ else
mapped_type = file->cls->fl_map[type];
- }
/*
* If the request maps to a free list then add memory to the free list
* without ever telling the driver that it was freed. Otherwise let the
* driver deallocate the memory.
*/
- if (mapped_type>=H5FD_MEM_DEFAULT) {
+ if(mapped_type >= H5FD_MEM_DEFAULT) {
H5FD_free_t *last; /* Last merged node */
- H5FD_free_t *last_prev=NULL;/* Pointer to node before merged node */
+ H5FD_free_t *last_prev = NULL;/* Pointer to node before merged node */
H5FD_free_t *curr; /* Current free block being inspected */
H5FD_free_t *prev; /* Previous free block being inspected */
/* Adjust the metadata accumulator to remove the freed block, if it overlaps */
if((file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA)
- && H5F_addr_overlap(addr,size,file->accum_loc,file->accum_size)) {
+ && H5F_addr_overlap(addr, size, file->accum_loc, file->accum_size)) {
size_t overlap_size; /* Size of overlap with accumulator */
/* Check for overlapping the beginning of the accumulator */
- if(H5F_addr_le(addr,file->accum_loc)) {
+ if(H5F_addr_le(addr, file->accum_loc)) {
/* Check for completely overlapping the accumulator */
- if(H5F_addr_ge(addr+size,file->accum_loc+file->accum_size)) {
+ if(H5F_addr_ge(addr + size, file->accum_loc + file->accum_size)) {
/* Reset the entire accumulator */
file->accum_loc=HADDR_UNDEF;
file->accum_size=FALSE;
@@ -2291,7 +2329,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
/* Write out the part of the accumulator after the block to free */
/* (Use the driver's write call directly - to avoid looping back and writing to metadata accumulator) */
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, tail_addr, tail_size, file->meta_accum+(tail_addr-file->accum_loc))<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, tail_addr, tail_size, file->meta_accum+(tail_addr-file->accum_loc)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
} /* end if */
@@ -2388,7 +2426,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
} /* end if */
else {
/* Allocate a new node to hold the free block's information */
- if(NULL==(last = H5FL_MALLOC(H5FD_free_t)))
+ if(NULL == (last = H5FL_MALLOC(H5FD_free_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate node for free space info")
last->addr = addr;
@@ -2417,8 +2455,8 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
H5FL_FREE(H5FD_free_t, last);
}
}
- } else if (file->cls->free) {
- if ((file->cls->free)(file, type, dxpl_id, addr, size)<0)
+ } else if(file->cls->free) {
+ if((file->cls->free)(file, type, dxpl_id, addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed")
} else {
/* leak memory */
@@ -2460,13 +2498,13 @@ H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsiz
H5TRACE6("a","xMtiahh",file,type,dxpl_id,old_addr,old_size,new_size);
/* Check args */
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
- if (HADDR_UNDEF==(ret_value=H5FD_realloc(file, type, dxpl_id, old_addr, old_size, new_size)))
+ if(HADDR_UNDEF==(ret_value=H5FD_realloc(file, type, dxpl_id, old_addr, old_size, new_size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file reallocation request failed")
done:
@@ -2502,24 +2540,24 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi
FUNC_ENTER_NOAPI(H5FD_realloc, HADDR_UNDEF)
- if (new_size==old_size) {
+ if(new_size==old_size) {
/*nothing to do*/
- } else if (0==old_size) {
+ } else if(0==old_size) {
/* allocate memory */
assert(!H5F_addr_defined(old_addr));
- if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
+ if(HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed")
- } else if (0==new_size) {
+ } else if(0==new_size) {
/* free memory */
assert(H5F_addr_defined(old_addr));
- if(H5FD_free(file, type, dxpl_id, old_addr, old_size)<0)
+ if(H5FD_free(file, type, dxpl_id, old_addr, old_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
new_addr = HADDR_UNDEF;
- } else if (new_size<old_size) {
+ } else if(new_size<old_size) {
/* free the end of the block */
- if(H5FD_free(file, type, dxpl_id, old_addr+old_size, old_size-new_size)<0)
+ if(H5FD_free(file, type, dxpl_id, old_addr+old_size, old_size-new_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
} else {
/* move memory to new location */
@@ -2529,24 +2567,24 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi
* to move pieces of the realloced data through a fixed size buffer, etc.
* -QAK, 6/20/01
*/
- if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
+ if(HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed")
H5_CHECK_OVERFLOW(old_size,hsize_t,size_t);
- if (old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc((size_t)old_size))) {
+ if(old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc((size_t)old_size))) {
(void)H5FD_free(file, type, dxpl_id, new_addr, new_size);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
}
- if (H5FD_read(file, type, dxpl_id, old_addr, (size_t)old_size, buf)<0 ||
- H5FD_write(file, type, dxpl_id, new_addr, (size_t)old_size, buf)<0) {
+ if(H5FD_read(file, type, dxpl_id, old_addr, (size_t)old_size, buf) < 0 ||
+ H5FD_write(file, type, dxpl_id, new_addr, (size_t)old_size, buf) < 0) {
(void)H5FD_free(file, type, dxpl_id, new_addr, new_size);
- if (buf!=_buf)
+ if(buf!=_buf)
H5MM_xfree(buf);
HGOTO_ERROR(H5E_FILE, H5E_READERROR, HADDR_UNDEF, "unable to move file block")
}
- if (buf!=_buf)
+ if(buf!=_buf)
H5MM_xfree(buf);
- if(H5FD_free(file, type, dxpl_id, old_addr, old_size)<0)
+ if(H5FD_free(file, type, dxpl_id, old_addr, old_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
}
@@ -2583,7 +2621,7 @@ H5FD_can_extend(const H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size,
FUNC_ENTER_NOAPI(H5FD_can_extend, FAIL)
/* Retrieve the end of the address space */
- if (HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
+ if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
/* Check if the block is exactly at the end of the file */
@@ -2595,30 +2633,30 @@ H5FD_can_extend(const H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size,
haddr_t end; /* End of block in file */
/* Map request type to free list */
- if (H5FD_MEM_DEFAULT==file->cls->fl_map[type])
+ if(H5FD_MEM_DEFAULT==file->cls->fl_map[type])
mapped_type = type;
else
mapped_type = file->cls->fl_map[type];
/* Check if block is inside the metadata or small data accumulator */
if(mapped_type!=H5FD_MEM_DRAW) {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
/* If the metadata block is at the end of the file, and
* the block to test adjoins the beginning of the metadata
* block, then it's extendable
*/
- if (file->eoma + file->cur_meta_block_size == eoa &&
+ if(file->eoma + file->cur_meta_block_size == eoa &&
(addr+size)==file->eoma)
HGOTO_DONE(TRUE)
} /* end if */
} /* end if */
else {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
/* If the small data block is at the end of the file, and
* the block to test adjoins the beginning of the small data
* block, then it's extendable
*/
- if (file->eosda + file->cur_sdata_block_size == eoa &&
+ if(file->eosda + file->cur_sdata_block_size == eoa &&
(addr+size)==file->eosda)
HGOTO_DONE(TRUE)
} /* end if */
@@ -2673,13 +2711,16 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t e
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_extend, FAIL)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n", FUNC, (unsigned)type, addr, size, extra_requested);
+#endif /* H5FD_ALLOC_DEBUG */
/* Retrieve the end of the address space */
- if (HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
+ if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
/* Map request type to free list */
- if (H5FD_MEM_DEFAULT==file->cls->fl_map[type])
+ if(H5FD_MEM_DEFAULT==file->cls->fl_map[type])
mapped_type = type;
else
mapped_type = file->cls->fl_map[type];
@@ -2693,22 +2734,22 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t e
else {
/* (Check if block is inside the metadata or small data accumulator) */
if(mapped_type!=H5FD_MEM_DRAW) {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA)
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA)
/* If the metadata block is at the end of the file, and
* the block to test adjoins the beginning of the metadata
* block, then it's extendable
*/
- if ((file->eoma + file->cur_meta_block_size) == eoa &&
+ if((file->eoma + file->cur_meta_block_size) == eoa &&
end == file->eoma)
update_eoma=TRUE;
} /* end if */
else {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)
/* If the small data block is at the end of the file, and
* the block to test adjoins the beginning of the small data
* block, then it's extendable
*/
- if ((file->eosda + file->cur_sdata_block_size) == eoa &&
+ if((file->eosda + file->cur_sdata_block_size) == eoa &&
end == file->eosda)
update_eosda=TRUE;
} /* end else */
@@ -2717,12 +2758,12 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t e
/* Block is at end of file, we are extending the eoma or eosda */
if(update_eoma || update_eosda || at_end) {
/* Check for overflowing the file */
- if (H5F_addr_overflow(eoa, extra_requested) || eoa + extra_requested > file->maxaddr)
+ if(H5F_addr_overflow(eoa, extra_requested) || eoa + extra_requested > file->maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "file allocation request failed")
/* Extend the file */
eoa += extra_requested;
- if (file->cls->set_eoa(file, eoa) < 0)
+ if(file->cls->set_eoa(file, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "file allocation request failed")
/* Update the metadata and/or small data block */
@@ -2809,11 +2850,11 @@ H5FDget_eoa(H5FD_t *file)
H5TRACE1("a","x",file);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
- if (HADDR_UNDEF==(ret_value=H5FD_get_eoa(file)))
+ if(HADDR_UNDEF==(ret_value=H5FD_get_eoa(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed")
done:
@@ -2846,7 +2887,7 @@ H5FD_get_eoa(const H5FD_t *file)
assert(file && file->cls);
/* Dispatch to driver */
- if (HADDR_UNDEF==(ret_value=(file->cls->get_eoa)(file)))
+ if(HADDR_UNDEF==(ret_value=(file->cls->get_eoa)(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
done:
@@ -2890,14 +2931,14 @@ H5FDset_eoa(H5FD_t *file, haddr_t addr)
H5TRACE2("e","xa",file,addr);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (!H5F_addr_defined(addr) || addr>file->maxaddr)
+ if(!H5F_addr_defined(addr) || addr>file->maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value")
/* The real work */
- if (H5FD_set_eoa(file, addr)<0)
+ if(H5FD_set_eoa(file, addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed")
done:
@@ -2932,7 +2973,7 @@ H5FD_set_eoa(H5FD_t *file, haddr_t addr)
assert(H5F_addr_defined(addr) && addr<=file->maxaddr);
/* Dispatch to driver */
- if ((file->cls->set_eoa)(file, addr)<0)
+ if((file->cls->set_eoa)(file, addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed")
done:
@@ -2975,11 +3016,11 @@ H5FDget_eof(H5FD_t *file)
H5TRACE1("a","x",file);
/* Check arguments */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
- if (HADDR_UNDEF==(ret_value=H5FD_get_eof(file)))
+ if(HADDR_UNDEF==(ret_value=H5FD_get_eof(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed")
done:
@@ -3013,8 +3054,8 @@ H5FD_get_eof(const H5FD_t *file)
assert(file && file->cls);
/* Dispatch to driver */
- if (file->cls->get_eof) {
- if (HADDR_UNDEF==(ret_value=(file->cls->get_eof)(file)))
+ if(file->cls->get_eof) {
+ if(HADDR_UNDEF==(ret_value=(file->cls->get_eof)(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eof request failed")
} else {
ret_value = file->maxaddr;
@@ -3056,20 +3097,20 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
/* Get the default dataset transfer property list if the user didn't provide one */
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
- if (!buf)
+ if(!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer")
/* Do the real work */
- if (H5FD_read(file, type, dxpl_id, addr, size, buf)<0)
+ if(H5FD_read(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed")
done:
@@ -3114,7 +3155,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Do not return early for Parallel mode since the I/O could be a */
/* collective transfer. */
/* The no-op case */
- if (0==size)
+ if(0==size)
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
@@ -3138,7 +3179,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
H5_ASSIGN_OVERFLOW(amount_read,file->accum_loc-addr,hsize_t,size_t);
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, amount_read, read_buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, amount_read, read_buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Adjust the buffer, address & size */
@@ -3173,7 +3214,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Read the part after the metadata accumulator */
if(size>0 && addr>=(file->accum_loc+file->accum_size)) {
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, size, read_buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, size, read_buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Adjust the buffer, address & size */
@@ -3194,7 +3235,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
if(file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA_READ || !file->accum_dirty) {
/* Flush current contents, if dirty */
if(file->accum_dirty) {
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
/* Reset accumulator dirty flag */
@@ -3205,7 +3246,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Check if we need to resize the buffer */
if(size>file->accum_buf_size) {
/* Grow the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3218,7 +3259,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
size_t new_size=(file->accum_buf_size/H5FD_ACCUM_THROTTLE); /* New size of accumulator buffer */
/* Shrink the accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,new_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,new_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3232,7 +3273,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
file->accum_dirty=FALSE;
/* Read into accumulator */
- if ((file->cls->read)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->read)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Copy into buffer */
@@ -3240,14 +3281,14 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
} /* end if */
else {
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, size, buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
} /* end else */
} /* end if */
else {
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, size, buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
@@ -3285,19 +3326,19 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
/* Get the default dataset transfer property list if the user didn't provide one */
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
- if (!buf)
+ if(!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer")
/* The real work */
- if (H5FD_write(file, type, dxpl_id, addr, size, buf)<0)
+ if(H5FD_write(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
done:
@@ -3344,7 +3385,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Do not return early for Parallel mode since the I/O could be a */
/* collective transfer. */
/* The no-op case */
- if (0==size)
+ if(0==size)
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
@@ -3365,7 +3406,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
file->accum_buf_size = MAX(file->accum_buf_size*2,size+file->accum_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3393,7 +3434,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
file->accum_buf_size = MAX(file->accum_buf_size*2,size+file->accum_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3428,7 +3469,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
file->accum_buf_size = MAX(file->accum_buf_size*2,new_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3462,7 +3503,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
file->accum_buf_size = MAX(file->accum_buf_size*2,new_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3486,7 +3527,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
else {
/* Write out the existing metadata accumulator, with dispatch to driver */
if(file->accum_dirty) {
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
/* Reset accumulator dirty flag */
file->accum_dirty=FALSE;
@@ -3496,7 +3537,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Check if we need to resize the buffer */
if(size>file->accum_buf_size) {
/* Grow the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3512,7 +3553,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
size_t tmp_size=(file->accum_buf_size/H5FD_ACCUM_THROTTLE); /* New size of accumulator buffer */
/* Shrink the accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,tmp_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,tmp_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3534,7 +3575,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Check if we need to reallocate the buffer */
if(size>file->accum_buf_size) {
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3552,7 +3593,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
} /* end if */
else {
/* Dispatch to driver */
- if ((file->cls->write)(file, type, dxpl_id, addr, size, buf)<0)
+ if((file->cls->write)(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
} /* end else */
@@ -3589,16 +3630,16 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing)
H5TRACE3("e","xiIu",file,dxpl_id,closing);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
- if (H5FD_flush(file,dxpl_id,closing)<0)
+ if(H5FD_flush(file,dxpl_id,closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file flush request failed")
done:
@@ -3637,14 +3678,14 @@ H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing)
if((file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA) && file->accum_dirty && file->accum_size>0) {
/* Flush the metadata contents */
/* Not certain if the type and dxpl should be the way they are... -QAK */
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver write request failed")
/* Reset the dirty flag */
file->accum_dirty=FALSE;
} /* end if */
- if (file->cls->flush && (file->cls->flush)(file,dxpl_id,closing)<0)
+ if(file->cls->flush && (file->cls->flush)(file,dxpl_id,closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed")
done:
@@ -3757,8 +3798,6 @@ done:
* Programmer: Quincey Koziol
* Monday, October 6, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -3766,27 +3805,72 @@ H5FD_get_freespace(const H5FD_t *file)
{
H5FD_free_t *free_node; /* Pointer to node on free list */
H5FD_mem_t type; /* Type of memory */
- hssize_t ret_value; /* Return value */
+ haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */
+ hsize_t ma_size; /* Size of "metadata aggregator" */
+ haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */
+ hsize_t sda_size; /* Size of "small data aggregator" */
+ haddr_t eoa; /* End of allocated space in the file */
+ hssize_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI(H5FD_get_freespace, FAIL)
/* check args */
- assert(file);
- assert(file->cls);
+ HDassert(file);
+ HDassert(file->cls);
+
+ /* Retrieve the 'eoa' for the file */
+ eoa = file->cls->get_eoa(file);
+
+ /* Check for aggregating metadata allocations */
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
+ ma_addr = file->eoma;
+ ma_size = file->cur_meta_block_size;
+ } /* end if */
- /* Initialize return value */
- ret_value=0;
+ /* Check for aggregating small data allocations */
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
+ sda_addr = file->eosda;
+ sda_size = file->cur_sdata_block_size;
+ } /* end if */
/* Iterate over all the types of memory, to retrieve amount of free space for each */
- for (type=H5FD_MEM_DEFAULT; type<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) {
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) {
/* Iterate through the free list, accumulating the amount of free space for this type */
free_node = file->fl[type];
while(free_node) {
- ret_value+=(hssize_t)free_node->size;
- free_node=free_node->next;
+ /* Check for current node adjoining the metadata & small data aggregators */
+ if(H5F_addr_eq(free_node->addr + free_node->size, ma_addr)) {
+ ma_addr -= free_node->size;
+ ma_size += free_node->size;
+ } else if(H5F_addr_eq(free_node->addr + free_node->size, sda_addr)) {
+ sda_addr -= free_node->size;
+ sda_size += free_node->size;
+ } else if(H5F_addr_eq(ma_addr + ma_size, free_node->addr))
+ ma_size += free_node->size;
+ else if(H5F_addr_eq(sda_addr + sda_size, free_node->addr))
+ sda_size += free_node->size;
+ else
+ ret_value += (hssize_t)free_node->size;
+ free_node = free_node->next;
} /* end while */
} /* end for */
+ /* Check for aggregating metadata allocations */
+ if(H5F_addr_defined(ma_addr)) {
+ /* Add in the reserved space for metadata to the available free space */
+ /* (if it's not at the tail of the file) */
+ if(H5F_addr_ne(ma_addr + ma_size, eoa))
+ ret_value += ma_size;
+ } /* end if */
+
+ /* Check for aggregating small data allocations */
+ if(H5F_addr_defined(sda_addr)) {
+ /* Add in the reserved space for metadata to the available free space */
+ /* (if it's not at the tail of the file) */
+ if(H5F_addr_ne(sda_addr + sda_size, eoa))
+ ret_value += sda_size;
+ } /* end if */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_get_freespace() */
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 16ec733..d780da4 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -228,17 +228,19 @@ struct H5FD_t {
* allocation region left */
haddr_t eoma; /* End of metadata
* allocated region */
+ /* (ie. beginning of space available) */
/* "Small data" aggregation fields */
- hsize_t def_sdata_block_size; /* "Small data"
- * allocation block size
- * (if aggregating "small
- * data") */
- hsize_t cur_sdata_block_size; /* Current size of "small
- * data" allocation
- * region left */
- haddr_t eosda; /* End of "small data"
- * allocated region */
+ hsize_t def_sdata_block_size; /* "Small data"
+ * allocation block size
+ * (if aggregating "small
+ * data") */
+ hsize_t cur_sdata_block_size; /* Current size of "small
+ * data" allocation
+ * region left */
+ haddr_t eosda; /* End of "small data"
+ * allocated region */
+ /* (ie. beginning of space available) */
/* Metadata accumulator fields */
unsigned char *meta_accum; /* Buffer to hold the accumulated metadata */
diff --git a/src/H5FS.c b/src/H5FS.c
index 673c6ed..94c5303 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -231,6 +231,7 @@ herr_t
H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr)
{
H5FS_t *fspace = NULL; /* Free space header loaded from file */
+ H5FS_prot_t fs_prot; /* Temporary information for protecting free space header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FS_delete, FAIL)
@@ -242,8 +243,14 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC);
HDassert(f);
HDassert(H5F_addr_defined(fs_addr));
+ /* Initialize user data for protecting the free space manager */
+ /* (no class information necessary for delete) */
+ fs_prot.nclasses = 0;
+ fs_prot.classes = NULL;
+ fs_prot.cls_init_udata = NULL;
+
/* Protect the free space header */
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header")
/* Delete serialized section storage, if there are any */
@@ -404,7 +411,7 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
FUNC_ENTER_NOAPI_NOINIT(H5FS_new)
/* Check arguments. */
- HDassert(nclasses || classes);
+ HDassert(nclasses == 0 || (nclasses > 0 && classes));
/*
* Allocate free space structure
diff --git a/src/H5FScache.c b/src/H5FScache.c
index e0ec79a..646cf3e 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -209,9 +209,10 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr);
H5F_DECODE_LENGTH(f, p, fspace->ghost_sect_count);
/* # of section classes */
+ /* (only check if we actually have some classes) */
UINT16DECODE(p, nclasses);
- if(fspace->nclasses != nclasses)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown section class count mismatch")
+ if(fspace->nclasses > 0 && fspace->nclasses != nclasses)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch")
/* Shrink percent */
UINT16DECODE(p, fspace->shrink_percent);
@@ -409,7 +410,8 @@ H5FS_cache_hdr_dest(H5F_t UNUSED *f, H5FS_t *fspace)
} /* end for */
/* Release the memory for the free space section classes */
- fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
+ if(fspace->sect_cls)
+ fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
/* Free free space info */
H5FL_FREE(H5FS_t, fspace);
diff --git a/src/H5G.c b/src/H5G.c
index db049dc..25525c9 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -48,13 +48,13 @@
* | | | file. |
* +--------------+------------+--------------------------------+
* | File ID | "foo/bar" | Find `foo' within `bar' within |
- * | | | the current working group of |
- * | | | the specified file. |
+ * | | | the root group of the specified|
+ * | | | file. |
* +--------------+------------+--------------------------------+
* | File ID | "/" | The root group of the specified|
* | | | file. |
* +--------------+------------+--------------------------------+
- * | File ID | "." | The current working group of |
+ * | File ID | "." | The root group of the specified|
* | | | the specified file. |
* +--------------+------------+--------------------------------+
* | Group ID | "/foo/bar" | Find `foo' within `bar' within |
@@ -93,7 +93,6 @@
#include "H5Pprivate.h" /* Property lists */
/* Local macros */
-#define H5G_INIT_HEAP 8192
#define H5G_RESERVED_ATOMS 0
/* Local typedefs */
@@ -201,7 +200,6 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
-#ifdef H5_GROUP_REVISION
/* Check if we need to create a non-standard GCPL */
if(size_hint > 0) {
H5P_genplist_t *gc_plist; /* Property list created */
@@ -229,7 +227,6 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
} /* end if */
else
-#endif /* H5_GROUP_REVISION */
tmp_gcpl = H5P_GROUP_CREATE_DEFAULT;
/* What file is the group being added to? This may not be the same file
@@ -246,16 +243,19 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
if(NULL == (grp = H5G_create(file, H5AC_dxpl_id, tmp_gcpl, H5P_DEFAULT)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
+ /* Get an ID for the newly created group */
if((grp_id = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ /* Get the new group's location */
if(H5G_loc(grp_id, &grp_loc) <0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get location for new group")
- /* Link the group */
- if( H5L_link(&loc, name, &grp_loc, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
+ /* Link the new group to its parent group */
+ if(H5L_link(&loc, name, &grp_loc, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link to group")
+ /* Set the return value */
ret_value = grp_id;
done:
@@ -277,7 +277,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Gcreate_expand
@@ -345,6 +344,7 @@ H5Gcreate_expand(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
+ /* Create the new group & get its ID */
if(NULL == (grp = H5G_create(loc.oloc->file, H5AC_dxpl_id, gcpl_id, gapl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
if((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
@@ -358,7 +358,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate_expand() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -581,8 +580,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Giterate(hid_t loc_id, const char *name, int *idx_p,
- H5G_iterate_t op, void *op_data)
+H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
+ void *op_data)
{
int last_obj; /* Index of last object looked at */
int idx; /* Internal location to hold index */
@@ -604,7 +603,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
last_obj = 0;
/* Call private function. */
- if((ret_value = H5G_obj_iterate(loc_id, name, idx, &last_obj, op, op_data, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5G_obj_iterate(loc_id, name, H5_ITER_INC, idx, &last_obj, op, op_data, H5AC_ind_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Check for too high of a starting index (ex post facto :-) */
@@ -614,7 +613,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
/* Set the index we stopped at */
if(idx_p)
- *idx_p=last_obj;
+ *idx_p = last_obj;
done:
FUNC_LEAVE_API(ret_value)
@@ -868,7 +867,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_comment() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Gget_create_plist
@@ -937,7 +935,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_create_plist() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -1380,20 +1377,16 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
*/
if (loc == NULL) {
H5P_genplist_t *fc_plist; /* File creation property list */
-#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info parameters */
-#endif /* H5_GROUP_REVISION */
/* Get the file creation property list */
/* (Which is a sub-class of the group creation property class) */
if(NULL == (fc_plist = H5I_object(f->shared->fcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-#ifdef H5_GROUP_REVISION
/* Get the group info property */
if(H5P_get(fc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
-#endif /* H5_GROUP_REVISION */
/* Set up group location for root group */
new_root_loc.oloc = &new_root_oloc;
@@ -1401,11 +1394,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
H5G_loc_reset(&new_root_loc);
loc = &new_root_loc;
- if(H5G_obj_create(f, dxpl_id,
-#ifdef H5_GROUP_REVISION
- &ginfo,
-#endif /* H5_GROUP_REVISION */
- loc->oloc/*out*/) < 0)
+ if(H5G_obj_create(f, dxpl_id, &ginfo, loc->oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
if(1 != H5O_link(loc->oloc, 1, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)")
@@ -1470,9 +1459,7 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
{
H5G_t *grp = NULL; /*new group */
H5P_genplist_t *gc_plist; /* Property list created */
-#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info */
-#endif /* H5_GROUP_REVISION */
unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */
H5G_t *ret_value; /* Return value */
@@ -1495,18 +1482,12 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
if(NULL == (gc_plist = H5I_object(gcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
-#ifdef H5_GROUP_REVISION
/* Get the group info property */
if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get group info")
-#endif /* H5_GROUP_REVISION */
/* Create the group object header */
- if(H5G_obj_create(file, dxpl_id,
-#ifdef H5_GROUP_REVISION
- &ginfo,
-#endif /* H5_GROUP_REVISION */
- &(grp->oloc)/*out*/) < 0)
+ if(H5G_obj_create(file, dxpl_id, &ginfo, &(grp->oloc)/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header")
oloc_init = 1; /* Indicate that the object location information is valid */
@@ -1516,6 +1497,7 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects")
+ /* Set the count of times the object is opened */
grp->shared->fo_count = 1;
/* Set return value */
@@ -1671,11 +1653,8 @@ H5G_open_oid(H5G_t *grp, hid_t dxpl_id)
obj_opened = TRUE;
/* Check if this object has the right message(s) to be treated as a group */
- if(H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id) <= 0
-#ifdef H5_GROUP_REVISION
- && H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, dxpl_id) <= 0
-#endif /* H5_GROUP_REVISION */
- )
+ if((H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id) <= 0)
+ && (H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, dxpl_id) <= 0))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group")
done:
@@ -1931,10 +1910,9 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
/* Info for soft and UD links is gotten by H5L_get_linkinfo. If we have
- * a hard link, follow it and get info on the object */
- if(udata->follow_link || !lnk ||
- (lnk->type == H5L_LINK_HARD)) {
-
+ * a hard link, follow it and get info on the object
+ */
+ if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
/* Get object type */
statbuf->type = H5O_obj_type(obj_loc->oloc, udata->dxpl_id);
if(statbuf->type == H5G_UNKNOWN)
@@ -2029,16 +2007,16 @@ H5G_get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
ret = H5L_get_linkinfo(loc, name, &linfo, H5P_DEFAULT, dxpl_id);
} H5E_END_TRY
- if(ret >=0 && linfo.linkclass != H5L_LINK_HARD)
+ if(ret >=0 && linfo.type != H5L_TYPE_HARD)
{
statbuf->linklen = linfo.u.link_size;
- if(linfo.linkclass == H5L_LINK_SOFT)
+ if(linfo.type == H5L_TYPE_SOFT)
{
statbuf->type = H5G_LINK;
}
else /* UD link. H5L_get_linkinfo checked for invalid link classes */
{
- HDassert(linfo.linkclass >= H5L_LINK_UD_MIN && linfo.linkclass <= H5L_LINK_MAX);
+ HDassert(linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX);
statbuf->type = H5G_UDLINK;
}
}
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
new file mode 100644
index 0000000..f53493c
--- /dev/null
+++ b/src/H5Gbtree2.c
@@ -0,0 +1,376 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Gbtree2.c
+ * Sep 9 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: v2 B-tree callbacks for indexing fields on links
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gpkg.h" /* Groups */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/*
+ * Data exchange structure for dense link storage. This structure is
+ * passed through the fractal heap layer to compare links.
+ */
+typedef struct H5G_fh_ud_cmp_t {
+ /* downward */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ const char *name; /* Name of link to compare */
+ H5B2_found_t found_op; /* Callback when correct link is found */
+ void *found_op_data; /* Callback data when correct link is found */
+
+ /* upward */
+ int cmp; /* Comparison of two link names */
+} H5G_fh_ud_cmp_t;
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* v2 B-tree function callbacks */
+
+/* v2 B-tree driver callbacks */
+static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
+static herr_t H5G_dense_btree2_name_retrieve(void *udata, const void *native);
+static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2);
+static herr_t H5G_dense_btree2_name_encode(const H5F_t *f, uint8_t *raw,
+ const void *native);
+static herr_t H5G_dense_btree2_name_decode(const H5F_t *f, const uint8_t *raw,
+ void *native);
+static herr_t H5G_dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
+ int indent, int fwidth, const void *record, const void *_udata);
+
+/* Fractal heap function callbacks */
+static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
+
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+/* v2 B-tree class for indexing 'name' field of links */
+const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
+ H5B2_GRP_DENSE_NAME_ID, /* Type of B-tree */
+ sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */
+ H5G_dense_btree2_name_store, /* Record storage callback */
+ H5G_dense_btree2_name_retrieve, /* Record retrieval callback */
+ H5G_dense_btree2_name_compare, /* Record comparison callback */
+ H5G_dense_btree2_name_encode, /* Record encoding callback */
+ H5G_dense_btree2_name_decode, /* Record decoding callback */
+ H5G_dense_btree2_name_debug /* Record debugging callback */
+}};
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_fh_name_cmp
+ *
+ * Purpose: Compares the name of a link in a fractal heap to another
+ * name
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_fh_name_cmp)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+ /* Compare the string values */
+ udata->cmp = HDstrcmp(udata->name, lnk->name);
+
+ /* Check for correct link & callback to make */
+ if(udata->cmp == 0 && udata->found_op) {
+ if((udata->found_op)(lnk, udata->found_op_data) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed")
+ } /* end if */
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_fh_name_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_store
+ *
+ * Purpose: Store user information into native record for v2 B-tree
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, September 9, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
+{
+ const H5G_bt2_ud_ins_t *udata = (const H5G_bt2_ud_ins_t *)_udata;
+ H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_store)
+
+ /* Copy user information info native record */
+ nrecord->hash = udata->common.name_hash;
+ HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_store() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_retrieve
+ *
+ * Purpose: Retrieve native information from record for v2 B-tree
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_retrieve(void *udata, const void *nrecord)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_retrieve)
+
+ *(H5G_dense_bt2_name_rec_t *)udata = *(const H5G_dense_bt2_name_rec_t *)nrecord;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_retrieve() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_compare
+ *
+ * Purpose: Compare two native information records, according to some key
+ *
+ * Return: <0 if rec1 < rec2
+ * =0 if rec1 == rec2
+ * >0 if rec1 > rec2
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
+{
+ const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata;
+ const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec;
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_compare)
+
+ /* Sanity check */
+ HDassert(bt2_udata);
+ HDassert(bt2_rec);
+
+#ifdef QAK
+{
+unsigned u;
+
+HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G_dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash);
+HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G_dense_btree2_name_compare", (unsigned)bt2_rec->hash);
+for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
+ HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
+}
+#endif /* QAK */
+ /* Check hash value */
+ if(bt2_udata->name_hash < bt2_rec->hash)
+ HGOTO_DONE(-1)
+ else if(bt2_udata->name_hash > bt2_rec->hash)
+ HGOTO_DONE(1)
+ else {
+ H5G_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t status; /* Status from fractal heap 'op' routine */
+
+ /* Sanity check */
+ HDassert(bt2_udata->name_hash == bt2_rec->hash);
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+ fh_udata.name = bt2_udata->name;
+ fh_udata.found_op = bt2_udata->found_op;
+ fh_udata.found_op_data = bt2_udata->found_op_data;
+
+ /* up */
+ fh_udata.cmp = 0;
+
+ /* Check if the user's link and the B-tree's link have the same name */
+ status = H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id,
+ H5G_dense_fh_name_cmp, &fh_udata);
+ HDassert(status >= 0);
+
+ /* Callback will set comparison value */
+ HGOTO_DONE(fh_udata.cmp)
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5G_dense_btree2_name_compare() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_encode
+ *
+ * Purpose: Encode native information into raw form for storing on disk
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_encode(const H5F_t UNUSED *f, uint8_t *raw, const void *_nrecord)
+{
+ const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_encode)
+
+ /* Encode the record's fields */
+ UINT32ENCODE(raw, nrecord->hash)
+ HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_decode
+ *
+ * Purpose: Decode raw disk form of record into native form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_decode(const H5F_t UNUSED *f, const uint8_t *raw, void *_nrecord)
+{
+ H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_decode)
+
+ /* Decode the record's fields */
+ UINT32DECODE(raw, nrecord->hash)
+ HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_debug
+ *
+ * Purpose: Debug native form of record
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
+ int indent, int fwidth, const void *_nrecord,
+ const void UNUSED *_udata)
+{
+ const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_debug)
+
+ HDfprintf(stream, "%*s%-*s {%lx, ", indent, "", fwidth, "Record:",
+ nrecord->hash);
+ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
+ HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_debug() */
+
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
new file mode 100644
index 0000000..4c31adc
--- /dev/null
+++ b/src/H5Gdense.c
@@ -0,0 +1,1374 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Gdense.c
+ * Sep 9 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: Routines for operating on "dense" link storage for a
+ * group in a file.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Gpkg.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Fractal heap creation parameters for "dense" link storage */
+#define H5G_FHEAP_MAN_WIDTH 4
+#define H5G_FHEAP_MAN_START_BLOCK_SIZE 512
+#define H5G_FHEAP_MAN_MAX_DIRECT_SIZE (64 * 1024)
+#define H5G_FHEAP_MAN_MAX_INDEX 32
+#define H5G_FHEAP_MAN_START_ROOT_ROWS 1
+#define H5G_FHEAP_CHECKSUM_DBLOCKS TRUE
+#define H5G_FHEAP_MAX_MAN_SIZE (4 * 1024)
+
+/* v2 B-tree creation macros for 'name' field index */
+#define H5G_NAME_BT2_NODE_SIZE 512
+#define H5G_NAME_BT2_MERGE_PERC 40
+#define H5G_NAME_BT2_SPLIT_PERC 100
+
+/* v2 B-tree creation macros for 'corder' field index */
+#define H5G_CORDER_BT2_NODE_SIZE 512
+#define H5G_CORDER_BT2_MERGE_PERC 40
+#define H5G_CORDER_BT2_SPLIT_PERC 100
+
+/* Size of stack buffer for serialized link */
+#define H5G_LINK_BUF_SIZE 128
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Data exchange structure to use when building table of links in group */
+typedef struct {
+ H5G_link_table_t *ltable; /* Pointer to link table to build */
+ size_t curr_lnk; /* Current link to operate on */
+} H5G_dense_bt_ud1_t;
+
+/*
+ * Data exchange structure to pass through the v2 B-tree layer for the
+ * H5B2_iterate function when iterating over densely stored links.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+ hbool_t lib_internal; /* Callback is library internal */
+
+ /* downward (from application) */
+ hid_t gid; /* Group ID for application callback */
+ H5G_link_iterate_t op; /* Callback for each link */
+ void *op_data; /* Callback data for each link */
+ int skip; /* Number of links to skip */
+ int *last_lnk; /* Pointer to the last link operated on */
+
+ /* upward */
+ int op_ret; /* Return value from callback */
+} H5G_bt2_it_ud1_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when iterating over densely stored links.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+
+ /* upward */
+ H5O_link_t *lnk; /* Copy of link */
+} H5G_fh_it_ud1_t;
+
+/*
+ * Data exchange structure for dense link storage. This structure is
+ * passed through the v2 B-tree layer when removing links.
+ */
+typedef struct {
+ /* downward */
+ H5G_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
+ hbool_t adj_link; /* Whether to adjust link count on object */
+ hbool_t rem_from_fheap; /* Whether to remove the link from the fractal heap */
+
+ /* upward (for application) */
+ H5G_obj_t *obj_type; /* Type of object being removed */
+} H5G_bt2_ud_rem_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when removing a link from densely stored links.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ hbool_t adj_link; /* Whether to adjust link count on object */
+
+ /* upward (for application) */
+ H5G_obj_t *obj_type; /* Type of object being removed */
+} H5G_fh_rem_ud1_t;
+
+/*
+ * Data exchange structure to pass through the v2 B-tree layer for the
+ * H5B2_index function when retrieving the name of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+
+ /* downward (from application) */
+ char *name; /* Name buffer to fill */
+ size_t name_size; /* Size of name buffer to fill */
+
+ /* upward */
+ ssize_t name_len; /* Full length of name */
+} H5G_bt2_gnbi_ud1_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when retrieving the name of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+
+ /* downward (from application) */
+ char *name; /* Name buffer to fill */
+ size_t name_size; /* Size of name buffer to fill */
+
+ /* upward */
+ ssize_t name_len; /* Full length of name */
+} H5G_fh_gnbi_ud1_t;
+
+/*
+ * Data exchange structure to pass through the v2 B-tree layer for the
+ * H5B2_index function when retrieving the type of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+
+ /* upward */
+ H5G_obj_t type; /* Type of object */
+} H5G_bt2_gtbi_ud1_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when retrieving the type of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+
+ /* upward */
+ H5G_obj_t type; /* Type of object */
+} H5G_fh_gtbi_ud1_t;
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* The v2 B-tree class for indexing 'name' field on links */
+H5_DLLVAR const H5B2_class_t H5G_BT2_NAME[1];
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Declare a free list to manage the serialized link information */
+H5FL_BLK_DEFINE(ser_link);
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_create
+ *
+ * Purpose: Creates dense link storage structures for a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 9 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo)
+{
+ H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
+ H5HF_t *fheap; /* Fractal heap handle */
+ size_t fheap_id_len; /* Fractal heap ID length */
+ size_t bt2_rrec_size; /* v2 B-tree raw record size */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_create, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Set fractal heap creation parameters */
+/* XXX: Give some control of these to applications? */
+ HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam));
+ fheap_cparam.managed.width = H5G_FHEAP_MAN_WIDTH;
+ fheap_cparam.managed.start_block_size = H5G_FHEAP_MAN_START_BLOCK_SIZE;
+ fheap_cparam.managed.max_direct_size = H5G_FHEAP_MAN_MAX_DIRECT_SIZE;
+ fheap_cparam.managed.max_index = H5G_FHEAP_MAN_MAX_INDEX;
+ fheap_cparam.managed.start_root_rows = H5G_FHEAP_MAN_START_ROOT_ROWS;
+ fheap_cparam.checksum_dblocks = H5G_FHEAP_CHECKSUM_DBLOCKS;
+ fheap_cparam.max_man_size = H5G_FHEAP_MAX_MAN_SIZE;
+
+ /* Create fractal heap for storing links */
+ if(NULL == (fheap = H5HF_create(f, dxpl_id, &fheap_cparam)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create fractal heap")
+
+ /* Retrieve the heap's address in the file */
+ if(H5HF_get_heap_addr(fheap, &(linfo->link_fheap_addr)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address")
+#ifdef QAK
+HDfprintf(stderr, "%s: linfo->link_fheap_addr = %a\n", FUNC, linfo->link_fheap_addr);
+#endif /* QAK */
+
+ /* Retrieve the heap's ID length in the file */
+ if(H5HF_get_id_len(fheap, &fheap_id_len) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
+ HDassert(fheap_id_len == H5G_DENSE_FHEAP_ID_LEN);
+#ifdef QAK
+HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
+#endif /* QAK */
+
+ /* Close the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ /* Create the name index v2 B-tree */
+ bt2_rrec_size = 4 + /* Name's hash value */
+ fheap_id_len; /* Fractal heap ID */
+ if(H5B2_create(f, dxpl_id, H5G_BT2_NAME,
+ (size_t)H5G_NAME_BT2_NODE_SIZE, bt2_rrec_size,
+ H5G_NAME_BT2_SPLIT_PERC, H5G_NAME_BT2_MERGE_PERC,
+ &(linfo->name_bt2_addr)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
+#ifdef QAK
+HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr);
+#endif /* QAK */
+
+ /* XXX: Check if we should create a creation order index v2 B-tree */
+ /* XXX: Create the creation order index v2 B-tree */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_insert
+ *
+ * Purpose: Insert a link into the dense link storage structures for a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const H5O_link_t *lnk)
+{
+ H5G_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ size_t link_size; /* Size of serialized link in the heap */
+ uint8_t link_buf[H5G_LINK_BUF_SIZE]; /* Buffer for serializing link */
+ void *link_ptr = NULL; /* Pointer to serialized link */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_insert, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(lnk);
+#ifdef QAK
+HDfprintf(stderr, "%s: linfo->link_fheap_addr = %a\n", FUNC, linfo->link_fheap_addr);
+HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr);
+#endif /* QAK */
+
+ /* Find out the size of buffer needed for serialized link */
+ if((link_size = H5O_raw_size(H5O_LINK_ID, f, lnk)) == 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
+#ifdef QAK
+HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDstrlen(lnk->name), link_size);
+#endif /* QAK */
+
+ /* Allocate space for serialized link, if necessary */
+ if(link_size > sizeof(link_buf)) {
+ if(NULL == (link_ptr = H5FL_BLK_MALLOC(ser_link, link_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "memory allocation failed")
+ } /* end if */
+ else
+ link_ptr = link_buf;
+
+ /* Create serialized form of link */
+ if(H5O_encode(f, link_ptr, lnk, H5O_LINK_ID) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Insert the serialized link into the fractal heap */
+ if(H5HF_insert(fheap, dxpl_id, link_size, link_ptr, udata.id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into fractal heap")
+
+ /* Create the callback information for v2 B-tree record insertion */
+ udata.common.f = f;
+ udata.common.dxpl_id = dxpl_id;
+ udata.common.fheap = fheap;
+ udata.common.name = lnk->name;
+ udata.common.name_hash = H5_checksum_lookup3(lnk->name, HDstrlen(lnk->name));
+ udata.common.found_op = NULL;
+ udata.common.found_op_data = NULL;
+ /* udata.id already set in H5HF_insert() call */
+
+ /* Insert link into 'name' tracking v2 B-tree */
+ if(H5B2_insert(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
+
+ /* XXX: Check if we should create a creation order index v2 B-tree record */
+ /* XXX: Insert the record into the creation order index v2 B-tree */
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(link_ptr && link_ptr != link_buf)
+ H5FL_BLK_FREE(ser_link, link_ptr);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_lookup_cb
+ *
+ * Purpose: Callback when a link is located in the 'name' index
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_lookup_cb(const void *_lnk, void *_user_lnk)
+{
+ const H5O_link_t *lnk = (const H5O_link_t *)_lnk; /* Record from B-tree */
+ H5O_link_t *user_lnk = (H5O_link_t *)_user_lnk; /* User data from v2 B-tree link lookup */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_lookup_cb)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(lnk);
+ HDassert(user_lnk);
+
+ /* Check if we want the link information */
+ if(user_lnk) {
+ /* Copy link information */
+ if(H5O_copy(H5O_LINK_ID, lnk, user_lnk) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5O_ITER_ERROR, "can't copy link message")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_lookup_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_lookup
+ *
+ * Purpose: Look up a link within a group that uses dense link storage
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const char *name, H5O_link_t *lnk)
+{
+ H5G_bt2_ud_common_t udata; /* User data for v2 B-tree link lookup */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_lookup, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(name && *name);
+ HDassert(lnk);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Construct the user data for v2 B-tree callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+ udata.name = name;
+ udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name));
+ udata.found_op = H5G_dense_lookup_cb; /* v2 B-tree comparison callback */
+ udata.found_op_data = lnk;
+
+ /* Find & copy the named link in the 'name' index */
+ if(H5B2_find(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in name index")
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_lookup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_build_table_cb
+ *
+ * Purpose: Callback routine for building table of links from dense
+ * link storage.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 25 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_build_table_cb(const H5O_link_t *lnk, void *_udata)
+{
+ H5G_dense_bt_ud1_t *udata = (H5G_dense_bt_ud1_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5B2_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_build_table_cb)
+
+ /* check arguments */
+ HDassert(lnk);
+ HDassert(udata);
+ HDassert(udata->curr_lnk < udata->ltable->nlinks);
+
+ /* Copy link information */
+ if(H5O_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5B2_ITER_ERROR, "can't copy link message")
+
+ /* Increment number of links stored */
+ udata->curr_lnk++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_build_table_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_build_table
+ *
+ * Purpose: Builds a table containing a sorted (alphabetically) list of
+ * links for a group
+ *
+ * Note: Used for building table of links in non-native iteration order
+ * for an index
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Sep 25, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, H5G_link_table_t *ltable)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_build_table)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(ltable);
+
+ /* Set size of table */
+ H5_CHECK_OVERFLOW(linfo->nlinks, /* From: */ hsize_t, /* To: */ size_t);
+ ltable->nlinks = (size_t)linfo->nlinks;
+
+ /* Allocate space for the table entries */
+ if(ltable->nlinks > 0) {
+ H5G_dense_bt_ud1_t udata; /* User data for iteration callback */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+
+ /* Allocate the table to store the links */
+ if((ltable->lnks = H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Set up user data for iteration */
+ udata.ltable = ltable;
+ udata.curr_lnk = 0;
+
+ /* Build iterator operator */
+ lnk_op.lib_op = H5G_dense_build_table_cb;
+
+ /* Iterate over the links in the group, building a table of the link messages */
+ if(H5G_dense_iterate(f, dxpl_id, H5_ITER_NATIVE, 0, linfo, TRUE, 0, NULL, lnk_op, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+
+ /* Sort link table in correct iteration order */
+ /* (XXX: by name, currently) */
+ if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_inc);
+ else if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_dec);
+ else
+ HDassert(order == H5_ITER_NATIVE);
+ } /* end if */
+ else
+ ltable->lnks = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_build_table() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_iterate_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator, to make user's callback
+ * when iterating over links
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_iterate_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_it_ud1_t *udata = (H5G_fh_it_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_iterate_fh_cb)
+
+ /* Decode link information & keep a copy */
+ /* (we make a copy instead of calling the user/library callback directly in
+ * this routine because this fractal heap 'op' callback routine is called
+ * with the direct block protected and if the callback routine invokes an
+ * HDF5 routine, it could attempt to re-protect that direct block for the
+ * heap, causing the HDF5 routine called to fail)
+ */
+ if(NULL == (udata->lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_iterate_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_iterate_bt2_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage iterator
+ *
+ * Return: H5B2_ITER_ERROR/H5B2_ITER_CONT/H5B2_ITER_STOP
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_it_ud1_t *bt2_udata = (H5G_bt2_it_ud1_t *)_bt2_udata; /* User data for callback */
+ int ret_value = H5B2_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_iterate_bt2_cb)
+
+ /* Check for skipping links */
+ if(bt2_udata->skip > 0)
+ --bt2_udata->skip;
+ else {
+ H5G_fh_it_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+
+ /* Call fractal heap 'op' routine, to copy the link information */
+ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, record->id,
+ H5G_dense_iterate_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5B2_ITER_ERROR, "link found callback failed")
+
+ /* Check for internal callback with link info */
+ if(bt2_udata->lib_internal)
+ /* Call the library's callback */
+ ret_value = (bt2_udata->op.lib_op)(fh_udata.lnk, bt2_udata->op_data);
+ else
+ /* Make the application's callback */
+ ret_value = (bt2_udata->op.app_op)(bt2_udata->gid, fh_udata.lnk->name, bt2_udata->op_data);
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, fh_udata.lnk);
+ } /* end else */
+
+ /* Increment the number of entries passed through */
+ /* (whether we skipped them or not) */
+ if(bt2_udata->last_lnk)
+ (*bt2_udata->last_lnk)++;
+
+ /* Check for callback failure and pass along return value */
+ if(ret_value < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_iterate_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_iterate
+ *
+ * Purpose: Iterate over the objects in a group using dense link storage
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, H5_iter_order_t order, hid_t gid,
+ const H5O_linfo_t *linfo, hbool_t lib_internal, int skip, int *last_lnk,
+ H5G_link_iterate_t op, void *op_data)
+{
+ H5G_bt2_it_ud1_t udata; /* User data for iterator callback */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_iterate, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(op.lib_op);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Check on iteration order */
+ /* ("native" iteration order is unordered for this link storage mechanism) */
+ if(order == H5_ITER_NATIVE) {
+ /* Construct the user data for v2 B-tree iterator callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+ udata.lib_internal = lib_internal;
+ udata.gid = gid;
+ udata.skip = skip;
+ udata.last_lnk = last_lnk;
+ udata.op = op;
+ udata.op_data = op_data;
+
+ /* Iterate over the records in the v2 B-tree */
+ /* (XXX: by name, currently) */
+ if((ret_value = H5B2_iterate(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr,
+ H5G_dense_iterate_bt2_cb, &udata)) < 0)
+ HERROR(H5E_SYM, H5E_BADITER, "link iteration failed");
+ } /* end if */
+ else {
+ H5G_link_table_t ltable; /* Table of links */
+ size_t u; /* Local index variable */
+
+ /* Build the table of links for this group */
+ if(H5G_dense_build_table(f, dxpl_id, linfo, order, &ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+
+ /* Iterate over link messages */
+ for(u = 0, ret_value = H5B_ITER_CONT; u < ltable.nlinks && !ret_value; u++) {
+ if(skip > 0)
+ --skip;
+ else {
+ /* Check for internal callback with link info */
+ if(lib_internal)
+ ret_value = (op.lib_op)(&(ltable.lnks[u]), op_data);
+ else
+ ret_value = (op.app_op)(gid, ltable.lnks[u].name, op_data);
+ } /* end else */
+
+ /* Increment the number of entries passed through */
+ /* (whether we skipped them or not) */
+ if(last_lnk)
+ (*last_lnk)++;
+ } /* end for */
+
+ /* Check for callback failure and pass along return value */
+ if(ret_value < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+
+ /* Free link table information */
+ if(H5G_obj_release_table(&ltable) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
+ } /* end else */
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_name_by_idx_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator, to retrieve name according
+ * to an index
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_gnbi_ud1_t *udata = (H5G_fh_gnbi_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_name_by_idx_fh_cb)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+ /* Get the length of the name */
+ udata->name_len = (ssize_t)HDstrlen(lnk->name);
+
+ /* Copy the name into the user's buffer, if given */
+ if(udata->name) {
+ HDstrncpy(udata->name, lnk->name, MIN((size_t)(udata->name_len + 1), udata->name_size));
+ if((size_t)udata->name_len >= udata->name_size)
+ udata->name[udata->name_size - 1] = '\0';
+ } /* end if */
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_name_by_idx_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_name_by_idx_bt2_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage 'get name by idx' call
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_gnbi_ud1_t *bt2_udata = (H5G_bt2_gnbi_ud1_t *)_bt2_udata; /* User data for callback */
+ H5G_fh_gnbi_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_name_by_idx_bt2_cb)
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+ fh_udata.name = bt2_udata->name;
+ fh_udata.name_size = bt2_udata->name_size;
+
+ /* Call fractal heap 'op' routine, to perform user callback */
+ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, record->id,
+ H5G_dense_get_name_by_idx_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed")
+
+ /* Set the name's full length to return */
+ bt2_udata->name_len = fh_udata.name_len;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_name_by_idx_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_name_by_idx
+ *
+ * Purpose: Returns the name of objects in the group by giving index.
+ *
+ * Return: Success: Non-negative, length of name
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ hsize_t idx, char* name, size_t size)
+{
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_gnbi_ud1_t udata; /* User data for v2 B-tree callback */
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_get_name_by_idx, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+ udata.name = name;
+ udata.name_size = size;
+
+ /* Retrieve the name according to the v2 B-tree's index order */
+ /* (XXX: using name index currently) */
+ if(H5B2_index(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, idx,
+ H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
+
+ /* Set return value */
+ ret_value = udata.name_len;
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_name_by_idx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_type_by_idx_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator, to retrieve type according
+ * to an index
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_type_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_gtbi_ud1_t *udata = (H5G_fh_gtbi_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_type_by_idx_fh_cb)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+ /* Get the type of the link */
+ /* Determine type of object */
+ if(lnk->type == H5L_TYPE_SOFT)
+ udata->type = H5G_LINK;
+ else if(lnk->type >= H5L_TYPE_UD_MIN)
+ udata->type = H5G_UDLINK;
+ else if(lnk->type == H5L_TYPE_HARD) {
+ H5O_loc_t tmp_oloc; /* Temporary object location */
+
+ /* Build temporary object location */
+ tmp_oloc.file = udata->f;
+ tmp_oloc.addr = lnk->u.hard.addr;
+
+ /* Get the type of the object */
+ if((udata->type = H5O_obj_type(&tmp_oloc, udata->dxpl_id)) == H5G_UNKNOWN)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine object type")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown link type")
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_type_by_idx_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_type_by_idx_bt2_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage 'get type by idx' call
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_type_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_gtbi_ud1_t *bt2_udata = (H5G_bt2_gtbi_ud1_t *)_bt2_udata; /* User data for callback */
+ H5G_fh_gtbi_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_type_by_idx_bt2_cb)
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+
+ /* Call fractal heap 'op' routine, to perform user callback */
+ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, record->id,
+ H5G_dense_get_type_by_idx_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed")
+
+ /* Set the link's type to return */
+ bt2_udata->type = fh_udata.type;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_type_by_idx_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_type_by_idx
+ *
+ * Purpose: Returns the type of objects in the group by giving index.
+ *
+ * Return: Success: Non-negative, length of name
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+H5G_obj_t
+H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ hsize_t idx)
+{
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_gtbi_ud1_t udata; /* User data for v2 B-tree callback */
+ H5G_obj_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_get_type_by_idx, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+
+ /* Retrieve the name according to the v2 B-tree's index order */
+ /* (XXX: using name index currently) */
+ if(H5B2_index(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, idx,
+ H5G_dense_get_type_by_idx_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
+
+ /* Set return value */
+ ret_value = udata.type;
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_type_by_idx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_remove_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator when removing over links
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_rem_ud1_t *udata = (H5G_fh_rem_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_fh_cb)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5B2_ITER_ERROR, "can't decode link")
+
+ /* Retrieve the link's object type & decr. the ref. count on hard links, if requested */
+ switch(lnk->type) {
+ case H5L_TYPE_HARD:
+ {
+ H5O_loc_t tmp_oloc; /* Temporary object location */
+
+ /* Build temporary object location */
+ tmp_oloc.file = udata->f;
+ tmp_oloc.addr = lnk->u.hard.addr;
+
+ /* Get the type of the object */
+ /* Note: no way to check for error :-( */
+ if(udata->obj_type)
+ *(udata->obj_type) = H5O_obj_type(&tmp_oloc, udata->dxpl_id);
+
+ /* Decrement the ref count for the object, if requested */
+ if(udata->adj_link)
+ if(H5O_link(&tmp_oloc, -1, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to decrement object link count")
+ }
+ break;
+
+ case H5L_TYPE_SOFT:
+ if(udata->obj_type)
+ *(udata->obj_type) = H5G_LINK;
+ break;
+
+ default: /* User-defined link */
+ if(lnk->type < H5L_TYPE_UD_MIN)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
+ if(udata->obj_type)
+ *(udata->obj_type) = H5G_UDLINK;
+ } /* end switch */
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_remove_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_remove_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage record removal
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_ud_rem_t *bt2_udata = (H5G_bt2_ud_rem_t *)_bt2_udata; /* User data for callback */
+ H5G_fh_rem_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_bt2_cb)
+
+ /* Set up the user data for fractalheap 'op' callback */
+ fh_udata.f = bt2_udata->common.f;
+ fh_udata.dxpl_id = bt2_udata->common.dxpl_id;
+ fh_udata.adj_link = bt2_udata->adj_link;
+ fh_udata.obj_type = bt2_udata->obj_type;
+
+ /* Call fractal heap 'op' routine, to perform user callback */
+ if(H5HF_op(bt2_udata->common.fheap, bt2_udata->common.dxpl_id, record->id,
+ H5G_dense_remove_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed")
+
+ /* Remove record from fractal heap, if requested */
+ if(bt2_udata->rem_from_fheap)
+ if(H5HF_remove(bt2_udata->common.fheap, bt2_udata->common.dxpl_id, record->id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from fractal heap")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_remove_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_remove
+ *
+ * Purpose: Remove a link from the dense storage of a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const char *name, H5G_obj_t *obj_type)
+{
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_ud_rem_t udata; /* User data for v2 B-tree record removal */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_remove, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(name && *name);
+ HDassert(obj_type);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.common.f = f;
+ udata.common.dxpl_id = dxpl_id;
+ udata.common.fheap = fheap;
+ udata.common.name = name;
+ udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name));
+ udata.common.found_op = NULL;
+ udata.common.found_op_data = NULL;
+ udata.adj_link = TRUE;
+ udata.rem_from_fheap = TRUE;
+ udata.obj_type = obj_type;
+
+ /* Remove the record from the name index v2 B-tree */
+ if(H5B2_remove(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr,
+ &udata, H5G_dense_remove_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree")
+
+/* XXX: Remove the link from the creation order index v2 B-tree */
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_remove() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_delete
+ *
+ * Purpose: Delete the dense storage for a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_delete, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Check if we are to adjust the ref. count for all the links */
+ if(adj_link) {
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_ud_rem_t udata; /* User data for v2 B-tree record removal */
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.common.f = f;
+ udata.common.dxpl_id = dxpl_id;
+ udata.common.fheap = fheap;
+ udata.common.name = NULL;
+ udata.common.name_hash = 0;
+ udata.common.found_op = NULL;
+ udata.common.found_op_data = NULL;
+ udata.adj_link = TRUE;
+ udata.rem_from_fheap = FALSE;
+ udata.obj_type = NULL;
+
+ /* Delete the name index, adjusting the ref. count on links removed */
+ if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, H5G_dense_remove_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
+
+ /* Close the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ } /* end if */
+ else {
+ /* Delete the name index, without adjusting the ref. count on the links */
+ if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
+ } /* end else */
+ linfo->name_bt2_addr = HADDR_UNDEF;
+
+/* XXX: Check if we should delete the creation order index v2 B-tree */
+
+ /* Delete the fractal heap */
+ if(H5HF_delete(f, dxpl_id, linfo->link_fheap_addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete fractal heap")
+ linfo->link_fheap_addr = HADDR_UNDEF;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_delete() */
+
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 31304b4..35fe13a 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -43,29 +43,29 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5Glink(hid_t cur_loc_id, H5L_link_t type, const char *cur_name, const char *new_name)
+H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, const char *new_name)
{
herr_t ret_value;
FUNC_ENTER_API(H5Glink, FAIL)
H5TRACE4("e","iLlss",cur_loc_id,type,cur_name,new_name);
- if(type == H5L_LINK_HARD)
+ if(type == H5L_TYPE_HARD)
{
- if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
+ if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
- else if(type == H5L_LINK_SOFT)
+ else if(type == H5L_TYPE_SOFT)
{
- if((ret_value = H5Lcreate_soft(cur_name, cur_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
+ if((ret_value = H5Lcreate_soft(cur_name, cur_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Glink() */
/*-------------------------------------------------------------------------
@@ -77,7 +77,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_link_t type,
+H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type,
hid_t new_loc_id, const char *new_name)
{
herr_t ret_value;
@@ -85,11 +85,11 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_link_t type,
FUNC_ENTER_API(H5Glink2, FAIL)
H5TRACE5("e","isLlis",cur_loc_id,cur_name,type,new_loc_id,new_name);
- if(type == H5L_LINK_HARD) {
+ if(type == H5L_TYPE_HARD) {
if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, new_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
- else if(type == H5L_LINK_SOFT) {
+ else if(type == H5L_TYPE_SOFT) {
/* Soft links only need one location, the new_loc_id, but it's possible that
* new_loc_id is H5L_SAME_LOC */
if(new_loc_id == H5L_SAME_LOC)
diff --git a/src/H5Gent.c b/src/H5Gent.c
index f242bad..ad6a083 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -183,11 +183,6 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
UINT32DECODE (*pp, ent->cache.slink.lval_offset);
break;
- case H5G_CACHED_ULINK:
- UINT32DECODE (*pp, ent->cache.ulink.udata_size);
- UINT32DECODE (*pp, ent->cache.ulink.udata_offset);
- UINT32DECODE (*pp, ent->cache.ulink.link_type);
- break;
default:
/* Error or unknown type. Bail out. */
return -1;
@@ -302,12 +297,6 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
UINT32ENCODE (*pp, ent->cache.slink.lval_offset);
break;
- case H5G_CACHED_ULINK:
- UINT32ENCODE (*pp, ent->cache.ulink.udata_size);
- UINT32ENCODE (*pp, ent->cache.ulink.udata_offset);
- UINT32ENCODE (*pp, ent->cache.ulink.link_type);
- break;
-
default:
/* Unknown cached type. Bail out. */
return -1;
@@ -411,10 +400,8 @@ H5G_ent_reset(H5G_entry_t *ent)
*
* Purpose: Convert a link to a symbol table entry
*
- * Return: Success: Non-negative, with *pp pointing to the first byte
- * after the last symbol.
- *
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -450,12 +437,12 @@ H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name, const H5O_link_t
/* Build correct information for symbol table entry based on link type */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
ent->type = H5G_NOTHING_CACHED;
ent->header = lnk->u.hard.addr;
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
{
size_t lnk_offset; /* Offset to sym-link value */
@@ -470,24 +457,7 @@ H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name, const H5O_link_t
break;
default:
- if(lnk->type < H5L_LINK_UD_MIN)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
-
- {
- size_t udata_offset = (size_t) (-1); /* Offset to data buffer */
-
- if(lnk->u.ud.size > 0)
- {
- if((size_t)(-1) == (udata_offset = H5HL_insert(f, dxpl_id,
- heap_addr, lnk->u.ud.size, lnk->u.ud.udata)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write user data to local heap")
- }
-
- ent->type = H5G_CACHED_ULINK;
- ent->cache.ulink.udata_size = lnk->u.ud.size;
- ent->cache.ulink.udata_offset = udata_offset;
- ent->cache.ulink.link_type = lnk->type;
- }
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
} /* end switch */
/* Set the file for the entry */
@@ -536,7 +506,7 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
ent->dirty ? "Yes" : "No");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
"Cache info type:");
- switch (ent->type) {
+ switch(ent->type) {
case H5G_NOTHING_CACHED:
HDfprintf(stream, "Nothing Cached\n");
break;
@@ -554,88 +524,30 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
break;
case H5G_CACHED_SLINK:
- HDfprintf (stream, "Symbolic Link\n");
+ HDfprintf(stream, "Symbolic Link\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
"Cached information:");
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
+ HDfprintf(stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"Link value offset:",
(unsigned long)(ent->cache.slink.lval_offset));
- if (heap>0 && H5F_addr_defined(heap)) {
+ if(heap > 0 && H5F_addr_defined(heap)) {
const H5HL_t *heap_ptr;
heap_ptr = H5HL_protect(ent->file, dxpl_id, heap);
lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.slink.lval_offset);
- HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"Link value:",
lval);
H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET);
- }
+ } /* end if */
else
HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given, name not displayed!");
break;
- case H5G_CACHED_ULINK:
- if(ent->cache.ulink.link_type == H5L_LINK_EXTERNAL)
- {
- HDfprintf (stream, "External Link\n");
- HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
- "Cached information:");
- if(ent->cache.ulink.udata_size > 0)
- {
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data offset:",
- (unsigned long)(ent->cache.ulink.udata_offset));
- }
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data size:",
- (unsigned long)(ent->cache.ulink.udata_size));
- if (heap>0 && H5F_addr_defined(heap)) {
- const H5HL_t *heap_ptr;
- char * filename;
- char * pathname;
-
- heap_ptr = H5HL_protect(ent->file, dxpl_id, heap);
- lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.ulink.udata_offset);
- if(H5Lunpack_elink_val(lval, &filename, &pathname) < 0) return FAIL;
-
- HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
- "External link file name:",
- lval);
- HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
- "External link object name:",
- pathname);
- H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET);
- } else {
- HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given!");
- }
- }
- else
- {
- HDfprintf (stream, "User-defined Link\n");
- HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
- "Cached information:");
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "Link class:",
- (unsigned long)(ent->cache.ulink.link_type));
- if(ent->cache.ulink.udata_size > 0)
- {
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data offset:",
- (unsigned long)(ent->cache.ulink.udata_offset));
- }
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data size:",
- (unsigned long)(ent->cache.ulink.udata_size));
- if (heap<=0 || !H5F_addr_defined(heap)) {
- HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given!");
- }
- }
- break;
-
default:
HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type);
break;
- }
+ } /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED);
}
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 018088e..ab9fdce 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -33,15 +33,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#ifdef H5_GROUP_REVISION
/* Private typedefs */
-/* Data structure to hold table of links for a group */
-typedef struct {
- size_t nlinks; /* # of links in table */
- H5O_link_t *lnks; /* Pointer to array of links */
-} H5G_link_table_t;
-
/* User data for link message iteration when building link table */
typedef struct {
H5G_link_table_t *ltable; /* Pointer to link table to build */
@@ -93,37 +86,9 @@ typedef struct {
/* Private macros */
/* PRIVATE PROTOTYPES */
-static int H5G_link_cmp_name(const void *lnk1, const void *lnk2);
static herr_t H5G_link_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
static herr_t H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id,
- H5G_link_table_t *ltable);
-static herr_t H5G_link_release_table(H5G_link_table_t *ltable);
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G_link_cmp_name
- *
- * Purpose: Callback routine for comparing two link messages.
- *
- * Return: An integer less than, equal to, or greater than zero if the
- * first argument is considered to be respectively less than,
- * equal to, or greater than the second. If two members compare
- * as equal, their order in the sorted array is undefined.
- * (i.e. same as strcmp())
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Sep 5 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5G_link_cmp_name(const void *lnk1, const void *lnk2)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_link_cmp_name)
-
- FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
-} /* end H5G_link_cmp_name() */
+ const H5O_linfo_t *linfo, H5_iter_order_t order, H5G_link_table_t *ltable);
/*-------------------------------------------------------------------------
@@ -181,23 +146,21 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, H5G_link_table_t *ltable)
+H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, H5G_link_table_t *ltable)
{
- H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_link_build_table)
/* Sanity check */
HDassert(oloc);
-
- /* Retrieve the link info */
- if(NULL == H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+ HDassert(linfo);
+ HDassert(ltable);
/* Set size of table */
- H5_CHECK_OVERFLOW(linfo.nlinks, hsize_t, size_t);
- ltable->nlinks = (size_t)linfo.nlinks;
+ H5_CHECK_OVERFLOW(linfo->nlinks, hsize_t, size_t);
+ ltable->nlinks = (size_t)linfo->nlinks;
/* Allocate space for the table entries */
if(ltable->nlinks > 0) {
@@ -214,8 +177,14 @@ H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, H5G_link_table_t *ltable)
if(H5O_iterate(oloc, H5O_LINK_ID, H5G_link_build_table_cb, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
- /* Sort link table (XXX: alphabetically, for now) */
- HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_name);
+ /* Sort link table in correct iteration order */
+ /* (XXX: by name, currently) */
+ if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_inc);
+ else if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_dec);
+ else
+ HDassert(order == H5_ITER_NATIVE);
} /* end if */
else
ltable->lnks = NULL;
@@ -226,133 +195,186 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_link_release_table
+ * Function: H5G_link_convert
*
- * Purpose: Release table containing a list of links for a group
+ * Purpose: Convert a symbol table entry to a link
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * Sep 6, 2005
+ * koziol@hdfgroup.org
+ * Sep 16 2006
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5G_link_release_table(H5G_link_table_t *ltable)
+herr_t
+H5G_link_convert(H5F_t *f, hid_t dxpl_id, H5O_link_t *lnk, haddr_t lheap_addr,
+ const H5G_entry_t *ent, const char *name)
{
- size_t u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5G_link_release_table)
+ FUNC_ENTER_NOAPI(H5G_link_convert, FAIL)
- /* Sanity check */
- HDassert(ltable);
+ /* check arguments */
+ HDassert(f);
+ HDassert(lnk);
+ HDassert(ent);
- /* Release link info, if any */
- if(ltable->nlinks > 0) {
- /* Free link message information */
- for(u = 0; u < ltable->nlinks; u++)
- if(H5O_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message")
+ /* Set (default) common info for link */
+ lnk->cset = H5F_CRT_DEFAULT_CSET;
+ lnk->corder = 0;
+ lnk->corder_valid = FALSE; /* Creation order not valid for this link */
+ lnk->name = H5MM_xstrdup(name);
- /* Free table of links */
- H5MM_xfree(ltable->lnks);
- } /* end if */
- else
- HDassert(ltable->lnks == NULL);
+ /* Object is a symbolic or hard link */
+ switch(ent->type) {
+ case H5G_CACHED_SLINK:
+ {
+ const char *s; /* Pointer to link value */
+ const H5HL_t *heap; /* Pointer to local heap for group */
+
+ /* Lock the local heap */
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, lheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
+
+ s = H5HL_offset_into(f, heap, ent->cache.slink.lval_offset);
+
+ /* Copy the link value */
+ lnk->u.soft.name = H5MM_xstrdup(s);
+
+ /* Release the local heap */
+ if(H5HL_unprotect(f, dxpl_id, heap, lheap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
+
+ /* Set link type */
+ lnk->type = H5L_TYPE_SOFT;
+ }
+ break;
+
+ default:
+ /* Set address of object */
+ lnk->u.hard.addr = ent->header;
+
+ /* Set link type */
+ lnk->type = H5L_TYPE_HARD;
+ break;
+ } /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_release_table() */
+} /* end H5G_link_convert() */
/*-------------------------------------------------------------------------
- * Function: H5G_link_convert
+ * Function: H5G_link_copy_file
*
- * Purpose: Converts a group entry into a link object.
+ * Purpose: Copy a link and the object it points to from one file to
+ * another.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Sep 5 2005
+ * koziol@hdfgroup.org
+ * Sep 29 2006
*
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_convert(H5O_link_t *lnk, const H5G_entry_t *ent, const H5HL_t *heap,
- const char *name)
+H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
+ const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info)
{
+ H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */
+ const H5O_link_t *src_lnk = _src_lnk; /* Source link */
+ hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_link_convert, FAIL)
+ FUNC_ENTER_NOAPI(H5G_link_copy_file, FAIL)
- /* Check arguments. */
- HDassert(lnk);
- HDassert(ent);
- HDassert(name);
+ /* check arguments */
+ HDassert(dst_file);
+ HDassert(src_lnk);
+ HDassert(dst_lnk);
+ HDassert(cpy_info);
+
+ /* Expand soft link */
+ if(H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) {
+ H5G_stat_t statbuf; /* Information about object pointed to by soft link */
+ H5G_loc_t grp_loc; /* Group location holding soft link */
+ H5G_name_t grp_path; /* Path for group holding soft link */
+
+ /* Make a temporary copy, so that it will not change the info in the cache */
+ if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy message")
+
+ /* Set up group location for soft link to start in */
+ H5G_name_reset(&grp_path);
+ grp_loc.path = &grp_path;
+ grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
+
+ /* Check if the object pointed by the soft link exists in the source file */
+ /* (It would be more efficient to make a specialized traversal callback,
+ * but this is good enough for now... -QAK)
+ */
+ if(H5G_get_objinfo(&grp_loc, tmp_src_lnk.u.soft.name, TRUE, &statbuf, dxpl_id) >= 0) {
+ /* Convert soft link to hard link */
+ tmp_src_lnk.u.soft.name = H5MM_xfree(tmp_src_lnk.u.soft.name);
+ tmp_src_lnk.type = H5L_TYPE_HARD;
+#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
+ tmp_src_lnk.u.hard.addr = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
+#else
+ tmp_src_lnk.u.hard.addr = statbuf.objno[0];
+#endif
+ src_lnk = &tmp_src_lnk;
+ } /* end if */
+ else {
+ /* Discard any errors from a dangling soft link */
+ H5E_clear_stack(NULL);
- /* Create link message from object entry */
- HDassert(ent->type == H5G_NOTHING_CACHED || ent->type == H5G_CACHED_SLINK
- || ent->type == H5G_CACHED_ULINK);
-/* XXX: Set character set & creation time for real? */
- lnk->cset = H5F_CRT_DEFAULT_CSET;
- lnk->ctime = 0;
- lnk->name = H5MM_xstrdup(name); /* Casting away const OK -QAK */
- HDassert(lnk->name);
- switch(ent->type) {
- case H5G_NOTHING_CACHED:
- lnk->type = H5L_LINK_HARD;
- lnk->u.hard.addr = ent->header;
- break;
+ /* Release any information copied for temporary src link */
+ H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
+ } /* end else */
+ } /* end if */
- case H5G_CACHED_SLINK:
- {
- const char *s; /* Pointer to link value in heap */
+ /* Copy src link information to dst link information */
+ if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, dst_lnk))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy message")
+ dst_lnk_init = TRUE;
- lnk->type = H5L_LINK_SOFT;
+ /* Check if object in source group is a hard link & copy it */
+ if(H5L_TYPE_HARD == src_lnk->type) {
+ H5O_loc_t new_dst_oloc; /* Copied object location in destination */
+ H5O_loc_t tmp_src_oloc; /* Temporary object location for source object */
- s = H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset);
- HDassert(s);
+ /* Set up copied object location to fill in */
+ H5O_loc_reset(&new_dst_oloc);
+ new_dst_oloc.file = dst_file;
- /* Copy to link */
- lnk->u.soft.name = H5MM_xstrdup(s);
- HDassert(lnk->u.soft.name);
- }
- break;
+ /* Build temporary object location for source */
+ H5O_loc_reset(&tmp_src_oloc);
+ tmp_src_oloc.file = src_oloc->file;
+ HDassert(H5F_addr_defined(src_lnk->u.hard.addr));
+ tmp_src_oloc.addr = src_lnk->u.hard.addr;
- case H5G_CACHED_ULINK:
- {
- const char *s; /* Pointer to link name in heap */
-
- /* Copy link type and udata size from entry info */
- lnk->type = ent->cache.ulink.link_type;
- lnk->u.ud.size = ent->cache.ulink.udata_size;
-
- /* Get pointer to udata in heap */
- s = H5HL_offset_into(ent->file, heap, ent->cache.ulink.udata_offset);
- HDassert(s);
-
- /* Read udata from heap if it exists */
- if(lnk->u.ud.size > 0)
- {
- if(NULL== (lnk->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for user link data")
- HDmemcpy(lnk->u.ud.udata, s, lnk->u.ud.size);
- }
- else
- lnk->u.ud.udata = NULL;
- }
- break;
+ /* Copy the shared object from source to destination */
+ if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy object")
- default:
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
- } /* end switch */
+ /* Copy new destination object's information for eventual insertion */
+ dst_lnk->u.hard.addr = new_dst_oloc.addr;
+ } /* end if */
done:
+ /* Check if we used a temporary src link */
+ if(src_lnk != _src_lnk) {
+ HDassert(src_lnk == &tmp_src_lnk);
+ H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
+ } /* end if */
+ if(ret_value < 0)
+ if(dst_lnk_init)
+ H5O_reset(H5O_LINK_ID, dst_lnk);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_convert() */
+} /* end H5G_link_copy_file() */
/*-------------------------------------------------------------------------
@@ -396,7 +418,7 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -405,8 +427,8 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
- size_t size, hid_t dxpl_id)
+H5G_link_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
ssize_t ret_value; /* Return value */
@@ -417,7 +439,7 @@ H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
+ if(H5G_link_build_table(oloc, dxpl_id, linfo, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
@@ -438,7 +460,7 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
- if(H5G_link_release_table(&ltable) < 0)
+ if(H5G_obj_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
@@ -460,7 +482,8 @@ done:
*-------------------------------------------------------------------------
*/
H5G_obj_t
-H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
+H5G_link_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ hsize_t idx)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
H5G_obj_t ret_value; /* Return value */
@@ -471,7 +494,7 @@ H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
+ if(H5G_link_build_table(oloc, dxpl_id, linfo, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
/* Check for going out of bounds */
@@ -479,11 +502,11 @@ H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
- if(ltable.lnks[idx].type == H5L_LINK_SOFT)
+ if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
ret_value = H5G_LINK;
- else if(ltable.lnks[idx].type >= H5L_LINK_UD_MIN)
+ else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
ret_value = H5G_UDLINK;
- else if(ltable.lnks[idx].type == H5L_LINK_HARD){
+ else if(ltable.lnks[idx].type == H5L_TYPE_HARD){
H5O_loc_t tmp_oloc; /* Temporary object location */
/* Build temporary object location */
@@ -501,7 +524,7 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
- if(H5G_link_release_table(&ltable) < 0)
+ if(H5G_obj_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
} /* end if */
@@ -540,7 +563,7 @@ H5G_link_remove_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
if(HDstrcmp(lnk->name, udata->name) == 0) {
switch(lnk->type)
{
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
{
H5O_loc_t tmp_oloc; /* Temporary object location */
@@ -554,13 +577,13 @@ H5G_link_remove_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
}
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
*(udata->obj_type) = H5G_LINK;
break;
default: /* User-defined link */
- if(lnk->type < H5L_LINK_UD_MIN)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type");
+ if(lnk->type < H5L_TYPE_UD_MIN)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
*(udata->obj_type) = H5G_UDLINK;
}
@@ -615,7 +638,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_link_iterate
*
- * Purpose: Iterate over the objects in a group
+ * Purpose: Iterate over the links in a group
*
* Return: Non-negative on success/Negative on failure
*
@@ -625,8 +648,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
- H5G_iterate_t op, void *op_data, hid_t dxpl_id)
+H5G_link_iterate(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, hid_t gid, hbool_t lib_internal, int skip,
+ int *last_obj, H5G_link_iterate_t op, void *op_data)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
size_t u; /* Local index variable */
@@ -636,24 +660,24 @@ H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
/* Sanity check */
HDassert(oloc);
- HDassert(H5I_GROUP == H5I_get_type(gid));
- HDassert(last_obj);
- HDassert(op);
+ HDassert(lib_internal || H5I_GROUP == H5I_get_type(gid));
+ HDassert(op.lib_op);
/* Build table of all link messages */
- if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "can't create link message table")
-
- /* Check for going out of bounds */
- if(skip > 0 && (size_t)skip >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5B_ITER_ERROR, "index out of bound")
+ if(H5G_link_build_table(oloc, dxpl_id, linfo, order, &ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Iterate over link messages */
for(u = 0, ret_value = H5B_ITER_CONT; u < ltable.nlinks && !ret_value; u++) {
if(skip > 0)
--skip;
- else
- ret_value = (op)(gid, ltable.lnks[u].name, op_data);
+ else {
+ /* Check for internal callback with link info */
+ if(lib_internal)
+ ret_value = (op.lib_op)(&(ltable.lnks[u]), op_data);
+ else
+ ret_value = (op.app_op)(gid, ltable.lnks[u].name, op_data);
+ } /* end else */
/* Increment the number of entries passed through */
/* (whether we skipped them or not) */
@@ -668,8 +692,8 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
- if(H5G_link_release_table(&ltable) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5B_ITER_ERROR, "unable to release link table")
+ if(H5G_obj_release_table(&ltable) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -765,5 +789,4 @@ H5G_link_lookup(H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_lookup() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 791c278..4e72774 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -364,7 +364,7 @@ done:
*/
herr_t
H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
- hbool_t inc_link, hid_t dxpl_id)
+ hid_t dxpl_id)
{
H5O_link_t lnk; /* Link for object to insert */
herr_t ret_value = SUCCEED; /* Return value */
@@ -376,25 +376,17 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
HDassert(name && *name);
HDassert(obj_loc);
- /* "Translate" object location into link object */
- lnk.type = H5L_LINK_HARD;
-#ifdef H5_HAVE_GETTIMEOFDAY
- {
- struct timeval now_tv;
-
- HDgettimeofday(&now_tv, NULL);
- lnk.ctime = now_tv.tv_sec;
- }
-#else /* H5_HAVE_GETTIMEOFDAY */
- lnk.ctime = HDtime(NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ /* Create link object for the object location */
+ lnk.type = H5L_TYPE_HARD;
lnk.cset = H5F_CRT_DEFAULT_CSET;
+ lnk.corder = 0; /* Will be reset if the group is tracking creation order */
+ lnk.corder_valid = FALSE; /* Indicate that the creation order isn't valid (yet) */
/* Casting away const OK -QAK */
lnk.name = (char *)name;
lnk.u.hard.addr = obj_loc->oloc->addr;
/* Insert new group into current group's symbol table */
- if(H5G_obj_insert(grp_loc->oloc, name, &lnk, inc_link, dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert object")
/* Set the name of the object location */
@@ -404,6 +396,7 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_loc_insert() */
+
/*-------------------------------------------------------------------------
* Function: H5G_loc_exists
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index c640a65..cbbfeae 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -382,18 +382,18 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
if ((buf=H5FL_BLK_MALLOC(symbol_node,size))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for symbol table node");
p=buf;
- if (NULL==(sym = H5FL_CALLOC(H5G_node_t)) ||
- NULL==(sym->entry=H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f)))))
+ if(NULL == (sym = H5FL_CALLOC(H5G_node_t)) ||
+ NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read symbol table node");
/* magic */
- if (HDmemcmp(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature");
p += 4;
/* version */
- if (H5G_NODE_VERS != *p++)
+ if(H5G_NODE_VERS != *p++)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node version");
/* reserved */
p++;
@@ -402,16 +402,16 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
UINT16DECODE(p, sym->nsyms);
/* entries */
- if (H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0)
+ if(H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries");
/* Set return value */
ret_value = sym;
done:
- if (buf)
+ if(buf)
H5FL_BLK_FREE(symbol_node,buf);
- if (!ret_value) {
+ if(!ret_value) {
if (sym)
if(H5G_node_dest(f, sym)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node");
@@ -543,7 +543,7 @@ H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf)
p = buf;
/* magic number */
- HDmemcpy(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC);
+ HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC);
p += 4;
/* version number */
@@ -717,16 +717,16 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
assert(f);
assert(H5B_INS_FIRST == op);
- if (NULL==(sym = H5FL_CALLOC(H5G_node_t)))
+ if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
size = H5G_node_size(f);
- if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
+ if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space");
- sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f)));
- if (NULL==sym->entry)
+ sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)));
+ if(NULL==sym->entry)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- if (H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node");
/*
* The left and right symbols in an empty tree are both the
@@ -734,17 +734,17 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
* allows the comparison functions to work correctly without knowing
* that there are no symbols.
*/
- if (lt_key)
+ if(lt_key)
lt_key->offset = 0;
- if (rt_key)
+ if(rt_key)
rt_key->offset = 0;
done:
- if(ret_value<0) {
- if(sym!=NULL) {
- if(sym->entry!=NULL)
- H5FL_SEQ_FREE(H5G_entry_t,sym->entry);
- H5FL_FREE(H5G_node_t,sym);
+ if(ret_value < 0) {
+ if(sym != NULL) {
+ if(sym->entry != NULL)
+ H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
+ H5FL_FREE(H5G_node_t, sym);
} /* end if */
} /* end if */
@@ -793,23 +793,23 @@ H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
assert(rt_key);
/* Get base address of heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/* Get pointers to string names */
- s1=base+lt_key->offset;
- s2=base+rt_key->offset;
+ s1 = base + lt_key->offset;
+ s2 = base + rt_key->offset;
/* Set return value */
ret_value = HDstrcmp(s1, s2);
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
+ if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name")
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -854,10 +854,10 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
FUNC_ENTER_NOAPI_NOINIT(H5G_node_cmp3);
/* Get base address of heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/* left side */
s=base+lt_key->offset;
@@ -935,7 +935,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/*
* Binary search.
@@ -1048,7 +1048,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/*
* Where does the new symbol get inserted? We use a binary search.
@@ -1228,7 +1228,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/* Find the name with a binary search */
rt = sn->nsyms;
@@ -1251,84 +1251,51 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
switch(sn->entry[idx].type)
{
- case H5G_CACHED_SLINK:
- {
- /* Set the type of the link removed */
- *(udata->obj_type) = H5G_LINK;
-
- /* Remove the symbolic link value */
- if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
-
- s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset);
- if(s) {
- len = HDstrlen(s) + 1;
- found = 1;
- } /* end if */
- else
- found = 0;
-
- if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
- heap = NULL; s = NULL;
-
- if(found)
- H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
-
- H5E_clear_stack(NULL); /* no big deal */
- }
- break;
+ case H5G_CACHED_SLINK:
+ /* Set the type of the link removed */
+ *(udata->obj_type) = H5G_LINK;
+
+ /* Remove the symbolic link value */
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
+
+ s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset);
+ if(s) {
+ len = HDstrlen(s) + 1;
+ found = 1;
+ } /* end if */
+ else
+ found = 0;
- case H5G_CACHED_ULINK:
- {
- size_t ud_data_size = 0; /* User link data size */
- hbool_t ud_data_found; /* Indicate that the link user data was found */
+ if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
+ heap = NULL; s = NULL;
- /* Set the type of the link removed */
- *(udata->obj_type) = H5G_UDLINK;
+ if(found)
+ H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
- /* Remove the link user data from the heap */
- if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
+ H5E_clear_stack(NULL); /* no big deal */
+ break;
- s = H5HL_offset_into(f, heap, sn->entry[idx].cache.ulink.udata_offset);
- if(s)
+ default:
{
- ud_data_found = 1;
- ud_data_size = sn->entry[idx].cache.ulink.udata_size;
- }
- else
- ud_data_found = 0;
- if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
- heap = NULL; s = NULL;
+ H5O_loc_t tmp_oloc; /* Temporary object location */
- if(ud_data_found)
- H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.ulink.udata_offset, ud_data_size);
+ /* Build temporary object location */
+ tmp_oloc.file = f;
+ HDassert(H5F_addr_defined(sn->entry[idx].header));
+ tmp_oloc.addr = sn->entry[idx].header;
- H5E_clear_stack(NULL); /* no big deal */
- }
- break;
+ /* Get the type of the object */
+ if((*(udata->obj_type) = H5O_obj_type(&tmp_oloc, dxpl_id)) == H5G_UNKNOWN)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to determine object type")
- default:
- {
- H5O_loc_t tmp_oloc; /* Temporary object location */
-
- /* Build temporary object location */
- tmp_oloc.file = f;
- HDassert(H5F_addr_defined(sn->entry[idx].header));
- tmp_oloc.addr = sn->entry[idx].header;
-
- /* Get the type of the object */
- if((*(udata->obj_type) = H5O_obj_type(&tmp_oloc, dxpl_id)) == H5G_UNKNOWN)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to determine object type")
-
- /* Decrement the reference count, if requested */
- if(udata->adj_link) {
- if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
- } /* end if */
- }
+ /* Decrement the reference count, if requested */
+ if(udata->adj_link)
+ if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
+ break;
+ }
} /* end switch */
/* Remove the name from the local heap */
@@ -1418,8 +1385,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Reduce the link count for all entries in this node */
for(idx = 0; idx < sn->nsyms; idx++) {
- if(!(H5G_CACHED_SLINK == sn->entry[idx].type ||
- H5G_CACHED_ULINK == sn->entry[idx].type)) {
+ if(!(H5G_CACHED_SLINK == sn->entry[idx].type)) {
/* Decrement the reference count, if requested */
if(udata->adj_link) {
HDassert(H5F_addr_defined(sn->entry[idx].header));
@@ -1471,14 +1437,15 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
- const void UNUSED *_rt_key, void *_udata)
+H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_it_ud1_t *udata = (H5G_bt_it_ud1_t *)_udata;
H5G_node_t *sn = NULL;
const H5HL_t *heap = NULL;
unsigned nsyms; /* # of symbols in node */
- size_t n, *name_off=NULL;
+ H5G_entry_t *ents = NULL; /* Copy of entries in this node */
+ size_t n;
const char *name;
char buf[1024], *s;
unsigned u; /* Local index variable */
@@ -1497,18 +1464,17 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
* Save information about the symbol table node since we can't lock it
* because we're about to call an application function.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node")
nsyms = sn->nsyms;
- if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, (size_t)nsyms)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
- for(u = 0; u < nsyms; u++)
- name_off[u] = sn->entry[u].name_off;
+ if(NULL == (ents = H5FL_SEQ_MALLOC(H5G_entry_t, (size_t)nsyms)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed")
+ HDmemcpy(ents, sn->entry, sizeof(H5G_entry_t) * nsyms);
- if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
+ if(H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
sn = NULL;
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
- }
+ HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
+ } /* end if */
sn=NULL; /* Make certain future references will be caught */
@@ -1516,49 +1482,72 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
* Iterate over the symbol table node entries.
*/
for(u = 0, ret_value = H5B_ITER_CONT; u < nsyms && !ret_value; u++) {
- if (udata->skip>0) {
+ if(udata->skip > 0)
--udata->skip;
- } else {
- if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name");
+ else {
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name")
+
+ name = H5HL_offset_into(f, heap, ents[u].name_off);
+ HDassert(name);
+ n = HDstrlen(name);
+
+ /* Allocate space or point to existing buffer */
+ if((n + 1) > sizeof(buf)) {
+ if(NULL == (s = H5MM_malloc(n + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed")
+ } /* end if */
+ else
+ s = buf;
- name = H5HL_offset_into(f, heap, name_off[u]);
- assert (name);
- n = HDstrlen (name);
+ /* Make a copy of the name */
+ HDstrcpy(s, name);
- if (n+1>sizeof(buf)) {
- if (NULL==(s = H5MM_malloc (n+1)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
- } else {
- s = buf;
- }
- HDstrcpy (s, name);
+ if(H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
+ heap = NULL; name = NULL;
- if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
- heap=NULL; name=NULL;
+ /* Check for internal callback with link info */
+ if(udata->lib_internal) {
+ H5O_link_t lnk; /* Link for entry */
- ret_value = (udata->op)(udata->group_id, s, udata->op_data);
- if (s!=buf)
- H5MM_xfree (s);
- }
+ /* Convert the entry to a link */
+ if(H5G_link_convert(f, dxpl_id, &lnk, udata->heap_addr, &ents[u], s) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_ITER_ERROR, "unable to convert symbol table entry to link")
+
+ /* Call the library's callback */
+ ret_value = (udata->op.lib_op)(&lnk, udata->op_data);
+
+ /* Release memory for link object */
+ if(H5O_reset(H5O_LINK_ID, &lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, H5B_ITER_ERROR, "unable to release link message")
+ } /* end if */
+ else
+ /* Make the application's callback */
+ ret_value = (udata->op.app_op)(udata->group_id, s, udata->op_data);
+
+ /* Free the memory for the name, if we used a dynamically allocated buffer */
+ if(s != buf)
+ H5MM_xfree(s);
+ } /* end else */
/* Increment the number of entries passed through */
/* (whether we skipped them or not) */
- (*udata->final_ent)++;
- }
- if (ret_value<0)
- HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+ if(udata->final_ent)
+ (*udata->final_ent)++;
+ } /* end for */
+ if(ret_value < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
+ if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
+ if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
- if(name_off)
- H5FL_SEQ_FREE(size_t,name_off);
+ if(ents)
+ H5FL_SEQ_FREE(H5G_entry_t, ents);
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -1717,23 +1706,19 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
loc_idx = udata->idx - udata->num_objs;
/* Check for a soft link */
- switch(sn->entry[loc_idx].type)
- {
- case H5G_CACHED_SLINK:
- udata->type = H5G_LINK;
- break;
- case H5G_CACHED_ULINK:
- udata->type = H5G_UDLINK;
- break;
-
- default:
- /* Build temporary object location */
- tmp_oloc.file = f;
- HDassert(H5F_addr_defined(sn->entry[loc_idx].header));
- tmp_oloc.addr = sn->entry[loc_idx].header;
-
- udata->type = H5O_obj_type(&tmp_oloc, dxpl_id);
- break;
+ switch(sn->entry[loc_idx].type) {
+ case H5G_CACHED_SLINK:
+ udata->type = H5G_LINK;
+ break;
+
+ default:
+ /* Build temporary object location */
+ tmp_oloc.file = f;
+ HDassert(H5F_addr_defined(sn->entry[loc_idx].header));
+ tmp_oloc.addr = sn->entry[loc_idx].header;
+
+ udata->type = H5O_obj_type(&tmp_oloc, dxpl_id);
+ break;
}
ret_value = H5B_ITER_STOP;
} else {
@@ -1747,78 +1732,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5G_node_type() */
-#ifdef H5_GROUP_REVISION
-
-/*-------------------------------------------------------------------------
- * Function: H5G_node_stab_convert
- *
- * Purpose: This function gets called when the entries in a group are
- * converted from a symbol table to link messages.
- *
- * Return: 0 if object isn't found in this node; 1 if found;
- * Negative on failure
- *
- * Programmer: Quincey Koziol
- * Sep 5, 2005
- *
- *-------------------------------------------------------------------------
- */
-int
-H5G_node_stab_convert(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
- const void UNUSED *_rt_key, void *_udata)
-{
- H5G_bt_it_ud4_t *udata = (H5G_bt_it_ud4_t*)_udata;
- H5G_node_t *sn = NULL; /* Pointer to symbol table node to operate on */
- const H5HL_t *heap = NULL; /* Pointer to local heap for group */
- const char *name; /* Pointer to name of link */
- const H5G_entry_t *ent; /* Pointer to current entry */
- unsigned u; /* Local index variable */
- int ret_value = H5B_ITER_CONT;
-
- FUNC_ENTER_NOAPI(H5G_node_stab_convert, H5B_ITER_ERROR)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(udata);
-
- /* Lock the symbol table node */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node")
-
- /* Lock the local heap */
- if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name")
-
- /* Convert all the entries from this node into link messages */
- for(u = 0, ent = sn->entry; u < sn->nsyms; u++, ent++) {
- /* Get a pointer to the link's name in the local heap */
- name = H5HL_offset_into(f, heap, ent->name_off);
- HDassert(name);
-
- /* Check for too many links for link table */
- if(udata->nlinks >= udata->max_links)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "too many links for table")
-
- /* Convert entry into link message object */
- if(H5G_link_convert(&(udata->lnk_table[udata->nlinks]), ent, heap, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "can't convert entry to link message")
-
- /* Increment number of links stored */
- udata->nlinks++;
- } /* end for */
-
-done:
- if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
-
- if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_node_stab_convert() */
-#endif /* H5_GROUP_REVISION */
-
/*-------------------------------------------------------------------------
* Function: H5G_node_init
@@ -1961,7 +1874,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_it_ud5_t *udata = (H5G_bt_it_ud5_t *)_udata;
- H5O_loc_t *parent_src_oloc = udata->src_oloc;
+ const H5O_loc_t *src_oloc = udata->src_oloc;
H5O_copy_t *cpy_info = udata->cpy_info;
const H5HL_t *heap = NULL;
H5G_node_t *sn = NULL;
@@ -1993,87 +1906,73 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* expand soft link */
if(H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) {
H5G_stat_t statbuf; /* Information about object pointed to by soft link */
- H5G_loc_t grp_loc; /* Group location for parent of soft link */
- H5G_name_t grp_path; /* Path for parent of soft link */
+ H5G_loc_t grp_loc; /* Group location holding soft link */
+ H5G_name_t grp_path; /* Path for group holding soft link */
char *link_name; /* Pointer to value of soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
HDmemcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t));
- src_ent = &tmp_src_ent;
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
grp_loc.path = &grp_path;
- grp_loc.oloc = parent_src_oloc;
+ grp_loc.oloc = (H5O_loc_t *)src_oloc;
/* Get pointer to link value in local heap */
- link_name = (char *)H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset);
+ link_name = (char *)H5HL_offset_into(f, heap, tmp_src_ent.cache.slink.lval_offset);
/* Check if the object pointed by the soft link exists in the source file */
/* (It would be more efficient to make a specialized traversal callback,
* but this is good enough for now... -QAK)
*/
- if(H5G_get_objinfo(&grp_loc, link_name, TRUE, &statbuf, H5AC_ind_dxpl_id) >= 0) {
+ if(H5G_get_objinfo(&grp_loc, link_name, TRUE, &statbuf, dxpl_id) >= 0) {
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- src_ent->header = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
+ tmp_src_ent.header = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
#else
- src_ent->header = statbuf.objno[0];
+ tmp_src_ent.header = statbuf.objno[0];
#endif
+ src_ent = &tmp_src_ent;
} /* end if */
+ else
+ H5E_clear_stack(NULL); /* discard any errors from a dangling soft link */
} /* if ((H5G_CACHED_SLINK == src_ent->type)... */
/* Check if object in source group is a hard link */
if(H5F_addr_defined(src_ent->header)) {
- H5O_loc_t new_oloc; /* Copied object object location */
- H5O_loc_t src_oloc; /* Temporary object location for source object */
+ H5O_loc_t new_dst_oloc; /* Copied object location in destination */
+ H5O_loc_t tmp_src_oloc; /* Temporary object location for source object */
/* Set up copied object location to fill in */
- H5O_loc_reset(&new_oloc);
- new_oloc.file = udata->dst_file;
+ H5O_loc_reset(&new_dst_oloc);
+ new_dst_oloc.file = udata->dst_file;
/* Build temporary object location for source */
- src_oloc.file = f;
- HDassert(H5F_addr_defined(src_ent->header));
- src_oloc.addr = src_ent->header;
+ H5O_loc_reset(&tmp_src_oloc);
+ tmp_src_oloc.file = f;
+ tmp_src_oloc.addr = src_ent->header;
/* Copy the shared object from source to destination */
- if(H5O_copy_header_map(&src_oloc, &new_oloc, dxpl_id, cpy_info, TRUE) < 0)
+ if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B_ITER_ERROR, "unable to copy object")
/* Construct link information for eventual insertion */
- lnk.type = H5L_LINK_HARD;
- lnk.u.hard.addr = new_oloc.addr;
+ lnk.type = H5L_TYPE_HARD;
+ lnk.u.hard.addr = new_dst_oloc.addr;
} /* ( H5F_addr_defined(src_ent->header)) */
else if(H5G_CACHED_SLINK == src_ent->type) {
/* it is a soft link */
/* Construct link information for eventual insertion */
- lnk.type = H5L_LINK_SOFT;
+ lnk.type = H5L_TYPE_SOFT;
lnk.u.soft.name = H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset);
} /* else if */
- else if(H5G_CACHED_ULINK == src_ent->type) {
- /* user-defined link */
-
- /* Construct link information for eventual insertion */
- lnk.type = src_ent->cache.ulink.link_type;
- lnk.u.ud.size = src_ent->cache.ulink.udata_size;
- lnk.u.ud.udata = H5HL_offset_into(f, heap, src_ent->cache.ulink.udata_offset);
- } /* else if */
else
HDassert(0 && "Unknown entry type");
/* Set up common link data */
-#ifdef H5_HAVE_GETTIMEOFDAY
- {
- struct timeval now_tv;
-
- HDgettimeofday(&now_tv, NULL);
- lnk.ctime = now_tv.tv_sec;
- }
-#else /* H5_HAVE_GETTIMEOFDAY */
- lnk.ctime = HDtime(NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
lnk.cset = H5F_CRT_DEFAULT_CSET; /* XXX: Allow user to set this */
+ lnk.corder = 0; /* Creation order is not tracked for old-style links */
+ lnk.corder_valid = FALSE; /* Creation order is not valid */
/* lnk.name = name; */ /* This will be set in callback */
/* Determine name of source object */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 4cf99ef..960061f 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -22,11 +22,18 @@
*
*-------------------------------------------------------------------------
*/
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
@@ -37,29 +44,164 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property Lists */
-/* Private typedefs */
-/* User data for converting link messages to symbol table */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* User data for object header iterator when converting link messages to dense
+ * link storage
+ */
typedef struct {
H5F_t *f; /* Pointer to file for insertion */
- haddr_t btree_addr; /* Address of symbol table B-tree */
- haddr_t heap_addr; /* Address of symbol table local heap */
hid_t dxpl_id; /* DXPL during insertion */
-} H5G_obj_ud1_t;
+ H5O_linfo_t *linfo; /* Pointer to link info */
+} H5G_obj_oh_it_ud1_t;
-/* User data for looking up an object in a group */
+/* User data for link iterator when converting dense link storage to link
+ * messages
+ */
typedef struct {
- H5O_link_t *lnk; /* Link information to set for object */
- H5O_loc_t *oloc; /* Object location to set */
-} H5G_obj_ud2_t;
+ H5O_link_t *lnk_table; /* Array of links to convert */
+ size_t nlinks; /* Number of links converted */
+ size_t alloc_links; /* Size of link table */
+} H5G_obj_lnk_it_ud1_t;
-/* Private macros */
+/* User data for symbol table iterator when converting old-format group to
+ * a new-format group
+ */
+typedef struct {
+ H5O_loc_t *grp_oloc; /* Pointer to group for insertion */
+ hid_t dxpl_id; /* DXPL during insertion */
+} H5G_obj_stab_it_ud1_t;
-/* PRIVATE PROTOTYPES */
-#ifdef H5_GROUP_REVISION
-static herr_t
-H5G_obj_link_to_stab_cb(const void *_mesg, unsigned idx, void *_udata);
-#endif /* H5_GROUP_REVISION */
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5G_obj_link_to_dense_cb(const void *_mesg, unsigned idx,
+ void *_udata);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_cmp_name_inc
+ *
+ * Purpose: Callback routine for comparing two link names, in
+ * increasing alphabetic order
+ *
+ * Return: An integer less than, equal to, or greater than zero if the
+ * first argument is considered to be respectively less than,
+ * equal to, or greater than the second. If two members compare
+ * as equal, their order in the sorted array is undefined.
+ * (i.e. same as strcmp())
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Sep 5 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5G_obj_cmp_name_inc(const void *lnk1, const void *lnk2)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_obj_cmp_name_inc)
+
+ FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
+} /* end H5G_obj_cmp_name_inc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_cmp_name_dec
+ *
+ * Purpose: Callback routine for comparing two link names, in
+ * decreasing alphabetic order
+ *
+ * Return: An integer less than, equal to, or greater than zero if the
+ * second argument is considered to be respectively less than,
+ * equal to, or greater than the first. If two members compare
+ * as equal, their order in the sorted array is undefined.
+ * (i.e. opposite strcmp())
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Sep 25 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5G_obj_cmp_name_dec(const void *lnk1, const void *lnk2)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_obj_cmp_name_dec)
+
+ FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name))
+} /* end H5G_obj_cmp_name_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_release_table
+ *
+ * Purpose: Release table containing a list of links for a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Sep 6, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_obj_release_table(H5G_link_table_t *ltable)
+{
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_obj_release_table)
+
+ /* Sanity check */
+ HDassert(ltable);
+
+ /* Release link info, if any */
+ if(ltable->nlinks > 0) {
+ /* Free link message information */
+ for(u = 0; u < ltable->nlinks; u++)
+ if(H5O_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message")
+
+ /* Free table of links */
+ H5MM_xfree(ltable->lnks);
+ } /* end if */
+ else
+ HDassert(ltable->lnks == NULL);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_obj_release_table() */
/*-------------------------------------------------------------------------
@@ -76,21 +218,12 @@ H5G_obj_link_to_stab_cb(const void *_mesg, unsigned idx, void *_udata);
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_create(H5F_t *f, hid_t dxpl_id,
-#ifdef H5_GROUP_REVISION
- H5O_ginfo_t *ginfo,
-#endif /* H5_GROUP_REVISION */
+H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5O_loc_t *oloc/*out*/)
{
-#ifdef H5_GROUP_REVISION
H5O_linfo_t linfo; /* Link information */
- H5O_link_t lnk; /* Temporary link message info for computing message size */
- char null_char = '\0'; /* Character for creating null string */
- size_t ginfo_size; /* Size of the group info message */
- size_t linfo_size; /* Size of the link info message */
- size_t link_size; /* Size of a link message */
-#endif /* H5_GROUP_REVISION */
size_t hdr_size; /* Size of object header to request */
+ hbool_t use_latest_format; /* Flag indicating the new group format should be used */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_create, FAIL)
@@ -99,34 +232,49 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id,
* Check arguments.
*/
HDassert(f);
-#ifdef H5_GROUP_REVISION
HDassert(ginfo);
-#endif /* H5_GROUP_REVISION */
HDassert(oloc);
-#ifdef H5_GROUP_REVISION
- /* Initialize message information */
- linfo.nlinks = 0;
-
- /* Calculate message size infomation, for creating group's object header */
- linfo_size = H5O_mesg_size(H5O_LINFO_ID, f, &linfo);
- HDassert(linfo_size);
-
- ginfo_size = H5O_mesg_size(H5O_GINFO_ID, f, ginfo);
- HDassert(ginfo_size);
-
- lnk.type = H5L_LINK_HARD;
- lnk.name = &null_char;
- link_size = H5O_mesg_size(H5O_LINK_ID, f, &lnk);
- HDassert(link_size);
-
- /* Compute size of header to use for creation */
- hdr_size = linfo_size +
- ginfo_size +
- (ginfo->est_num_entries * (link_size + ginfo->est_name_len));
-#else /* H5_GROUP_REVISION */
- hdr_size = 4 + 2 * H5F_SIZEOF_ADDR(f);
-#endif /* H5_GROUP_REVISION */
+ /* Check for using the latest version of the group format */
+/* XXX: add more checks for creating "new format" groups when needed */
+ if(f->shared->latest_format || ginfo->track_corder)
+ use_latest_format = TRUE;
+ else
+ use_latest_format = FALSE;
+
+ /* Check if we should be using the latest version of the group format */
+ if(use_latest_format) {
+ H5O_linfo_t def_linfo = H5G_CRT_LINK_INFO_DEF; /* Default link info */
+ H5O_link_t lnk; /* Temporary link message info for computing message size */
+ char null_char = '\0'; /* Character for creating null string */
+ size_t ginfo_size; /* Size of the group info message */
+ size_t linfo_size; /* Size of the link info message */
+ size_t link_size; /* Size of a link message */
+
+ /* Initialize message information */
+ HDmemcpy(&linfo, &def_linfo, sizeof(H5O_linfo_t));
+
+ /* Calculate message size infomation, for creating group's object header */
+ linfo_size = H5O_mesg_size(H5O_LINFO_ID, f, &linfo, (size_t)0);
+ HDassert(linfo_size);
+
+ ginfo_size = H5O_mesg_size(H5O_GINFO_ID, f, ginfo, (size_t)0);
+ HDassert(ginfo_size);
+
+ lnk.type = H5L_TYPE_HARD;
+ lnk.corder = 0;
+ lnk.corder_valid = ginfo->track_corder;
+ lnk.name = &null_char;
+ link_size = H5O_mesg_size(H5O_LINK_ID, f, &lnk, (size_t)ginfo->est_name_len);
+ HDassert(link_size);
+
+ /* Compute size of header to use for creation */
+ hdr_size = linfo_size +
+ ginfo_size +
+ (ginfo->est_num_entries * link_size);
+ } /* end if */
+ else
+ hdr_size = 4 + 2 * H5F_SIZEOF_ADDR(f);
/*
* Create symbol table object header. It has a zero link count
@@ -136,24 +284,23 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id,
if(H5O_create(f, dxpl_id, hdr_size, oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
-#ifdef H5_GROUP_REVISION
- /* Insert link info message */
- if(H5O_modify(oloc, H5O_LINFO_ID, H5O_NEW_MESG, 0, 0, &linfo, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+ /* Check for format of group to create */
+ if(use_latest_format) {
+ /* Insert link info message */
+ if(H5O_modify(oloc, H5O_LINFO_ID, H5O_NEW_MESG, 0, 0, &linfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
- /* Insert group info message */
- if(H5O_modify(oloc, H5O_GINFO_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, ginfo, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
-#else /* H5_GROUP_REVISION */
- {
+ /* Insert group info message */
+ if(H5O_modify(oloc, H5O_GINFO_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, ginfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+ } /* end if */
+ else {
H5O_stab_t stab; /* Symbol table message */
/* The group doesn't currently have a 'stab' message, go create one */
- if(H5G_stab_create(oloc, &stab, dxpl_id) < 0)
+ if(H5G_stab_create(oloc, dxpl_id, ginfo, &stab) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table")
-
- }
-#endif /* H5_GROUP_REVISION */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -250,13 +397,12 @@ H5G_obj_ent_encode(H5F_t *f, uint8_t **pp, const H5O_loc_t *oloc)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_obj_ent_encode() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
- * Function: H5G_obj_link_to_stab_cb
+ * Function: H5G_obj_link_to_dense_cb
*
- * Purpose: Callback routine for converting 'link' messages to symbol table
- * form.
+ * Purpose: Callback routine for converting 'link' messages to "dense"
+ * link storage form.
*
* Return: Non-negative on success/Negative on failure
*
@@ -267,32 +413,61 @@ H5G_obj_ent_encode(H5F_t *f, uint8_t **pp, const H5O_loc_t *oloc)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_obj_link_to_stab_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
+H5G_obj_link_to_dense_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
- H5G_obj_ud1_t *udata = (H5G_obj_ud1_t *)_udata; /* 'User data' passed in */
- H5G_bt_ud1_t bt_udata; /* Data to pass through B-tree */
+ H5G_obj_oh_it_ud1_t *udata = (H5G_obj_oh_it_ud1_t *)_udata; /* 'User data' passed in */
herr_t ret_value = H5O_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5G_obj_link_to_stab_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5G_obj_link_to_dense_cb)
/* check arguments */
HDassert(lnk);
HDassert(udata);
- /* Construct user data to pass through B-tree routines */
- bt_udata.common.name = lnk->name;
- bt_udata.common.heap_addr = udata->heap_addr;
- bt_udata.lnk = lnk;
+ /* Insert link into dense link storage */
+ if(H5G_dense_insert(udata->f, udata->dxpl_id, udata->linfo, lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_obj_link_to_dense_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_stab_to_new_cb
+ *
+ * Purpose: Callback routine for converting "symbol table" link storage to
+ * "new format" storage (either link messages or "dense" storage).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 16 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata)
+{
+ H5G_obj_stab_it_ud1_t *udata = (H5G_obj_stab_it_ud1_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5B_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_obj_stab_to_new_cb)
+
+ /* check arguments */
+ HDassert(lnk);
+ HDassert(udata);
- /* Insert entry into symbol table */
- if(H5B_insert(udata->f, udata->dxpl_id, H5B_SNODE, udata->btree_addr, &bt_udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry")
+ /* Insert link into group */
+ /* (Casting away const OK - QAK) */
+ if(H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_ITER_ERROR, "can't insert link into group")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_obj_link_to_stab_cb() */
-#endif /* H5_GROUP_REVISION */
+} /* end H5G_obj_stab_to_new_cb() */
/*-------------------------------------------------------------------------
@@ -300,8 +475,9 @@ done:
*
* Purpose: Insert a new symbol into the group described by GRP_OLOC.
* file F. The name of the new symbol is NAME and its symbol
- * table entry is OBJ_LNK. Optionally, increment the reference
- * count for the object the link points to with INC_LINK.
+ * table entry is OBJ_LNK. Increment the reference
+ * count for the object the link points if OBJ_LNK is a hard link
+ * and ADJ_LINK is true.
*
* Return: Non-negative on success/Negative on failure
*
@@ -313,13 +489,12 @@ done:
*/
herr_t
H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
- hbool_t inc_link, hid_t dxpl_id)
+ hbool_t adj_link, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
H5O_linfo_t linfo; /* Link info message */
- htri_t linfo_exists; /* Whether the link info is present */
- hbool_t use_stab; /* Whether to use symbol table for insertions or not */
-#endif /* H5_GROUP_REVISION */
+ H5O_ginfo_t ginfo; /* Group info message */
+ hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for insertions or not */
+ hbool_t use_new_dense = FALSE; /* Whether to use "dense" form of 'new format' group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_insert, FAIL)
@@ -329,99 +504,145 @@ H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
HDassert(name && *name);
HDassert(obj_lnk);
-#ifdef H5_GROUP_REVISION
/* Check if we have information about the number of objects in this group */
- if((linfo_exists = H5O_exists(grp_oloc, H5O_LINFO_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for link info")
- if(linfo_exists) {
- htri_t stab_exists; /* Whether the symbol table info is present */
-
- /* Get the number of objects in this group */
- if(NULL == H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
-
- /* Check if there is already a 'stab' message */
- if((stab_exists = H5O_exists(grp_oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
- if(stab_exists)
- use_stab = TRUE;
+ /* (by attempting to get the link info message for this group) */
+ if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ size_t link_msg_size; /* Size of new link message in the file */
+
+ /* Using the new format for groups */
+ use_old_format = FALSE;
+
+ /* Get the group info */
+ if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
+
+ /* Check for tracking creation order on this group's links */
+ if(ginfo.track_corder) {
+ /* Set the creation order for the new link & indicate that it's valid */
+ obj_lnk->corder = linfo.max_corder;
+ obj_lnk->corder_valid = TRUE;
+
+ /* Increment the max. creation order used in the group */
+ linfo.max_corder++;
+ } /* end if */
+
+ /* Get the link's message size */
+ if((link_msg_size = H5O_raw_size(H5O_LINK_ID, grp_oloc->file, obj_lnk)) == 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
+
+ /* If there's still a small enough number of links, use the 'link' message */
+ /* (If the encoded form of the link is too large to fit into an object
+ * header message, convert to using dense link storage instead of link messages)
+ */
+ if(H5F_addr_defined(linfo.link_fheap_addr))
+ use_new_dense = TRUE;
+ else if(linfo.nlinks < ginfo.max_compact && link_msg_size < H5O_MAX_SIZE)
+ use_new_dense = FALSE;
else {
- H5O_ginfo_t ginfo; /* Group info message */
- size_t link_msg_size; /* Size of link message in the file */
+ H5G_obj_oh_it_ud1_t udata; /* User data for iteration */
- /* Get the link message size */
- if((link_msg_size = H5O_raw_size(H5O_LINK_ID, grp_oloc->file, obj_lnk)) == 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
+ /* The group doesn't currently have "dense" storage for links */
+ if(H5G_dense_create(grp_oloc->file, dxpl_id, &linfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create 'dense' form of new format group")
- /* Get the group info */
- if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
+ /* Set up user data for object header message iteration */
+ udata.f = grp_oloc->file;
+ udata.dxpl_id = dxpl_id;
+ udata.linfo = &linfo;
- /* If there's still a small enough number of links, use the 'link' message */
- /* (If the encoded form of the link is too large to fit into an object
- * header message, convert to using symbol table instead of link messages)
- */
- if(linfo.nlinks < ginfo.max_compact && link_msg_size < H5O_MAX_SIZE)
- use_stab = FALSE;
- else {
- H5G_obj_ud1_t udata; /* User data for iteration */
- H5O_stab_t stab; /* Symbol table message */
-
- /* The group doesn't currently have a 'stab' message, go create one */
- if(H5G_stab_create(grp_oloc, &stab, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table")
-
- /* Set up user data for object header message iteration */
- udata.f = grp_oloc->file;
- udata.btree_addr = stab.btree_addr;
- udata.heap_addr = stab.heap_addr;
- udata.dxpl_id = dxpl_id;
-
- /* Iterate over the 'link' messages, inserting them into the symbol table */
- if(H5O_iterate(grp_oloc, H5O_LINK_ID, H5G_obj_link_to_stab_cb, &udata, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links")
-
- /* Remove all the 'link' messages */
- if(H5O_remove(grp_oloc, H5O_LINK_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link messages")
-
- use_stab = TRUE;
- } /* end else */
+ /* Iterate over the 'link' messages, inserting them into the dense link storage */
+ if(H5O_iterate(grp_oloc, H5O_LINK_ID, H5G_obj_link_to_dense_cb, &udata, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links")
+
+ /* Remove all the 'link' messages */
+ if(H5O_remove(grp_oloc, H5O_LINK_ID, H5O_ALL, FALSE, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link messages")
+
+ use_new_dense = TRUE;
} /* end else */
} /* end if */
- else
- use_stab = TRUE;
-#endif /* H5_GROUP_REVISION */
+ else {
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
+ /* Check for new-style link information */
+ if(obj_lnk->cset != H5T_CSET_ASCII || obj_lnk->type > H5L_TYPE_BUILTIN_MAX) {
+ H5O_linfo_t new_linfo = H5G_CRT_LINK_INFO_DEF; /* Link information */
+ H5O_ginfo_t new_ginfo = H5G_CRT_GROUP_INFO_DEF; /* Group information */
+ H5G_obj_stab_it_ud1_t udata; /* User data for iteration */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+
+ /* Convert group to "new format" group, in order to hold the information */
+
+ /* Insert link info message */
+ if(H5O_modify(grp_oloc, H5O_LINFO_ID, H5O_NEW_MESG, 0, 0, &new_linfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+
+ /* Insert group info message */
+ if(H5O_modify(grp_oloc, H5O_GINFO_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 0, &new_ginfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+
+ /* Set up user data for iteration */
+ udata.grp_oloc = grp_oloc;
+ udata.dxpl_id = dxpl_id;
+
+ /* Build iterator operator */
+ lnk_op.lib_op = H5G_obj_stab_to_new_cb;
+
+ /* Iterate through all links in "old format" group and insert them into new format */
+ if(H5G_stab_iterate(grp_oloc, H5_ITER_NATIVE, 0, TRUE, 0, NULL, lnk_op, &udata, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over old format links")
+
+ /* Remove the symbol table message from the group */
+ if(H5O_remove(grp_oloc, H5O_STAB_ID, 0, FALSE, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete old format link storage")
+
+ /* Recursively call this routine to insert the new link, since the
+ * group is in the "new format" now and the link info should be
+ * set up, etc.
+ */
+ if(H5G_obj_insert(grp_oloc, name, obj_lnk, adj_link, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into group")
+
+ /* Done with insertion now */
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ else
+ use_old_format = TRUE;
+ } /* end if */
- /* Insert into symbol table or create link object */
-#ifdef H5_GROUP_REVISION
- if(use_stab) {
-#endif /* H5_GROUP_REVISION */
+ /* Insert into symbol table or "dense" storage */
+ if(use_old_format) {
/* Insert into symbol table */
if(H5G_stab_insert(grp_oloc, name, obj_lnk, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry")
-#ifdef H5_GROUP_REVISION
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry into symbol table")
} /* end if */
else {
- /* Insert with link message */
- if(H5G_link_insert(grp_oloc, obj_lnk, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry")
+ if(use_new_dense) {
+ /* Insert into dense link storage */
+ if(H5G_dense_insert(grp_oloc->file, dxpl_id, &linfo, obj_lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage")
+ } /* end if */
+ else {
+ /* Insert with link message */
+ if(H5G_link_insert(grp_oloc, obj_lnk, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link as link message")
+ } /* end else */
} /* end else */
/* Increment the number of objects in this group */
- if(linfo_exists) {
+ if(!use_old_format) {
linfo.nlinks++;
if(H5O_modify(grp_oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
} /* end if */
-#endif /* H5_GROUP_REVISION */
- /* Increment link count on object, if appropriate */
- if(inc_link) {
+ /* Increment link count on object, if requested and it's a hard link */
+ if(adj_link && obj_lnk->type == H5L_TYPE_HARD) {
H5O_loc_t obj_oloc; /* Object location */
H5O_loc_reset(&obj_oloc);
- /* Convert to object location */
+ /* Create temporary object location */
obj_oloc.file = grp_oloc->file;
obj_oloc.addr = obj_lnk->u.hard.addr;
@@ -451,51 +672,59 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_iterate(hid_t loc_id, const char *name, int skip, int *last_obj,
- H5G_iterate_t op, void *op_data, hid_t dxpl_id)
+H5G_obj_iterate(hid_t loc_id, const char *name, H5_iter_order_t order,
+ int skip, int *last_lnk, H5G_iterate_t op, void *op_data, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
- hid_t gid = -1; /* ID of group to iterate over */
- H5G_t *grp; /* Pointer to group data structure to iterate over */
- herr_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+ hid_t gid = -1; /* ID of group to iterate over */
+ H5G_t *grp; /* Pointer to group data structure to iterate over */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_iterate, FAIL)
/* Sanity check */
HDassert(name);
- HDassert(last_obj);
+ HDassert(last_lnk);
HDassert(op);
/*
* Open the group on which to operate. We also create a group ID which
* we can pass to the application-defined operator.
*/
- if((gid = H5Gopen (loc_id, name)) < 0)
+ if((gid = H5Gopen(loc_id, name)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((grp = H5I_object(gid)) == NULL)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "bad group ID")
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, iterate over link messages */
- if(!stab_exists) {
- /* Get the object's name from the link messages */
- if((ret_value = H5G_link_iterate(&(grp->oloc), gid, skip, last_obj, op, op_data, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over links")
+ /* Set up link operator */
+ lnk_op.app_op = op;
+
+ /* Attempt to get the link info for this group */
+ if(H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ /* Check for going out of bounds */
+ if(skip > 0 && (size_t)skip >= linfo.nlinks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
+
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Iterate over the links in the group, building a table of the link messages */
+ if((ret_value = H5G_dense_iterate(grp->oloc.file, dxpl_id, order, gid, &linfo, FALSE, skip, last_lnk, lnk_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+ } /* end if */
+ else {
+ /* Get the object's name from the link messages */
+ if((ret_value = H5G_link_iterate(&(grp->oloc), dxpl_id, &linfo, order, gid, FALSE, skip, last_lnk, lnk_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over links")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Iterate over symbol table */
- if((ret_value = H5G_stab_iterate(&(grp->oloc), gid, skip, last_obj, op, op_data, dxpl_id)) < 0)
+ if((ret_value = H5G_stab_iterate(&(grp->oloc), order, gid, FALSE, skip, last_lnk, lnk_op, op_data, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over symbol table")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
if(gid > 0)
@@ -521,9 +750,7 @@ done:
herr_t
H5G_obj_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t linfo_exists; /* Whether the link info is present */
-#endif /* H5_GROUP_REVISION */
+ H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_count, FAIL)
@@ -532,30 +759,19 @@ H5G_obj_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id)
HDassert(oloc);
HDassert(num_objs);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((linfo_exists = H5O_exists(oloc, H5O_LINFO_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for link info")
-
- /* If the link info exists, then it has the number of objects in the group */
- if(linfo_exists > 0) {
- H5O_linfo_t linfo; /* Link info message */
-
- /* Get the link info for this group */
- if(NULL == H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
-
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Set the number of objects */
*num_objs = linfo.nlinks;
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the number of objects in this group by iterating over symbol table */
if(H5G_stab_count(oloc, num_objs, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't count objects")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -568,8 +784,7 @@ done:
* Purpose: Private function for H5Gget_objname_by_idx.
* Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative
- *
+ * Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Raymond Lu
@@ -578,37 +793,38 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G_obj_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name, size_t size, hid_t dxpl_id)
+H5G_obj_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name, size_t size,
+ hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
- ssize_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_get_name_by_idx, FAIL)
/* Sanity check */
HDassert(oloc);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, search link messages */
- if(!stab_exists) {
- /* Get the object's name from the link messages */
- if((ret_value = H5G_link_get_name_by_idx(oloc, idx, name, size, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Get the object's name from the dense link storage */
+ if((ret_value = H5G_dense_get_name_by_idx(oloc->file, dxpl_id, &linfo, idx, name, size)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
+ } /* end if */
+ else {
+ /* Get the object's name from the link messages */
+ if((ret_value = H5G_link_get_name_by_idx(oloc, dxpl_id, &linfo, idx, name, size)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the object's name from the symbol table */
if((ret_value = H5G_stab_get_name_by_idx(oloc, idx, name, size, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -633,35 +849,35 @@ done:
H5G_obj_t
H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
- H5G_obj_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_get_type_by_idx, H5G_UNKNOWN)
/* Sanity check */
HDassert(oloc);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, search link messages */
- if(!stab_exists) {
- /* Get the object's type from the link messages */
- if((ret_value = H5G_link_get_type_by_idx(oloc, idx, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Get the object's name from the dense link storage */
+ if((ret_value = H5G_dense_get_type_by_idx(oloc->file, dxpl_id, &linfo, idx)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
+ } /* end if */
+ else {
+ /* Get the object's type from the link messages */
+ if((ret_value = H5G_link_get_type_by_idx(oloc, dxpl_id, &linfo, idx)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the object's type from the symbol table */
if((ret_value = H5G_stab_get_type_by_idx(oloc, idx, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -672,10 +888,10 @@ done:
* Function: H5G_obj_remove
*
* Purpose: Remove an object from a group.
- * (Needs to hand up the type of the object removed)
*
- * Return: Success: Non-negative
+ * Note: Needs to hand up the type of the object removed
*
+ * Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -686,151 +902,116 @@ done:
herr_t
H5G_obj_remove(H5O_loc_t *oloc, const char *name, H5G_obj_t *obj_type, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t linfo_exists; /* Whether the link info is present */
- H5O_linfo_t linfo; /* Link info message */
- htri_t stab_exists; /* Whether the symbol table info is present */
- hbool_t use_stab; /* Whether to use symbol table for deletions or not */
-#endif /* H5_GROUP_REVISION */
- H5G_obj_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for deletion or not */
+ hbool_t use_new_dense = FALSE; /* Whether to use "dense" form of 'new format' group */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_remove, FAIL)
/* Sanity check */
HDassert(oloc);
+ HDassert(name && *name);
HDassert(obj_type);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* Check if we have information about the number of objects in this group */
- if((linfo_exists = H5O_exists(oloc, H5O_LINFO_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for link info message")
- if(linfo_exists) {
- H5O_ginfo_t ginfo; /* Group info message */
-
- /* Get the number of objects in this group */
- if(NULL == H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ /* Using the new format for groups */
+ use_old_format = FALSE;
/* Check for deleting enough links from group to go back to link messages */
- if(stab_exists) {
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ H5O_ginfo_t ginfo; /* Group info message */
+
/* Get the group info */
if(NULL == H5O_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
- /* Switch from symbol table back to link messages */
+ /* Check if we should switch from dense storage back to link messages */
if(linfo.nlinks <= ginfo.min_dense) {
- H5G_bt_it_ud4_t udata;
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5O_link_t *lnk_table; /* Array of links to convert */
+ H5G_link_table_t ltable; /* Table of links */
hbool_t can_convert = TRUE; /* Whether converting to link messages is possible */
size_t u; /* Local index */
- /* Get the B-tree & local heap info */
- if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
-
- /* Allocate space for the link table */
- H5_CHECK_OVERFLOW(linfo.nlinks, /* From: */ hsize_t, /* To: */size_t);
- if(NULL == (lnk_table = H5MM_malloc(sizeof(H5O_link_t) * (size_t)linfo.nlinks)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for link table")
-
- /* Build udata to pass through H5B_iterate() */
- udata.heap_addr = stab.heap_addr;
- udata.lnk_table = lnk_table;
- udata.nlinks = 0;
- H5_CHECK_OVERFLOW(linfo.nlinks, hsize_t, size_t);
- udata.max_links = (size_t)linfo.nlinks;
-
- /* Iterate over the group members, building a table of equivalent link messages */
- if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE,
- H5G_node_stab_convert, stab.btree_addr, &udata)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over entries")
+ /* Build the table of links for this group */
+ if(H5G_dense_build_table(oloc->file, dxpl_id, &linfo, H5_ITER_NATIVE, &ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
/* Inspect links in table for ones that can't be converted back
* into link message form (currently only links which can't fit
* into an object header message)
*/
for(u = 0; u < linfo.nlinks; u++)
- if(H5O_mesg_size(H5O_LINK_ID, oloc->file, &(lnk_table[u])) >= H5O_MAX_SIZE) {
+ if(H5O_mesg_size(H5O_LINK_ID, oloc->file, &(ltable.lnks[u]), (size_t)0) >= H5O_MAX_SIZE) {
can_convert = FALSE;
break;
} /* end if */
/* If ok, insert links as link messages */
if(can_convert) {
- for(u = 0; u < linfo.nlinks; u++) {
- /* Insert link message into group */
- if(H5O_modify(oloc, H5O_LINK_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &(lnk_table[u]), dxpl_id) < 0)
+ /* Insert link messages into group */
+ for(u = 0; u < linfo.nlinks; u++)
+ if(H5O_modify(oloc, H5O_LINK_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &(ltable.lnks[u]), dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
- } /* end for */
- /* Remove the 'stab' message */
- if(H5O_remove(oloc, H5O_STAB_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table message")
+ /* Remove the dense storage */
+ if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
- use_stab = FALSE;
+ use_new_dense = FALSE;
} /* end if */
else
- use_stab = TRUE;
-
- /* Release memory for link names (and memory for soft link values) */
- for(u = 0; u < linfo.nlinks; u++) {
- H5MM_xfree(lnk_table[u].name);
- if(lnk_table[u].type == H5L_LINK_SOFT)
- H5MM_xfree(lnk_table[u].u.soft.name);
- else if(lnk_table[u].type >= H5L_LINK_UD_MIN) {
- if(lnk_table[u].u.ud.size > 0)
- H5MM_xfree(lnk_table[u].u.ud.udata);
- } /* end if */
- } /* end for */
+ use_new_dense = TRUE;
- /* Release memory for link table */
- H5MM_xfree(lnk_table);
+ /* Free link table information */
+ if(H5G_obj_release_table(&ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
else
- use_stab = TRUE;
+ use_new_dense = TRUE;
} /* end if */
else
- use_stab = FALSE;
+ use_new_dense = FALSE;
} /* end if */
- else
- use_stab = TRUE;
-#endif /* H5_GROUP_REVISION */
+ else {
+ H5E_clear_stack(NULL); /* Clear error stack from not finding the link info message */
+ use_old_format = TRUE;
+ } /* end else */
/* If the symbol table doesn't exist, search link messages */
-#ifdef H5_GROUP_REVISION
- if(!use_stab) {
- /* Remove object from the link messages */
- if((ret_value = H5G_link_remove(oloc, name, obj_type, dxpl_id)) < 0)
+ if(use_old_format) {
+ /* Remove object from the symbol table */
+ if(H5G_stab_remove(oloc, name, obj_type, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
- /* Remove object from the symbol table */
- if((ret_value = H5G_stab_remove(oloc, name, obj_type, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
-#ifdef H5_GROUP_REVISION
+ if(use_new_dense) {
+ /* Remove object from the dense link storage */
+ if(H5G_dense_remove(oloc->file, dxpl_id, &linfo, name, obj_type) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
+ } /* end if */
+ else {
+ /* Remove object from the link messages */
+ if(H5G_link_remove(oloc, name, obj_type, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
+ } /* end else */
} /* end else */
-#endif /* H5_GROUP_REVISION */
-#ifdef H5_GROUP_REVISION
- /* Decrement the number of objects in this group */
- if(linfo_exists) {
+ /* Update link info for a new-style group */
+ if(!use_old_format) {
+ /* Decrement # of links in group */
linfo.nlinks--;
- if(H5O_modify(oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
- /* Remove the symbol table, if we are using one and the number of links drops to zero */
- if(linfo.nlinks == 0 && use_stab) {
- if(H5O_remove(oloc, H5O_STAB_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table message")
+ /* Remove the dense link storage, if we are using it and the number of links drops to zero */
+ if(linfo.nlinks == 0 && use_new_dense) {
+ if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
} /* end if */
+
+ /* Update link info in the object header */
+ if(H5O_modify(oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
} /* end if */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -854,9 +1035,7 @@ herr_t
H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
+ H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_lookup, FAIL)
@@ -865,29 +1044,30 @@ H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
HDassert(grp_oloc && grp_oloc->file);
HDassert(name && *name);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(grp_oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, search link messages */
- if(!stab_exists) {
- /* Get the object's info from the link messages */
- if(H5G_link_lookup(grp_oloc, name, lnk, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
+ /* Attempt to get the link info message for this group */
+ if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ /* Check for dense link storage */
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Get the object's info from the dense link storage */
+ if(H5G_dense_lookup(grp_oloc->file, dxpl_id, &linfo, name, lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
+ } /* end if */
+ else {
+ /* Get the object's info from the link messages */
+ if(H5G_link_lookup(grp_oloc, name, lnk, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the object's info from the symbol table */
if(H5G_stab_lookup(grp_oloc, name, lnk, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_lookup() */
-
-
diff --git a/src/H5Goh.c b/src/H5Goh.c
index 08d1b25..c51a493 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -81,9 +81,7 @@ htri_t
H5O_group_isa(struct H5O_t *oh)
{
htri_t stab_exists; /* Whether the 'stab' message is in the object header */
-#ifdef H5_GROUP_REVISION
htri_t linfo_exists; /* Whether the 'linfo' message is in the object header */
-#endif /* H5_GROUP_REVISION */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_group_isa)
@@ -93,16 +91,10 @@ H5O_group_isa(struct H5O_t *oh)
/* Check for any of the messages that indicate a group */
if((stab_exists = H5O_exists_oh(oh, H5O_STAB_ID, 0)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
-#ifdef H5_GROUP_REVISION
if((linfo_exists = H5O_exists_oh(oh, H5O_LINFO_ID, 0)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
-#endif /* H5_GROUP_REVISION */
-#ifdef H5_GROUP_REVISION
ret_value = (stab_exists > 0 || linfo_exists > 0);
-#else /* H5_GROUP_REVISION */
- ret_value = stab_exists > 0;
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 164cf31..d3ed14e 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -32,13 +32,13 @@
/* Other private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
+#include "H5B2private.h" /* v2 B-trees */
+#include "H5HFprivate.h" /* Fractal heaps */
#include "H5Oprivate.h" /* Object headers */
#include "H5SLprivate.h" /* Skip lists */
-#define H5G_SIZE_HINT 256 /* default root grp size hint */
-
-/* H5G_NLINKS is deprecated */
-#define H5G_NLINKS H5L_NLINKS_DEF
+/* Standard length of fractal heap ID for link */
+#define H5G_DENSE_FHEAP_ID_LEN 7
/*
* Various types of object header information can be cached in a symbol
@@ -51,9 +51,8 @@ typedef enum H5G_type_t {
H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
H5G_CACHED_STAB = 1, /*symbol table, `stab' */
H5G_CACHED_SLINK = 2, /*symbolic link */
- H5G_CACHED_ULINK = 3, /*user-defined link */
- H5G_NCACHED = 4 /*THIS MUST BE LAST */
+ H5G_NCACHED /*THIS MUST BE LAST */
} H5G_type_t;
/*
@@ -72,12 +71,6 @@ typedef union H5G_cache_t {
struct {
size_t lval_offset; /*link value offset */
} slink;
-
- struct {
- size_t udata_size; /*size of user data buffer */
- size_t udata_offset; /*link's user data buffer */
- H5L_link_t link_type; /*link type ID */
- } ulink;
} H5G_cache_t;
/*
@@ -113,6 +106,15 @@ struct H5G_t {
H5G_name_t path; /* Group hierarchy path */
};
+/* Link iteration operator for internal library callbacks */
+typedef herr_t (*H5G_lib_iterate_t)(const H5O_link_t *lnk, void *op_data);
+
+/* Some syntactic sugar to make the compiler happy with two different kinds of iterator callbacks */
+typedef union {
+ H5G_iterate_t app_op; /* Application callback for each link */
+ H5G_lib_iterate_t lib_op; /* Library internal callback for each link */
+} H5G_link_iterate_t;
+
/*
* Common data exchange structure for symbol table nodes. This structure is
* passed through the B-link tree layer to the methods for the objects
@@ -182,9 +184,10 @@ typedef struct H5G_bt_it_ud1_t {
/* downward */
hid_t group_id; /*group id to pass to iteration operator */
haddr_t heap_addr; /*symbol table heap address */
- H5G_iterate_t op; /*iteration operator */
+ H5G_link_iterate_t op; /*iteration operator */
void *op_data; /*user-defined operator data */
int skip; /*initial entries to skip */
+ hbool_t lib_internal; /* Callback is library internal */
/* upward */
int *final_ent; /*final entry looked at */
@@ -233,13 +236,48 @@ typedef struct H5G_bt_it_ud4_t {
/* Data passed to B-tree iteration for copying copy symblol table content */
typedef struct H5G_bt_it_ud5_t {
- H5O_loc_t *src_oloc; /* source object location */
- haddr_t src_heap_addr; /* heap address of the source symbol table */
+ const H5O_loc_t *src_oloc; /* Source object location */
+ haddr_t src_heap_addr; /* Heap address of the source symbol table */
H5F_t *dst_file; /* File of destination group */
- H5O_stab_t *dst_stab; /* symbol table info for destination group */
+ H5O_stab_t *dst_stab; /* Symbol table message for destination group */
H5O_copy_t *cpy_info; /* Information for copy operation */
} H5G_bt_it_ud5_t;
+/* Typedefs for "new format" groups */
+/* (fractal heap & v2 B-tree info) */
+
+/* Typedef for native 'name' field index records in the v2 B-tree */
+typedef struct H5G_dense_bt2_name_rec_t {
+ uint32_t hash; /* Hash of 'name' field value */
+ uint8_t id[H5G_DENSE_FHEAP_ID_LEN]; /* Heap ID for link */
+} H5G_dense_bt2_name_rec_t;
+
+/*
+ * Common data exchange structure for dense link storage. This structure is
+ * passed through the v2 B-tree layer to the methods for the objects
+ * to which the v2 B-tree points.
+ */
+typedef struct H5G_bt2_ud_common_t {
+ /* downward */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+ const char *name; /* Name of link to compare */
+ uint32_t name_hash; /* Hash of name of link to compare */
+ H5B2_found_t found_op; /* Callback when correct link is found */
+ void *found_op_data; /* Callback data when correct link is found */
+} H5G_bt2_ud_common_t;
+
+/*
+ * Data exchange structure for dense link storage. This structure is
+ * passed through the v2 B-tree layer when inserting links.
+ */
+typedef struct H5G_bt2_ud_ins_t {
+ /* downward */
+ H5G_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
+ uint8_t id[H5G_DENSE_FHEAP_ID_LEN]; /* Heap ID of link to insert */
+} H5G_bt2_ud_ins_t;
+
/* Typedef for path traversal operations */
/* grp_loc is the location of the group in which the targeted object is located.
* name is the last component of the object's name
@@ -265,6 +303,12 @@ typedef herr_t (*H5G_traverse_t)(H5G_loc_t *grp_loc/*in*/, const char *name,
#define H5G_TARGET_UDLINK 0x0004
#define H5G_CRT_INTMD_GROUP 0x0008
+/* Data structure to hold table of links for a group */
+typedef struct {
+ size_t nlinks; /* # of links in table */
+ H5O_link_t *lnks; /* Pointer to array of links */
+} H5G_link_table_t;
+
/*
* This is the class identifier to give to the B-tree functions.
*/
@@ -288,15 +332,17 @@ H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name,
* functions that understand names are exported to the rest of
* the library and appear in H5Gprivate.h.
*/
-H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id);
+H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id,
+ const H5O_ginfo_t *ginfo, H5O_stab_t *stab);
H5_DLL herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link);
-H5_DLL herr_t H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip,
- int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5G_stab_iterate(H5O_loc_t *oloc, H5_iter_order_t order,
+ hid_t gid, hbool_t lib_internal, int skip, int *last_obj,
+ H5G_link_iterate_t op, void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id);
H5_DLL ssize_t H5G_stab_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
size_t size, hid_t dxpl_id);
@@ -323,11 +369,9 @@ H5_DLL herr_t H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name,
H5_DLL herr_t H5G_ent_debug(H5F_t *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream,
int indent, int fwidth, haddr_t heap);
-struct H5HL_t; /* defined in H5HLprivate.h */
-
/* Functions that understand symbol table nodes */
H5_DLL herr_t H5G_node_init(H5F_t *f);
-H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+H5_DLL int H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
@@ -337,41 +381,60 @@ H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t a
const void *_rt_key, void *_udata);
H5_DLL int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
-#ifdef H5_GROUP_REVISION
-H5_DLL int H5G_node_stab_convert(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
- const void *_rt_key, void *_udata);
-#endif /* H5_GROUP_REVISION */
/* Functions that understand link messages */
-/* forward reference for later use */
-struct H5HL_t; /* defined in H5HLprivate.h */
-H5_DLL herr_t H5G_link_convert(H5O_link_t *lnk, const H5G_entry_t *ent,
- const struct H5HL_t *_heap, const char *name);
+H5_DLL herr_t H5G_link_convert(H5F_t *f, hid_t dxpl_id, H5O_link_t *lnk,
+ haddr_t lheap_addr, const H5G_entry_t *ent, const char *name);
+H5_DLL herr_t H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id,
+ const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk,
+ H5O_copy_t *cpy_info);
H5_DLL herr_t H5G_link_insert(H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk,
hid_t dxpl_id);
-H5_DLL ssize_t H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
- size_t size, hid_t dxpl_id);
-H5_DLL H5G_obj_t H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx,
- hid_t dxpl_id);
+H5_DLL ssize_t H5G_link_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size);
+H5_DLL H5G_obj_t H5G_link_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, hsize_t idx);
H5_DLL herr_t H5G_link_remove(const H5O_loc_t *oloc, const char *name,
H5G_obj_t *obj_type, hid_t dxpl_id);
-H5_DLL herr_t H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip,
- int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5G_link_iterate(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, hid_t gid, hbool_t lib_internal, int skip,
+ int *last_obj, H5G_link_iterate_t op, void *op_data);
H5_DLL herr_t H5G_link_lookup(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk, hid_t dxpl_id);
+/* Functions that understand "dense" link storage */
+H5_DLL herr_t H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, H5G_link_table_t *ltable);
+H5_DLL herr_t H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo);
+H5_DLL herr_t H5G_dense_insert(H5F_t *f, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, const H5O_link_t *lnk);
+H5_DLL herr_t H5G_dense_lookup(H5F_t *f, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, const char *name, H5O_link_t *lnk);
+H5_DLL herr_t H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, H5_iter_order_t order,
+ hid_t gid, const H5O_linfo_t *linfo, hbool_t lib_internal, int skip,
+ int *last_lnk, H5G_link_iterate_t op, void *op_data);
+H5_DLL ssize_t H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id,
+ H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size);
+H5_DLL H5G_obj_t H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id,
+ H5O_linfo_t *linfo, hsize_t idx);
+H5_DLL herr_t H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const char *name, H5G_obj_t *obj_type);
+H5_DLL herr_t H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ hbool_t adj_link);
+
/* Functions that understand objects */
-H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id,
-#ifdef H5_GROUP_REVISION
- H5O_ginfo_t *ginfo,
-#endif /* H5_GROUP_REVISION */
+H5_DLL int H5G_obj_cmp_name_inc(const void *lnk1, const void *lnk2);
+H5_DLL int H5G_obj_cmp_name_dec(const void *lnk1, const void *lnk2);
+H5_DLL herr_t H5G_obj_release_table(H5G_link_table_t *ltable);
+H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5O_loc_t *oloc/*out*/);
H5_DLL herr_t H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name,
- H5O_link_t *obj_lnk, hbool_t inc_link, hid_t dxpl_id);
+ H5O_link_t *obj_lnk, hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk, hid_t dxpl_id);
-H5_DLL herr_t H5G_obj_iterate(hid_t loc_id, const char *name, int skip,
- int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5G_obj_iterate(hid_t loc_id, const char *name,
+ H5_iter_order_t order, int skip, int *last_obj, H5G_iterate_t op,
+ void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id);
H5_DLL ssize_t H5G_obj_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx,
char* name, size_t size, hid_t dxpl_id);
@@ -394,7 +457,7 @@ H5_DLL herr_t H5G_name_set(H5G_name_t *loc, H5G_name_t *obj, const char *name);
*/
H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, H5G_loc_t *src, H5_copy_depth_t depth);
H5_DLL herr_t H5G_loc_insert(H5G_loc_t *grp_loc, const char *name,
- H5G_loc_t *obj_loc, hbool_t inc_link, hid_t dxpl_id);
+ H5G_loc_t *obj_loc, hid_t dxpl_id);
H5_DLL herr_t H5G_loc_exists(const H5G_loc_t *loc, const char *name, hid_t dxpl_id);
H5_DLL herr_t H5G_loc_remove(H5G_loc_t *grp_loc, const char *name,
H5G_loc_t *obj_loc, hid_t dxpl_id);
@@ -404,6 +467,7 @@ H5_DLL herr_t H5G_loc_remove(H5G_loc_t *grp_loc, const char *name,
H5_DLL htri_t H5G_is_empty_test(hid_t gid);
H5_DLL htri_t H5G_has_links_test(hid_t gid, unsigned *nmsgs);
H5_DLL htri_t H5G_has_stab_test(hid_t gid);
+H5_DLL htri_t H5G_is_new_dense_test(hid_t gid);
H5_DLL herr_t H5G_lheap_size_test(hid_t gid, size_t *lheap_size);
H5_DLL herr_t H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *user_path_hidden);
#endif /* H5G_TESTING */
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index d03f400..e1379c5 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -58,8 +58,24 @@
/* ========= Group Creation properties ============ */
+/* Defaults for link info values */
+#define H5G_CRT_LINFO_NLINKS 0
+#define H5G_CRT_LINFO_MIN_CORDER 0
+#define H5G_CRT_LINFO_MAX_CORDER 0
+#define H5G_CRT_LINFO_LINK_FHEAP_ADDR HADDR_UNDEF
+#define H5G_CRT_LINFO_NAME_BT2_ADDR HADDR_UNDEF
+#define H5G_CRT_LINFO_CORDER_BT2_ADDR HADDR_UNDEF
+#define H5G_CRT_LINK_INFO_DEF {H5G_CRT_LINFO_NLINKS, \
+ H5G_CRT_LINFO_MIN_CORDER, \
+ H5G_CRT_LINFO_MAX_CORDER, \
+ H5G_CRT_LINFO_LINK_FHEAP_ADDR, \
+ H5G_CRT_LINFO_NAME_BT2_ADDR, \
+ H5G_CRT_LINFO_CORDER_BT2_ADDR}
+
/* Defaults for group info values */
#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
+#define H5G_CRT_GINFO_TRACK_CORDER FALSE
+#define H5G_CRT_GINFO_INDEX_CORDER FALSE
#define H5G_CRT_GINFO_MAX_COMPACT 8
#define H5G_CRT_GINFO_MIN_DENSE 6
#define H5G_CRT_GINFO_EST_NUM_ENTRIES 4
@@ -69,6 +85,8 @@
#define H5G_CRT_GROUP_INFO_NAME "group info"
#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
#define H5G_CRT_GROUP_INFO_DEF {H5G_CRT_GINFO_LHEAP_SIZE_HINT, \
+ H5G_CRT_GINFO_TRACK_CORDER, \
+ H5G_CRT_GINFO_INDEX_CORDER, \
H5G_CRT_GINFO_MAX_COMPACT, \
H5G_CRT_GINFO_MIN_DENSE, \
H5G_CRT_GINFO_EST_NUM_ENTRIES, \
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 45e6f64..e6851f4 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -100,11 +100,9 @@ H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name,
const char *comment);
H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
char *buf);
-#ifdef H5_GROUP_REVISION
H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, hid_t gcpl_id,
hid_t gapl_id);
H5_DLL hid_t H5Gget_create_plist(hid_t group_id);
-#endif /* H5_GROUP_REVISION */
H5_DLL herr_t H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
@@ -112,22 +110,22 @@ H5_DLL herr_t H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
* of the HDF5 API.
* Use of these functions and variables is depreciated.
*/
-H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_link_t type,
+H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type,
const char *cur_name, const char *new_name);
H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name,
const char *dst_name);
H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name,
- H5L_link_t type, hid_t new_loc_id, const char *new_name);
+ H5L_type_t type, hid_t new_loc_id, const char *new_name);
H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name,
hid_t dst_loc_id, const char *dst_name);
H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name,
size_t size, char *buf/*out*/);
-#define H5G_LINK_ERROR H5L_LINK_ERROR
-#define H5G_LINK_HARD H5L_LINK_HARD
-#define H5G_LINK_SOFT H5L_LINK_SOFT
-#define H5G_link_t H5L_link_t
+#define H5G_LINK_ERROR H5L_TYPE_ERROR
+#define H5G_LINK_HARD H5L_TYPE_HARD
+#define H5G_LINK_SOFT H5L_TYPE_SOFT
+#define H5G_link_t H5L_type_t
#define H5G_SAME_LOC H5L_SAME_LOC
@@ -136,4 +134,3 @@ H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name,
#endif
#endif
-
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index c4dc677..81b9916 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -155,12 +155,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id)
+H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
+ H5O_stab_t *stab)
{
-#ifdef H5_GROUP_REVISION
- H5O_ginfo_t ginfo; /* Group info message */
size_t heap_hint; /* Local heap size hint */
-#endif /* H5_GROUP_REVISION */
size_t size_hint; /* Local heap size hint */
herr_t ret_value = SUCCEED; /* Return value */
@@ -172,21 +170,16 @@ H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id)
HDassert(grp_oloc);
HDassert(stab);
-#ifdef H5_GROUP_REVISION
- /* Get the group info */
- if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
-
/* Adjust the size hint, if necessary */
- if(ginfo.lheap_size_hint == 0)
- heap_hint = ginfo.est_num_entries * (ginfo.est_name_len + 1);
+ if(ginfo->lheap_size_hint == 0)
+ heap_hint = 8 + /* "null" name inserted for B-tree */
+ (ginfo->est_num_entries * H5HL_ALIGN(ginfo->est_name_len + 1)) + /* estimated size of names for links, aligned for inserting into local heap */
+ H5HL_SIZEOF_FREE(grp_oloc->file); /* Free list entry in local heap */
else
- heap_hint = ginfo.lheap_size_hint;
+ heap_hint = ginfo->lheap_size_hint;
size_hint = MAX(heap_hint, H5HL_SIZEOF_FREE(grp_oloc->file) + 2);
-#else /* H5_GROUP_REVISION */
- size_hint = 4 * (H5HL_SIZEOF_FREE(grp_oloc->file) + 2);
-#endif /* H5_GROUP_REVISION */
+ /* Go create the B-tree & local heap */
if(H5G_stab_create_components(grp_oloc->file, stab, size_hint, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components")
@@ -363,11 +356,11 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_lin
udata.adj_link = adj_link;
/* Delete entire B-tree */
- if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata)<0)
+ if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree");
/* Delete local heap for names */
- if(H5HL_delete(f, dxpl_id, stab->heap_addr)<0)
+ if(H5HL_delete(f, dxpl_id, stab->heap_addr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap");
done:
@@ -388,8 +381,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
- H5G_iterate_t op, void *op_data, hid_t dxpl_id)
+H5G_stab_iterate(H5O_loc_t *oloc, H5_iter_order_t order, hid_t gid,
+ hbool_t lib_internal, int skip, int *last_lnk, H5G_link_iterate_t op,
+ void *op_data, hid_t dxpl_id)
{
H5G_bt_it_ud1_t udata; /* User data to pass to B-tree callback */
H5O_stab_t stab; /* Info about symbol table */
@@ -399,26 +393,34 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
/* Sanity check */
HDassert(oloc);
- HDassert(H5I_GROUP == H5I_get_type(gid));
- HDassert(last_obj);
- HDassert(op);
+ HDassert(lib_internal || H5I_GROUP == H5I_get_type(gid));
+ HDassert(op.lib_op);
/* Get the B-tree info */
if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
- /* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
- udata.group_id = gid;
- udata.skip = skip;
- udata.heap_addr = stab.heap_addr;
- udata.op = op;
- udata.op_data = op_data;
- udata.final_ent = last_obj;
-
- /* Iterate over the group members */
- if((ret_value = H5B_iterate(oloc->file, H5AC_dxpl_id, H5B_SNODE,
- H5G_node_iterate, stab.btree_addr, &udata))<0)
- HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+ /* Check on iteration order */
+ /* ("native" iteration order is increasing for this link storage mechanism) */
+ if(order != H5_ITER_DEC) {
+ /* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
+ udata.group_id = gid;
+ udata.skip = skip;
+ udata.heap_addr = stab.heap_addr;
+ udata.lib_internal = lib_internal;
+ udata.op = op;
+ udata.op_data = op_data;
+ udata.final_ent = last_lnk;
+
+ /* Iterate over the group members */
+ if((ret_value = H5B_iterate(oloc->file, H5AC_dxpl_id, H5B_SNODE,
+ H5G_node_iterate, stab.btree_addr, &udata)) < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+ } /* end if */
+ else {
+HDfprintf(stderr, "%s: Decreasing iteration order for symbol table storage not supported yet!\n", FUNC);
+HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "decreasing iteration order for symbol table storage not supported yet")
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -428,7 +430,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_stab_count
*
- * Purpose: Count the # of objects in a group
+ * Purpose: Count the # of links in a group
*
* Return: Non-negative on success/Negative on failure
*
@@ -470,7 +472,7 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Raymond Lu
@@ -502,7 +504,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
udata.name = NULL;
/* Iterate over the group members */
- if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_name, stab.btree_addr, &udata))<0)
+ if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_name, stab.btree_addr, &udata)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed")
/* If we don't know the name now, we almost certainly went out of bounds */
@@ -603,80 +605,10 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata)
/* Set link info */
if(udata->lnk) {
- /* Set (default) common info for link */
- udata->lnk->cset = H5F_CRT_DEFAULT_CSET;
- udata->lnk->ctime = 0;
- udata->lnk->name = H5MM_xstrdup(udata->name);
-
- /* Object is a symbolic or user-defined link */
- switch(ent->type)
- {
- case H5G_CACHED_SLINK:
- {
- const char *s; /* Pointer to link value */
- const H5HL_t *heap; /* Pointer to local heap for group */
-
- /* Lock the local heap */
- if(NULL == (heap = H5HL_protect(udata->file, udata->dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
-
- s = H5HL_offset_into(udata->file, heap, ent->cache.slink.lval_offset);
-
- /* Copy the link value */
- udata->lnk->u.soft.name = H5MM_xstrdup(s);
-
- /* Release the local heap */
- if(H5HL_unprotect(udata->file, udata->dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
-
- /* Set link type */
- udata->lnk->type = H5L_LINK_SOFT;
- }
- break;
-
- case H5G_CACHED_ULINK:
- {
- void * s; /* Pointer to heap value */
- const H5HL_t *heap; /* Pointer to local heap for group */
- size_t data_size; /* Size of user link data */
-
- /* Lock the local heap */
- if(NULL == (heap = H5HL_protect(udata->file, udata->dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
-
- data_size =ent->cache.ulink.udata_size;
-
- /* If there is user data, allocate space for it and copy it from the heap */
- if(data_size > 0)
- {
- s = H5HL_offset_into(udata->file, heap, ent->cache.ulink.udata_offset);
-
- udata->lnk->u.ud.udata = H5MM_malloc(data_size);
- HDmemcpy(udata->lnk->u.ud.udata, s, data_size);
- } /* end if */
- else
- udata->lnk->u.ud.udata = NULL;
-
- /* Release the local heap */
- if(H5HL_unprotect(udata->file, udata->dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- {
- /* Release allocated memory before exiting */
- H5MM_free(udata->lnk->u.ud.udata);
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
- }
- /* Set link size and type */
- udata->lnk->u.ud.size = data_size;
- udata->lnk->type = ent->cache.ulink.link_type;
- }
- break;
-
- default:
- /* Set address of object */
- udata->lnk->u.hard.addr = ent->header;
-
- /* Set link type */
- udata->lnk->type = H5L_LINK_HARD;
- } /* end switch */
+ /* Convert the entry to a link */
+ if(H5G_link_convert(udata->file, udata->dxpl_id, udata->lnk, udata->heap_addr,
+ ent, udata->name) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link")
} /* end if */
done:
@@ -738,4 +670,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_stab_lookup() */
-
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 262a925..a142dfd 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -29,7 +29,6 @@
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
-#ifdef H5_GROUP_REVISION
/*--------------------------------------------------------------------------
NAME
@@ -43,7 +42,7 @@
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
Checks to see if the group has no link messages and no symbol table message
- dimensionality and shape.
+ and no "dense" link storage
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
@@ -54,7 +53,8 @@ htri_t
H5G_is_empty_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
- htri_t msg_exists = 0; /* Indicate that a header message is present */
+ htri_t msg_exists = FALSE; /* Indicate that a header message is present */
+ htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5G_is_empty_test, FAIL)
@@ -63,17 +63,79 @@ H5G_is_empty_test(hid_t gid)
if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ /* "New format" checks */
+
/* Check if the group has any link messages */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
- if(msg_exists > 0)
+ if(msg_exists > 0) {
+ /* Sanity check that new group format shouldn't have old messages */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
+
HGOTO_DONE(FALSE)
+ } /* end if */
+
+ /* Check for a link info message */
+ if((linfo_exists = H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(linfo_exists > 0) {
+ H5O_linfo_t linfo; /* Link info message */
+
+ /* Sanity check that new group format shouldn't have old messages */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
+
+ /* Get the link info */
+ if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+
+ /* Check for 'dense' link storage file addresses being defined */
+ if(H5F_addr_defined(linfo.link_fheap_addr))
+ HGOTO_DONE(FALSE)
+ if(H5F_addr_defined(linfo.name_bt2_addr))
+ HGOTO_DONE(FALSE)
+ if(H5F_addr_defined(linfo.corder_bt2_addr))
+ HGOTO_DONE(FALSE)
+
+ /* Check for link count */
+ if(linfo.nlinks > 0)
+ HGOTO_DONE(FALSE)
+ } /* end if */
+
+ /* "Old format" checks */
/* Check if the group has a symbol table message */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
- if(msg_exists > 0)
- HGOTO_DONE(FALSE)
+ if(msg_exists > 0) {
+ H5O_stab_t stab; /* Info about local heap & B-tree */
+ hsize_t nlinks; /* Number of links in the group */
+
+ /* Sanity check that old group format shouldn't have new messages */
+ if(linfo_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_GINFO_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found")
+
+ /* Get the B-tree & local heap info */
+ if(NULL == H5O_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message")
+
+ /* Get the count of links in the group */
+ if(H5G_stab_count(&(grp->oloc), &nlinks, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links")
+
+ /* Check for link count */
+ if(nlinks > 0)
+ HGOTO_DONE(FALSE)
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -185,7 +247,73 @@ H5G_has_stab_test(hid_t gid)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_has_stab_test() */
-#endif /* H5_GROUP_REVISION */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5G_is_new_dense_test
+ PURPOSE
+ Determine whether a group is in the "new" format and dense
+ USAGE
+ htri_t H5G_is_new_dense_test(gid)
+ hid_t gid; IN: group to check
+ RETURNS
+ Non-negative TRUE/FALSE on success, negative on failure
+ DESCRIPTION
+ Checks to see if the group is in the "new" format for groups (link messages/
+ fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has
+ a name B-tree index).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5G_is_new_dense_test(hid_t gid)
+{
+ H5G_t *grp = NULL; /* Pointer to group */
+ htri_t msg_exists = 0; /* Indicate that a header message is present */
+ htri_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_is_new_dense_test, FAIL)
+
+ /* Get group structure */
+ if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+
+ /* Check if the group has a symbol table message */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_DONE(FALSE)
+
+ /* Check if the group has any link messages */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_DONE(FALSE)
+
+ /* Check if the group has link info message */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0) {
+ H5O_linfo_t linfo; /* Link info message */
+
+ /* Get the link info */
+ if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+
+ /* Check for 'dense' link storage file addresses being defined */
+ if(!H5F_addr_defined(linfo.link_fheap_addr))
+ HGOTO_DONE(FALSE)
+ if(!H5F_addr_defined(linfo.name_bt2_addr))
+ HGOTO_DONE(FALSE)
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5G_is_new_dense_test() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 5a58e2b..0bdc0f4 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -150,7 +150,7 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t lapl_id,
hid_t dxpl_id)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
+ const H5L_class_t *link_class; /* User-defined link class */
hid_t cb_return = -1; /* The ID the user-defined callback returned */
H5G_loc_t grp_loc_copy;
H5G_name_t grp_path_copy;
@@ -168,7 +168,7 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
- HDassert(lnk->type >= H5L_LINK_UD_MIN);
+ HDassert(lnk->type >= H5L_TYPE_UD_MIN);
HDassert(obj_loc);
HDassert(nlinks);
@@ -310,7 +310,7 @@ H5G_traverse_slink(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
- HDassert(lnk->type == H5L_LINK_SOFT);
+ HDassert(lnk->type == H5L_TYPE_SOFT);
HDassert(nlinks);
/* Set up temporary location */
@@ -545,16 +545,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* If there's valid information in the link, reset it */
if(link_valid) {
-#ifdef H5_GROUP_REVISION
H5O_reset(H5O_LINK_ID, &lnk);
-#else /* H5_GROUP_REVISION */
- /* Free information for link (but don't free link pointer) */
- if(lnk.type == H5L_LINK_SOFT)
- lnk.u.soft.name = H5MM_xfree(lnk.u.soft.name);
- else if(lnk.type >= H5L_LINK_UD_MIN && lnk.u.ud.size > 0)
- lnk.u.ud.udata = H5MM_xfree(lnk.u.ud.udata);
- lnk.name = H5MM_xfree(lnk.name);
-#endif /* H5_GROUP_REVISION */
link_valid = FALSE;
} /* end if */
@@ -565,8 +556,8 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* If the lookup was OK, try traversing soft links and mount points, if allowed */
if(lookup_status >= 0) {
/* Indicate that the link info is valid */
- HDassert(lnk.type >= H5L_LINK_HARD);
- if(lnk.type >H5L_LINK_BUILTIN_MAX && lnk.type < H5L_LINK_UD_MIN)
+ HDassert(lnk.type >= H5L_TYPE_HARD);
+ if(lnk.type >H5L_TYPE_BUILTIN_MAX && lnk.type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "unknown link type")
link_valid = TRUE;
@@ -577,7 +568,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Set the object location, if it's a hard link set the address also */
obj_loc.oloc->file = grp_loc.oloc->file;
obj_loc.oloc->holding_file = FALSE;
- if(lnk.type == H5L_LINK_HARD)
+ if(lnk.type == H5L_TYPE_HARD)
obj_loc.oloc->addr = lnk.u.hard.addr;
obj_loc_valid = TRUE;
@@ -586,7 +577,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* is the last component of the name and the H5G_TARGET_SLINK bit of
* TARGET is set then we don't follow it.
*/
- if(H5L_LINK_SOFT == lnk.type &&
+ if(H5L_TYPE_SOFT == lnk.type &&
(0 == (target & H5G_TARGET_SLINK) || !last_comp)) {
if((*nlinks)-- <= 0)
HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links")
@@ -599,7 +590,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* is the last component of the name and the H5G_TARGET_UDLINK bit of
* TARGET is set then we don't follow it.
*/
- if( lnk.type >= H5L_LINK_UD_MIN && ((0 == (target & H5G_TARGET_UDLINK)) || !last_comp) ) {
+ if( lnk.type >= H5L_TYPE_UD_MIN && ((0 == (target & H5G_TARGET_UDLINK)) || !last_comp) ) {
if((*nlinks)-- <= 0)
HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links")
if(H5G_traverse_ud(&grp_loc/*in,out*/, &lnk/*in*/, &obj_loc, nlinks, lapl_id, dxpl_id) < 0)
@@ -660,26 +651,29 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
if(lookup_status < 0) {
/* If an intermediate group doesn't exist & flag is set, create the group */
if(target & H5G_CRT_INTMD_GROUP) {
-#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info message for parent group */
/* Get the group info for parent group */
- if(NULL == H5O_read(grp_loc.oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
-#endif /* H5_GROUP_REVISION */
+ /* (OK if not found) */
+ if(NULL == H5O_read(grp_loc.oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) {
+ H5O_ginfo_t def_ginfo = H5G_CRT_GROUP_INFO_DEF;
+
+ /* Clear error stack from not finding the group info message */
+ H5E_clear_stack(NULL);
+
+ /* Use default group info settings */
+ HDmemcpy(&ginfo, &def_ginfo, sizeof(H5O_ginfo_t));
+ } /* end if */
/* Create the intermediate group */
/* XXX: Should we allow user to control the group creation params here? -QAK */
- if(H5G_obj_create(grp_oloc.file, dxpl_id,
-#ifdef H5_GROUP_REVISION
- &ginfo,
-#endif /* H5_GROUP_REVISION */
- obj_loc.oloc/*out*/) < 0)
+ if(H5G_obj_create(grp_oloc.file, dxpl_id, &ginfo, obj_loc.oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
/* Insert new group into current group's symbol table */
- if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, TRUE, dxpl_id) < 0)
+ if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group")
+
/* Close new group */
if(H5O_close(obj_loc.oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close")
@@ -742,18 +736,8 @@ done:
H5G_loc_free(&grp_loc);
/* If there's valid information in the link, reset it */
- if(link_valid) {
-#ifdef H5_GROUP_REVISION
+ if(link_valid)
H5O_reset(H5O_LINK_ID, &lnk);
-#else /* H5_GROUP_REVISION */
- /* Free information for link (but don't free link pointer) */
- if(lnk.type == H5L_LINK_SOFT)
- lnk.u.soft.name = H5MM_xfree(lnk.u.soft.name);
- else if(lnk.type >= H5L_LINK_UD_MIN && lnk.u.ud.size > 0)
- lnk.u.ud.udata = H5MM_xfree(lnk.u.ud.udata);
- lnk.name = H5MM_xfree(lnk.name);
-#endif /* H5_GROUP_REVISION */
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_real() */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 4908d4b..ae4185d 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -373,7 +373,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
UINT32DECODE(p, hdr->pline_root_direct_filter_mask);
/* Decode I/O filter information */
- if(NULL == (pline = H5O_decode(hdr->f, p, H5O_PLINE_ID)))
+ if(NULL == (pline = H5O_decode(hdr->f, dxpl_id, p, H5O_PLINE_ID)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
p += hdr->filter_len;
diff --git a/src/H5HL.c b/src/H5HL.c
index cdfe49b..d1bf94f 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -42,7 +42,7 @@
/* Private macros */
#define H5HL_FREE_NULL 1 /*end of free list on disk */
-#define H5HL_MIN_HEAP 256 /* Minimum size to reduce heap buffer to */
+#define H5HL_MIN_HEAP 128 /* Minimum size to reduce heap buffer to */
/*
* Local heap collection version.
@@ -343,8 +343,8 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
FUNC_ENTER_NOAPI(H5HL_minimize_heap_space, FAIL)
/* check args */
- HDassert( f );
- HDassert( heap );
+ HDassert(f);
+ HDassert(heap);
sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */
@@ -358,12 +358,12 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
H5HL_free_t *last_fl = NULL;
/* Search for a free block at the end of the buffer */
- for (tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next)
+ for(tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next)
/* Check if the end of this free block is at the end of the buffer */
- if (tmp_fl->offset + tmp_fl->size == heap->heap_alloc) {
+ if(tmp_fl->offset + tmp_fl->size == heap->heap_alloc) {
last_fl = tmp_fl;
break;
- }
+ } /* end if */
/*
* Found free block at the end of the buffer, decide what to do
@@ -980,16 +980,16 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *
HDassert(buf_size > 0);
HDassert(buf);
- if (0==(f->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file");
+ if(0 == (f->intent & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file")
- if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap");
+ if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap")
heap_flags |= H5AC__DIRTIED_FLAG;
/* Cache this for later */
- sizeof_hdr= H5HL_SIZEOF_HDR(f);
+ sizeof_hdr = H5HL_SIZEOF_HDR(f);
/*
* In order to keep the free list descriptors aligned on word boundaries,
@@ -1280,21 +1280,21 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
FUNC_ENTER_NOAPI(H5HL_remove, FAIL);
/* check arguments */
- HDassert( f );
- HDassert( H5F_addr_defined(addr) );
- HDassert( size > 0 );
- HDassert( offset == H5HL_ALIGN(offset) );
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(size > 0);
+ HDassert(offset == H5HL_ALIGN(offset));
- if (0==(f->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file");
+ if(0 == (f->intent & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
size = H5HL_ALIGN (size);
- if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap");
+ if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap")
- HDassert( offset < heap->heap_alloc );
- HDassert( offset + size <= heap->heap_alloc );
+ HDassert(offset < heap->heap_alloc);
+ HDassert(offset + size <= heap->heap_alloc);
fl = heap->freelist;
heap_flags |= H5AC__DIRTIED_FLAG;
@@ -1304,106 +1304,105 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
* free chunk. It might also fall between two chunks in such a way
* that all three chunks can be combined into one.
*/
- while (fl) {
- if (offset + size == fl->offset) {
+ while(fl) {
+ if((offset + size) == fl->offset) {
fl->offset = offset;
fl->size += size;
- assert (fl->offset==H5HL_ALIGN (fl->offset));
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->offset==H5HL_ALIGN (fl->offset));
+ HDassert(fl->size==H5HL_ALIGN (fl->size));
fl2 = fl->next;
- while (fl2) {
- if (fl2->offset + fl2->size == fl->offset) {
+ while(fl2) {
+ if((fl2->offset + fl2->size) == fl->offset) {
fl->offset = fl2->offset;
fl->size += fl2->size;
- assert (fl->offset==H5HL_ALIGN (fl->offset));
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->offset == H5HL_ALIGN (fl->offset));
+ HDassert(fl->size == H5HL_ALIGN (fl->size));
fl2 = H5HL_remove_free(heap, fl2);
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc ) &&
+ ((2 * fl->size) > heap->heap_alloc )) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl2 = fl2->next;
}
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0 )
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
-
- } else if (fl->offset + fl->size == offset) {
+ } else if(fl->offset + fl->size == offset) {
fl->size += size;
fl2 = fl->next;
- assert (fl->size==H5HL_ALIGN (fl->size));
- while (fl2) {
- if (fl->offset + fl->size == fl2->offset) {
+ HDassert(fl->size==H5HL_ALIGN (fl->size));
+ while(fl2) {
+ if(fl->offset + fl->size == fl2->offset) {
fl->size += fl2->size;
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->size==H5HL_ALIGN (fl->size));
fl2 = H5HL_remove_free(heap, fl2);
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl2 = fl2->next;
}
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl = fl->next;
- }
+ } /* end while */
/*
* The amount which is being removed must be large enough to
* hold the free list data. If not, the freed chunk is forever
* lost.
*/
- if (size < H5HL_SIZEOF_FREE(f)) {
+ if(size < H5HL_SIZEOF_FREE(f)) {
#ifdef H5HL_DEBUG
- if (H5DEBUG(HL)) {
+ if(H5DEBUG(HL)) {
fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n",
(unsigned long) size);
}
#endif
HGOTO_DONE(SUCCEED);
- }
+ } /* end if */
/*
* Add an entry to the free list.
*/
- if (NULL==(fl = H5FL_MALLOC(H5HL_free_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if(NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
fl->offset = offset;
fl->size = size;
- assert (fl->offset==H5HL_ALIGN (fl->offset));
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->offset == H5HL_ALIGN(fl->offset));
+ HDassert(fl->size == H5HL_ALIGN(fl->size));
fl->prev = NULL;
fl->next = heap->freelist;
- if (heap->freelist)
+ if(heap->freelist)
heap->freelist->prev = fl;
heap->freelist = fl;
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
- }
+ } /* end if */
done:
- if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED)
- HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
+ if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5HL_remove() */
/*-------------------------------------------------------------------------
diff --git a/src/H5L.c b/src/H5L.c
index 538ceb9..3cc46c7 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -121,13 +121,13 @@ static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/,
static herr_t H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
const H5O_link_t *lnk, H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static int H5L_find_class_idx(H5L_link_t id);
+static int H5L_find_class_idx(H5L_type_t id);
/* Information about user-defined links */
-static size_t H5L_table_alloc_g = 0;
-static size_t H5L_table_used_g = 0;
-static H5L_link_class_t *H5L_table_g = NULL;
+static size_t H5L_table_alloc_g = 0;
+static size_t H5L_table_used_g = 0;
+static H5L_class_t *H5L_table_g = NULL;
@@ -172,7 +172,7 @@ done:
*
* The link class passed in will override any existing link
* class for the specified link class ID. It must at least
- * include a H5L_link_class_t version (which should be
+ * include a H5L_class_t version (which should be
* H5L_LINK_CLASS_T_VERS), a link class ID, and a traversal
* function.
*
@@ -184,7 +184,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lregister(const H5L_link_class_t *cls)
+H5Lregister(const H5L_class_t *cls)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -195,13 +195,13 @@ H5Lregister(const H5L_link_class_t *cls)
if (cls==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
- /* Check H5L_link_class_t version number; this is where a function to convert
+ /* Check H5L_class_t version number; this is where a function to convert
* from an outdated version should be called.
*/
if(cls->version != H5L_LINK_CLASS_T_VERS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_link_class_t version number");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number");
- if (cls->id<H5L_LINK_UD_MIN || cls->id>H5L_LINK_MAX)
+ if (cls->id<H5L_TYPE_UD_MIN || cls->id>H5L_TYPE_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number")
if (cls->trav_func==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified")
@@ -231,7 +231,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5L_find_class_idx(H5L_link_t id)
+H5L_find_class_idx(H5L_type_t id)
{
size_t i; /* Local index variable */
int ret_value=FAIL; /* Return value */
@@ -261,11 +261,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-const H5L_link_class_t *
-H5L_find_class(H5L_link_t id)
+const H5L_class_t *
+H5L_find_class(H5L_type_t id)
{
int idx; /* Filter index in global table */
- H5L_link_class_t *ret_value=NULL; /* Return value */
+ H5L_class_t *ret_value=NULL; /* Return value */
FUNC_ENTER_NOAPI(H5L_find_class, NULL)
@@ -541,6 +541,8 @@ H5Llink(hid_t new_loc_id, const char *new_name, hid_t obj_id, hid_t lcpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long")
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@@ -691,7 +693,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_link_t link_type,
+H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc;
@@ -856,7 +858,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lunregister(H5L_link_t id)
+H5Lunregister(H5L_type_t id)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -864,7 +866,7 @@ H5Lunregister(H5L_link_t id)
H5TRACE1("e","Ll",id);
/* Check args */
- if (id<0 || id>H5L_LINK_MAX)
+ if (id<0 || id>H5L_TYPE_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
/* Do it */
@@ -891,7 +893,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-htri_t H5Lis_registered(H5L_link_t id)
+htri_t H5Lis_registered(H5L_type_t id)
{
size_t i; /* Local index variable */
htri_t ret_value=FALSE; /* Return value */
@@ -899,7 +901,7 @@ htri_t H5Lis_registered(H5L_link_t id)
FUNC_ENTER_API(H5Lis_registered, FAIL)
/* Check args */
- if(id<0 || id>H5L_LINK_MAX)
+ if(id<0 || id>H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number")
/* Is the link class already registered? */
@@ -938,7 +940,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_register (const H5L_link_class_t *cls)
+H5L_register (const H5L_class_t *cls)
{
size_t i;
herr_t ret_value=SUCCEED; /* Return value */
@@ -946,7 +948,7 @@ H5L_register (const H5L_link_class_t *cls)
FUNC_ENTER_NOAPI(H5L_register, FAIL)
assert (cls);
- assert (cls->id>=0 && cls->id<=H5L_LINK_MAX);
+ assert (cls->id>=0 && cls->id<=H5L_TYPE_MAX);
/* Is the link type already registered? */
for (i=0; i<H5L_table_used_g; i++)
@@ -957,8 +959,8 @@ H5L_register (const H5L_link_class_t *cls)
if (i>=H5L_table_used_g) {
if (H5L_table_used_g>=H5L_table_alloc_g) {
size_t n = MAX(H5L_MIN_TABLE_SIZE, 2*H5L_table_alloc_g);
- H5L_link_class_t *table = H5MM_realloc(H5L_table_g,
- n*sizeof(H5L_link_class_t));
+ H5L_class_t *table = H5MM_realloc(H5L_table_g,
+ n*sizeof(H5L_class_t));
if (!table)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table")
H5L_table_g = table;
@@ -967,12 +969,12 @@ H5L_register (const H5L_link_class_t *cls)
/* Initialize */
i = H5L_table_used_g++;
- HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_link_class_t));
+ HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t));
} /* end if */
/* Filter already registered */
else {
/* Replace old contents */
- HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_link_class_t));
+ HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t));
} /* end else */
done:
@@ -995,14 +997,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_unregister (H5L_link_t id)
+H5L_unregister (H5L_type_t id)
{
size_t i; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5L_unregister,FAIL)
- assert (id>=0 && id<=H5L_LINK_MAX);
+ assert (id>=0 && id<=H5L_TYPE_MAX);
/* Is the filter already registered? */
for (i=0; i<H5L_table_used_g; i++)
@@ -1015,7 +1017,7 @@ H5L_unregister (H5L_link_t id)
/* Remove filter from table */
/* Don't worry about shrinking table size (for now) */
- HDmemmove(&H5L_table_g[i],&H5L_table_g[i+1],sizeof(H5L_link_class_t)*((H5L_table_used_g-1)-i));
+ HDmemmove(&H5L_table_g[i],&H5L_table_g[i+1],sizeof(H5L_class_t)*((H5L_table_used_g-1)-i));
H5L_table_used_g--;
done:
@@ -1056,7 +1058,7 @@ H5L_link(H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc,
*/
/* Construct link information for eventual insertion */
- lnk.type = H5L_LINK_HARD;
+ lnk.type = H5L_TYPE_HARD;
lnk.u.hard.addr = obj_loc->oloc->addr;
/* Create the link */
@@ -1099,7 +1101,7 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name already exists")
/* Check for crossing file boundaries with a new hard link */
- if(udata->lnk->type == H5L_LINK_HARD) {
+ if(udata->lnk->type == H5L_TYPE_HARD) {
/* Check that both objects are in same file */
if(grp_loc->oloc->file->shared != udata->file->shared)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "interfile hard links are not allowed")
@@ -1110,22 +1112,18 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
udata->lnk->name = (char *)name;
/* Insert link into group */
- if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, (hbool_t)(udata->lnk->type == H5L_LINK_HARD ? TRUE : FALSE), udata->dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object")
/* Set object's path if it has been passed in and is not set */
if(udata->path != NULL && udata->path->user_path_r == NULL)
- {
- if(H5G_name_set(grp_loc->path, udata->path, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")
- }
+ if(H5G_name_set(grp_loc->path, udata->path, name) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")
/* If link is a user-defined link, trigger its creation callback if it has one*/
- if(udata->lnk->type >= H5L_LINK_UD_MIN)
+ if(udata->lnk->type >= H5L_TYPE_UD_MIN)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
+ const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(udata->lnk->type)))
@@ -1133,6 +1131,9 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
if(link_class->create_func != NULL)
{
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
/* Create a temporary location (or else H5G_open will do a shallow
* copy and wipe out grp_loc)
*/
@@ -1184,8 +1185,7 @@ done:
* Purpose: Creates a link at a path location
*
* lnk should have linkclass-specific information already
- * set, but this function will take care of setting
- * creation time and name.
+ * set, but this function will take care of setting name.
*
* obj_path can be NULL if the object's path doesn't need to
* be set, and obj_file can be NULL if the object is not a
@@ -1215,7 +1215,7 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path
HDassert(lnk);
HDassert(link_loc);
HDassert(link_name && *link_name);
- HDassert(lnk->type >= H5L_LINK_HARD && lnk->type <= H5L_LINK_MAX);
+ HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX);
/* Get normalized link name */
if((norm_link_name = H5G_normalize(link_name)) == NULL)
@@ -1246,16 +1246,8 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path
/* Fill in common data for the link struct */
lnk->cset = char_encoding;
-#ifdef H5_HAVE_GETTIMEOFDAY
- {
- struct timeval now_tv;
-
- HDgettimeofday(&now_tv, NULL);
- lnk->ctime = now_tv.tv_sec;
- }
-#else /* H5_HAVE_GETTIMEOFDAY */
- lnk->ctime = HDtime(NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ lnk->corder = 0; /* Will be re-written during group insertion, if the group is tracking creation order */
+ lnk->corder_valid = FALSE; /* Creation order not valid (yet) */
/* Set up user data
* file is used to make sure that hard links don't cross files, and
@@ -1325,7 +1317,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name")
/* Set up link data specific to hard links */
- lnk.type = H5L_LINK_HARD;
+ lnk.type = H5L_TYPE_HARD;
/* Get object location for object pointed to */
obj_loc.path = &path;
@@ -1394,7 +1386,7 @@ H5L_create_soft( const char *target_path, H5G_loc_t *link_loc,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name")
/* Set up link data specific to soft links */
- lnk.type = H5L_LINK_SOFT;
+ lnk.type = H5L_TYPE_SOFT;
lnk.u.soft.name = norm_target;
/* Create actual link to the object */
@@ -1426,7 +1418,7 @@ done:
*/
herr_t
H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, const void * ud_data,
- size_t ud_data_size, H5L_link_t type, hid_t lcpl_id, hid_t lapl_id,
+ size_t ud_data_size, H5L_type_t type, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id)
{
H5O_link_t lnk; /* Link to insert */
@@ -1435,7 +1427,7 @@ H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, const void * ud_data,
FUNC_ENTER_NOAPI_NOINIT(H5L_create_ud)
/* Check args */
- HDassert(type >= H5L_LINK_UD_MIN && type <= H5L_LINK_MAX);
+ HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX);
HDassert(link_loc);
HDassert(link_name && *link_name);
HDassert(ud_data_size == 0 || ud_data);
@@ -1489,7 +1481,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5L_trav_ud5_t *udata = (H5L_trav_ud5_t *)_udata; /* User data passed in */
- const H5L_link_class_t *link_class; /* User-defined link class */
+ const H5L_class_t *link_class; /* User-defined link class */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_linkval_cb)
@@ -1498,7 +1490,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
if(lnk == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
- if(H5L_LINK_SOFT == lnk->type)
+ if(H5L_TYPE_SOFT == lnk->type)
{
/* Copy to output buffer */
if(udata->size > 0 && udata->buf) {
@@ -1507,7 +1499,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
udata->buf[udata->size - 1] = '\0';
} /* end if */
}
- else if(lnk->type >= H5L_LINK_UD_MIN)
+ else if(lnk->type >= H5L_TYPE_UD_MIN)
{
/* Get the link class for this type of link. It's okay if the class isn't registered, though--we
* just can't give any more information about it */
@@ -1607,11 +1599,9 @@ H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "can't delete self")
/* If there is a user-defined callback, call it before deleting the link */
- if(lnk->type >= H5L_LINK_UD_MIN)
+ if(lnk->type >= H5L_TYPE_UD_MIN)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
+ const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(lnk->type)))
@@ -1619,6 +1609,9 @@ H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
if(link_class->del_func != NULL)
{
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
H5G_name_reset(&temp_path);
if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
@@ -1738,7 +1731,7 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "an object with that name already exists")
/* Check for crossing file boundaries with a new hard link */
- if(udata->lnk->type == H5L_LINK_HARD) {
+ if(udata->lnk->type == H5L_TYPE_HARD) {
/* Check that both objects are in same file */
if(grp_loc->oloc->file->shared != udata->file->shared)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
@@ -1747,19 +1740,16 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
/* Give the object its new name */
/* Casting away const okay -JML */
HDassert(udata->lnk->name == NULL);
-/* JAMES udata->lnk->name = H5MM_xfree(udata->lnk->name); */
- udata->lnk->name= (char *)name;
+ udata->lnk->name = (char *)name;
/* Insert the link into the group */
- if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, (hbool_t)(udata->lnk->type == H5L_LINK_HARD ? TRUE : FALSE), udata->dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
/* If the link was a user-defined link, call its move callback if it has one */
- if(udata->lnk->type >= H5L_LINK_UD_MIN)
+ if(udata->lnk->type >= H5L_TYPE_UD_MIN)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
+ const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(udata->lnk->type)))
@@ -1767,6 +1757,9 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
if((!udata->copy && link_class->move_func != NULL) || (udata->copy && link_class->move_func))
{
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
/* Create a temporary location (or else H5G_open will do a shallow
* copy and wipe out grp_loc)
*/
@@ -1860,23 +1853,23 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
/* Get object type */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
if(H5G_UNKNOWN == (type = H5O_obj_type(obj_loc->oloc, udata->dxpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object type to move")
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
type = H5G_LINK;
break;
default:
- if(lnk->type < H5L_LINK_UD_MIN)
+ if(lnk->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unrecognized link type")
type = H5G_UDLINK;
} /* end switch */
/* Set up user data for move_dest_cb */
- if((udata_out.lnk = H5O_link_copy(lnk, NULL, 0)) == NULL)
+ if((udata_out.lnk = H5O_copy(H5O_LINK_ID, lnk, NULL)) == NULL)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved");
/* In this special case, the link's name is going to be replaced at its
* destination, so we should free it here.
@@ -1922,9 +1915,9 @@ done:
*/
if(link_copied)
{
- if(udata_out.lnk->type == H5L_LINK_SOFT)
+ if(udata_out.lnk->type == H5L_TYPE_SOFT)
udata_out.lnk->u.soft.name = H5MM_xfree(udata_out.lnk->u.soft.name);
- else if(udata_out.lnk->type >= H5L_LINK_UD_MIN && udata_out.lnk->u.ud.size > 0)
+ else if(udata_out.lnk->type >= H5L_TYPE_UD_MIN && udata_out.lnk->u.ud.size > 0)
udata_out.lnk->u.ud.udata = H5MM_xfree(udata_out.lnk->u.ud.udata);
/* JAMES: the dest_cb already frees the link name. Hmm. */
H5MM_xfree(udata_out.lnk);
@@ -2048,7 +2041,7 @@ H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const
{
H5L_trav_ud1_t *udata = (H5L_trav_ud1_t *)_udata; /* User data passed in */
H5L_linkinfo_t *linfo = udata->linfo;
- const H5L_link_class_t *link_class; /* User-defined link class */
+ const H5L_class_t *link_class; /* User-defined link class */
ssize_t cb_ret; /* Return value from UD callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2062,21 +2055,22 @@ H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const
if(linfo)
{
linfo->cset = lnk->cset;
- linfo->ctime = lnk->ctime;
- linfo->linkclass = lnk->type;
+ linfo->corder = lnk->corder;
+ linfo->corder_valid = lnk->corder_valid;
+ linfo->type = lnk->type;
switch(lnk->type)
{
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
linfo->u.address = lnk->u.hard.addr;
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
linfo->u.link_size = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/
break;
default:
- if(lnk->type < H5L_LINK_UD_MIN || lnk->type > H5L_LINK_MAX)
+ if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unknown link class")
/* User-defined link; call its query function to get the link udata size. */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index a967d59..44ce345 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -32,9 +32,9 @@ static ssize_t H5L_extern_query(const char UNUSED * link_name, void * udata,
size_t udata_size, void * buf /*out*/, size_t buf_size);
/* Default External Link link class */
-const H5L_link_class_t H5L_EXTERN_LINK_CLASS[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
- H5L_LINK_EXTERNAL, /* Link type id number */
+const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ H5L_TYPE_EXTERNAL, /* Link type id number */
"external_link", /* Link name for debugging */
NULL, /* Creation callback */
NULL, /* Move callback */
@@ -243,7 +243,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HDstrcpy(temp_name + (HDstrlen(file_name) + 1), obj_name);
/* Create an external link */
- if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_LINK_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
+ if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h
index f5e719e..6811049 100644
--- a/src/H5Lpkg.h
+++ b/src/H5Lpkg.h
@@ -35,7 +35,7 @@
/******************************/
H5_DLL herr_t H5L_create_ud(H5G_loc_t *link_loc, const char *link_name,
- const void * ud_data, size_t ud_data_size, H5L_link_t type,
+ const void * ud_data, size_t ud_data_size, H5L_type_t type,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id);
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index bfe3949..0d1c81d 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -53,9 +53,9 @@ H5_DLL herr_t H5L_init(void);
H5_DLL herr_t H5L_register_external(void);
/* User-defined link functions */
-H5_DLL herr_t H5L_register (const H5L_link_class_t *cls);
-H5_DLL herr_t H5L_unregister (H5L_link_t id);
-H5_DLL const H5L_link_class_t *H5L_find_class(H5L_link_t id);
+H5_DLL herr_t H5L_register(const H5L_class_t *cls);
+H5_DLL herr_t H5L_unregister(H5L_type_t id);
+H5_DLL const H5L_class_t *H5L_find_class(H5L_type_t id);
#endif /* _H5Lprivate_H */
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index 2f0bf28..a351ab6 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -34,28 +34,34 @@
extern "C" {
#endif
-/* Link classes.
+/* Maximum length of a link's name */
+/* (encoded in a 32-bit unsigned integer) */
+#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
+
+/* Link class types.
* Values less than 64 are reserved for the HDF5 library's internal use.
- * Values 64 to 255 are for "user-defined" link types; these types are
+ * Values 64 to 255 are for "user-defined" link class types; these types are
* defined by HDF5 but their behavior can be overridden by users.
* Users who want to create new classes of links should contact the HDF5
* development team at hdfhelp@ncsa.uiuc.edu .
* These values can never change because they appear in HDF5 files.
*/
-typedef int H5L_link_t;
-#define H5L_LINK_ERROR (-1)
-#define H5L_LINK_HARD 0
-#define H5L_LINK_SOFT 1
-#define H5L_LINK_BUILTIN_MAX H5L_LINK_SOFT /* Maximum value link value for "built-in" link types */
-#define H5L_LINK_UD_MIN 64 /*link ids at or above this value are "user-defined" link types. */
-#define H5L_LINK_EXTERNAL 64
-#define H5L_LINK_MAX 255 /*maximum link id */
+typedef enum {
+ H5L_TYPE_ERROR = (-1), /* Invalid link type id */
+ H5L_TYPE_HARD = 0, /* Hard link id */
+ H5L_TYPE_SOFT = 1, /* Soft link id */
+ H5L_TYPE_EXTERNAL = 64, /* External link id */
+ H5L_TYPE_MAX = 255 /* Maximum link type id */
+} H5L_type_t;
+#define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT /* Maximum value link value for "built-in" link types */
+#define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL /* Link ids at or above this value are "user-defined" link types. */
/* Metadata buffer for user query function */
-typedef struct H5L_linkinfo_t {
+typedef struct {
H5T_cset_t cset; /* Character set of link name */
- time_t ctime; /* Creation time */
- H5L_link_t linkclass; /* Type of link */
+ int64_t corder; /* Creation order */
+ hbool_t corder_valid; /* Indicate if creation order is valid */
+ H5L_type_t type; /* Type of link */
union {
haddr_t address; /* Address hard link points to */
size_t link_size; /* Size of a soft link or UD link */
@@ -64,11 +70,11 @@ typedef struct H5L_linkinfo_t {
#define H5L_SAME_LOC 0
-/* The H5L_link_class_t struct can be used to override the behavior of a
+/* The H5L_class_t struct can be used to override the behavior of a
* "user-defined" link class. Users should populate the struct with callback
* functions defined below.
*/
-/* Current version of the H5L_link_class_t struct */
+/* Current version of the H5L_class_t struct */
#define H5L_LINK_CLASS_T_VERS (0)
/* Callback prototypes for user-defined links */
@@ -78,11 +84,11 @@ typedef herr_t (*H5L_create_func_t)(const char * link_name, hid_t loc_group, voi
/* Callback for when the link is moved */
typedef herr_t (*H5L_move_func_t)(const char * new_name, hid_t new_loc, void * udata, size_t udata_size);
-/* Callback for when the link is moved */
+/* Callback for when the link is copied */
typedef herr_t (*H5L_copy_func_t)(const char * new_name, hid_t new_loc, void * udata, size_t udata_size);
-/* The actual link function, called during traversal */
-typedef herr_t (*H5L_func_t)(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id);
+/* Callback during link traversal */
+typedef herr_t (*H5L_traverse_func_t)(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id);
/* Callback for when the link is deleted */
typedef herr_t (*H5L_delete_func_t)(const char * link_name, hid_t loc_group, void * udata, size_t udata_size);
@@ -92,17 +98,17 @@ typedef herr_t (*H5L_delete_func_t)(const char * link_name, hid_t loc_group, voi
typedef ssize_t (*H5L_query_func_t)(const char * link_name, void * udata, size_t udata_size, void * buf /*out*/, size_t buf_size);
/* User-defined link types */
-typedef struct H5L_link_class_t {
+typedef struct {
int version; /* Version number of this struct */
- H5L_link_t id; /* Link type ID */
+ H5L_type_t id; /* Link type ID */
const char *comment; /* Comment for debugging */
H5L_create_func_t create_func; /* Callback during link creation */
H5L_move_func_t move_func; /* Callback after moving link */
H5L_copy_func_t copy_func; /* Callback after copying link */
- H5L_func_t trav_func; /* The main traversal function */
+ H5L_traverse_func_t trav_func; /* Callback during link traversal */
H5L_delete_func_t del_func; /* Callback for link deletion */
H5L_query_func_t query_func; /* Callback for queries */
-} H5L_link_class_t;
+} H5L_class_t;
#define H5L_ELINK_PREFIX_PROP "elink_prefix"
@@ -127,11 +133,11 @@ H5_DLL herr_t H5Lget_linkinfo(hid_t loc_id, const char *name,
/* UD link functions */
H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name,
- H5L_link_t link_type, const void * udata, size_t udata_size,
+ H5L_type_t link_type, const void * udata, size_t udata_size,
hid_t lcpl_id, hid_t lapl_id);
-H5_DLL herr_t H5Lregister(const H5L_link_class_t *cls);
-H5_DLL herr_t H5Lunregister(H5L_link_t id);
-H5_DLL htri_t H5Lis_registered(H5L_link_t id);
+H5_DLL herr_t H5Lregister(const H5L_class_t *cls);
+H5_DLL herr_t H5Lunregister(H5L_type_t id);
+H5_DLL htri_t H5Lis_registered(H5L_type_t id);
/* External link functions */
H5_DLL herr_t H5Lunpack_elink_val(char * ext_linkval/*in*/,
diff --git a/src/H5O.c b/src/H5O.c
index d049777..6657a79 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -111,19 +111,11 @@ typedef struct H5O_addr_map_t {
const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_NULL, /*0x0000 Null */
H5O_MSG_SDSPACE, /*0x0001 Simple Dimensionality */
-#ifdef H5_GROUP_REVISION
H5O_MSG_LINFO, /*0x0002 Link information */
-#else /* H5_GROUP_REVISION */
- NULL,
-#endif /* H5_GROUP_REVISION */
H5O_MSG_DTYPE, /*0x0003 Data Type */
H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
H5O_MSG_FILL_NEW, /*0x0005 New Data storage -- fill value */
-#ifdef H5_GROUP_REVISION
H5O_MSG_LINK, /*0x0006 Link */
-#else /* H5_GROUP_REVISION */
- NULL,
-#endif /* H5_GROUP_REVISION */
H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
H5O_MSG_LAYOUT, /*0x0008 Data Layout */
#ifdef H5O_ENABLE_BOGUS
@@ -131,11 +123,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
#else /* H5O_ENABLE_BOGUS */
NULL, /*0x0009 "Bogus" */
#endif /* H5O_ENABLE_BOGUS */
-#ifdef H5_GROUP_REVISION
H5O_MSG_GINFO, /*0x000A Group Information */
-#else /* H5_GROUP_REVISION */
- NULL,
-#endif /* H5_GROUP_REVISION */
H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
H5O_MSG_ATTR, /*0x000C Attribute list */
H5O_MSG_NAME, /*0x000D Object name */
@@ -458,7 +446,7 @@ H5Oincr_refcount(hid_t object_id)
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Oincr_refcount, FAIL)
- H5TRACE1("Is","i",object_id);
+ H5TRACE1("e","i",object_id);
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_oloc(object_id)) == NULL)
@@ -499,7 +487,7 @@ H5Odecr_refcount(hid_t object_id)
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Odecr_refcount, FAIL)
- H5TRACE1("Is","i",object_id);
+ H5TRACE1("e","i",object_id);
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_oloc(object_id)) == NULL)
@@ -896,22 +884,22 @@ done:
herr_t
H5O_reset(unsigned type_id, void *native)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- herr_t ret_value; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_reset,FAIL);
+ FUNC_ENTER_NOAPI(H5O_reset, FAIL)
/* check args */
- assert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- assert(type);
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
/* Call the "real" reset routine */
- if((ret_value=H5O_reset_real(type, native)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to reset object header");
+ if(H5O_reset_real(type, native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_reset() */
@@ -933,24 +921,23 @@ done:
static herr_t
H5O_reset_real(const H5O_msg_class_t *type, void *native)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_reset_real);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_reset_real)
/* check args */
- assert(type);
+ HDassert(type);
- if (native) {
- if (type->reset) {
- if ((type->reset) (native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "reset method failed");
- } else {
+ if(native) {
+ if(type->reset) {
+ if((type->reset)(native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
+ } else
HDmemset(native, 0, type->native_size);
- }
- }
+ } /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_reset_real() */
@@ -972,7 +959,7 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_free (unsigned type_id, void *mesg)
+H5O_free(unsigned type_id, void *mesg)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
void * ret_value; /* Return value */
@@ -2011,11 +1998,11 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_msg_class_t *orig_t
} /* end else */
/* Compute the size needed to store the message on disk */
- if ((size = ((*new_type)->raw_size) (f, *new_mesg)) >=H5O_MAX_SIZE)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large");
+ if((size = ((*new_type)->raw_size)(f, *new_mesg)) >=H5O_MAX_SIZE)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large")
/* Allocate space in the object headed for the message */
- if ((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
+ if((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message");
/* Increment any links in message */
@@ -2124,18 +2111,18 @@ H5O_touch_oh(H5F_t *f,
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Create a new message */
- if (idx==oh->nmesgs) {
- if (!force)
+ if(idx == oh->nmesgs) {
+ if(!force)
HGOTO_DONE(SUCCEED); /*nothing to do*/
size = (H5O_MSG_MTIME_NEW->raw_size)(f, &now);
- if ((idx=H5O_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, size, oh_flags_ptr))==UFAIL)
+ if((idx = H5O_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, size, oh_flags_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message");
- }
+ } /* end if */
/* Update the native part */
- if (NULL==oh->mesg[idx].native) {
- if (NULL==(oh->mesg[idx].native = H5FL_MALLOC(time_t)))
+ if(NULL==oh->mesg[idx].native) {
+ if(NULL==(oh->mesg[idx].native = H5FL_MALLOC(time_t)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for modification time message");
}
*((time_t*)(oh->mesg[idx].native)) = now;
@@ -3324,13 +3311,11 @@ H5O_alloc_new_chunk(H5F_t *f,
(found_attr < 0 ||
oh->mesg[u].raw_size < oh->mesg[found_attr].raw_size))
found_attr = u;
-#ifdef H5_GROUP_REVISION
} else if(H5O_LINK_ID == msg_id) {
if(oh->mesg[u].raw_size >= cont_size &&
(found_link < 0 ||
oh->mesg[u].raw_size < oh->mesg[found_link].raw_size))
found_link = u;
-#endif /* H5_GROUP_REVISION */
} else {
if(oh->mesg[u].raw_size >= cont_size &&
(found_other < 0 ||
@@ -3671,18 +3656,18 @@ H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg)
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_raw_size,0)
+ FUNC_ENTER_NOAPI(H5O_raw_size, 0)
/* Check args */
HDassert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
HDassert(type->raw_size);
HDassert(f);
HDassert(mesg);
/* Compute the raw data size for the mesg */
- if ((ret_value = (type->raw_size)(f, mesg))==0)
+ if((ret_value = (type->raw_size)(f, mesg)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
done:
@@ -3705,16 +3690,16 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg)
+H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg, size_t extra_raw)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_mesg_size,0)
+ FUNC_ENTER_NOAPI(H5O_mesg_size, 0)
/* Check args */
HDassert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
HDassert(type->raw_size);
HDassert(f);
@@ -3724,6 +3709,9 @@ H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg)
if((ret_value = (type->raw_size)(f, mesg)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
+ /* Add in "extra" raw space */
+ ret_value += extra_raw;
+
/* Adjust size for alignment, if necessary */
ret_value = H5O_ALIGN(ret_value);
@@ -3999,37 +3987,38 @@ done:
* slu@ncsa.uiuc.edu
* July 13, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id)
+H5O_encode(H5F_t *f, unsigned char *buf, const void *obj, unsigned type_id)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_encode,FAIL);
+ FUNC_ENTER_NOAPI(H5O_encode,FAIL)
/* check args */
- assert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- assert(type);
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
/* Encode */
- if ((type->encode)(f, buf, obj) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
+ if((type->encode)(f, buf, obj) < 0)
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_encode() */
/*-------------------------------------------------------------------------
* Function: H5O_decode
*
- * Purpose: Decode a binary object(data type and data space only)
- * description and return a new object handle.
+ * Purpose: Decode a binary object description and return a new
+ * object handle.
+ *
+ * Note: This routine is not guaranteed to work with all possible
+ * header messages, use with care.
*
* Return: Success: Pointer to object(data type or space)
*
@@ -4039,30 +4028,28 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-void*
-H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id)
+void *
+H5O_decode(H5F_t *f, hid_t dxpl_id, const unsigned char *buf, unsigned type_id)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- void *ret_value=NULL; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_decode,NULL);
+ FUNC_ENTER_NOAPI(H5O_decode, NULL)
/* check args */
- assert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- assert(type);
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
/* decode */
- if((ret_value = (type->decode)(f, 0, buf))==NULL)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message");
+ if((ret_value = (type->decode)(f, dxpl_id, buf)) == NULL)
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_decode() */
/*-------------------------------------------------------------------------
@@ -4431,7 +4418,6 @@ H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth)
*/
if(src->holding_file)
dst->file->nopen_objs++;
- ;
} else if(depth == H5_COPY_SHALLOW) {
/* Discarding 'const' qualifier OK - QAK */
H5O_loc_reset((H5O_loc_t *)src);
@@ -4772,13 +4758,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message")
} /* end else */
- /*
- * Encode the message. If the message is shared then we
- * encode a Shared Object message instead of the object
- * which is being shared.
- */
- if((copy_type->encode)(oloc_dst->file, mesg_dst->raw, mesg_dst->native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
+ /* Mark the message in the destination as dirty, so it'll get encoded when the object header is flushed */
+ mesg_dst->dirty = TRUE;
} /* end if (mesg_src->type->copy_file) */
} /* end of mesgno loop */
@@ -4820,22 +4801,14 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HDassert(copy_type);
if(copy_type->post_copy_file && mesg_src->native) {
- hbool_t modified = FALSE;
-
- /* Get destination message */
+ /* Sanity check destination message */
HDassert(mesg_dst->type == mesg_src->type);
-
- /* Make certain the destination's native info is available */
- LOAD_NATIVE(oloc_dst->file, dxpl_id, mesg_dst, FAIL)
+ HDassert(mesg_dst->native);
/* Perform "post copy" operation on messge */
if((copy_type->post_copy_file)(oloc_src, mesg_src->native, oloc_dst,
- mesg_dst->native, &modified, dxpl_id, cpy_info) < 0)
+ mesg_dst->native, dxpl_id, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to perform 'post copy' operation on message")
-
- /* Mark message and header as dirty if the destination message was modified */
- if(modified)
- mesg_dst->dirty = TRUE;
} /* end if */
} /* end for */
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 63e8b39..f4e7064 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -33,7 +33,6 @@
#include "H5Opkg.h" /* Object headers */
-#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_ginfo_encode(H5F_t *f, uint8_t *p, const void *_mesg);
@@ -67,6 +66,10 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
/* Current version of group info information */
#define H5O_GINFO_VERSION 1
+/* Flags for group flag encoding */
+#define H5O_GINFO_FLAG_TRACK_CORDER 0x01
+#define H5O_GINFO_FLAG_INDEX_CORDER 0x02
+
/* Declare a free list to manage the H5O_ginfo_t struct */
H5FL_DEFINE_STATIC(H5O_ginfo_t);
@@ -90,9 +93,10 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t);
*-------------------------------------------------------------------------
*/
static void *
-H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
+H5O_ginfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */
+ unsigned char flags; /* Flags for encoding group info */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_ginfo_decode)
@@ -101,7 +105,7 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HDassert(f);
HDassert(p);
- /* decode */
+ /* Version of message */
if(*p++ != H5O_GINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
@@ -109,8 +113,10 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the local heap size hint */
- UINT32DECODE(p, ginfo->lheap_size_hint)
+ /* Get the flags for the group */
+ flags = *p++;
+ ginfo->track_corder = (flags & H5O_GINFO_FLAG_TRACK_CORDER) ? TRUE : FALSE;
+ ginfo->index_corder = (flags & H5O_GINFO_FLAG_INDEX_CORDER) ? TRUE : FALSE;
/* Get the max. # of links to store compactly & the min. # of links to store densely */
UINT32DECODE(p, ginfo->max_compact)
@@ -148,9 +154,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
+H5O_ginfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
- const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
+ const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
+ unsigned char flags; /* Flags for encoding group info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_ginfo_encode)
@@ -162,14 +169,16 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_GINFO_VERSION;
- /* Store the local heap size hint for the group */
- UINT32ENCODE(p, ginfo->lheap_size_hint)
+ /* The flags for the group */
+ flags = ginfo->track_corder ? H5O_GINFO_FLAG_TRACK_CORDER : 0;
+ flags |= ginfo->index_corder ? H5O_GINFO_FLAG_INDEX_CORDER : 0;
+ *p++ = flags;
/* Store the max. # of links to store compactly & the min. # of links to store densely */
UINT32ENCODE(p, ginfo->max_compact)
UINT32ENCODE(p, ginfo->min_dense)
- /* Store the estimated # of entries & name lengths */
+ /* Estimated # of entries & name lengths */
UINT32ENCODE(p, ginfo->est_num_entries)
UINT32ENCODE(p, ginfo->est_name_len)
@@ -240,7 +249,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg)
+H5O_ginfo_size(const H5F_t *f, const void UNUSED *_mesg)
{
size_t ret_value; /* Return value */
@@ -248,7 +257,7 @@ H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg)
/* Set return value */
ret_value = 1 + /* Version */
- 4 + /* Local heap size hint */
+ 1 + /* Flags */
4 + /* "Max compact" links */
4 + /* "Min dense" links */
4 + /* Estimated # of entries in group */
@@ -315,22 +324,19 @@ H5O_ginfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Local heap size hint:", ginfo->lheap_size_hint);
-
+ HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
+ "Track creation order of links:", ginfo->track_corder);
+ HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
+ "Index creation order of links:", ginfo->index_corder);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Max. compact links:", ginfo->max_compact);
-
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Min. dense links:", ginfo->min_dense);
-
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated # of objects in group:", ginfo->est_num_entries);
-
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated length of object in group's name:", ginfo->est_name_len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ginfo_debug() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 8017002..57a230f 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -25,23 +25,27 @@
*-------------------------------------------------------------------------
*/
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
+#include "H5Gpkg.h" /* Groups */
#include "H5Opkg.h" /* Object headers */
-#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_linfo_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_linfo_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_linfo_free(void *_mesg);
+static herr_t H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
static void *H5O_linfo_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
+static herr_t H5O_linfo_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_linfo_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -56,19 +60,28 @@ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
H5O_linfo_size, /*size of symbol table entry */
NULL, /*default reset method */
H5O_linfo_free, /* free method */
- NULL, /* file delete method */
+ H5O_linfo_delete, /* file delete method */
NULL, /* link method */
NULL, /*get share method */
NULL, /*set share method */
NULL, /* pre copy native value to file */
H5O_linfo_copy_file, /* copy native value to file */
- NULL, /* post copy native value to file */
+ H5O_linfo_post_copy_file, /* post copy native value to file */
H5O_linfo_debug /*debug the message */
}};
/* Current version of link info information */
#define H5O_LINFO_VERSION 1
+/* Data exchange structure to use when copying links from src to dst */
+typedef struct {
+ const H5O_loc_t *src_oloc; /* Source object location */
+ H5O_loc_t *dst_oloc; /* Destination object location */
+ H5O_linfo_t *dst_linfo; /* Destination object's link info message */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5O_copy_t *cpy_info; /* Information for copy operation */
+} H5O_linfo_postcopy_ud_t;
+
/* Declare a free list to manage the hsize_t struct */
H5FL_DEFINE_STATIC(H5O_linfo_t);
@@ -111,9 +124,22 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if (NULL == (linfo = H5FL_MALLOC(H5O_linfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the number of links in the group */
+ /* Number of links in the group */
H5F_DECODE_LENGTH(f, p, linfo->nlinks)
+ /* Min. & max creation order value for the group */
+ INT64DECODE(p, linfo->min_corder)
+ INT64DECODE(p, linfo->max_corder)
+
+ /* Address of fractal heap to store "dense" links */
+ H5F_addr_decode(f, &p, &(linfo->link_fheap_addr));
+
+ /* Address of v2 B-tree to index names of links */
+ H5F_addr_decode(f, &p, &(linfo->name_bt2_addr));
+
+ /* Address of v2 B-tree to index creation order of links */
+ H5F_addr_decode(f, &p, &(linfo->corder_bt2_addr));
+
/* Set return value */
ret_value = linfo;
@@ -156,9 +182,22 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_LINFO_VERSION;
- /* Store the number of links in the group */
+ /* Number of links in the group */
H5F_ENCODE_LENGTH(f, p, linfo->nlinks)
+ /* Min. & max creation order value for the group */
+ INT64ENCODE(p, linfo->min_corder)
+ INT64ENCODE(p, linfo->max_corder)
+
+ /* Address of fractal heap to store "dense" links */
+ H5F_addr_encode(f, &p, linfo->link_fheap_addr);
+
+ /* Address of v2 B-tree to index names of links */
+ H5F_addr_encode(f, &p, linfo->name_bt2_addr);
+
+ /* Address of v2 B-tree to index creation order of links */
+ H5F_addr_encode(f, &p, linfo->corder_bt2_addr);
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_encode() */
@@ -199,7 +238,7 @@ H5O_linfo_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
*dest = *linfo;
/* Set return value */
- ret_value=dest;
+ ret_value = dest;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -233,8 +272,13 @@ H5O_linfo_size(const H5F_t *f, const void UNUSED *_mesg)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_linfo_size)
/* Set return value */
- ret_value = 1 + /* Version */
- H5F_SIZEOF_SIZE(f); /* Number of links */
+ ret_value = 1 /* Version */
+ + H5F_SIZEOF_SIZE(f) /* Number of links */
+ + 8 /* Min. creation order value */
+ + 8 /* Max. creation order value */
+ + H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */
+ + H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */
+ + H5F_SIZEOF_ADDR(f); /* Address of v2 B-tree for indexing creation order values of links */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_size() */
@@ -268,6 +312,40 @@ H5O_linfo_free(void *mesg)
/*-------------------------------------------------------------------------
+ * Function: H5O_linfo_delete
+ *
+ * Purpose: Free file space referenced by message
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, September 16, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
+{
+ const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_delete)
+
+ /* check args */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* If the group is using "dense" link storage, delete it */
+ if(H5F_addr_defined(linfo->link_fheap_addr))
+ if(H5G_dense_delete(f, dxpl_id, (H5O_linfo_t *)linfo, adj_link) < 0) /* Casting away const OK - QAK */
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense link storage")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_linfo_delete() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_linfo_copy_file
*
* Purpose: Copies a message from _MESG to _DEST in file
@@ -282,8 +360,8 @@ H5O_linfo_free(void *mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_dst,
- hid_t UNUSED dxpl_id, H5O_copy_t *cpy_info, void UNUSED *udata)
+H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
+ hid_t dxpl_id, H5O_copy_t *cpy_info, void UNUSED *udata)
{
H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src;
H5O_linfo_t *linfo_dst = NULL;
@@ -300,11 +378,26 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed")
/* If we are performing a 'shallow hierarchy' copy, and the links in this
- * group won't be included in the destination, reset the link count for
+ * group won't be included in the destination, reset the link info for
* this group.
*/
- if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth)
+ if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth) {
linfo_dst->nlinks = 0;
+ linfo_dst->min_corder = linfo_dst->max_corder = 0;
+ linfo_dst->link_fheap_addr = HADDR_UNDEF;
+ linfo_dst->name_bt2_addr = HADDR_UNDEF;
+ linfo_dst->corder_bt2_addr = HADDR_UNDEF;
+ } /* end if */
+ else {
+ /* Create the components of the dense link storage for the destination group */
+ /* (XXX: should probably get the "creation" parameters for the source group's
+ * dense link storage components and use those - QAK)
+ */
+ if(H5F_addr_defined(linfo_src->link_fheap_addr)) {
+ if(H5G_dense_create(file_dst, dxpl_id, linfo_dst) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create 'dense' form of new format group")
+ } /* end if */
+ } /* end else */
/* Set return value */
ret_value = linfo_dst;
@@ -319,6 +412,114 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_linfo_post_copy_file_cb
+ *
+ * Purpose: Callback routine for copying links from src to dst file
+ * during "post copy" routine
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 26 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata)
+{
+ H5O_linfo_postcopy_ud_t *udata = (H5O_linfo_postcopy_ud_t *)_udata; /* 'User data' passed in */
+ H5O_link_t dst_lnk; /* Destination link to insert */
+ hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
+ herr_t ret_value = H5B2_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_post_copy_file_cb)
+
+ /* Check arguments */
+ HDassert(src_lnk);
+ HDassert(udata);
+
+ /* Copy the link (and the object it points to) */
+ if(H5G_link_copy_file(udata->dst_oloc->file, udata->dxpl_id, src_lnk,
+ udata->src_oloc, &dst_lnk, udata->cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy link")
+ dst_lnk_init = TRUE;
+
+ /* Insert the new object in the destination file's group */
+ /* (Doesn't increment the link count - that's already been taken care of for hard links) */
+ if(H5G_dense_insert(udata->dst_oloc->file, udata->dxpl_id, udata->dst_linfo, &dst_lnk) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5B2_ITER_ERROR, "unable to insert destination link")
+
+done:
+ /* Check if the destination link has been initialized */
+ if(dst_lnk_init)
+ H5O_reset(H5O_LINK_ID, &dst_lnk);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_linfo_post_copy_file_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_linfo_post_copy_file
+ *
+ * Purpose: Finish copying a message from between files
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 26, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_linfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
+ H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
+{
+ const H5O_linfo_t *linfo_src = (const H5O_linfo_t *)mesg_src;
+ H5O_linfo_t *linfo_dst = (H5O_linfo_t *)mesg_dst;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_post_copy_file)
+
+ /* check args */
+ HDassert(src_oloc && src_oloc->file);
+ HDassert(linfo_src);
+ HDassert(dst_oloc && dst_oloc->file);
+ HDassert(H5F_addr_defined(dst_oloc->addr));
+ HDassert(linfo_dst);
+ HDassert(cpy_info);
+
+ /* If we are performing a 'shallow hierarchy' copy, get out now */
+ if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth)
+ HGOTO_DONE(SUCCEED)
+
+ /* Check for copying dense link storage */
+ if(H5F_addr_defined(linfo_src->link_fheap_addr)) {
+ H5O_linfo_postcopy_ud_t udata; /* User data for iteration callback */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+
+ /* Set up dense link iteration user data */
+ udata.src_oloc = src_oloc;
+ udata.dst_oloc = dst_oloc;
+ udata.dst_linfo = linfo_dst;
+ udata.dxpl_id = dxpl_id;
+ udata.cpy_info = cpy_info;
+
+ /* Build iterator operator */
+ lnk_op.lib_op = H5O_linfo_post_copy_file_cb;
+
+ /* Iterate over the links in the group, building a table of the link messages */
+ if(H5G_dense_iterate(src_oloc->file, dxpl_id, H5_ITER_NATIVE, 0, linfo_src, TRUE, 0, NULL, lnk_op, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5O_linfo_post_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_linfo_debug
*
* Purpose: Prints debugging info for a message.
@@ -350,8 +551,18 @@ H5O_linfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Number of links:", linfo->nlinks);
+ HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth,
+ "Min. creation order value:", linfo->min_corder);
+ HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth,
+ "Max. creation order value:", linfo->max_corder);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "'Dense' link storage fractal heap address:", linfo->link_fheap_addr);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr);
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_debug() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 039184d..7d2b694 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -20,24 +20,24 @@
*
* Purpose: Link messages.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
+#include "H5Gpkg.h" /* Groups */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
-#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg);
+static void *H5O_link_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_link_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_link_reset(void *_mesg);
static herr_t H5O_link_free(void *_mesg);
@@ -46,8 +46,8 @@ static herr_t H5O_link_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *typ
void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static void *H5O_link_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
-static herr_t H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
- void *mesg_dst, hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info);
+static herr_t H5O_link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_link_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -75,12 +75,12 @@ const H5O_msg_class_t H5O_MSG_LINK[1] = {{
/* Current version of link information */
#define H5O_LINK_VERSION 1
-#endif /* H5_GROUP_REVISION */
+/* Flags for link flag encoding */
+#define H5O_LINK_FLAG_HAS_CORDER 0x01
/* Declare a free list to manage the H5O_link_t struct */
H5FL_DEFINE_STATIC(H5O_link_t);
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5O_link_decode
@@ -96,16 +96,14 @@ H5FL_DEFINE_STATIC(H5O_link_t);
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
H5O_link_t *lnk = NULL; /* Pointer to link message */
- uint16_t len; /* Length of a string in the message */
- uint32_t tmp_time; /* Temporary copy of the time */
+ size_t len; /* Length of a string in the message */
+ unsigned char link_flags; /* Flags for encoding link info */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_decode)
@@ -122,14 +120,23 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if(NULL == (lnk = H5FL_CALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ /* Get the encoding flags for the link */
+ link_flags = *p++;
+
/* Get the type of the link */
lnk->type = *p++;
- if(lnk->type < H5L_LINK_HARD || lnk->type > H5L_LINK_MAX)
+ if(lnk->type < H5L_TYPE_HARD || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad link type")
/* Get the link creation time from the file */
- UINT32DECODE(p, tmp_time)
- lnk->ctime = (time_t)tmp_time;
+ if(link_flags & H5O_LINK_FLAG_HAS_CORDER) {
+ INT64DECODE(p, lnk->corder)
+ lnk->corder_valid = TRUE;
+ } /* end if */
+ else {
+ lnk->corder = 0;
+ lnk->corder_valid = FALSE;
+ } /* end else */
/* Get the link name's character set */
lnk->cset = (H5T_cset_t)*p++;
@@ -137,10 +144,10 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad cset type")
/* Get the link's name */
- UINT16DECODE(p, len)
+ UINT32DECODE(p, len)
if(len == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length")
- if(NULL == (lnk->name = H5MM_malloc((size_t)len + 1)))
+ if(NULL == (lnk->name = H5MM_malloc(len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(lnk->name, p, len);
lnk->name[len] = '\0';
@@ -148,12 +155,12 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* Get the appropriate information for each type of link */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
/* Get the address of the object the link points to */
H5F_addr_decode(f, &p, &(lnk->u.hard.addr));
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
/* Get the link value */
UINT16DECODE(p, len)
if(len == 0)
@@ -167,7 +174,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* User-defined links */
default:
- if(lnk->type < H5L_LINK_UD_MIN || lnk->type > H5L_LINK_MAX)
+ if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown link type")
/* A UD link. Get the user-supplied data */
@@ -185,16 +192,16 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
} /* end switch */
/* Set return value */
- ret_value=lnk;
+ ret_value = lnk;
done:
if(ret_value == NULL)
if(lnk != NULL) {
if(lnk->name != NULL)
H5MM_xfree(lnk->name);
- if(lnk->type == H5L_LINK_SOFT && lnk->u.soft.name != NULL)
+ if(lnk->type == H5L_TYPE_SOFT && lnk->u.soft.name != NULL)
H5MM_xfree(lnk->u.soft.name);
- if(lnk->type >= H5L_LINK_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL)
+ if(lnk->type >= H5L_TYPE_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL)
H5MM_xfree(lnk->u.ud.udata);
H5FL_FREE(H5O_link_t, lnk);
} /* end if */
@@ -214,16 +221,14 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
- uint16_t len; /* Length of a string in the message */
- uint32_t tmp_time; /* Temporary copy of the time */
+ size_t len; /* Length of a string in the message */
+ unsigned char link_flags; /* Flags for encoding link info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_link_encode)
@@ -235,31 +240,35 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_LINK_VERSION;
+ /* The encoding flags for the link */
+ link_flags = lnk->corder_valid ? H5O_LINK_FLAG_HAS_CORDER : 0;
+ *p++ = link_flags;
+
/* Store the type of the link */
*p++ = lnk->type;
- /* Store the link creation time from the file */
- tmp_time = lnk->ctime;
- UINT32ENCODE(p, tmp_time)
+ /* Store the link creation order in the file, if its valid */
+ if(lnk->corder_valid)
+ INT64ENCODE(p, lnk->corder)
/* Store the link name's character set */
*p++ = (uint8_t)lnk->cset;
/* Store the link's name */
- len = (uint16_t)HDstrlen(lnk->name);
+ len = HDstrlen(lnk->name);
HDassert(len > 0);
- UINT16ENCODE(p, len)
+ UINT32ENCODE(p, (uint32_t)len)
HDmemcpy(p, lnk->name, len);
p += len;
/* Store the appropriate information for each type of link */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
/* Store the address of the object the link points to */
H5F_addr_encode(f, &p, lnk->u.hard.addr);
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
/* Store the link value */
len = (uint16_t)HDstrlen(lnk->u.soft.name);
HDassert(len > 0);
@@ -270,7 +279,7 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* User-defined links */
default:
- HDassert(lnk->type >= H5L_LINK_UD_MIN && lnk->type <= H5L_LINK_MAX);
+ HDassert(lnk->type >= H5L_TYPE_UD_MIN && lnk->type <= H5L_TYPE_MAX);
/* Store the user-supplied data, however long it is */
len = (uint16_t)lnk->u.ud.size;
@@ -285,7 +294,6 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_link_encode() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -302,11 +310,9 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-void *
+static void *
H5O_link_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
@@ -315,35 +321,40 @@ H5O_link_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy)
- /* check args */
+ /* Check args */
HDassert(lnk);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* copy */
+ /* Copy static information */
*dest = *lnk;
+
+ /* Duplicate the link's name */
HDassert(lnk->name);
- dest->name = H5MM_xstrdup(lnk->name);
- if(lnk->type == H5L_LINK_SOFT)
- dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name);
- else if(lnk->type >= H5L_LINK_UD_MIN) {
- if(lnk->u.ud.size > 0)
- {
+ if(NULL == (dest->name = H5MM_xstrdup(lnk->name)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate link name")
+
+ /* Copy other information needed for different link types */
+ if(lnk->type == H5L_TYPE_SOFT) {
+ if(NULL == (dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate soft link value")
+ } /* end if */
+ else if(lnk->type >= H5L_TYPE_UD_MIN) {
+ if(lnk->u.ud.size > 0) {
if(NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size);
- }
- }/* end if */
+ } /* end if */
+ } /* end if */
/* Set return value */
- ret_value=dest;
+ ret_value = dest;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_copy() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5O_link_size
*
@@ -371,25 +382,26 @@ H5O_link_size(const H5F_t *f, const void *_mesg)
/* Set return value */
ret_value = 1 + /* Version */
+ 1 + /* Link encoding flags */
1 + /* Link type */
- 4 + /* Creation time */
+ (lnk->corder_valid ? 8 : 0) + /* Creation order */
1 + /* Character set */
- 2 + /* Name length */
+ 4 + /* Name length */
HDstrlen(lnk->name); /* Name */
/* Add the appropriate length for each type of link */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
ret_value += H5F_SIZEOF_ADDR(f);
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
ret_value += 2 + /* Link value length */
HDstrlen(lnk->u.soft.name); /* Link value */
break;
default: /* Default is user-defined link type */
- HDassert(lnk->type >= H5L_LINK_UD_MIN);
+ HDassert(lnk->type >= H5L_TYPE_UD_MIN);
ret_value += 2 + /* User-defined data size */
lnk->u.ud.size; /* User-defined data */
break;
@@ -421,13 +433,11 @@ H5O_link_reset(void *_mesg)
if(lnk) {
/* Free information for link (but don't free link pointer) */
- if(lnk->type == H5L_LINK_SOFT)
+ if(lnk->type == H5L_TYPE_SOFT)
lnk->u.soft.name = H5MM_xfree(lnk->u.soft.name);
- else if (lnk->type >= H5L_LINK_UD_MIN) {
+ else if (lnk->type >= H5L_TYPE_UD_MIN) {
if(lnk->u.ud.size > 0)
- {
- lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata);
- }
+ lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata);
} /* end if */
lnk->name = H5MM_xfree(lnk->name);
} /* end if */
@@ -489,8 +499,8 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(f);
HDassert(lnk);
- /* Decrement reference count to the object, for hard links */
- if(lnk->type == H5L_LINK_HARD) {
+ /* Decrement reference count to the object (if requested), for hard links */
+ if(lnk->type == H5L_TYPE_HARD && adj_link) {
H5O_loc_t oloc;
/* Construct object location for object, in order to decrement it's ref count */
@@ -499,10 +509,9 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(H5F_addr_defined(lnk->u.hard.addr));
oloc.addr = lnk->u.hard.addr;
- /* Decrement the ref count for the object, if requested */
- if(adj_link)
- if(H5O_link(&oloc, -1, dxpl_id)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
+ /* Decrement the ref count for the object */
+ if(H5O_link(&oloc, -1, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
} /* end if */
done:
@@ -566,56 +575,25 @@ static void *
H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_dst,
hid_t UNUSED dxpl_id, H5O_copy_t UNUSED *cpy_info, void UNUSED *udata)
{
- H5O_link_t *link_src = (H5O_link_t *) native_src;
- H5O_link_t *link_dst = NULL;
- void *ret_value; /* Return value */
+ H5O_link_t *link_src = (H5O_link_t *)native_src;
+ H5O_link_t *link_dst = NULL;
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy_file)
/* check args */
HDassert(link_src);
- HDassert(file_dst);
HDassert(cpy_info);
HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth);
- /* Allocate space for the destination stab */
- if(NULL == (link_dst = H5FL_MALLOC(H5O_link_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* Copy top-level information */
- *link_dst = *link_src;
-
- /* Deep copy the link's name */
- if(NULL == (link_dst->name = H5MM_xstrdup(link_src->name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* "Deep copy" other information for each kind of link */
- switch(link_src->type) {
- case H5L_LINK_HARD:
- /* Set link's address undefined here, will be fixed up in "post copy" callback */
- link_dst->u.hard.addr = HADDR_UNDEF;
- break;
-
- case H5L_LINK_SOFT:
- /* Copy the soft link's value */
- if(NULL == (link_dst->u.soft.name = H5MM_xstrdup(link_src->u.soft.name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- break;
+ /* Sanity check source link type */
+ if(link_src->type > H5L_TYPE_SOFT && link_src->type < H5L_TYPE_UD_MIN)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized built-in link type")
- default:
- if(link_src->type >= H5L_LINK_UD_MIN)
- {
- /* Copy the user-defined link's user data if it exists */
- if(link_src->u.ud.size > 0)
- {
- if(NULL == (link_dst->u.ud.udata = H5MM_malloc(link_src->u.ud.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(link_dst->u.ud.udata, link_src->u.ud.udata, link_src->u.ud.size);
- }
- }
- else
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized link type")
- } /* end switch */
+ /* Allocate "blank" link for destination */
+ /* (values will be filled in during 'post copy' operation) */
+ if(NULL == (link_dst = H5FL_CALLOC(H5O_link_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set return value */
ret_value = link_dst;
@@ -623,7 +601,7 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_
done:
if(!ret_value)
if(link_dst)
- H5FL_FREE(H5O_link_t, link_dst);
+ H5O_link_free(link_dst);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_link_copy_file() */
@@ -642,13 +620,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
- hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info)
+H5O_link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
+ H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
- H5O_link_t *link_src = (H5O_link_t *)mesg_src; /* Casting away const OK... -QAK */
- H5O_link_t tmp_link_src;
- H5O_link_t *link_dst = (H5O_link_t *)mesg_dst;
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_link_t *link_src = (const H5O_link_t *)mesg_src;
+ H5O_link_t *link_dst = (H5O_link_t *)mesg_dst;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_post_copy_file)
@@ -658,82 +635,13 @@ H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src,
HDassert(H5F_addr_defined(dst_oloc->addr));
HDassert(dst_oloc->file);
HDassert(link_dst);
- HDassert(modified && *modified == FALSE);
HDassert(cpy_info);
HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth);
- /* Expand soft link */
- if(H5L_LINK_SOFT == link_src->type && cpy_info->expand_soft_link) {
- H5G_stat_t statbuf; /* Information about object pointed to by soft link */
- H5G_loc_t grp_loc; /* Group location for parent of soft link */
- H5G_name_t grp_path; /* Path for parent of soft link */
-
- /* Make a temporary copy, so that it will not change the info in the cache */
- HDmemcpy(&tmp_link_src, link_src, sizeof(H5O_link_t));
- link_src = &tmp_link_src;
-
- /* Set up group location for soft link to start in */
- H5G_name_reset(&grp_path);
- grp_loc.path = &grp_path;
- grp_loc.oloc = (H5O_loc_t *)parent_src_oloc; /* Casting away const OK... -QAK */
-
- /* Check if the object pointed by the soft link exists in the source file */
- /* (It would be more efficient to make a specialized traversal callback,
- * but this is good enough for now... -QAK)
- */
- if(H5G_get_objinfo(&grp_loc, link_src->u.soft.name, TRUE, &statbuf, H5AC_ind_dxpl_id) >= 0) {
- /* Convert temp. copy of source soft link to hard link */
-#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- link_src->u.hard.addr = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
-#else
- link_src->u.hard.addr = statbuf.objno[0];
-#endif
- link_src->type = H5L_LINK_HARD;
-
- /* Convert destination link to hard link */
- link_dst->type = H5L_LINK_HARD;
- link_dst->u.soft.name = H5MM_xfree(link_dst->u.soft.name);
- } /* end if */
- } /* if ((H5G_CACHED_SLINK == src_ent->type)... */
-
- /* Additional "deep copy" for each kind of link */
- switch(link_src->type) {
- case H5L_LINK_HARD:
- /* Copy the object pointed to */
- {
- H5O_loc_t src_oloc; /* Temporary object location for source object */
- H5O_loc_t new_oloc; /* Temporary object location for source object */
-
- /* Build temporary object location for source */
- H5O_loc_reset(&src_oloc);
- src_oloc.file = parent_src_oloc->file;
- HDassert(H5F_addr_defined(link_src->u.hard.addr));
- src_oloc.addr = link_src->u.hard.addr;
-
- /* Build temporary object location for destination */
- H5O_loc_reset(&new_oloc);
- new_oloc.file = dst_oloc->file;
-
- /* Copy the shared object from source to destination */
- if(H5O_copy_header_map(&src_oloc, &new_oloc, dxpl_id, cpy_info, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
-
- /* Update link information with new destination object's address */
- link_dst->u.hard.addr = new_oloc.addr;
-
- /* Indicate that the destination message was modified */
- *modified = TRUE;
- } /* end case */
- break;
-
- case H5L_LINK_SOFT:
- case H5L_LINK_EXTERNAL:
- HGOTO_DONE(SUCCEED)
- break;
-
- default:
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
- } /* end switch */
+ /* Copy the link (and the object it points to) */
+ if(H5G_link_copy_file(dst_oloc->file, dxpl_id, link_src, src_oloc, link_dst,
+ cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy link")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -751,19 +659,16 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth)
{
- const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
- struct tm *tm;
- char buf[128];
+ const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_link_debug)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_link_debug)
/* check args */
HDassert(f);
@@ -773,15 +678,14 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Link Type:", (lnk->type == H5L_LINK_HARD ? "Hard" :
- (lnk->type == H5L_LINK_SOFT ? "Soft" :
- (lnk->type == H5L_LINK_EXTERNAL ? "External" :
- (lnk->type >= H5L_LINK_UD_MIN ? "User-defined" : "Unknown")))));
+ "Link Type:", (lnk->type == H5L_TYPE_HARD ? "Hard" :
+ (lnk->type == H5L_TYPE_SOFT ? "Soft" :
+ (lnk->type == H5L_TYPE_EXTERNAL ? "External" :
+ (lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown")))));
- tm = HDlocaltime(&(lnk->ctime));
- HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Creation Time:", buf);
+ if(lnk->corder_valid)
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Creation Order:", lnk->corder);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name Character Set:", (lnk->cset == H5T_CSET_ASCII ?
@@ -789,31 +693,39 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name:", lnk->name);
+ /* Display link-specific information */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Object address:", lnk->u.hard.addr);
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Value:", lnk->u.soft.name);
break;
- case H5L_LINK_EXTERNAL:
- {
- char * objname = (char *) lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Link File Name:", lnk->u.ud.udata);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Link Object Name:", objname);
- }
-
default:
+ if(lnk->type >= H5L_TYPE_UD_MIN) {
+ if(lnk->type == H5L_TYPE_EXTERNAL) {
+ const char * objname = (const char *)lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1);
+
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "External File Name:", lnk->u.ud.udata);
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "External Object Name:", objname);
+ } /* end if */
+ else {
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "User-Defined Link Size:", lnk->u.ud.size);
+ } /* end else */
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
break;
} /* end switch */
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_debug() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 092de03..35fc5f9 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -74,7 +74,7 @@ struct H5O_msg_class_t {
herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); /* Set shared information */
herr_t (*pre_copy_file)(H5F_t *, const H5O_msg_class_t *, void *, hbool_t *, const H5O_copy_t *, void *); /*"pre copy" action when copying native value to file */
void *(*copy_file)(H5F_t *, void *, H5F_t *, hid_t, H5O_copy_t *, void *); /*copy native value to file */
- herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, hbool_t *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */
+ herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int);
};
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 10b6c31..ead851e 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -84,21 +84,15 @@ typedef struct H5O_copy_t {
/* Header message IDs */
#define H5O_NULL_ID 0x0000 /* Null Message. */
#define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */
-#ifdef H5_GROUP_REVISION
#define H5O_LINFO_ID 0x0002 /* Link Info Message. */
-#endif /* H5_GROUP_REVISION */
#define H5O_DTYPE_ID 0x0003 /* Datatype Message. */
#define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */
#define H5O_FILL_NEW_ID 0x0005 /* Fill Value Message. (New) */
-#ifdef H5_GROUP_REVISION
#define H5O_LINK_ID 0x0006 /* Link Message. */
-#endif /* H5_GROUP_REVISION */
#define H5O_EFL_ID 0x0007 /* External File List Message */
#define H5O_LAYOUT_ID 0x0008 /* Data Storage Layout Message. */
#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */
-#ifdef H5_GROUP_REVISION
#define H5O_GINFO_ID 0x000a /* Group Info Message. */
-#endif /* H5_GROUP_REVISION */
#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */
#define H5O_ATTR_ID 0x000c /* Attribute Message. */
#define H5O_NAME_ID 0x000d /* Object name message. */
@@ -108,15 +102,19 @@ typedef struct H5O_copy_t {
#define H5O_STAB_ID 0x0011 /* Symbol table message. */
#define H5O_MTIME_NEW_ID 0x0012 /* Modification time message. (New) */
-#ifdef H5_GROUP_REVISION
/*
* Link Info Message.
+ * (Contains dynamic information about links in a group)
* (Data structure in memory)
*/
typedef struct H5O_linfo_t {
- hsize_t nlinks; /* Number of links in the group */
+ hsize_t nlinks; /* Number of links in the group */
+ int64_t min_corder; /* Min. creation order value for group */
+ int64_t max_corder; /* Max. creation order value for group */
+ haddr_t link_fheap_addr; /* Address of fractal heap for storing "dense" links */
+ haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of links */
+ haddr_t corder_bt2_addr; /* Address of v2 B-tree for indexing creation order values of links */
} H5O_linfo_t;
-#endif /* H5_GROUP_REVISION */
/*
* Fill Value Message. (Old)
@@ -161,8 +159,9 @@ typedef struct H5O_link_ud_t {
} H5O_link_ud_t;
typedef struct H5O_link_t {
- H5L_link_t type; /* Type of link */
- time_t ctime; /* Time link was createed */
+ H5L_type_t type; /* Type of link */
+ hbool_t corder_valid; /* Creation order for link is valid (not stored) */
+ int64_t corder; /* Creation order for link (stored if it's valid) */
H5T_cset_t cset; /* Character set of link name */
char *name; /* Link name */
union {
@@ -244,14 +243,20 @@ typedef struct H5O_bogus_t {
/*
* Group info message.
+ * (Contains static information about a group)
* (Data structure in memory)
*/
typedef struct H5O_ginfo_t {
- size_t lheap_size_hint; /* Local heap size hint */
- unsigned max_compact; /* Maximum # of compact links */
- unsigned min_dense; /* Minimum # of "dense" links */
- unsigned est_num_entries; /* Estimated # of entries in group */
- unsigned est_name_len; /* Estimated length of entry name */
+ /* "Old" format group info (not stored) */
+ uint32_t lheap_size_hint; /* Local heap size hint */
+
+ /* "New" format group info (stored) */
+ hbool_t track_corder; /* Are creation order values tracked on links? */
+ hbool_t index_corder; /* Are creation order values indexed on links? */
+ uint32_t max_compact; /* Maximum # of compact links */
+ uint32_t min_dense; /* Minimum # of "dense" links */
+ uint32_t est_num_entries; /* Estimated # of entries in group */
+ uint32_t est_name_len; /* Estimated length of entry name */
} H5O_ginfo_t;
/*
@@ -355,11 +360,13 @@ H5_DLL herr_t H5O_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence
H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5O_reset(unsigned type_id, void *native);
H5_DLL void *H5O_free(unsigned type_id, void *mesg);
-H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id);
-H5_DLL void* H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id);
+H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, const void *obj, unsigned type_id);
+H5_DLL void* H5O_decode(H5F_t *f, hid_t dxpl_id, const unsigned char *buf,
+ unsigned type_id);
H5_DLL void *H5O_copy(unsigned type_id, const void *mesg, void *dst);
H5_DLL size_t H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg);
-H5_DLL size_t H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg);
+H5_DLL size_t H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg,
+ size_t extra_raw);
H5_DLL herr_t H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share);
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_info(H5O_loc_t *loc, H5O_stat_t *ostat, hid_t dxpl_id);
@@ -378,12 +385,6 @@ H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, in
int fwidth);
/*
- * These functions operate on links
- */
-H5_DLL void *H5O_link_copy(const void *_mesg, void *_dest, unsigned update_flags);
-
-
-/*
* These functions operate on object locations
*/
H5_DLL herr_t H5O_loc_reset(H5O_loc_t *loc);
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index d641bc5..c15d676 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -45,8 +45,8 @@ static herr_t H5O_stab_free(void *_mesg);
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
static void *H5O_stab_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
-static herr_t H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
- void *mesg_dst, hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info);
+static herr_t H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -272,23 +272,21 @@ H5O_stab_free (void *mesg)
* Programmer: Quincey Koziol
* Thursday, March 20, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *mesg, hbool_t adj_link)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_delete)
/* check args */
- assert(f);
- assert(mesg);
+ HDassert(f);
+ HDassert(mesg);
/* Free the file space for the symbol table */
- if (H5G_stab_delete(f, dxpl_id, mesg, adj_link)<0)
+ if(H5G_stab_delete(f, dxpl_id, mesg, adj_link) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table")
done:
@@ -362,19 +360,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
- void *mesg_dst, hbool_t UNUSED *modified, hid_t dxpl_id, H5O_copy_t *cpy_info)
+H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
- H5G_bt_it_ud5_t udata; /* B-tree user data */
const H5O_stab_t *stab_src = (const H5O_stab_t *)mesg_src;
H5O_stab_t *stab_dst = (H5O_stab_t *)mesg_dst;
- H5F_t *file_src = parent_src_oloc->file;
+ H5G_bt_it_ud5_t udata; /* B-tree user data */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_post_copy_file)
/* check args */
- HDassert(file_src);
HDassert(stab_src);
HDassert(H5F_addr_defined(dst_oloc->addr));
HDassert(dst_oloc->file);
@@ -386,14 +382,14 @@ H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src,
HGOTO_DONE(SUCCEED)
/* Set up B-tree iteration user data */
- udata.src_oloc = (H5O_loc_t *)parent_src_oloc; /* Casting away const OK - QAK */
+ udata.src_oloc = src_oloc;
udata.src_heap_addr = stab_src->heap_addr;
udata.dst_file = dst_oloc->file;
udata.dst_stab = stab_dst;
udata.cpy_info = cpy_info;
/* Iterate over objects in group, copying them */
- if((H5B_iterate(file_src, dxpl_id, H5B_SNODE, H5G_node_copy, stab_src->btree_addr, &udata)) < 0)
+ if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, H5G_node_copy, stab_src->btree_addr, &udata)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed")
done:
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index b78bc2b..a97fe42 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -24,7 +24,6 @@
/* Static function prototypes */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_local_heap_size_hint
@@ -292,7 +291,87 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_est_link_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_creation_order_tracking
+ *
+ * Purpose: Set the flag to track creation order of links in a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 12, 2006
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_creation_order_tracking(hid_t plist_id, hbool_t track_corder)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_ginfo_t ginfo; /* Group information structure */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_creation_order_tracking, FAIL)
+ H5TRACE2("e","ib",plist_id,track_corder);
+
+ /* 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")
+
+ /* Get group info */
+ if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Update fields */
+ ginfo.track_corder = track_corder;
+
+ /* Set group info */
+ if(H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_creation_order_tracking() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_creation_order_tracking
+ *
+ * Purpose: Returns the flag indicating that creation order is tracked
+ * for links in a group.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 12, 2006
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_creation_order_tracking(hid_t plist_id, hbool_t *track_corder /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* return value */
-#endif /* H5_GROUP_REVISION */
+ FUNC_ENTER_API(H5Pget_creation_order_tracking, FAIL)
+ H5TRACE2("e","ix",plist_id,track_corder);
+
+ /* Get values */
+ if(track_corder) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_ginfo_t ginfo; /* Group information structure */
+
+ /* 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")
+
+ /* Get group info */
+ if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+
+ if(track_corder)
+ *track_corder = ginfo.track_corder;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_creation_order_tracking() */
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 55c3c58..c4a85a9 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -24,7 +24,6 @@
/* Static function prototypes */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_create_intermediate_group
@@ -97,5 +96,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_create_intermediate_group() */
-#endif /* H5_GROUP_REVISION */
-
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 3a749b7..c24b9d9 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -25,10 +25,10 @@
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Cpublic.h"
-#include "H5Ipublic.h"
#include "H5Dpublic.h"
#include "H5Fpublic.h"
#include "H5FDpublic.h"
+#include "H5Ipublic.h"
#include "H5MMpublic.h"
#include "H5Tpublic.h"
#include "H5Zpublic.h"
@@ -357,7 +357,6 @@ H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size/*out*/);
H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void* operate_data);
H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void** operate_data);
-#ifdef H5_GROUP_REVISION
/* Link creation property list (LCPL) routines */
H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/);
@@ -369,13 +368,13 @@ H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, uns
H5_DLL herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/);
H5_DLL herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len);
H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */, unsigned *est_name_len /* out */);
+H5_DLL herr_t H5Pset_creation_order_tracking(hid_t plist_id, hbool_t track_corder);
+H5_DLL herr_t H5Pget_creation_order_tracking(hid_t plist_id, hbool_t *track_corder /* out */);
/* String creation property list (SCPL) routines */
H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding);
H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/);
-#endif /* H5_GROUP_REVISION */
-
/* Link access property list (LAPL) routines */
H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks);
H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks);
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index ac13539..6a307c0 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -23,7 +23,6 @@
/* Static function prototypes */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_char_encoding
*
@@ -97,5 +96,3 @@ done:
FUNC_LEAVE_API(ret_value);
} /* end H5Pget_char_encoding() */
-#endif /* H5_GROUP_REVISION */
-
diff --git a/src/H5S.c b/src/H5S.c
index b3060ef..77468ce 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1717,32 +1717,33 @@ done:
static herr_t
H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
{
- size_t extent_size;
- hssize_t sselect_size;
- size_t select_size;
- H5F_t f; /* fake file structure*/
+ size_t extent_size; /* Size of serialized dataspace extent */
+ hssize_t sselect_size; /* Signed size of serialized dataspace selection */
+ size_t select_size; /* Size of serialized dataspace selection */
+ H5F_t f; /* Fake file structure*/
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5S_encode, FAIL);
/* Fake file structure, used only for header message operation */
f.shared = (H5F_file_t*)H5MM_calloc(sizeof(H5F_file_t));
+ HDassert(f.shared);
f.shared->sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF;
/* Find out the size of buffer needed for extent */
- if((extent_size=H5O_raw_size(H5O_SDSPACE_ID, &f, obj))==0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size");
+ if((extent_size = H5O_raw_size(H5O_SDSPACE_ID, &f, obj)) == 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size")
- if((sselect_size=H5S_SELECT_SERIAL_SIZE(obj))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size");
- H5_ASSIGN_OVERFLOW(select_size,sselect_size,hssize_t,size_t);
+ if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size")
+ H5_ASSIGN_OVERFLOW(select_size, sselect_size, hssize_t, size_t);
/* Verify the size of buffer. If it's not big enough, simply return the
* right size without filling the buffer. */
- if(!buf || *nalloc<(extent_size+select_size+1+1+1+4)) {
- *nalloc = extent_size+select_size+1+1+1+4;
- HGOTO_DONE(ret_value);
- }
+ if(!buf || *nalloc<(extent_size + select_size + 1 + 1 + 1 + 4)) {
+ *nalloc = extent_size + select_size + 1 + 1 + 1 + 4;
+ HGOTO_DONE(ret_value)
+ } /* end if */
/* Encode the type of the information */
*buf++ = H5O_SDSPACE_ID;
@@ -1757,26 +1758,26 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
UINT32ENCODE(buf, extent_size);
/* Encode the extent part of dataspace */
- if(H5O_encode(&f, buf, obj, H5O_SDSPACE_ID)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space");
- buf +=extent_size;
+ if(H5O_encode(&f, buf, obj, H5O_SDSPACE_ID) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space")
+ buf += extent_size;
/* Encode the selection part of dataspace. */
- if(H5S_SELECT_SERIALIZE(obj, buf) <0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space");
+ if(H5S_SELECT_SERIALIZE(obj, buf) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space")
done:
if(f.shared)
H5MM_free(f.shared);
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_encode() */
/*-------------------------------------------------------------------------
* Function: H5Sdecode
*
- * Purpose: Decode a binary object description of data space and
+ * Purpose: Decode a binary object description of dataspace and
* return a new object handle.
*
* Return: Success: dataspace ID(non-negative)
@@ -1787,8 +1788,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -1797,22 +1796,22 @@ H5Sdecode(const void *buf)
H5S_t *ds;
hid_t ret_value;
- FUNC_ENTER_API (H5Sdecode, FAIL);
+ FUNC_ENTER_API (H5Sdecode, FAIL)
H5TRACE1("i","x",buf);
- if (buf==NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
- if((ds = H5S_decode(buf))==NULL)
+ if((ds = H5S_decode(buf)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object");
/* Register the type and return the ID */
- if ((ret_value=H5I_register (H5I_DATASPACE, ds))<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace");
+ if((ret_value = H5I_register(H5I_DATASPACE, ds)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Sdecode() */
/*-------------------------------------------------------------------------
@@ -1829,23 +1828,21 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5S_t*
H5S_decode(const unsigned char *buf)
{
H5S_t *ds;
- H5S_extent_t *extent;
+ H5S_extent_t *extent;
size_t extent_size; /* size of the extent message*/
H5F_t f; /* fake file structure*/
H5S_t *ret_value;
- FUNC_ENTER_NOAPI(H5S_decode, NULL);
+ FUNC_ENTER_NOAPI(H5S_decode, NULL)
/* Initialize this before anything goes bad... */
- f.shared=NULL;
+ f.shared = NULL;
/* Decode the type of the information */
if(*buf++ != H5O_SDSPACE_ID)
@@ -1865,35 +1862,36 @@ H5S_decode(const unsigned char *buf)
UINT32DECODE(buf, extent_size);
/* Decode the extent part of dataspace */
- if((extent = H5O_decode(&f, buf, H5O_SDSPACE_ID))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object");
+ /* (pass mostly bogus file pointer and bogus DXPL) */
+ if((extent = H5O_decode(&f, H5P_DEFAULT, buf, H5O_SDSPACE_ID))==NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
buf += extent_size;
/* Copy the extent into dataspace structure */
if((ds = H5FL_CALLOC(H5S_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table");
- if(H5O_copy(H5O_SDSPACE_ID, extent, &(ds->extent))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object");
- if(H5S_extent_release(extent)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace");
- H5FL_FREE(H5S_extent_t,extent);
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table")
+ if(H5O_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
+ if(H5S_extent_release(extent) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace")
+ H5FL_FREE(H5S_extent_t, extent);
/* Initialize to "all" selection. Deserialization relies on valid existing selection. */
- if(H5S_select_all(ds,0)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection");
+ if(H5S_select_all(ds, 0) < 0)
+ HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
/* Decode the select part of dataspace. I believe this part always exists. */
- if(H5S_SELECT_DESERIALIZE(ds, buf)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection");
+ if(H5S_SELECT_DESERIALIZE(ds, buf) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection")
/* Set return value */
- ret_value=ds;
+ ret_value = ds;
done:
H5MM_xfree(f.shared);
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_decode() */
/*-------------------------------------------------------------------------
@@ -1908,22 +1906,15 @@ done:
* koziol@ncsa.uiuc.edu
* October 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
size_t
H5S_raw_size(const H5F_t *f, const H5S_t *space)
{
- size_t ret_value;
-
- FUNC_ENTER_NOAPI(H5S_raw_size, 0);
-
- /* Find out the size of buffer needed for extent */
- ret_value=H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent));
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_raw_size)
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ /* Return the size of buffer needed for extent */
+ FUNC_LEAVE_NOAPI(H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent)))
} /* end H5S_raw_size() */
diff --git a/src/H5T.c b/src/H5T.c
index 44ac21f..f5e786a 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2797,8 +2797,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -2810,19 +2808,19 @@ H5Tdecode(const void *buf)
FUNC_ENTER_API (H5Tdecode, FAIL);
H5TRACE1("i","x",buf);
- if (buf==NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
- if((dt = H5T_decode(buf))==NULL)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object");
+ if((dt = H5T_decode(buf)) == NULL)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object")
/* Register the type and return the ID */
- if ((ret_value=H5I_register (H5I_DATATYPE, dt))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type");
+ if((ret_value = H5I_register (H5I_DATATYPE, dt)) < 0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Tdecode() */
/*-------------------------------------------------------------------------
* API functions are above; library-private functions are below...
@@ -2895,8 +2893,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5T_t *
@@ -2904,22 +2900,24 @@ H5T_decode(const unsigned char *buf)
{
H5T_t *ret_value;
- FUNC_ENTER_NOAPI(H5T_decode, NULL);
+ FUNC_ENTER_NOAPI(H5T_decode, NULL)
/* Decode the type of the information */
if(*buf++ != H5O_DTYPE_ID)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype")
/* Decode the version of the datatype information */
if(*buf++ != H5T_ENCODE_VERSION)
- HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype")
- if((ret_value = H5O_decode(NULL, buf, H5O_DTYPE_ID))==NULL)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object");
+ /* Decode the serialized datatype message */
+ /* (pass bogus file pointer and DXPL) */
+ if((ret_value = H5O_decode(NULL, H5P_DEFAULT, buf, H5O_DTYPE_ID)) == NULL)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_decode() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 8527c96..4b64dcc 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -154,7 +154,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Tcommit_expand
@@ -209,7 +208,6 @@ H5Tcommit_expand(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit_expand() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h
index 96b87dd..79c6aa1 100644
--- a/src/H5api_adpt.h
+++ b/src/H5api_adpt.h
@@ -123,3 +123,4 @@
#endif
#endif /* H5API_ADPT_H */
+
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 6addc39..99b49c2 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -39,9 +39,6 @@
/* Define if gettimeofday() populates the tz pointer passed in */
#undef GETTIMEOFDAY_GIVES_TZ
-/* Define if the group revision code is to be compiled in */
-#undef GROUP_REVISION
-
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
diff --git a/src/H5err.txt b/src/H5err.txt
index 3345251..cb399dd 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -188,6 +188,7 @@ MINOR, OHDR, H5E_BADMESG, Unrecognized message
MINOR, OHDR, H5E_CANTDELETE, Can't delete message
MINOR, OHDR, H5E_BADITER, Iteration failed
MINOR, OHDR, H5E_CANTPACK, Can't pack messages
+MINOR, OHDR, H5E_CANTRESET, Can't reset object
# Group related errors
MINOR, GROUP, H5E_CANTOPENOBJ, Can't open object
diff --git a/src/H5public.h b/src/H5public.h
index cc29c78..724539b 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -57,6 +57,7 @@
#endif
+/* Include the Windows API adapter header early */
#include "H5api_adpt.h"
#ifdef __cplusplus
@@ -206,6 +207,13 @@ typedef ssize_t hssize_t;
#endif
#define HADDR_MAX (HADDR_UNDEF-1)
+/* Common iteration orders */
+typedef enum {
+ H5_ITER_INC, /* Increasing order */
+ H5_ITER_DEC, /* Decreasing order */
+ H5_ITER_NATIVE /* No particular order, whatever is fastest */
+} H5_iter_order_t;
+
/* Functions in H5.c */
H5_DLL herr_t H5open(void);
H5_DLL herr_t H5close(void);
diff --git a/src/H5trace.c b/src/H5trace.c
index f53c2eb..1d2e8c2 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -546,147 +546,147 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
break;
case 'F':
- switch (type[1]) {
- case 'd':
- if (ptr) {
- if (vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */
- switch (degree) {
- case H5F_CLOSE_DEFAULT:
- fprintf(out, "H5F_CLOSE_DEFAULT");
- break;
- case H5F_CLOSE_WEAK:
- fprintf(out, "H5F_CLOSE_WEAK");
- break;
- case H5F_CLOSE_SEMI:
- fprintf(out, "H5F_CLOSE_SEMI");
- break;
- case H5F_CLOSE_STRONG:
- fprintf(out, "H5F_CLOSE_STRONG");
- break;
- }
- }
- break;
+ switch(type[1]) {
+ case 'd':
+ if(ptr) {
+ if(vp)
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */
- case 's':
- if (ptr) {
- if (vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */
- switch (scope) {
- case H5F_SCOPE_LOCAL:
- fprintf(out, "H5F_SCOPE_LOCAL");
- break;
- case H5F_SCOPE_GLOBAL:
- fprintf(out, "H5F_SCOPE_GLOBAL");
- break;
- case H5F_SCOPE_DOWN:
- fprintf(out, "H5F_SCOPE_DOWN "
- "/*FOR INTERNAL USE ONLY!*/");
- break;
- }
- }
- break;
+ switch(degree) {
+ case H5F_CLOSE_DEFAULT:
+ fprintf(out, "H5F_CLOSE_DEFAULT");
+ break;
+ case H5F_CLOSE_WEAK:
+ fprintf(out, "H5F_CLOSE_WEAK");
+ break;
+ case H5F_CLOSE_SEMI:
+ fprintf(out, "H5F_CLOSE_SEMI");
+ break;
+ case H5F_CLOSE_STRONG:
+ fprintf(out, "H5F_CLOSE_STRONG");
+ break;
+ }
+ }
+ break;
- default:
- fprintf(out, "BADTYPE(F%c)", type[1]);
- goto error;
+ case 's':
+ if(ptr) {
+ if(vp)
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */
+
+ switch(scope) {
+ case H5F_SCOPE_LOCAL:
+ fprintf(out, "H5F_SCOPE_LOCAL");
+ break;
+ case H5F_SCOPE_GLOBAL:
+ fprintf(out, "H5F_SCOPE_GLOBAL");
+ break;
+ case H5F_SCOPE_DOWN:
+ fprintf(out, "H5F_SCOPE_DOWN "
+ "/*FOR INTERNAL USE ONLY!*/");
+ break;
+ }
+ }
+ break;
+
+ default:
+ fprintf(out, "BADTYPE(F%c)", type[1]);
+ goto error;
}
break;
case 'G':
- switch (type[1]) {
- case 'l':
- if (ptr) {
- if (vp) {
- fprintf (out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5L_link_t link_type = va_arg (ap, H5L_link_t); /*lint !e64 Type mismatch not really occuring */
- switch (link_type) {
- case H5L_LINK_ERROR:
- fprintf (out, "H5L_LINK_ERROR");
- break;
- case H5L_LINK_HARD:
- fprintf (out, "H5L_LINK_HARD");
- break;
- case H5L_LINK_SOFT:
- fprintf (out, "H5L_LINK_SOFT");
- break;
- default:
- fprintf (out, "%ld", (long)link_type);
- break;
- }
- }
- break;
+ switch(type[1]) {
+ case 'l':
+ if(ptr) {
+ if(vp)
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5L_type_t link_type = va_arg(ap, H5L_type_t); /*lint !e64 Type mismatch not really occuring */
- case 'o':
- if (ptr) {
- if (vp) {
- fprintf (out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5G_obj_t obj_type = va_arg (ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */
- switch (obj_type) {
- case H5G_UNKNOWN:
- fprintf (out, "H5G_UNKNOWN");
- break;
- case H5G_LINK:
- fprintf (out, "H5G_LINK");
- break;
- case H5G_UDLINK:
- fprintf (out, "H5G_UDLINK");
- break;
- case H5G_GROUP:
- fprintf (out, "H5G_GROUP");
- break;
- case H5G_DATASET:
- fprintf (out, "H5G_DATASET");
- break;
- case H5G_TYPE:
- fprintf (out, "H5G_TYPE");
- break;
- case H5G_RESERVED_5:
- case H5G_RESERVED_6:
- case H5G_RESERVED_7:
- fprintf (out, "H5G_RESERVED(%ld)",(long)obj_type);
- break;
- default:
- fprintf (out, "%ld", (long)obj_type);
- break;
- }
- }
- break;
+ switch(link_type) {
+ case H5L_TYPE_ERROR:
+ fprintf(out, "H5L_TYPE_ERROR");
+ break;
+ case H5L_TYPE_HARD:
+ fprintf(out, "H5L_TYPE_HARD");
+ break;
+ case H5L_TYPE_SOFT:
+ fprintf(out, "H5L_TYPE_SOFT");
+ break;
+ default:
+ fprintf(out, "%ld", (long)link_type);
+ break;
+ }
+ }
+ break;
- case 's':
- if (ptr) {
- if (vp) {
- fprintf (out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
- fprintf (out, "0x%lx", (unsigned long)statbuf);
- }
- break;
+ case 'o':
+ if(ptr) {
+ if(vp)
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5G_obj_t obj_type = va_arg(ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */
- default:
- fprintf (out, "BADTYPE(G%c)", type[1]);
- goto error;
+ switch(obj_type) {
+ case H5G_UNKNOWN:
+ fprintf(out, "H5G_UNKNOWN");
+ break;
+ case H5G_LINK:
+ fprintf(out, "H5G_LINK");
+ break;
+ case H5G_UDLINK:
+ fprintf(out, "H5G_UDLINK");
+ break;
+ case H5G_GROUP:
+ fprintf(out, "H5G_GROUP");
+ break;
+ case H5G_DATASET:
+ fprintf(out, "H5G_DATASET");
+ break;
+ case H5G_TYPE:
+ fprintf(out, "H5G_TYPE");
+ break;
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ fprintf(out, "H5G_RESERVED(%ld)",(long)obj_type);
+ break;
+ default:
+ fprintf(out, "%ld", (long)obj_type);
+ break;
+ }
+ }
+ break;
+
+ case 's':
+ if(ptr) {
+ if(vp)
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
+
+ fprintf(out, "0x%lx", (unsigned long)statbuf);
+ }
+ break;
+
+ default:
+ fprintf(out, "BADTYPE(G%c)", type[1]);
+ goto error;
}
break;
diff --git a/src/Makefile.am b/src/Makefile.am
index b11a52e..e8c28da 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,8 +50,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \
- H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
- H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
+ H5G.c H5Gbtree2.c H5Gdense.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c \
+ H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 66940ad..99a16a2 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -91,29 +91,30 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Fsfile.lo H5Fsuper.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
H5FDlog.lo H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \
H5FDsec2.lo H5FDstdio.lo H5FDstream.lo H5FL.lo H5FO.lo H5FS.lo \
- H5FScache.lo H5FSdbg.lo H5FSsection.lo H5G.lo H5Gdeprec.lo \
- H5Gent.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \
- H5Goh.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \
- H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \
- H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
- H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
- H5HFtiny.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo \
- H5I.lo H5MF.lo H5MM.lo H5MP.lo H5MPtest.lo H5L.lo \
- H5Lexternal.lo H5O.lo H5Oattr.lo H5Obogus.lo H5Ocache.lo \
- H5Ocont.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo \
- H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omtime.lo H5Oname.lo \
- H5Onull.lo H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo \
- H5P.lo H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \
- H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pstrcpl.lo \
- H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo \
- H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \
- H5SL.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo \
- H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tenum.lo H5Tfields.lo \
- H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo \
- H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo \
- H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo \
- H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo H5Zszip.lo \
- H5Zscaleoffset.lo H5Ztrans.lo
+ H5FScache.lo H5FSdbg.lo H5FSsection.lo H5G.lo H5Gbtree2.lo \
+ H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Glink.lo H5Gloc.lo \
+ H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Gstab.lo H5Gtest.lo \
+ H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo \
+ H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \
+ H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \
+ H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \
+ H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5MF.lo H5MM.lo \
+ H5MP.lo H5MPtest.lo H5L.lo H5Lexternal.lo H5O.lo H5Oattr.lo \
+ H5Obogus.lo H5Ocache.lo H5Ocont.lo H5Odtype.lo H5Oefl.lo \
+ H5Ofill.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo \
+ H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Osdspace.lo \
+ H5Oshared.lo H5Ostab.lo H5P.lo H5Pacpl.lo H5Pdcpl.lo \
+ H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pgcpl.lo H5Plapl.lo \
+ H5Plcpl.lo H5Pocpl.lo H5Pstrcpl.lo H5Ptest.lo H5R.lo H5RC.lo \
+ H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \
+ H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5ST.lo H5T.lo \
+ H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo \
+ H5Tcset.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo \
+ H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo H5Topaque.lo \
+ H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo \
+ H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \
+ H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \
+ H5Ztrans.lo
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
H5detect_SOURCES = H5detect.c
@@ -399,8 +400,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \
- H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
- H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
+ H5G.c H5Gbtree2.c H5Gdense.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c \
+ H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
@@ -599,6 +600,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsfile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsuper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5G.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gbtree2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdense.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdeprec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Glink.Plo@am__quote@