summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-01-08 16:54:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-01-08 16:54:49 (GMT)
commit596f9b43271b088bf4f13783024f0a75ac05011c (patch)
treed1c30cb9aa9a74cda2ab95e3a94e954375398197 /src/H5Dint.c
parentde5e1d93e44fdab49ab2d6b3bad4042219ad5236 (diff)
downloadhdf5-596f9b43271b088bf4f13783024f0a75ac05011c.zip
hdf5-596f9b43271b088bf4f13783024f0a75ac05011c.tar.gz
hdf5-596f9b43271b088bf4f13783024f0a75ac05011c.tar.bz2
[svn-r16278] Description:
Update layout information in DCPL to unify all information in one underlying property and switch to using H5O_layout_t for storing it, which simplifies things considerably. Also, fix many compiler warnings. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.6 (amazon) in debug mode Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r--src/H5Dint.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 3018108..9ccd7e0 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -171,8 +171,8 @@ H5D_init_interface(void)
if(NULL == (def_dcpl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_CREATE_g)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get default dataset creation property list")
- /* Get the default data storage method */
- if(H5P_get(def_dcpl, H5D_CRT_LAYOUT_NAME, &H5D_def_dset.layout.type) < 0)
+ /* Get the default data storage layout */
+ if(H5P_get(def_dcpl, H5D_CRT_LAYOUT_NAME, &H5D_def_dset.layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
/* Get the default dataset creation properties */
@@ -1063,7 +1063,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Check if the dataset has a non-default DCPL & get important values, if so */
if(new_dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
- H5D_layout_t *layout; /* Dataset's layout information */
+ H5O_layout_t *layout; /* Dataset's layout information */
H5O_pline_t *pline; /* Dataset's I/O pipeline information */
H5O_fill_t *fill; /* Dataset's fill value info */
@@ -1083,10 +1083,10 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
pline = &new_dset->shared->dcpl_cache.pline;
if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve pipeline filter")
- layout = &new_dset->shared->layout.type;
+ layout = &new_dset->shared->layout;
if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout")
- if(pline->nused > 0 && H5D_CHUNKED != *layout)
+ if(pline->nused > 0 && H5D_CHUNKED != layout->type)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout")
fill = &new_dset->shared->dcpl_cache.fill;
if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill) < 0)
@@ -1097,7 +1097,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "invalid space allocation state")
/* Don't allow compact datasets to allocate space later */
- if(*layout == H5D_COMPACT && fill->alloc_time != H5D_ALLOC_TIME_EARLY)
+ if(layout->type == H5D_COMPACT && fill->alloc_time != H5D_ALLOC_TIME_EARLY)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation")
/* If MPI VFD is used, no filter support yet. */
@@ -1352,8 +1352,14 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
*/
if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
- if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout.type) < 0)
+ /* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */
+ if(H5D_CHUNKED == dataset->shared->layout.type)
+ dataset->shared->layout.u.chunk.ndims--;
+ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout")
+ /* Adjust chunk dimensions back again (*sigh*) */
+ if(H5D_CHUNKED == dataset->shared->layout.type)
+ dataset->shared->layout.u.chunk.ndims++;
/* Get the external file list message, which might not exist. Space is
* also undefined when space allocate time is H5D_ALLOC_TIME_LATE. */
@@ -1396,25 +1402,9 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
break;
case H5D_CHUNKED:
- /*
- * Chunked storage. The creation plist's dimension is one less than
- * the chunk dimension because the chunk includes a dimension for the
- * individual bytes of the datatype.
- */
- {
- unsigned chunk_ndims; /* Dimensionality of chunk */
-
- chunk_ndims = dataset->shared->layout.u.chunk.ndims - 1;
-
- if(H5P_set(plist, H5D_CRT_CHUNK_DIM_NAME, &chunk_ndims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk dimensions")
- if(H5P_set(plist, H5D_CRT_CHUNK_SIZE_NAME, dataset->shared->layout.u.chunk.dim) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk size")
-
- /* Initialize the chunk cache for the dataset */
- if(H5D_chunk_init(dataset->oloc.file, dapl_id, dxpl_id, dataset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize chunk cache")
- }
+ /* Initialize the chunk cache for the dataset */
+ if(H5D_chunk_init(dataset->oloc.file, dapl_id, dxpl_id, dataset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize chunk cache")
break;
case H5D_COMPACT:
@@ -1464,7 +1454,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
/* If "old" fill value size is 0 (undefined), map it to -1 */
if(fill_prop->size == 0)
- fill_prop->size = (size_t)-1;
+ fill_prop->size = (ssize_t)-1;
} /* end if */
alloc_time_state = 0;
if((dataset->shared->layout.type == H5D_COMPACT && fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY)
@@ -1605,7 +1595,7 @@ H5D_close(H5D_t *dataset)
* Release datatype, dataspace and creation property list -- there isn't
* much we can do if one of these fails, so we just continue.
*/
- free_failed = (H5I_dec_ref(dataset->shared->type_id, FALSE) < 0 || H5S_close(dataset->shared->space) < 0 ||
+ free_failed = (unsigned)(H5I_dec_ref(dataset->shared->type_id, FALSE) < 0 || H5S_close(dataset->shared->space) < 0 ||
H5I_dec_ref(dataset->shared->dcpl_id, FALSE) < 0);
/* Remove the dataset from the list of opened objects in the file */