summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-04-25 14:32:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-04-25 14:32:17 (GMT)
commit95e0006dc2d9e748db4b6e35acfcf56ff31ed416 (patch)
treebefdc8b2778d707134bd1a528555cc547e4ab33e
parentead005cc27f05e2b1497c3651524b7151c9fc48a (diff)
downloadhdf5-95e0006dc2d9e748db4b6e35acfcf56ff31ed416.zip
hdf5-95e0006dc2d9e748db4b6e35acfcf56ff31ed416.tar.gz
hdf5-95e0006dc2d9e748db4b6e35acfcf56ff31ed416.tar.bz2
[svn-r25097] Description:
Make progress toward moving from DXPL IDs to property list structures within the library. Also move the signature location code from the H5F package to the H5FD package, where it's a better fit. Also, clean up some more compiler warnings along the way. Tested on: Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & parallel (h5committest forthcoming)
-rw-r--r--src/H5F.c2
-rw-r--r--src/H5FDint.c64
-rw-r--r--src/H5FDprivate.h1
-rw-r--r--src/H5Faccum.c84
-rw-r--r--src/H5Fpkg.h7
-rw-r--r--src/H5Fprivate.h4
-rw-r--r--src/H5Fsuper.c76
-rw-r--r--src/H5MF.c13
-rw-r--r--test/accum.c26
9 files changed, 142 insertions, 135 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 45ad208..ed95322 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -850,7 +850,7 @@ H5Fis_hdf5(const char *name)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
/* The file is an hdf5 file if the hdf5 file signature can be found */
- if(H5F_locate_signature(file, H5AC_ind_dxpl_id, &sig_addr) < 0)
+ if(H5FD_locate_signature(file, H5AC_ind_dxpl_g, &sig_addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
ret_value = (HADDR_UNDEF != sig_addr);
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 2d1fc09..9f02a25 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -103,6 +103,70 @@ H5FD_int_init_interface(void)
/*-------------------------------------------------------------------------
+ * Function: H5FD_locate_signature
+ *
+ * Purpose: Finds the HDF5 superblock signature in a file. The
+ * signature can appear at address 0, or any power of two
+ * beginning with 512.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_addr)
+{
+ haddr_t addr, eoa;
+ uint8_t buf[H5F_SIGNATURE_LEN];
+ unsigned n, maxpow;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Find the least N such that 2^N is larger than the file size */
+ if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER)))
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value")
+ for(maxpow = 0; addr; maxpow++)
+ addr >>= 1;
+ maxpow = MAX(maxpow, 9);
+
+ /*
+ * Search for the file signature at format address zero followed by
+ * powers of two larger than 9.
+ */
+ for(n = 8; n < maxpow; n++) {
+ addr = (8 == n) ? 0 : (haddr_t)1 << n;
+ if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature")
+ if(H5FD_read(file, dxpl, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature")
+ if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
+ break;
+ } /* end for */
+
+ /*
+ * If the signature was not found then reset the EOA value and return
+ * HADDR_UNDEF.
+ */
+ if(n >= maxpow) {
+ if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value")
+ *sig_addr = HADDR_UNDEF;
+ } /* end if */
+ else
+ /* Set return value */
+ *sig_addr = addr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_locate_signature() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5FD_read
*
* Purpose: Private version of H5FDread()
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 6e64e62..33332d7 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -109,6 +109,7 @@ struct H5P_genplist_t;
struct H5F_t;
H5_DLL int H5FD_term_interface(void);
+H5_DLL herr_t H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_addr);
H5_DLL H5FD_class_t *H5FD_get_class(hid_t id);
H5_DLL hsize_t H5FD_sb_size(H5FD_t *file);
H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf);
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index ba8c4da..7eb75bd 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -40,7 +40,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -832,7 +831,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_accum_free
+ * Function: H5F__accum_free
*
* Purpose: Check for free space invalidating [part of] a metadata
* accumulator.
@@ -846,24 +845,25 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
+H5F__accum_free(const H5F_io_info_t *fio_info, H5FD_mem_t UNUSED type, haddr_t addr,
hsize_t size)
{
- H5P_genplist_t *dxpl; /* DXPL object */
+ H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* check arguments */
- HDassert(f);
+ HDassert(fio_info);
+ HDassert(fio_info->f);
+ HDassert(fio_info->dxpl);
- /* Get the DXPL plist object for DXPL ID */
- if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+ /* Set up alias for file's metadata accumulator info */
+ accum = &fio_info->f->shared->accum;
/* Adjust the metadata accumulator to remove the freed block, if it overlaps */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA)
- && H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) {
+ if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA)
+ && H5F_addr_overlap(addr, size, accum->loc, accum->size)) {
size_t overlap_size; /* Size of overlap with accumulator */
/* Sanity check */
@@ -872,57 +872,57 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
HDassert(H5FD_MEM_GHEAP != type); /* (global heap data is being treated as raw data currently) */
/* Check for overlapping the beginning of the accumulator */
- if(H5F_addr_le(addr, f->shared->accum.loc)) {
+ if(H5F_addr_le(addr, accum->loc)) {
/* Check for completely overlapping the accumulator */
- if(H5F_addr_ge(addr + size, f->shared->accum.loc + f->shared->accum.size)) {
+ if(H5F_addr_ge(addr + size, accum->loc + accum->size)) {
/* Reset the accumulator, but don't free buffer */
- f->shared->accum.loc = HADDR_UNDEF;
- f->shared->accum.size = 0;
- f->shared->accum.dirty = FALSE;
+ accum->loc = HADDR_UNDEF;
+ accum->size = 0;
+ accum->dirty = FALSE;
} /* end if */
/* Block to free must end within the accumulator */
else {
size_t new_accum_size; /* Size of new accumulator buffer */
/* Calculate the size of the overlap with the accumulator, etc. */
- H5_ASSIGN_OVERFLOW(overlap_size, (addr + size) - f->shared->accum.loc, haddr_t, size_t);
- new_accum_size = f->shared->accum.size - overlap_size;
+ H5_ASSIGN_OVERFLOW(overlap_size, (addr + size) - accum->loc, haddr_t, size_t);
+ new_accum_size = accum->size - overlap_size;
/* Move the accumulator buffer information to eliminate the freed block */
- HDmemmove(f->shared->accum.buf, f->shared->accum.buf + overlap_size, new_accum_size);
+ HDmemmove(accum->buf, accum->buf + overlap_size, new_accum_size);
/* Adjust the accumulator information */
- f->shared->accum.loc += overlap_size;
- f->shared->accum.size = new_accum_size;
+ accum->loc += overlap_size;
+ accum->size = new_accum_size;
/* Adjust the dirty region and possibly mark accumulator clean */
- if(f->shared->accum.dirty) {
+ if(accum->dirty) {
/* Check if block freed is entirely before dirty region */
- if(overlap_size < f->shared->accum.dirty_off)
- f->shared->accum.dirty_off -= overlap_size;
+ if(overlap_size < accum->dirty_off)
+ accum->dirty_off -= overlap_size;
else {
/* Check if block freed ends within dirty region */
- if(overlap_size < (f->shared->accum.dirty_off + f->shared->accum.dirty_len)) {
- f->shared->accum.dirty_len = (f->shared->accum.dirty_off + f->shared->accum.dirty_len) - overlap_size;
- f->shared->accum.dirty_off = 0;
+ if(overlap_size < (accum->dirty_off + accum->dirty_len)) {
+ accum->dirty_len = (accum->dirty_off + accum->dirty_len) - overlap_size;
+ accum->dirty_off = 0;
} /* end if */
/* Block freed encompasses dirty region */
else
- f->shared->accum.dirty = FALSE;
+ accum->dirty = FALSE;
} /* end else */
} /* end if */
} /* end else */
} /* end if */
/* Block to free must start within the accumulator */
else {
- haddr_t dirty_end = f->shared->accum.loc + f->shared->accum.dirty_off + f->shared->accum.dirty_len;
- haddr_t dirty_start = f->shared->accum.loc + f->shared->accum.dirty_off;
+ haddr_t dirty_end = accum->loc + accum->dirty_off + accum->dirty_len;
+ haddr_t dirty_start = accum->loc + accum->dirty_off;
/* Calculate the size of the overlap with the accumulator */
- H5_ASSIGN_OVERFLOW(overlap_size, (f->shared->accum.loc + f->shared->accum.size) - addr, haddr_t, size_t);
+ H5_ASSIGN_OVERFLOW(overlap_size, (accum->loc + accum->size) - addr, haddr_t, size_t);
/* Check if block to free begins before end of dirty region */
- if(f->shared->accum.dirty && H5F_addr_lt(addr, dirty_end)) {
+ if(accum->dirty && H5F_addr_lt(addr, dirty_end)) {
haddr_t tail_addr;
/* Calculate the address of the tail to write */
@@ -933,7 +933,7 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
/* Check if block to free is entirely before dirty region */
if(H5F_addr_le(tail_addr, dirty_start)) {
/* Write out the entire dirty region of the accumulator */
- if(H5FD_write(f->shared->lf, dxpl, H5FD_MEM_DEFAULT, dirty_start, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, dirty_start, accum->dirty_len, accum->buf + accum->dirty_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
} /* end if */
/* Block to free overlaps with some/all of dirty region */
@@ -943,17 +943,17 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
size_t dirty_delta;
write_size = (size_t)(dirty_end - tail_addr);
- dirty_delta = f->shared->accum.dirty_len - write_size;
+ dirty_delta = accum->dirty_len - write_size;
HDassert(write_size > 0);
/* Write out the unfreed dirty region of the accumulator */
- if(H5FD_write(f->shared->lf, dxpl, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, accum->buf + accum->dirty_off + dirty_delta) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
} /* end if */
/* Reset dirty flag */
- f->shared->accum.dirty = FALSE;
+ accum->dirty = FALSE;
} /* end if */
/* Block to free begins at beginning of or in middle of dirty region */
else {
@@ -963,36 +963,36 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
size_t dirty_delta;
write_size = (size_t)(dirty_end - tail_addr);
- dirty_delta = f->shared->accum.dirty_len - write_size;
+ dirty_delta = accum->dirty_len - write_size;
HDassert(write_size > 0);
/* Write out the unfreed end of the dirty region of the accumulator */
- if(H5FD_write(f->shared->lf, dxpl, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0)
+ if(H5FD_write(fio_info->f->shared->lf, fio_info->dxpl, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, accum->buf + accum->dirty_off + dirty_delta) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
} /* end if */
/* Check for block to free beginning at same location as dirty region */
if(H5F_addr_eq(addr, dirty_start)) {
/* Reset dirty flag */
- f->shared->accum.dirty = FALSE;
+ accum->dirty = FALSE;
} /* end if */
/* Block to free eliminates end of dirty region */
else {
- f->shared->accum.dirty_len = (size_t)(addr - dirty_start);
+ accum->dirty_len = (size_t)(addr - dirty_start);
} /* end else */
} /* end else */
} /* end if */
/* Adjust the accumulator information */
- f->shared->accum.size = f->shared->accum.size - overlap_size;
+ accum->size = accum->size - overlap_size;
} /* end else */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_accum_free() */
+} /* end H5F__accum_free() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 9458223..9f48070 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -53,10 +53,6 @@
# undef H5F_DEBUG
#endif
-/* Define the HDF5 file signature */
-#define H5F_SIGNATURE "\211HDF\r\n\032\n"
-#define H5F_SIGNATURE_LEN 8
-
/* Superblock status flags */
#define H5F_SUPER_WRITE_ACCESS 0x01
#define H5F_SUPER_FILE_OK 0x02
@@ -296,7 +292,6 @@ H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1];
/* General routines */
H5_DLL herr_t H5F_init(void);
H5_DLL herr_t H5F__term_deprec_interface(void);
-H5_DLL herr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr);
H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing);
/* File mount related routines */
@@ -322,7 +317,7 @@ H5_DLL herr_t H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type,
haddr_t addr, size_t size, void *buf);
H5_DLL herr_t H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type,
haddr_t addr, size_t size, const void *buf);
-H5_DLL herr_t H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
+H5_DLL herr_t H5F__accum_free(const H5F_io_info_t *fio_info, H5FD_mem_t type,
haddr_t addr, hsize_t size);
H5_DLL herr_t H5F__accum_flush(const H5F_io_info_t *fio_info);
H5_DLL herr_t H5F__accum_reset(const H5F_io_info_t *fio_info, hbool_t flush);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 710e163..fc0a01e 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -466,6 +466,10 @@
#define H5_PAR_META_WRITE 0
#endif /* H5_HAVE_PARALLEL */
+/* Define the HDF5 file signature */
+#define H5F_SIGNATURE "\211HDF\r\n\032\n"
+#define H5F_SIGNATURE_LEN 8
+
/* Version #'s of the major components of the file format */
#define HDF5_SUPERBLOCK_VERSION_DEF 0 /* The default super block format */
#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 81aaca2..dd80a46 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -100,75 +100,6 @@ H5F_init_super_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5F_locate_signature
- *
- * Purpose: Finds the HDF5 superblock signature in a file. The
- * signature can appear at address 0, or any power of two
- * beginning with 512.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr)
-{
- H5P_genplist_t *dxpl; /* DXPL object */
- haddr_t addr, eoa;
- uint8_t buf[H5F_SIGNATURE_LEN];
- unsigned n, maxpow;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Find the least N such that 2^N is larger than the file size */
- if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER)))
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value")
- for(maxpow = 0; addr; maxpow++)
- addr >>= 1;
- maxpow = MAX(maxpow, 9);
-
- /* Get the DXPL plist object for DXPL ID */
- if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
-
- /*
- * Search for the file signature at format address zero followed by
- * powers of two larger than 9.
- */
- for(n = 8; n < maxpow; n++) {
- addr = (8 == n) ? 0 : (haddr_t)1 << n;
- if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature")
- if(H5FD_read(file, dxpl, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature")
- if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
- break;
- } /* end for */
-
- /*
- * If the signature was not found then reset the EOA value and return
- * HADDR_UNDEF.
- */
- if(n >= maxpow) {
- if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value")
- *sig_addr = HADDR_UNDEF;
- } /* end if */
- else
- /* Set return value */
- *sig_addr = addr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_locate_signature() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_super_ext_create
*
* Purpose: Create the superblock extension
@@ -325,6 +256,7 @@ done:
herr_t
H5F_super_read(H5F_t *f, hid_t dxpl_id)
{
+ H5P_genplist_t *dxpl; /* DXPL object */
H5F_super_t * sblock = NULL; /* superblock structure */
unsigned sblock_flags = H5AC__NO_FLAGS_SET; /* flags used in superblock unprotect call */
haddr_t super_addr; /* Absolute address of superblock */
@@ -334,8 +266,12 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id)
FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL)
+ /* Get the DXPL plist object for DXPL ID */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Find the superblock */
- if(H5F_locate_signature(f->shared->lf, dxpl_id, &super_addr) < 0)
+ if(H5FD_locate_signature(f->shared->lf, dxpl, &super_addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
if(HADDR_UNDEF == super_addr)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found")
diff --git a/src/H5MF.c b/src/H5MF.c
index 956ec18..29e9ece 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -38,8 +38,9 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
#include "H5MFpkg.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
@@ -600,6 +601,7 @@ herr_t
H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr,
hsize_t size)
{
+ H5F_io_info_t fio_info; /* I/O info for operation */
H5MF_free_section_t *node = NULL; /* Free space section pointer */
H5MF_sect_ud_t udata; /* User data for callback */
H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */
@@ -620,8 +622,13 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
if(H5F_addr_le(f->shared->tmp_addr, addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space")
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Check if the space to free intersects with the file's metadata accumulator */
- if(H5F_accum_free(f, dxpl_id, alloc_type, addr, size) < 0)
+ if(H5F__accum_free(&fio_info, alloc_type, addr, size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't check free space intersection w/metadata accumulator")
/* Get free space type from allocation type */
@@ -843,7 +850,7 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
hsize_t tot_fs_size = 0; /* Amount of all free space managed */
hsize_t tot_meta_size = 0; /* Amount of metadata for free space managers */
H5FD_mem_t type; /* Memory type for iteration */
- H5FD_mem_t fs_started[H5FD_MEM_NTYPES]; /* Indicate whether the free-space manager has been started */
+ hbool_t fs_started[H5FD_MEM_NTYPES]; /* Indicate whether the free-space manager has been started */
hbool_t eoa_shrank; /* Whether an EOA shrink occurs */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/test/accum.c b/test/accum.c
index cf1402f..a924517 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -57,7 +57,7 @@ void accum_printf(void);
/* Private Test H5Faccum Function Wrappers */
#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b))
#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b))
-#define accum_free(a,s) H5F_accum_free(f, H5P_DATASET_XFER_DEFAULT, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
+#define accum_free(fio_info,a,s) H5F__accum_free(fio_info, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
#define accum_flush(fio_info) H5F__accum_flush(fio_info)
#define accum_reset(fio_info) H5F__accum_reset(fio_info, TRUE)
@@ -351,38 +351,38 @@ test_free(const H5F_io_info_t *fio_info)
if(accum_write(0, 256 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_free(0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Free an empty accumulator */
- if(accum_free(0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Write second quarter of the accumulator */
if(accum_write(64 * sizeof(int32_t), 64 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
/* Free the second quarter of the accumulator, the requested area
* is bigger than the data region on the right side. */
- if(accum_free(64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Write half of the accumulator. */
if(accum_write(0, 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
/* Free the first block of 4B */
- if(accum_free(0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 127 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf + 1, rbuf, 127 * sizeof(int32_t)) != 0) TEST_ERROR;
/* Free the block of 4B at 127*4B */
- if(accum_free(127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf + 1, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR;
/* Free the block of 4B at 2*4B */
- if(accum_free(2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -398,7 +398,7 @@ test_free(const H5F_io_info_t *fio_info)
if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(66 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -412,7 +412,7 @@ test_free(const H5F_io_info_t *fio_info)
if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -426,7 +426,7 @@ test_free(const H5F_io_info_t *fio_info)
if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(70 * sizeof(int32_t), 122 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -440,7 +440,7 @@ test_free(const H5F_io_info_t *fio_info)
if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(74 * sizeof(int32_t), 118 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -454,7 +454,7 @@ test_free(const H5F_io_info_t *fio_info)
if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -468,7 +468,7 @@ test_free(const H5F_io_info_t *fio_info)
if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 8 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 8 * sizeof(int32_t));
- if(accum_free(72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(76 * sizeof(int32_t), 116 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;