From ba28c64ba7b36ee8a98c2f312f87fa1424f9a07c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 10 Oct 2000 02:43:38 -0500 Subject: [svn-r2652] Purpose: Maintainance & performance enhancements Description: Re-arranged header files to protect private symbols better. Changed optimized regular hyperslab I/O to compute the offsets more efficiently from previous method of using matrix operations. Added sequential I/O operations at a more abstract level (at the same level as H5F_arr_read/write), to support the optimized hyperslab I/O. Platforms tested: Solaris 2.6 (baldric) & FreeBSD 4.1.1 (hawkwind) --- src/H5.c | 4 +- src/H5A.c | 5 +- src/H5AC.c | 4 + src/H5Apkg.h | 3 +- src/H5B.c | 5 +- src/H5D.c | 44 ++++- src/H5Dcontig.c | 13 +- src/H5Distore.c | 13 +- src/H5Dprivate.h | 24 +++ src/H5Dseq.c | 494 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5F.c | 111 +++++++++--- src/H5FD.c | 6 +- src/H5FDcore.c | 1 + src/H5FDdpss.c | 5 +- src/H5FDfamily.c | 1 + src/H5FDgass.c | 1 + src/H5FDlog.c | 5 +- src/H5FDlog.h | 2 +- src/H5FDmpio.c | 1 + src/H5FDsec2.c | 1 + src/H5FDsrb.c | 1 + src/H5Farray.c | 13 +- src/H5Fcontig.c | 13 +- src/H5Fistore.c | 13 +- src/H5Fpkg.h | 212 +++++++++++++++++++++++ src/H5Fprivate.h | 381 +++++++++++------------------------------ src/H5Fseq.c | 494 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5G.c | 4 + src/H5Gent.c | 8 +- src/H5Gnode.c | 7 +- src/H5Gstab.c | 2 + src/H5HG.c | 17 +- src/H5HL.c | 22 +-- src/H5MF.c | 4 +- src/H5MFprivate.h | 1 + src/H5O.c | 4 +- src/H5Oattr.c | 4 +- src/H5Ocont.c | 5 +- src/H5Oefl.c | 15 +- src/H5Oprivate.h | 4 +- src/H5Osdspace.c | 19 ++- src/H5Oshared.c | 1 + src/H5P.c | 37 ++-- src/H5Pprivate.h | 2 +- src/H5Ppublic.h | 1 + src/H5R.c | 4 +- src/H5S.c | 40 ++++- src/H5Sall.c | 5 +- src/H5Shyper.c | 144 ++++++++++------ src/H5Smpio.c | 4 +- src/H5Snone.c | 5 +- src/H5Spkg.h | 234 ++++++++++++++++++++++++++ src/H5Spoint.c | 5 +- src/H5Sprivate.h | 229 ++----------------------- src/H5Sselect.c | 4 +- src/H5Tconv.c | 4 +- src/H5Tpkg.h | 11 +- src/H5Tvlen.c | 8 +- src/Makefile.in | 16 +- 59 files changed, 2023 insertions(+), 717 deletions(-) create mode 100644 src/H5Dseq.c create mode 100644 src/H5Fpkg.h create mode 100644 src/H5Fseq.c create mode 100644 src/H5Spkg.h diff --git a/src/H5.c b/src/H5.c index be91357..331c9d0 100644 --- a/src/H5.c +++ b/src/H5.c @@ -1823,8 +1823,8 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) /*Save the rank of simple data spaces for arrays*/ { H5S_t *space = H5I_object(obj); - if (H5S_SIMPLE==space->extent.type) { - asize[argno] = space->extent.u.simple.rank; + if (H5S_SIMPLE==H5S_get_simple_extent_type(space)) { + asize[argno] = H5S_get_simple_extent_ndims(space); } } break; diff --git a/src/H5A.c b/src/H5A.c index d7135e1..fdede04 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -17,6 +17,7 @@ static char RcsId[] = "$Revision$"; /* $Id$ */ #define H5A_PACKAGE /*suppress error about including H5Apkg */ +#define H5S_PACKAGE /*suppress error about including H5Spkg */ /* Private header files */ #include /* Generic Functions */ @@ -29,6 +30,7 @@ static char RcsId[] = "$Revision$"; #include /* Memory management */ #include /* Property lists */ #include /* Object Headers */ +#include /* Data-space functions */ #include /* Attributes */ #define PABLO_MASK H5A_mask @@ -254,8 +256,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, /* Compute the internal sizes */ attr->dt_size=(H5O_DTYPE[0].raw_size)(attr->ent.file,type); - attr->ds_size=(H5O_SDSPACE[0].raw_size)(attr->ent.file, - &(space->extent.u.simple)); + attr->ds_size=(H5O_SDSPACE[0].raw_size)(attr->ent.file,&(space->extent.u.simple)); attr->data_size=H5S_get_simple_extent_npoints(space)*H5T_get_size(type); /* Hold the symbol table entry (and file) open */ diff --git a/src/H5AC.c b/src/H5AC.c index 290938b..e148912 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -23,9 +23,13 @@ * *------------------------------------------------------------------------- */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include #include +#include #include /*Free Lists */ #include diff --git a/src/H5Apkg.h b/src/H5Apkg.h index a0af7aa..c5497a2 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -23,8 +23,9 @@ # undef H5A_DEBUG #endif -#include #include +#include +#include struct H5A_t { uintn initialized;/* Indicate whether the attribute has been modified */ diff --git a/src/H5B.c b/src/H5B.c index 1b91975..6c52bd6 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -86,12 +86,15 @@ * *------------------------------------------------------------------------- */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + /* private headers */ #include /*library */ #include /*cache */ #include /*B-link trees */ #include /*error handling */ -#include /*file access */ +#include /*file access */ #include /*Free Lists */ #include /*file memory management */ #include /*core memory management */ diff --git a/src/H5D.c b/src/H5D.c index 5e6b3ce..ec8bf0f 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -76,6 +76,32 @@ const H5D_create_t H5D_create_dflt = { {0, 0, NULL} /* No filters in pipeline */ }; +/* Default data transfer property list */ +/* Not const anymore because some of the VFL drivers modify this struct - QAK */ +H5D_xfer_t H5D_xfer_dflt = { + 1024*1024, /*Temporary buffer size */ + NULL, /*Type conversion buffer or NULL */ + NULL, /*Background buffer or NULL */ + H5T_BKG_NO, /*Type of background buffer needed */ + {0.1, 0.5, 0.9}, /*B-tree node splitting ratios */ +#ifndef H5_HAVE_PARALLEL + 1, /*Cache the hyperslab blocks */ +#else + 0, /*Don't cache the hyperslab blocks */ +#endif /* H5_HAVE_PARALLEL */ + 0, /*No limit on hyperslab block size to cache */ + NULL, /*Use malloc() for VL data allocations */ + NULL, /*No information needed for malloc() calls */ + NULL, /*Use free() for VL data frees */ + NULL, /*No information needed for free() calls */ + -2, /*See H5Pget_driver() */ + NULL, /*No file driver-specific information yet */ +#ifdef COALESCE_READS + 0, /*coalesce single reads into a read */ + /*transaction */ +#endif +}; + /* Interface initialization? */ static intn interface_initialize_g = 0; #define INTERFACE_INIT H5D_init_interface @@ -1407,7 +1433,7 @@ H5D_open_oid(H5G_entry_t *ent) * This is especially important for parallel I/O where the B-tree must * be fully populated before I/O can happen. */ - if ((dataset->ent.file->intent & H5F_ACC_RDWR) && + if ((H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR) && H5D_CHUNKED==dataset->layout.type) { if (H5D_init_storage(dataset, space)<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, @@ -1526,7 +1552,7 @@ herr_t H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, void *buf/*out*/) { - const H5F_xfer_t *xfer_parms = NULL; + const H5D_xfer_t *xfer_parms = NULL; hssize_t nelmts; /*number of elements */ size_t smine_start; /*strip mine start loc */ size_t n, smine_nelmts; /*elements per strip */ @@ -1566,7 +1592,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Get the dataset transfer property list */ if (H5P_DEFAULT == dxpl_id) { - xfer_parms = &H5F_xfer_dflt; + xfer_parms = &H5D_xfer_dflt; } else if (H5P_DATA_XFER != H5P_get_class(dxpl_id) || NULL == (xfer_parms = H5I_object(dxpl_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); @@ -1902,7 +1928,7 @@ herr_t H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf) { - const H5F_xfer_t *xfer_parms = NULL; + const H5D_xfer_t *xfer_parms = NULL; hssize_t nelmts; /*total number of elmts */ size_t smine_start; /*strip mine start loc */ size_t n, smine_nelmts; /*elements per strip */ @@ -1967,13 +1993,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Get the dataset transfer property list */ if (H5P_DEFAULT == dxpl_id) { - xfer_parms = &H5F_xfer_dflt; + xfer_parms = &H5D_xfer_dflt; } else if (H5P_DATA_XFER != H5P_get_class(dxpl_id) || NULL == (xfer_parms = H5I_object(dxpl_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); } - if (0==(dataset->ent.file->intent & H5F_ACC_RDWR)) { + if (0==(H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR)) { HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file"); } @@ -2768,8 +2794,8 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) { - H5F_xfer_t tmp_xfer_parms; /* Temporary copy of the default xfer parms */ - H5F_xfer_t *xfer_parms = NULL; /* xfer parms as iterator op_data */ + H5D_xfer_t tmp_xfer_parms; /* Temporary copy of the default xfer parms */ + H5D_xfer_t *xfer_parms = NULL; /* xfer parms as iterator op_data */ herr_t ret_value=FAIL; FUNC_ENTER(H5Dvlen_reclaim, FAIL); @@ -2784,7 +2810,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) /* Retrieve dataset transfer property list */ if (H5P_DEFAULT == plist_id) { - HDmemcpy(&tmp_xfer_parms,&H5F_xfer_dflt,sizeof(H5F_xfer_t)); + HDmemcpy(&tmp_xfer_parms,&H5D_xfer_dflt,sizeof(H5D_xfer_t)); xfer_parms = &tmp_xfer_parms; } else if (H5P_DATA_XFER != H5P_get_class(plist_id) || NULL == (xfer_parms = H5I_object(plist_id))) { diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index d4430c0..b4f4ab1 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -11,9 +11,12 @@ * H5F_seg_read/write. * */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include -#include +#include #include /*file driver */ #include @@ -244,8 +247,8 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, f->shared->sieve_size=0; } /* end if */ - /* Write directly from the user's buffer */ - if (H5F_block_write(f, H5FD_MEM_DRAW, addr, size, dxpl_id, buf)<0) { + /* Write directly to the user's buffer */ + if (H5F_block_write(f, type, addr, size, dxpl_id, buf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } @@ -293,7 +296,7 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, else { /* Check if we can actually hold the I/O request in the sieve buffer */ if(size>f->shared->sieve_buf_size) { - if (H5F_block_write(f, H5FD_MEM_DRAW, addr, size, dxpl_id, buf)<0) { + if (H5F_block_write(f, type, addr, size, dxpl_id, buf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } @@ -330,7 +333,7 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, } /* end else */ } /* end if */ else { - if (H5F_block_write(f, H5FD_MEM_DRAW, addr, size, dxpl_id, buf)<0) { + if (H5F_block_write(f, type, addr, size, dxpl_id, buf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } diff --git a/src/H5Distore.c b/src/H5Distore.c index 06667bc..42c6aad 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -29,10 +29,13 @@ * entries near the front of the list to make room for the new * entry which is added to the end of the list. */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include #include -#include +#include #include /*Free Lists */ #include #include @@ -1498,8 +1501,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->chunk = chunk; { - H5F_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5F_xfer_dflt : (H5F_xfer_t *)H5I_object(dxpl_id); + H5D_xfer_t *dxpl; + dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); ent->split_ratios[0] = dxpl->split_ratios[0]; ent->split_ratios[1] = dxpl->split_ratios[1]; ent->split_ratios[2] = dxpl->split_ratios[2]; @@ -1640,8 +1643,8 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, x.alloc_size = x.chunk_size; x.chunk = chunk; { - H5F_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5F_xfer_dflt : (H5F_xfer_t *)H5I_object(dxpl_id); + H5D_xfer_t *dxpl; + dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); x.split_ratios[0] = dxpl->split_ratios[0]; x.split_ratios[1] = dxpl->split_ratios[1]; x.split_ratios[2] = dxpl->split_ratios[2]; diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 4fc441e..5efe8e6 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -22,6 +22,7 @@ #include #include /*for the H5F_t type */ #include /*symbol tables */ +#include /*for H5MM_allocate_t and H5MM_free_t types */ #include /*object Headers */ #include /*for the H5S_t type */ #include /*for the H5T_t type */ @@ -50,9 +51,32 @@ typedef struct H5D_create_t { H5O_pline_t pline; /*data filter pipeline */ } H5D_create_t; +/* Data transfer property list */ +typedef struct H5D_xfer_t { + size_t buf_size; /*max temp buffer size */ + void *tconv_buf; /*type conversion buffer or null */ + void *bkg_buf; /*background buffer or null */ + H5T_bkg_t need_bkg; /*type of background buffer needed */ + double split_ratios[3];/*B-tree node splitting ratios */ + uintn cache_hyper; /*cache hyperslab blocks during I/O? */ + uintn block_limit; /*largest hyperslab block to cache */ + H5MM_allocate_t vlen_alloc; /*VL datatype allocation function */ + void *alloc_info; /*VL datatype allocation information */ + H5MM_free_t vlen_free; /*VL datatype free function */ + void *free_info; /*VL datatype free information */ + hid_t driver_id; /*File driver ID */ + void *driver_info; /*File driver specific information */ +#ifdef COALESCE_READS + uintn gather_reads; /*coalesce single reads into a read */ + /*transaction */ +#endif +} H5D_xfer_t; + typedef struct H5D_t H5D_t; +/* library variables */ __DLLVAR__ const H5D_create_t H5D_create_dflt; +__DLLVAR__ H5D_xfer_t H5D_xfer_dflt; /* Functions defined in H5D.c */ __DLL__ herr_t H5D_init(void); diff --git a/src/H5Dseq.c b/src/H5Dseq.c new file mode 100644 index 0000000..9aa3a48 --- /dev/null +++ b/src/H5Dseq.c @@ -0,0 +1,494 @@ +/* + * Copyright (C) 2000 NCSA + * All rights reserved. + * + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 + * + * Purpose: Provides I/O facilities for sequences of bytes stored with various + * layout policies. These routines are similar to the H5Farray.c routines, + * these deal in terms of byte offsets and lengths, not coordinates and + * hyperslab sizes. + * + */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + +#include +#include +#include +#include +#include /*file driver */ +#include +#include +#include /*memory management */ +#include +#include +#include + +/* MPIO driver functions are needed for some special checks */ +#include + +/* Interface initialization */ +#define PABLO_MASK H5Fseq_mask +#define INTERFACE_INIT NULL +static intn interface_initialize_g = 0; + + +/*------------------------------------------------------------------------- + * Function: H5F_seq_read + * + * Purpose: Reads a sequence of bytes from a file dataset into a buffer in + * in memory. The data is read from file F and the array's size and + * storage information is in LAYOUT. External files are described + * according to the external file list, EFL. The sequence offset is + * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are + * in terms of bytes) and the size of the hyperslab is SEQ_LEN. The + * total size of the file array is implied in the LAYOUT argument. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, const H5O_fill_t *fill, + const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size, + hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset, + void *_buf/*out*/) +{ + uint8_t *buf = (uint8_t*)_buf; /*cast for arithmetic */ + hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */ + hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */ + hsize_t hslab_size[H5O_LAYOUT_NDIMS]; /* hyperslab size in dataspace*/ + intn ndims; + haddr_t addr; /*address in file */ + intn i; /*counters */ +#ifdef H5_HAVE_PARALLEL + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; +#endif + + FUNC_ENTER(H5F_seq_read, FAIL); + + /* Check args */ + assert(f); + assert(layout); + assert(buf); + +#ifdef H5_HAVE_PARALLEL + { + /* Get the transfer mode */ + H5F_xfer_t *dxpl; + H5FD_mpio_dxpl_t *dx; + + if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && + H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && + H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { + xfer_mode = dx->xfer_mode; + } + } + + /* Collective MPIO access is unsupported for non-contiguous datasets */ + if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) { + HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, + "collective access on non-contiguous datasets not supported yet"); + } +#endif + + switch (layout->type) { + case H5D_CONTIGUOUS: + /* Filters cannot be used for contiguous data. */ + if (pline && pline->nfilters>0) { + HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, + "filters are not allowed for contiguous data"); + } + + /* + * Initialize loop variables. The loop is a multi-dimensional loop + * that counts from SIZE down to zero and IDX is the counter. Each + * element of IDX is treated as a digit with IDX[0] being the least + * significant digit. + */ + if (efl && efl->nused>0) { + addr = 0; + } else { + addr = layout->addr; + } + addr += file_offset; + buf += mem_offset; + + /* + * Now begin to walk through the array, copying data from disk to + * memory. + */ +#ifdef H5_HAVE_PARALLEL + if (H5FD_MPIO_COLLECTIVE==xfer_mode) { + /* + * Currently supports same number of collective access. Need to + * be changed LATER to combine all reads into one collective MPIO + * call. + */ + unsigned long max, min, temp; + + temp = seq_len; + assert(temp==seq_len); /* verify no overflow */ + MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, + H5FD_mpio_communicator(f->shared->lf)); + MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, + H5FD_mpio_communicator(f->shared->lf)); +#ifdef AKC + printf("seq_len=%lu, min=%lu, max=%lu\n", temp, min, max); +#endif + if (max != min) + HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, + "collective access with unequal number of blocks not supported yet"); + } +#endif + + /* Read directly from file if the dataset is in an external file */ + /* Note: We can't use data sieve buffers for datasets in external files + * because the 'addr' of all external files is set to 0 (above) and + * all datasets in external files would alias to the same set of + * file offsets, totally mixing up the data sieve buffer information. -QAK + */ + if (efl && efl->nused>0) { + if (H5O_efl_read(f, efl, addr, seq_len, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, + "external data read failed"); + } + } else { + if (H5F_contig_read(f, addr, seq_len, dxpl_id, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, + "block read failed"); + } + } /* end else */ + break; + + case H5D_CHUNKED: + /* + * This method is unable to access external raw data files + */ + if (efl && efl->nused>0) { + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, + "chunking and external files are mutually exclusive"); + } + /* Compute the file offset coordinates and hyperslab size */ + if((ndims=H5S_get_simple_extent_dims(file_space,dset_dims,NULL))<0) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to retrieve dataspace dimensions"); + +#ifdef QAK + /* The library shouldn't be reading partial elements currently */ + assert(seq_len%elmt_size!=0); + assert(addr%elmt_size!=0); +#endif /* QAK */ + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len); + printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset); + count++; + } +} +#endif /* QAK */ + /* Set location in dataset from the file_offset */ + addr=file_offset; + + /* Convert the bytes into elements */ + seq_len/=elmt_size; + addr/=elmt_size; + + /* Compute the hyperslab offset from the address given */ + for(i=ndims-1; i>=0; i--) { + coords[i]=addr%dset_dims[i]; + addr/=dset_dims[i]; + } /* end for */ + coords[ndims]=0; /* No offset for element info */ + + /* Compute the hyperslab size from the length given */ + for(i=ndims-1; i>=0; i--) { + /* Check if the hyperslab is wider than the width of the dimension */ + if(seq_len>dset_dims[i]) { + if (0!=coords[i]) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to copy into a proper hyperslab"); + hslab_size[i]=dset_dims[i]; + } /* end if */ + else + hslab_size[i]=seq_len; + + /* Fold the length into the length in the next highest dimension */ + seq_len/=dset_dims[i]; + + /* Make certain the hyperslab sizes don't go less than 1 */ + if(seq_len<1) + seq_len=1; + } /* end for */ + hslab_size[ndims]=elmt_size; /* basic hyperslab size is the element */ + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len); + for(i=0; i<=ndims; i++) + printf("%s: dset_dims[%d]=%d\n",FUNC,i,(int)dset_dims[i]); + for(i=0; i<=ndims; i++) + printf("%s: coords[%d]=%d, hslab_size[%d]=%d\n",FUNC,i,(int)coords[i],(int)i,(int)hslab_size[i]); + count++; + } +} +#endif /* QAK */ + + if (H5F_istore_read(f, dxpl_id, layout, pline, fill, coords, + hslab_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"); + } /* end switch() */ + + FUNC_LEAVE(SUCCEED); +} /* H5F_seq_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_seq_write + * + * Purpose: Writes a sequence of bytes to a file dataset from a buffer in + * in memory. The data is written to file F and the array's size and + * storage information is in LAYOUT. External files are described + * according to the external file list, EFL. The sequence offset is + * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are + * in terms of bytes) and the size of the hyperslab is SEQ_LEN. The + * total size of the file array is implied in the LAYOUT argument. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, October 9, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, const H5O_fill_t *fill, + const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size, + hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset, + const void *_buf) +{ + const uint8_t *buf = (const uint8_t*)_buf; /*cast for arithmetic */ + hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */ + hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */ + hsize_t hslab_size[H5O_LAYOUT_NDIMS]; /* hyperslab size in dataspace*/ + intn ndims; + haddr_t addr; /*address in file */ + intn i; /*counters */ +#ifdef H5_HAVE_PARALLEL + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; +#endif + + FUNC_ENTER(H5F_seq_write, FAIL); + + /* Check args */ + assert(f); + assert(layout); + assert(buf); + +#ifdef H5_HAVE_PARALLEL + { + /* Get the transfer mode */ + H5F_xfer_t *dxpl; + H5FD_mpio_dxpl_t *dx; + + if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && + H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && + H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { + xfer_mode = dx->xfer_mode; + } + } + + /* Collective MPIO access is unsupported for non-contiguous datasets */ + if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) { + HRETURN_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, + "collective access on non-contiguous datasets not supported yet"); + } +#endif + + switch (layout->type) { + case H5D_CONTIGUOUS: + /* Filters cannot be used for contiguous data. */ + if (pline && pline->nfilters>0) { + HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, + "filters are not allowed for contiguous data"); + } + + /* + * Initialize loop variables. The loop is a multi-dimensional loop + * that counts from SIZE down to zero and IDX is the counter. Each + * element of IDX is treated as a digit with IDX[0] being the least + * significant digit. + */ + if (efl && efl->nused>0) { + addr = 0; + } else { + addr = layout->addr; + } + addr += file_offset; + buf += mem_offset; + + /* + * Now begin to walk through the array, copying data from disk to + * memory. + */ +#ifdef H5_HAVE_PARALLEL + if (H5FD_MPIO_COLLECTIVE==xfer_mode) { + /* + * Currently supports same number of collective access. Need to + * be changed LATER to combine all reads into one collective MPIO + * call. + */ + unsigned long max, min, temp; + + temp = seq_len; + assert(temp==seq_len); /* verify no overflow */ + MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, + H5FD_mpio_communicator(f->shared->lf)); + MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, + H5FD_mpio_communicator(f->shared->lf)); +#ifdef AKC + printf("seq_len=%lu, min=%lu, max=%lu\n", temp, min, max); +#endif + if (max != min) + HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, + "collective access with unequal number of blocks not supported yet"); + } +#endif + + /* Write directly to file if the dataset is in an external file */ + /* Note: We can't use data sieve buffers for datasets in external files + * because the 'addr' of all external files is set to 0 (above) and + * all datasets in external files would alias to the same set of + * file offsets, totally mixing up the data sieve buffer information. -QAK + */ + if (efl && efl->nused>0) { + if (H5O_efl_write(f, efl, addr, seq_len, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, + "external data write failed"); + } + } else { + if (H5F_contig_write(f, H5FD_MEM_DRAW, addr, seq_len, dxpl_id, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, + "block write failed"); + } + } /* end else */ + break; + + case H5D_CHUNKED: + /* + * This method is unable to access external raw data files + */ + if (efl && efl->nused>0) { + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, + "chunking and external files are mutually exclusive"); + } + /* Compute the file offset coordinates and hyperslab size */ + if((ndims=H5S_get_simple_extent_dims(file_space,dset_dims,NULL))<0) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to retrieve dataspace dimensions"); + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%lu\n",FUNC,(int)elmt_size,(int)addr,(unsigned long)seq_len); + printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset); + count++; + } +} +#endif /* QAK */ +#ifdef QAK + /* The library shouldn't be reading partial elements currently */ + assert((seq_len%elmt_size)!=0); + assert((addr%elmt_size)!=0); +#endif /* QAK */ + + /* Set location in dataset from the file_offset */ + addr=file_offset; + + /* Convert the bytes into elements */ + seq_len/=elmt_size; + addr/=elmt_size; + + /* Compute the hyperslab offset from the address given */ + for(i=ndims-1; i>=0; i--) { + coords[i]=addr%dset_dims[i]; + addr/=dset_dims[i]; + } /* end for */ + coords[ndims]=0; /* No offset for element info */ + + /* Compute the hyperslab size from the length given */ + for(i=ndims-1; i>=0; i--) { + /* Check if the hyperslab is wider than the width of the dimension */ + if(seq_len>dset_dims[i]) { + if (0!=coords[i]) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to copy into a proper hyperslab"); + hslab_size[i]=dset_dims[i]; + } /* end if */ + else + hslab_size[i]=seq_len; + + /* Fold the length into the length in the next highest dimension */ + seq_len/=dset_dims[i]; + + /* Make certain the hyperslab sizes don't go less than 1 */ + if(seq_len<1) + seq_len=1; + } /* end for */ + hslab_size[ndims]=elmt_size; /* basic hyperslab size is the element */ + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len); + for(i=0; i<=ndims; i++) + printf("%s: dset_dims[%d]=%d\n",FUNC,i,(int)dset_dims[i]); + for(i=0; i<=ndims; i++) + printf("%s: coords[%d]=%d, hslab_size[%d]=%d\n",FUNC,i,(int)coords[i],(int)i,(int)hslab_size[i]); + count++; + } +} +#endif /* QAK */ + + if (H5F_istore_write(f, dxpl_id, layout, pline, fill, coords, + hslab_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"); + } /* end switch() */ + + FUNC_LEAVE(SUCCEED); +} /* H5F_seq_write() */ + diff --git a/src/H5F.c b/src/H5F.c index a93ea60..db39416 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -20,6 +20,8 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + /* Predefined file drivers */ #include /*temporary in-memory files */ #include /*family of files */ @@ -41,7 +43,7 @@ static char RcsId[] = "@(#)$Revision$"; #include /*object IDs */ #include /*cache */ #include /*error handling */ -#include /*file access */ +#include /*file access */ #include /*file driver */ #include /*symbol tables */ #include /*core memory management */ @@ -80,32 +82,6 @@ const H5F_create_t H5F_create_dflt = { */ H5F_access_t H5F_access_dflt; -/* Default data transfer property list */ -/* Not const anymore before some of the VFL drivers modify this struct - QAK */ -H5F_xfer_t H5F_xfer_dflt = { - 1024*1024, /*Temporary buffer size */ - NULL, /*Type conversion buffer or NULL */ - NULL, /*Background buffer or NULL */ - H5T_BKG_NO, /*Type of background buffer needed */ - {0.1, 0.5, 0.9}, /*B-tree node splitting ratios */ -#ifndef H5_HAVE_PARALLEL - 1, /*Cache the hyperslab blocks */ -#else - 0, /*Don't cache the hyperslab blocks */ -#endif /* H5_HAVE_PARALLEL */ - 0, /*No limit on hyperslab block size to cache */ - NULL, /*Use malloc() for VL data allocations */ - NULL, /*No information needed for malloc() calls */ - NULL, /*Use free() for VL data frees */ - NULL, /*No information needed for free() calls */ - -2, /*See H5Pget_driver() */ - NULL, /*No file driver-specific information yet */ -#ifdef COALESCE_READS - 0, /*coalesce single reads into a read */ - /*transaction */ -#endif -}; - /* * Define the default mount property list. */ @@ -2450,6 +2426,87 @@ H5Freopen(hid_t file_id) /*------------------------------------------------------------------------- + * Function: H5F_get_intent + * + * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) + * + * Return: 'intent' on success/abort on failure (shouldn't fail) + * + * Programmer: Quincey Koziol + * September 29, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +uintn +H5F_get_intent(H5F_t *f) +{ + FUNC_ENTER(H5F_get_intent, 0); + + assert(f); + + FUNC_LEAVE(f->intent); +} + + +/*------------------------------------------------------------------------- + * Function: H5F_sizeof_addr + * + * Purpose: Quick and dirty routine to retrieve the size of the file's size_t + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) + * + * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail) + * + * Programmer: Quincey Koziol + * September 29, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +size_t +H5F_sizeof_addr(H5F_t *f) +{ + FUNC_ENTER(H5F_sizeof_addr, 0); + + assert(f); + + FUNC_LEAVE((f)->shared->fcpl->sizeof_addr) +} + + +/*------------------------------------------------------------------------- + * Function: H5F_sizeof_size + * + * Purpose: Quick and dirty routine to retrieve the size of the file's off_t + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) + * + * Return: 'sizeof_size' on success/abort on failure (shouldn't fail) + * + * Programmer: Quincey Koziol + * September 29, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +size_t +H5F_sizeof_size(H5F_t *f) +{ + FUNC_ENTER(H5F_sizeof_size, 0); + + assert(f); + + FUNC_LEAVE((f)->shared->fcpl->sizeof_addr) +} + + +/*------------------------------------------------------------------------- * Function: H5F_block_read * * Purpose: Reads some data from a file/server/etc into a buffer. diff --git a/src/H5FD.c b/src/H5FD.c index 384f470..4011cb7 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -12,10 +12,12 @@ * layer. */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + /* Packages needed by this file */ #include /*library functions */ #include /*error handling */ -#include /*files */ +#include /*files */ #include /*virtual file driver */ #include /*Free Lists */ #include /*interface abstraction layer */ @@ -282,7 +284,7 @@ H5FD_get_class(hid_t id) { H5FD_class_t *ret_value=NULL; H5F_access_t *fapl=NULL; - H5F_xfer_t *dxpl=NULL; + H5D_xfer_t *dxpl=NULL; FUNC_ENTER(H5FD_get_class, NULL); diff --git a/src/H5FDcore.c b/src/H5FDcore.c index b923861..e551d46 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -12,6 +12,7 @@ #include /*library functions */ #include /*error handling */ #include /*files */ +#include /*file driver */ #include /* Core file driver */ #include /* Memory allocation */ #include /*property lists */ diff --git a/src/H5FDdpss.c b/src/H5FDdpss.c index 26ede02..e01c95b 100644 --- a/src/H5FDdpss.c +++ b/src/H5FDdpss.c @@ -11,11 +11,10 @@ #include #include /* error handling */ +#include /*file driver */ +#include #include /* memory management */ -/*** FIXME: should this be included here or in ??? ***/ -#include "H5FDdpss.h" - #ifdef COALESCE_READS /* Packages needed by this file.*/ #include diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 6f12863..7f4b160 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -24,6 +24,7 @@ #include /*library functions */ #include /*error handling */ #include /*files */ +#include /*file driver */ #include /* Family file driver */ #include /* Memory allocation */ #include /*property lists */ diff --git a/src/H5FDgass.c b/src/H5FDgass.c index 7d8ac9c..a9ca657 100644 --- a/src/H5FDgass.c +++ b/src/H5FDgass.c @@ -11,6 +11,7 @@ #include /*library functions */ #include /*error handling */ #include /*files */ +#include /*file driver */ #include /* Core file driver */ #include /* Memory allocation */ #include /*property lists */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 77464c9..63f6bdd 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -17,6 +17,7 @@ #include /*library functions */ #include /*error handling */ #include /*files */ +#include /*file driver */ #include /* logging file driver */ #include /*Free Lists */ #include /* Memory allocation */ @@ -40,7 +41,7 @@ static hid_t H5FD_LOG_g = 0; /* Driver-specific file access properties */ typedef struct H5FD_log_fapl_t { - const char *logfile; /* Allocated log file name */ + char *logfile; /* Allocated log file name */ intn verbosity; /* Verbosity of logging information */ } H5FD_log_fapl_t; @@ -257,7 +258,7 @@ H5FD_log_init(void) *------------------------------------------------------------------------- */ herr_t -H5Pset_fapl_log(hid_t fapl_id, const char *logfile, int verbosity) +H5Pset_fapl_log(hid_t fapl_id, char *logfile, int verbosity) { H5FD_log_fapl_t fa; /* File access property list information */ herr_t ret_value=FAIL; diff --git a/src/H5FDlog.h b/src/H5FDlog.h index 632430d..7db9403 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -15,7 +15,7 @@ #define H5FD_LOG (H5FD_log_init()) __DLL__ hid_t H5FD_log_init(void); -__DLL__ herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, int verbosity); +__DLL__ herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile, int verbosity); #endif diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index f2b8435..fe9fd08 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -23,6 +23,7 @@ #include /*library functions */ #include /*error handling */ #include /*files */ +#include /*file driver */ #include /* MPI I/O file driver */ #include /* Memory allocation */ #include /*property lists */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index ee38f55..bfb76ce 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -15,6 +15,7 @@ #include /*library functions */ #include /*error handling */ #include /*files */ +#include /*file driver */ #include /* Sec2 file driver */ #include /*Free Lists */ #include /* Memory allocation */ diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c index bfc5f13..4c19372 100644 --- a/src/H5FDsrb.c +++ b/src/H5FDsrb.c @@ -10,6 +10,7 @@ #include /*library functions */ #include /*error handling */ #include /*files */ +#include /*file driver */ #include /* Core file driver */ #include /* Memory allocation */ #include /*property lists */ diff --git a/src/H5Farray.c b/src/H5Farray.c index a79c4dc..798be54 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 1998 Spizella Software - * All rights reserved. + * Copyright (C) 1998 NCSA + * All rights reserved. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, January 15, 1998 * * Purpose: Provides I/O facilities for multi-dimensional arrays of bytes @@ -11,10 +11,13 @@ * dimension. For example, a 10x20 array of int would * translate to a 10x20x4 array of bytes at this level. */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include #include -#include +#include #include /*file driver */ #include #include @@ -140,7 +143,6 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, size_t nelmts, z; /*number of elements */ intn ndims; /*stride dimensionality */ haddr_t addr; /*address in file */ - haddr_t eof; /*end of file address */ intn i, j; /*counters */ hbool_t carray; /*carry for subtraction */ #ifdef H5_HAVE_PARALLEL @@ -409,7 +411,6 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, size_t nelmts, z; /*number of elements */ intn ndims; /*dimensionality */ haddr_t addr; /*address in file */ - haddr_t eof; /*end of file address */ intn i, j; /*counters */ hbool_t carray; /*carry for subtraction */ #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Fcontig.c b/src/H5Fcontig.c index d4430c0..b4f4ab1 100644 --- a/src/H5Fcontig.c +++ b/src/H5Fcontig.c @@ -11,9 +11,12 @@ * H5F_seg_read/write. * */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include -#include +#include #include /*file driver */ #include @@ -244,8 +247,8 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, f->shared->sieve_size=0; } /* end if */ - /* Write directly from the user's buffer */ - if (H5F_block_write(f, H5FD_MEM_DRAW, addr, size, dxpl_id, buf)<0) { + /* Write directly to the user's buffer */ + if (H5F_block_write(f, type, addr, size, dxpl_id, buf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } @@ -293,7 +296,7 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, else { /* Check if we can actually hold the I/O request in the sieve buffer */ if(size>f->shared->sieve_buf_size) { - if (H5F_block_write(f, H5FD_MEM_DRAW, addr, size, dxpl_id, buf)<0) { + if (H5F_block_write(f, type, addr, size, dxpl_id, buf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } @@ -330,7 +333,7 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, } /* end else */ } /* end if */ else { - if (H5F_block_write(f, H5FD_MEM_DRAW, addr, size, dxpl_id, buf)<0) { + if (H5F_block_write(f, type, addr, size, dxpl_id, buf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 06667bc..42c6aad 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -29,10 +29,13 @@ * entries near the front of the list to make room for the new * entry which is added to the end of the list. */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include #include -#include +#include #include /*Free Lists */ #include #include @@ -1498,8 +1501,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->chunk = chunk; { - H5F_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5F_xfer_dflt : (H5F_xfer_t *)H5I_object(dxpl_id); + H5D_xfer_t *dxpl; + dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); ent->split_ratios[0] = dxpl->split_ratios[0]; ent->split_ratios[1] = dxpl->split_ratios[1]; ent->split_ratios[2] = dxpl->split_ratios[2]; @@ -1640,8 +1643,8 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, x.alloc_size = x.chunk_size; x.chunk = chunk; { - H5F_xfer_t *dxpl; - dxpl = (H5P_DEFAULT==dxpl_id) ? &H5F_xfer_dflt : (H5F_xfer_t *)H5I_object(dxpl_id); + H5D_xfer_t *dxpl; + dxpl = (H5P_DEFAULT==dxpl_id) ? &H5D_xfer_dflt : (H5D_xfer_t *)H5I_object(dxpl_id); x.split_ratios[0] = dxpl->split_ratios[0]; x.split_ratios[1] = dxpl->split_ratios[1]; x.split_ratios[2] = dxpl->split_ratios[2]; diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h new file mode 100644 index 0000000..6abd9cf --- /dev/null +++ b/src/H5Fpkg.h @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2000 NCSA + * All rights reserved. + * + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 + * + * Purpose: This file contains declarations which are visible only within + * the H5F package. Source files outside the H5F package should + * include H5Fprivate.h instead. + */ +#ifndef H5F_PACKAGE +#error "Do not include this file outside the H5F package!" +#endif + +#ifndef _H5Fpkg_H +#define _H5Fpkg_H + +#include + +/* This is a near top-level header! Try not to include much! */ +#include + +/* + * Feature: Define this constant to be non-zero if you want to enable code + * that minimizes the number of calls to lseek(). This has a huge + * performance benefit on some systems. Set this constant to zero + * on the compiler command line to disable that optimization. + */ +#ifndef H5F_OPT_SEEK +# define H5F_OPT_SEEK 1 +#endif + +/* + * Feature: Define this constant on the compiler command-line if you want to + * see some debugging messages on the debug stream. + */ +#ifdef NDEBUG +# undef H5F_DEBUG +#endif + +/* Maximum size of boot-block buffer */ +#define H5F_BOOTBLOCK_SIZE 1024 + +/* Define the HDF5 file signature */ +#define H5F_SIGNATURE "\211HDF\r\n\032\n" +#define H5F_SIGNATURE_LEN 8 + +/* + * Private file open flags. + */ +#define H5F_ACC_PUBLIC_FLAGS 0x00ffu + +/* + * Macros that check for overflows. These are somewhat dangerous to fiddle + * with. + */ +#if (SIZEOF_SIZE_T >= SIZEOF_OFF_T) +# define H5F_OVERFLOW_SIZET2OFFT(X) \ + ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(off_t)-1))) +#else +# define H5F_OVERFLOW_SIZET2OFFT(X) 0 +#endif + +/* The raw data chunk cache */ +typedef struct H5F_rdcc_t { + uintn ninits; /* Number of chunk creations */ + uintn nhits; /* Number of cache hits */ + uintn nmisses;/* Number of cache misses */ + uintn nflushes;/* Number of cache flushes */ + size_t nbytes; /* Current cached raw data in bytes */ + intn nslots; /* Number of chunk slots allocated */ + struct H5F_rdcc_ent_t *head; /* Head of doubly linked list */ + struct H5F_rdcc_ent_t *tail; /* Tail of doubly linked list */ + intn nused; /* Number of chunk slots in use */ + struct H5F_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/ +} H5F_rdcc_t; + +/* + * Define the structure to store the file information for HDF5 files. One of + * these structures is allocated per file, not per H5Fopen(). That is, set of + * H5F_t structs can all point to the same H5F_file_t struct. The `nrefs' + * count in this struct indicates the number of H5F_t structs which are + * pointing to this struct. + */ +typedef struct H5F_file_t { + uintn flags; /* Access Permissions for file */ + H5FD_t *lf; /* Lower level file handle for I/O */ + uintn nrefs; /* Ref count for times file is opened */ + uint32_t consist_flags; /* File Consistency Flags */ + haddr_t boot_addr; /* Absolute address of boot block */ + haddr_t base_addr; /* Absolute base address for rel.addrs. */ + haddr_t freespace_addr; /* Relative address of free-space info */ + haddr_t driver_addr; /* File driver information block address*/ + struct H5AC_t *cache; /* The object cache */ + H5F_create_t *fcpl; /* File-creation property list */ + /* This actually ends up being a pointer to a */ + /* H5P_t type, which is returned from H5P_copy */ + /* But that's ok because we only access it like */ + /* a H5F_create_t until we pass it back to */ + /* H5P_close to release it - QAK */ + intn mdc_nelmts; /* Size of meta data cache (elements) */ + intn rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ + size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ + double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ + hsize_t threshold; /* Threshold for alignment */ + hsize_t alignment; /* Alignment */ + uintn gc_ref; /* Garbage-collect references? */ + struct H5G_t *root_grp; /* Open root group */ + intn ncwfs; /* Num entries on cwfs list */ + struct H5HG_heap_t **cwfs; /* Global heap cache */ + + /* Data Sieve Buffering fields */ + unsigned char *sieve_buf; /* Buffer to hold data sieve buffer */ + haddr_t sieve_loc; /* File location (offset) of the data sieve buffer */ + hsize_t sieve_size; /* Size of the data sieve buffer used (in bytes) */ + hsize_t sieve_buf_size; /* Size of the data sieve buffer allocated (in bytes) */ + unsigned sieve_dirty; /* Flag to indicate that the data sieve buffer is dirty */ + + H5F_rdcc_t rdcc; /* Raw data chunk cache */ +} H5F_file_t; + +/* A record of the mount table */ +typedef struct H5F_mount_t { + struct H5G_t *group; /* Mount point group held open */ + struct H5F_t *file; /* File mounted at that point */ +} H5F_mount_t; + +/* + * The mount table describes what files are attached to (mounted on) the file + * to which this table belongs. + */ +typedef struct H5F_mtab_t { + struct H5F_t *parent;/* Parent file */ + uintn nmounts;/* Number of children which are mounted */ + uintn nalloc; /* Number of mount slots allocated */ + H5F_mount_t *child; /* An array of mount records */ +} H5F_mtab_t; + +/* + * This is the top-level file descriptor. One of these structures is + * allocated every time H5Fopen() is called although they may contain pointers + * to shared H5F_file_t structs. The reference count (nrefs) indicates the + * number of times the file has been opened (the application can only open a + * file once explicitly, but the library can open the file a second time to + * indicate that the file is mounted on some other file). + */ +struct H5F_t { + uintn nrefs; /* Reference count */ + uintn intent; /* The flags passed to H5F_open()*/ + char *name; /* Name used to open file */ + H5F_file_t *shared; /* The shared file info */ + uintn nopen_objs; /* Number of open object headers*/ + hid_t closing; /* H5I_FILE_CLOSING ID or zero */ + H5F_mtab_t mtab; /* File mount table */ +}; + +#ifdef H5_HAVE_PARALLEL +__DLLVAR__ hbool_t H5_mpi_1_metawrite_g; +#endif /* H5_HAVE_PARALLEL */ + +/* Private functions, not part of the publicly documented API */ +__DLL__ void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, + uint8_t *l); +__DLL__ H5F_t *H5F_open(const char *name, uintn flags, hid_t fcpl_id, + hid_t fapl_id); +__DLL__ herr_t H5F_close(H5F_t *f); +__DLL__ herr_t H5F_close_all(void); +__DLL__ herr_t H5F_flush_all(hbool_t invalidate); +__DLL__ herr_t H5F_debug(H5F_t *f, haddr_t addr, FILE * stream, + intn indent, intn fwidth); +__DLL__ herr_t H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, + intn indent, intn fwidth, int ndims); +__DLL__ herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/); + +/* Functions that operate on indexed storage */ +__DLL__ herr_t H5F_istore_init (H5F_t *f); +__DLL__ herr_t H5F_istore_flush (H5F_t *f, hbool_t preempt); +__DLL__ herr_t H5F_istore_dest (H5F_t *f); +__DLL__ herr_t H5F_istore_stats (H5F_t *f, hbool_t headers); +__DLL__ herr_t H5F_istore_create(H5F_t *f, + struct H5O_layout_t *layout/*in,out*/); +__DLL__ herr_t H5F_istore_read(H5F_t *f, hid_t dxpl_id, + const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill, + const hssize_t offset[], const hsize_t size[], + void *buf/*out*/); +__DLL__ herr_t H5F_istore_write(H5F_t *f, hid_t dxpl_id, + const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill, + const hssize_t offset[], const hsize_t size[], + const void *buf); +__DLL__ herr_t H5F_istore_allocate (H5F_t *f, hid_t dxpl_id, + const struct H5O_layout_t *layout, + const hsize_t *space_dim, + const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill); + +/* Functions that operate on contiguous storage wrt boot block */ +__DLL__ herr_t H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, + hid_t dxpl_id, void *_buf/*out*/); +__DLL__ herr_t H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, + hsize_t size, hid_t dxpl_id, const void *buf); + +/* Functions for allocation/releasing chunks */ +__DLL__ void * H5F_istore_chunk_alloc(size_t chunk_size); +__DLL__ void * H5F_istore_chunk_realloc(void *chunk, size_t new_size); + +#endif + diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 50d6707..d643f9e 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -18,46 +18,13 @@ #ifndef _H5Fprivate_H #define _H5Fprivate_H + #include /* This is a near top-level header! Try not to include much! */ -#include #include /*file drivers */ -#include /*for H5MM_allocate_t and H5MM_free_t types */ -/* - * Feature: Define this constant to be non-zero if you want to enable code - * that minimizes the number of calls to lseek(). This has a huge - * performance benefit on some systems. Set this constant to zero - * on the compiler command line to disable that optimization. - */ -#ifndef H5F_OPT_SEEK -# define H5F_OPT_SEEK 1 -#endif - -/* - * Feature: Define this constant on the compiler command-line if you want to - * see some debugging messages on the debug stream. - */ -#ifdef NDEBUG -# undef H5F_DEBUG -#endif - -/* Maximum size of boot-block buffer */ -#define H5F_BOOTBLOCK_SIZE 1024 - -/* Define the HDF5 file signature */ -#define H5F_SIGNATURE "\211HDF\r\n\032\n" -#define H5F_SIGNATURE_LEN 8 - -/* size of size_t and off_t as they exist on disk */ -#define H5F_SIZEOF_ADDR(F) ((F)->shared->fcpl->sizeof_addr) -#define H5F_SIZEOF_SIZE(F) ((F)->shared->fcpl->sizeof_size) - -/* - * Private file open flags. - */ -#define H5F_ACC_PUBLIC_FLAGS 0x00ffu +typedef struct H5F_t H5F_t; /* * Encode and decode macros for file meta-data. @@ -218,16 +185,74 @@ */ #define NBYTEDECODE(s, d, n) { HDmemcpy(d,s,n); p+=n } -/* - * Macros that check for overflows. These are somewhat dangerous to fiddle - * with. - */ -#if (SIZEOF_SIZE_T >= SIZEOF_OFF_T) -# define H5F_OVERFLOW_SIZET2OFFT(X) \ - ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(off_t)-1))) -#else -# define H5F_OVERFLOW_SIZET2OFFT(X) 0 -#endif +/* Address-related macros */ +#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ + HADDR_UNDEF==(X)+(haddr_t)(Z) || \ + (X)+(haddr_t)(Z)<(X)) +#define H5F_addr_hash(X,M) ((unsigned)((X)%(M))) +#define H5F_addr_defined(X) (X!=HADDR_UNDEF) +#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)==(Y)) +#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) +#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<(Y)) +#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<=(Y)) +#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>(Y)) +#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>=(Y)) +#define H5F_addr_cmp(X,Y) (H5F_addr_eq(X,Y)?0: \ + (H5F_addr_lt(X, Y)?-1:1)) +#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) + +/* size of size_t and off_t as they exist on disk */ +#ifdef H5F_PACKAGE +#define H5F_SIZEOF_ADDR(F) ((F)->shared->fcpl->sizeof_addr) +#define H5F_SIZEOF_SIZE(F) ((F)->shared->fcpl->sizeof_size) +#else /* H5F_PACKAGE */ +#define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) +#define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) +#endif /* H5F_PACKAGE */ +__DLL__ size_t H5F_sizeof_addr(H5F_t *f); +__DLL__ size_t H5F_sizeof_size(H5F_t *f); + +/* Macros to encode/decode offset/length's for storing in the file */ +#ifdef NOT_YET +#define H5F_ENCODE_OFFSET(f,p,o) (H5F_SIZEOF_ADDR(f)==4 ? UINT32ENCODE(p,o) \ + : H5F_SIZEOF_ADDR(f)==8 ? UINT64ENCODE(p,o) \ + : H5F_SIZEOF_ADDR(f)==2 ? UINT16ENCODE(p,o) \ + : H5FPencode_unusual_offset(f,&(p),(uint8_t*)&(o))) +#else /* NOT_YET */ +#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ + case 4: UINT32ENCODE(p,o); break; \ + case 8: UINT64ENCODE(p,o); break; \ + case 2: UINT16ENCODE(p,o); break; \ +} +#endif /* NOT_YET */ + +#define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) { \ + case 4: UINT32DECODE (p, o); break; \ + case 8: UINT64DECODE (p, o); break; \ + case 2: UINT16DECODE (p, o); break; \ +} + +#define H5F_ENCODE_LENGTH(f,p,l) switch(H5F_SIZEOF_SIZE(f)) { \ + case 4: UINT32ENCODE(p,l); break; \ + case 8: UINT64ENCODE(p,l); break; \ + case 2: UINT16ENCODE(p,l); break; \ +} + +#define H5F_DECODE_LENGTH(f,p,l) switch(H5F_SIZEOF_SIZE(f)) { \ + case 4: UINT32DECODE(p,l); break; \ + case 8: UINT64DECODE(p,l); break; \ + case 2: UINT16DECODE(p,l); break; \ +} /* * File-creation property list. @@ -261,164 +286,15 @@ typedef struct H5F_access_t { void *driver_info; /* File driver specific information */ } H5F_access_t; -/* Data transfer property list */ -typedef struct H5F_xfer_t { - size_t buf_size; /*max temp buffer size */ - void *tconv_buf; /*type conversion buffer or null */ - void *bkg_buf; /*background buffer or null */ - H5T_bkg_t need_bkg; /*type of background buffer needed */ - double split_ratios[3];/*B-tree node splitting ratios */ - uintn cache_hyper; /*cache hyperslab blocks during I/O? */ - uintn block_limit; /*largest hyperslab block to cache */ - H5MM_allocate_t vlen_alloc; /*VL datatype allocation function */ - void *alloc_info; /*VL datatype allocation information */ - H5MM_free_t vlen_free; /*VL datatype free function */ - void *free_info; /*VL datatype free information */ - hid_t driver_id; /*File driver ID */ - void *driver_info; /*File driver specific information */ -#ifdef COALESCE_READS - uintn gather_reads; /*coalesce single reads into a read */ - /*transaction */ -#endif -} H5F_xfer_t; - -/* The raw data chunk cache */ -typedef struct H5F_rdcc_t { - uintn ninits; /* Number of chunk creations */ - uintn nhits; /* Number of cache hits */ - uintn nmisses;/* Number of cache misses */ - uintn nflushes;/* Number of cache flushes */ - size_t nbytes; /* Current cached raw data in bytes */ - intn nslots; /* Number of chunk slots allocated */ - struct H5F_rdcc_ent_t *head; /* Head of doubly linked list */ - struct H5F_rdcc_ent_t *tail; /* Tail of doubly linked list */ - intn nused; /* Number of chunk slots in use */ - struct H5F_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/ -} H5F_rdcc_t; - -/* - * Define the structure to store the file information for HDF5 files. One of - * these structures is allocated per file, not per H5Fopen(). That is, set of - * H5F_t structs can all point to the same H5F_file_t struct. The `nrefs' - * count in this struct indicates the number of H5F_t structs which are - * pointing to this struct. - */ -typedef struct H5F_file_t { - uintn flags; /* Access Permissions for file */ - H5FD_t *lf; /* Lower level file handle for I/O */ - uintn nrefs; /* Ref count for times file is opened */ - uint32_t consist_flags; /* File Consistency Flags */ - haddr_t boot_addr; /* Absolute address of boot block */ - haddr_t base_addr; /* Absolute base address for rel.addrs. */ - haddr_t freespace_addr; /* Relative address of free-space info */ - haddr_t driver_addr; /* File driver information block address*/ - struct H5AC_t *cache; /* The object cache */ - H5F_create_t *fcpl; /* File-creation property list */ - /* This actually ends up being a pointer to a */ - /* H5P_t type, which is returned from H5P_copy */ - /* But that's ok because we only access it like */ - /* a H5F_create_t until we pass it back to */ - /* H5P_close to release it - QAK */ - intn mdc_nelmts; /* Size of meta data cache (elements) */ - intn rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ - size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ - double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ - hsize_t threshold; /* Threshold for alignment */ - hsize_t alignment; /* Alignment */ - uintn gc_ref; /* Garbage-collect references? */ - struct H5G_t *root_grp; /* Open root group */ - intn ncwfs; /* Num entries on cwfs list */ - struct H5HG_heap_t **cwfs; /* Global heap cache */ - - /* Data Sieve Buffering fields */ - unsigned char *sieve_buf; /* Buffer to hold data sieve buffer */ - haddr_t sieve_loc; /* File location (offset) of the data sieve buffer */ - hsize_t sieve_size; /* Size of the data sieve buffer used (in bytes) */ - hsize_t sieve_buf_size; /* Size of the data sieve buffer allocated (in bytes) */ - unsigned sieve_dirty; /* Flag to indicate that the data sieve buffer is dirty */ - - H5F_rdcc_t rdcc; /* Raw data chunk cache */ -} H5F_file_t; - /* Mount property list */ typedef struct H5F_mprop_t { hbool_t local; /* Are absolute symlinks local to file? */ } H5F_mprop_t; -/* A record of the mount table */ -typedef struct H5F_mount_t { - struct H5G_t *group; /* Mount point group held open */ - struct H5F_t *file; /* File mounted at that point */ -} H5F_mount_t; - -/* - * The mount table describes what files are attached to (mounted on) the file - * to which this table belongs. - */ -typedef struct H5F_mtab_t { - struct H5F_t *parent;/* Parent file */ - uintn nmounts;/* Number of children which are mounted */ - uintn nalloc; /* Number of mount slots allocated */ - H5F_mount_t *child; /* An array of mount records */ -} H5F_mtab_t; - -/* - * This is the top-level file descriptor. One of these structures is - * allocated every time H5Fopen() is called although they may contain pointers - * to shared H5F_file_t structs. The reference count (nrefs) indicates the - * number of times the file has been opened (the application can only open a - * file once explicitly, but the library can open the file a second time to - * indicate that the file is mounted on some other file). - */ -typedef struct H5F_t { - uintn nrefs; /* Reference count */ - uintn intent; /* The flags passed to H5F_open()*/ - char *name; /* Name used to open file */ - H5F_file_t *shared; /* The shared file info */ - uintn nopen_objs; /* Number of open object headers*/ - hid_t closing; /* H5I_FILE_CLOSING ID or zero */ - H5F_mtab_t mtab; /* File mount table */ -} H5F_t; - -#ifdef NOT_YET -#define H5F_ENCODE_OFFSET(f,p,o) (H5F_SIZEOF_ADDR(f)==4 ? UINT32ENCODE(p,o) \ - : H5F_SIZEOF_ADDR(f)==8 ? UINT64ENCODE(p,o) \ - : H5F_SIZEOF_ADDR(f)==2 ? UINT16ENCODE(p,o) \ - : H5FPencode_unusual_offset(f,&(p),(uint8_t*)&(o))) -#else /* NOT_YET */ -#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ - case 4: UINT32ENCODE(p,o); break; \ - case 8: UINT64ENCODE(p,o); break; \ - case 2: UINT16ENCODE(p,o); break; \ -} -#endif /* NOT_YET */ - -#define H5F_DECODE_OFFSET(f,p,o) \ - switch (H5F_SIZEOF_ADDR (f)) { \ - case 4: \ - UINT32DECODE (p, o); \ - break; \ - case 8: \ - UINT64DECODE (p, o); \ - break; \ - case 2: \ - UINT16DECODE (p, o); \ - break; \ - } - -#define H5F_encode_length(f,p,l) \ - switch(H5F_SIZEOF_SIZE(f)) { \ - case 4: UINT32ENCODE(p,l); break; \ - case 8: UINT64ENCODE(p,l); break; \ - case 2: UINT16ENCODE(p,l); break; \ -} - -#define H5F_decode_length(f,p,l) \ - switch(H5F_SIZEOF_SIZE(f)) { \ - case 4: UINT32DECODE(p,l); break; \ - case 8: UINT64DECODE(p,l); break; \ - case 2: UINT16DECODE(p,l); break; \ -} +/* library variables */ +__DLLVAR__ const H5F_create_t H5F_create_dflt; +__DLLVAR__ H5F_access_t H5F_access_dflt; +__DLLVAR__ const H5F_mprop_t H5F_mount_dflt; /* Forward declarations for prototypes arguments */ struct H5O_layout_t; @@ -426,31 +302,11 @@ struct H5O_efl_t; struct H5O_pline_t; struct H5O_fill_t; struct H5G_entry_t; - -/* library variables */ -__DLLVAR__ const H5F_create_t H5F_create_dflt; -__DLLVAR__ H5F_access_t H5F_access_dflt; -__DLLVAR__ H5F_xfer_t H5F_xfer_dflt; -__DLLVAR__ const H5F_mprop_t H5F_mount_dflt; - -#ifdef H5_HAVE_PARALLEL -__DLLVAR__ hbool_t H5_mpi_1_metawrite_g; -#endif /* H5_HAVE_PARALLEL */ +struct H5S_t; /* Private functions, not part of the publicly documented API */ __DLL__ herr_t H5F_init(void); -__DLL__ void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, - uint8_t *l); -__DLL__ H5F_t *H5F_open(const char *name, uintn flags, hid_t fcpl_id, - hid_t fapl_id); -__DLL__ herr_t H5F_close(H5F_t *f); -__DLL__ herr_t H5F_close_all(void); -__DLL__ herr_t H5F_flush_all(hbool_t invalidate); -__DLL__ herr_t H5F_debug(H5F_t *f, haddr_t addr, FILE * stream, - intn indent, intn fwidth); -__DLL__ herr_t H5F_istore_debug(H5F_t *f, haddr_t addr, FILE * stream, - intn indent, intn fwidth, int ndims); -__DLL__ herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/); +__DLL__ uintn H5F_get_intent(H5F_t *f); /* Functions that operate on array storage */ __DLL__ herr_t H5F_arr_create(H5F_t *f, @@ -474,81 +330,38 @@ __DLL__ herr_t H5F_arr_write (H5F_t *f, hid_t dxpl_id, const hssize_t mem_offset[], const hssize_t file_offset[], const void *_buf); -/* Functions that operate on indexed storage */ -__DLL__ herr_t H5F_istore_init (H5F_t *f); -__DLL__ herr_t H5F_istore_flush (H5F_t *f, hbool_t preempt); -__DLL__ herr_t H5F_istore_dest (H5F_t *f); -__DLL__ hsize_t H5F_istore_allocated(H5F_t *f, int ndims, haddr_t addr); -__DLL__ herr_t H5F_istore_stats (H5F_t *f, hbool_t headers); -__DLL__ herr_t H5F_istore_create(H5F_t *f, - struct H5O_layout_t *layout/*in,out*/); -__DLL__ herr_t H5F_istore_read(H5F_t *f, hid_t dxpl_id, - const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_fill_t *fill, - const hssize_t offset[], const hsize_t size[], - void *buf/*out*/); -__DLL__ herr_t H5F_istore_write(H5F_t *f, hid_t dxpl_id, - const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_fill_t *fill, - const hssize_t offset[], const hsize_t size[], - const void *buf); -__DLL__ herr_t H5F_istore_allocate (H5F_t *f, hid_t dxpl_id, - const struct H5O_layout_t *layout, - const hsize_t *space_dim, - const struct H5O_pline_t *pline, - const struct H5O_fill_t *fill); -__DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, - haddr_t addr); - -/* Functions that operate on contiguous storage wrt boot block */ -__DLL__ herr_t H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, - hid_t dxpl_id, void *_buf/*out*/); -__DLL__ herr_t H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, - hsize_t size, hid_t dxpl_id, const void *buf); - /* Functions that operate on blocks of bytes wrt boot block */ __DLL__ herr_t H5F_block_read(H5F_t *f, haddr_t addr, hsize_t size, hid_t dxpl_id, void *buf/*out*/); __DLL__ herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxpl_id, const void *buf); -/* Address-related macros and functions */ -#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ - HADDR_UNDEF==(X)+(haddr_t)(Z) || \ - (X)+(haddr_t)(Z)<(X)) -#define H5F_addr_hash(X,M) ((unsigned)((X)%(M))) -#define H5F_addr_defined(X) (X!=HADDR_UNDEF) -#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)==(Y)) -#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>=(Y)) -#define H5F_addr_cmp(X,Y) (H5F_addr_eq(X,Y)?0: \ - (H5F_addr_lt(X, Y)?-1:1)) -#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) +/* Functions that operate on byte sequences */ +__DLL__ herr_t H5F_seq_read(H5F_t *f, hid_t dxpl_id, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill, const struct H5O_efl_t *efl, + const struct H5S_t *file_space, size_t elmt_size, hsize_t seq_len, + hssize_t mem_offset, hssize_t file_offset, void *_buf/*out*/); +__DLL__ herr_t H5F_seq_write (H5F_t *f, hid_t dxpl_id, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill, const struct H5O_efl_t *efl, + const struct H5S_t *file_space, size_t elmt_size, hsize_t seq_len, + hssize_t mem_offset, hssize_t file_offset, const void *_buf); + +/* Functions that operate on indexed storage */ +__DLL__ hsize_t H5F_istore_allocated(H5F_t *f, int ndims, haddr_t addr); +__DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, + haddr_t addr); + +/* Functions for allocation/releasing chunks */ +__DLL__ void * H5F_istore_chunk_free(void *chunk); + +/* Address-related functions */ __DLL__ void H5F_addr_encode(H5F_t *, uint8_t**/*in,out*/, haddr_t); __DLL__ void H5F_addr_decode(H5F_t *, const uint8_t**/*in,out*/, haddr_t*/*out*/); __DLL__ herr_t H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/, const unsigned long objno[2]); -/* Functions for allocation/releasing chunks */ -__DLL__ void * H5F_istore_chunk_alloc(size_t chunk_size); -__DLL__ void * H5F_istore_chunk_free(void *chunk); -__DLL__ void * H5F_istore_chunk_realloc(void *chunk, size_t new_size); - #endif diff --git a/src/H5Fseq.c b/src/H5Fseq.c new file mode 100644 index 0000000..9aa3a48 --- /dev/null +++ b/src/H5Fseq.c @@ -0,0 +1,494 @@ +/* + * Copyright (C) 2000 NCSA + * All rights reserved. + * + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 + * + * Purpose: Provides I/O facilities for sequences of bytes stored with various + * layout policies. These routines are similar to the H5Farray.c routines, + * these deal in terms of byte offsets and lengths, not coordinates and + * hyperslab sizes. + * + */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + +#include +#include +#include +#include +#include /*file driver */ +#include +#include +#include /*memory management */ +#include +#include +#include + +/* MPIO driver functions are needed for some special checks */ +#include + +/* Interface initialization */ +#define PABLO_MASK H5Fseq_mask +#define INTERFACE_INIT NULL +static intn interface_initialize_g = 0; + + +/*------------------------------------------------------------------------- + * Function: H5F_seq_read + * + * Purpose: Reads a sequence of bytes from a file dataset into a buffer in + * in memory. The data is read from file F and the array's size and + * storage information is in LAYOUT. External files are described + * according to the external file list, EFL. The sequence offset is + * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are + * in terms of bytes) and the size of the hyperslab is SEQ_LEN. The + * total size of the file array is implied in the LAYOUT argument. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, const H5O_fill_t *fill, + const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size, + hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset, + void *_buf/*out*/) +{ + uint8_t *buf = (uint8_t*)_buf; /*cast for arithmetic */ + hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */ + hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */ + hsize_t hslab_size[H5O_LAYOUT_NDIMS]; /* hyperslab size in dataspace*/ + intn ndims; + haddr_t addr; /*address in file */ + intn i; /*counters */ +#ifdef H5_HAVE_PARALLEL + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; +#endif + + FUNC_ENTER(H5F_seq_read, FAIL); + + /* Check args */ + assert(f); + assert(layout); + assert(buf); + +#ifdef H5_HAVE_PARALLEL + { + /* Get the transfer mode */ + H5F_xfer_t *dxpl; + H5FD_mpio_dxpl_t *dx; + + if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && + H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && + H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { + xfer_mode = dx->xfer_mode; + } + } + + /* Collective MPIO access is unsupported for non-contiguous datasets */ + if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) { + HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, + "collective access on non-contiguous datasets not supported yet"); + } +#endif + + switch (layout->type) { + case H5D_CONTIGUOUS: + /* Filters cannot be used for contiguous data. */ + if (pline && pline->nfilters>0) { + HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, + "filters are not allowed for contiguous data"); + } + + /* + * Initialize loop variables. The loop is a multi-dimensional loop + * that counts from SIZE down to zero and IDX is the counter. Each + * element of IDX is treated as a digit with IDX[0] being the least + * significant digit. + */ + if (efl && efl->nused>0) { + addr = 0; + } else { + addr = layout->addr; + } + addr += file_offset; + buf += mem_offset; + + /* + * Now begin to walk through the array, copying data from disk to + * memory. + */ +#ifdef H5_HAVE_PARALLEL + if (H5FD_MPIO_COLLECTIVE==xfer_mode) { + /* + * Currently supports same number of collective access. Need to + * be changed LATER to combine all reads into one collective MPIO + * call. + */ + unsigned long max, min, temp; + + temp = seq_len; + assert(temp==seq_len); /* verify no overflow */ + MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, + H5FD_mpio_communicator(f->shared->lf)); + MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, + H5FD_mpio_communicator(f->shared->lf)); +#ifdef AKC + printf("seq_len=%lu, min=%lu, max=%lu\n", temp, min, max); +#endif + if (max != min) + HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, + "collective access with unequal number of blocks not supported yet"); + } +#endif + + /* Read directly from file if the dataset is in an external file */ + /* Note: We can't use data sieve buffers for datasets in external files + * because the 'addr' of all external files is set to 0 (above) and + * all datasets in external files would alias to the same set of + * file offsets, totally mixing up the data sieve buffer information. -QAK + */ + if (efl && efl->nused>0) { + if (H5O_efl_read(f, efl, addr, seq_len, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, + "external data read failed"); + } + } else { + if (H5F_contig_read(f, addr, seq_len, dxpl_id, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, + "block read failed"); + } + } /* end else */ + break; + + case H5D_CHUNKED: + /* + * This method is unable to access external raw data files + */ + if (efl && efl->nused>0) { + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, + "chunking and external files are mutually exclusive"); + } + /* Compute the file offset coordinates and hyperslab size */ + if((ndims=H5S_get_simple_extent_dims(file_space,dset_dims,NULL))<0) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to retrieve dataspace dimensions"); + +#ifdef QAK + /* The library shouldn't be reading partial elements currently */ + assert(seq_len%elmt_size!=0); + assert(addr%elmt_size!=0); +#endif /* QAK */ + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len); + printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset); + count++; + } +} +#endif /* QAK */ + /* Set location in dataset from the file_offset */ + addr=file_offset; + + /* Convert the bytes into elements */ + seq_len/=elmt_size; + addr/=elmt_size; + + /* Compute the hyperslab offset from the address given */ + for(i=ndims-1; i>=0; i--) { + coords[i]=addr%dset_dims[i]; + addr/=dset_dims[i]; + } /* end for */ + coords[ndims]=0; /* No offset for element info */ + + /* Compute the hyperslab size from the length given */ + for(i=ndims-1; i>=0; i--) { + /* Check if the hyperslab is wider than the width of the dimension */ + if(seq_len>dset_dims[i]) { + if (0!=coords[i]) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to copy into a proper hyperslab"); + hslab_size[i]=dset_dims[i]; + } /* end if */ + else + hslab_size[i]=seq_len; + + /* Fold the length into the length in the next highest dimension */ + seq_len/=dset_dims[i]; + + /* Make certain the hyperslab sizes don't go less than 1 */ + if(seq_len<1) + seq_len=1; + } /* end for */ + hslab_size[ndims]=elmt_size; /* basic hyperslab size is the element */ + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len); + for(i=0; i<=ndims; i++) + printf("%s: dset_dims[%d]=%d\n",FUNC,i,(int)dset_dims[i]); + for(i=0; i<=ndims; i++) + printf("%s: coords[%d]=%d, hslab_size[%d]=%d\n",FUNC,i,(int)coords[i],(int)i,(int)hslab_size[i]); + count++; + } +} +#endif /* QAK */ + + if (H5F_istore_read(f, dxpl_id, layout, pline, fill, coords, + hslab_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"); + } /* end switch() */ + + FUNC_LEAVE(SUCCEED); +} /* H5F_seq_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_seq_write + * + * Purpose: Writes a sequence of bytes to a file dataset from a buffer in + * in memory. The data is written to file F and the array's size and + * storage information is in LAYOUT. External files are described + * according to the external file list, EFL. The sequence offset is + * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are + * in terms of bytes) and the size of the hyperslab is SEQ_LEN. The + * total size of the file array is implied in the LAYOUT argument. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, October 9, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, const H5O_fill_t *fill, + const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size, + hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset, + const void *_buf) +{ + const uint8_t *buf = (const uint8_t*)_buf; /*cast for arithmetic */ + hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */ + hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */ + hsize_t hslab_size[H5O_LAYOUT_NDIMS]; /* hyperslab size in dataspace*/ + intn ndims; + haddr_t addr; /*address in file */ + intn i; /*counters */ +#ifdef H5_HAVE_PARALLEL + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; +#endif + + FUNC_ENTER(H5F_seq_write, FAIL); + + /* Check args */ + assert(f); + assert(layout); + assert(buf); + +#ifdef H5_HAVE_PARALLEL + { + /* Get the transfer mode */ + H5F_xfer_t *dxpl; + H5FD_mpio_dxpl_t *dx; + + if (H5P_DEFAULT!=dxpl_id && (dxpl=H5I_object(dxpl_id)) && + H5FD_MPIO==dxpl->driver_id && (dx=dxpl->driver_info) && + H5FD_MPIO_INDEPENDENT!=dx->xfer_mode) { + xfer_mode = dx->xfer_mode; + } + } + + /* Collective MPIO access is unsupported for non-contiguous datasets */ + if (H5D_CONTIGUOUS!=layout->type && H5FD_MPIO_COLLECTIVE==xfer_mode) { + HRETURN_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, + "collective access on non-contiguous datasets not supported yet"); + } +#endif + + switch (layout->type) { + case H5D_CONTIGUOUS: + /* Filters cannot be used for contiguous data. */ + if (pline && pline->nfilters>0) { + HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, + "filters are not allowed for contiguous data"); + } + + /* + * Initialize loop variables. The loop is a multi-dimensional loop + * that counts from SIZE down to zero and IDX is the counter. Each + * element of IDX is treated as a digit with IDX[0] being the least + * significant digit. + */ + if (efl && efl->nused>0) { + addr = 0; + } else { + addr = layout->addr; + } + addr += file_offset; + buf += mem_offset; + + /* + * Now begin to walk through the array, copying data from disk to + * memory. + */ +#ifdef H5_HAVE_PARALLEL + if (H5FD_MPIO_COLLECTIVE==xfer_mode) { + /* + * Currently supports same number of collective access. Need to + * be changed LATER to combine all reads into one collective MPIO + * call. + */ + unsigned long max, min, temp; + + temp = seq_len; + assert(temp==seq_len); /* verify no overflow */ + MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, + H5FD_mpio_communicator(f->shared->lf)); + MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, + H5FD_mpio_communicator(f->shared->lf)); +#ifdef AKC + printf("seq_len=%lu, min=%lu, max=%lu\n", temp, min, max); +#endif + if (max != min) + HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, + "collective access with unequal number of blocks not supported yet"); + } +#endif + + /* Write directly to file if the dataset is in an external file */ + /* Note: We can't use data sieve buffers for datasets in external files + * because the 'addr' of all external files is set to 0 (above) and + * all datasets in external files would alias to the same set of + * file offsets, totally mixing up the data sieve buffer information. -QAK + */ + if (efl && efl->nused>0) { + if (H5O_efl_write(f, efl, addr, seq_len, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, + "external data write failed"); + } + } else { + if (H5F_contig_write(f, H5FD_MEM_DRAW, addr, seq_len, dxpl_id, buf)<0) { + HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, + "block write failed"); + } + } /* end else */ + break; + + case H5D_CHUNKED: + /* + * This method is unable to access external raw data files + */ + if (efl && efl->nused>0) { + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, + "chunking and external files are mutually exclusive"); + } + /* Compute the file offset coordinates and hyperslab size */ + if((ndims=H5S_get_simple_extent_dims(file_space,dset_dims,NULL))<0) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to retrieve dataspace dimensions"); + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%lu\n",FUNC,(int)elmt_size,(int)addr,(unsigned long)seq_len); + printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset); + count++; + } +} +#endif /* QAK */ +#ifdef QAK + /* The library shouldn't be reading partial elements currently */ + assert((seq_len%elmt_size)!=0); + assert((addr%elmt_size)!=0); +#endif /* QAK */ + + /* Set location in dataset from the file_offset */ + addr=file_offset; + + /* Convert the bytes into elements */ + seq_len/=elmt_size; + addr/=elmt_size; + + /* Compute the hyperslab offset from the address given */ + for(i=ndims-1; i>=0; i--) { + coords[i]=addr%dset_dims[i]; + addr/=dset_dims[i]; + } /* end for */ + coords[ndims]=0; /* No offset for element info */ + + /* Compute the hyperslab size from the length given */ + for(i=ndims-1; i>=0; i--) { + /* Check if the hyperslab is wider than the width of the dimension */ + if(seq_len>dset_dims[i]) { + if (0!=coords[i]) + HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unable to copy into a proper hyperslab"); + hslab_size[i]=dset_dims[i]; + } /* end if */ + else + hslab_size[i]=seq_len; + + /* Fold the length into the length in the next highest dimension */ + seq_len/=dset_dims[i]; + + /* Make certain the hyperslab sizes don't go less than 1 */ + if(seq_len<1) + seq_len=1; + } /* end for */ + hslab_size[ndims]=elmt_size; /* basic hyperslab size is the element */ + +#ifdef QAK +/* Print out the file offsets & hyperslab sizes */ +{ + static int count=0; + + if(count<10) { + printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len); + for(i=0; i<=ndims; i++) + printf("%s: dset_dims[%d]=%d\n",FUNC,i,(int)dset_dims[i]); + for(i=0; i<=ndims; i++) + printf("%s: coords[%d]=%d, hslab_size[%d]=%d\n",FUNC,i,(int)coords[i],(int)i,(int)hslab_size[i]); + count++; + } +} +#endif /* QAK */ + + if (H5F_istore_write(f, dxpl_id, layout, pline, fill, coords, + hslab_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"); + } /* end switch() */ + + FUNC_LEAVE(SUCCEED); +} /* H5F_seq_write() */ + diff --git a/src/H5G.c b/src/H5G.c index 5d2366a..02cb036 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -71,7 +71,10 @@ * *------------------------------------------------------------------------- */ + #define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + /* Packages needed by this file... */ #include @@ -79,6 +82,7 @@ #include #include #include +#include /*file access */ #include /*Free Lists */ #include #include diff --git a/src/H5Gent.c b/src/H5Gent.c index f62e89e..a9816db 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -6,9 +6,11 @@ * Friday, September 19, 1997 */ #define H5G_PACKAGE +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ #include #include +#include #include #include #include @@ -161,7 +163,7 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) ent->file = f; /* decode header */ - H5F_decode_length(f, *pp, ent->name_off); + H5F_DECODE_LENGTH(f, *pp, ent->name_off); H5F_addr_decode(f, pp, &(ent->header)); UINT32DECODE(*pp, tmp); *pp += 4; /*reserved*/ @@ -273,7 +275,7 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) if (ent) { /* encode header */ - H5F_encode_length(f, *pp, ent->name_off); + H5F_ENCODE_LENGTH(f, *pp, ent->name_off); H5F_addr_encode(f, pp, ent->header); UINT32ENCODE(*pp, ent->type); UINT32ENCODE(*pp, 0); /*reserved*/ @@ -297,7 +299,7 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) HDabort(); } } else { - H5F_encode_length(f, *pp, 0); + H5F_ENCODE_LENGTH(f, *pp, 0); H5F_addr_encode(f, pp, HADDR_UNDEF); UINT32ENCODE(*pp, H5G_NOTHING_CACHED); UINT32ENCODE(*pp, 0); /*reserved*/ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 7165d54..3523a94 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -18,13 +18,14 @@ *------------------------------------------------------------------------- */ #define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Packages needed by this file... */ #include /*library */ #include /*cache */ #include /*B-link trees */ #include /*error handling */ -#include /*file access */ +#include /*file access */ #include /*Free Lists */ #include /*me */ #include /*local heap */ @@ -159,7 +160,7 @@ H5G_node_decode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key) assert(raw); assert(key); - H5F_decode_length(f, raw, key->offset); + H5F_DECODE_LENGTH(f, raw, key->offset); FUNC_LEAVE(SUCCEED); } @@ -191,7 +192,7 @@ H5G_node_encode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key) assert(raw); assert(key); - H5F_encode_length(f, raw, key->offset); + H5F_ENCODE_LENGTH(f, raw, key->offset); FUNC_LEAVE(SUCCEED); } diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 3dd58a8..c486718 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -7,9 +7,11 @@ * */ #define H5G_PACKAGE +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ #include #include +#include /*file access */ #include #include #include diff --git a/src/H5HG.c b/src/H5HG.c index 94a340a..b1c7473 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -24,9 +24,12 @@ * for a new object based on object size, amount of free space * in the collection, and temporal locality. */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include /*library */ #include /*caching */ #include /*error handling */ +#include /*file access */ #include /*Free Lists */ #include /*global heaps */ #include /*file memory management */ @@ -150,7 +153,7 @@ printf("%s: size=%d\n",FUNC,(int)size); *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ - H5F_encode_length (f, p, size); + H5F_ENCODE_LENGTH (f, p, size); /* * Padding so free space object is aligned. If malloc returned memory @@ -171,7 +174,7 @@ printf("%s: heap->obj[0].size=%d, size=%d\n",FUNC,(int)heap->obj[0].size,(int)si UINT16ENCODE(p, 0); /*object ID*/ UINT16ENCODE(p, 0); /*reference count*/ UINT32ENCODE(p, 0); /*reserved*/ - H5F_encode_length (f, p, heap->obj[0].size); + H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p)); /* Add the heap to the cache */ @@ -276,7 +279,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, p += 3; /* Size */ - H5F_decode_length (f, p, heap->size); + H5F_DECODE_LENGTH (f, p, heap->size); assert (heap->size>=H5HG_MINSIZE); /* @@ -322,7 +325,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, assert (NULL==heap->obj[idx].begin); UINT16DECODE (p, heap->obj[idx].nrefs); p += 4; /*reserved*/ - H5F_decode_length (f, p, heap->obj[idx].size); + H5F_DECODE_LENGTH (f, p, heap->obj[idx].size); heap->obj[idx].begin = begin; /* * The total storage size includes the size of the object header @@ -490,7 +493,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size) UINT16ENCODE(p, idx); UINT16ENCODE(p, 0); /*nrefs*/ UINT32ENCODE(p, 0); /*reserved*/ - H5F_encode_length (f, p, size); + H5F_ENCODE_LENGTH (f, p, size); /* Fix the free space object */ if (need==heap->obj[0].size) { @@ -517,7 +520,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size) UINT16ENCODE(p, 0); /*id*/ UINT16ENCODE(p, 0); /*nrefs*/ UINT32ENCODE(p, 0); /*reserved*/ - H5F_encode_length (f, p, heap->obj[0].size); + H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); assert(H5HG_ISALIGNED(heap->obj[0].size)); } else { @@ -884,7 +887,7 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj) UINT16ENCODE(p, 0); /*id*/ UINT16ENCODE(p, 0); /*nrefs*/ UINT32ENCODE(p, 0); /*reserved*/ - H5F_encode_length (f, p, need); + H5F_ENCODE_LENGTH (f, p, need); } HDmemset (heap->obj+hobj->idx, 0, sizeof(H5HG_obj_t)); heap->dirty = 1; diff --git a/src/H5HL.c b/src/H5HL.c index 1b72e81..05431f6 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -18,10 +18,12 @@ * *------------------------------------------------------------------------- */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include /*library */ #include /*cache */ #include /*error handling */ -#include /*file access */ +#include /*file access */ #include /*Free Lists */ #include /*self */ #include /*file memory management */ @@ -239,11 +241,11 @@ H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1, p += 4; /* heap data size */ - H5F_decode_length(f, p, heap->disk_alloc); + H5F_DECODE_LENGTH(f, p, heap->disk_alloc); heap->mem_alloc = heap->disk_alloc; /* free list head */ - H5F_decode_length(f, p, free_block); + H5F_DECODE_LENGTH(f, p, free_block); if (free_block != H5HL_FREE_NULL && free_block >= heap->disk_alloc) { HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list"); @@ -281,8 +283,8 @@ H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1, if (!heap->freelist) heap->freelist = fl; p = heap->chunk + H5HL_SIZEOF_HDR(f) + free_block; - H5F_decode_length(f, p, free_block); - H5F_decode_length(f, p, fl->size); + H5F_DECODE_LENGTH(f, p, free_block); + H5F_DECODE_LENGTH(f, p, fl->size); if (fl->offset + fl->size > heap->disk_alloc) { HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, @@ -366,8 +368,8 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ - H5F_encode_length(f, p, heap->mem_alloc); - H5F_encode_length(f, p, fl ? fl->offset : H5HL_FREE_NULL); + H5F_ENCODE_LENGTH(f, p, heap->mem_alloc); + H5F_ENCODE_LENGTH(f, p, fl ? fl->offset : H5HL_FREE_NULL); H5F_addr_encode(f, &p, heap->addr); /* @@ -377,11 +379,11 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) assert (fl->offset == H5HL_ALIGN (fl->offset)); p = heap->chunk + H5HL_SIZEOF_HDR(f) + fl->offset; if (fl->next) { - H5F_encode_length(f, p, fl->next->offset); + H5F_ENCODE_LENGTH(f, p, fl->next->offset); } else { - H5F_encode_length(f, p, H5HL_FREE_NULL); + H5F_ENCODE_LENGTH(f, p, H5HL_FREE_NULL); } - H5F_encode_length(f, p, fl->size); + H5F_ENCODE_LENGTH(f, p, fl->size); fl = fl->next; } diff --git a/src/H5MF.c b/src/H5MF.c index 0a7ba1e..79b8e8a 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -20,9 +20,11 @@ * *------------------------------------------------------------------------- */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include -#include +#include #include #include diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 4040b88..99732ad 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -20,6 +20,7 @@ /* Private headers needed by this file */ #include #include +#include /*file driver */ /* * Feature: Define H5MF_DEBUG on the compiler command line if you want to diff --git a/src/H5O.c b/src/H5O.c index 5284c80..166f6a2 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -14,10 +14,12 @@ * *------------------------------------------------------------------------- */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include #include -#include +#include #include /*Free Lists */ #include #include diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 7caadbd..7ffd804 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -16,7 +16,8 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ -#define H5A_PACKAGE /*prevent warning from including H5Tpkg.h */ +#define H5A_PACKAGE /*prevent warning from including H5Tpkg.h */ +#define H5S_PACKAGE /*suppress error about including H5Spkg */ #include #include @@ -25,6 +26,7 @@ static char RcsId[] = "@(#)$Revision$"; #include #include #include +#include /* Data spaces */ #define PABLO_MASK H5O_attr_mask diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 45b3e31..d799475 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -17,6 +17,7 @@ * *------------------------------------------------------------------------- */ + #include #include #include @@ -85,7 +86,7 @@ H5O_cont_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) "memory allocation failed"); } H5F_addr_decode(f, &p, &(cont->addr)); - H5F_decode_length(f, p, cont->size); + H5F_DECODE_LENGTH(f, p, cont->size); FUNC_LEAVE((void *) cont); } @@ -119,7 +120,7 @@ H5O_cont_encode(H5F_t *f, uint8_t *p, const void *_mesg) /* encode */ H5F_addr_encode(f, &p, cont->addr); - H5F_encode_length(f, p, cont->size); + H5F_ENCODE_LENGTH(f, p, cont->size); FUNC_LEAVE(SUCCEED); } diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 0a16485..6793873 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -5,8 +5,11 @@ * Programmer: Robb Matzke * Tuesday, November 25, 1997 */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include #include +#include #include #include #include @@ -116,16 +119,16 @@ H5O_efl_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) } for (i=0; inused; i++) { /* Name */ - H5F_decode_length (f, p, mesg->slot[i].name_offset); + H5F_DECODE_LENGTH (f, p, mesg->slot[i].name_offset); s = H5HL_peek(f, mesg->heap_addr, mesg->slot[i].name_offset); assert (s && *s); mesg->slot[i].name = H5MM_xstrdup (s); /* File offset */ - H5F_decode_length (f, p, mesg->slot[i].offset); + H5F_DECODE_LENGTH (f, p, mesg->slot[i].offset); /* Size */ - H5F_decode_length (f, p, mesg->slot[i].size); + H5F_DECODE_LENGTH (f, p, mesg->slot[i].size); assert (mesg->slot[i].size>0); } @@ -191,9 +194,9 @@ H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg) * created. */ assert(mesg->slot[i].name_offset); - H5F_encode_length (f, p, mesg->slot[i].name_offset); - H5F_encode_length (f, p, mesg->slot[i].offset); - H5F_encode_length (f, p, mesg->slot[i].size); + H5F_ENCODE_LENGTH (f, p, mesg->slot[i].name_offset); + H5F_ENCODE_LENGTH (f, p, mesg->slot[i].offset); + H5F_ENCODE_LENGTH (f, p, mesg->slot[i].size); } FUNC_LEAVE(SUCCEED); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 10a1f13..b7b85a4 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include /* @@ -125,7 +125,7 @@ __DLLVAR__ const H5O_class_t H5O_NULL[1]; #define H5O_SDSPACE_ID 0x0001 __DLLVAR__ const H5O_class_t H5O_SDSPACE[1]; -/* operates on an H5S_simple_t struct */ +/* operates on an H5S_t struct */ /* * Data Type Message. diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 1a7e0a8..ae156c4 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -16,12 +16,15 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ +#define H5S_PACKAGE /*prevent warning from including H5Spkg.h */ + #include #include #include /*Free Lists */ #include #include #include +#include #define PABLO_MASK H5O_sdspace_mask @@ -125,7 +128,7 @@ H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) "memory allocation failed"); } for (u = 0; u < sdim->rank; u++) { - H5F_decode_length (f, p, sdim->size[u]); + H5F_DECODE_LENGTH (f, p, sdim->size[u]); } if (flags & H5S_VALID_MAX) { if (NULL==(sdim->max=H5FL_ARR_ALLOC(hsize_t,sdim->rank,0))) { @@ -133,7 +136,7 @@ H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) "memory allocation failed"); } for (u = 0; u < sdim->rank; u++) { - H5F_decode_length (f, p, sdim->max[u]); + H5F_DECODE_LENGTH (f, p, sdim->max[u]); } } #ifdef LATER @@ -212,11 +215,11 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg) if (sdim->rank > 0) { for (u = 0; u < sdim->rank; u++) { - H5F_encode_length (f, p, sdim->size[u]); + H5F_ENCODE_LENGTH (f, p, sdim->size[u]); } if (flags & H5S_VALID_MAX) { for (u = 0; u < sdim->rank; u++) { - H5F_encode_length (f, p, sdim->max[u]); + H5F_ENCODE_LENGTH (f, p, sdim->max[u]); } } #ifdef LATER @@ -313,7 +316,7 @@ H5O_sdspace_copy(const void *mesg, void *dest) static size_t H5O_sdspace_size(H5F_t *f, const void *mesg) { - const H5S_simple_t *sdim = (const H5S_simple_t *) mesg; + const H5S_simple_t *space = (const H5S_simple_t *) mesg; /* * All dimensionality messages are at least 8 bytes long. @@ -323,14 +326,14 @@ H5O_sdspace_size(H5F_t *f, const void *mesg) FUNC_ENTER(H5O_sdspace_size, 0); /* add in the dimension sizes */ - ret_value += sdim->rank * H5F_SIZEOF_SIZE (f); + ret_value += space->rank * H5F_SIZEOF_SIZE (f); /* add in the space for the maximum dimensions, if they are present */ - ret_value += sdim->max ? sdim->rank * H5F_SIZEOF_SIZE (f) : 0; + ret_value += space->max ? space->rank * H5F_SIZEOF_SIZE (f) : 0; #ifdef LATER /* add in the space for the dimension permutations, if they are present */ - ret_value += sdim->perm ? sdim->rank * 4 : 0; + ret_value += space->perm ? space->rank * 4 : 0; #endif FUNC_LEAVE(ret_value); diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 1e1216b..b33243b 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -13,6 +13,7 @@ * pointed-to message and the pointed-to message is stored in * the global heap. */ + #include #include #include diff --git a/src/H5P.c b/src/H5P.c index 3a4de07..3f5effc 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -22,6 +22,7 @@ static char RcsId[] = "@(#)$Revision$"; #include /* B-tree subclass names */ #include /* Datasets */ #include /* Error handling */ +#include /* Files */ #include /* File drivers */ #include /* Free Lists */ #include /* Memory management */ @@ -317,7 +318,7 @@ H5Pcreate(H5P_class_t type) src = &H5D_create_dflt; break; case H5P_DATA_XFER: - src = &H5F_xfer_dflt; + src = &H5D_xfer_dflt; break; case H5P_MOUNT: src = &H5F_mount_dflt; @@ -442,7 +443,7 @@ H5P_close(void *_plist) { H5P_t *plist=(H5P_t *)_plist; H5F_access_t *fa_list = &(plist->u.faccess); - H5F_xfer_t *dx_list = &(plist->u.dxfer); + H5D_xfer_t *dx_list = &(plist->u.dxfer); H5D_create_t *dc_list = &(plist->u.dcreate); FUNC_ENTER (H5P_close, FAIL); @@ -657,7 +658,7 @@ H5P_copy (H5P_class_t type, const void *src) const H5D_create_t *dc_src = NULL; H5D_create_t *dc_dst = NULL; H5F_access_t *fa_dst = NULL; - H5F_xfer_t *dx_dst = NULL; + H5D_xfer_t *dx_dst = NULL; FUNC_ENTER (H5P_copy, NULL); @@ -676,7 +677,7 @@ H5P_copy (H5P_class_t type, const void *src) break; case H5P_DATA_XFER: - size = sizeof(H5F_xfer_t); + size = sizeof(H5D_xfer_t); break; case H5P_MOUNT: @@ -740,7 +741,7 @@ H5P_copy (H5P_class_t type, const void *src) break; case H5P_DATA_XFER: - dx_dst = (H5F_xfer_t*)dst; + dx_dst = (H5D_xfer_t*)dst; if (dx_dst->driver_id>=0) { H5I_inc_ref(dx_dst->driver_id); @@ -1662,7 +1663,7 @@ herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info) { H5F_access_t *fapl=NULL; - H5F_xfer_t *dxpl=NULL; + H5D_xfer_t *dxpl=NULL; FUNC_ENTER(H5Pset_driver, FAIL); H5TRACE3("e","iix",plist_id,driver_id,driver_info); @@ -1741,7 +1742,7 @@ hid_t H5Pget_driver(hid_t plist_id) { H5F_access_t *fapl=NULL; - H5F_xfer_t *dxpl=NULL; + H5D_xfer_t *dxpl=NULL; hid_t ret_value=-1; FUNC_ENTER (H5Pget_driver, FAIL); @@ -1792,7 +1793,7 @@ void * H5Pget_driver_info(hid_t plist_id) { H5F_access_t *fapl=NULL; - H5F_xfer_t *dxpl=NULL; + H5D_xfer_t *dxpl=NULL; void *ret_value=NULL; FUNC_ENTER(H5Pget_driver_info, NULL); @@ -1953,7 +1954,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER (H5Pset_buffer, FAIL); H5TRACE4("e","izxx",plist_id,size,tconv,bkg); @@ -1997,7 +1998,7 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) size_t H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER (H5Pget_buffer, 0); H5TRACE3("z","ixx",plist_id,tconv,bkg); @@ -2045,7 +2046,7 @@ H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) herr_t H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER (H5Pset_hyper_cache, FAIL); H5TRACE3("e","iIuIu",plist_id,cache,limit); @@ -2083,7 +2084,7 @@ herr_t H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/, unsigned *limit/*out*/) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER (H5Pget_hyper_cache, FAIL); H5TRACE3("e","ixx",plist_id,cache,limit); @@ -2126,7 +2127,7 @@ H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/, herr_t H5Pset_preserve(hid_t plist_id, hbool_t status) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER (H5Pset_preserve, FAIL); H5TRACE2("e","ib",plist_id,status); @@ -2164,7 +2165,7 @@ H5Pset_preserve(hid_t plist_id, hbool_t status) int H5Pget_preserve(hid_t plist_id) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER (H5Pget_preserve, FAIL); H5TRACE1("Is","i",plist_id); @@ -2483,7 +2484,7 @@ herr_t H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/, double *right/*out*/) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER(H5Pget_btree_ratios, FAIL); H5TRACE4("e","ixxx",plist_id,left,middle,right); @@ -2533,7 +2534,7 @@ herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER(H5Pget_btree_ratios, FAIL); H5TRACE4("e","iddd",plist_id,left,middle,right); @@ -2840,7 +2841,7 @@ herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER(H5Pset_vlen_mem_manager, FAIL); H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info); @@ -2882,7 +2883,7 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/, H5MM_free_t *free_func/*out*/, void **free_info/*out*/) { - H5F_xfer_t *plist = NULL; + H5D_xfer_t *plist = NULL; FUNC_ENTER(H5Pget_vlen_mem_manager, FAIL); H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 4f5d16f..676254e 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -89,7 +89,7 @@ typedef struct { H5F_create_t fcreate; /* File creation properties */ H5F_access_t faccess; /* File access properties */ H5D_create_t dcreate; /* Dataset creation properties */ - H5F_xfer_t dxfer; /* Data transfer properties */ + H5D_xfer_t dxfer; /* Data transfer properties */ H5F_mprop_t mount; /* Mounting properties */ } u; H5P_class_t class; /* Property list class */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 49c2563..9763aec 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -25,6 +25,7 @@ #include #include #include +#include #include /* Property list classes */ diff --git a/src/H5R.c b/src/H5R.c index 8ab44cf..ab7921a 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -16,11 +16,13 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + #include /* Generic Functions */ #include /* ID Functions */ #include /* Datasets */ #include /* Error handling */ -#include /* Files */ +#include /* Files */ #include /* Groups */ #include /* Global Heaps */ #include /* Memory Management */ diff --git a/src/H5S.c b/src/H5S.c index 485d92f..5db6c7a 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -16,6 +16,8 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ +#define H5S_PACKAGE /*suppress error about including H5Spkg */ + #define _H5S_IN_H5S_C #include /* Generic Functions */ #include /* ID Functions */ @@ -23,7 +25,7 @@ static char RcsId[] = "@(#)$Revision$"; #include /* Free Lists */ #include /* Memory Management functions */ #include /* object headers */ -#include /* Data-space functions */ +#include /* Data-space functions */ /* Interface initialization */ #define PABLO_MASK H5S_mask @@ -1722,6 +1724,40 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], if (ret_value<0 && space) H5S_close(space); FUNC_LEAVE(ret_value); } + + +/*------------------------------------------------------------------------- + * Function: H5S_get_simple_extent_type + * + * Purpose: Internal function for retrieving the type of extent for a dataspace object + * + * Return: Success: The class of the dataspace object + * + * Failure: N5S_NO_CLASS + * + * Errors: + * + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +H5S_class_t +H5S_get_simple_extent_type(const H5S_t *space) +{ + H5S_class_t ret_value = H5S_NO_CLASS; + + FUNC_ENTER(H5S_get_simple_extent_type, H5S_NO_CLASS); + + assert(space); + + ret_value=space->extent.type; + + FUNC_LEAVE(ret_value); +} + /*------------------------------------------------------------------------- * Function: H5Sget_simple_extent_type @@ -1755,7 +1791,7 @@ H5Sget_simple_extent_type(hid_t sid) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace"); } - ret_value=space->extent.type; + ret_value=H5S_get_simple_extent_type(space); FUNC_LEAVE(ret_value); } diff --git a/src/H5Sall.c b/src/H5Sall.c index f3ca1e5..f4d75f9 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -7,10 +7,13 @@ * * Purpose: "All" selection data space I/O functions. */ + +#define H5S_PACKAGE /*suppress error about including H5Spkg */ + #include #include #include -#include +#include #include #include diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 65cc9fd..336536b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -7,14 +7,18 @@ * * Purpose: Hyperslab selection data space I/O functions. */ + +#define H5S_PACKAGE /*suppress error about including H5Spkg */ + #include #include #include +#include #include /*Free Lists */ #include #include #include -#include +#include #include /* Interface initialization */ @@ -585,13 +589,13 @@ H5S_hyper_fread (intn dim, H5S_hyper_io_info_t *io_info) size_t i; /* Counters */ intn j; size_t num_read=0; /* Number of elements read */ - const H5F_xfer_t *xfer_parms;/* Data transfer property list */ + const H5D_xfer_t *xfer_parms;/* Data transfer property list */ FUNC_ENTER (H5S_hyper_fread, 0); assert(io_info); if (H5P_DEFAULT==io_info->dxpl_id) { - xfer_parms = &H5F_xfer_dflt; + xfer_parms = &H5D_xfer_dflt; } else { xfer_parms = H5I_object(io_info->dxpl_id); assert(xfer_parms); @@ -934,17 +938,19 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, hid_t dxpl_id, void *_buf/*out*/) { - hsize_t hsize[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ - hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */ hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset on disk */ + hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary block count */ hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block offset */ uint8_t *buf=(uint8_t *)_buf; /* Alias for pointer arithmetic */ intn fast_dim; /* Rank of the fastest changing dimension for the dataspace */ intn temp_dim; /* Temporary rank holder */ + hsize_t acc; /* Accumulator */ + size_t buf_off; /* Buffer offset for copying memory */ intn i; /* Counters */ intn ndims; /* Number of dimensions of dataset */ uintn actual_read; /* The actual number of elements to read in */ + uintn actual_bytes; /* The actual number of bytes to copy */ size_t num_read=0; /* Number of elements read */ FUNC_ENTER (H5S_hyper_fread_opt, 0); @@ -965,15 +971,13 @@ for(i=0; iextent.u.simple.rank; i++) /* Set the rank of the fastest changing dimension */ fast_dim=file_space->extent.u.simple.rank-1; - - /* Set up the hyperslab and 'zero' arrays */ ndims=file_space->extent.u.simple.rank; - /* initialize hyperslab size and offset in memory buffer */ - for(i=0; i<(ndims+1); i++) { - hsize[i]=1; /* hyperslab size is 1, except for last element */ - zero[i]=0; /* memory offset is 0 */ + + /* initialize row sizes for each dimension */ + for(i=(ndims-1),acc=1; i>=0; i--) { + slab[i]=acc*elmt_size; + acc*=file_space->extent.u.simple.size[i]; } /* end for */ - hsize[ndims] = elmt_size; /* Check if we stopped in the middle of a sequence of elements */ if((file_iter->hyp.pos[fast_dim]-file_space->select.sel_info.hslab.diminfo[fast_dim].start)%file_space->select.sel_info.hslab.diminfo[fast_dim].stride!=0) { @@ -987,9 +991,7 @@ printf("%s: Check 1.0\n",FUNC); /* Make certain that we don't read too many */ actual_read=MIN(leftover,nelmts); - - /* Set the hyperslab size in the fastest changing dimension to read in */ - hsize[fast_dim]=actual_read; + actual_bytes=actual_read*elmt_size; /* Copy the location of the point to get */ HDmemcpy(offset, file_iter->hyp.pos,ndims*sizeof(hssize_t)); @@ -999,9 +1001,13 @@ printf("%s: Check 1.0\n",FUNC); for(i=0; iselect.offset[i]; - /* Read in the rest of the sequence, if possible */ - if (H5F_arr_read(f, dxpl_id, layout, pline, fill, efl, hsize, - hsize, zero, offset, buf/*out*/)<0) { + /* Compute the initial buffer offset */ + for(i=0,buf_off=0; ihyp.pos[i]-file_space->select.sel_info.hslab.diminfo[i].start)/file_space->select.sel_info.hslab.diminfo[i].stride; } /* end for */ + /* Compute the initial buffer offset */ + for(i=0,buf_off=0; iselect.sel_info.hslab.diminfo[fast_dim].block; - hsize[fast_dim]=actual_read; + + /* Set the number of actual bytes */ + actual_bytes=actual_read*elmt_size; #ifdef QAK printf("%s: actual_read=%d\n",FUNC,(int)actual_read); for(i=0; iextent.u.simple.rank; i++) @@ -1071,7 +1083,7 @@ for(i=0; iextent.u.simple.rank; i++) /* Check if we are running out of room in the buffer */ if((actual_read+num_read)>nelmts) { actual_read=nelmts-num_read; - hsize[fast_dim]=actual_read; + actual_bytes=actual_read*elmt_size; } /* end if */ #ifdef QAK @@ -1080,9 +1092,9 @@ for(i=0; iextent.u.simple.rank; i++) printf("%s: tmp_count[%d]=%d, offset[%d]=%d\n",FUNC,(int)i,(int)tmp_count[i],(int)i,(int)offset[i]); #endif /* QAK */ - /* Read in the sequence, if possible */ - if (H5F_arr_read(f, dxpl_id, layout, pline, fill, efl, hsize, - hsize, zero, offset, buf/*out*/)<0) { + /* Read in the sequence */ + if (H5F_seq_read(f, dxpl_id, layout, pline, fill, efl, file_space, + elmt_size, actual_bytes, 0, buf_off, buf/*out*/)<0) { HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error"); } @@ -1103,10 +1115,12 @@ for(i=0; iextent.u.simple.rank; i++) /* Check for partial block read! */ if(actual_readselect.sel_info.hslab.diminfo[fast_dim].block) { offset[temp_dim]+=actual_read; + buf_off+=actual_bytes; break; } /* end if */ else { offset[temp_dim]+=file_space->select.sel_info.hslab.diminfo[temp_dim].stride; /* reset the offset in the fastest dimension */ + buf_off+=slab[temp_dim]*file_space->select.sel_info.hslab.diminfo[temp_dim].stride; tmp_count[temp_dim]++; } /* end else */ @@ -1116,11 +1130,16 @@ for(i=0; iextent.u.simple.rank; i++) else { tmp_count[temp_dim]=0; /* reset back to the beginning of the line */ offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim]; + + /* Re-compute the initial buffer offset */ + for(i=0,buf_off=0; iextent.u.simple.rank; i++) else { /* Move to the next block in the current dimension */ offset[temp_dim]+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block); + buf_off+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block)*slab[temp_dim]; tmp_block[temp_dim]=0; tmp_count[temp_dim]++; @@ -1139,6 +1159,10 @@ for(i=0; iextent.u.simple.rank; i++) tmp_count[temp_dim]=0; /* reset back to the beginning of the line */ tmp_block[temp_dim]=0; offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim]; + + /* Re-compute the initial buffer offset */ + for(i=0,buf_off=0; idxpl_id) { - xfer_parms = &H5F_xfer_dflt; + xfer_parms = &H5D_xfer_dflt; } else { xfer_parms = H5I_object(io_info->dxpl_id); assert(xfer_parms); @@ -1434,18 +1458,20 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, hid_t dxpl_id, const void *_buf) { - hsize_t hsize[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ - hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */ hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset on disk */ + hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary block count */ hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block offset */ const uint8_t *buf=(const uint8_t *)_buf; /* Alias for pointer arithmetic */ intn fast_dim; /* Rank of the fastest changing dimension for the dataspace */ intn temp_dim; /* Temporary rank holder */ + hsize_t acc; /* Accumulator */ + size_t buf_off; /* Buffer offset for copying memory */ intn i; /* Counters */ intn ndims; /* Number of dimensions of dataset */ - uintn actual_write; /* The actual number of elements to read in */ - size_t num_write=0; /* Number of elements read */ + uintn actual_write; /* The actual number of elements to read in */ + uintn actual_bytes; /* The actual number of bytes to copy */ + size_t num_write=0; /* Number of elements read */ FUNC_ENTER (H5S_hyper_fwrite_opt, 0); @@ -1465,15 +1491,13 @@ for(i=0; iextent.u.simple.rank; i++) /* Set the rank of the fastest changing dimension */ fast_dim=file_space->extent.u.simple.rank-1; - - /* Set up the hyperslab and 'zero' arrays */ ndims=file_space->extent.u.simple.rank; - /* initialize hyperslab size and offset in memory buffer */ - for(i=0; i<(int)(ndims+1); i++) { - hsize[i]=1; /* hyperslab size is 1, except for last element */ - zero[i]=0; /* memory offset is 0 */ + + /* initialize row sizes for each dimension */ + for(i=(ndims-1),acc=1; i>=0; i--) { + slab[i]=acc*elmt_size; + acc*=file_space->extent.u.simple.size[i]; } /* end for */ - hsize[ndims] = elmt_size; /* Check if we stopped in the middle of a sequence of elements */ if((file_iter->hyp.pos[fast_dim]-file_space->select.sel_info.hslab.diminfo[fast_dim].start)%file_space->select.sel_info.hslab.diminfo[fast_dim].stride!=0) { @@ -1487,9 +1511,7 @@ printf("%s: Check 1.0\n",FUNC); /* Make certain that we don't write too many */ actual_write=MIN(leftover,nelmts); - - /* Set the hyperslab size in the fastest changing dimension to write in */ - hsize[fast_dim]=actual_write; + actual_bytes=actual_write*elmt_size; /* Copy the location of the point to get */ HDmemcpy(offset, file_iter->hyp.pos,ndims*sizeof(hssize_t)); @@ -1499,10 +1521,14 @@ printf("%s: Check 1.0\n",FUNC); for(i=0; iselect.offset[i]; - /* Read in the rest of the sequence, if possible */ - if (H5F_arr_write(f, dxpl_id, layout, pline, fill, efl, hsize, - hsize, zero, offset, buf)<0) { - HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "write error"); + /* Compute the initial buffer offset */ + for(i=0,buf_off=0; ihyp.pos[i]-file_space->select.sel_info.hslab.diminfo[i].start)/file_space->select.sel_info.hslab.diminfo[i].stride; } /* end for */ + /* Compute the initial buffer offset */ + for(i=0,buf_off=0; iselect.sel_info.hslab.diminfo[fast_dim].block; - hsize[fast_dim]=actual_write; + + /* Set the number of actual bytes */ + actual_bytes=actual_write*elmt_size; #ifdef QAK printf("%s: actual_write=%d\n",FUNC,(int)actual_write); for(i=0; iextent.u.simple.rank; i++) @@ -1571,7 +1603,7 @@ for(i=0; iextent.u.simple.rank; i++) /* Check if we are running out of room in the buffer */ if((actual_write+num_write)>nelmts) { actual_write=nelmts-num_write; - hsize[fast_dim]=actual_write; + actual_bytes=actual_write*elmt_size; } /* end if */ #ifdef QAK @@ -1580,10 +1612,10 @@ for(i=0; iextent.u.simple.rank; i++) printf("%s: tmp_count[%d]=%d, offset[%d]=%d\n",FUNC,(int)i,(int)tmp_count[i],(int)i,(int)offset[i]); #endif /* QAK */ - /* Read in the sequence, if possible */ - if (H5F_arr_write(f, dxpl_id, layout, pline, fill, efl, hsize, - hsize, zero, offset, buf)<0) { - HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "write error"); + /* Read in the sequence */ + if (H5F_seq_write(f, dxpl_id, layout, pline, fill, efl, file_space, + elmt_size, actual_bytes, 0, buf_off, buf)<0) { + HRETURN_ERROR(H5E_DATASPACE, H5E_WRITEERROR, 0, "write error"); } /* Increment the offset of the buffer */ @@ -1603,10 +1635,12 @@ for(i=0; iextent.u.simple.rank; i++) /* Check for partial block write! */ if(actual_writeselect.sel_info.hslab.diminfo[fast_dim].block) { offset[temp_dim]+=actual_write; + buf_off+=actual_bytes; break; } /* end if */ else { offset[temp_dim]+=file_space->select.sel_info.hslab.diminfo[temp_dim].stride; /* reset the offset in the fastest dimension */ + buf_off+=slab[temp_dim]*file_space->select.sel_info.hslab.diminfo[temp_dim].stride; tmp_count[temp_dim]++; } /* end else */ @@ -1616,11 +1650,16 @@ for(i=0; iextent.u.simple.rank; i++) else { tmp_count[temp_dim]=0; /* reset back to the beginning of the line */ offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim]; + + /* Re-compute the initial buffer offset */ + for(i=0,buf_off=0; iextent.u.simple.rank; i++) else { /* Move to the next block in the current dimension */ offset[temp_dim]+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block); + buf_off+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block)*slab[temp_dim]; tmp_block[temp_dim]=0; tmp_count[temp_dim]++; @@ -1639,6 +1679,10 @@ for(i=0; iextent.u.simple.rank; i++) tmp_count[temp_dim]=0; /* reset back to the beginning of the line */ tmp_block[temp_dim]=0; offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim]; + + /* Re-compute the initial buffer offset */ + for(i=0,buf_off=0; i #include #include -#include +#include #include /*the MPIO file driver */ diff --git a/src/H5Snone.c b/src/H5Snone.c index cba2af4..dbfab2e 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -7,10 +7,13 @@ * * Purpose: "None" selection data space I/O functions. */ + +#define H5S_PACKAGE /*suppress error about including H5Spkg */ + #include #include #include -#include +#include #include #include diff --git a/src/H5Spkg.h b/src/H5Spkg.h new file mode 100644 index 0000000..a517378 --- /dev/null +++ b/src/H5Spkg.h @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2000 NCSA + * All rights reserved. + * + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 + * + * Purpose: This file contains declarations which are visible only within + * the H5S package. Source files outside the H5S package should + * include H5Sprivate.h instead. + */ +#ifndef H5S_PACKAGE +#error "Do not include this file outside the H5S package!" +#endif + +#ifndef _H5Spkg_H +#define _H5Spkg_H + +#include + +/* + * Dataspace extent information + */ +/* Simple extent container */ +typedef struct H5S_simple_t { + intn rank; /* Number of dimensions */ + hsize_t *size; /* Current size of the dimensions */ + hsize_t *max; /* Maximum size of the dimensions */ +#ifdef LATER + hsize_t *perm; /* Dimension permutation array */ +#endif /* LATER */ +} H5S_simple_t; + +/* Extent container */ +typedef struct { + H5S_class_t type; /* Type of extent */ + union { + H5S_simple_t simple; /* Simple dimensionality information */ + } u; +} H5S_extent_t; + +/* + * Dataspace selection information + */ +/* Node in point selection list (typedef'd in H5Sprivate.h) */ +struct H5S_pnt_node_t { + hssize_t *pnt; /* Pointer to a selected point */ + struct H5S_pnt_node_t *next; /* pointer to next point in list */ +}; + +/* Information about point selection list */ +typedef struct { + H5S_pnt_node_t *head; /* Pointer to head of point list */ +} H5S_pnt_list_t; + +/* Node in hyperslab selection list */ +typedef struct H5S_hyper_node_tag { + hssize_t *start; /* Pointer to a corner of a hyperslab closest to the origin */ + hssize_t *end; /* Pointer to a corner of a hyperslab furthest from the origin */ + struct { + uintn cached; /* Flag to indicate that the block is cached (during I/O only) */ + size_t size; /* Size of cached block (in elements) */ + uintn rleft; /* Read elements left to access in block */ + uintn wleft; /* Write elements left to access in block */ + uint8_t *block; /* Pointer into buffer for cache */ + uint8_t *rpos; /* Pointer to current read location within block */ + uint8_t *wpos; /* Pointer to current write location within block */ + } cinfo; + struct H5S_hyper_node_tag *next; /* pointer to next hyperslab in list */ +} H5S_hyper_node_t; + +/* Region in dimension */ +typedef struct H5S_hyper_region_tag { + hssize_t start; /* The low bound of a region in a dimension */ + hssize_t end; /* The high bound of a region in a dimension */ + H5S_hyper_node_t *node; /* pointer to the node the region is in */ +} H5S_hyper_region_t; + +/* Information about hyperslab boundary and pointer to hyperslab node */ +typedef struct { + hssize_t bound; /* Location of boundary */ + H5S_hyper_node_t *node; /* Boundary's node */ +} H5S_hyper_bound_t; + +/* Information about hyperslab list */ +typedef struct { + size_t count; /* Number of nodes in list */ + H5S_hyper_node_t *head; /* Pointer to head of hyperslab list */ + H5S_hyper_bound_t **lo_bounds; /* Lower (closest to the origin) bound array for each dimension */ +} H5S_hyper_list_t; + +/* Information about one dimension in a hyperslab selection */ +typedef struct { + hssize_t start; + hsize_t stride; + hsize_t count; + hsize_t block; +} H5S_hyper_dim_t; + +/* Information about hyperslab selection */ +typedef struct { + H5S_hyper_dim_t *diminfo; /* ->[rank] of per-dim selection info */ + /* diminfo only points to one array, which holds the information + * for one hyperslab selection. Perhaps this might need to be + * expanded into a list of arrays when the H5Sselect_hyperslab's + * restriction to H5S_SELECT_SET is removed. */ + H5S_hyper_dim_t *app_diminfo;/* ->[rank] of per-dim selection info */ + /* 'diminfo' points to a [potentially] optimized version of the user's + * hyperslab information. 'app_diminfo' points to the actual parameters + * that the application used for setting the hyperslab selection. These + * are only used for re-gurgitating the original values used to set the + * hyperslab to the application when it queries the hyperslab selection + * information. */ + H5S_hyper_list_t *hyper_lst; /* List of selected hyperslabs (order is not important) */ +} H5S_hyper_sel_t; + +/* Selection information container */ +typedef struct { + H5S_sel_type type; /* Type of selection (list of points or hyperslabs) */ + hssize_t *offset; /* Offset within the extent (NULL means a 0 offset) */ + hsize_t *order; /* Selection order. (NULL means a specific ordering of points) */ + hsize_t num_elem; /* Number of elements in selection */ + union { + H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */ + H5S_hyper_sel_t hslab; /* Info about hyperslab selections */ + } sel_info; +} H5S_select_t; + +/* Main dataspace structure (typedef'd in H5Sprivate.h) */ +struct H5S_t { + H5S_extent_t extent; /* Dataspace extent */ + H5S_select_t select; /* Dataspace selection */ +}; + +__DLL__ herr_t H5S_close_simple(H5S_simple_t *simple); +__DLL__ herr_t H5S_release_simple(H5S_simple_t *simple); +__DLL__ herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); +__DLL__ herr_t H5S_register(H5S_sel_type cls, const H5S_fconv_t *fconv, + const H5S_mconv_t *mconv); + +/* Point select functions */ +__DLL__ herr_t H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, + const hssize_t **coord); +__DLL__ herr_t H5S_point_release(H5S_t *space); +__DLL__ hsize_t H5S_point_npoints(const H5S_t *space); +__DLL__ herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src); +__DLL__ htri_t H5S_point_select_valid(const H5S_t *space); +__DLL__ hssize_t H5S_point_select_serial_size(const H5S_t *space); +__DLL__ herr_t H5S_point_select_serialize(const H5S_t *space, uint8_t *buf); +__DLL__ herr_t H5S_point_select_deserialize(H5S_t *space, const uint8_t *buf); +__DLL__ herr_t H5S_point_bounds(H5S_t *space, hsize_t *start, hsize_t *end); +__DLL__ htri_t H5S_point_select_contiguous(const H5S_t *space); +__DLL__ herr_t H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, + H5D_operator_t op, + void *operator_data); + +/* "All" select functions */ +__DLL__ herr_t H5S_all_release(H5S_t *space); +__DLL__ hsize_t H5S_all_npoints(const H5S_t *space); +__DLL__ herr_t H5S_all_select_serialize(const H5S_t *space, uint8_t *buf); +__DLL__ herr_t H5S_all_select_deserialize(H5S_t *space, const uint8_t *buf); +__DLL__ herr_t H5S_all_bounds(H5S_t *space, hsize_t *start, hsize_t *end); +__DLL__ herr_t H5S_all_read(H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, const H5S_t *mem_space, + hid_t dxpl_id, void *buf/*out*/, + hbool_t *must_convert/*out*/); +__DLL__ herr_t H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, const H5S_t *mem_space, + hid_t dxpl_id, const void *buf, + hbool_t *must_convert/*out*/); +__DLL__ herr_t H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, + H5D_operator_t op, void *operator_data); + +/* Hyperslab selection functions */ +__DLL__ herr_t H5S_hyper_release(H5S_t *space); +__DLL__ herr_t H5S_hyper_sel_iter_release(H5S_sel_iter_t *sel_iter); +__DLL__ hsize_t H5S_hyper_npoints(const H5S_t *space); +__DLL__ int H5S_hyper_compare_regions(const void *r1, const void *r2); +__DLL__ int H5S_hyper_compare_bounds(const void *r1, const void *r2); +__DLL__ herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src); +__DLL__ htri_t H5S_hyper_select_valid(const H5S_t *space); +__DLL__ intn H5S_hyper_bound_comp(const void *_b1, const void *_b2); +__DLL__ herr_t H5S_hyper_node_add(H5S_hyper_node_t **head, intn endflag, + intn rank, const hssize_t *start, + const hsize_t *size); +__DLL__ herr_t H5S_hyper_clip(H5S_t *space, H5S_hyper_node_t *nodes, + H5S_hyper_node_t **uniq, + H5S_hyper_node_t **overlap); +__DLL__ hssize_t H5S_hyper_select_serial_size(const H5S_t *space); +__DLL__ herr_t H5S_hyper_select_serialize(const H5S_t *space, uint8_t *buf); +__DLL__ herr_t H5S_hyper_select_deserialize(H5S_t *space, const uint8_t *buf); +__DLL__ herr_t H5S_hyper_bounds(H5S_t *space, hsize_t *start, hsize_t *end); +__DLL__ htri_t H5S_hyper_select_contiguous(const H5S_t *space); +__DLL__ herr_t H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space, + H5D_operator_t op, void *operator_data); + +/* "None" selection functions */ +__DLL__ herr_t H5S_none_select_serialize(const H5S_t *space, uint8_t *buf); +__DLL__ herr_t H5S_none_select_deserialize(H5S_t *space, const uint8_t *buf); +__DLL__ herr_t H5S_none_select_iterate(void *buf, hid_t type_id, H5S_t *space, + H5D_operator_t op, void *operator_data); + +#ifdef H5_HAVE_PARALLEL +/* MPI-IO function to read directly from app buffer to file rky980813 */ +__DLL__ herr_t H5S_mpio_spaces_read(H5F_t *f, + const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, + size_t elmt_size, const H5S_t *file_space, + const H5S_t *mem_space, hid_t dxpl_id, + void *buf/*out*/, + hbool_t *must_convert /*out*/ ); + +/* MPI-IO function to write directly from app buffer to file rky980813 */ +__DLL__ herr_t H5S_mpio_spaces_write(H5F_t *f, + const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, + size_t elmt_size, const H5S_t *file_space, + const H5S_t *mem_space, hid_t dxpl_id, + const void *buf, + hbool_t *must_convert /*out*/ ); +#ifndef _H5S_IN_H5S_C +/* Global var whose value comes from environment variable */ +__DLLVAR__ hbool_t H5_mpi_opt_types_g; +#endif /* _H5S_IN_H5S_C */ + +#endif /* H5_HAVE_PARALLEL */ + +#endif diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 7cd56bf..d56fe82 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -7,11 +7,14 @@ * * Purpose: Point selection data space I/O functions. */ + +#define H5S_PACKAGE /*suppress error about including H5Spkg */ + #include #include #include #include -#include +#include #include #include diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 2824af0..4ae3510 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -22,7 +22,6 @@ #include #include #include -#include /*for H5G_entry_t */ #include #define H5S_RESERVED_ATOMS 2 @@ -31,30 +30,10 @@ #define H5S_VALID_MAX 0x01 #define H5S_VALID_PERM 0x02 -/* - * Dataspace extent information - */ -/* Simple extent container */ -typedef struct H5S_simple_t { - intn rank; /* Number of dimensions */ - hsize_t *size; /* Current size of the dimensions */ - hsize_t *max; /* Maximum size of the dimensions */ -#ifdef LATER - hsize_t *perm; /* Dimension permutation array */ -#endif /* LATER */ -} H5S_simple_t; - -/* Extent container */ -typedef struct { - H5S_class_t type; /* Type of extent */ - union { - H5S_simple_t simple; /* Simple dimensionality information */ - } u; -} H5S_extent_t; +/* Forward references of common typedefs */ +typedef struct H5S_t H5S_t; +typedef struct H5S_pnt_node_t H5S_pnt_node_t; -/* - * Dataspace selection information - */ /* Enumerated type for the type of selection */ typedef enum { H5S_SEL_ERROR = -1, /* Error */ @@ -65,90 +44,6 @@ typedef enum { H5S_SEL_N = 4 /*THIS MUST BE LAST */ }H5S_sel_type; -/* Node in point selection list */ -typedef struct H5S_pnt_node_tag { - hssize_t *pnt; /* Pointer to a selected point */ - struct H5S_pnt_node_tag *next; /* pointer to next point in list */ -} H5S_pnt_node_t; - -/* Information about point selection list */ -typedef struct { - H5S_pnt_node_t *head; /* Pointer to head of point list */ -} H5S_pnt_list_t; - -/* Node in hyperslab selection list */ -typedef struct H5S_hyper_node_tag { - hssize_t *start; /* Pointer to a corner of a hyperslab closest to the origin */ - hssize_t *end; /* Pointer to a corner of a hyperslab furthest from the origin */ - struct { - uintn cached; /* Flag to indicate that the block is cached (during I/O only) */ - size_t size; /* Size of cached block (in elements) */ - uintn rleft; /* Read elements left to access in block */ - uintn wleft; /* Write elements left to access in block */ - uint8_t *block; /* Pointer into buffer for cache */ - uint8_t *rpos; /* Pointer to current read location within block */ - uint8_t *wpos; /* Pointer to current write location within block */ - } cinfo; - struct H5S_hyper_node_tag *next; /* pointer to next hyperslab in list */ -} H5S_hyper_node_t; - -/* Region in dimension */ -typedef struct H5S_hyper_region_tag { - hssize_t start; /* The low bound of a region in a dimension */ - hssize_t end; /* The high bound of a region in a dimension */ - H5S_hyper_node_t *node; /* pointer to the node the region is in */ -} H5S_hyper_region_t; - -/* Information about hyperslab boundary and pointer to hyperslab node */ -typedef struct { - hssize_t bound; /* Location of boundary */ - H5S_hyper_node_t *node; /* Boundary's node */ -} H5S_hyper_bound_t; - -/* Information about hyperslab list */ -typedef struct { - size_t count; /* Number of nodes in list */ - H5S_hyper_node_t *head; /* Pointer to head of hyperslab list */ - H5S_hyper_bound_t **lo_bounds; /* Lower (closest to the origin) bound array for each dimension */ -} H5S_hyper_list_t; - -/* Information about one dimension in a hyperslab selection */ -typedef struct { - hssize_t start; - hsize_t stride; - hsize_t count; - hsize_t block; -} H5S_hyper_dim_t; - -/* Information about hyperslab selection */ -typedef struct { - H5S_hyper_dim_t *diminfo; /* ->[rank] of per-dim selection info */ - /* diminfo only points to one array, which holds the information - * for one hyperslab selection. Perhaps this might need to be - * expanded into a list of arrays when the H5Sselect_hyperslab's - * restriction to H5S_SELECT_SET is removed. */ - H5S_hyper_dim_t *app_diminfo;/* ->[rank] of per-dim selection info */ - /* 'diminfo' points to a [potentially] optimized version of the user's - * hyperslab information. 'app_diminfo' points to the actual parameters - * that the application used for setting the hyperslab selection. These - * are only used for re-gurgitating the original values used to set the - * hyperslab to the application when it queries the hyperslab selection - * information. */ - H5S_hyper_list_t *hyper_lst; /* List of selected hyperslabs (order is not important) */ -} H5S_hyper_sel_t; - -/* Selection information container */ -typedef struct { - H5S_sel_type type; /* Type of selection (list of points or hyperslabs) */ - hssize_t *offset; /* Offset within the extent (NULL means a 0 offset) */ - hsize_t *order; /* Selection order. (NULL means a specific ordering of points) */ - hsize_t num_elem; /* Number of elements in selection */ - union { - H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */ - H5S_hyper_sel_t hslab; /* Info about hyperslab selections */ - } sel_info; -} H5S_select_t; - /* Point selection iteration container */ typedef struct { hsize_t elmt_left; /* Number of elements left to iterate over */ @@ -174,12 +69,6 @@ typedef union { H5S_all_iter_t all; /* "All" selection iteration information */ } H5S_sel_iter_t; -/* Main dataspace structure */ -typedef struct H5S_t { - H5S_extent_t extent; /* Dataspace extent */ - H5S_select_t select; /* Dataspace selection */ -} H5S_t; - /* * Data space conversions usually take place in two halves. One half * transfers data points between memory and a data type conversion array @@ -303,21 +192,24 @@ __DLLVAR__ const H5S_mconv_t H5S_ALL_MCONV[]; __DLLVAR__ const H5S_fconv_t H5S_HYPER_FCONV[]; __DLLVAR__ const H5S_mconv_t H5S_HYPER_MCONV[]; +/* Forward declarations for prototypes arguments */ +struct H5G_entry_t; + __DLL__ H5S_t *H5S_create(H5S_class_t type); __DLL__ H5S_t *H5S_copy(const H5S_t *src); -__DLL__ herr_t H5S_close_simple(H5S_simple_t *simple); __DLL__ herr_t H5S_close(H5S_t *ds); +__DLL__ H5S_conv_t *H5S_find(const H5S_t *mem_space, const H5S_t *file_space); +__DLL__ H5S_class_t H5S_get_simple_extent_type(const H5S_t *ds); __DLL__ hsize_t H5S_get_simple_extent_npoints(const H5S_t *ds); __DLL__ hsize_t H5S_get_npoints_max(const H5S_t *ds); __DLL__ intn H5S_get_simple_extent_ndims(const H5S_t *ds); __DLL__ intn H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/, hsize_t max_dims[]/*out*/); -__DLL__ herr_t H5S_modify(H5G_entry_t *ent, const H5S_t *space); -__DLL__ H5S_t *H5S_read(H5G_entry_t *ent); +__DLL__ herr_t H5S_modify(struct H5G_entry_t *ent, const H5S_t *space); +__DLL__ H5S_t *H5S_read(struct H5G_entry_t *ent); __DLL__ intn H5S_cmp(const H5S_t *ds1, const H5S_t *ds2); __DLL__ htri_t H5S_is_simple(const H5S_t *sdim); __DLL__ uintn H5S_nelem(const H5S_t *space); -__DLL__ H5S_conv_t *H5S_find(const H5S_t *mem_space, const H5S_t *file_space); __DLL__ herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hssize_t start[], const hsize_t _stride[], @@ -325,13 +217,9 @@ __DLL__ herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t _block[]); __DLL__ intn H5S_get_hyperslab(const H5S_t *ds, hssize_t offset[]/*out*/, hsize_t size[]/*out*/, hsize_t stride[]/*out*/); -__DLL__ herr_t H5S_release_simple(H5S_simple_t *simple); -__DLL__ herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); __DLL__ herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src); __DLL__ herr_t H5S_extent_release(H5S_t *space); __DLL__ herr_t H5S_select_release(H5S_t *space); -__DLL__ herr_t H5S_sel_iter_release(const H5S_t *space, - H5S_sel_iter_t *sel_iter); __DLL__ hssize_t H5S_get_select_npoints(const H5S_t *space); __DLL__ intn H5S_extend(H5S_t *space, const hsize_t *size); __DLL__ herr_t H5S_set_extent_simple(H5S_t *space, int rank, @@ -339,106 +227,13 @@ __DLL__ herr_t H5S_set_extent_simple(H5S_t *space, int rank, __DLL__ htri_t H5S_select_valid(const H5S_t *space); __DLL__ herr_t H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, intn indent, intn fwidth); -__DLL__ herr_t H5S_register(H5S_sel_type cls, const H5S_fconv_t *fconv, - const H5S_mconv_t *mconv); __DLL__ hssize_t H5S_select_serial_size(const H5S_t *space); __DLL__ herr_t H5S_select_serialize(const H5S_t *space, uint8_t *buf); __DLL__ herr_t H5S_select_deserialize(H5S_t *space, const uint8_t *buf); __DLL__ htri_t H5S_select_contiguous(const H5S_t *space); __DLL__ herr_t H5S_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op, void *operator_data); - -/* Point select functions */ -__DLL__ herr_t H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, - const hssize_t **coord); -__DLL__ herr_t H5S_point_release(H5S_t *space); -__DLL__ hsize_t H5S_point_npoints(const H5S_t *space); -__DLL__ herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src); -__DLL__ htri_t H5S_point_select_valid(const H5S_t *space); -__DLL__ hssize_t H5S_point_select_serial_size(const H5S_t *space); -__DLL__ herr_t H5S_point_select_serialize(const H5S_t *space, uint8_t *buf); -__DLL__ herr_t H5S_point_select_deserialize(H5S_t *space, const uint8_t *buf); -__DLL__ herr_t H5S_point_bounds(H5S_t *space, hsize_t *start, hsize_t *end); -__DLL__ htri_t H5S_point_select_contiguous(const H5S_t *space); -__DLL__ herr_t H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, - H5D_operator_t op, - void *operator_data); - -/* "All" select functions */ -__DLL__ herr_t H5S_all_release(H5S_t *space); -__DLL__ hsize_t H5S_all_npoints(const H5S_t *space); -__DLL__ herr_t H5S_all_select_serialize(const H5S_t *space, uint8_t *buf); -__DLL__ herr_t H5S_all_select_deserialize(H5S_t *space, const uint8_t *buf); -__DLL__ herr_t H5S_all_bounds(H5S_t *space, hsize_t *start, hsize_t *end); -__DLL__ herr_t H5S_all_read(H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, - hid_t dxpl_id, void *buf/*out*/, - hbool_t *must_convert/*out*/); -__DLL__ herr_t H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, - hid_t dxpl_id, const void *buf, - hbool_t *must_convert/*out*/); -__DLL__ herr_t H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, - H5D_operator_t op, void *operator_data); - -/* Hyperslab selection functions */ -__DLL__ herr_t H5S_hyper_release(H5S_t *space); -__DLL__ herr_t H5S_hyper_sel_iter_release(H5S_sel_iter_t *sel_iter); -__DLL__ hsize_t H5S_hyper_npoints(const H5S_t *space); -__DLL__ int H5S_hyper_compare_regions(const void *r1, const void *r2); -__DLL__ int H5S_hyper_compare_bounds(const void *r1, const void *r2); -__DLL__ herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src); -__DLL__ htri_t H5S_hyper_select_valid(const H5S_t *space); -__DLL__ intn H5S_hyper_bound_comp(const void *_b1, const void *_b2); -__DLL__ herr_t H5S_hyper_node_add(H5S_hyper_node_t **head, intn endflag, - intn rank, const hssize_t *start, - const hsize_t *size); -__DLL__ herr_t H5S_hyper_clip(H5S_t *space, H5S_hyper_node_t *nodes, - H5S_hyper_node_t **uniq, - H5S_hyper_node_t **overlap); -__DLL__ hssize_t H5S_hyper_select_serial_size(const H5S_t *space); -__DLL__ herr_t H5S_hyper_select_serialize(const H5S_t *space, uint8_t *buf); -__DLL__ herr_t H5S_hyper_select_deserialize(H5S_t *space, const uint8_t *buf); -__DLL__ herr_t H5S_hyper_bounds(H5S_t *space, hsize_t *start, hsize_t *end); -__DLL__ htri_t H5S_hyper_select_contiguous(const H5S_t *space); -__DLL__ herr_t H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space, - H5D_operator_t op, void *operator_data); - -/* "None" selection functions */ -__DLL__ herr_t H5S_none_select_serialize(const H5S_t *space, uint8_t *buf); -__DLL__ herr_t H5S_none_select_deserialize(H5S_t *space, const uint8_t *buf); -__DLL__ herr_t H5S_none_select_iterate(void *buf, hid_t type_id, H5S_t *space, - H5D_operator_t op, void *operator_data); - -#ifdef H5_HAVE_PARALLEL -/* MPI-IO function to read directly from app buffer to file rky980813 */ -__DLL__ herr_t H5S_mpio_spaces_read(H5F_t *f, - const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, - size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, - void *buf/*out*/, - hbool_t *must_convert /*out*/ ); - -/* MPI-IO function to write directly from app buffer to file rky980813 */ -__DLL__ herr_t H5S_mpio_spaces_write(H5F_t *f, - const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, - size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, - const void *buf, - hbool_t *must_convert /*out*/ ); -#ifndef _H5S_IN_H5S_C -/* Global var whose value comes from environment variable */ -__DLLVAR__ hbool_t H5_mpi_opt_types_g; -#endif /* _H5S_IN_H5S_C */ - -#endif /* H5_HAVE_PARALLEL */ +__DLL__ herr_t H5S_sel_iter_release(const H5S_t *space, + H5S_sel_iter_t *sel_iter); #endif /* _H5Sprivate_H */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index f31bba4..641acaa 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -8,12 +8,14 @@ * Purpose: Dataspace functions. */ +#define H5S_PACKAGE /*suppress error about including H5Spkg */ + #include #include #include /*Free Lists */ #include #include -#include +#include #include /* Interface initialization */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 16883b1..ffbcd86 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1813,7 +1813,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *_buf, void UNUSED *_bkg, hid_t dset_xfer_plist) { - const H5F_xfer_t *xfer_parms = NULL; + const H5D_xfer_t *xfer_parms = NULL; H5T_path_t *tpath; /* Type conversion path */ hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ H5T_t *src = NULL; /*source data type */ @@ -1877,7 +1877,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Get the dataset transfer property list */ if (H5P_DEFAULT == dset_xfer_plist) { - xfer_parms = &H5F_xfer_dflt; + xfer_parms = &H5D_xfer_dflt; } else if (H5P_DATA_XFER != H5P_get_class(dset_xfer_plist) || NULL == (xfer_parms = H5I_object(dset_xfer_plist))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index f541b63..2e150ad 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -24,8 +24,9 @@ #endif #include +#include +#include #include -#include /* Publicly accessible reference information needed also */ #include typedef struct H5T_atomic_t { @@ -88,7 +89,7 @@ typedef struct H5T_enum_t { /* VL function pointers */ typedef hssize_t (*H5T_vlen_getlenfunc_t)(H5F_t *f, void *vl_addr); typedef herr_t (*H5T_vlen_readfunc_t)(H5F_t *f, void *vl_addr, void *buf, size_t len); -typedef herr_t (*H5T_vlen_writefunc_t)(const H5F_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size); +typedef herr_t (*H5T_vlen_writefunc_t)(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size); /* A VL datatype */ typedef struct H5T_vlen_t { @@ -737,13 +738,13 @@ __DLL__ htri_t H5T_bit_inc(uint8_t *buf, size_t start, size_t size); /* VL functions */ __DLL__ hssize_t H5T_vlen_seq_mem_getlen(H5F_t *f, void *vl_addr); __DLL__ herr_t H5T_vlen_seq_mem_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -__DLL__ herr_t H5T_vlen_seq_mem_write(const H5F_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); +__DLL__ herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); __DLL__ hssize_t H5T_vlen_str_mem_getlen(H5F_t *f, void *vl_addr); __DLL__ herr_t H5T_vlen_str_mem_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -__DLL__ herr_t H5T_vlen_str_mem_write(const H5F_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); +__DLL__ herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); __DLL__ hssize_t H5T_vlen_disk_getlen(H5F_t *f, void *vl_addr); __DLL__ herr_t H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *_buf, size_t len); -__DLL__ herr_t H5T_vlen_disk_write(const H5F_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); +__DLL__ herr_t H5T_vlen_disk_write(const H5D_xfer_t *xfer_parms, H5F_t *f, void *vl_addr, void *_buf, hsize_t seq_len, hsize_t base_size); /* Reference specific functions */ __DLL__ H5R_type_t H5T_get_ref_type(const H5T_t *dt); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 0e3237b..f2958a0 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -206,7 +206,7 @@ herr_t H5T_vlen_seq_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t l * *------------------------------------------------------------------------- */ -herr_t H5T_vlen_seq_mem_write(const H5F_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) +herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) { hvl_t *vl=(hvl_t *)vl_addr; /* Pointer to the user's hvl_t information */ size_t len=seq_len*base_size; @@ -308,7 +308,7 @@ herr_t H5T_vlen_str_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t l * *------------------------------------------------------------------------- */ -herr_t H5T_vlen_str_mem_write(const H5F_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) +herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) { char **s=(char **)vl_addr; /* Pointer to the user's hvl_t information */ size_t len=seq_len*base_size; @@ -421,7 +421,7 @@ herr_t H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *buf, size_t UNUSED len) * *------------------------------------------------------------------------- */ -herr_t H5T_vlen_disk_write(const H5F_xfer_t UNUSED *xfer_parms, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) +herr_t H5T_vlen_disk_write(const H5D_xfer_t UNUSED *xfer_parms, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size) { uint8_t *vl=(uint8_t *)vl_addr; /* Pointer to the user's hvl_t information */ H5HG_t hobjid; @@ -576,7 +576,7 @@ done: herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *op_data) { - H5F_xfer_t *xfer_parms = (H5F_xfer_t *)op_data; /* Dataset transfer plist from iterator */ + H5D_xfer_t *xfer_parms = (H5D_xfer_t *)op_data; /* Dataset transfer plist from iterator */ H5T_t *dt = NULL; herr_t ret_value = FAIL; diff --git a/src/Makefile.in b/src/Makefile.in index 5d975bf..05b5afe 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -20,14 +20,14 @@ CLEAN=libhdf5.settings ## Source and object files for the library (lexicographically)... LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcontig.c \ - H5Fistore.c H5FD.c H5FDsec2.c H5FDfamily.c H5FDmpio.c H5FDcore.c H5FDdpss.c \ - H5FDmulti.c H5FDgass.c H5FDlog.c H5FDsrb.c H5FDstdio.c H5FDstream.c H5FL.c \ - H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c H5MM.c H5O.c \ - H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Olayout.c \ - H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c H5Oshared.c H5Ostab.c H5P.c \ - H5R.c H5RA.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ - H5Sselect.c H5T.c H5Tbit.c H5Tconv.c H5Tinit.c H5Tvlen.c H5TB.c H5TS.c \ - H5V.c H5Z.c H5Zdeflate.c + H5Fistore.c H5Fseq.c H5FD.c H5FDsec2.c H5FDfamily.c H5FDmpio.c H5FDcore.c \ + H5FDdpss.c H5FDmulti.c H5FDgass.c H5FDlog.c H5FDsrb.c H5FDstdio.c \ + H5FDstream.c H5FL.c H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c \ + H5MF.c H5MM.c H5O.c H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c \ + H5Ofill.c H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c \ + H5Oshared.c H5Ostab.c H5P.c H5R.c H5RA.c H5S.c H5Sall.c H5Shyper.c \ + H5Smpio.c H5Snone.c H5Spoint.c H5Sselect.c H5T.c H5Tbit.c H5Tconv.c \ + H5Tinit.c H5Tvlen.c H5TB.c H5TS.c H5V.c H5Z.c H5Zdeflate.c LIB_OBJ=$(LIB_SRC:.c=.lo) -- cgit v0.12