diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-06-03 20:34:58 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-06-03 20:34:58 (GMT) |
commit | 79380c228cb804bb7ed9bb1ac7b3f36706719c20 (patch) | |
tree | 24e7905fd80682e481e5ab9b342dd20862095f01 /src/H5Dcompact.c | |
parent | a9fa9a4a3715b8bd0dce83911548b88f30329c62 (diff) | |
download | hdf5-79380c228cb804bb7ed9bb1ac7b3f36706719c20.zip hdf5-79380c228cb804bb7ed9bb1ac7b3f36706719c20.tar.gz hdf5-79380c228cb804bb7ed9bb1ac7b3f36706719c20.tar.bz2 |
[svn-r15132] Description:
Bring back revision 15131 from trunk:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
Mac OS X/32 10.5.3 (amazon)
Linux/32 2.4 (chicago)
Diffstat (limited to 'src/H5Dcompact.c')
-rw-r--r-- | src/H5Dcompact.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index c3abab6..0458e74 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -57,6 +57,8 @@ /********************/ /* Layout operation callbacks */ +static herr_t H5D_compact_new(H5F_t *f, hid_t dxpl_id, H5D_t *dset, + const H5P_genplist_t *dc_plist); static herr_t H5D_compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); @@ -74,6 +76,7 @@ static ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info, /* Compact storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ + H5D_compact_new, H5D_compact_io_init, H5D_contig_read, H5D_contig_write, @@ -149,6 +152,53 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_compact_new + * + * Purpose: Constructs new compact layout information for dataset + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, May 22, 2008 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5D_compact_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, + const H5P_genplist_t UNUSED *dc_plist) +{ + hssize_t tmp_size; /* Temporary holder for raw data size */ + hsize_t comp_data_size; /* Size of compact data */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5D_compact_new) + + /* Sanity checks */ + HDassert(f); + HDassert(dset); + HDassert(dc_plist); + + /* + * Compact dataset is stored in dataset object header message of + * layout. + */ + tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(dset->shared->type); + H5_ASSIGN_OVERFLOW(dset->shared->layout.u.compact.size, tmp_size, hssize_t, size_t); + + /* Verify data size is smaller than maximum header message size + * (64KB) minus other layout message fields. + */ + comp_data_size = H5O_MESG_MAX_SIZE - H5O_layout_meta_size(f, &(dset->shared->layout)); + if(dset->shared->layout.u.compact.size > comp_data_size) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "compact dataset size is bigger than header message maximum size") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_compact_new() */ + + +/*------------------------------------------------------------------------- * Function: H5D_compact_io_init * * Purpose: Performs initialization before any sort of I/O on the raw data |