diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-16 20:45:05 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-16 20:45:05 (GMT) |
commit | d2b87ec47ebdb096c331c7b62a195b9cea2f33ae (patch) | |
tree | a066f01361afaf5df457cef612bb0bb9fd80fe18 /src/H5Goh.c | |
parent | ee5a1e07350f0dcf3ef07d9443aa2f4c073392f4 (diff) | |
download | hdf5-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/H5Goh.c')
-rw-r--r-- | src/H5Goh.c | 129 |
1 files changed, 108 insertions, 21 deletions
diff --git a/src/H5Goh.c b/src/H5Goh.c index d727cb7..2494838 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -45,12 +45,16 @@ /* Local Prototypes */ /********************/ +static void *H5O_group_get_copy_file_udata(void); +static void H5O_group_free_copy_file_udata(void *udata); static htri_t H5O_group_isa(H5O_t *loc); static hid_t H5O_group_open(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref); static void *H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id); static H5O_loc_t *H5O_group_get_oloc(hid_t obj_id); +static herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, + H5_ih_info_t *bh_info); /*********************/ @@ -71,14 +75,84 @@ static H5O_loc_t *H5O_group_get_oloc(hid_t obj_id); const H5O_obj_class_t H5O_OBJ_GROUP[1] = {{ H5O_TYPE_GROUP, /* object type */ "group", /* object name, for debugging */ - NULL, /* get 'copy file' user data */ - NULL, /* free 'copy file' user data */ + H5O_group_get_copy_file_udata, /* get 'copy file' user data */ + H5O_group_free_copy_file_udata, /* free 'copy file' user data */ H5O_group_isa, /* "isa" message */ H5O_group_open, /* open an object of this class */ H5O_group_create, /* create an object of this class */ - H5O_group_get_oloc /* get an object header location for an object */ + H5O_group_get_oloc, /* get an object header location for an object */ + H5O_group_bh_info /* get the index & heap info for an object */ }}; +/* Declare the external free list to manage the H5O_ginfo_t struct */ +H5FL_DEFINE(H5G_copy_file_ud_t); + + +/*------------------------------------------------------------------------- + * Function: H5O_group_get_copy_file_udata + * + * Purpose: Allocates the user data needed for copying a group's + * object header from file to file. + * + * Return: Success: Non-NULL pointer to user data + * + * Failure: NULL + * + * Programmer: Neil Fortner + * Thursday, July 30, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5O_group_get_copy_file_udata(void) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5O_group_get_copy_file_udata) + + /* Allocate space for the 'copy file' user data for copying groups. + * Currently this is only a ginfo, so there is no specific struct type for + * this operation. */ + if(NULL == (ret_value = H5FL_CALLOC(H5G_copy_file_ud_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_group_get_copy_file_udata() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_group_free_copy_file_udata + * + * Purpose: Release the user data needed for copying a group's + * object header from file to file. + * + * Return: <none> + * + * Programmer: Neil Fortner + * Thursday, July 30, 2009 + * + *------------------------------------------------------------------------- + */ +static void +H5O_group_free_copy_file_udata(void *_udata) +{ + H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *)_udata; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_group_free_copy_file_udata) + + /* Sanity check */ + HDassert(udata); + + /* Free the ginfo struct (including nested data structs) */ + H5O_msg_free(H5O_PLINE_ID, udata->common.src_pline); + + /* Release space for 'copy file' user data (ginfo struct) */ + (void)H5FL_FREE(H5G_copy_file_ud_t, udata); + + FUNC_LEAVE_NOAPI_VOID +} /* end H5O_group_free_copy_file_udata() */ + /*------------------------------------------------------------------------- * Function: H5O_group_isa @@ -257,14 +331,16 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) { htri_t exists; /* Flag if header message of interest exists */ H5HF_t *fheap = NULL; /* Fractal heap handle */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_group_bh_info, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5O_group_bh_info) /* Sanity check */ HDassert(f); @@ -281,30 +357,37 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LINFO_ID, &linfo)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't read LINFO message") - /* Get creation order B-tree size, if available */ - if(H5F_addr_defined(linfo.corder_bt2_addr)) - if(H5B2_iterate_size(f, dxpl_id, H5G_BT2_CORDER, linfo.corder_bt2_addr, &bh_info->index_size) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") + /* Check if name index available */ + if(H5F_addr_defined(linfo.name_bt2_addr)) { + /* Open the name index v2 B-tree */ + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo.name_bt2_addr))) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") - /* Get name order B-tree size, if available */ - if(H5F_addr_defined(linfo.name_bt2_addr)) - if(H5B2_iterate_size(f, dxpl_id, H5G_BT2_NAME, linfo.name_bt2_addr, &bh_info->index_size) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") + /* Get name index B-tree size */ + if(H5B2_size(bt2_name, dxpl_id, &bh_info->index_size) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for name index") + } /* end if */ + + /* Check if creation order index available */ + if(H5F_addr_defined(linfo.corder_bt2_addr)) { + /* Open the creation order index v2 B-tree */ + if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, linfo.corder_bt2_addr))) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + + /* Get creation order index B-tree size */ + if(H5B2_size(bt2_corder, dxpl_id, &bh_info->index_size) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for creation order index") + } /* end if */ /* Get fractal heap size, if available */ if(H5F_addr_defined(linfo.fheap_addr)) { /* Open the fractal heap for links */ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo.fheap_addr))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get heap storage size */ if(H5HF_size(fheap, dxpl_id, &bh_info->heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") - - /* Release the fractal heap */ - if(H5HF_close(fheap, dxpl_id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap") - fheap = NULL; + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") } /* end if */ } /* end if */ else { @@ -322,7 +405,11 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) done: /* Release resources */ if(fheap && H5HF_close(fheap, dxpl_id) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") + if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_group_bh_info() */ |