summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2001-10-03 17:57:56 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2001-10-03 17:57:56 (GMT)
commite3a137f39e80b6fe7271f18d2009865823f95f43 (patch)
tree8f16768f0622101ebb308a824560fc16e73732a0
parent7666ce56d350ee6e65af4736ae3455916a86aadd (diff)
downloadhdf5-e3a137f39e80b6fe7271f18d2009865823f95f43.zip
hdf5-e3a137f39e80b6fe7271f18d2009865823f95f43.tar.gz
hdf5-e3a137f39e80b6fe7271f18d2009865823f95f43.tar.bz2
[svn-r4517]
Purpose: Changed to the new generic property list for dataset creation property list. Platforms tested: Arabica, modi4 and Hawkwind
-rw-r--r--examples/h5_extend_write.c3
-rw-r--r--examples/h5_group.c1
-rw-r--r--examples/h5_select.c5
-rw-r--r--src/H5.c6
-rw-r--r--src/H5D.c812
-rw-r--r--src/H5Dprivate.h54
-rw-r--r--src/H5P.c441
-rw-r--r--src/H5Pprivate.h2
-rw-r--r--src/H5Ppublic.h9
-rw-r--r--test/dsets.c4
-rw-r--r--test/extend.c2
-rw-r--r--test/external.c18
-rw-r--r--test/tgenprop.c15
-rw-r--r--testpar/t_dset.c1
-rw-r--r--tools/h4toh5/h4toh5image.c2
-rw-r--r--tools/h4toh5/h4toh5sds.c18
-rw-r--r--tools/h5dump/h5dumptst.c3
17 files changed, 903 insertions, 493 deletions
diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c
index 4fd404c..133e2aa 100644
--- a/examples/h5_extend_write.c
+++ b/examples/h5_extend_write.c
@@ -57,7 +57,7 @@ main (void)
/*
* Modify dataset creation properties, i.e. enable chunking.
*/
- cparms = H5Pcreate (H5P_DATASET_CREATE);
+ cparms = H5Pcreate(H5P_DATASET_CREATE);
status = H5Pset_chunk( cparms, RANK, chunk_dims);
/*
@@ -165,6 +165,7 @@ main (void)
H5Dclose(dataset);
H5Sclose(dataspace);
H5Sclose(filespace);
+ H5Pclose(cparms);
H5Fclose(file);
return 0;
diff --git a/examples/h5_group.c b/examples/h5_group.c
index 72982ec..2900a7b 100644
--- a/examples/h5_group.c
+++ b/examples/h5_group.c
@@ -78,6 +78,7 @@ main(void)
*/
H5Sclose(dataspace);
H5Dclose(dataset);
+ H5Pclose(plist);
H5Fclose(file);
/*
diff --git a/examples/h5_select.c b/examples/h5_select.c
index 0ff9de1..ad41536 100644
--- a/examples/h5_select.c
+++ b/examples/h5_select.c
@@ -302,6 +302,11 @@ main (void)
* Close dataset.
*/
ret = H5Dclose(dataset);
+
+ /*
+ * Close property list
+ */
+ ret = H5Pclose(plist);
/*
* Close the file.
diff --git a/src/H5.c b/src/H5.c
index 8b95d0a..a6cd6db 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -1980,9 +1980,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case H5P_FILE_ACCESS_OLD:
fprintf(out, "H5P_FILE_ACCESS");
break;
- case H5P_DATASET_CREATE_OLD:
- fprintf(out, "H5P_DATASET_CREATE");
- break;
case H5P_MOUNT_OLD:
fprintf(out, "H5P_MOUNT");
break;
@@ -2149,9 +2146,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case H5P_FILE_ACCESS_OLD:
fprintf (out, "H5P_FILE_ACCESS");
break;
- case H5P_DATASET_CREATE_OLD:
- fprintf (out, "H5P_DATASET_CREATE");
- break;
case H5P_MOUNT_OLD:
fprintf (out, "H5P_MOUNT");
break;
diff --git a/src/H5D.c b/src/H5D.c
index c82c89a..62ad844 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -47,38 +47,16 @@
struct H5D_t {
H5G_entry_t ent; /*cached object header stuff */
H5T_t *type; /*datatype of this dataset */
- H5D_create_t *create_parms; /*creation parameters */
+ hid_t dcpl_id; /*dataset creation property id */
H5O_layout_t layout; /*data layout */
};
-/* Default dataset creation property list */
-const H5D_create_t H5D_create_dflt = {
- H5D_CONTIGUOUS, /* Layout */
- 1, /* Chunk dimensions */
- {1, 1, 1, 1, 1, 1, 1, 1, /* Chunk size. These default values....*/
- 1, 1, 1, 1, 1, 1, 1, 1, /*...are quite useless. Larger chunks..*/
- 1, 1, 1, 1, 1, 1, 1, 1, /*...produce fewer, but larger I/O......*/
- 1, 1, 1, 1, 1, 1, 1, 1}, /*...requests. */
-
- /* Fill value */
- {NULL, 0, NULL}, /* No fill value */
-
- /* External file list */
- {HADDR_UNDEF, /* External file list heap address */
- 0, /*...slots allocated */
- 0, /*...slots used */
- NULL}, /*...slot array */
-
- /* Filters */
- {0, 0, NULL} /* No filters in pipeline */
-};
-
/* Interface initialization? */
static int interface_initialize_g = 0;
#define INTERFACE_INIT H5D_init_interface
static herr_t H5D_init_interface(void);
static herr_t H5D_init_storage(H5D_t *dataset, const H5S_t *space);
-H5D_t * H5D_new(const H5D_create_t *create_parms);
+H5D_t * H5D_new(const hid_t dcpl_id);
/* Declare a free list to manage the H5D_t struct */
H5FL_DEFINE_STATIC(H5D_t);
@@ -139,25 +117,60 @@ DESCRIPTION
static herr_t
H5D_init_interface(void)
{
- H5P_genclass_t *pclass; /* Property list class to modify */
- size_t def_max_temp_buf=H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */
- void *def_tconv_buf=H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */
- void *def_bkgr_buf=H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */
- H5T_bkg_t def_bkgr_buf_type=H5D_XFER_BKGR_BUF_TYPE_DEF; /* Default value for background buffer type */
- double def_btree_split_ratio[3]=H5D_XFER_BTREE_SPLIT_RATIO_DEF; /* Default value for B-tree node split ratios */
- unsigned def_hyper_cache=H5D_XFER_HYPER_CACHE_DEF; /* Default value for hyperslab caching */
- unsigned def_hyper_cache_lim=H5D_XFER_HYPER_CACHE_LIM_DEF; /* Default value for hyperslab cache limit */
- H5MM_allocate_t def_vlen_alloc=H5D_XFER_VLEN_ALLOC_DEF; /* Default value for vlen allocation function */
- void *def_vlen_alloc_info=H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */
- H5MM_free_t def_vlen_free=H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */
- void *def_vlen_free_info=H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */
- hid_t def_vfl_id=H5D_XFER_VFL_ID_DEF; /* Default value for file driver ID */
- void *def_vfl_info=H5D_XFER_VFL_INFO_DEF; /* Default value for file driver info */
+ /* Dataset Transfer property class variables. In sequence, they are,
+ * - Transfer Property list class to modify
+ * - Default value for maximum temp buffer size
+ * - Default value for type conversion buffer
+ * - Default value for background buffer
+ * - Default value for B-tree node split ratios
+ * - Default value for hyperslab caching
+ * - Default value for hyperslab cache limit
+ * - Default value for vlen allocation function
+ * - Default value for vlen allocation information
+ * - Default value for vlen free function
+ * - Default value for vlen free information
+ * - Default value for file driver ID
+ * - Default value for file driver info
+ * - Default value for 'gather reads' property
+ * - Default value for vector size
+ */
+ H5P_genclass_t *xfer_pclass;
+ size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF;
+ void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF;
+ void *def_bkgr_buf = H5D_XFER_BKGR_BUF_DEF;
+ H5T_bkg_t def_bkgr_buf_type = H5D_XFER_BKGR_BUF_TYPE_DEF;
+ double def_btree_split_ratio[3] = H5D_XFER_BTREE_SPLIT_RATIO_DEF;
+ unsigned def_hyper_cache = H5D_XFER_HYPER_CACHE_DEF;
+ unsigned def_hyper_cache_lim = H5D_XFER_HYPER_CACHE_LIM_DEF;
+ H5MM_allocate_t def_vlen_alloc = H5D_XFER_VLEN_ALLOC_DEF;
+ void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF;
+ H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF;
+ void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF;
+ hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF;
+ void *def_vfl_info = H5D_XFER_VFL_INFO_DEF;
#ifdef COALESCE_READS
- unsigned def_gather_reads=H5D_XFER_GATHER_READS_DEF; /* Default value for 'gather reads' property */
+ unsigned def_gather_reads = H5D_XFER_GATHER_READS_DEF;
#endif /* COALESCE_READS */
- size_t def_hyp_vec_size=H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */
- herr_t ret_value=SUCCEED; /* Return value */
+ size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF;
+
+ /* Dataset creation property class variables. In sequence, they are,
+ * - Creation property list class to modify
+ * - Default value for storage layout property
+ * - Default value for chunk dimensionality property
+ * - Default value for chunk size
+ * - Default value for fill value
+ * - Default value for external file list
+ * - Default value for data filter pipeline
+ */
+ H5P_genclass_t *crt_pclass;
+ H5D_layout_t layout = H5D_CRT_LAYOUT_DEF;
+ int chunk_ndims = H5D_CRT_CHUNK_DIM_DEF;
+ hsize_t chunk_size[32] = H5D_CRT_CHUNK_SIZE_DEF;
+ H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF;
+ H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF;
+ H5O_pline_t pline = H5D_CRT_DATA_PIPELINE_DEF;
+
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER(H5D_init_interface, FAIL);
@@ -168,79 +181,129 @@ H5D_init_interface(void)
"unable to initialize interface");
}
- /* Register the default dataset creation properties */
+ /* =========Dataset Transfer Property Class Initialization========= */
+ /* Register the default dataset transfer properties */
assert(H5P_CLS_DATASET_XFER_g!=(-1));
- /* Get the pointer to the dataset creation class */
- if (H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_DATASET_XFER_g) || NULL == (pclass = H5I_object(H5P_CLS_DATASET_XFER_g)))
+ /* Get the pointer to the dataset transfer class */
+ if (H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_DATASET_XFER_g) || NULL == (xfer_pclass = H5I_object(H5P_CLS_DATASET_XFER_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class");
/* Register the max. temp buffer size property */
- if(H5P_register(pclass,H5D_XFER_MAX_TEMP_BUF_NAME,H5D_XFER_MAX_TEMP_BUF_SIZE,&def_max_temp_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_MAX_TEMP_BUF_NAME,H5D_XFER_MAX_TEMP_BUF_SIZE,&def_max_temp_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the type conversion buffer property */
- if(H5P_register(pclass,H5D_XFER_TCONV_BUF_NAME,H5D_XFER_TCONV_BUF_SIZE,&def_tconv_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_TCONV_BUF_NAME,H5D_XFER_TCONV_BUF_SIZE,&def_tconv_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the background buffer property */
- if(H5P_register(pclass,H5D_XFER_BKGR_BUF_NAME,H5D_XFER_BKGR_BUF_SIZE,&def_bkgr_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_NAME,H5D_XFER_BKGR_BUF_SIZE,&def_bkgr_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the background buffer type property */
- if(H5P_register(pclass,H5D_XFER_BKGR_BUF_TYPE_NAME,H5D_XFER_BKGR_BUF_TYPE_SIZE,&def_bkgr_buf_type,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_TYPE_NAME,H5D_XFER_BKGR_BUF_TYPE_SIZE,&def_bkgr_buf_type,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the B-Tree node splitting ratios property */
- if(H5P_register(pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,&def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,&def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the hyperslab caching property */
- if(H5P_register(pclass,H5D_XFER_HYPER_CACHE_NAME,H5D_XFER_HYPER_CACHE_SIZE,&def_hyper_cache,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_HYPER_CACHE_NAME,H5D_XFER_HYPER_CACHE_SIZE,&def_hyper_cache,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the hyperslab cache limit property */
- if(H5P_register(pclass,H5D_XFER_HYPER_CACHE_LIM_NAME,H5D_XFER_HYPER_CACHE_LIM_SIZE,&def_hyper_cache_lim,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_HYPER_CACHE_LIM_NAME,H5D_XFER_HYPER_CACHE_LIM_SIZE,&def_hyper_cache_lim,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the vlen allocation function property */
- if(H5P_register(pclass,H5D_XFER_VLEN_ALLOC_NAME,H5D_XFER_VLEN_ALLOC_SIZE,&def_vlen_alloc,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_NAME,H5D_XFER_VLEN_ALLOC_SIZE,&def_vlen_alloc,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the vlen allocation information property */
- if(H5P_register(pclass,H5D_XFER_VLEN_ALLOC_INFO_NAME,H5D_XFER_VLEN_ALLOC_INFO_SIZE,&def_vlen_alloc_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_INFO_NAME,H5D_XFER_VLEN_ALLOC_INFO_SIZE,&def_vlen_alloc_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the vlen free function property */
- if(H5P_register(pclass,H5D_XFER_VLEN_FREE_NAME,H5D_XFER_VLEN_FREE_SIZE,&def_vlen_free,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_NAME,H5D_XFER_VLEN_FREE_SIZE,&def_vlen_free,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the vlen free information property */
- if(H5P_register(pclass,H5D_XFER_VLEN_FREE_INFO_NAME,H5D_XFER_VLEN_FREE_INFO_SIZE,&def_vlen_free_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_INFO_NAME,H5D_XFER_VLEN_FREE_INFO_SIZE,&def_vlen_free_info,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 property */
- if(H5P_register(pclass,H5D_XFER_VFL_ID_NAME,H5D_XFER_VFL_ID_SIZE,&def_vfl_id,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VFL_ID_NAME,H5D_XFER_VFL_ID_SIZE,&def_vfl_id,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 property */
- if(H5P_register(pclass,H5D_XFER_VFL_INFO_NAME,H5D_XFER_VFL_INFO_SIZE,&def_vfl_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VFL_INFO_NAME,H5D_XFER_VFL_INFO_SIZE,&def_vfl_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
#ifdef COALESCE_READS
/* Register the 'gather reads' property */
- if(H5P_register(pclass,H5D_XFER_GATHER_READS_NAME,H5D_XFER_GATHER_READS_SIZE,&def_gather_reads,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_GATHER_READS_NAME,H5D_XFER_GATHER_READS_SIZE,&def_gather_reads,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
#endif /* COALESCE_READS */
/* Register the vector size property */
- if(H5P_register(pclass,H5D_XFER_HYPER_VECTOR_SIZE_NAME,H5D_XFER_HYPER_VECTOR_SIZE_SIZE,&def_hyp_vec_size,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_HYPER_VECTOR_SIZE_NAME,H5D_XFER_HYPER_VECTOR_SIZE_SIZE,&def_hyp_vec_size,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the default data transfer property list */
if ((H5P_LST_DATASET_XFER_g = H5Pcreate_list (H5P_CLS_DATASET_XFER_g))<0)
HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list");
+ /* =========Dataset Creation Property Class Initialization========== */
+ /* Register the default dataset creation properties */
+ assert(H5P_CLS_DATASET_CREATE_g != -1);
+
+ /* Get the pointer to the dataset creation class */
+ if(H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_DATASET_CREATE_g) ||
+ NULL == (crt_pclass = H5I_object(H5P_CLS_DATASET_CREATE_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class");
+
+ /* Register the storage layout property */
+ if(H5P_register(crt_pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE,
+ &layout, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the chunking dimensionality property */
+ if(H5P_register(crt_pclass, H5D_CRT_CHUNK_DIM_NAME, H5D_CRT_CHUNK_DIM_SIZE,
+ &chunk_ndims, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the chunking size property */
+ if(H5P_register(crt_pclass, H5D_CRT_CHUNK_SIZE_NAME, H5D_CRT_CHUNK_SIZE_SIZE, chunk_size, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the fill value property */
+ if(H5P_register(crt_pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the external file list property */
+ if(H5P_register(crt_pclass, H5D_CRT_EXT_FILE_LIST_NAME,
+ H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL,
+ NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the data pipeline property */
+ if(H5P_register(crt_pclass, H5D_CRT_DATA_PIPELINE_NAME,
+ H5D_CRT_DATA_PIPELINE_SIZE, &pline, NULL, NULL, NULL,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the default data transfer property list */
+ if ((H5P_LST_DATASET_CREATE_g = H5Pcreate_list (H5P_CLS_DATASET_CREATE_g))<0)
+ HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list");
+
done:
FUNC_LEAVE(ret_value);
}
@@ -282,6 +345,122 @@ H5D_term_interface(void)
/*-------------------------------------------------------------------------
+ * Function: H5D_crt_copy
+ *
+ * Purpose: Callback routine which is called whenever any dataset
+ * creation property list is copied. This routine copies
+ * the properties from the old list to the new list.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * Tuesday, October 2, 2001
+ *
+ * Modification:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D_crt_copy(hid_t new_plist_id, hid_t old_plist_id, void UNUSED *copy_data)
+{
+ H5O_fill_t src_fill={0}, dst_fill={0};
+ H5O_efl_t src_efl={0}, dst_efl={0};
+ H5O_pline_t src_pline={0}, dst_pline={0};
+ herr_t ret_value=SUCCEED;
+
+ FUNC_ENTER(H5D_crt_copy, FAIL);
+
+ /* Verify property list ID */
+ if(H5I_GENPROP_LST != H5I_get_type(new_plist_id) || H5I_GENPROP_LST !=
+ H5I_get_type(old_plist_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ /* Get the fill value, external file list, and data pipeline properties
+ * from the old property list */
+ if(H5P_get(old_plist_id, H5D_CRT_FILL_VALUE_NAME, &src_fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+ if(H5P_get(old_plist_id, H5D_CRT_EXT_FILE_LIST_NAME, &src_efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ if(H5P_get(old_plist_id, H5D_CRT_DATA_PIPELINE_NAME, &src_pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+
+ /* Make copies of fill value, external file list, and data pipeline */
+ if(NULL==H5O_copy(H5O_FILL, &src_fill, &dst_fill))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value");
+ if(NULL==H5O_copy(H5O_EFL, &src_efl, &dst_efl))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,
+ "can't copy external file list");
+ if(NULL==H5O_copy(H5O_PLINE, &src_pline, &dst_pline))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline");
+
+ /* Set the fill value, external file list, and data pipeline property
+ * for the new property list */
+ if(H5P_set(new_plist_id, H5D_CRT_FILL_VALUE_NAME, &dst_fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set fill value");
+ if(H5P_set(new_plist_id, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,
+ "can't set external file list");
+ if(H5P_set(new_plist_id, H5D_CRT_DATA_PIPELINE_NAME, &dst_pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set pipeline");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_crt_close
+ *
+ * Purpose: Callback routine which is called whenever any dataset create
+ * property list is closed. This routine performs any generic
+ * cleanup needed on the properties the library put into the list.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 11, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D_crt_close(hid_t dcpl_id, void UNUSED *close_data)
+{
+ H5O_fill_t fill={0};
+ H5O_efl_t efl={0};
+ H5O_pline_t pline={0};
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER(H5D_crt_close, FAIL);
+
+ /* Get the fill value, external file list, and data pipeline properties
+ * from the old property list */
+ if(H5P_get(dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+ if(H5P_get(dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ if(H5P_get(dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+
+ /* Clean up any values set for the fill-value, external file-list and
+ * data pipeline */
+ H5O_reset(H5O_FILL, &fill);
+ H5O_reset(H5O_EFL, &efl);
+ H5O_reset(H5O_PLINE, &pline);
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5D_crt_close() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D_xfer_create
*
* Purpose: Callback routine which is called whenever any dataset transfer
@@ -339,6 +518,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D_xfer_copy
+ *
+ * Purpose: Callback routine which is called whenever any dataset
+ * transfer property list is copied. This routine copies
+ * the properties from the old list to the new list.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * Tuesday, October 2, 2001
+ *
+ * Modification:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D_xfer_copy(hid_t new_plist_id, hid_t UNUSED old_plist_id,
+ void *copy_data)
+{
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER(H5D_xfer_copy, FAIL);
+
+ if(H5D_xfer_create(new_plist_id, copy_data) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy property list");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5D_xfer_close
*
* Purpose: Callback routine which is called whenever any dataset transfer
@@ -432,7 +645,6 @@ H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
H5S_t *space = NULL;
H5D_t *new_dset = NULL;
hid_t ret_value = FAIL;
- const H5D_create_t *create_parms = NULL;
FUNC_ENTER(H5Dcreate, FAIL);
H5TRACE5("i","isiii",loc_id,name,type_id,space_id,plist_id);
@@ -452,17 +664,15 @@ H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
NULL == (space = H5I_object(space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
}
- if (H5P_DEFAULT==plist_id) {
- create_parms = &H5D_create_dflt;
- } else if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (create_parms = H5I_object(plist_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a dataset creation property list");
- }
+ if(H5P_DEFAULT == plist_id)
+ plist_id = H5P_DATASET_CREATE_DEFAULT;
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id) ||
+ TRUE != H5Pisa_class(plist_id, H5P_DATASET_CREATE))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not dataset create property list");
/* build and open the new dataset */
- if (NULL == (new_dset = H5D_create(loc, name, type, space,
- create_parms))) {
+ if (NULL == (new_dset = H5D_create(loc, name, type, space, plist_id))) {
HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to create dataset");
}
@@ -739,6 +949,11 @@ H5Dget_type(hid_t dset_id)
* Tuesday, February 3, 1998
*
* Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * The way to retrieve and set property is changed for the
+ * generic property list.
*
*-------------------------------------------------------------------------
*/
@@ -746,7 +961,8 @@ hid_t
H5Dget_create_plist(hid_t dset_id)
{
H5D_t *dset = NULL;
- H5D_create_t *copied_parms = NULL;
+ H5O_fill_t copied_fill={NULL,0,NULL};
+ H5O_efl_t efl1, efl2;
hid_t ret_value = FAIL;
FUNC_ENTER (H5Dget_create_plist, FAIL);
@@ -757,29 +973,25 @@ H5Dget_create_plist(hid_t dset_id)
NULL==(dset=H5I_object (dset_id))) {
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
}
-
/* Copy the creation property list */
- if (NULL==(copied_parms=H5P_copy (H5P_DATASET_CREATE,
- dset->create_parms))) {
- HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
- "unable to copy the creation property list");
+ if((ret_value = H5P_copy_new(dset->dcpl_id)) < 0) {
+ HRETURN_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to copy the creation property list");
}
+ /* Get the fill value property */
+ if(H5Pget(ret_value, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
/* Copy the dataset type into the fill value message */
- if (!copied_parms->fill.type &&
- NULL==(copied_parms->fill.type=H5T_copy(dset->type,
- H5T_COPY_TRANSIENT))) {
- HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
- "unable to copy dataset data type for fill value");
- }
-
- /* Create an atom */
- if ((ret_value=H5I_register ((H5I_type_t)(H5I_TEMPLATE_0+
- H5P_DATASET_CREATE),
- copied_parms))<0) {
- HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL,
- "unable to register creation property list");
+ if(copied_fill.type==NULL)
+ if(NULL==(copied_fill.type=H5T_copy(dset->type, H5T_COPY_TRANSIENT))){
+ HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to copy dataset data type for fill value");
}
+ /* Set back the fill value property to property list */
+ if(H5P_set(ret_value, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0)
+ HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to set property list fill value");
FUNC_LEAVE (ret_value);
}
@@ -1044,10 +1256,15 @@ H5Dextend(hid_t dset_id, const hsize_t *size)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to query and inialization for generic
+ * property list.
+ *
*-------------------------------------------------------------------------
*/
H5D_t *
-H5D_new(const H5D_create_t *create_parms)
+H5D_new(hid_t dcpl_id)
{
H5D_t *ret_value = NULL; /*return value */
@@ -1060,12 +1277,13 @@ H5D_new(const H5D_create_t *create_parms)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
- if(create_parms!=NULL) {
- ret_value->create_parms = H5P_copy (H5P_DATASET_CREATE, create_parms);
- } else {
- ret_value->create_parms = H5P_copy (H5P_DATASET_CREATE,
- &H5D_create_dflt);
- }
+ if(H5P_DEFAULT == dcpl_id)
+ dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+ if(H5I_GENPROP_LST != H5I_get_type(dcpl_id) ||
+ TRUE != H5Pisa_class(dcpl_id, H5P_DATASET_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list");
+
+ ret_value->dcpl_id = H5P_copy_new(dcpl_id);
ret_value->ent.header = HADDR_UNDEF;
/* Success */
@@ -1110,19 +1328,30 @@ done:
* The names for the external file list are entered into the heap hear
* instead of when the efl message is encoded, preventing a possible
* infinite recursion situation.
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to retrieve and set property for generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
H5D_t *
-H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
- const H5S_t *space, const H5D_create_t *create_parms)
+H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
+ const H5S_t *space, hid_t dcpl_id)
{
H5D_t *new_dset = NULL;
H5D_t *ret_value = NULL;
- int i, ndims;
+ int i, ndims;
unsigned u;
hsize_t max_dim[H5O_LAYOUT_NDIMS]={0};
- H5O_efl_t *efl = NULL;
+ H5O_efl_t efl;
H5F_t *f = NULL;
+ H5O_pline_t dcpl_pline;
+ H5D_layout_t dcpl_layout;
+ int chunk_ndims = 0;
+ hsize_t chunk_size[32]={0};
+ H5O_fill_t fill={NULL,0,NULL};
FUNC_ENTER(H5D_create, NULL);
@@ -1131,11 +1360,16 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
assert (name && *name);
assert (type);
assert (space);
- assert (create_parms);
- if (create_parms->pline.nfilters>0 && H5D_CHUNKED!=create_parms->layout) {
- HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
- "filters can only be used with chunked layout");
- }
+ assert(H5I_GENPROP_LST==H5I_get_type(dcpl_id));
+ if(H5P_get(dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &dcpl_pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't retrieve pipeline filter");
+ if(H5P_get(dcpl_id, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout");
+ if(dcpl_pline.nfilters > 0 && H5D_CHUNKED != dcpl_layout)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL,
+ "filters can only be used with chunked layout");
+
/* What file is the dataset being added to? */
if (NULL==(f=H5G_insertion_file(loc, name))) {
@@ -1145,18 +1379,19 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
#ifdef H5_HAVE_PARALLEL
/* If MPIO is used, no filter support yet. */
- if (IS_H5FD_MPIO(f) && create_parms->pline.nfilters>0) {
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
- "Parallel IO does not support filters yet");
- }
+ if(IS_H5FD_MPIO(f) && dcpl_pline.nfilters > 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL,
+ "Parallel I/O does not support filters yet");
#endif
/* Initialize the dataset object */
- if (NULL==(new_dset = H5D_new(create_parms))) {
+ if(NULL == (new_dset = H5D_new(dcpl_id))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
-
+ if(H5P_get(new_dset->dcpl_id, H5D_CRT_CHUNK_DIM_NAME, &chunk_ndims) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout");
+
/* Copy datatype for dataset */
new_dset->type = H5T_copy(type, H5T_COPY_ALL);
@@ -1165,23 +1400,28 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid VL location");
}
- efl = &(new_dset->create_parms->efl);
+ if(H5P_get(new_dset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't retrieve external file list");
/* Total raw data size */
- new_dset->layout.type = new_dset->create_parms->layout;
+ if(H5P_get(new_dset->dcpl_id, H5D_CRT_LAYOUT_NAME,
+ &(new_dset->layout.type)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout");
new_dset->layout.ndims = H5S_get_simple_extent_ndims(space) + 1;
assert((unsigned)(new_dset->layout.ndims) <= NELMTS(new_dset->layout.dim));
- new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size(new_dset->type);
+ new_dset->layout.dim[new_dset->layout.ndims-1] =
+ H5T_get_size(new_dset->type);
- switch (new_dset->create_parms->layout) {
+ switch (dcpl_layout) {
case H5D_CONTIGUOUS:
/*
* The maximum size of the dataset cannot exceed the storage size.
* Also, only the slowest varying dimension of a simple data space
* can be extendible.
*/
- if ((ndims=H5S_get_simple_extent_dims(space, new_dset->layout.dim,
- max_dim))<0) {
+ if ((ndims=H5S_get_simple_extent_dims(space, new_dset->layout.dim,
+ max_dim))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize contiguous storage");
}
@@ -1191,9 +1431,9 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
"only the first dimension can be extendible");
}
}
- if (efl->nused>0) {
+ if (efl.nused>0) {
hsize_t max_points = H5S_get_npoints_max (space);
- hsize_t max_storage = H5O_efl_total_size (efl);
+ hsize_t max_storage = H5O_efl_total_size (&efl);
if (H5S_UNLIMITED==max_points) {
if (H5O_EFL_UNLIMITED!=max_storage) {
@@ -1218,11 +1458,11 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
* Chunked storage allows any type of data space extension, so we
* don't even bother checking.
*/
- if (new_dset->create_parms->chunk_ndims != H5S_get_simple_extent_ndims(space)) {
+ if(chunk_ndims != H5S_get_simple_extent_ndims(space)) {
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL,
"dimensionality of chunks doesn't match the data space");
}
- if (efl->nused>0) {
+ if (efl.nused>0) {
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
"external storage not supported with chunked layout");
}
@@ -1231,12 +1471,17 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
* The chunk size of a dimension with a fixed size cannot exceed
* the maximum dimension size
*/
+ if(H5P_get(new_dset->dcpl_id, H5D_CRT_CHUNK_SIZE_NAME, chunk_size)
+ < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't retrieve chunk size");
+
if (H5S_get_simple_extent_dims(space, NULL, max_dim)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to query maximum dimensions");
}
for (u=0; u<new_dset->layout.ndims-1; u++) {
- if (max_dim[u]!=H5S_UNLIMITED && max_dim[u]<new_dset->create_parms->chunk_size[u]) {
+ if(max_dim[u] != H5S_UNLIMITED && max_dim[u] < chunk_size[u]) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"chunk size must be <= maximum dimension size for fixed-sized dimensions");
}
@@ -1244,7 +1489,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
/* Set the dataset's chunk sizes from the property list's chunk sizes */
for (u=0; u<new_dset->layout.ndims-1; u++) {
- new_dset->layout.dim[u] = new_dset->create_parms->chunk_size[u];
+ new_dset->layout.dim[u] = chunk_size[u];
}
break;
@@ -1259,17 +1504,19 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
}
/* Convert the fill value to the dataset type and write the message */
- if (H5O_fill_convert(&(new_dset->create_parms->fill), new_dset->type)<0) {
+ if(H5P_get(new_dset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve fill value");
+ if (H5O_fill_convert(&fill, new_dset->type) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
- "unable to convert fill value to dataset type");
+ "unable to convert fill value to dataset type");
}
- if (new_dset->create_parms->fill.buf &&
- H5O_modify(&(new_dset->ent), H5O_FILL, 0, H5O_FLAG_CONSTANT,
- &(new_dset->create_parms->fill))<0) {
+ if (fill.buf && H5O_modify(&(new_dset->ent), H5O_FILL, 0,
+ H5O_FLAG_CONSTANT, &fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
- "unable to update fill value header message");
- }
-
+ "unable to update fill value header message");
+ if(H5P_set(new_dset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't set fill value");
+
/* Update the type and space header messages */
if (H5O_modify(&(new_dset->ent), H5O_DTYPE, 0,
H5O_FLAG_CONSTANT|H5O_FLAG_SHARED, new_dset->type)<0 ||
@@ -1279,9 +1526,11 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
}
/* Update the filters message */
- if (new_dset->create_parms->pline.nfilters>0 &&
- H5O_modify (&(new_dset->ent), H5O_PLINE, 0, H5O_FLAG_CONSTANT,
- &(new_dset->create_parms->pline))<0) {
+ if(H5P_get(new_dset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &dcpl_pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "Can't retrieve pipeline filter");
+ if (dcpl_pline.nfilters>0 && H5O_modify (&(new_dset->ent), H5O_PLINE, 0,
+ H5O_FLAG_CONSTANT, &dcpl_pline) < 0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update filter header message");
}
@@ -1310,7 +1559,7 @@ printf("%s: check 0.5\n",FUNC);
#ifdef QAK
printf("%s: check 1.0\n",FUNC);
#endif /* QAK */
- if (0==efl->nused) {
+ if (0==efl.nused) {
if (H5F_arr_create(f, &(new_dset->layout)) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize storage");
@@ -1333,28 +1582,28 @@ printf("%s: check 2.0\n",FUNC);
printf("%s: check 3.0\n",FUNC);
#endif /* QAK */
/* Update external storage message */
- if (efl->nused>0) {
+ if (efl.nused>0) {
size_t heap_size = H5HL_ALIGN (1);
- for (i=0; i<efl->nused; i++) {
- heap_size += H5HL_ALIGN (HDstrlen (efl->slot[i].name)+1);
+ for (i=0; i<efl.nused; i++) {
+ heap_size += H5HL_ALIGN (HDstrlen (efl.slot[i].name)+1);
}
- if (H5HL_create (f, heap_size, &(efl->heap_addr)/*out*/)<0 ||
- (size_t)(-1)==H5HL_insert(f, efl->heap_addr, 1, "")) {
+ if (H5HL_create (f, heap_size, &(efl.heap_addr)/*out*/)<0 ||
+ (size_t)(-1)==H5HL_insert(f, efl.heap_addr, 1, "")) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to create external file list name heap");
}
- for (i=0; i<efl->nused; i++) {
- size_t offset = H5HL_insert(f, efl->heap_addr,
- HDstrlen(efl->slot[i].name)+1, efl->slot[i].name);
- assert(0==efl->slot[i].name_offset);
+ for (i=0; i<efl.nused; i++) {
+ size_t offset = H5HL_insert(f, efl.heap_addr,
+ HDstrlen(efl.slot[i].name)+1, efl.slot[i].name);
+ assert(0==efl.slot[i].name_offset);
if ((size_t)(-1)==offset) {
HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, NULL,
"unable to insert URL into name heap");
}
- efl->slot[i].name_offset = offset;
+ efl.slot[i].name_offset = offset;
}
- if (H5O_modify (&(new_dset->ent), H5O_EFL, 0, H5O_FLAG_CONSTANT, efl)<0) {
+ if (H5O_modify (&(new_dset->ent), H5O_EFL, 0, H5O_FLAG_CONSTANT, &efl)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update external file list message");
}
@@ -1379,10 +1628,6 @@ printf("%s: check 6.0\n",FUNC);
if (!ret_value && new_dset) {
if (new_dset->type)
H5T_close(new_dset->type);
- if (new_dset->create_parms) {
- H5P_close (new_dset->create_parms);
- new_dset->create_parms = NULL;
- }
if (H5F_addr_defined(new_dset->ent.header)) {
H5O_close(&(new_dset->ent));
}
@@ -1509,6 +1754,10 @@ done:
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to set property for generic property list.
+ *
*-------------------------------------------------------------------------
*/
H5D_t *
@@ -1517,6 +1766,11 @@ H5D_open_oid(H5G_entry_t *ent)
H5D_t *dataset = NULL; /*new dataset struct */
H5D_t *ret_value = NULL; /*return value */
H5S_t *space = NULL; /*data space */
+ H5O_fill_t fill={0};
+ H5O_pline_t pline={0};
+ H5O_efl_t efl={0};
+ H5D_layout_t layout;
+ int chunk_ndims;
unsigned u;
FUNC_ENTER(H5D_open_oid, NULL);
@@ -1525,9 +1779,9 @@ H5D_open_oid(H5G_entry_t *ent)
assert (ent);
/* Allocate the dataset structure */
- if (NULL==(dataset = H5D_new(NULL))) {
+ if(NULL==(dataset = H5D_new(H5P_DEFAULT))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
- "memory allocation failed");
+ "memory allocation failed");
}
/* Copy over the symbol table information if it's provided */
@@ -1549,24 +1803,24 @@ H5D_open_oid(H5G_entry_t *ent)
}
/* Get the optional fill value message */
- if (NULL==H5O_read(&(dataset->ent), H5O_FILL, 0,
- &(dataset->create_parms->fill))) {
+ if(NULL == H5O_read(&(dataset->ent), H5O_FILL, 0, &fill)) {
H5E_clear();
- HDmemset(&(dataset->create_parms->fill), 0,
- sizeof(dataset->create_parms->fill));
+ HDmemset(&fill, 0, sizeof(fill));
}
+ if(H5P_set(dataset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't set fill value");
/* Get the optional filters message */
- if (NULL==H5O_read (&(dataset->ent), H5O_PLINE, 0,
- &(dataset->create_parms->pline))) {
- H5E_clear ();
- HDmemset (&(dataset->create_parms->pline), 0,
- sizeof(dataset->create_parms->pline));
+ if(NULL == H5O_read(&(dataset->ent), H5O_PLINE, 0, &pline)) {
+ H5E_clear();
+ HDmemset(&pline, 0, sizeof(pline));
}
+ if(H5P_set(dataset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't set pipeline");
#ifdef H5_HAVE_PARALLEL
/* If MPIO is used, no filter support yet. */
- if (IS_H5FD_MPIO(dataset->ent.file) && dataset->create_parms->pline.nfilters>0) {
+ if(IS_H5FD_MPIO(dataset->ent.file) && pline.nfilters > 0) {
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
"Parallel IO does not support filters yet");
}
@@ -1584,7 +1838,10 @@ H5D_open_oid(H5G_entry_t *ent)
}
switch (dataset->layout.type) {
case H5D_CONTIGUOUS:
- dataset->create_parms->layout = H5D_CONTIGUOUS;
+ layout = H5D_CONTIGUOUS;
+ if(H5P_set(dataset->dcpl_id, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL,
+ "can't set layout");
break;
case H5D_CHUNKED:
@@ -1593,26 +1850,35 @@ H5D_open_oid(H5G_entry_t *ent)
* the chunk dimension because the chunk includes a dimension for the
* individual bytes of the data type.
*/
- dataset->create_parms->layout = H5D_CHUNKED;
- dataset->create_parms->chunk_ndims = dataset->layout.ndims - 1;
- for (u = 0; u < dataset->layout.ndims - 1; u++) {
- dataset->create_parms->chunk_size[u] = dataset->layout.dim[u];
- }
+ layout = H5D_CHUNKED;
+ chunk_ndims = dataset->layout.ndims - 1;
+
+ if(H5P_set(dataset->dcpl_id, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL,
+ "can't set layout");
+ if(H5P_set(dataset->dcpl_id, H5D_CRT_CHUNK_DIM_NAME, &chunk_ndims)
+ < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL,
+ "can't set chunk dimensions");
+ if(H5P_set(dataset->dcpl_id, H5D_CRT_CHUNK_SIZE_NAME,
+ dataset->layout.dim) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL,
+ "can't set chunk size");
break;
-
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL,
"not implemented yet");
}
/* Get the external file list message, which might not exist */
- if (NULL==H5O_read (&(dataset->ent), H5O_EFL, 0,
- &(dataset->create_parms->efl)) &&
- !H5F_addr_defined (dataset->layout.addr)) {
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
- "storage address is undefined an no external file list");
+ if( !H5F_addr_defined(dataset->layout.addr) ) {
+ if(NULL == H5O_read(&(dataset->ent), H5O_EFL, 0, &efl))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
+ "storage address is undefined and no external file list");
+ if(H5P_set(dataset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL,
+ "can't set external file list");
}
-
/*
* Make sure all storage is properly initialized for chunked datasets.
* This is especially important for parallel I/O where the B-tree must
@@ -1638,9 +1904,6 @@ done:
if (dataset->type) {
H5T_close(dataset->type);
}
- if (dataset->create_parms) {
- H5P_close (dataset->create_parms);
- }
dataset->ent.file = NULL;
H5FL_FREE(H5D_t,dataset);
}
@@ -1684,7 +1947,7 @@ H5D_close(H5D_t *dataset)
* can do if one of these fails, so we just continue.
*/
free_failed = (H5T_close(dataset->type) < 0 ||
- H5P_close(dataset->create_parms));
+ H5Pclose_list(dataset->dcpl_id) < 0);
/* Close the dataset object */
H5O_close(&(dataset->ent));
@@ -1740,6 +2003,9 @@ H5D_close(H5D_t *dataset)
* Albert Cheng, 2000-11-27
* Changed to use the optimized MPIO transfer for Collective calls only.
*
+ * Raymond Lu, 2001-10-2
+ * Changed the way to retrieve property for generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1775,6 +2041,10 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5S_DEBUG
H5_timer_t timer;
#endif
+ H5O_pline_t pline;
+ H5O_efl_t efl;
+ H5O_fill_t fill;
+
FUNC_ENTER(H5D_read, FAIL);
@@ -1877,12 +2147,15 @@ printf("%s: check 1.1, \n",FUNC);
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
- status = (sconv->read)(dataset->ent.file, &(dataset->layout),
- &(dataset->create_parms->pline),
- &(dataset->create_parms->efl),
- H5T_get_size (dataset->type), file_space,
- mem_space, dxpl_id, buf/*out*/,
- &must_convert);
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get pipeline");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ status = (sconv->read)(dataset->ent.file, &(dataset->layout), &pline,
+ &efl, H5T_get_size(dataset->type), file_space,
+ mem_space, dxpl_id, buf/*out*/, &must_convert);
+
if (status<0) {
/* Supports only no conversion, type or space, for now. */
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
@@ -1979,7 +2252,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
*/
if (tpath->cdata.need_bkg) {
/* Retrieve the bkgr buffer property */
- if(H5Pget(dxpl_id, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
+ if(H5P_get(dxpl_id, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type");
need_bkg = MAX(tpath->cdata.need_bkg, need_bkg);
} else {
@@ -2029,12 +2302,21 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
- n = (sconv->f->gath)(dataset->ent.file, &(dataset->layout),
- &(dataset->create_parms->pline),
- &(dataset->create_parms->fill),
- &(dataset->create_parms->efl), src_type_size,
- file_space, &file_iter, smine_nelmts,
- dxpl_id, tconv_buf/*out*/);
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't retrieve data pipeline");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't retrieve fill value");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't retrieve external file list");
+ n = (sconv->f->gath)(dataset->ent.file, &(dataset->layout), &pline,
+ &fill, &efl, src_type_size, file_space,
+ &file_iter, smine_nelmts, dxpl_id,
+ tconv_buf/*out*/);
+
+
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].gath_timer), &timer);
sconv->stats[1].gath_nbytes += n * src_type_size;
@@ -2202,6 +2484,9 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
* Albert Cheng, 2000-11-27
* Changed to use the optimized MPIO transfer for Collective calls only.
*
+ * Raymond Lu, 2001-10-2
+ * Changed the way to retrieve property for generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2237,6 +2522,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5S_DEBUG
H5_timer_t timer;
#endif
+ H5O_pline_t pline;
+ H5O_efl_t efl;
+ H5O_fill_t fill;
FUNC_ENTER(H5D_write, FAIL);
@@ -2373,11 +2661,14 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
- status = (sconv->write)(dataset->ent.file, &(dataset->layout),
- &(dataset->create_parms->pline),
- &(dataset->create_parms->efl),
- H5T_get_size (dataset->type), file_space,
- mem_space, dxpl_id, buf, &must_convert/*out*/);
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get pipeline");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ status = (sconv->write)(dataset->ent.file, &(dataset->layout), &pline,
+ &efl, H5T_get_size(dataset->type), file_space,
+ mem_space, dxpl_id, buf/*out*/, &must_convert);
if (status<0) {
/* Supports only no conversion, type or space, for now. */
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL,
@@ -2470,7 +2761,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
*/
if (tpath->cdata.need_bkg) {
/* Retrieve the bkgr buffer property */
- if(H5Pget(dxpl_id, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
+ if(H5P_get(dxpl_id, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type");
need_bkg = MAX (tpath->cdata.need_bkg, need_bkg);
} else {
@@ -2550,12 +2841,21 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
- n = (sconv->f->gath)(dataset->ent.file, &(dataset->layout),
- &(dataset->create_parms->pline),
- &(dataset->create_parms->fill),
- &(dataset->create_parms->efl), dst_type_size,
- file_space, &bkg_iter, smine_nelmts,
- dxpl_id, bkg_buf/*out*/);
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline)
+ < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get data pipeline");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get fill value");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ n = (sconv->f->gath)(dataset->ent.file, &(dataset->layout), &pline,
+ &fill, &efl, dst_type_size, file_space,
+ &bkg_iter, smine_nelmts, dxpl_id,
+ bkg_buf/*out*/);
+
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[0].bkg_timer), &timer);
sconv->stats[0].bkg_nbytes += n * dst_type_size;
@@ -2591,12 +2891,21 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
- status = (sconv->f->scat)(dataset->ent.file, &(dataset->layout),
- &(dataset->create_parms->pline),
- &(dataset->create_parms->fill),
- &(dataset->create_parms->efl), dst_type_size,
- file_space, &file_iter, smine_nelmts,
- dxpl_id, tconv_buf);
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline)
+ < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get data pipeline");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get fill value");
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ status = (sconv->f->scat)(dataset->ent.file, &(dataset->layout),
+ &pline, &fill, &efl, dst_type_size,
+ file_space, &file_iter, smine_nelmts,
+ dxpl_id, tconv_buf/*out*/);
+
#ifdef QAK
printf("%s: check 6.35\n",FUNC);
#endif
@@ -2670,6 +2979,11 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to retrieve property for generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2677,6 +2991,7 @@ H5D_extend (H5D_t *dataset, const hsize_t *size)
{
herr_t changed, ret_value=FAIL;
H5S_t *space = NULL;
+ H5O_fill_t fill;
FUNC_ENTER (H5D_extend, FAIL);
@@ -2721,11 +3036,12 @@ H5D_extend (H5D_t *dataset, const hsize_t *size)
* need it for contiguous datasets because the chunked datasets will
* either fill on demand during I/O or attempt a fill of all chunks.
*/
- if (H5D_CONTIGUOUS==dataset->layout.type &&
- dataset->create_parms->fill.buf) {
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
- "unable to select fill value region");
- }
+ if(H5P_get(dataset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get fill value");
+ if(H5D_CONTIGUOUS == dataset->layout.type && fill.buf)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
+ "unable to select fill value region");
#endif
if (H5D_init_storage(dataset, space)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
@@ -2832,22 +3148,39 @@ H5D_get_file (const H5D_t *dset)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to retrieve property for generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5D_init_storage(H5D_t *dset, const H5S_t *space)
{
- hssize_t npoints, ptsperbuf;
+ hssize_t npoints, ptsperbuf;
size_t bufsize=8*1024;
size_t size;
haddr_t addr;
herr_t ret_value = FAIL;
void *buf = NULL;
-
+ H5O_fill_t fill;
+ H5O_efl_t efl;
+ H5O_pline_t pline;
+
FUNC_ENTER(H5D_init_storage, FAIL);
assert(dset);
assert(space);
+ /* Get fill value, external file list, and data pipeline properties */
+ if(H5P_get(dset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value");
+ if(H5P_get(dset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ if(H5P_get(dset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline");
+
switch (dset->layout.type) {
case H5D_CONTIGUOUS:
/*
@@ -2856,16 +3189,15 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
* filling when the underlying storage isn't initialized to zero.
*/
npoints = H5S_get_simple_extent_npoints(space);
- if (dset->create_parms->fill.buf &&
- npoints==H5S_get_select_npoints(space)) {
+
+ if (fill.buf && npoints==H5S_get_select_npoints(space)) {
/*
* Fill the entire current extent with the fill value. We can do
* this quite efficiently by making sure we copy the fill value
* in relatively large pieces.
*/
- ptsperbuf = (hssize_t)MAX(1,
- bufsize/dset->create_parms->fill.size);
- bufsize = ptsperbuf * dset->create_parms->fill.size;
+ ptsperbuf = (hssize_t)MAX(1, bufsize/fill.size);
+ bufsize = ptsperbuf * fill.size;
/* Allocate temporary buffer */
if ((buf=H5FL_BLK_ALLOC(fill_conv,bufsize,0))==NULL)
@@ -2873,22 +3205,21 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
"memory allocation failed for fill buffer");
assert(ptsperbuf==(hssize_t)((size_t)ptsperbuf)); /*check for overflow*/
- H5V_array_fill(buf, dset->create_parms->fill.buf,
- dset->create_parms->fill.size, (size_t)ptsperbuf);
- if (dset->create_parms->efl.nused) {
+ H5V_array_fill(buf, fill.buf, fill.size, (size_t)ptsperbuf);
+ if (efl.nused) {
addr = 0;
} else {
addr = dset->layout.addr;
- }
-
+ }
+
while (npoints>0) {
- size = MIN(ptsperbuf, npoints) * dset->create_parms->fill.size;
- if (dset->create_parms->efl.nused) {
- if (H5O_efl_write(dset->ent.file,
- &(dset->create_parms->efl), addr, size, buf)<0) {
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
- "unable to write fill value to dataset");
- }
+ size = MIN(ptsperbuf, npoints) * fill.size;
+ if(efl.nused) {
+ if(H5O_efl_write(dset->ent.file, &efl, addr, size,
+ buf) < 0) {
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to write fill value to dataset");
+ }
} else {
if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, addr,
size, H5P_DATASET_XFER_DEFAULT, buf)<0) {
@@ -2899,7 +3230,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
npoints -= MIN(ptsperbuf, npoints);
addr += size;
}
- } else if (dset->create_parms->fill.buf) {
+ } else if(fill.buf) {
/*
* Fill the specified selection with the fill value.
*/
@@ -2926,13 +3257,12 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
dim[ndims] = dset->layout.dim[ndims];
ndims++;
- if (H5F_istore_allocate(dset->ent.file, H5P_DATASET_XFER_DEFAULT,
- &(dset->layout), dim,
- &(dset->create_parms->pline),
- &(dset->create_parms->fill))<0) {
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
- "unable to allocate all chunks of dataset");
- }
+ if (H5F_istore_allocate(dset->ent.file,
+ H5P_DATASET_XFER_DEFAULT, &(dset->layout), dim, &pline,
+ &fill)<0) {
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to allocate all chunks of dataset");
+ }
}
#endif /*H5_HAVE_PARALLEL*/
break;
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index dbe045c..a66db7b 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -41,17 +41,34 @@
/* Set the minimum object header size to create objects with */
#define H5D_MINHDR_SIZE 512
-/* Dataset creation property list */
-typedef struct H5D_create_t {
- H5D_layout_t layout; /*storage layout */
- int chunk_ndims; /*chunk dimensionality */
- hsize_t chunk_size[32]; /*chunk size if chunked storage */
- H5O_fill_t fill; /*fill value */
- H5O_efl_t efl; /*external file list */
- H5O_pline_t pline; /*data filter pipeline */
-} H5D_create_t;
+/* ======== Dataset creation properties ======== */
+/* Definitions for storage layout property */
+#define H5D_CRT_LAYOUT_NAME "layout"
+#define H5D_CRT_LAYOUT_SIZE sizeof(H5D_layout_t)
+#define H5D_CRT_LAYOUT_DEF H5D_CONTIGUOUS
+/* Definitions for chunk dimensionality property */
+#define H5D_CRT_CHUNK_DIM_NAME "chunk_ndims"
+#define H5D_CRT_CHUNK_DIM_SIZE sizeof(int)
+#define H5D_CRT_CHUNK_DIM_DEF 1
+/* Definitions for chunk size */
+#define H5D_CRT_CHUNK_SIZE_NAME "chunk_size"
+#define H5D_CRT_CHUNK_SIZE_SIZE sizeof(hsize_t[32])
+#define H5D_CRT_CHUNK_SIZE_DEF {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,\
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
+/* Definitions for fill value */
+#define H5D_CRT_FILL_VALUE_NAME "fill"
+#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t)
+#define H5D_CRT_FILL_VALUE_DEF {NULL, 0, NULL}
+/* Definitions for external file list */
+#define H5D_CRT_EXT_FILE_LIST_NAME "efl"
+#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t)
+#define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL}
+/* Definitions for data filter pipeline */
+#define H5D_CRT_DATA_PIPELINE_NAME "pline"
+#define H5D_CRT_DATA_PIPELINE_SIZE sizeof(H5O_pline_t)
+#define H5D_CRT_DATA_PIPELINE_DEF {0, 0, NULL}
-/* Data transfer properties */
+/* ======== Data transfer properties ======== */
/* Definitions for maximum temp buffer size property */
#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf"
#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
@@ -125,14 +142,11 @@ typedef struct H5D_create_t {
typedef struct H5D_t H5D_t;
-/* library variables */
-__DLLVAR__ const H5D_create_t H5D_create_dflt;
-
/* Functions defined in H5D.c */
__DLL__ herr_t H5D_init(void);
-__DLL__ H5D_t *H5D_create(H5G_entry_t *loc, const char *name,
- const H5T_t *type, const H5S_t *space,
- const H5D_create_t *create_parms);
+__DLL__ H5D_t *H5D_create(H5G_entry_t *loc, const char *name,
+ const H5T_t *type, const H5S_t *space,
+ hid_t dcpl_id);
__DLL__ H5D_t *H5D_open(H5G_entry_t *loc, const char *name);
__DLL__ herr_t H5D_close(H5D_t *dataset);
__DLL__ htri_t H5D_isa(H5G_entry_t *ent);
@@ -150,8 +164,14 @@ __DLL__ H5D_t * H5D_open_oid(H5G_entry_t *ent);
__DLL__ H5F_t * H5D_get_file(const H5D_t *dset);
__DLL__ hsize_t H5D_get_storage_size(H5D_t *dset);
__DLL__ void *H5D_vlen_get_buf_size_alloc(size_t size, void *info);
-__DLL__ herr_t H5D_vlen_get_buf_size(void *elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *op_data);
+__DLL__ herr_t H5D_vlen_get_buf_size(void *elem, hid_t type_id, hsize_t ndim,
+ hssize_t *point, void *op_data);
+__DLL__ herr_t H5D_crt_copy(hid_t new_plist_t, hid_t old_plist_t,
+ void *copy_data);
+__DLL__ herr_t H5D_crt_close(hid_t dxpl_id, void *close_data);
__DLL__ herr_t H5D_xfer_create(hid_t dxpl_id, void *create_data);
+__DLL__ herr_t H5D_xfer_copy(hid_t new_plist_id, hid_t old_plist_id,
+ void *copy_data);
__DLL__ herr_t H5D_xfer_close(hid_t dxpl_id, void *close_data);
#endif
diff --git a/src/H5P.c b/src/H5P.c
index 2372cc7..0524ac5 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -40,7 +40,6 @@ static herr_t H5P_init_interface(void);
hid_t H5P_NO_CLASS=(hid_t)H5P_NO_CLASS_OLD;
hid_t H5P_FILE_CREATE=(hid_t)H5P_FILE_CREATE_OLD;
hid_t H5P_FILE_ACCESS=(hid_t)H5P_FILE_ACCESS_OLD;
-hid_t H5P_DATASET_CREATE=(hid_t)H5P_DATASET_CREATE_OLD;
hid_t H5P_MOUNT=(hid_t)H5P_MOUNT_OLD;
/*
@@ -234,7 +233,7 @@ H5P_init_interface(void)
/* Register the dataset creation and data xfer property classes */
/* Allocate the dataset creation class */
- if (NULL==(pclass = H5P_create_class (root_class,"dataset create",H5P_DATASET_CREATE_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ if (NULL==(pclass = H5P_create_class (root_class,"dataset create",H5P_DATASET_CREATE_HASH_SIZE,1,NULL,NULL,H5D_crt_copy,NULL,H5D_crt_close,NULL)))
HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
/* Register the dataset creation class */
@@ -242,7 +241,7 @@ H5P_init_interface(void)
HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
/* Allocate the data xfer class */
- if (NULL==(pclass = H5P_create_class (root_class,"data xfer",H5P_DATASET_XFER_HASH_SIZE,1,H5D_xfer_create,NULL,H5D_xfer_create,NULL,H5D_xfer_close,NULL)))
+ if (NULL==(pclass = H5P_create_class (root_class,"data xfer",H5P_DATASET_XFER_HASH_SIZE,1,H5D_xfer_create,NULL,H5D_xfer_copy,NULL,H5D_xfer_close,NULL)))
HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
/* Register the data xfer class */
@@ -347,7 +346,6 @@ H5Pcreate(hid_t type)
old_type=(H5P_class_t_old)type;
assert( old_type==H5P_FILE_CREATE_OLD ||
old_type==H5P_FILE_ACCESS_OLD ||
- old_type==H5P_DATASET_CREATE_OLD ||
old_type==H5P_MOUNT_OLD);
/* Allocate a new property list and initialize it with default values */
@@ -358,9 +356,6 @@ assert( old_type==H5P_FILE_CREATE_OLD ||
case H5P_FILE_ACCESS_OLD:
src = &H5F_access_dflt;
break;
- case H5P_DATASET_CREATE_OLD:
- src = &H5D_create_dflt;
- break;
case H5P_MOUNT_OLD:
src = &H5F_mount_dflt;
break;
@@ -487,6 +482,10 @@ H5Pclose(hid_t plist_id)
* Modifications:
* Robb Matzke, 1999-08-03
* Modified to work with the virtual file layer.
+ *
+ * Raymond Lu, 2001-10-02
+ * Took out case H5P_DATASET_CREATE for generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -494,7 +493,6 @@ H5P_close(void *_plist)
{
H5P_t *plist=(H5P_t *)_plist;
H5F_access_t *fa_list = &(plist->u.faccess);
- H5D_create_t *dc_list = &(plist->u.dcreate);
FUNC_ENTER (H5P_close, FAIL);
@@ -516,12 +514,6 @@ H5P_close(void *_plist)
case H5P_FILE_CREATE_OLD:
break;
- case H5P_DATASET_CREATE_OLD:
- H5O_reset(H5O_FILL, &(dc_list->fill));
- H5O_reset(H5O_EFL, &(dc_list->efl));
- H5O_reset(H5O_PLINE, &(dc_list->pline));
- break;
-
case H5P_MOUNT_OLD:
break;
@@ -690,8 +682,9 @@ done:
PURPOSE
Internal routine to copy a generic property lists
USAGE
- hid_t H5P_copy_plist(plist)
- H5P_genplist_t *plist; IN: Property list to copy
+ hid_t H5P_copy_plist(old_plist, old_plist_id)
+ H5P_genplist_t *old_plist; IN: Property list to copy
+ hid_t old_plist_id; IN: Property list ID to copy
RETURNS
Success: valid property list ID on success (non-negative)
Failure: negative
@@ -705,35 +698,35 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hid_t H5P_copy_plist(H5P_genplist_t *plist)
+static hid_t H5P_copy_plist(H5P_genplist_t *old_plist, hid_t old_plist_id)
{
H5P_genplist_t *new_plist; /* New property list generated from copy */
H5P_genprop_t *tprop; /* Temporary pointer to properties */
H5P_genprop_t *new_prop; /* New property created for copy */
- hid_t plist_id; /* Property list ID of new list created */
- unsigned u; /* Local index variable */
+ hid_t new_plist_id; /* Property list ID of new list created */
+ unsigned u; /* Local index variable */
hid_t ret_value=FAIL; /* return value */
-
+
FUNC_ENTER (H5P_copy_plist, FAIL);
- assert(plist);
+ assert(old_plist);
/*
* Create new property list object
*/
/* Allocate room for the property list & it's hash table of properties */
- if (NULL==(new_plist = H5MM_calloc (sizeof(H5P_genplist_t)+((plist->pclass->hashsize-1)*sizeof(H5P_genprop_t *)))))
+ if (NULL==(new_plist = H5MM_calloc (sizeof(H5P_genplist_t)+((old_plist->pclass->hashsize-1)*sizeof(H5P_genprop_t *)))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,"memory allocation failed");
/* Set class state */
- new_plist->pclass = plist->pclass;
+ new_plist->pclass = old_plist->pclass;
new_plist->nprops = 0; /* Initially the plist has the same number of properties as the class */
new_plist->class_init = 0; /* Initially, wait until the class callback finishes to set */
/* Cycle through the properties and copy them also */
- for(u=0; u<plist->pclass->hashsize; u++) {
- tprop=plist->props[u];
+ for(u=0; u<old_plist->pclass->hashsize; u++) {
+ tprop=old_plist->props[u];
/* Walk through the list of properties at each hash location */
while(tprop!=NULL) {
@@ -766,14 +759,14 @@ static hid_t H5P_copy_plist(H5P_genplist_t *plist)
HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ref count");
/* Get an atom for the property list */
- if ((plist_id = H5I_register(H5I_GENPROP_LST, new_plist))<0)
+ if ((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list");
/* Call the class callback (if it exists) now that we have the property list ID */
if(new_plist->pclass->copy_func!=NULL) {
- if((new_plist->pclass->copy_func)(plist_id,plist->pclass->copy_data)<0) {
+ if((new_plist->pclass->copy_func)(new_plist_id,old_plist_id,old_plist->pclass->copy_data)<0) {
/* Delete ID, ignore return value */
- H5I_remove(plist_id);
+ H5I_remove(new_plist_id);
HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property");
} /* end if */
} /* end if */
@@ -782,7 +775,7 @@ static hid_t H5P_copy_plist(H5P_genplist_t *plist)
new_plist->class_init=1;
/* Set the return value */
- ret_value=plist_id;
+ ret_value=new_plist_id;
done:
if (ret_value<0 && new_plist)
@@ -813,7 +806,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hid_t H5P_copy_new(hid_t id)
+hid_t H5P_copy_new(hid_t id)
{
void *obj; /* Property object to copy */
hid_t ret_value=FALSE; /* return value */
@@ -828,7 +821,7 @@ static hid_t H5P_copy_new(hid_t id)
/* Compare property lists */
if(H5I_GENPROP_LST == H5I_get_type(id)) {
- if((ret_value=H5P_copy_plist(obj))<0)
+ if((ret_value=H5P_copy_plist(obj, id))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list");
} /* end if */
/* Must be property classes */
@@ -931,6 +924,10 @@ H5Pcopy(hid_t plist_id)
* Modifications:
* Robb Matzke, 1999-08-03
* Modified to use the virtual file layer.
+ *
+ * Raymond Lu, 2001-10-02
+ * Took out case H5P_DATASET_CREATE for generic property list.
+ *
*-------------------------------------------------------------------------
*/
void *
@@ -938,8 +935,6 @@ H5P_copy (H5P_class_t_old type, const void *src)
{
size_t size;
H5P_t *dst = NULL;
- const H5D_create_t *dc_src = NULL;
- H5D_create_t *dc_dst = NULL;
H5F_access_t *fa_dst = NULL;
FUNC_ENTER (H5P_copy, NULL);
@@ -954,10 +949,6 @@ H5P_copy (H5P_class_t_old type, const void *src)
size = sizeof(H5F_access_t);
break;
- case H5P_DATASET_CREATE_OLD:
- size = sizeof(H5D_create_t);
- break;
-
case H5P_MOUNT_OLD:
size = sizeof(H5F_mprop_t);
break;
@@ -994,30 +985,6 @@ H5P_copy (H5P_class_t_old type, const void *src)
}
break;
- case H5P_DATASET_CREATE_OLD:
- dc_src = (const H5D_create_t*)src;
- dc_dst = (H5D_create_t*)dst;
-
- /* Copy the fill value */
- if (NULL==H5O_copy(H5O_FILL, &(dc_src->fill), &(dc_dst->fill))) {
- HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,
- "unabe to copy fill value message");
- }
-
- /* Copy the external file list */
- HDmemset(&(dc_dst->efl), 0, sizeof(dc_dst->efl));
- if (NULL==H5O_copy(H5O_EFL, &(dc_src->efl), &(dc_dst->efl))) {
- HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,
- "unable to copy external file list message");
- }
-
- /* Copy the filter pipeline */
- if (NULL==H5O_copy(H5O_PLINE, &(dc_src->pline), &(dc_dst->pline))) {
- HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,
- "unable to copy filter pipeline message");
- }
- break;
-
case H5P_MOUNT_OLD:
/* Nothing to do */
break;
@@ -1552,19 +1519,21 @@ H5Pget_istore_k(hid_t plist_id, int *ik /*out */ )
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_layout(hid_t plist_id, H5D_layout_t layout)
{
- H5D_create_t *plist = NULL;
-
FUNC_ENTER(H5Pset_layout, FAIL);
H5TRACE2("e","iDl",plist_id,layout);
/* Check arguments */
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (plist = H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
}
@@ -1574,7 +1543,8 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout)
}
/* Set value */
- plist->layout = layout;
+ if(H5P_set(plist_id, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
FUNC_LEAVE(SUCCEED);
}
@@ -1593,24 +1563,30 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and get property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
H5D_layout_t
H5Pget_layout(hid_t plist_id)
{
- H5D_create_t *plist = NULL;
+ H5D_layout_t layout;
FUNC_ENTER(H5Pget_layout, H5D_LAYOUT_ERROR);
H5TRACE1("Dl","i",plist_id);
/* Check arguments */
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (plist = H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5D_LAYOUT_ERROR,
"not a dataset creation property list");
- }
- FUNC_LEAVE(plist->layout);
+ if(H5P_get(plist_id, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR,
+ "can't get layout");
+ FUNC_LEAVE(layout);
}
/*-------------------------------------------------------------------------
@@ -1630,23 +1606,27 @@ H5Pget_layout(hid_t plist_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
{
int i;
- H5D_create_t *plist = NULL;
+ H5D_layout_t layout;
FUNC_ENTER(H5Pset_chunk, FAIL);
H5TRACE3("e","iIs*[a1]h",plist_id,ndims,dim);
/* Check arguments */
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (plist = H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
+
if (ndims <= 0) {
HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
"chunk dimensionality must be positive");
@@ -1666,11 +1646,14 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
}
}
- /* Set value */
- plist->layout = H5D_CHUNKED;
- plist->chunk_ndims = ndims;
- for (i = 0; i < ndims; i++)
- plist->chunk_size[i] = dim[i];
+ layout = H5D_CHUNKED;
+ if(H5P_set(plist_id, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
+ if(H5P_set(plist_id, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,
+ "can't set chunk dimensionanlity");
+ if(H5P_set(plist_id, H5D_CRT_CHUNK_SIZE_NAME, (void*)dim) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set chunk size");
FUNC_LEAVE(SUCCEED);
}
@@ -1692,32 +1675,45 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
int
H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
{
int i;
- H5D_create_t *plist = NULL;
+ int ndims;
+ H5D_layout_t layout;
+ hsize_t chunk_size[32];
FUNC_ENTER(H5Pget_chunk, FAIL);
H5TRACE3("Is","iIsx",plist_id,max_ndims,dim);
/* Check arguments */
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (plist = H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
- if (H5D_CHUNKED != plist->layout) {
+
+ if(H5P_get(plist_id, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout");
+ if(H5D_CHUNKED != layout)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "not a chunked storage layout");
- }
+ "not a chunked storage layout");
+
+ if(H5P_get(plist_id, H5D_CRT_CHUNK_SIZE_NAME, chunk_size) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk size");
+ if(H5P_get(plist_id, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get chunk dimensionality");
- for (i=0; i<plist->chunk_ndims && i<max_ndims && dim; i++)
- dim[i] = plist->chunk_size[i];
+ for (i=0; i<ndims && i<max_ndims && dim; i++)
+ dim[i] = chunk_size[i];
- FUNC_LEAVE(plist->chunk_ndims);
+ FUNC_LEAVE(ndims);
}
@@ -1744,6 +1740,11 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1751,17 +1752,16 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
{
int idx;
size_t total, tmp;
- H5D_create_t *plist = NULL;
+ H5O_efl_t efl;
FUNC_ENTER(H5Pset_external, FAIL);
H5TRACE4("e","isoh",plist_id,name,offset,size);
/* Check arguments */
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (plist = H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
+
if (!name || !*name) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
}
@@ -1772,40 +1772,47 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
if (size<=0) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "zero size");
}
- if (plist->efl.nused>0 &&
- H5O_EFL_UNLIMITED==plist->efl.slot[plist->efl.nused-1].size) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
- "previous file size is unlimited");
- }
+ if(H5P_get(plist_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get external file list");
+ if(efl.nused > 0 && H5O_EFL_UNLIMITED==efl.slot[efl.nused-1].size)
+ HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "previous file size is unlimited");
+
if (H5O_EFL_UNLIMITED!=size) {
- for (idx=0, total=size; idx<plist->efl.nused; idx++, total=tmp) {
- tmp = total + plist->efl.slot[idx].size;
+ for (idx=0, total=size; idx<efl.nused; idx++, total=tmp) {
+ tmp = total + efl.slot[idx].size;
if (tmp <= total) {
HRETURN_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL,
- "total external data size overflowed");
+ "total external data size overflowed");
}
}
}
+
/* Add to the list */
- if (plist->efl.nused>=plist->efl.nalloc) {
- int na = plist->efl.nalloc + H5O_EFL_ALLOC;
- H5O_efl_entry_t *x = H5MM_realloc (plist->efl.slot,
+ if (efl.nused >= efl.nalloc) {
+ int na = efl.nalloc + H5O_EFL_ALLOC;
+ H5O_efl_entry_t *x = H5MM_realloc (efl.slot,
na*sizeof(H5O_efl_entry_t));
if (!x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed");
+ "memory allocation failed");
}
- plist->efl.nalloc = na;
- plist->efl.slot = x;
+ efl.nalloc = na;
+ efl.slot = x;
}
- idx = plist->efl.nused;
- plist->efl.slot[idx].name_offset = 0; /*not entered into heap yet*/
- plist->efl.slot[idx].name = H5MM_xstrdup (name);
- plist->efl.slot[idx].offset = offset;
- plist->efl.slot[idx].size = size;
- plist->efl.nused++;
+ idx = efl.nused;
+ efl.slot[idx].name_offset = 0; /*not entered into heap yet*/
+ efl.slot[idx].name = H5MM_xstrdup (name);
+ efl.slot[idx].offset = offset;
+ efl.slot[idx].size = size;
+ efl.nused++;
+
+ if(H5P_set(plist_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,
+ "can't set external file list");
FUNC_LEAVE(SUCCEED);
}
@@ -1825,25 +1832,32 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
int
H5Pget_external_count(hid_t plist_id)
{
- H5D_create_t *plist = NULL;
-
+ H5O_efl_t efl;
+
FUNC_ENTER (H5Pget_external_count, FAIL);
H5TRACE1("Is","i",plist_id);
/* Check arguments */
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (plist = H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
+ if(H5P_get(plist_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get external file list");
+
/* Return */
- FUNC_LEAVE (plist->efl.nused);
+ FUNC_LEAVE (efl.nused);
}
@@ -1871,35 +1885,43 @@ H5Pget_external_count(hid_t plist_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and get property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
off_t *offset/*out*/, hsize_t *size/*out*/)
{
- H5D_create_t *plist = NULL;
-
+ H5O_efl_t efl;
+
FUNC_ENTER (H5Pget_external, FAIL);
H5TRACE6("e","iIszxxx",plist_id,idx,name_size,name,offset,size);
/* Check arguments */
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (plist = H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
- if (idx<0 || idx>=plist->efl.nused) {
+
+ if(H5P_get(plist_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get external file list");
+
+ if (idx<0 || idx>=efl.nused) {
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL,
"external file index is out of range");
}
/* Return values */
if (name_size>0 && name)
- HDstrncpy (name, plist->efl.slot[idx].name, name_size);
+ HDstrncpy (name, efl.slot[idx].name, name_size);
if (offset)
- *offset = plist->efl.slot[idx].offset;
+ *offset = efl.slot[idx].offset;
if (size)
- *size = plist->efl.slot[idx].size;
+ *size = efl.slot[idx].size;
FUNC_LEAVE (SUCCEED);
}
@@ -2548,27 +2570,30 @@ H5Pget_preserve(hid_t plist_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
{
- H5D_create_t *plist = NULL;
-
+ H5O_pline_t pline;
+
FUNC_ENTER (H5Pset_filter, FAIL);
H5TRACE5("e","iZfIuz*[a3]Iu",plist_id,filter,flags,cd_nelmts,cd_values);
/* Check arguments */
- if (H5P_DATASET_XFER==H5P_get_class(plist_id)) {
- HRETURN_ERROR(H5E_PLINE, H5E_UNSUPPORTED, FAIL,
- "transient pipelines are not supported yet");
- }
- if (H5P_DATASET_CREATE!=H5P_get_class (plist_id) ||
- NULL==(plist=H5I_object (plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
+
+ if(H5P_get(plist_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+
if (filter<0 || filter>H5Z_FILTER_MAX) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"invalid filter identifier");
@@ -2583,10 +2608,11 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
}
/* Do it */
- if (H5Z_append(&(plist->pline), filter, flags, cd_nelmts, cd_values)<0) {
- HRETURN_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL,
- "unable to add filter to pipeline");
- }
+ if(H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0)
+ HRETURN_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL,
+ "unable to add filter to pipeline");
+ if(H5P_set(plist_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline");
FUNC_LEAVE (SUCCEED);
}
@@ -2619,22 +2645,19 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
int
H5Pget_nfilters(hid_t plist_id)
{
- H5D_create_t *plist = NULL;
-
+ H5O_pline_t pline;
+
FUNC_ENTER(H5Pget_nfilters, FAIL);
H5TRACE1("Is","i",plist_id);
- if (H5P_DATASET_XFER==H5P_get_class(plist_id)) {
- HRETURN_ERROR(H5E_PLINE, H5E_UNSUPPORTED, FAIL,
- "transient pipelines are not supported yet");
- }
- if (H5P_DATASET_CREATE!=H5P_get_class(plist_id) ||
- NULL==(plist=H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
+
+ if(H5P_get(plist_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
- FUNC_LEAVE((int)(plist->pline.nfilters));
+ FUNC_LEAVE((int)(pline.nfilters));
}
@@ -2661,6 +2684,11 @@ H5Pget_nfilters(hid_t plist_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check paramter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
H5Z_filter_t
@@ -2668,7 +2696,7 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
size_t namelen, char name[]/*out*/)
{
- H5D_create_t *plist = NULL;
+ H5O_pline_t pline;
size_t i;
FUNC_ENTER (H5Pget_filter, H5Z_FILTER_ERROR);
@@ -2676,16 +2704,14 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
name);
/* Check arguments */
- if (H5P_DATASET_XFER==H5P_get_class(plist_id)) {
- HRETURN_ERROR(H5E_PLINE, H5E_UNSUPPORTED, H5Z_FILTER_ERROR,
- "transient filters are not supported yet");
- }
- if (H5P_DATASET_CREATE!=H5P_get_class (plist_id) ||
- NULL==(plist=H5I_object (plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, H5Z_FILTER_ERROR,
"not a dataset creation property list");
- }
- if (idx<0 || (size_t)idx>=plist->pline.nfilters) {
+
+ if(H5P_get(plist_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+
+ if (idx<0 || (size_t)idx>=pline.nfilters) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR,
"filter number is invalid");
}
@@ -2713,21 +2739,20 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
cd_values = NULL;
}
- /* Output values */
if (flags)
- *flags = plist->pline.filter[idx].flags;
+ *flags = pline.filter[idx].flags;
if (cd_values) {
- for (i=0; i<plist->pline.filter[idx].cd_nelmts && i<*cd_nelmts; i++) {
- cd_values[i] = plist->pline.filter[idx].cd_values[i];
+ for (i=0; i<pline.filter[idx].cd_nelmts && i<*cd_nelmts; i++) {
+ cd_values[i] = pline.filter[idx].cd_values[i];
}
}
if (cd_nelmts)
- *cd_nelmts = plist->pline.filter[idx].cd_nelmts;
+ *cd_nelmts = pline.filter[idx].cd_nelmts;
if (namelen>0 && name) {
- const char *s = plist->pline.filter[idx].name;
+ const char *s = pline.filter[idx].name;
if (!s) {
- H5Z_class_t *cls = H5Z_find(plist->pline.filter[idx].id);
+ H5Z_class_t *cls = H5Z_find(pline.filter[idx].id);
if (cls)
s = cls->name;
@@ -2738,7 +2763,7 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
name[0] = '\0';
}
- FUNC_LEAVE (plist->pline.filter[idx].id);
+ FUNC_LEAVE (pline.filter[idx].id);
}
@@ -2760,37 +2785,41 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_deflate(hid_t plist_id, unsigned level)
{
- H5D_create_t *plist = NULL;
+ H5O_pline_t pline;
FUNC_ENTER (H5Pset_deflate, FAIL);
H5TRACE2("e","iIu",plist_id,level);
/* Check arguments */
- if (H5P_DATASET_XFER==H5P_get_class(plist_id)) {
- HRETURN_ERROR(H5E_PLINE, H5E_UNSUPPORTED, FAIL,
- "transient filter pipelines are not supported yet");
- }
- if (H5P_DATASET_CREATE!=H5P_get_class (plist_id) ||
- NULL==(plist=H5I_object (plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
+
if (level>9) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"invalid deflate level");
}
/* Add the filter */
- if (H5Z_append(&(plist->pline), H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL,
+ if(H5P_get(plist_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ if (H5Z_append(&pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL,
1, &level)<0) {
HRETURN_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL,
- "unable to add deflate filter to pipeline");
+ "unable to add deflate filter to pipeline");
}
+ if(H5P_set(plist_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HRETURN_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
FUNC_LEAVE (SUCCEED);
}
@@ -2911,23 +2940,30 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
{
- H5D_create_t *plist = NULL;
+ H5O_fill_t fill;
H5T_t *type = NULL;
FUNC_ENTER(H5Pset_fill_value, FAIL);
H5TRACE3("e","iix",plist_id,type_id,value);
/* Check arguments */
- if (H5P_DATASET_CREATE!=H5P_get_class(plist_id) ||
- NULL==(plist=H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
- }
+
+ if(H5P_get(plist_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+
if (H5I_DATATYPE!=H5I_get_type(type_id) ||
NULL==(type=H5I_object(type_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
@@ -2937,17 +2973,20 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
}
/* Set the fill value */
- H5O_reset(H5O_FILL, &(plist->fill));
- if (NULL==(plist->fill.type=H5T_copy(type, H5T_COPY_TRANSIENT))) {
+ H5O_reset(H5O_FILL, &fill);
+ if (NULL==(fill.type=H5T_copy(type, H5T_COPY_TRANSIENT))) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to copy data type");
}
- plist->fill.size = H5T_get_size(type);
- if (NULL==(plist->fill.buf=H5MM_malloc(plist->fill.size))) {
+ fill.size = H5T_get_size(type);
+ if (NULL==(fill.buf=H5MM_malloc(fill.size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL,
"memory allocation failed for fill value");
}
- HDmemcpy(plist->fill.buf, value, plist->fill.size);
+ HDmemcpy(fill.buf, value, fill.size);
+
+ if(H5P_set(plist_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value");
FUNC_LEAVE(SUCCEED);
}
@@ -2969,12 +3008,17 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and get property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
{
- H5D_create_t *plist = NULL; /*property list */
+ H5O_fill_t fill;
H5T_t *type = NULL; /*data type */
H5T_path_t *tpath = NULL; /*type conversion info */
void *buf = NULL; /*conversion buffer */
@@ -2986,11 +3030,10 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
H5TRACE3("e","iix",plist_id,type_id,value);
/* Check arguments */
- if (H5P_DATASET_CREATE!=H5P_get_class(plist_id) ||
- NULL==(plist=H5I_object(plist_id))) {
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation proprety list");
- }
+
if (H5I_DATATYPE!=H5I_get_type(type_id) ||
NULL==(type=H5I_object(type_id))) {
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
@@ -3005,19 +3048,21 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
* return zero because we don't know the data type of the dataset and
* data type conversion might not have resulted in zero.
*/
- if (NULL==plist->fill.buf) {
+ if(H5P_get(plist_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+ if(NULL == fill.buf) {
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no fill value defined");
}
/*
* Can we convert between the source and destination data types?
*/
- if (NULL==(tpath=H5T_path_find(plist->fill.type, type, NULL, NULL))) {
+ if(NULL==(tpath=H5T_path_find(fill.type, type, NULL, NULL))) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to convert between src and dst data types");
}
src_id = H5I_register(H5I_DATATYPE,
- H5T_copy (plist->fill.type, H5T_COPY_TRANSIENT));
+ H5T_copy (fill.type, H5T_COPY_TRANSIENT));
if (src_id<0) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to copy/register data type");
@@ -3028,7 +3073,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
* other than the fill value buffer that is large enough for both source
* and destination. The app-supplied buffer might do okay.
*/
- if (H5T_get_size(type)>=H5T_get_size(plist->fill.type)) {
+ if (H5T_get_size(type)>=H5T_get_size(fill.type)) {
buf = value;
if (tpath->cdata.need_bkg>=H5T_BKG_TEMP &&
NULL==(bkg=H5MM_malloc(H5T_get_size(type)))) {
@@ -3036,14 +3081,14 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
"memory allocation failed for type conversion");
}
} else {
- if (NULL==(buf=H5MM_malloc(H5T_get_size(plist->fill.type)))) {
+ if (NULL==(buf=H5MM_malloc(H5T_get_size(fill.type)))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for type conversion");
}
if (tpath->cdata.need_bkg>=H5T_BKG_TEMP)
bkg = value;
}
- HDmemcpy(buf, plist->fill.buf, H5T_get_size(plist->fill.type));
+ HDmemcpy(buf, fill.buf, H5T_get_size(fill.type));
/* Do the conversion */
if (H5T_convert(tpath, src_id, type_id, (hsize_t)1, 0, 0, buf, bkg, H5P_DEFAULT)<0) {
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 61916f1..f17b14b 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -95,7 +95,6 @@ typedef struct {
union {
H5F_create_t fcreate; /* File creation properties */
H5F_access_t faccess; /* File access properties */
- H5D_create_t dcreate; /* Dataset creation properties */
H5F_mprop_t mount; /* Mounting properties */
} u;
H5P_class_t_old cls; /* Property list class */
@@ -105,6 +104,7 @@ typedef struct {
__DLL__ herr_t H5P_init(void);
__DLL__ hid_t H5P_create(H5P_class_t_old type, H5P_t *plist);
__DLL__ void *H5P_copy(H5P_class_t_old type, const void *src);
+__DLL__ hid_t H5P_copy_new(hid_t id);
__DLL__ herr_t H5P_close(void *plist);
__DLL__ herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size,
void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index fec9801..e21368e 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -41,8 +41,7 @@ typedef enum H5P_class_t_old {
H5P_NO_CLASS_OLD = -1, /*error return value */
H5P_FILE_CREATE_OLD = 0, /*file creation properties */
H5P_FILE_ACCESS_OLD = 1, /*file access properties */
- H5P_DATASET_CREATE_OLD= 2, /*dataset creation properties */
- H5P_MOUNT_OLD = 3, /*file mounting properties */
+ H5P_MOUNT_OLD = 2, /*file mounting properties */
H5P_NCLASSES_OLD /*this must be last! */
} H5P_class_t_old;
@@ -59,7 +58,6 @@ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */
__DLLVAR__ hid_t H5P_NO_CLASS;
__DLLVAR__ hid_t H5P_FILE_CREATE;
__DLLVAR__ hid_t H5P_FILE_ACCESS;
-__DLLVAR__ hid_t H5P_DATASET_CREATE;
__DLLVAR__ hid_t H5P_MOUNT;
/* H5P_DATASET_XFER was the name from the beginning through 1.2. It was
@@ -72,7 +70,8 @@ __DLLVAR__ hid_t H5P_MOUNT;
/* Define property list class callback function pointer types */
typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
-typedef herr_t (*H5P_cls_copy_func_t)(hid_t prop_id, void *copy_data);
+typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id,
+ void *copy_data);
typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data);
/* Define property list callback function pointer types */
@@ -99,7 +98,7 @@ extern "C" {
#define H5P_FILE_CREATE_HASH_SIZE 17
#define H5P_FILE_ACCESS_NEW (H5open(), H5P_CLS_FILE_ACCESS_g)
#define H5P_FILE_ACCESS_HASH_SIZE 17
-#define H5P_DATASET_CREATE_NEW (H5open(), H5P_CLS_DATASET_CREATE_g)
+#define H5P_DATASET_CREATE (H5open(), H5P_CLS_DATASET_CREATE_g)
#define H5P_DATASET_CREATE_HASH_SIZE 17
#define H5P_DATASET_XFER (H5open(), H5P_CLS_DATASET_XFER_g)
#define H5P_DATASET_XFER_HASH_SIZE 17
diff --git a/test/dsets.c b/test/dsets.c
index 6716e02..1c2956a 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -388,7 +388,7 @@ test_compression(hid_t file)
if (H5Pset_buffer (xfer, 1000, tconv_buf, NULL)<0) goto error;
/* Use chunked storage with compression */
- if ((dc = H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error;
if (H5Pset_deflate (dc, 6)<0) goto error;
@@ -678,7 +678,7 @@ test_multiopen (hid_t file)
TESTING("multi-open with extending");
/* Create the dataset and open it twice */
- if ((dcpl=H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_chunk (dcpl, 1, cur_size)<0) goto error;
if ((space=H5Screate_simple (1, cur_size, max_size))<0) goto error;
if ((dset1=H5Dcreate (file, "multiopen", H5T_NATIVE_INT, space,
diff --git a/test/extend.c b/test/extend.c
index 9ae8489..128985f 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -69,7 +69,7 @@ main (void)
}
/* Create the dataset which is originally NX by NY */
- if ((cparms = H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_chunk (cparms, 2, chunk_dims)<0) goto error;
if ((dataset = H5Dcreate (file, "dataset", H5T_NATIVE_INT, mem_space,
cparms))<0) goto error;
diff --git a/test/external.c b/test/external.c
index e9766a4..ce1afe0 100644
--- a/test/external.c
+++ b/test/external.c
@@ -96,7 +96,7 @@ test_1a(hid_t file)
TESTING("fixed-size data space, exact storage");
/* Create the dataset */
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = max_size[0] = 100;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)))<0) goto error;
@@ -175,7 +175,7 @@ test_1b(hid_t file)
hsize_t max_size[1]; /*maximum data space size */
TESTING("external storage is too small");
- if ((dcpl = H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = max_size[0] = 100;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)-1))<0) goto error;
@@ -231,7 +231,7 @@ test_1c(hid_t file)
hsize_t max_size[1]; /*maximum data space size */
TESTING("extendible dataspace, exact external size");
- if ((dcpl=H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = 100;
max_size[0] = 200;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
@@ -282,7 +282,7 @@ test_1d(hid_t file)
hsize_t max_size[1]; /*maximum data space size */
TESTING("extendible dataspace, external storage is too small");
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = 100;
max_size[0] = 200;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
@@ -344,7 +344,7 @@ test_1e(hid_t file)
TESTING("unlimited dataspace, unlimited external storage");
/* Create dataset */
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED)<0) goto error;
cur_size[0] = 100;
max_size[0] = H5S_UNLIMITED;
@@ -421,7 +421,7 @@ test_1f(hid_t file)
hsize_t max_size[1]; /*data space maximum size */
TESTING("multiple external files");
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = max_size[0] = 100;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4))<0) goto error;
@@ -527,7 +527,7 @@ test_1h(void)
herr_t status; /*return status */
TESTING("address overflow in external files");
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1)<0) goto error;
H5E_BEGIN_TRY {
status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100);
@@ -616,7 +616,7 @@ test_2 (hid_t fapl)
if (H5Gclose(grp)<0) goto error;
/* Create the dataset */
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external (dcpl, "extern_1a.raw", (off_t)0, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_2a.raw", (off_t)10, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_3a.raw", (off_t)20, (hsize_t)sizeof part)<0 ||
@@ -720,7 +720,7 @@ test_3 (hid_t fapl)
}
/* Create the external file list */
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external(dcpl, "extern_1b.raw", (off_t)0, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_2b.raw", (off_t)10, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_3b.raw", (off_t)20, (hsize_t)sizeof part)<0 ||
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 1a0b75f..ae906b2 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -380,6 +380,19 @@ test_genprop_cls_cb1(hid_t list_id, void *create_data)
return(SUCCEED);
}
+static herr_t
+test_genprop_cls_cb2(hid_t new_list_id, hid_t old_list_id, void *create_data)
+{
+ struct { /* Struct for iterations */
+ int count;
+ hid_t id;
+ } *count_struct=create_data;
+
+ count_struct->count++;
+ count_struct->id=new_list_id;
+
+ return(SUCCEED);
+}
/****************************************************************
**
** test_genprop_class_callback(): Test basic generic property list code.
@@ -998,7 +1011,7 @@ test_genprop_list_callback(void)
MESSAGE(5, ("Testing Basic Generic Property List Property Callback Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,test_genprop_cls_cb1,&cop_cb_struct,NULL,NULL);
+ cid1 = H5Pcreate_class(H5P_NO_CLASS_NEW,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,test_genprop_cls_cb2,&cop_cb_struct,NULL,NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with callbacks) */
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index efcf97c..1917d20 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -1023,6 +1023,7 @@ extend_writeInd(char *filename)
/* release resource */
H5Sclose(sid);
+ H5Pclose(dataset_pl);
diff --git a/tools/h4toh5/h4toh5image.c b/tools/h4toh5/h4toh5image.c
index fd32405..c4c945f 100644
--- a/tools/h4toh5/h4toh5image.c
+++ b/tools/h4toh5/h4toh5image.c
@@ -424,7 +424,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in
By default, we will compress HDF5 dataset by using gzip compression if HDF5 file is compressed. */
/* we don't use data transfer property list.
- write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW);
+ write_plist = H5Pcreate(H5P_DATASET_XFER);
bufsize = h4memsize *h5dims[1]*ncomp;
if(H5Pset_buffer(write_plist,bufsize,NULL,NULL)<0) {
diff --git a/tools/h4toh5/h4toh5sds.c b/tools/h4toh5/h4toh5sds.c
index 28c87f4..4e2a9d9 100644
--- a/tools/h4toh5/h4toh5sds.c
+++ b/tools/h4toh5/h4toh5sds.c
@@ -84,7 +84,7 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int
int16 special_code;
int32 access_id;
uint16 sd_ref;
- int gzip_level;
+ int gzip_level;
/* define varibles for hdf5. */
hid_t h5dset;
@@ -443,9 +443,7 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int
return FAIL;
}
/* comment this out.
- write_plist = H5Pcreate(H5P_DATASET_XFER);
-
- write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW);
+ write_plist = H5Pcreate(H5P_DATASET_XFER);
bufsize = h4memsize;
for(i=1;i<sds_rank;i++)
bufsize *= h5dims[i];
@@ -458,7 +456,7 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int
free(chunk_dims);
H5Sclose(h5d_sid);
H5Pclose(create_plist);
- H5Pclose_list(write_plist);
+ H5Pclose(write_plist);
return FAIL;
}
if (H5Dwrite(h5dset,h5_memtype,h5d_sid,h5d_sid,write_plist,
@@ -1482,7 +1480,7 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg
chunk_dims = malloc(sizeof(hsize_t)*sds_rank);
if(chunk_dims == NULL) {
- H5Pclose(H5P_DATASET_CREATE);
+ H5Pclose(create_plist);
free(sds_start);
free(sds_edge);
free(sds_stride);
@@ -1529,7 +1527,7 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg
}
/* Before HDF5 library make the optimzation of dealing with fill value
data, leave this alone. */
- /* write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW);
+ /* write_plist = H5Pcreate(H5P_DATASET_XFER);
bufsize = h4memsize;
for(i=1;i<sds_rank;i++)
bufsize *= h5dims[i];
@@ -1542,7 +1540,7 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg
free(chunk_dims);
H5Sclose(h5d_sid);
H5Pclose(create_plist);
- H5Pclose_list(write_plist);
+ H5Pclose(write_plist);
return FAIL;
}
@@ -1553,7 +1551,7 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg
H5Sclose(h5d_sid);
H5Dclose(h5dset);
H5Pclose(create_plist);
- H5Pclose_list(write_plist);
+ H5Pclose(write_plist);
free(sds_start);
free(sds_edge);
free(sds_stride);
@@ -1677,7 +1675,7 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg
H5Sclose(h5d_sid);
H5Dclose(h5dset);
H5Pclose(create_plist);
-/* H5Pclose_list(write_plist); */
+/* H5Pclose(write_plist); */
return SUCCEED;
}
diff --git a/tools/h5dump/h5dumptst.c b/tools/h5dump/h5dumptst.c
index 7d63e9f..9ad987f 100644
--- a/tools/h5dump/h5dumptst.c
+++ b/tools/h5dump/h5dumptst.c
@@ -215,6 +215,7 @@ static void test_dataset2(void)
H5Sclose(space);
H5Dclose(dataset);
+ H5Pclose(create_plist);
H5Fclose(fid);
}
@@ -705,6 +706,7 @@ static void test_compound_dt2(void) { /* test compound data type */
H5Dclose(dataset);
H5Sclose(space);
H5Gclose(group);
+ H5Pclose(create_plist);
H5Fclose(fid);
@@ -1089,6 +1091,7 @@ static void test_many(void) {
group = H5Gopen(fid, "/g5");
H5Glink (group, H5G_LINK_SOFT, "/g6/dset3", "slink4");
H5Gclose(group);
+ H5Pclose(create_plist);
H5Fclose(fid);