summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Fprivate.h3
-rw-r--r--src/H5Fquery.c29
-rw-r--r--test/mf.c7
3 files changed, 39 insertions, 0 deletions
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index cd6bcd0..c7b4d25 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -265,6 +265,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5F_HAS_FEATURE(F,FL) ((F)->shared->lf->feature_flags & (FL))
#define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id)
#define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno)
+#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR)))
#else /* H5F_PACKAGE */
#define H5F_INTENT(F) (H5F_get_intent(F))
#define H5F_FCPL(F) (H5F_get_fcpl(F))
@@ -287,6 +288,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL))
#define H5F_DRIVER_ID(F) (H5F_get_driver_id(F))
#define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM)))
+#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR)))
#endif /* H5F_PACKAGE */
@@ -489,6 +491,7 @@ H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f);
H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
+H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr);
/* Functions that retrieve values from VFD layer */
H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 275061d..5538d60 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -687,3 +687,32 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_fileno() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_is_tmp_addr
+ *
+ * Purpose: Quick and dirty routine to determine if an address is in
+ * the 'temporary' file space.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
+ *
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * June 11, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5F_is_tmp_addr(const H5F_t *f, haddr_t addr)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_is_tmp_addr)
+
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->lf);
+
+ FUNC_LEAVE_NOAPI(H5F_addr_le(f->shared->tmp_addr, addr))
+} /* end H5F_is_tmp_addr() */
+
diff --git a/test/mf.c b/test/mf.c
index 8b5c51b..5c05848 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -30,6 +30,7 @@
#include "H5FSpkg.h"
#define H5F_PACKAGE
+#define H5F_TESTING
#include "H5Fpkg.h"
#include "H5FLprivate.h"
@@ -790,6 +791,8 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
FAIL_STACK_ERROR
/* Check if temporary file address is valid */
+ if(!H5F_IS_TMP_ADDR(f, tmp_addr))
+ TEST_ERROR
if(tmp_addr < (haddr_t)(maxaddr - TEST_BLOCK_SIZE30))
TEST_ERROR
@@ -836,10 +839,14 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
/* Allocate 1/3 of the file as temporary address space */
if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3))))
FAIL_STACK_ERROR
+ if(!H5F_IS_TMP_ADDR(f, tmp_addr))
+ TEST_ERROR
/* Allocate 1/3 of the file as normal address space */
if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3))))
FAIL_STACK_ERROR
+ if(H5F_IS_TMP_ADDR(f, norm_addr))
+ TEST_ERROR
/* Test that pushing temporary space allocation into normal space fails */
H5E_BEGIN_TRY {