summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-04-18 13:34:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-04-18 13:34:20 (GMT)
commit6a0ecf73666152cff2f45c1433df50bdcb3e111b (patch)
tree2a841d660f3ba94e36934f6db6930a1055a617c3 /src/H5D.c
parent6ef3da02334f56068280a83f8d18f045db1d0153 (diff)
downloadhdf5-6a0ecf73666152cff2f45c1433df50bdcb3e111b.zip
hdf5-6a0ecf73666152cff2f45c1433df50bdcb3e111b.tar.gz
hdf5-6a0ecf73666152cff2f45c1433df50bdcb3e111b.tar.bz2
[svn-r5198] Purpose:
Code Cleanup Description: Remove "knowledge" about external file storage from H5D_init_storage and call H5F_seq_write instead, which handles things correctly. Platforms tested: FreeBSD 4.5 (sleipnir)
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 94a00e5..a19bc6c 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -3338,16 +3338,16 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
{
hssize_t snpoints; /* Number of points in space (for error checking) */
size_t npoints; /* Number of points in space */
- size_t ptsperbuf;
- size_t bufsize=8*1024;
- size_t size;
- haddr_t addr;
- herr_t ret_value = FAIL;
- void *buf = NULL;
- H5O_fill_t fill;
- H5O_efl_t efl;
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list */
+ size_t ptsperbuf; /* Maximum # of points which fit in the buffer */
+ size_t bufsize=64*1024; /* Size of buffer to write */
+ size_t size; /* Current # of points to write */
+ haddr_t addr; /* Offset in dataset */
+ void *buf = NULL; /* Buffer for fill value writing */
+ H5O_fill_t fill; /* Fill value information */
+ H5O_efl_t efl; /* External File List information */
+ H5O_pline_t pline; /* I/O pipeline information */
+ H5P_genplist_t *plist; /* Property list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER(H5D_init_storage, FAIL);
assert(dset);
@@ -3388,21 +3388,17 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer");
H5V_array_fill(buf, fill.buf, fill.size, ptsperbuf);
- if (efl.nused) {
- addr = 0;
- } else {
- addr = dset->layout.addr;
- }
+
+ /* Start at the beginning of the dataset */
+ addr = 0;
+ /* Loop through writing the fill value to the dataset */
while (npoints>0) {
size = MIN(ptsperbuf, npoints) * fill.size;
- if(efl.nused) {
- if(H5O_efl_write(dset->ent.file, &efl, addr, size, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset");
- } else {
- if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, addr, size, H5P_DATASET_XFER_DEFAULT, buf)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset");
- }
+ if (H5F_seq_write(dset->ent.file, H5P_DATASET_XFER_DEFAULT,
+ &(dset->layout), &pline, &fill, &efl, space,
+ fill.size, size, addr, buf)<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset");
npoints -= MIN(ptsperbuf, npoints);
addr += size;
} /* end while */
@@ -3432,7 +3428,6 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
#endif /*H5_HAVE_PARALLEL*/
break;
} /* end switch */
- ret_value = SUCCEED;
done:
if (buf)