summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5F.c116
-rw-r--r--src/H5Fprivate.h107
-rw-r--r--src/H5Fquery.c191
-rw-r--r--src/H5O.c24
-rwxr-xr-xsrc/H5SM.c95
-rw-r--r--src/H5SMcache.c13
-rwxr-xr-xsrc/H5SMpkg.h2
-rw-r--r--src/H5SMtest.c10
8 files changed, 438 insertions, 120 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 5aa5810..c8f68f8 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -3003,3 +3003,119 @@ H5F_set_grp_btree_shared(H5F_t *f, H5RC_t *rc)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5F_set_grp_btree_shared() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_sohm_addr
+ *
+ * Purpose: Set the sohm_addr field with a new value.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * 7/20/11
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_sohm_addr(H5F_t *f, haddr_t addr)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_set_sohm_addr)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+
+ f->shared->sohm_addr = addr;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_sohm_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_sohm_vers
+ *
+ * Purpose: Set the sohm_vers field with a new value.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * 7/20/11
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_sohm_vers(H5F_t *f, unsigned vers)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_set_sohm_vers)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+
+ f->shared->sohm_vers = vers;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_sohm_vers() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_sohm_nindexes
+ *
+ * Purpose: Set the sohm_nindexes field with a new value.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * 7/20/11
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_set_sohm_nindexes)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+
+ f->shared->sohm_nindexes = nindexes;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_sohm_nindexes() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_store_msg_crt_idx
+ *
+ * Purpose: Set the store_msg_crt_idx field with a new value.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * 7/20/11
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_set_store_msg_crt_idx)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+
+ f->shared->store_msg_crt_idx = flag;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_store_msg_crt_idx() */
+
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 4bb3002..868674f 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -241,27 +241,40 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
#define H5F_EXTPATH(F) ((F)->extpath)
#define H5F_SHARED(F) ((F)->shared)
-#define H5F_PARENT(F) ((F)->parent)
#define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared))
-#define H5F_FCPL(F) ((F)->shared->fcpl_id)
-#define H5F_SIZEOF_ADDR(F) ((F)->shared->sizeof_addr)
-#define H5F_SIZEOF_SIZE(F) ((F)->shared->sizeof_size)
+#define H5F_NOPEN_OBJS(F) ((F)->nopen_objs)
+#define H5F_INCR_NOPEN_OBJS(F) ((F)->nopen_objs++)
+#define H5F_DECR_NOPEN_OBJS(F) ((F)->nopen_objs--)
+#define H5F_FILE_ID(F) ((F)->file_id)
+#define H5F_PARENT(F) ((F)->parent)
+#define H5F_NMOUNTS(F) ((F)->nmounts)
+#define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id)
+#define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno)
+#define H5F_HAS_FEATURE(F,FL) ((F)->shared->lf->feature_flags & (FL))
+#define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr)
#define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k)
#define H5F_KVALUE(F,T) ((F)->shared->sblock->btree_k[(T)->id])
+#define H5F_NREFS(F) ((F)->shared->nrefs)
+#define H5F_SIZEOF_ADDR(F) ((F)->shared->sizeof_addr)
+#define H5F_SIZEOF_SIZE(F) ((F)->shared->sizeof_size)
+#define H5F_SOHM_ADDR(F) ((F)->shared->sohm_addr)
+#define H5F_SET_SOHM_ADDR(F, A) ((F)->shared->sohm_addr = (A))
+#define H5F_SOHM_VERS(F) ((F)->shared->sohm_vers)
+#define H5F_SET_SOHM_VERS(F, V) ((F)->shared->sohm_vers = (V))
+#define H5F_SOHM_NINDEXES(F) ((F)->shared->sohm_nindexes)
+#define H5F_SET_SOHM_NINDEXES(F, N) ((F)->shared->sohm_nindexes = (N))
+#define H5F_FCPL(F) ((F)->shared->fcpl_id)
+#define H5F_GET_FC_DEGREE(F) ((F)->shared->fc_degree)
#define H5F_RDCC_NSLOTS(F) ((F)->shared->rdcc_nslots)
#define H5F_RDCC_NBYTES(F) ((F)->shared->rdcc_nbytes)
#define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0)
-#define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr)
-#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
-#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
#define H5F_USE_LATEST_FORMAT(F) ((F)->shared->latest_format)
-#define H5F_GET_FC_DEGREE(F) ((F)->shared->fc_degree)
#define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx)
-#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_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
+#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
+#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
#define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space)
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR)))
#else /* H5F_PACKAGE */
@@ -270,27 +283,40 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
#define H5F_EXTPATH(F) (H5F_get_extpath(F))
#define H5F_SHARED(F) (H5F_get_shared(F))
-#define H5F_PARENT(F) (H5F_get_parent(F))
#define H5F_SAME_SHARED(F1, F2) (H5F_same_shared((F1), (F2)))
-#define H5F_FCPL(F) (H5F_get_fcpl(F))
-#define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F))
-#define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F))
+#define H5F_NOPEN_OBJS(F) (H5F_get_nopen_objs(F))
+#define H5F_INCR_NOPEN_OBJS(F) (H5F_incr_nopen_objs(F))
+#define H5F_DECR_NOPEN_OBJS(F) (H5F_decr_nopen_objs(F))
+#define H5F_FILE_ID(F) (H5F_get_file_id(F))
+#define H5F_PARENT(F) (H5F_get_parent(F))
+#define H5F_NMOUNTS(F) (H5F_get_nmounts(F))
+#define H5F_DRIVER_ID(F) (H5F_get_driver_id(F))
+#define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM)))
+#define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL))
+#define H5F_BASE_ADDR(F) (H5F_get_base_addr(F))
#define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F))
#define H5F_KVALUE(F,T) (H5F_Kvalue(F,T))
+#define H5F_NREFS(F) (H5F_get_nrefs(F))
+#define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F))
+#define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F))
+#define H5F_SOHM_ADDR(F) (H5F_get_sohm_addr(F))
+#define H5F_SET_SOHM_ADDR(F, A) (H5F_set_sohm_addr((F), (A)))
+#define H5F_SOHM_VERS(F) (H5F_get_sohm_vers(F))
+#define H5F_SET_SOHM_VERS(F, V) (H5F_set_sohm_vers((F), (V)))
+#define H5F_SOHM_NINDEXES(F) (H5F_get_sohm_nindexes(F))
+#define H5F_SET_SOHM_NINDEXES(F, N) (H5F_set_sohm_nindexes((F), (N)))
+#define H5F_FCPL(F) (H5F_get_fcpl(F))
+#define H5F_GET_FC_DEGREE(F) (H5F_get_fc_degree(F))
#define H5F_RDCC_NSLOTS(F) (H5F_rdcc_nslots(F))
#define H5F_RDCC_NBYTES(F) (H5F_rdcc_nbytes(F))
#define H5F_RDCC_W0(F) (H5F_rdcc_w0(F))
-#define H5F_BASE_ADDR(F) (H5F_get_base_addr(F))
-#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
-#define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC)))
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
#define H5F_GC_REF(F) (H5F_gc_ref(F))
#define H5F_USE_LATEST_FORMAT(F) (H5F_use_latest_format(F))
-#define H5F_GET_FC_DEGREE(F) (H5F_get_fc_degree(F))
#define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
-#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_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL)))
+#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
+#define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC)))
#define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F))
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR)))
#endif /* H5F_PACKAGE */
@@ -486,46 +512,57 @@ struct H5HG_heap_t;
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, hid_t dxpl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f);
-H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f);
-H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f);
/* Functions than retrieve values from the file struct */
H5_DLL unsigned H5F_get_intent(const H5F_t *f);
-H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
H5_DLL char *H5F_get_open_name(const H5F_t *f);
H5_DLL char *H5F_get_actual_name(const H5F_t *f);
H5_DLL char *H5F_get_extpath(const H5F_t *f);
H5_DLL H5F_file_t *H5F_get_shared(const H5F_t *f);
-H5_DLL H5F_t *H5F_get_parent(const H5F_t *f);
H5_DLL hbool_t H5F_same_shared(const H5F_t *f1, const H5F_t *f2);
+H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f);
+H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f);
+H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f);
+H5_DLL hid_t H5F_get_file_id(const H5F_t *f);
+H5_DLL H5F_t *H5F_get_parent(const H5F_t *f);
+H5_DLL unsigned H5F_get_nmounts(const H5F_t *f);
+H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
H5_DLL size_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref);
H5_DLL size_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *obj_id_list, hbool_t app_ref);
/* Functions than retrieve values set/cached from the superblock/FCPL */
-H5_DLL hid_t H5F_get_fcpl(const H5F_t *f);
-H5_DLL uint8_t H5F_sizeof_addr(const H5F_t *f);
-H5_DLL uint8_t H5F_sizeof_size(const H5F_t *f);
+H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
H5_DLL unsigned H5F_sym_leaf_k(const H5F_t *f);
H5_DLL unsigned H5F_Kvalue(const H5F_t *f, const struct H5B_class_t *type);
+H5_DLL unsigned H5F_get_nrefs(const H5F_t *f);
+H5_DLL uint8_t H5F_sizeof_addr(const H5F_t *f);
+H5_DLL uint8_t H5F_sizeof_size(const H5F_t *f);
+H5_DLL haddr_t H5F_get_sohm_addr(const H5F_t *f);
+H5_DLL herr_t H5F_set_sohm_addr(H5F_t *f, haddr_t addr);
+H5_DLL unsigned H5F_get_sohm_vers(const H5F_t *f);
+H5_DLL herr_t H5F_set_sohm_vers(H5F_t *f, unsigned vers);
+H5_DLL unsigned H5F_get_sohm_nindexes(const H5F_t *f);
+H5_DLL herr_t H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes);
+H5_DLL hid_t H5F_get_fcpl(const H5F_t *f);
+H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f);
H5_DLL size_t H5F_rdcc_nbytes(const H5F_t *f);
H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f);
H5_DLL double H5F_rdcc_w0(const H5F_t *f);
-H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
-H5_DLL struct H5RC_t *H5F_grp_btree_shared(const H5F_t *f);
-H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5RC_t *rc);
H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f);
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);
+H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
+H5_DLL struct H5RC_t *H5F_grp_btree_shared(const H5F_t *f);
+H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5RC_t *rc);
H5_DLL hbool_t H5F_use_tmp_space(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);
H5_DLL hid_t H5F_get_driver_id(const H5F_t *f);
H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum);
+H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature);
H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type);
H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl,
void **file_handle);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index bc9bc3d..4c05066 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -204,6 +204,78 @@ H5F_get_shared(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_same_shared
+ *
+ * Purpose: Determine if two files have the same shared file pointer
+ *
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 19, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5F_same_shared(const H5F_t *f1, const H5F_t *f2)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_same_shared)
+
+ HDassert(f1);
+ HDassert(f1->shared);
+ HDassert(f2);
+ HDassert(f2->shared);
+
+ FUNC_LEAVE_NOAPI(f1->shared == f2->shared)
+} /* end H5F_same_shared() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_nopen_objs
+ *
+ * Purpose: Retrieve the file's 'nopen_objs' value
+ *
+ * Return: 'nopen_objs' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+unsigned
+H5F_get_nopen_objs(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_nopen_objs)
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->nopen_objs)
+} /* end H5F_get_nopen_objs() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_file_id
+ *
+ * Purpose: Retrieve the file's 'file_id' value
+ *
+ * Return: 'file_id' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5F_get_file_id(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_file_id)
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->file_id)
+} /* end H5F_get_file_id() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_parent
*
* Purpose: Retrieve the file's 'parent' pointer
@@ -227,29 +299,26 @@ H5F_get_parent(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_same_shared
+ * Function: H5F_get_nmounts
*
- * Purpose: Determine if two files have the same shared file pointer
+ * Purpose: Retrieve the file's 'nmounts' value
*
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
+ * Return: 'nmounts' on success/abort on failure (shouldn't fail)
*
- * Programmer: Quincey Koziol, July 19, 2011
+ * Programmer: Quincey Koziol, July 20, 2011
*
*-------------------------------------------------------------------------
*/
-hbool_t
-H5F_same_shared(const H5F_t *f1, const H5F_t *f2)
+unsigned
+H5F_get_nmounts(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_same_shared)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_nmounts)
- HDassert(f1);
- HDassert(f1->shared);
- HDassert(f2);
- HDassert(f2->shared);
+ HDassert(f);
- FUNC_LEAVE_NOAPI(f1->shared == f2->shared)
-} /* end H5F_same_shared() */
+ FUNC_LEAVE_NOAPI(f->nmounts)
+} /* end H5F_get_nmounts() */
/*-------------------------------------------------------------------------
@@ -335,6 +404,78 @@ H5F_sizeof_size(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_sohm_addr
+ *
+ * Purpose: Retrieve the file's 'sohm_addr' value
+ *
+ * Return: 'sohm_addr' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5F_get_sohm_addr(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_sohm_addr)
+
+ HDassert(f);
+ HDassert(f->shared);
+
+ FUNC_LEAVE_NOAPI(f->shared->sohm_addr)
+} /* end H5F_get_sohm_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_sohm_vers
+ *
+ * Purpose: Retrieve the file's 'sohm_vers' value
+ *
+ * Return: 'sohm_vers' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+unsigned
+H5F_get_sohm_vers(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_sohm_vers)
+
+ HDassert(f);
+ HDassert(f->shared);
+
+ FUNC_LEAVE_NOAPI(f->shared->sohm_vers)
+} /* end H5F_get_sohm_vers() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_sohm_nindexes
+ *
+ * Purpose: Retrieve the file's 'sohm_nindexes' value
+ *
+ * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+unsigned
+H5F_get_sohm_nindexes(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_sohm_nindexes)
+
+ HDassert(f);
+ HDassert(f->shared);
+
+ FUNC_LEAVE_NOAPI(f->shared->sohm_nindexes)
+} /* end H5F_get_sohm_nindexes() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_sym_leaf_k
*
* Purpose: Replaced a macro to retrieve the symbol table leaf size,
@@ -400,6 +541,30 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_nrefs
+ *
+ * Purpose: Retrieve the file's 'nrefs' value
+ *
+ * Return: 'nrefs' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+unsigned
+H5F_get_nrefs(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_nrefs)
+
+ HDassert(f);
+ HDassert(f->shared);
+
+ FUNC_LEAVE_NOAPI(f->shared->nrefs)
+} /* end H5F_get_nrefs() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_rdcc_nslots
*
* Purpose: Replaced a macro to retrieve the raw data cache number of slots,
diff --git a/src/H5O.c b/src/H5O.c
index 515c134..5de0dc4 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -28,7 +28,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
/* Interface initialization */
@@ -39,8 +38,9 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
+#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MFprivate.h" /* File memory management */
@@ -1317,7 +1317,7 @@ H5O_open(H5O_loc_t *loc)
if(loc->holding_file)
loc->holding_file = FALSE;
else
- loc->file->nopen_objs++;
+ H5F_INCR_NOPEN_OBJS(loc->file);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1434,17 +1434,17 @@ H5O_close(H5O_loc_t *loc)
/* Check args */
HDassert(loc);
HDassert(loc->file);
- HDassert(loc->file->nopen_objs > 0);
+ HDassert(H5F_NOPEN_OBJS(loc->file) > 0);
/* Decrement open-lock counters */
- --loc->file->nopen_objs;
+ H5F_DECR_NOPEN_OBJS(loc->file);
#ifdef H5O_DEBUG
if(H5DEBUG(O)) {
- if(loc->file->file_id < 0 && 1 == loc->file->shared->nrefs)
+ if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file))
HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
loc->addr,
- (unsigned long)(loc->file->nopen_objs));
+ (unsigned long)H5F_NOPEN_OBJS(loc->file));
else
HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
} /* end if */
@@ -1454,7 +1454,7 @@ H5O_close(H5O_loc_t *loc)
* If the file open object count has reached the number of open mount points
* (each of which has a group open in the file) attempt to close the file.
*/
- if(loc->file->nopen_objs == loc->file->nmounts)
+ if(H5F_NOPEN_OBJS(loc->file) == H5F_NMOUNTS(loc->file))
/* Attempt to close down the file hierarchy */
if(H5F_try_close(loc->file) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close")
@@ -2557,7 +2557,7 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
* hold it open, too.
*/
if(src->holding_file)
- dst->file->nopen_objs++;
+ H5F_INCR_NOPEN_OBJS(dst->file);
} else if(depth == H5_COPY_SHALLOW) {
H5O_loc_reset(src);
} /* end if */
@@ -2591,7 +2591,7 @@ H5O_loc_hold_file(H5O_loc_t *loc)
/* If this location is not already holding its file open, do so. */
if(!loc->holding_file) {
- loc->file->nopen_objs++;
+ H5F_INCR_NOPEN_OBJS(loc->file);
loc->holding_file = TRUE;
} /* end if */
@@ -2626,9 +2626,9 @@ H5O_loc_free(H5O_loc_t *loc)
/* If this location is holding its file open try to close the file. */
if(loc->holding_file) {
- loc->file->nopen_objs--;
+ H5F_DECR_NOPEN_OBJS(loc->file);
loc->holding_file = FALSE;
- if(loc->file->nopen_objs <= 0) {
+ if(H5F_NOPEN_OBJS(loc->file) <= 0) {
if(H5F_try_close(loc->file) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
} /* end if */
diff --git a/src/H5SM.c b/src/H5SM.c
index a971fb0..e5d2765 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -17,7 +17,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#define H5SM_PACKAGE /*suppress error about including H5SMpkg */
@@ -26,7 +25,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
@@ -135,12 +134,12 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
HDassert(f);
/* File should not already have a SOHM table */
- HDassert(f->shared->sohm_addr == HADDR_UNDEF);
+ HDassert(!H5F_addr_defined(H5F_SOHM_ADDR(f)));
/* Initialize master table */
if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table")
- table->num_indexes = f->shared->sohm_nindexes;
+ table->num_indexes = H5F_SOHM_NINDEXES(f);
table->table_size = H5SM_TABLE_SIZE(f);
/* Get information from fcpl */
@@ -213,18 +212,18 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache")
/* Record the address of the master table in the file */
- f->shared->sohm_addr = table_addr;
+ H5F_SET_SOHM_ADDR(f, table_addr);
/* Check for sharing attributes in this file, which means that creation
* indices must be tracked on object header message in the file.
*/
if(type_flags_used & H5O_SHMESG_ATTR_FLAG)
- f->shared->store_msg_crt_idx = TRUE;
+ H5F_SET_STORE_MSG_CRT_IDX(f, TRUE);
/* Write shared message information to the superblock extension */
- sohm_table.addr = f->shared->sohm_addr;
- sohm_table.version = f->shared->sohm_vers;
- sohm_table.nindexes = f->shared->sohm_nindexes;
+ sohm_table.addr = H5F_SOHM_ADDR(f);
+ sohm_table.version = H5F_SOHM_VERS(f);
+ sohm_table.nindexes = H5F_SOHM_NINDEXES(f);
if(H5O_msg_create(ext_loc, H5O_SHMESG_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &sohm_table, dxpl_id) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to update SOHM header message")
@@ -353,13 +352,13 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't map message type to flag")
/* Look up the master SOHM table */
- if(H5F_addr_defined(f->shared->sohm_addr)) {
+ if(H5F_addr_defined(H5F_SOHM_ADDR(f))) {
H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
/* Set up user data for callback */
cache_udata.f = f;
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
} /* end if */
else
@@ -375,7 +374,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id)
done:
/* Release the master SOHM table */
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
@@ -413,7 +412,7 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad
cache_udata.f = f;
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Look up index for message type */
@@ -425,7 +424,7 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad
done:
/* Release the master SOHM table */
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
@@ -877,7 +876,7 @@ H5SM_can_share_common(const H5F_t *f, unsigned type_id, const void *mesg)
/* Check whether this message ought to be shared or not */
/* If sharing is disabled in this file, don't share the message */
- if(!H5F_addr_defined(f->shared->sohm_addr))
+ if(!H5F_addr_defined(H5F_SOHM_ADDR(f)))
HGOTO_DONE(FALSE)
/* Type-specific check */
@@ -940,7 +939,7 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
/* Set up user data for callback */
cache_udata.f = f;
- if(NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
+ if(NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
} /* end if */
@@ -964,7 +963,7 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
done:
/* Release the master SOHM table, if we protected it */
- if(my_table && my_table != table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, my_table, H5AC__NO_FLAGS_SET) < 0)
+ if(my_table && my_table != table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), my_table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
@@ -1050,7 +1049,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
cache_udata.f = f;
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_WRITE)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* "complex" sharing checks */
@@ -1087,7 +1086,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
done:
/* Release the master SOHM table */
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, cache_flags) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
@@ -1439,7 +1438,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
FUNC_ENTER_NOAPI_TAG(H5SM_delete, dxpl_id, H5AC__SOHM_TAG, FAIL)
HDassert(f);
- HDassert(f->shared->sohm_addr != HADDR_UNDEF);
+ HDassert(H5F_addr_defined(H5F_SOHM_ADDR(f)));
HDassert(sh_mesg);
/* Get message type */
@@ -1449,7 +1448,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
cache_udata.f = f;
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_WRITE)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and try to delete from it */
@@ -1464,7 +1463,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete mesage from SOHM index")
/* Release the master SOHM table */
- if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, cache_flags) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
table = NULL;
@@ -1482,7 +1481,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
done:
/* Release the master SOHM table (should only happen on error) */
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, cache_flags) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
/* Release any native message we decoded */
@@ -1846,9 +1845,9 @@ herr_t
H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
{
H5F_t *f = ext_loc->file; /* File pointer (convenience variable) */
- H5F_file_t *shared = f->shared; /* Shared file info (convenience variable) */
H5O_shmesg_table_t sohm_table; /* SOHM message from superblock extension */
H5SM_master_table_t *table = NULL; /* SOHM master table */
+ unsigned tmp_sohm_nindexes; /* Number of shared messages indexes in the table */
htri_t status; /* Status for message existing */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1856,7 +1855,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Sanity check */
HDassert(ext_loc);
- HDassert(f && shared);
+ HDassert(f);
HDassert(fc_plist);
/* Check for the extension having a 'shared message info' message */
@@ -1879,17 +1878,17 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
HDmemset(minsizes, 0, sizeof(minsizes));
/* Set SOHM info from file */
- shared->sohm_addr = sohm_table.addr;
- shared->sohm_vers = sohm_table.version;
- shared->sohm_nindexes = sohm_table.nindexes;
- HDassert(H5F_addr_defined(shared->sohm_addr));
- HDassert(shared->sohm_nindexes > 0 && shared->sohm_nindexes <= H5O_SHMESG_MAX_NINDEXES);
+ H5F_SET_SOHM_ADDR(f, sohm_table.addr);
+ H5F_SET_SOHM_VERS(f, sohm_table.version);
+ H5F_SET_SOHM_NINDEXES(f, sohm_table.nindexes);
+ HDassert(H5F_addr_defined(H5F_SOHM_ADDR(f)));
+ HDassert(H5F_SOHM_NINDEXES(f) > 0 && H5F_SOHM_NINDEXES(f) <= H5O_SHMESG_MAX_NINDEXES);
/* Set up user data for callback */
cache_udata.f = f;
/* Read the rest of the SOHM table information from the cache */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, &cache_udata, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get index conversion limits */
@@ -1910,11 +1909,12 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
* indices must be tracked on object header message in the file.
*/
if(index_flags[u] & H5O_SHMESG_ATTR_FLAG)
- shared->store_msg_crt_idx = TRUE;
+ H5F_SET_STORE_MSG_CRT_IDX(f, TRUE);
} /* end for */
/* Set values in the property list */
- if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0)
+ tmp_sohm_nindexes = H5F_SOHM_NINDEXES(f);
+ if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &tmp_sohm_nindexes) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
if(H5P_set(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, index_flags) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set type flags for indexes")
@@ -1927,18 +1927,19 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
} /* end if */
else {
/* No SOHM info in file */
- shared->sohm_addr = HADDR_UNDEF;
- shared->sohm_nindexes = 0;
- shared->sohm_vers = 0;
+ H5F_SET_SOHM_ADDR(f, HADDR_UNDEF);
+ H5F_SET_SOHM_VERS(f, 0);
+ H5F_SET_SOHM_NINDEXES(f, 0);
/* Shared object header messages are disabled */
- if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0)
+ tmp_sohm_nindexes = H5F_SOHM_NINDEXES(f);
+ if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &tmp_sohm_nindexes) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
} /* end else */
done:
/* Release the master SOHM table if we took it out of the cache */
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
@@ -2050,7 +2051,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
tbl_cache_udata.f = f;
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &tbl_cache_udata, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &tbl_cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and find the message in it */
@@ -2124,7 +2125,7 @@ done:
/* Release resources */
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
@@ -2429,12 +2430,12 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
* userblock
*/
if(table_vers == UFAIL)
- table_vers = f->shared->sohm_vers;
- else if(table_vers != f->shared->sohm_vers)
+ table_vers = H5F_SOHM_VERS(f);
+ else if(table_vers != H5F_SOHM_VERS(f))
HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n");
if(num_indexes == UFAIL)
- num_indexes = f->shared->sohm_nindexes;
- else if(num_indexes != f->shared->sohm_nindexes)
+ num_indexes = H5F_SOHM_NINDEXES(f);
+ else if(num_indexes != H5F_SOHM_NINDEXES(f))
HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n");
/* Check arguments. Version must be 0, the only version implemented so far */
@@ -2602,7 +2603,7 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info)
/* Sanity check */
HDassert(f);
- HDassert(H5F_addr_defined(f->shared->sohm_addr));
+ HDassert(H5F_addr_defined(H5F_SOHM_ADDR(f)));
HDassert(hdr_size);
HDassert(ih_info);
@@ -2610,7 +2611,7 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info)
cache_udata.f = f;
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get SOHM header size */
@@ -2662,7 +2663,7 @@ done:
HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 1511fd0..65fc359 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -17,7 +17,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5SM_PACKAGE /*suppress error about including H5SMpkg */
@@ -25,7 +24,7 @@
/* Headers */
/***********/
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
@@ -133,16 +132,16 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *udata)
/* Verify that we're reading version 0 of the table; this is the only
* version defined so far.
*/
- HDassert(f->shared->sohm_vers == HDF5_SHAREDHEADER_VERSION);
+ HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION);
/* Allocate space for the master table in memory */
if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read number of indexes and version from file superblock */
- table->num_indexes = f->shared->sohm_nindexes;
+ table->num_indexes = H5F_SOHM_NINDEXES(f);
- HDassert(addr == f->shared->sohm_addr);
+ HDassert(addr == H5F_SOHM_ADDR(f));
HDassert(addr != HADDR_UNDEF);
HDassert(table->num_indexes > 0);
@@ -273,7 +272,7 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
/* Verify that we're writing version 0 of the table; this is the only
* version defined so far.
*/
- HDassert(f->shared->sohm_vers == HDF5_SHAREDHEADER_VERSION);
+ HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION);
/* Wrap the local buffer for serialized header info */
if(NULL == (wb = H5WB_wrap(tbl_buf, sizeof(tbl_buf))))
@@ -615,7 +614,7 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
UINT32ENCODE(p, computed_chksum);
#ifdef H5_CLEAR_MEMORY
-HDmemset(p, 0, (list->header->list_size - (p - buf)));
+HDmemset(p, 0, (list->header->list_size - (size_t)(p - buf)));
#endif /* H5_CLEAR_MEMORY */
/* Write the list to disk */
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index 84c2bf4..68dc484 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -83,7 +83,7 @@
H5SM_METADATA_PREFIX_SIZE \
\
/* Indices */ \
- + ((f)->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f)) \
+ + (H5F_SOHM_NINDEXES(f) * H5SM_INDEX_HEADER_SIZE(f)) \
)
#define H5SM_LIST_SIZE(f, num_mesg) ( \
diff --git a/src/H5SMtest.c b/src/H5SMtest.c
index 5f4a89b..6b9f7ac 100644
--- a/src/H5SMtest.c
+++ b/src/H5SMtest.c
@@ -17,7 +17,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5SM_PACKAGE /*suppress error about including H5SMpkg */
#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/
@@ -28,7 +27,8 @@
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5SMpkg.h" /* Shared object header messages */
@@ -89,7 +89,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
HDassert(mesg_count);
/* Check for shared messages being enabled */
- if(H5F_addr_defined(f->shared->sohm_addr)) {
+ if(H5F_addr_defined(H5F_SOHM_ADDR(f))) {
H5SM_index_header_t *header; /* Index header for message type */
H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
ssize_t index_num; /* Table index for message type */
@@ -98,7 +98,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
cache_udata.f = f;
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index for this message type */
@@ -115,7 +115,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
done:
/* Release resources */
- if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)