summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5F.c30
-rw-r--r--src/H5Fmount.c80
-rw-r--r--src/H5Fprivate.h27
-rw-r--r--src/H5Fquery.c49
-rw-r--r--src/H5G.c50
-rw-r--r--src/H5Gent.c50
-rw-r--r--src/H5Gname.c72
-rw-r--r--src/H5Gnode.c53
-rw-r--r--src/H5Gobj.c15
-rw-r--r--src/H5Groot.c35
-rw-r--r--src/H5Gstab.c49
-rw-r--r--src/H5Gtraverse.c140
-rw-r--r--src/H5HG.c6
-rw-r--r--src/H5HL.c3
-rw-r--r--src/H5HLprivate.h2
15 files changed, 501 insertions, 160 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 84d5536..9821678 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2929,3 +2929,33 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fclear_elink_file_cache() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_grp_btree_shared
+ *
+ * Purpose: Set the grp_btree_shared field with a valid ref-count pointer.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * 7/19/11
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_grp_btree_shared(H5F_t *f, H5RC_t *rc)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_set_grp_btree_shared)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(rc);
+
+ f->shared->grp_btree_shared = rc;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_grp_btree_shared() */
+
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index d04e747..707495a 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -705,3 +705,83 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_flush_mounts() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_traverse_mount
+ *
+ * Purpose: If LNK is a mount point then copy the entry for the root
+ * group of the mounted file into LNK.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, October 6, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_traverse_mount(H5O_loc_t *oloc/*in,out*/)
+{
+ H5F_t *parent = oloc->file, /* File of object */
+ *child = NULL; /* Child file */
+ unsigned lt, rt, md = 0; /* Binary search indices */
+ int cmp;
+ H5O_loc_t *mnt_oloc = NULL; /* Object location for mount points */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5F_traverse_mount, FAIL)
+
+ /* Sanity check */
+ HDassert(oloc);
+
+ /*
+ * The loop is necessary because we might have file1 mounted at the root
+ * of file2, which is mounted somewhere in file3.
+ */
+ do {
+ /*
+ * Use a binary search to find the potential mount point in the mount
+ * table for the parent
+ */
+ lt = 0;
+ rt = parent->shared->mtab.nmounts;
+ cmp = -1;
+ while(lt < rt && cmp) {
+ md = (lt + rt) / 2;
+ mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group);
+ cmp = H5F_addr_cmp(oloc->addr, mnt_oloc->addr);
+ if(cmp < 0)
+ rt = md;
+ else
+ lt = md + 1;
+ } /* end while */
+
+ /* Copy root info over to ENT */
+ if(0 == cmp) {
+ /* Get the child file */
+ child = parent->shared->mtab.child[md].file;
+
+ /* Get the location for the root group in the child's file */
+ mnt_oloc = H5G_oloc(child->shared->root_grp);
+
+ /* Release the mount point */
+ if(H5O_loc_free(oloc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to free object location")
+
+ /* Copy the entry for the root group */
+ if(H5O_loc_copy(oloc, mnt_oloc, H5_COPY_DEEP) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
+
+ /* In case the shared root group info points to a different file handle
+ * than the child, modify oloc */
+ oloc->file = child;
+
+ /* Switch to child's file */
+ parent = child;
+ } /* end if */
+ } while(!cmp);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_traverse_mount() */
+
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 7cb9cfc..036e141 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -236,6 +236,11 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5F_PACKAGE
#define H5F_INTENT(F) ((F)->intent)
+#define H5F_OPEN_NAME(F) ((F)->open_name)
+#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
+#define H5F_EXTPATH(F) ((F)->extpath)
+#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)
@@ -246,12 +251,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#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_OPEN_NAME(F) ((F)->open_name)
-#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
-#define H5F_EXTPATH(F) ((F)->extpath)
#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))
@@ -261,6 +264,11 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#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_OPEN_NAME(F) (H5F_get_open_name(F))
+#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
+#define H5F_EXTPATH(F) (H5F_get_extpath(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))
@@ -271,12 +279,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#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_OPEN_NAME(F) (H5F_get_open_name(F))
-#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
-#define H5F_EXTPATH(F) (H5F_get_extpath(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))
@@ -458,6 +464,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* Forward declarations for prototype arguments */
struct H5B_class_t;
struct H5RC_t;
+struct H5O_loc_t;
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
@@ -469,9 +476,11 @@ 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_extpath(const H5F_t *f);
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_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 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);
@@ -487,6 +496,7 @@ 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);
@@ -503,9 +513,10 @@ 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);
-/* Functions than check file mounting information */
+/* Functions that check file mounting information */
H5_DLL hbool_t H5F_is_mount(const H5F_t *file);
H5_DLL hbool_t H5F_has_mount(const H5F_t *file);
+H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc/*in,out*/);
/* Functions that operate on blocks of bytes wrt super block */
H5_DLL herr_t H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr,
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index c5ecf6b..9c042d7 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -181,6 +181,55 @@ H5F_get_extpath(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_parent
+ *
+ * Purpose: Retrieve the file's 'parent' pointer
+ *
+ * Return: 'parent' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 19, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_t *
+H5F_get_parent(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_parent)
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->parent)
+} /* end H5F_get_parent() */
+
+
+/*-------------------------------------------------------------------------
+ * 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_fcpl
*
* Purpose: Retrieve the value of a file's FCPL.
diff --git a/src/H5G.c b/src/H5G.c
index 1a0c35a..32d3b28 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -75,27 +75,41 @@
*-------------------------------------------------------------------------
*/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/****************/
+/* Module Setup */
+/****************/
+
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5G_init_interface
-/* Packages needed by this file... */
+
+/***********/
+/* Headers */
+/***********/
#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 "H5FOprivate.h" /* File objects */
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-/* Local macros */
+
+/****************/
+/* Local Macros */
+/****************/
+
#define H5G_RESERVED_ATOMS 0
-/* Local typedefs */
+
+/******************/
+/* Local Typedefs */
+/******************/
/* User data for path traversal routine for "insertion file" routine */
typedef struct {
@@ -126,10 +140,21 @@ typedef struct {
} H5G_iter_visit_ud_t;
-/* Package variables */
+/********************/
+/* Package Typedefs */
+/********************/
+
+/********************/
+/* Local Prototypes */
+/********************/
-/* Local variables */
+static herr_t H5G_open_oid(H5G_t *grp, hid_t dxpl_id);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Declare a free list to manage the H5G_t struct */
H5FL_DEFINE(H5G_t);
@@ -139,8 +164,15 @@ H5FL_DEFINE(H5G_shared_t);
H5FL_DEFINE(H5_obj_t);
-/* Private prototypes */
-static herr_t H5G_open_oid(H5G_t *grp, hid_t dxpl_id);
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
diff --git a/src/H5Gent.c b/src/H5Gent.c
index cec788c..ad4c058 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -17,25 +17,63 @@
* Programmer: Robb Matzke <matzke@llnl.gov>
* Friday, September 19, 1997
*/
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#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 "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
-/* Private macros */
-/* Private prototypes */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Declare extern the PQ free list for the wrapped strings */
H5FL_BLK_EXTERN(str_buf);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*-------------------------------------------------------------------------
* Function: H5G_ent_decode_vec
@@ -249,7 +287,7 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
/* fill with zero */
if(*pp < p_ret)
- HDmemset(*pp, 0, (p_ret - *pp));
+ HDmemset(*pp, 0, (size_t)(p_ret - *pp));
*pp = p_ret;
done:
diff --git a/src/H5Gname.c b/src/H5Gname.c
index e732360..18723a9 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -23,22 +23,36 @@
*
*-------------------------------------------------------------------------
*/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory wrappers */
-/* Private typedefs */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
/* Struct used by change name callback function */
typedef struct H5G_names_t {
@@ -60,14 +74,15 @@ typedef struct H5G_gnba_iter_t {
char *path; /* Name of the object */
} H5G_gnba_iter_t;
-/* Private macros */
+/********************/
+/* Package Typedefs */
+/********************/
-/* Local variables */
-/* Declare extern the PQ free list for the wrapped strings */
-H5FL_BLK_EXTERN(str_buf);
+/********************/
+/* Local Prototypes */
+/********************/
-/* PRIVATE PROTOTYPES */
static htri_t H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r);
static H5RS_str_t *H5G_build_fullpath(const char *prefix, const char *name);
#ifdef NOT_YET
@@ -77,6 +92,25 @@ static herr_t H5G_name_move_path(H5RS_str_t **path_r_ptr,
const char *full_suffix, const char *src_path, const char *dst_path);
static int H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Declare extern the PQ free list for the wrapped strings */
+H5FL_BLK_EXTERN(str_buf);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*-------------------------------------------------------------------------
* Function: H5G_common_path
@@ -719,30 +753,30 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
HGOTO_DONE(SUCCEED) /* No need to look at object, it's path is already invalid */
/* Find the top file in object's mount hier. */
- if(oloc->file->parent) {
+ if(H5F_PARENT(oloc->file)) {
/* Check if object is in child file (for mount & unmount operations) */
- if(names->dst_file && oloc->file->shared == names->dst_file->shared)
+ if(names->dst_file && H5F_SAME_SHARED(oloc->file, names->dst_file))
obj_in_child = TRUE;
/* Find the "top" file in the chain of mounted files */
- top_obj_file = oloc->file->parent;
- while(top_obj_file->parent != NULL) {
+ top_obj_file = H5F_PARENT(oloc->file);
+ while(H5F_PARENT(top_obj_file) != NULL) {
/* Check if object is in child mount hier. (for mount & unmount operations) */
- if(names->dst_file && top_obj_file->shared == names->dst_file->shared)
+ if(names->dst_file && H5F_SAME_SHARED(top_obj_file, names->dst_file))
obj_in_child = TRUE;
- top_obj_file = top_obj_file->parent;
+ top_obj_file = H5F_PARENT(top_obj_file);
} /* end while */
} /* end if */
else
top_obj_file = oloc->file;
/* Check if object is in top of child mount hier. (for mount & unmount operations) */
- if(names->dst_file && top_obj_file->shared == names->dst_file->shared)
+ if(names->dst_file && H5F_SAME_SHARED(top_obj_file, names->dst_file))
obj_in_child = TRUE;
/* Check if the object is in same file mount hier. */
- if(top_obj_file->shared != names->src_file->shared)
+ if(!H5F_SAME_SHARED(top_obj_file, names->src_file))
HGOTO_DONE(SUCCEED) /* No need to look at object, it's path is already invalid */
switch(names->op) {
@@ -1022,8 +1056,8 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
H5G_names_t names; /* Structure to hold operation information for callback */
/* Find top file in src location's mount hierarchy */
- while(src_file->parent)
- src_file = src_file->parent;
+ while(H5F_PARENT(src_file))
+ src_file = H5F_PARENT(src_file);
/* Set up common information for callback */
names.src_file = src_file;
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index a33dfc7..611694b 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -26,15 +26,21 @@
*
*-------------------------------------------------------------------------
*/
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#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 "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
@@ -42,7 +48,15 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property Lists */
-/* Private typedefs */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
/*
* Each key field of the B-link tree that points to symbol table
@@ -53,9 +67,14 @@ typedef struct H5G_node_key_t {
} H5G_node_key_t;
-/* Private macros */
+/********************/
+/* Package Typedefs */
+/********************/
+
-/* PRIVATE PROTOTYPES */
+/********************/
+/* Local Prototypes */
+/********************/
/* B-tree callbacks */
static H5RC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata);
@@ -79,6 +98,11 @@ static herr_t H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, cons
static herr_t H5G_node_debug_key(FILE *stream, int indent, int fwidth,
const void *key, const void *udata);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* H5G inherits B-tree like properties from H5B */
H5B_class_t H5B_SNODE[1] = {{
H5B_SNODE_ID, /*id */
@@ -104,6 +128,16 @@ H5FL_DEFINE(H5G_node_t);
/* Declare a free list to manage sequences of H5G_entry_t's */
H5FL_SEQ_DEFINE(H5G_entry_t);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5G_node_get_shared
@@ -701,8 +735,9 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
} /* end else */
/* Move entries down to make room for new entry */
+ HDassert(idx >= 0);
HDmemmove(insert_into->entry + idx + 1, insert_into->entry + idx,
- (insert_into->nsyms - idx) * sizeof(H5G_entry_t));
+ (insert_into->nsyms - (unsigned)idx) * sizeof(H5G_entry_t));
/* Copy new entry into table */
H5G_ent_copy(&(insert_into->entry[idx]), &ent, H5_COPY_SHALLOW);
@@ -1154,8 +1189,8 @@ H5G_node_init(H5F_t *f)
/* <none> */
/* Make shared B-tree info reference counted */
- if(NULL == (f->shared->grp_btree_shared = H5RC_create(shared, H5B_shared_free)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
+ if(H5F_SET_GRP_BTREE_SHARED(f, H5RC_create(shared, H5B_shared_free)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 16b202a..8580508 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -28,7 +28,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
@@ -37,7 +36,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
@@ -81,6 +80,7 @@ typedef struct {
hid_t dxpl_id; /* DXPL during insertion */
} H5G_obj_stab_it_ud1_t;
+
/********************/
/* Package Typedefs */
/********************/
@@ -202,7 +202,7 @@ H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
HDassert(oloc);
/* Check for invalid access request */
- if(0 == (f->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
/* Check for using the latest version of the group format */
@@ -268,16 +268,19 @@ H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for format of group to create */
if(use_latest_format) {
/* Insert link info message */
- if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, linfo, dxpl_id) < 0)
+ /* (Casting away const OK - QAK) */
+ if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
/* Insert group info message */
- if(H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, ginfo, dxpl_id) < 0)
+ /* (Casting away const OK - QAK) */
+ if(H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)ginfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
/* Insert pipeline message */
if(pline && pline->nused)
- if(H5O_msg_create(oloc, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline, dxpl_id) < 0)
+ /* (Casting away const OK - QAK) */
+ if(H5O_msg_create(oloc, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)pline, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
} /* end if */
else {
diff --git a/src/H5Groot.c b/src/H5Groot.c
index a7d7e29..9a567e1 100644
--- a/src/H5Groot.c
+++ b/src/H5Groot.c
@@ -44,6 +44,41 @@
#include "H5Pprivate.h" /* Property Lists */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*-------------------------------------------------------------------------
* Function: H5G_rootof
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index c221f2e..e52636c 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -17,19 +17,34 @@
* Friday, September 19, 1997
*
*/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5MMprivate.h" /* Memory management */
-/* Private typedefs */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
/* User data for finding link information from B-tree */
typedef struct {
/* downward */
@@ -74,7 +89,31 @@ typedef struct H5G_bt_it_lbi_t {
hbool_t found; /*whether we found the link */
} H5G_bt_it_lbi_t;
-/* Private prototypes */
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 9519f32..c04d7a2 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -23,15 +23,21 @@
*
*-------------------------------------------------------------------------
*/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
@@ -40,7 +46,15 @@
#include "H5Ppublic.h" /* Property Lists */
#include "H5WBprivate.h" /* Wrapped Buffers */
-/* Private typedefs */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
/* User data for path traversal routine */
typedef struct {
@@ -52,11 +66,15 @@ typedef struct {
hbool_t exists; /* Indicate if object exists */
} H5G_trav_slink_t;
-/* Private macros */
-/* Local variables */
+/********************/
+/* Package Typedefs */
+/********************/
-/* PRIVATE PROTOTYPES */
+
+/********************/
+/* Local Prototypes */
+/********************/
static herr_t H5G_traverse_slink_cb(H5G_loc_t *grp_loc, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -66,11 +84,26 @@ static herr_t H5G_traverse_ud(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
static herr_t H5G_traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
H5G_loc_t *obj_loc/*in,out*/, unsigned target, size_t *nlinks/*in,out*/,
hbool_t *obj_exists, hid_t lapl_id, hid_t dxpl_id);
-static herr_t H5G_traverse_mount(H5G_loc_t *loc/*in,out*/);
static herr_t H5G_traverse_real(const H5G_loc_t *loc, const char *name,
unsigned target, size_t *nlinks, H5G_traverse_t op, void *op_data,
hid_t lapl_id, hid_t dxpl_id);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*-------------------------------------------------------------------------
* Function: H5G_traverse_slink_cb
@@ -347,86 +380,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_traverse_mount
- *
- * Purpose: If LNK is a mount point then copy the entry for the root
- * group of the mounted file into LNK.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, October 6, 1998
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G_traverse_mount(H5G_loc_t *obj_loc/*in,out*/)
-{
- H5F_t *parent = obj_loc->oloc->file, /* File of object */
- *child = NULL; /* Child file */
- unsigned lt, rt, md = 0; /* Binary search indices */
- int cmp;
- H5O_loc_t *oloc = NULL; /* Object location for mount points */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5G_traverse_mount, FAIL)
-
- /* Sanity check */
- HDassert(obj_loc);
-
- /*
- * The loop is necessary because we might have file1 mounted at the root
- * of file2, which is mounted somewhere in file3.
- */
- do {
- /*
- * Use a binary search to find the potential mount point in the mount
- * table for the parent
- */
- lt = 0;
- rt = parent->shared->mtab.nmounts;
- cmp = -1;
- while(lt < rt && cmp) {
- md = (lt + rt) / 2;
- oloc = H5G_oloc(parent->shared->mtab.child[md].group);
- cmp = H5F_addr_cmp(obj_loc->oloc->addr, oloc->addr);
- if(cmp < 0)
- rt = md;
- else
- lt = md + 1;
- } /* end while */
-
- /* Copy root info over to ENT */
- if(0 == cmp) {
- /* Get the child file */
- child = parent->shared->mtab.child[md].file;
-
- /* Get the location for the root group in the child's file */
- oloc = H5G_oloc(child->shared->root_grp);
-
- /* Release the mount point */
- if(H5O_loc_free(obj_loc->oloc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to free object location")
-
- /* Copy the entry for the root group */
- if(H5O_loc_copy(obj_loc->oloc, oloc, H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
-
- /* In case the shared root group info points to a different file handle
- * than the child, modify obj_loc */
- obj_loc->oloc->file = child;
-
- /* Switch to child's file */
- parent = child;
- } /* end if */
- } while(!cmp);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_traverse_mount() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_traverse_special
*
* Purpose: Handle traversing special link situations
@@ -493,7 +446,7 @@ H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
*/
if(H5F_addr_defined(obj_loc->oloc->addr) &&
(0 == (target & H5G_TARGET_MOUNT) || !last_comp)) {
- if(H5G_traverse_mount(obj_loc/*in,out*/) < 0)
+ if(H5F_traverse_mount(obj_loc->oloc/*in,out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "mount point traversal failed")
} /* end if */
@@ -786,13 +739,16 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Reset any non-default object header messages */
if(ginfo != &def_ginfo)
- if(H5O_msg_reset(H5O_GINFO_ID, ginfo) < 0)
+ /* (Casting away const OK - QAK) */
+ if(H5O_msg_reset(H5O_GINFO_ID, (void *)ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message")
if(linfo != &def_linfo)
- if(H5O_msg_reset(H5O_LINFO_ID, linfo) < 0)
+ /* (Casting away const OK - QAK) */
+ if(H5O_msg_reset(H5O_LINFO_ID, (void *)linfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message")
if(pline != &def_pline)
- if(H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
+ /* (Casting away const OK - QAK) */
+ if(H5O_msg_reset(H5O_PLINE_ID, (void *)pline) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message")
} /* end if */
else
diff --git a/src/H5HG.c b/src/H5HG.c
index 8f4bd89..19c80b7 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -552,7 +552,7 @@ H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/
HDassert(0 == size || obj);
HDassert(hobj);
- if(0 == (f->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Find a large enough collection on the CWFS list */
@@ -775,7 +775,7 @@ H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust)
/* Check args */
HDassert(f);
HDassert(hobj);
- if(0 == (f->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Load the heap */
@@ -838,7 +838,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
/* Check args */
HDassert(f);
HDassert(hobj);
- if(0 == (f->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Load the heap */
diff --git a/src/H5HL.c b/src/H5HL.c
index 4665474..d806308 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -29,7 +29,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /* Suppress error about including H5Fpkg */
#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */
@@ -38,7 +37,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5HLpkg.h" /* Local Heaps */
#include "H5MFprivate.h" /* File memory management */
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 8679bee..0b044b6 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -44,7 +44,7 @@
# undef H5HL_DEBUG
#endif
-#define H5HL_ALIGN(X) (((X)+7)&(unsigned)(~0x07)) /*align on 8-byte boundary */
+#define H5HL_ALIGN(X) ((((unsigned)X)+7)&(unsigned)(~0x07)) /*align on 8-byte boundary */
#define H5HL_SIZEOF_FREE(F) \
H5HL_ALIGN(H5F_SIZEOF_SIZE (F) + /*ptr to next free block */ \