diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-06-10 14:43:15 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-06-10 14:43:15 (GMT) |
commit | ac4c35cca592fc598c5a064fd8f769bbef69bd75 (patch) | |
tree | 6b23aa1ea8834532ca1de25b3fa469bc3d2a8158 /src/H5Flow.c | |
parent | 27edf86f6ab408352b4b975669d0759aa47bff78 (diff) | |
download | hdf5-ac4c35cca592fc598c5a064fd8f769bbef69bd75.zip hdf5-ac4c35cca592fc598c5a064fd8f769bbef69bd75.tar.gz hdf5-ac4c35cca592fc598c5a064fd8f769bbef69bd75.tar.bz2 |
[svn-r418] ./html/Files.html
./src/H5F.c
./src/HFcore.c
./src/H5Ffamily.c
./src/H5Flow.c
./src/H5Fmpio.c
./src/H5Fprivate.h
./src/H5Fsec2.c
./src/H5Fsplit.c
./src/H5Fstdio.c
./src/H5MF.c
./src/H5P.c
./src/H5Ppublic.h
Added H5Pset_alignment() so that it is now possible to align
file allocation requests on application-specified
boundaries. Any request >= the specified threshold will begin
on an address which is a multiple of the specified
alignment. Defaults are one for threshold and alignment. The
alignment is done on relative addresses, so the size of the
user block can affect the location of the data in the file.
./src/H5D.c
./src/dsets.c
Added a test for, and fixed the data space caching bug in
datasets. Extending a dataset through one handle will cause
all other handles to the same dataset to get the new dataset
size.
./src/H5S.c
./src/H5Sprivate.h
Removed an unused argument from H5S_read() which duplicated
information from the other argument.
./config/linux
Made `--enable-parallel' the default on my system. It used to
be that way before but then I accidently turned it off and
forgot about it.
./src/H5Fmpio.c
Qualified some function arguments with __unused__. Changed a
couple places where NULL was returned on error for herr_t
functions.
./src/H5P.c
Removed unused autos from H5Pset_mpi().
Diffstat (limited to 'src/H5Flow.c')
-rw-r--r-- | src/H5Flow.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/H5Flow.c b/src/H5Flow.c index 82e1f1a..91fb495 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -515,6 +515,72 @@ H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, FUNC_LEAVE(SUCCEED); } + + +/*------------------------------------------------------------------------- + * Function: H5F_low_alloc + * + * Purpose: Determines if a free block BLK can satisfy a request for SIZE + * bytes of memory from file F. If SIZE >= THRESH then the + * memory must be aligned on an ALIGN-byte boundary. Alignment + * is wrt the relative file addresses (that is, the size of the + * user-defined block at the beginning of the file is subtracted + * from the addresses before aligning them). + * + * Return: Success: Positive if the free block exactly satisfies + * the request; zero if the free block + * over-satisfies the request. In either case, + * ADDR will be the address within the free + * block where the request can be satisfied. + * + * Failure: FAIL with the output value of ADDR + * undefined. + * + * Programmer: Robb Matzke + * Tuesday, June 9, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +intn +H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold, + size_t size, H5MF_free_t *blk, haddr_t *addr/*out*/) +{ + intn ret_value = FAIL; + hsize_t wasted; + + FUNC_ENTER (H5MF_acceptable, FAIL); + assert (lf); + assert (alignment>0); + assert (size>0); + assert (blk); + assert (addr); + + if (lf->type->alloc) { + ret_value = (lf->type->alloc)(lf, op, alignment, threshold, size, blk, + addr/*out*/); + } else { + if (size>=threshold) { + wasted = blk->addr.offset % alignment; + } else { + wasted = 0; + } + if (0==wasted && size==blk->size) { + /* exact match */ + *addr = blk->addr; + ret_value = 1; + } else if (blk->size>wasted && blk->size-wasted>=size) { + /* over-satisfied */ + *addr = blk->addr; + H5F_addr_inc (addr, wasted); + ret_value = 0; + } + } + + FUNC_LEAVE (ret_value); +} + /*------------------------------------------------------------------------- * Function: H5F_low_seteof |