summaryrefslogtreecommitdiffstats
path: root/src/H5Gobj.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
commitd2b87ec47ebdb096c331c7b62a195b9cea2f33ae (patch)
treea066f01361afaf5df457cef612bb0bb9fd80fe18 /src/H5Gobj.c
parentee5a1e07350f0dcf3ef07d9443aa2f4c073392f4 (diff)
downloadhdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.zip
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.gz
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.bz2
[svn-r17896] Description:
Bring r17546:17895 from trunk to revise_chunks branch. Changes to fixed and extensible array dataset chunk indexing code to accommodate changes to private APIs in those interfaces. Also, other adjustments to source code and expected output in response to changes on the trunk. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5Gobj.c')
-rw-r--r--src/H5Gobj.c116
1 files changed, 106 insertions, 10 deletions
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index a11dc13..4281ac0 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -125,20 +125,78 @@ static herr_t H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo,
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
- const H5O_linfo_t *linfo, hid_t gcpl_id, H5O_loc_t *oloc/*out*/)
+H5G_obj_create(H5F_t *f, hid_t dxpl_id, hid_t gcpl_id, H5O_loc_t *oloc/*out*/)
+{
+ H5P_genplist_t *gc_plist; /* Group creation property list */
+ H5O_ginfo_t ginfo; /* Group info */
+ H5O_linfo_t linfo; /* Link info */
+ H5O_pline_t pline; /* Pipeline */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_obj_create, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(oloc);
+
+ /* Get the property list */
+ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get the group info property */
+ if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Get the link info property */
+ if(H5P_get(gc_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Get the pipeline property */
+ if(H5P_get(gc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Call the "real" group creation routine now */
+ if(H5G_obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcpl_id, oloc) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "unable to create group")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_obj_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_create_real
+ *
+ * Purpose: Create an object header for a group and update object location info
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Sep 29 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
+ const H5O_linfo_t *linfo, const H5O_pline_t *pline, hid_t gcpl_id,
+ H5O_loc_t *oloc/*out*/)
{
size_t hdr_size; /* Size of object header to request */
hbool_t use_latest_format; /* Flag indicating the new group format should be used */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_obj_create, FAIL)
+ FUNC_ENTER_NOAPI(H5G_obj_create_real, FAIL)
/*
* Check arguments.
*/
HDassert(f);
HDassert(ginfo);
+ HDassert(linfo);
+ HDassert(pline);
HDassert(oloc);
/* Check for invalid access request */
@@ -147,7 +205,8 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for using the latest version of the group format */
/* (add more checks for creating "new format" groups when needed) */
- if(H5F_USE_LATEST_FORMAT(f) || linfo->track_corder)
+ if(H5F_USE_LATEST_FORMAT(f) || linfo->track_corder
+ || (pline && pline->nused))
use_latest_format = TRUE;
else
use_latest_format = FALSE;
@@ -164,6 +223,7 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
char null_char = '\0'; /* Character for creating null string */
size_t ginfo_size; /* Size of the group info message */
size_t linfo_size; /* Size of the link info message */
+ size_t pline_size = 0; /* Size of the pipeline message */
size_t link_size; /* Size of a link message */
/* Calculate message size infomation, for creating group's object header */
@@ -173,6 +233,11 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
ginfo_size = H5O_msg_size_f(f, gcpl_id, H5O_GINFO_ID, ginfo, (size_t)0);
HDassert(ginfo_size);
+ if(pline && pline->nused) {
+ pline_size = H5O_msg_size_f(f, gcpl_id, H5O_PLINE_ID, pline, (size_t)0);
+ HDassert(pline_size);
+ } /* end if */
+
lnk.type = H5L_TYPE_HARD;
lnk.corder = 0;
lnk.corder_valid = linfo->track_corder;
@@ -184,10 +249,11 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Compute size of header to use for creation */
hdr_size = linfo_size +
ginfo_size +
+ pline_size +
(ginfo->est_num_entries * link_size);
} /* end if */
else
- hdr_size = 4 + 2 * H5F_SIZEOF_ADDR(f);
+ hdr_size = (size_t)(4 + 2 * H5F_SIZEOF_ADDR(f));
/*
* Create group's object header. It has a zero link count
@@ -200,12 +266,17 @@ H5G_obj_create(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, 0, linfo, dxpl_id) < 0)
+ if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, 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, H5O_UPDATE_TIME, ginfo, dxpl_id) < 0)
+ if(H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, 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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
} /* end if */
else {
H5O_stab_t stab; /* Symbol table message */
@@ -217,7 +288,7 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_obj_create() */
+} /* end H5G_obj_create_real() */
/*-------------------------------------------------------------------------
@@ -238,6 +309,7 @@ done:
htri_t
H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
{
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_get_linfo, FAIL)
@@ -258,9 +330,13 @@ H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
if(linfo->nlinks == HSIZET_MAX) {
/* Check if we are using "dense" link storage */
if(H5F_addr_defined(linfo->fheap_addr)) {
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(grp_oloc->file, dxpl_id, linfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec(grp_oloc->file, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &linfo->nlinks) < 0)
+ if(H5B2_get_nrec(bt2_name, &linfo->nlinks) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
} /* end if */
else {
@@ -272,6 +348,10 @@ H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
} /* end if */
done:
+ /* Release resources */
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_get_linfo() */
@@ -369,6 +449,8 @@ herr_t
H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
hbool_t adj_link, hid_t dxpl_id)
{
+ H5O_pline_t tmp_pline; /* Pipeline message */
+ H5O_pline_t *pline = NULL; /* Pointer to pipeline message */
H5O_linfo_t linfo; /* Link info message */
htri_t linfo_exists; /* Whether the link info message exists */
hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for insertions or not */
@@ -420,11 +502,21 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
else if(linfo.nlinks < ginfo.max_compact && link_msg_size < H5O_MESG_MAX_SIZE)
use_new_dense = FALSE;
else {
+ htri_t pline_exists; /* Whether the pipeline message exists */
H5G_obj_oh_it_ud1_t udata; /* User data for iteration */
H5O_mesg_operator_t op; /* Message operator */
+ /* Get the pipeline message, if it exists */
+ if((pline_exists = H5O_msg_exists(grp_oloc, H5O_PLINE_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header")
+ if(pline_exists) {
+ if(NULL == H5O_msg_read(grp_oloc, H5O_PLINE_ID, &tmp_pline, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline")
+ pline = &tmp_pline;
+ } /* end if */
+
/* The group doesn't currently have "dense" storage for links */
- if(H5G_dense_create(grp_oloc->file, dxpl_id, &linfo) < 0)
+ if(H5G_dense_create(grp_oloc->file, dxpl_id, &linfo, pline) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create 'dense' form of new format group")
/* Set up user data for object header message iteration */
@@ -529,6 +621,10 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
} /* end if */
done:
+ /* Free any space used by the pipeline message */
+ if(pline && H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't release pipeline")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_insert() */