diff options
-rw-r--r-- | MANIFEST | 4 | ||||
-rw-r--r-- | src/H5D.c | 310 | ||||
-rw-r--r-- | src/H5Distore.c | 121 | ||||
-rw-r--r-- | src/H5Dprivate.h | 8 | ||||
-rw-r--r-- | src/H5Dpublic.h | 8 | ||||
-rw-r--r-- | src/H5Farray.c | 219 | ||||
-rw-r--r-- | src/H5Fistore.c | 121 | ||||
-rw-r--r-- | src/H5Fprivate.h | 20 | ||||
-rw-r--r-- | src/H5O.c | 4 | ||||
-rw-r--r-- | src/H5Ocstore.c | 258 | ||||
-rw-r--r-- | src/H5Olayout.c (renamed from src/H5Oistore.c) | 136 | ||||
-rw-r--r-- | src/H5Oprivate.h | 28 | ||||
-rw-r--r-- | src/H5V.c | 2 | ||||
-rw-r--r-- | src/Makefile.in | 8 | ||||
-rw-r--r-- | test/dsets.c | 11 | ||||
-rw-r--r-- | test/istore.c | 35 |
16 files changed, 614 insertions, 679 deletions
@@ -47,6 +47,7 @@ ./src/H5Eprivate.h ./src/H5Epublic.h ./src/H5F.c +./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c @@ -77,10 +78,9 @@ ./src/H5Mpublic.h ./src/H5O.c ./src/H5Ocont.c -./src/H5Ocstore.c ./src/H5Odtype.c ./src/H5Oefl.c -./src/H5Oistore.c +./src/H5Olayout.c ./src/H5Oname.c ./src/H5Onull.c ./src/H5Oprivate.h @@ -40,10 +40,7 @@ struct H5D_t { H5T_t *type; /*datatype of this dataset */ H5P_t *space; /*dataspace of this dataset */ H5D_create_t create_parms; /*creation parameters */ - union { - H5O_cstore_t cstore; /*contiguous storage info */ - H5O_istore_t istore; /*chunked storage info */ - } storage; + H5O_layout_t layout; /*data layout */ }; /* Default dataset creation template */ @@ -330,15 +327,20 @@ H5Dclose (hid_t dataset_id) * * Purpose: Reads (part of) a DATASET from the file into application * memory BUF. The part of the dataset to read is defined with - * SPACE_ID (if SPACE_ID is negative then we assume that the - * caller desires to read the entire dataset). The data points - * are converted from their file type to the TYPE_ID specified. + * MEM_SPACE_ID and FILE_SPACE_ID. The data points are + * converted from their file type to the MEM_TYPE_ID specified. * Additional miscellaneous data transfer properties can be * passed to this function with the XFER_PARMS_ID argument. * - * The SPACE_ID can be the constant H5P_ALL in which case the - * destination (memory) data space is the same as the source - * (file) data space defined when the dataset was created. + * The FILE_SPACE_ID can be the constant H5P_ALL which indicates + * that the entire file data space is to be referenced. + * + * The MEM_SPACE_ID can be the constant H5P_ALL in which case + * the memory data space is the same as the file data space + * defined when the dataset was created. + * + * The number of elements in the memory data space must match + * the number of elements in the file data space. * * The XFER_PARMS_ID can be the constant H5C_DEFAULT in which * case the default data transfer properties are used. @@ -363,12 +365,13 @@ H5Dclose (hid_t dataset_id) *------------------------------------------------------------------------- */ herr_t -H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id, - hid_t xfer_parms_id, void *buf/*out*/) +H5Dread (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_parms_id, void *buf/*out*/) { H5D_t *dataset = NULL; - const H5T_t *type = NULL; - const H5P_t *space = NULL; + const H5T_t *mem_type = NULL; + const H5P_t *mem_space = NULL; + const H5P_t *file_space = NULL; const H5D_xfer_t *xfer_parms = NULL; FUNC_ENTER (H5Dread, FAIL); @@ -380,13 +383,19 @@ H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id, NULL==dataset->ent.file) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } - if (H5_DATATYPE!=H5Aatom_group (type_id) || - NULL==(type=H5Aatom_object (type_id))) { + if (H5_DATATYPE!=H5Aatom_group (mem_type_id) || + NULL==(mem_type=H5Aatom_object (mem_type_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } - if (H5P_ALL!=space_id) { - if (H5_DATASPACE!=H5Aatom_group (space_id) || - NULL==(space=H5Aatom_object (space_id))) { + if (H5P_ALL!=mem_space_id) { + if (H5_DATASPACE!=H5Aatom_group (mem_space_id) || + NULL==(mem_space=H5Aatom_object (mem_space_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); + } + } + if (H5P_ALL!=file_space_id) { + if (H5_DATASPACE!=H5Aatom_group (file_space_id) || + NULL==(file_space=H5Aatom_object (file_space_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } @@ -401,7 +410,8 @@ H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id, } /* read raw data */ - if (H5D_read (dataset, type, space, xfer_parms, buf/*out*/)<0) { + if (H5D_read (dataset, mem_type, mem_space, file_space, xfer_parms, + buf/*out*/)<0) { HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); } @@ -414,17 +424,21 @@ H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id, * * Purpose: Writes (part of) a DATASET from application memory BUF to the * file. The part of the dataset to write is defined with the - * SPACE_ID (if SPACE_ID is negative then we assume that the - * caller desires to write the entire dataset). The data points - * are converted from their current type (TYPE_ID) to their file - * data type. Additional miscellaneous data transfer properties - * can be passed to this function with the XFER_PARMS_ID - * argument. - * - * The SPACE_ID can be the constant H5P_ALL in which case the - * source (memory) data space is the same as the destination - * (file) memory space which was defined when the dataset was - * created. + * MEM_SPACE_ID and FILE_SPACE_ID arguments. The data points + * are converted from their current type (MEM_TYPE_ID) to their + * file data type. Additional miscellaneous data transfer + * properties can be passed to this function with the + * XFER_PARMS_ID argument. + * + * The FILE_SPACE_ID can be the constant H5P_ALL which indicates + * that the entire file data space is to be referenced. + * + * The MEM_SPACE_ID can be the constant H5P_ALL in which case + * the memory data space is the same as the file data space + * defined when the dataset was created. + * + * The number of elements in the memory data space must match + * the number of elements in the file data space. * * The XFER_PARMS_ID can be the constant H5C_DEFAULT in which * case the default data transfer properties are used. @@ -443,12 +457,13 @@ H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id, *------------------------------------------------------------------------- */ herr_t -H5Dwrite (hid_t dataset_id, hid_t type_id, hid_t space_id, - hid_t xfer_parms_id, const void *buf) +H5Dwrite (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_parms_id, const void *buf) { H5D_t *dataset = NULL; - const H5T_t *type = NULL; - const H5P_t *space = NULL; + const H5T_t *mem_type = NULL; + const H5P_t *mem_space = NULL; + const H5P_t *file_space = NULL; const H5D_xfer_t *xfer_parms = NULL; FUNC_ENTER (H5Dwrite, FAIL); @@ -460,13 +475,19 @@ H5Dwrite (hid_t dataset_id, hid_t type_id, hid_t space_id, NULL==dataset->ent.file) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } - if (H5_DATATYPE!=H5Aatom_group (type_id) || - NULL==(type=H5Aatom_object (type_id))) { + if (H5_DATATYPE!=H5Aatom_group (mem_type_id) || + NULL==(mem_type=H5Aatom_object (mem_type_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } - if (H5P_ALL!=space_id) { - if (H5_DATASPACE!=H5Aatom_group (space_id) || - NULL==(space=H5Aatom_object (space_id))) { + if (H5P_ALL!=mem_space_id) { + if (H5_DATASPACE!=H5Aatom_group (mem_space_id) || + NULL==(mem_space=H5Aatom_object (mem_space_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); + } + } + if (H5P_ALL!=file_space_id) { + if (H5_DATASPACE!=H5Aatom_group (file_space_id) || + NULL==(file_space=H5Aatom_object (file_space_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } @@ -481,7 +502,8 @@ H5Dwrite (hid_t dataset_id, hid_t type_id, hid_t space_id, } /* write raw data */ - if (H5D_write (dataset, type, space, xfer_parms, buf)<0) { + if (H5D_write (dataset, mem_type, mem_space, file_space, xfer_parms, + buf)<0) { HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "can't write data"); } @@ -561,7 +583,7 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space, H5D_t *new_dset = NULL; H5D_t *ret_value = NULL; size_t nbytes; - intn ndims; + intn i; FUNC_ENTER (H5D_create, NULL); @@ -596,55 +618,43 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space, /* Total raw data size */ nbytes = H5T_get_size (type) * H5P_get_npoints (space); + new_dset->layout.type = new_dset->create_parms.layout; + new_dset->layout.ndims = H5P_get_ndims (space) + 1; + assert (new_dset->layout.ndims<=NELMTS (new_dset->layout.dim)); + new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size (type); - /* Initialize storage */ switch (new_dset->create_parms.layout) { case H5D_CONTIGUOUS: - new_dset->storage.cstore.size = nbytes; - if (H5MF_alloc (f, H5MF_RAW, nbytes, - &(new_dset->storage.cstore.addr))<0) { - HGOTO_ERROR (H5E_DATASET, H5E_NOSPACE, NULL, - "can't allocate raw file storage"); - } - if (H5O_modify (&(new_dset->ent), H5O_CSTORE, 0, 0, - &(new_dset->storage.cstore))<0) { + if (H5P_get_dims (space, new_dset->layout.dim)<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, - "can't update dataset object header"); + "unable to initialize contiguous storage"); } break; case H5D_CHUNKED: - /* - * The dimensionality of the chunk should match the dimensionality of - * the data space. We will add one more dimension here though, to - * describe the individual bytes of a data point. Therefore, there - * must be room in the template for one more dimension size. - */ - ndims = new_dset->create_parms.chunk_ndims; - if (ndims != H5P_get_ndims (space)) { + if (new_dset->create_parms.chunk_ndims != H5P_get_ndims (space)) { HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL, "dimensionality of chunks doesn't match the data space"); } - assert (ndims<NELMTS (new_dset->create_parms.chunk_size)); - new_dset->create_parms.chunk_size[ndims] = H5T_get_size (type); - - if (H5F_istore_create (f, &(new_dset->storage.istore), ndims+1, - new_dset->create_parms.chunk_size)<0) { - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, - "can't initialize chunked storage"); - } - if (H5O_modify (&(new_dset->ent), H5O_ISTORE, 0, 0, - &(new_dset->storage.istore))<0) { - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, - "can't update dataset object header"); + for (i=0; i<new_dset->layout.ndims-1; i++) { + new_dset->layout.dim[i] = new_dset->create_parms.chunk_size[i]; } break; default: - assert ("not implemented yet" && 0); HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet"); } + /* + * Initialize storage + */ + if (H5F_arr_create (f, &(new_dset->layout))<0 || + H5O_modify (&(new_dset->ent), H5O_LAYOUT, 0, 0, + &(new_dset->layout))<0) { + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "unable to initialize storage"); + } + /* Give the dataset a name */ if (H5G_insert (name, &(new_dset->ent))<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset"); @@ -693,7 +703,6 @@ H5D_open (H5F_t *f, const char *name) { H5D_t *dataset = NULL; /*the dataset which was found */ H5D_t *ret_value = NULL; /*return value */ - H5O_istore_t *istore = NULL; intn i; FUNC_ENTER (H5D_open, NULL); @@ -722,31 +731,34 @@ H5D_open (H5F_t *f, const char *name) } /* - * Get the raw data storage info. It's actually stored in two locations: + * Get the raw data layout info. It's actually stored in two locations: * the storage message of the dataset (dataset->storage) and certain * values are copied to the dataset create template so the user can query * them. */ - if (H5O_read (&(dataset->ent), H5O_CSTORE, 0, &(dataset->storage.cstore))) { - /* Contiguous storage */ + if (H5O_read (&(dataset->ent), H5O_LAYOUT, 0, &(dataset->layout))<0) { + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "unable to read data layout message"); + } + switch (dataset->layout.type) { + case H5D_CONTIGUOUS: dataset->create_parms.layout = H5D_CONTIGUOUS; - - } else if (H5O_read (&(dataset->ent), H5O_ISTORE, 0, - &(dataset->storage.istore))) { + break; + + case H5D_CHUNKED: /* * Chunked storage. The creation template's dimension is one less than * the chunk dimension because the chunk includes a dimension for the * individual bytes of the data type. */ - istore = &(dataset->storage.istore); dataset->create_parms.layout = H5D_CHUNKED; - dataset->create_parms.chunk_ndims = istore->ndims - 1; - assert (istore->ndims<=NELMTS (dataset->create_parms.chunk_size)); - for (i=0; i<istore->ndims-1; i++) { - dataset->create_parms.chunk_size[i] = istore->alignment[i]; + dataset->create_parms.chunk_ndims = dataset->layout.ndims - 1; + for (i=0; i<dataset->layout.ndims-1; i++) { + dataset->create_parms.chunk_size[i] = dataset->layout.dim[i]; } - - } else { + break; + + default: assert ("not implemented yet" && 0); HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet"); } @@ -834,12 +846,8 @@ H5D_close (H5D_t *dataset) /*------------------------------------------------------------------------- * Function: H5D_read * - * Purpose: Reads (part of) a DATASET into application memory BUF. The - * SPACE argument determines what part of the dataset to read - * (the whole thing is read if SPACE is null) and individual - * data points are translated from their file data type to the - * specified TYPE. The XFER_PARMS contains additional - * miscellaneous properties that control the data transfer. + * Purpose: Reads (part of) a DATASET into application memory BUF. See + * H5Dread() for complete details. * * Return: Success: SUCCEED * @@ -853,12 +861,13 @@ H5D_close (H5D_t *dataset) *------------------------------------------------------------------------- */ herr_t -H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, - const H5D_xfer_t *xfer_parms, void *buf/*out*/) +H5D_read (H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space, + const H5P_t *file_space, const H5D_xfer_t *xfer_parms, + void *buf/*out*/) { size_t nelmts, src_size, dst_size; - size_t offset[H5O_ISTORE_NDIMS]; - size_t size[H5O_ISTORE_NDIMS]; + size_t offset[H5O_LAYOUT_NDIMS]; + size_t size[H5O_LAYOUT_NDIMS]; intn i; herr_t ret_value = FAIL; uint8 *conv_buf = NULL; /*data type conv buffer */ @@ -869,25 +878,23 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, /* check args */ assert (dataset && dataset->ent.file); - assert (type); + assert (mem_type); assert (xfer_parms); assert (buf); - if (H5D_CONTIGUOUS!=dataset->create_parms.layout) { - HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "layout is not supported yet"); - } - if (space && H5P_cmp (space, dataset->space)) { + if ((mem_space && H5P_cmp (mem_space, dataset->space)) || + (file_space && H5P_cmp (file_space, dataset->space))) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "space conversion not supported yet"); } + /* * Convert data types to atoms because the conversion functions are * application-level functions. */ if ((src_id=H5Aregister_atom (H5_DATATYPE, H5T_copy (dataset->type)))<0 || - (dst_id=H5Aregister_atom (H5_DATATYPE, H5T_copy (type)))<0) { + (dst_id=H5Aregister_atom (H5_DATATYPE, H5T_copy (mem_type)))<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); } @@ -895,39 +902,24 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, /* Compute the size of the request and allocate scratch buffers */ nelmts = H5P_get_npoints (dataset->space); src_size = nelmts * H5T_get_size (dataset->type); - dst_size = nelmts * H5T_get_size (type); + dst_size = nelmts * H5T_get_size (mem_type); conv_buf = H5MM_xmalloc (MAX (src_size, dst_size)); - if (NULL==(conv_func=H5T_find (dataset->type, type))) { + if (NULL==(conv_func=H5T_find (dataset->type, mem_type))) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } /* * Read data into the data type conversion buffer. + * (We only support complete reads currently) */ - switch (dataset->create_parms.layout) { - case H5D_CONTIGUOUS: - /* Read a block of contiguous data */ - if (H5F_block_read (dataset->ent.file, &(dataset->storage.cstore.addr), - src_size, conv_buf)<0) { - HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed"); - } - break; - - case H5D_CHUNKED: - /* Read one or more chunks from indexed storage */ - for (i=0; i<dataset->storage.istore.ndims; i++) offset[i] = 0; - H5P_get_dims (dataset->space, size); - size[dataset->storage.istore.ndims-1] = H5T_get_size (dataset->type); - if (H5F_istore_read (dataset->ent.file, &(dataset->storage.istore), - offset, size, conv_buf)<0) { - HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed"); - } - break; - - default: - assert ("not implemented yet" && 0); - HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "not implemented yet"); + for (i=0; i<dataset->layout.ndims; i++) { + offset[i] = 0; + size[i] = dataset->layout.dim[i]; + } + if (H5F_arr_read (dataset->ent.file, &(dataset->layout), offset, size, + conv_buf)<0) { + HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed"); } /* @@ -956,12 +948,7 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, * Function: H5D_write * * Purpose: Writes (part of) a DATASET to a file from application memory - * BUF. The SPACE argument determines what part of the dataset - * to write (the whole thing is read if SPACE is null) and - * individual data points are translated from their memory data - * type (TYPE) to the file data type. The XFER_PARMS contains - * additional miscellaneous properties that control the data - * transfer. + * BUF. See H5Dwrite() for complete details. * * Return: Success: SUCCEED * @@ -975,12 +962,13 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, *------------------------------------------------------------------------- */ herr_t -H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, - const H5D_xfer_t *xfer_parms, const void *buf) +H5D_write (H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space, + const H5P_t *file_space, const H5D_xfer_t *xfer_parms, + const void *buf) { size_t nelmts, src_size, dst_size; - size_t offset[H5O_ISTORE_NDIMS]; - size_t size[H5O_ISTORE_NDIMS]; + size_t offset[H5O_LAYOUT_NDIMS]; + size_t size[H5O_LAYOUT_NDIMS]; intn i; herr_t ret_value = FAIL; uint8 *conv_buf = NULL; /*data type conversion buffer */ @@ -991,7 +979,7 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, /* check args */ assert (dataset && dataset->ent.file); - assert (type); + assert (mem_type); assert (xfer_parms); assert (buf); @@ -999,7 +987,8 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "layout is not supported yet"); } - if (space && H5P_cmp (space, dataset->space)) { + if ((mem_space && H5P_cmp (mem_space, dataset->space)) || + (file_space && H5P_cmp (file_space, dataset->space))) { HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "space conversion not supported yet"); } @@ -1008,8 +997,8 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, * Convert data types to atoms because the conversion functions are * application-level functions. */ - if ((src_id=H5Aregister_atom (H5_DATATYPE, H5T_copy (dataset->type)))<0 || - (dst_id=H5Aregister_atom (H5_DATATYPE, H5T_copy (type)))<0) { + if ((src_id=H5Aregister_atom (H5_DATATYPE, H5T_copy (mem_type)))<0 || + (dst_id=H5Aregister_atom (H5_DATATYPE, H5T_copy (dataset->type)))<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); } @@ -1017,10 +1006,10 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, /* Compute the size of the request and allocate scratch buffers */ nelmts = H5P_get_npoints (dataset->space); - src_size = nelmts * H5T_get_size (type); + src_size = nelmts * H5T_get_size (mem_type); dst_size = nelmts * H5T_get_size (dataset->type); conv_buf = H5MM_xmalloc (MAX (src_size, dst_size)); - if (NULL==(conv_func=H5T_find (type, dataset->type))) { + if (NULL==(conv_func=H5T_find (mem_type, dataset->type))) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } @@ -1041,30 +1030,15 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, /* * Write data into the file. + * (We only support complete writes currently.) */ - switch (dataset->create_parms.layout) { - case H5D_CONTIGUOUS: - /* Write a contiguous chunk of data */ - if (H5F_block_write (dataset->ent.file, &(dataset->storage.cstore.addr), - dst_size, conv_buf)<0) { - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed"); - } - break; - - case H5D_CHUNKED: - /* Write one or more chunks to indexed storage */ - for (i=0; i<dataset->storage.istore.ndims; i++) offset[i] = 0; - H5P_get_dims (dataset->space, size); - size[dataset->storage.istore.ndims-1] = H5T_get_size (dataset->type); - if (H5F_istore_write (dataset->ent.file, &(dataset->storage.istore), - offset, size, conv_buf)<0) { - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed"); - } - break; - - default: - assert ("not implemented yet" && 0); - HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "not implemented yet"); + for (i=0; i<dataset->layout.ndims; i++) { + offset[i] = 0; + size[i] = dataset->layout.dim[i]; + } + if (H5F_arr_write (dataset->ent.file, &(dataset->layout), offset, size, + conv_buf)<0) { + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed"); } ret_value = SUCCEED; diff --git a/src/H5Distore.c b/src/H5Distore.c index 15c7d4d..fa53b91 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -6,6 +6,7 @@ * Wednesday, October 8, 1997 */ #include <H5private.h> +#include <H5Dprivate.h> #include <H5Eprivate.h> #include <H5Fprivate.h> #include <H5MFprivate.h> @@ -48,7 +49,7 @@ static herr_t H5F_istore_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key); static herr_t H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key); -static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, +static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, const size_t offset_f[], const size_t size[], @@ -72,14 +73,14 @@ static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, */ typedef struct H5F_istore_key_t { uintn file_number; /*external file number */ - size_t offset[H5O_ISTORE_NDIMS]; /*logical offset to start*/ - size_t size[H5O_ISTORE_NDIMS]; /*logical chunk size */ + size_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ + size_t size[H5O_LAYOUT_NDIMS]; /*logical chunk size */ } H5F_istore_key_t; typedef struct H5F_istore_ud1_t { H5F_istore_key_t key; /*key values */ haddr_t addr; /*file address of chunk */ - H5O_istore_t mesg; /*storage message */ + H5O_layout_t mesg; /*layout message */ } H5F_istore_ud1_t; /* inherits B-tree like properties from H5B */ @@ -127,7 +128,7 @@ H5F_istore_sizeof_rkey (H5F_t *f, const void *_udata) size_t nbytes; assert (udata); - assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_LAYOUT_NDIMS); nbytes = 4 + /*external file number */ udata->mesg.ndims * 4 + /*dimension indices */ @@ -168,7 +169,7 @@ H5F_istore_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key) assert (bt); assert (raw); assert (key); - assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS); + assert (ndims>0 && ndims<=H5O_LAYOUT_NDIMS); /* decode */ UINT32DECODE (raw, key->file_number); @@ -213,7 +214,7 @@ H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key) assert (bt); assert (raw); assert (key); - assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS); + assert (ndims>0 && ndims<=H5O_LAYOUT_NDIMS); /* encode */ UINT32ENCODE (raw, key->file_number); @@ -261,7 +262,7 @@ H5F_istore_cmp2 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) assert (lt_key); assert (rt_key); assert (udata); - assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ cmp = H5V_vector_cmp (udata->mesg.ndims, lt_key->offset, rt_key->offset); @@ -312,7 +313,7 @@ H5F_istore_cmp3 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) assert (lt_key); assert (rt_key); assert (udata); - assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_LAYOUT_NDIMS); if (H5V_vector_lt (udata->mesg.ndims, udata->key.offset, lt_key->offset)) { cmp = -1; @@ -363,7 +364,7 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op, assert (lt_key); assert (rt_key); assert (udata); - assert (udata->mesg.ndims>=0 && udata->mesg.ndims<H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>=0 && udata->mesg.ndims<H5O_LAYOUT_NDIMS); assert (addr); /* Allocate new storage */ @@ -543,8 +544,8 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, */ md_key->file_number = udata->key.file_number; for (i=0, nbytes=1; i<udata->mesg.ndims; i++) { - assert (0==udata->key.offset[i] % udata->mesg.alignment[i]); - assert (udata->key.size[i] == udata->mesg.alignment[i]); + assert (0==udata->key.offset[i] % udata->mesg.dim[i]); + assert (udata->key.size[i] == udata->mesg.dim[i]); md_key->offset[i] = udata->key.offset[i]; md_key->size[i] = udata->key.size[i]; nbytes *= udata->key.size[i]; @@ -603,18 +604,18 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, *------------------------------------------------------------------------- */ static herr_t -H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, +H5F_istore_copy_hyperslab (H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, const size_t offset_f[], const size_t size[], const size_t offset_m[], const size_t size_m[], void *buf) { intn i, carry; - size_t idx_cur[H5O_ISTORE_NDIMS]; - size_t idx_min[H5O_ISTORE_NDIMS]; - size_t idx_max[H5O_ISTORE_NDIMS]; - size_t sub_size[H5O_ISTORE_NDIMS]; - size_t offset_wrt_chunk[H5O_ISTORE_NDIMS]; - size_t sub_offset_m[H5O_ISTORE_NDIMS]; + size_t idx_cur[H5O_LAYOUT_NDIMS]; + size_t idx_min[H5O_LAYOUT_NDIMS]; + size_t idx_max[H5O_LAYOUT_NDIMS]; + size_t sub_size[H5O_LAYOUT_NDIMS]; + size_t offset_wrt_chunk[H5O_LAYOUT_NDIMS]; + size_t sub_offset_m[H5O_LAYOUT_NDIMS]; size_t chunk_size; uint8 *chunk=NULL; H5F_istore_ud1_t udata; @@ -625,60 +626,60 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, /* check args */ assert (f); - assert (istore); - assert (H5F_addr_defined (&(istore->btree_addr))); - assert (istore->ndims>0 && istore->ndims<=H5O_ISTORE_NDIMS); + assert (layout && H5D_CHUNKED==layout->type); + assert (H5F_addr_defined (&(layout->addr))); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert (H5F_ISTORE_READ==op || H5F_ISTORE_WRITE==op); assert (size); assert (size_m); assert (buf); #ifndef NDEBUG - for (i=0; i<istore->ndims; i++) { + for (i=0; i<layout->ndims; i++) { assert (!offset_f || offset_f[i]>=0);/*neg domains unsupported */ assert (!offset_m || offset_m[i]>=0);/*mem array offset never neg */ assert (size[i]>=0); /*size may be zero, implies no-op */ assert (size_m[i]>0); /*destination must exist */ /*hyperslab must fit in BUF*/ assert ((offset_m?offset_m[i]:0)+size[i]<=size_m[i]); - assert (istore->alignment[i]>0); + assert (layout->dim[i]>0); } #endif /* Initialize indices */ - for (i=0; i<istore->ndims; i++) { - idx_min[i] = (offset_f?offset_f[i]:0) / istore->alignment[i]; - idx_max[i] = ((offset_f?offset_f[i]:0)+size[i]-1)/istore->alignment[i]+1; + for (i=0; i<layout->ndims; i++) { + idx_min[i] = (offset_f?offset_f[i]:0) / layout->dim[i]; + idx_max[i] = ((offset_f?offset_f[i]:0)+size[i]-1)/layout->dim[i]+1; idx_cur[i] = idx_min[i]; } /* Allocate buffers */ - for (i=0, chunk_size=1; i<istore->ndims; i++) { - chunk_size *= istore->alignment[i]; + for (i=0, chunk_size=1; i<layout->ndims; i++) { + chunk_size *= layout->dim[i]; } chunk = H5MM_xmalloc (chunk_size); /* Initialize non-changing part of udata */ - udata.mesg = *istore; + udata.mesg = *layout; /* Loop over all chunks */ while (1) { /* Read/Write chunk or create it if it doesn't exist */ - udata.mesg.ndims = istore->ndims; + udata.mesg.ndims = layout->ndims; H5F_addr_undef (&(udata.addr)); udata.key.file_number = 0; - for (i=0; i<istore->ndims; i++) { + for (i=0; i<layout->ndims; i++) { /* The location and size of the chunk being accessed */ - udata.key.offset[i] = idx_cur[i] * istore->alignment[i]; - udata.key.size[i] = istore->alignment[i]; + udata.key.offset[i] = idx_cur[i] * layout->dim[i]; + udata.key.size[i] = layout->dim[i]; /* The offset and size wrt the chunk */ offset_wrt_chunk[i] = MAX ((offset_f?offset_f[i]:0), udata.key.offset[i]) - udata.key.offset[i]; - sub_size[i] = MIN ((idx_cur[i]+1)*istore->alignment[i], + sub_size[i] = MIN ((idx_cur[i]+1)*layout->dim[i], (offset_f?offset_f[i]:0)+size[i]) - (udata.key.offset[i]+offset_wrt_chunk[i]); @@ -689,10 +690,10 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, } if (H5F_ISTORE_WRITE==op) { - status = H5B_insert (f, H5B_ISTORE, &(istore->btree_addr), &udata); + status = H5B_insert (f, H5B_ISTORE, &(layout->addr), &udata); assert (status>=0); } else { - status = H5B_find (f, H5B_ISTORE, &(istore->btree_addr), &udata); + status = H5B_find (f, H5B_ISTORE, &(layout->addr), &udata); } /* @@ -700,8 +701,8 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, * partial chunk then load the chunk from disk. */ if (H5F_ISTORE_READ==op || - !H5V_vector_zerop (istore->ndims, offset_wrt_chunk) || - !H5V_vector_eq (istore->ndims, sub_size, udata.key.size)) { + !H5V_vector_zerop (layout->ndims, offset_wrt_chunk) || + !H5V_vector_eq (layout->ndims, sub_size, udata.key.size)) { if (status>=0 && H5F_addr_defined (&(udata.addr))) { assert (0==udata.key.file_number); if (H5F_block_read (f, &(udata.addr), chunk_size, chunk)<0) { @@ -715,7 +716,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, /* Transfer data to/from the chunk */ if (H5F_ISTORE_WRITE==op) { - H5V_hyper_copy (istore->ndims, sub_size, + H5V_hyper_copy (layout->ndims, sub_size, udata.key.size, offset_wrt_chunk, chunk, size_m, sub_offset_m, buf); assert (0==udata.key.file_number); @@ -724,13 +725,13 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, "unable to write raw storage chunk"); } } else { - H5V_hyper_copy (istore->ndims, sub_size, + H5V_hyper_copy (layout->ndims, sub_size, size_m, sub_offset_m, buf, udata.key.size, offset_wrt_chunk, chunk); } /* Increment indices */ - for (i=istore->ndims-1, carry=1; i>=0 && carry; --i) { + for (i=layout->ndims-1, carry=1; i>=0 && carry; --i) { if (++idx_cur[i]>=idx_max[i]) idx_cur[i] = idx_min[i]; else carry = 0; } @@ -763,19 +764,19 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, *------------------------------------------------------------------------- */ herr_t -H5F_istore_read (H5F_t *f, const H5O_istore_t *istore, +H5F_istore_read (H5F_t *f, const H5O_layout_t *layout, const size_t offset[], const size_t size[], void *buf) { FUNC_ENTER (H5F_istore_read, FAIL); /* Check args */ assert (f); - assert (istore); - assert (istore->ndims>0 && istore->ndims<=H5O_ISTORE_NDIMS); + assert (layout && H5D_CHUNKED==layout->type); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert (size); assert (buf); - if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_READ, + if (H5F_istore_copy_hyperslab (f, layout, H5F_ISTORE_READ, offset, size, H5V_ZERO, size, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "hyperslab output failure"); @@ -803,7 +804,7 @@ H5F_istore_read (H5F_t *f, const H5O_istore_t *istore, *------------------------------------------------------------------------- */ herr_t -H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, +H5F_istore_write (H5F_t *f, const H5O_layout_t *layout, const size_t offset[], const size_t size[], const void *buf) { @@ -811,12 +812,12 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, /* Check args */ assert (f); - assert (istore); - assert (istore->ndims>0 && istore->ndims<=H5O_ISTORE_NDIMS); + assert (layout && H5D_CHUNKED==layout->type); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert (size); assert (buf); - if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_WRITE, + if (H5F_istore_copy_hyperslab (f, layout, H5F_ISTORE_WRITE, offset, size, H5V_ZERO, size, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "hyperslab output failure"); @@ -850,8 +851,7 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, *------------------------------------------------------------------------- */ herr_t -H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore/*out*/, - uintn ndims, const size_t alignment[]) +H5F_istore_create (H5F_t *f, H5O_layout_t *layout/*out*/) { H5F_istore_ud1_t udata; int i; @@ -860,23 +860,18 @@ H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore/*out*/, /* Check args */ assert (f); - assert (istore); - assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS); - assert (alignment); + assert (layout && H5D_CHUNKED==layout->type); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); #ifndef NDEBUG - for (i=0; i<ndims; i++) { - assert (alignment[i]>0); + for (i=0; i<layout->ndims; i++) { + assert (layout->dim[i]>0); } #endif - udata.mesg.ndims = istore->ndims = ndims; - if (H5B_create (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) { + udata.mesg.ndims = layout->ndims; + if (H5B_create (f, H5B_ISTORE, &udata, &(layout->addr)/*out*/)<0) { HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree"); } - for (i=0; i<ndims; i++) { - istore->alignment[i] = alignment[i]; - } - FUNC_LEAVE (SUCCEED); } diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 9c4ffeb..07f6d9c 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -55,9 +55,11 @@ H5D_t *H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space, const H5D_create_t *create_parms); H5D_t *H5D_open (H5F_t *f, const char *name); herr_t H5D_close (H5D_t *dataset); -herr_t H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, - const H5D_xfer_t *xfer_parms, void *buf/*out*/); -herr_t H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, +herr_t H5D_read (H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space, + const H5P_t *file_space, const H5D_xfer_t *xfer_parms, + void *buf/*out*/); +herr_t H5D_write (H5D_t *dataset, const H5T_t *mem_type, + const H5P_t *mem_space, const H5P_t *file_space, const H5D_xfer_t *xfer_parms, const void *buf); hid_t H5D_find_name (hid_t file_id, group_t UNUSED, const char *name); diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 417146b..303a18d 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -42,10 +42,10 @@ hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_parms_id); hid_t H5Dopen (hid_t file_id, const char *name); herr_t H5Dclose (hid_t dataset_id); -herr_t H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id, - hid_t xfer_parms_id, void *buf/*out*/); -herr_t H5Dwrite (hid_t dataset_id, hid_t type_id, hid_t space_id, - hid_t xfer_parms_id, const void *buf); +herr_t H5Dread (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_parms_id, void *buf/*out*/); +herr_t H5Dwrite (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_parms_id, const void *buf); #ifdef __cplusplus } diff --git a/src/H5Farray.c b/src/H5Farray.c new file mode 100644 index 0000000..88dae0b --- /dev/null +++ b/src/H5Farray.c @@ -0,0 +1,219 @@ +/* + * Copyright (C) 1998 Spizella Software + * All rights reserved. + * + * Programmer: Robb Matzke <robb@arborea.spizella.com> + * Thursday, January 15, 1998 + * + * Purpose: Provides I/O facilities for multi-dimensional arrays of bytes + * stored with various layout policies. + */ +#include <H5private.h> +#include <H5Dprivate.h> +#include <H5Eprivate.h> +#include <H5Fprivate.h> +#include <H5MFprivate.h> +#include <H5Oprivate.h> + +/* Interface initialization */ +#define PABLO_MASK H5F_arr_mask +#define INTERFACE_INIT NULL +static intn interface_initialize_g = FALSE; + + + +/*------------------------------------------------------------------------- + * Function: H5F_arr_create + * + * Purpose: Creates an array of bytes. When called to create an array of + * some type, the fastest varying dimension corresponds to an + * instance of that type. That is, a 10x20 array of int32 is + * really a 10x20x4 array of bytes. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Friday, January 16, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/) +{ + intn i; + size_t nbytes; + + FUNC_ENTER (H5F_arr_create, FAIL); + + /* check args */ + assert (f); + assert (layout); + H5F_addr_undef (&(layout->addr)); /*just in case we fail*/ + + switch (layout->type) { + case H5D_CONTIGUOUS: + /* Reserve space in the file for the entire array */ + for (i=0, nbytes=1; i<layout->ndims; i++) nbytes *= layout->dim[i]; + assert (nbytes>0); + if (H5MF_alloc (f, H5MF_RAW, nbytes, &(layout->addr)/*out*/)<0) { + HRETURN_ERROR (H5E_IO, H5E_NOSPACE, FAIL, + "unable to reserve file space"); + } + break; + + case H5D_CHUNKED: + /* Create the root of the B-tree that describes chunked storage */ + if (H5F_istore_create (f, layout/*out*/)<0) { + HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, + "unable to initialize chunked storage"); + } + break; + + default: + assert ("not implemented yet" && 0); + HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, + "unsupported storage layout"); + break; + } + + FUNC_LEAVE (SUCCEED); +} + + +/*------------------------------------------------------------------------- + * Function: H5F_arr_read + * + * Purpose: Reads a hyperslab of a file byte array into a byte array in + * memory which has the same dimensions as the hyperslab. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Friday, January 16, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, + const size_t offset[], const size_t size[], + void *buf/*out*/) +{ + intn i; + size_t nbytes; + size_t zero_offset[H5O_LAYOUT_NDIMS]; + + FUNC_ENTER (H5F_arr_read, FAIL); + + /* Check args */ + assert (f); + assert (layout); + if (!offset) { + HDmemset (zero_offset, 0, sizeof zero_offset); + offset = zero_offset; + } + assert (size); + assert (buf); + + switch (layout->type) { + case H5D_CONTIGUOUS: + /* + * We currently only support complete I/O. + */ + for (i=0; i<layout->ndims; i++) { + assert (0==offset[i]); + assert (size[i]==layout->dim[i]); + } + for (i=0, nbytes=1; i<layout->ndims; i++) nbytes *= layout->dim[i]; + if (H5F_block_read (f, &(layout->addr), nbytes, buf)<0) { + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "block read failed"); + } + break; + + case H5D_CHUNKED: + if (H5F_istore_read (f, layout, offset, size, buf)<0) { + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "chunked read failed"); + } + break; + + default: + assert ("not implemented yet" && 0); + HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, + "unsupported storage layout"); + break; + } + + FUNC_LEAVE (SUCCEED); +} + + +/*------------------------------------------------------------------------- + * Function: H5F_arr_write + * + * Purpose: Writes an array to a hyperslab of a file byte array. The + * memory array and the hyperslab are the same size. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Friday, January 16, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, + const size_t offset[], const size_t size[], + const void *buf) +{ + intn i; + size_t nbytes; + + FUNC_ENTER (H5F_arr_write, FAIL); + + /* Check args */ + assert (f); + assert (layout); + assert (offset); + assert (size); + assert (buf); + + switch (layout->type) { + case H5D_CONTIGUOUS: + /* + * We currently only support complete I/O. + */ + for (i=0; i<layout->ndims; i++) { + assert (0==offset[i]); + assert (size[i]==layout->dim[i]); + } + for (i=0, nbytes=1; i<layout->ndims; i++) nbytes *= layout->dim[i]; + if (H5F_block_write (f, &(layout->addr), nbytes, buf)<0) { + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + } + break; + + case H5D_CHUNKED: + if (H5F_istore_write (f, layout, offset, size, buf)<0) { + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "chunked write failed"); + } + break; + + default: + assert ("not implemented yet" && 0); + HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, + "unsupported storage layout"); + break; + } + + FUNC_LEAVE (SUCCEED); +} + diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 15c7d4d..fa53b91 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -6,6 +6,7 @@ * Wednesday, October 8, 1997 */ #include <H5private.h> +#include <H5Dprivate.h> #include <H5Eprivate.h> #include <H5Fprivate.h> #include <H5MFprivate.h> @@ -48,7 +49,7 @@ static herr_t H5F_istore_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key); static herr_t H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key); -static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, +static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, const size_t offset_f[], const size_t size[], @@ -72,14 +73,14 @@ static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, */ typedef struct H5F_istore_key_t { uintn file_number; /*external file number */ - size_t offset[H5O_ISTORE_NDIMS]; /*logical offset to start*/ - size_t size[H5O_ISTORE_NDIMS]; /*logical chunk size */ + size_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ + size_t size[H5O_LAYOUT_NDIMS]; /*logical chunk size */ } H5F_istore_key_t; typedef struct H5F_istore_ud1_t { H5F_istore_key_t key; /*key values */ haddr_t addr; /*file address of chunk */ - H5O_istore_t mesg; /*storage message */ + H5O_layout_t mesg; /*layout message */ } H5F_istore_ud1_t; /* inherits B-tree like properties from H5B */ @@ -127,7 +128,7 @@ H5F_istore_sizeof_rkey (H5F_t *f, const void *_udata) size_t nbytes; assert (udata); - assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_LAYOUT_NDIMS); nbytes = 4 + /*external file number */ udata->mesg.ndims * 4 + /*dimension indices */ @@ -168,7 +169,7 @@ H5F_istore_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key) assert (bt); assert (raw); assert (key); - assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS); + assert (ndims>0 && ndims<=H5O_LAYOUT_NDIMS); /* decode */ UINT32DECODE (raw, key->file_number); @@ -213,7 +214,7 @@ H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key) assert (bt); assert (raw); assert (key); - assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS); + assert (ndims>0 && ndims<=H5O_LAYOUT_NDIMS); /* encode */ UINT32ENCODE (raw, key->file_number); @@ -261,7 +262,7 @@ H5F_istore_cmp2 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) assert (lt_key); assert (rt_key); assert (udata); - assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ cmp = H5V_vector_cmp (udata->mesg.ndims, lt_key->offset, rt_key->offset); @@ -312,7 +313,7 @@ H5F_istore_cmp3 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) assert (lt_key); assert (rt_key); assert (udata); - assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_LAYOUT_NDIMS); if (H5V_vector_lt (udata->mesg.ndims, udata->key.offset, lt_key->offset)) { cmp = -1; @@ -363,7 +364,7 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op, assert (lt_key); assert (rt_key); assert (udata); - assert (udata->mesg.ndims>=0 && udata->mesg.ndims<H5O_ISTORE_NDIMS); + assert (udata->mesg.ndims>=0 && udata->mesg.ndims<H5O_LAYOUT_NDIMS); assert (addr); /* Allocate new storage */ @@ -543,8 +544,8 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, */ md_key->file_number = udata->key.file_number; for (i=0, nbytes=1; i<udata->mesg.ndims; i++) { - assert (0==udata->key.offset[i] % udata->mesg.alignment[i]); - assert (udata->key.size[i] == udata->mesg.alignment[i]); + assert (0==udata->key.offset[i] % udata->mesg.dim[i]); + assert (udata->key.size[i] == udata->mesg.dim[i]); md_key->offset[i] = udata->key.offset[i]; md_key->size[i] = udata->key.size[i]; nbytes *= udata->key.size[i]; @@ -603,18 +604,18 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, *------------------------------------------------------------------------- */ static herr_t -H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, +H5F_istore_copy_hyperslab (H5F_t *f, const H5O_layout_t *layout, H5F_isop_t op, const size_t offset_f[], const size_t size[], const size_t offset_m[], const size_t size_m[], void *buf) { intn i, carry; - size_t idx_cur[H5O_ISTORE_NDIMS]; - size_t idx_min[H5O_ISTORE_NDIMS]; - size_t idx_max[H5O_ISTORE_NDIMS]; - size_t sub_size[H5O_ISTORE_NDIMS]; - size_t offset_wrt_chunk[H5O_ISTORE_NDIMS]; - size_t sub_offset_m[H5O_ISTORE_NDIMS]; + size_t idx_cur[H5O_LAYOUT_NDIMS]; + size_t idx_min[H5O_LAYOUT_NDIMS]; + size_t idx_max[H5O_LAYOUT_NDIMS]; + size_t sub_size[H5O_LAYOUT_NDIMS]; + size_t offset_wrt_chunk[H5O_LAYOUT_NDIMS]; + size_t sub_offset_m[H5O_LAYOUT_NDIMS]; size_t chunk_size; uint8 *chunk=NULL; H5F_istore_ud1_t udata; @@ -625,60 +626,60 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, /* check args */ assert (f); - assert (istore); - assert (H5F_addr_defined (&(istore->btree_addr))); - assert (istore->ndims>0 && istore->ndims<=H5O_ISTORE_NDIMS); + assert (layout && H5D_CHUNKED==layout->type); + assert (H5F_addr_defined (&(layout->addr))); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert (H5F_ISTORE_READ==op || H5F_ISTORE_WRITE==op); assert (size); assert (size_m); assert (buf); #ifndef NDEBUG - for (i=0; i<istore->ndims; i++) { + for (i=0; i<layout->ndims; i++) { assert (!offset_f || offset_f[i]>=0);/*neg domains unsupported */ assert (!offset_m || offset_m[i]>=0);/*mem array offset never neg */ assert (size[i]>=0); /*size may be zero, implies no-op */ assert (size_m[i]>0); /*destination must exist */ /*hyperslab must fit in BUF*/ assert ((offset_m?offset_m[i]:0)+size[i]<=size_m[i]); - assert (istore->alignment[i]>0); + assert (layout->dim[i]>0); } #endif /* Initialize indices */ - for (i=0; i<istore->ndims; i++) { - idx_min[i] = (offset_f?offset_f[i]:0) / istore->alignment[i]; - idx_max[i] = ((offset_f?offset_f[i]:0)+size[i]-1)/istore->alignment[i]+1; + for (i=0; i<layout->ndims; i++) { + idx_min[i] = (offset_f?offset_f[i]:0) / layout->dim[i]; + idx_max[i] = ((offset_f?offset_f[i]:0)+size[i]-1)/layout->dim[i]+1; idx_cur[i] = idx_min[i]; } /* Allocate buffers */ - for (i=0, chunk_size=1; i<istore->ndims; i++) { - chunk_size *= istore->alignment[i]; + for (i=0, chunk_size=1; i<layout->ndims; i++) { + chunk_size *= layout->dim[i]; } chunk = H5MM_xmalloc (chunk_size); /* Initialize non-changing part of udata */ - udata.mesg = *istore; + udata.mesg = *layout; /* Loop over all chunks */ while (1) { /* Read/Write chunk or create it if it doesn't exist */ - udata.mesg.ndims = istore->ndims; + udata.mesg.ndims = layout->ndims; H5F_addr_undef (&(udata.addr)); udata.key.file_number = 0; - for (i=0; i<istore->ndims; i++) { + for (i=0; i<layout->ndims; i++) { /* The location and size of the chunk being accessed */ - udata.key.offset[i] = idx_cur[i] * istore->alignment[i]; - udata.key.size[i] = istore->alignment[i]; + udata.key.offset[i] = idx_cur[i] * layout->dim[i]; + udata.key.size[i] = layout->dim[i]; /* The offset and size wrt the chunk */ offset_wrt_chunk[i] = MAX ((offset_f?offset_f[i]:0), udata.key.offset[i]) - udata.key.offset[i]; - sub_size[i] = MIN ((idx_cur[i]+1)*istore->alignment[i], + sub_size[i] = MIN ((idx_cur[i]+1)*layout->dim[i], (offset_f?offset_f[i]:0)+size[i]) - (udata.key.offset[i]+offset_wrt_chunk[i]); @@ -689,10 +690,10 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, } if (H5F_ISTORE_WRITE==op) { - status = H5B_insert (f, H5B_ISTORE, &(istore->btree_addr), &udata); + status = H5B_insert (f, H5B_ISTORE, &(layout->addr), &udata); assert (status>=0); } else { - status = H5B_find (f, H5B_ISTORE, &(istore->btree_addr), &udata); + status = H5B_find (f, H5B_ISTORE, &(layout->addr), &udata); } /* @@ -700,8 +701,8 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, * partial chunk then load the chunk from disk. */ if (H5F_ISTORE_READ==op || - !H5V_vector_zerop (istore->ndims, offset_wrt_chunk) || - !H5V_vector_eq (istore->ndims, sub_size, udata.key.size)) { + !H5V_vector_zerop (layout->ndims, offset_wrt_chunk) || + !H5V_vector_eq (layout->ndims, sub_size, udata.key.size)) { if (status>=0 && H5F_addr_defined (&(udata.addr))) { assert (0==udata.key.file_number); if (H5F_block_read (f, &(udata.addr), chunk_size, chunk)<0) { @@ -715,7 +716,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, /* Transfer data to/from the chunk */ if (H5F_ISTORE_WRITE==op) { - H5V_hyper_copy (istore->ndims, sub_size, + H5V_hyper_copy (layout->ndims, sub_size, udata.key.size, offset_wrt_chunk, chunk, size_m, sub_offset_m, buf); assert (0==udata.key.file_number); @@ -724,13 +725,13 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, "unable to write raw storage chunk"); } } else { - H5V_hyper_copy (istore->ndims, sub_size, + H5V_hyper_copy (layout->ndims, sub_size, size_m, sub_offset_m, buf, udata.key.size, offset_wrt_chunk, chunk); } /* Increment indices */ - for (i=istore->ndims-1, carry=1; i>=0 && carry; --i) { + for (i=layout->ndims-1, carry=1; i>=0 && carry; --i) { if (++idx_cur[i]>=idx_max[i]) idx_cur[i] = idx_min[i]; else carry = 0; } @@ -763,19 +764,19 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, *------------------------------------------------------------------------- */ herr_t -H5F_istore_read (H5F_t *f, const H5O_istore_t *istore, +H5F_istore_read (H5F_t *f, const H5O_layout_t *layout, const size_t offset[], const size_t size[], void *buf) { FUNC_ENTER (H5F_istore_read, FAIL); /* Check args */ assert (f); - assert (istore); - assert (istore->ndims>0 && istore->ndims<=H5O_ISTORE_NDIMS); + assert (layout && H5D_CHUNKED==layout->type); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert (size); assert (buf); - if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_READ, + if (H5F_istore_copy_hyperslab (f, layout, H5F_ISTORE_READ, offset, size, H5V_ZERO, size, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "hyperslab output failure"); @@ -803,7 +804,7 @@ H5F_istore_read (H5F_t *f, const H5O_istore_t *istore, *------------------------------------------------------------------------- */ herr_t -H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, +H5F_istore_write (H5F_t *f, const H5O_layout_t *layout, const size_t offset[], const size_t size[], const void *buf) { @@ -811,12 +812,12 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, /* Check args */ assert (f); - assert (istore); - assert (istore->ndims>0 && istore->ndims<=H5O_ISTORE_NDIMS); + assert (layout && H5D_CHUNKED==layout->type); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert (size); assert (buf); - if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_WRITE, + if (H5F_istore_copy_hyperslab (f, layout, H5F_ISTORE_WRITE, offset, size, H5V_ZERO, size, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "hyperslab output failure"); @@ -850,8 +851,7 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, *------------------------------------------------------------------------- */ herr_t -H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore/*out*/, - uintn ndims, const size_t alignment[]) +H5F_istore_create (H5F_t *f, H5O_layout_t *layout/*out*/) { H5F_istore_ud1_t udata; int i; @@ -860,23 +860,18 @@ H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore/*out*/, /* Check args */ assert (f); - assert (istore); - assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS); - assert (alignment); + assert (layout && H5D_CHUNKED==layout->type); + assert (layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); #ifndef NDEBUG - for (i=0; i<ndims; i++) { - assert (alignment[i]>0); + for (i=0; i<layout->ndims; i++) { + assert (layout->dim[i]>0); } #endif - udata.mesg.ndims = istore->ndims = ndims; - if (H5B_create (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) { + udata.mesg.ndims = layout->ndims; + if (H5B_create (f, H5B_ISTORE, &udata, &(layout->addr)/*out*/)<0) { HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree"); } - for (i=0; i<ndims; i++) { - istore->alignment[i] = alignment[i]; - } - FUNC_LEAVE (SUCCEED); } diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 8ec0ab6..acf2e80 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -395,7 +395,7 @@ typedef struct H5F_t { case 2: UINT16DECODE(p,l); break; \ } -struct H5O_istore_t; /*forward decl for prototype arguments*/ +struct H5O_layout_t; /*forward decl for prototype arguments*/ /* library variables */ extern const H5F_create_t H5F_create_dflt; @@ -408,13 +408,21 @@ herr_t H5F_close (H5F_t *f); herr_t H5F_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, intn fwidth); +/* Functions that operate on array storage */ +herr_t H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/); +herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, + const size_t offset[], const size_t size[], + void *buf/*out*/); +herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, + const size_t offset[], const size_t size[], + const void *buf); + /* Functions that operate on indexed storage */ -herr_t H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore, - uintn ndims, const size_t alignment[]); -herr_t H5F_istore_read (H5F_t *f, const struct H5O_istore_t *mesg, +herr_t H5F_istore_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/); +herr_t H5F_istore_read (H5F_t *f, const struct H5O_layout_t *layout, const size_t offset[], const size_t size[], - void *buf); -herr_t H5F_istore_write (H5F_t *f, const struct H5O_istore_t *mesg, + void *buf/*out*/); +herr_t H5F_istore_write (H5F_t *f, const struct H5O_layout_t *layout, const size_t offset[], const size_t size[], const void *buf); @@ -55,10 +55,10 @@ static const H5O_class_t *const message_type_g[] = { NULL, /*0x0002 Data space (fiber bundle?) */ H5O_DTYPE, /*0x0003 Data Type */ NULL, /*0x0004 Not assigned */ - H5O_CSTORE, /*0x0005 Contiguous Data Storage */ + NULL, /*0x0005 Not assigned */ NULL, /*0x0006 Data storage -- compact object */ NULL, /*0x0007 Data storage -- external object */ - H5O_ISTORE, /*0x0008 Indexed Data Storage */ + H5O_LAYOUT, /*0x0008 Data Layout */ H5O_EFL, /*0x0009 External File List */ NULL, /*0x000A Not assigned */ NULL, /*0x000B Data storage -- compressed object */ diff --git a/src/H5Ocstore.c b/src/H5Ocstore.c deleted file mode 100644 index 5cc3215..0000000 --- a/src/H5Ocstore.c +++ /dev/null @@ -1,258 +0,0 @@ -/**************************************************************************** -* NCSA HDF * -* Software Development Group * -* National Center for Supercomputing Applications * -* University of Illinois at Urbana-Champaign * -* 605 E. Springfield, Champaign IL 61820 * -* * -* For conditions of distribution and use, see the accompanying * -* hdf/COPYING file. * -* * -****************************************************************************/ - -/*LINTLIBRARY */ -/*+ - FILE - H5Ocstore.c - HDF5 Contiguous Data Storage Object Header Message routines - - EXPORTED ROUTINES - - LIBRARY-SCOPED ROUTINES - - LOCAL ROUTINES - + */ - -#include <H5private.h> -#include <H5Eprivate.h> -#include <H5Gprivate.h> -#include <H5MMprivate.h> -#include <H5Oprivate.h> - -#define PABLO_MASK H5O_cstore_mask - -/* PRIVATE PROTOTYPES */ -static void *H5O_cstore_decode (H5F_t *f, size_t raw_size, const uint8 *p); -static herr_t H5O_cstore_encode (H5F_t *f, size_t size, uint8 *p, - const void *_mesg); -static void *H5O_cstore_copy (const void *_mesg, void *_dest); -static size_t H5O_cstore_size (H5F_t *f, const void *_mesg); -static herr_t H5O_cstore_debug (H5F_t *f, const void *_mesg, - FILE *stream, intn indent, intn fwidth); - -/* This message derives from H5O */ -const H5O_class_t H5O_CSTORE[1] = {{ - H5O_CSTORE_ID, /* message id number */ - "cstore", /* message name for debugging */ - sizeof (H5O_cstore_t), /* native message size */ - H5O_cstore_decode, /* decode message */ - H5O_cstore_encode, /* encode message */ - H5O_cstore_copy, /* copy the native value */ - H5O_cstore_size, /* size of symbol table entry */ - NULL, /* default reset method */ - H5O_cstore_debug, /* debug the message */ -}}; - -/* Interface initialization */ -static hbool_t interface_initialize_g = FALSE; -#define INTERFACE_INIT NULL - -/*-------------------------------------------------------------------------- - NAME - H5O_cstore_decode - PURPOSE - Decode a contiguous data storage and return a pointer to a memory - struct with the decoded information - USAGE - void *H5O_cstore_decode(f, raw_size, p) - H5F_t *f; IN: pointer to the HDF5 file struct - size_t raw_size; IN: size of the raw information buffer - const uint8 *p; IN: the raw information buffer - RETURNS - Pointer to the new message in native order on success, NULL on failure - DESCRIPTION - This function decodes the "raw" disk form of a contiguous data storage - message into a struct in memory native format. The struct is allocated - within this function using malloc() and is returned to the caller. ---------------------------------------------------------------------------*/ -static void * -H5O_cstore_decode (H5F_t *f, size_t raw_size, const uint8 *p) -{ - H5O_cstore_t *store=NULL; /* New contiguous storage structure */ - - FUNC_ENTER (H5O_cstore_decode, NULL); - - /* check args */ - assert (f); - assert (raw_size == H5F_SIZEOF_ADDR(f)+H5F_SIZEOF_SIZE(f)); - assert (p); - - /* decode */ - if((store = H5MM_xcalloc (1, sizeof(H5O_cstore_t)))!=NULL) - { - H5F_addr_decode (f, &p,&(store->addr)); - H5F_decode_length(f,p,store->size); - } /* end if */ - -#ifdef LATER -done: -#endif /* LATER */ - if(store == NULL) - { /* Error condition cleanup */ - - } /* end if */ - - /* Normal function cleanup */ - - FUNC_LEAVE (store); -} - -/*-------------------------------------------------------------------------- - NAME - H5O_cstore_encode - PURPOSE - Encode a contiguous data storage message - USAGE - herr_t H5O_cstore_encode(f, raw_size, p, mesg) - H5F_t *f; IN: pointer to the HDF5 file struct - size_t raw_size; IN: size of the raw information buffer - const uint8 *p; IN: the raw information buffer - const void *mesg; IN: Pointer to the contiguous storage struct - RETURNS - SUCCEED/FAIL - DESCRIPTION - This function encodes the native memory form of the contiguous data - storage message in the "raw" disk form. ---------------------------------------------------------------------------*/ -static herr_t -H5O_cstore_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *mesg) -{ - const H5O_cstore_t *store = (const H5O_cstore_t *)mesg; - - FUNC_ENTER (H5O_cstore_encode, FAIL); - - /* check args */ - assert (f); - assert (raw_size == H5F_SIZEOF_ADDR(f)+H5F_SIZEOF_SIZE(f)); - assert (p); - assert (store); - - /* encode */ - H5F_addr_encode (f, &p, &(store->addr)); - H5F_encode_length(f,p,store->size); - - FUNC_LEAVE (SUCCEED); -} - -/*-------------------------------------------------------------------------- - NAME - H5O_cstore_copy - PURPOSE - Copies a message from MESG to DEST, allocating DEST if necessary. - USAGE - void *H5O_cstore_copy(mesg, dest) - const void *mesg; IN: Pointer to the source contiguous storage - struct - const void *dest; IN: Pointer to the destination contiguous - storage struct - RETURNS - Pointer to DEST on success, NULL on failure - DESCRIPTION - This function copies a native (memory) contiguous storage message, - allocating the destination structure if necessary. ---------------------------------------------------------------------------*/ -static void * -H5O_cstore_copy (const void *mesg, void *dest) -{ - const H5O_cstore_t *src = (const H5O_cstore_t *)mesg; - H5O_cstore_t *dst = (H5O_cstore_t *)dest; - - FUNC_ENTER (H5O_cstore_copy, NULL); - - /* check args */ - assert (src); - if (!dst) - dst = H5MM_xcalloc (1, sizeof(H5O_cstore_t)); - - /* copy */ - HDmemcpy(dst,src,sizeof(H5O_cstore_t)); - - FUNC_LEAVE ((void*)dst); -} - -/*-------------------------------------------------------------------------- - NAME - H5O_cstore_size - PURPOSE - Return the raw message size in bytes - USAGE - void *H5O_cstore_copy(f, mesg) - H5F_t *f; IN: pointer to the HDF5 file struct - const void *mesg; IN: Pointer to the source contiguous storage - struct - RETURNS - Size of message on success, FAIL on failure - DESCRIPTION - This function returns the size of the raw contiguous storage message on - success. (Not counting the message type or size fields, only the data - portion of the message). It doesn't take into account alignment. ---------------------------------------------------------------------------*/ -static size_t -H5O_cstore_size (H5F_t *f, const void *mesg) -{ - size_t ret_value; - - FUNC_ENTER (H5O_cstore_size, FAIL); - - /* All contiguous data storage messages have the same data */ - ret_value=H5F_SIZEOF_ADDR(f)+H5F_SIZEOF_SIZE(f); - - FUNC_LEAVE (ret_value); -} - -/*-------------------------------------------------------------------------- - NAME - H5O_cstore_debug - PURPOSE - Prints debugging information for a contiguous storage message - USAGE - void *H5O_cstore_debug(f, mesg, stream, indent, fwidth) - H5F_t *f; IN: pointer to the HDF5 file struct - const void *mesg; IN: Pointer to the source contiguous storage - struct - FILE *stream; IN: Pointer to the stream for output data - intn indent; IN: Amount to indent information by - intn fwidth; IN: Field width (?) - RETURNS - SUCCEED/FAIL - DESCRIPTION - This function prints debugging output to the stream passed as a - parameter. ---------------------------------------------------------------------------*/ -static herr_t -H5O_cstore_debug (H5F_t *f, const void *mesg, FILE *stream, - intn indent, intn fwidth) -{ - const H5O_cstore_t *store = (const H5O_cstore_t *)mesg; - - FUNC_ENTER (H5O_cstore_debug, FAIL); - - /* check args */ - assert (f); - assert (store); - assert (stream); - assert (indent>=0); - assert (fwidth>=0); - - fprintf (stream, "%*s%-*s ", indent, "", fwidth, - "Address:"); - H5F_addr_print (stream, &(store->addr)); - fprintf (stream, "\n"); - - fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Size (bytes):", - (unsigned long)(store->size)); - - FUNC_LEAVE (SUCCEED); -} - diff --git a/src/H5Oistore.c b/src/H5Olayout.c index ea65578..0d1ed2e 100644 --- a/src/H5Oistore.c +++ b/src/H5Olayout.c @@ -2,47 +2,49 @@ * Copyright (C) 1997 NCSA * All rights reserved. * - * Programmer: Robb Matzke <matzke@llnl.gov> - * Wednesday, October 8, 1997 + * Programmer: Robb Matzke <matzke@llnl.gov> + * Wednesday, October 8, 1997 + * + * Purpose: Messages related to data layout. */ #include <H5private.h> +#include <H5Dprivate.h> #include <H5Eprivate.h> #include <H5MMprivate.h> #include <H5Oprivate.h> -#define PABLO_MASK H5O_istore_mask - /* PRIVATE PROTOTYPES */ -static void *H5O_istore_decode (H5F_t *f, size_t raw_size, const uint8 *p); -static herr_t H5O_istore_encode (H5F_t *f, size_t size, uint8 *p, +static void *H5O_layout_decode (H5F_t *f, size_t raw_size, const uint8 *p); +static herr_t H5O_layout_encode (H5F_t *f, size_t size, uint8 *p, const void *_mesg); -static void *H5O_istore_copy (const void *_mesg, void *_dest); -static size_t H5O_istore_size (H5F_t *f, const void *_mesg); -static herr_t H5O_istore_debug (H5F_t *f, const void *_mesg, FILE *stream, +static void *H5O_layout_copy (const void *_mesg, void *_dest); +static size_t H5O_layout_size (H5F_t *f, const void *_mesg); +static herr_t H5O_layout_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent, intn fwidth); /* This message derives from H5O */ -const H5O_class_t H5O_ISTORE[1] = {{ - H5O_ISTORE_ID, /*message id number */ - "istore", /*message name for debugging */ - sizeof(H5O_istore_t), /*native message size */ - H5O_istore_decode, /*decode message */ - H5O_istore_encode, /*encode message */ - H5O_istore_copy, /*copy the native value */ - H5O_istore_size, /*size of message on disk */ +const H5O_class_t H5O_LAYOUT[1] = {{ + H5O_LAYOUT_ID, /*message id number */ + "layout", /*message name for debugging */ + sizeof(H5O_layout_t), /*native message size */ + H5O_layout_decode, /*decode message */ + H5O_layout_encode, /*encode message */ + H5O_layout_copy, /*copy the native value */ + H5O_layout_size, /*size of message on disk */ NULL, /*reset method */ - H5O_istore_debug, /*debug the message */ + H5O_layout_debug, /*debug the message */ }}; /* Interface initialization */ +#define PABLO_MASK H5O_layout_mask static hbool_t interface_initialize_g = FALSE; #define INTERFACE_INIT NULL /*------------------------------------------------------------------------- - * Function: H5O_istore_decode + * Function: H5O_layout_decode * - * Purpose: Decode an indexed storage message and return a pointer to a + * Purpose: Decode an data layout message and return a pointer to a * new one created with malloc(). * * Return: Success: Ptr to new message in native order. @@ -57,38 +59,41 @@ static hbool_t interface_initialize_g = FALSE; *------------------------------------------------------------------------- */ static void * -H5O_istore_decode (H5F_t *f, size_t raw_size, const uint8 *p) +H5O_layout_decode (H5F_t *f, size_t raw_size, const uint8 *p) { - H5O_istore_t *mesg = NULL; + H5O_layout_t *mesg = NULL; intn i; - FUNC_ENTER (H5O_istore_decode, NULL); + FUNC_ENTER (H5O_layout_decode, NULL); /* check args */ assert (f); assert (p); /* decode */ - mesg = H5MM_xcalloc (1, sizeof(H5O_istore_t)); - H5F_addr_decode (f, &p, &(mesg->btree_addr)); + mesg = H5MM_xcalloc (1, sizeof(H5O_layout_t)); + H5F_addr_decode (f, &p, &(mesg->addr)); mesg->ndims = *p++; - assert (raw_size == H5O_istore_size (f, mesg)); + assert (raw_size == H5O_layout_size (f, mesg)); + + /* Layout class */ + mesg->type = *p++; + assert (H5D_CONTIGUOUS==mesg->type || H5D_CHUNKED==mesg->type); /* Reserved bytes */ - p += 7; + p += 6; - /* Read the min_corner, max_corner, and alignment values */ + /* Read the size */ for (i=0; i<mesg->ndims; i++) { - UINT32DECODE (p, mesg->alignment[i]); + UINT32DECODE (p, mesg->dim[i]); } FUNC_LEAVE (mesg); } - /*------------------------------------------------------------------------- - * Function: H5O_istore_encode + * Function: H5O_layout_encode * * Purpose: Encodes a message. * @@ -104,41 +109,43 @@ H5O_istore_decode (H5F_t *f, size_t raw_size, const uint8 *p) *------------------------------------------------------------------------- */ static herr_t -H5O_istore_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg) +H5O_layout_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg) { - const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; + const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg; int i; - FUNC_ENTER (H5O_istore_encode, FAIL); + FUNC_ENTER (H5O_layout_encode, FAIL); /* check args */ assert (f); assert (mesg); - assert (mesg->ndims>0 && mesg->ndims<=H5O_ISTORE_NDIMS); - assert (raw_size == H5O_istore_size (f, _mesg)); + assert (mesg->ndims>0 && mesg->ndims<=H5O_LAYOUT_NDIMS); + assert (raw_size == H5O_layout_size (f, _mesg)); assert (p); - /* encode B-tree offset */ - H5F_addr_encode (f, &p, &(mesg->btree_addr)); + /* data or B-tree address */ + H5F_addr_encode (f, &p, &(mesg->addr)); /* number of dimensions */ *p++ = mesg->ndims; + /* layout class */ + *p++ = mesg->type; + /* reserved bytes should be zero */ - for (i=0; i<7; i++) *p++ = 0; + for (i=0; i<6; i++) *p++ = 0; - /* min_corner, max_corner, and alignment */ + /* dimension size */ for (i=0; i<mesg->ndims; i++) { - UINT32ENCODE (p, mesg->alignment[i]); + UINT32ENCODE (p, mesg->dim[i]); } FUNC_LEAVE (SUCCEED); } - /*------------------------------------------------------------------------- - * Function: H5O_istore_copy + * Function: H5O_layout_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -155,16 +162,16 @@ H5O_istore_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg) *------------------------------------------------------------------------- */ static void * -H5O_istore_copy (const void *_mesg, void *_dest) +H5O_layout_copy (const void *_mesg, void *_dest) { - const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; - H5O_istore_t *dest = (H5O_istore_t *)_dest; + const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg; + H5O_layout_t *dest = (H5O_layout_t *)_dest; - FUNC_ENTER (H5O_istore_copy, NULL); + FUNC_ENTER (H5O_layout_copy, NULL); /* check args */ assert (mesg); - if (!dest) dest = H5MM_xcalloc (1, sizeof(H5O_istore_t)); + if (!dest) dest = H5MM_xcalloc (1, sizeof(H5O_layout_t)); /* copy */ *dest = *mesg; @@ -172,10 +179,9 @@ H5O_istore_copy (const void *_mesg, void *_dest) FUNC_LEAVE ((void*)dest); } - /*------------------------------------------------------------------------- - * Function: H5O_istore_size + * Function: H5O_layout_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. This @@ -193,30 +199,30 @@ H5O_istore_copy (const void *_mesg, void *_dest) *------------------------------------------------------------------------- */ static size_t -H5O_istore_size (H5F_t *f, const void *_mesg) +H5O_layout_size (H5F_t *f, const void *_mesg) { - const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; + const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg; size_t ret_value = FAIL; - FUNC_ENTER (H5O_istore_size, FAIL); + FUNC_ENTER (H5O_layout_size, FAIL); /* check args */ assert (f); assert (mesg); - assert (mesg->ndims>0 && mesg->ndims<=H5O_ISTORE_NDIMS); + assert (mesg->ndims>0 && mesg->ndims<=H5O_LAYOUT_NDIMS); ret_value = H5F_SIZEOF_ADDR (f) + /* B-tree address */ 1 + /* max dimension index */ - 7 + /* reserved bytes */ + 1 + /* layout class number */ + 6 + /* reserved bytes */ mesg->ndims * 4; /* alignment */ FUNC_LEAVE (ret_value); } - /*------------------------------------------------------------------------- - * Function: H5O_istore_debug + * Function: H5O_layout_debug * * Purpose: Prints debugging info for a message. * @@ -232,13 +238,13 @@ H5O_istore_size (H5F_t *f, const void *_mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_istore_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent, +H5O_layout_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent, intn fwidth) { - const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; + const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg; intn i; - FUNC_ENTER (H5O_istore_debug, FAIL); + FUNC_ENTER (H5O_layout_debug, FAIL); /* check args */ assert (f); @@ -248,20 +254,20 @@ H5O_istore_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent, assert (fwidth>=0); fprintf (stream, "%*s%-*s ", indent, "", fwidth, - "B-tree address:"); - H5F_addr_print (stream, &(mesg->btree_addr)); + H5D_CHUNKED==mesg->type?"B-tree address:":"Data address:"); + H5F_addr_print (stream, &(mesg->addr)); fprintf (stream, "\n"); fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, "Number of dimensions:", (unsigned long)(mesg->ndims)); - /* Alignment */ + /* Size */ fprintf (stream, "%*s%-*s {", indent, "", fwidth, - "Alignment:"); + "Size:"); for (i=0; i<mesg->ndims; i++) { fprintf (stream, "%s%lu", i?", ":"", - (unsigned long)(mesg->alignment[i])); + (unsigned long)(mesg->dim[i])); } fprintf (stream, "}\n"); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index fade4b4..cf23fc6 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -109,28 +109,18 @@ extern const H5O_class_t H5O_DTYPE[1]; /* operates on an H5T_t struct */ /* - * Contiguous Data Storage Message. + * Data Layout Message */ -#define H5O_CSTORE_ID 0x0005 -extern const H5O_class_t H5O_CSTORE[1]; +#define H5O_LAYOUT_ID 0x0008 +#define H5O_LAYOUT_NDIMS 32 +extern const H5O_class_t H5O_LAYOUT[1]; -typedef struct H5O_cstore_t { - haddr_t addr; - size_t size; -} H5O_cstore_t; - -/* - * Indexed Data Storage Message. - */ -#define H5O_ISTORE_ID 0x0008 -#define H5O_ISTORE_NDIMS 32 -extern const H5O_class_t H5O_ISTORE[1]; - -typedef struct H5O_istore_t { - haddr_t btree_addr; /*file address of B-tree */ +typedef struct H5O_layout_t { + int type; /*type of layout, H5D_layout_t */ + haddr_t addr; /*file address of data or B-tree*/ uintn ndims; /*num dimensions in stored data */ - size_t alignment[H5O_ISTORE_NDIMS]; /*algn in logical space */ -} H5O_istore_t; + size_t dim[H5O_LAYOUT_NDIMS]; /*size of data or chunk */ +} H5O_layout_t; /* * External File List Message @@ -11,7 +11,7 @@ #include <H5Oprivate.h> #include <H5Vprivate.h> -#define H5V_HYPER_NDIMS H5O_ISTORE_NDIMS +#define H5V_HYPER_NDIMS H5O_LAYOUT_NDIMS #define PABLO_MASK H5V_mask static hbool_t interface_initialize_g = TRUE; #define INTERFACE_INIT NULL diff --git a/src/Makefile.in b/src/Makefile.in index b0dc57f..7bb2f81 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -14,10 +14,10 @@ LIB=libhdf5.a PROGS=debug # Source and object files for the library (lexicographically)... -LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5E.c H5F.c H5Fcore.c H5Ffamily.c \ - H5Fistore.c H5Flow.c H5Fsec2.c H5Fsplit.c H5Fstdio.c H5G.c H5Gent.c \ - H5Gnode.c H5Gstab.c H5H.c H5M.c H5MF.c H5MM.c H5O.c H5Ocont.c \ - H5Ocstore.c H5Odtype.c H5Oefl.c H5Oistore.c H5Oname.c H5Onull.c \ +LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5E.c H5F.c H5Farray.c H5Fcore.c \ + H5Ffamily.c H5Fistore.c H5Flow.c H5Fsec2.c H5Fsplit.c H5Fstdio.c \ + H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5H.c H5M.c H5MF.c H5MM.c H5O.c \ + H5Ocont.c H5Odtype.c H5Oefl.c H5Olayout.c H5Oname.c H5Onull.c \ H5Osdspace.c H5Ostab.c H5P.c H5T.c H5Tconv.c H5Tinit.c H5V.c LIB_OBJ=$(LIB_SRC:.c=.o) diff --git a/test/dsets.c b/test/dsets.c index 45aff80..9e024af 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -231,7 +231,8 @@ test_simple_io (hid_t file) assert (dataset>=0); /* Write the data to the dataset */ - status = H5Dwrite (dataset, H5T_NATIVE_INT, H5P_ALL, H5C_DEFAULT, points); + status = H5Dwrite (dataset, H5T_NATIVE_INT, H5P_ALL, H5P_ALL, + H5C_DEFAULT, points); if (status<0) { puts ("*FAILED*"); if (!isatty (1)) { @@ -242,7 +243,8 @@ test_simple_io (hid_t file) } /* Read the dataset back */ - status = H5Dread (dataset, H5T_NATIVE_INT, H5P_ALL, H5C_DEFAULT, check); + status = H5Dread (dataset, H5T_NATIVE_INT, H5P_ALL, H5P_ALL, + H5C_DEFAULT, check); if (status<0) { puts ("*FAILED*"); if (!isatty (1)) { @@ -321,7 +323,8 @@ test_tconv (hid_t file) assert (dataset>=0); /* Write the data to the dataset */ - status = H5Dwrite (dataset, H5T_NATIVE_INT32, H5P_ALL, H5C_DEFAULT, out); + status = H5Dwrite (dataset, H5T_NATIVE_INT32, H5P_ALL, H5P_ALL, + H5C_DEFAULT, out); assert (status>=0); /* Create a new type with the opposite byte order */ @@ -339,7 +342,7 @@ test_tconv (hid_t file) } /* Read data with byte order conversion */ - status = H5Dread (dataset, type, H5P_ALL, H5C_DEFAULT, in); + status = H5Dread (dataset, type, H5P_ALL, H5P_ALL, H5C_DEFAULT, in); assert (status>=0); /* Check */ diff --git a/test/istore.c b/test/istore.c index 74154fc..8f246c8 100644 --- a/test/istore.c +++ b/test/istore.c @@ -99,8 +99,7 @@ print_array (uint8 *array, size_t nx, size_t ny, size_t nz) static int new_object (H5F_t *f, const char *name, size_t ndims, H5G_entry_t *ent/*out*/) { - H5O_istore_t istore; - size_t alignment[H5O_ISTORE_NDIMS]; + H5O_layout_t layout; intn i; /* Create the object header */ @@ -113,16 +112,18 @@ new_object (H5F_t *f, const char *name, size_t ndims, H5G_entry_t *ent/*out*/) return -1; } - /* Add the indexed-storage message */ + /* create chunked storage */ + layout.type = H5D_CHUNKED; + layout.ndims = ndims; for (i=0; i<ndims; i++) { if (i<NELMTS (align_g)) { - alignment[i] = align_g[i]; + layout.dim[i] = align_g[i]; } else { - alignment[i] = 2; + layout.dim[i] = 2; } } - H5F_istore_create (f, &istore, ndims, alignment); - if (H5O_modify (ent, H5O_ISTORE, H5O_NEW_MESG, 0, &istore)<0) { + H5F_arr_create (f, &layout/*in,out*/); + if (H5O_modify (ent, H5O_LAYOUT, H5O_NEW_MESG, 0, &layout)<0) { printf ("*FAILED*\n"); if (!isatty (1)) { AT(); @@ -174,7 +175,7 @@ test_create (H5F_t *f, const char *prefix) printf ("%-70s", "Testing istore create"); - for (i=1; i<=H5O_ISTORE_NDIMS; i++) { + for (i=1; i<=H5O_LAYOUT_NDIMS; i++) { sprintf (name, "%s_%02d", prefix, i); if (new_object (f, name, i, &handle)<0) return FAIL; } @@ -216,7 +217,7 @@ test_extend (H5F_t *f, const char *prefix, size_t size[3]; size_t whole_size[3]; size_t nelmts; - H5O_istore_t istore; + H5O_layout_t layout; if (!nz) { if (!ny) { @@ -250,7 +251,7 @@ test_extend (H5F_t *f, const char *prefix, } goto error; } - if (NULL==H5O_read (&handle, H5O_ISTORE, 0, &istore)) { + if (NULL==H5O_read (&handle, H5O_LAYOUT, 0, &layout)) { puts ("*FAILED*"); if (!isatty (1)) { AT (); @@ -258,7 +259,7 @@ test_extend (H5F_t *f, const char *prefix, } goto error; } - if (ndims!=istore.ndims) { + if (ndims!=layout.ndims) { puts ("*FAILED*"); if (!isatty (1)) { AT (); @@ -312,7 +313,7 @@ test_extend (H5F_t *f, const char *prefix, memset (buf, 128+ctr, nelmts); /* Write to disk */ - if (H5F_istore_write (f, &istore, offset, size, buf)<0) { + if (H5F_arr_write (f, &layout, offset, size, buf)<0) { puts ("*FAILED*"); if (!isatty (1)) { AT (); @@ -323,7 +324,7 @@ test_extend (H5F_t *f, const char *prefix, /* Read from disk */ memset (check, 0xff, nelmts); - if (H5F_istore_read (f, &istore, offset, size, check)<0) { + if (H5F_arr_read (f, &layout, offset, size, check)<0) { puts ("*FAILED*"); if (!isatty (1)) { AT (); @@ -357,7 +358,7 @@ test_extend (H5F_t *f, const char *prefix, /* Now read the entire array back out and check it */ memset (buf, 0xff, nx*ny*nz); - if (H5F_istore_read (f, &istore, H5V_ZERO, whole_size, buf)<0) { + if (H5F_arr_read (f, &layout, H5V_ZERO, whole_size, buf)<0) { puts ("*FAILED*"); if (!isatty (1)) { AT (); @@ -426,7 +427,7 @@ test_sparse (H5F_t *f, const char *prefix, size_t nblocks, char dims[64], s[256], name[256]; size_t offset[3], size[3], total=0; H5G_entry_t handle; - H5O_istore_t istore; + H5O_layout_t layout; uint8 *buf = NULL; if (!nz) { @@ -458,7 +459,7 @@ test_sparse (H5F_t *f, const char *prefix, size_t nblocks, } goto error; } - if (NULL==H5O_read (&handle, H5O_ISTORE, 0, &istore)) { + if (NULL==H5O_read (&handle, H5O_LAYOUT, 0, &layout)) { puts ("*FAILED*"); if (!isatty (1)) { AT (); @@ -477,7 +478,7 @@ test_sparse (H5F_t *f, const char *prefix, size_t nblocks, memset (buf, 128+ctr, nx*ny*nz); /* write to disk */ - if (H5F_istore_write (f, &istore, offset, size, buf)<0) { + if (H5F_arr_write (f, &layout, offset, size, buf)<0) { puts ("*FAILED*"); if (!isatty (1)) { AT (); |