mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[svn-r11758] Purpose:
New feature Description: Add in a combination of Peter's & my code to support copying variable-length data from one file to another, although currently only supported with contiguous data storage. Platforms tested: FreeBSD 4.11 (sleipnir) h5committest
This commit is contained in:
parent
4620776d72
commit
8d344f96bc
3
MANIFEST
3
MANIFEST
@ -435,6 +435,7 @@
|
||||
./src/H5Dio.c
|
||||
./src/H5Distore.c
|
||||
./src/H5Dmpio.c
|
||||
./src/H5Doh.c
|
||||
./src/H5Dpkg.h
|
||||
./src/H5Dprivate.h
|
||||
./src/H5Dpublic.h
|
||||
@ -498,6 +499,7 @@
|
||||
./src/H5Gname.c
|
||||
./src/H5Gnode.c
|
||||
./src/H5Gobj.c
|
||||
./src/H5Goh.c
|
||||
./src/H5Gpkg.h
|
||||
./src/H5Gprivate.h
|
||||
./src/H5Gpublic.h
|
||||
@ -605,6 +607,7 @@
|
||||
./src/H5Toffset.c
|
||||
./src/H5Topaque.c
|
||||
./src/H5Torder.c
|
||||
./src/H5Toh.c
|
||||
./src/H5Tpad.c
|
||||
./src/H5Tpkg.h
|
||||
./src/H5Tprecis.c
|
||||
|
@ -410,10 +410,10 @@
|
||||
! Outputs:
|
||||
! obj_type - object_type, possible values:
|
||||
! H5G_UNKNOWN_F (-1)
|
||||
! H5G_LINK_F 0
|
||||
! H5G_GROUP_F 1
|
||||
! H5G_DATASET_F 2
|
||||
! H5G_TYPE_F 3
|
||||
! H5G_GROUP_F 0
|
||||
! H5G_DATASET_F 1
|
||||
! H5G_TYPE_F 2
|
||||
! H5G_LINK_F 3
|
||||
!
|
||||
! hdferr: - error code
|
||||
! Success: 0
|
||||
@ -445,10 +445,10 @@
|
||||
TYPE(hobj_ref_t_f), INTENT(IN) :: ref ! Object reference
|
||||
INTEGER, INTENT(OUT) :: obj_type ! Object type
|
||||
! H5G_UNKNOWN_F (-1)
|
||||
! H5G_LINK_F 0
|
||||
! H5G_GROUP_F 1
|
||||
! H5G_DATASET_F 2
|
||||
! H5G_TYPE_F 3
|
||||
! H5G_GROUP_F 0
|
||||
! H5G_DATASET_F 1
|
||||
! H5G_TYPE_F 2
|
||||
! H5G_LINK_F 3
|
||||
|
||||
INTEGER, INTENT(OUT) :: hdferr ! Error code
|
||||
INTEGER(HADDR_T) :: ref_f ! Local buffer to pass reference
|
||||
|
@ -298,10 +298,10 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
|
||||
*/
|
||||
|
||||
h5g_flags[0] = H5G_UNKNOWN;
|
||||
h5g_flags[1] = H5G_LINK;
|
||||
h5g_flags[2] = H5G_GROUP;
|
||||
h5g_flags[3] = H5G_DATASET;
|
||||
h5g_flags[4] = H5G_TYPE;
|
||||
h5g_flags[1] = H5G_GROUP;
|
||||
h5g_flags[2] = H5G_DATASET;
|
||||
h5g_flags[3] = H5G_TYPE;
|
||||
h5g_flags[4] = H5G_LINK;
|
||||
h5g_flags[5] = H5G_LINK_ERROR;
|
||||
h5g_flags[6] = H5G_LINK_HARD;
|
||||
h5g_flags[7] = H5G_LINK_SOFT;
|
||||
|
@ -201,19 +201,19 @@
|
||||
COMMON /H5G_FLAGS/ H5G_flags
|
||||
|
||||
INTEGER :: H5G_UNKNOWN_F
|
||||
INTEGER :: H5G_LINK_F
|
||||
INTEGER :: H5G_GROUP_F
|
||||
INTEGER :: H5G_DATASET_F
|
||||
INTEGER :: H5G_TYPE_F
|
||||
INTEGER :: H5G_LINK_F
|
||||
INTEGER :: H5G_LINK_ERROR_F
|
||||
INTEGER :: H5G_LINK_HARD_F
|
||||
INTEGER :: H5G_LINK_SOFT_F
|
||||
|
||||
EQUIVALENCE(H5G_flags(1), H5G_UNKNOWN_F)
|
||||
EQUIVALENCE(H5G_flags(2), H5G_LINK_F)
|
||||
EQUIVALENCE(H5G_flags(3), H5G_GROUP_F)
|
||||
EQUIVALENCE(H5G_flags(4), H5G_DATASET_F)
|
||||
EQUIVALENCE(H5G_flags(5), H5G_TYPE_F)
|
||||
EQUIVALENCE(H5G_flags(2), H5G_GROUP_F)
|
||||
EQUIVALENCE(H5G_flags(3), H5G_DATASET_F)
|
||||
EQUIVALENCE(H5G_flags(4), H5G_TYPE_F)
|
||||
EQUIVALENCE(H5G_flags(5), H5G_LINK_F)
|
||||
EQUIVALENCE(H5G_flags(6), H5G_LINK_ERROR_F)
|
||||
EQUIVALENCE(H5G_flags(7), H5G_LINK_HARD_F)
|
||||
EQUIVALENCE(H5G_flags(8), H5G_LINK_SOFT_F)
|
||||
|
@ -158,7 +158,7 @@
|
||||
!
|
||||
CALL h5rget_object_type_f(dsetr_id, ref(3), obj_type, error)
|
||||
CALL check("h5rget_object_type_f",error,total_error)
|
||||
if (obj_type == 2) then
|
||||
if (obj_type == H5G_DATASET_F) then
|
||||
CALL h5rdereference_f(dsetr_id, ref(3), dset1_id, error)
|
||||
CALL check("h5rdereference_f",error,total_error)
|
||||
|
||||
@ -172,7 +172,7 @@
|
||||
!
|
||||
CALL h5rget_object_type_f(dsetr_id, ref(4), obj_type, error)
|
||||
CALL check("h5rget_object_type_f",error,total_error)
|
||||
if (obj_type == 3) then
|
||||
if (obj_type == H5G_TYPE_F) then
|
||||
CALL h5rdereference_f(dsetr_id, ref(4), type_id, error)
|
||||
CALL check("h5rdereference_f",error,total_error)
|
||||
end if
|
||||
|
3
src/H5.c
3
src/H5.c
@ -221,9 +221,6 @@ H5_term_library(void)
|
||||
pending += DOWN(A);
|
||||
pending += DOWN(S);
|
||||
pending += DOWN(T);
|
||||
/* Don't shut down the object header code until objects are shut down */
|
||||
if(pending==0)
|
||||
pending += DOWN(O);
|
||||
/* Don't shut down the file code until objects in files are shut down */
|
||||
if(pending==0)
|
||||
pending += DOWN(F);
|
||||
|
159
src/H5D.c
159
src/H5D.c
@ -68,6 +68,8 @@ static herr_t H5D_open_oid(H5D_t *dataset, hid_t dxpl_id);
|
||||
static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id);
|
||||
static hsize_t H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id);
|
||||
static haddr_t H5D_get_offset(const H5D_t *dset);
|
||||
static herr_t H5D_iterate(void *buf, hid_t type_id, H5S_t *space,
|
||||
H5D_operator_t op, void *operator_data);
|
||||
static herr_t H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id);
|
||||
static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id);
|
||||
static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
|
||||
@ -2349,50 +2351,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D_create() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D_isa
|
||||
*
|
||||
* Purpose: Determines if an object has the requisite messages for being
|
||||
* a dataset.
|
||||
*
|
||||
* Return: Success: TRUE if the required dataset messages are
|
||||
* present; FALSE otherwise.
|
||||
*
|
||||
* Failure: FAIL if the existence of certain messages
|
||||
* cannot be determined.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, November 2, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
htri_t
|
||||
H5D_isa(H5O_loc_t *loc, hid_t dxpl_id)
|
||||
{
|
||||
htri_t exists;
|
||||
htri_t ret_value = TRUE; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5D_isa, FAIL)
|
||||
|
||||
HDassert(loc);
|
||||
|
||||
/* Datatype */
|
||||
if((exists = H5O_exists(loc, H5O_DTYPE_ID, 0, dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
else if(!exists)
|
||||
HGOTO_DONE(FALSE)
|
||||
|
||||
/* Layout */
|
||||
if((exists = H5O_exists(loc, H5O_SDSPACE_ID, 0, dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
else if(!exists)
|
||||
HGOTO_DONE(FALSE)
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D_isa() */
|
||||
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
@ -3548,12 +3506,47 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op,
|
||||
if(!(H5S_has_extent(space)) )
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
|
||||
|
||||
ret_value = H5S_select_iterate(buf,type_id,space,op,operator_data);
|
||||
ret_value = H5D_iterate(buf, type_id, space, op, operator_data);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Diterate() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D_iterate
|
||||
*
|
||||
* Purpose: Internal version of H5Diterate()
|
||||
*
|
||||
* Return: Returns the return value of the last operator if it was non-zero,
|
||||
* or zero if all elements were processed. Otherwise returns a
|
||||
* negative value.
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, November 22, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5D_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op,
|
||||
void *operator_data)
|
||||
{
|
||||
herr_t ret_value;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_iterate)
|
||||
|
||||
/* Check args */
|
||||
HDassert(buf);
|
||||
HDassert(H5I_DATATYPE == H5I_get_type(type_id));
|
||||
HDassert(space);
|
||||
HDassert(H5S_has_extent(space));
|
||||
HDassert(op);
|
||||
|
||||
ret_value = H5S_select_iterate(buf, type_id, space, op, operator_data);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D_iterate() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Dvlen_reclaim
|
||||
@ -3573,35 +3566,75 @@ done:
|
||||
herr_t
|
||||
H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf)
|
||||
{
|
||||
H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */
|
||||
H5T_vlen_alloc_info_t *vl_alloc_info=&_vl_alloc_info; /* VL allocation info */
|
||||
H5S_t *space = NULL;
|
||||
herr_t ret_value;
|
||||
|
||||
FUNC_ENTER_API(H5Dvlen_reclaim, FAIL)
|
||||
H5TRACE4("e","iiix",type_id,space_id,plist_id,buf);
|
||||
|
||||
/* Check args */
|
||||
if (H5I_DATATYPE!=H5I_get_type(type_id) || H5I_DATASPACE!=H5I_get_type(space_id) ||
|
||||
buf==NULL)
|
||||
if (H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
|
||||
if(NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
|
||||
if(!(H5S_has_extent(space)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
|
||||
|
||||
/* Get the default dataset transfer property list if the user didn't provide one */
|
||||
if (H5P_DEFAULT == plist_id)
|
||||
plist_id= H5P_DATASET_XFER_DEFAULT;
|
||||
if(H5P_DEFAULT == plist_id)
|
||||
plist_id = H5P_DATASET_XFER_DEFAULT;
|
||||
else
|
||||
if (TRUE!=H5P_isa_class(plist_id,H5P_DATASET_XFER))
|
||||
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
|
||||
|
||||
/* Call internal routine */
|
||||
ret_value = H5D_vlen_reclaim(type_id, space, plist_id, buf);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Dvlen_reclaim() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D_vlen_reclaim
|
||||
*
|
||||
* Purpose: Frees the buffers allocated for storing variable-length data
|
||||
* in memory. Only frees the VL data in the selection defined in the
|
||||
* dataspace. The dataset transfer property list is required to find the
|
||||
* correct allocation/free methods for the VL data in the buffer.
|
||||
*
|
||||
* Return: Non-negative on success, negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, November 22, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
|
||||
{
|
||||
H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */
|
||||
H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */
|
||||
herr_t ret_value;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5D_vlen_reclaim, FAIL)
|
||||
|
||||
/* Check args */
|
||||
HDassert(H5I_DATATYPE == H5I_get_type(type_id));
|
||||
HDassert(space);
|
||||
HDassert(H5P_isa_class(plist_id, H5P_DATASET_XFER));
|
||||
HDassert(buf);
|
||||
|
||||
/* Get the allocation info */
|
||||
if(H5T_vlen_get_alloc_info(plist_id,&vl_alloc_info)<0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
|
||||
|
||||
/* Call H5Diterate with args, etc. */
|
||||
ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,vl_alloc_info);
|
||||
/* Call H5D_iterate with args, etc. */
|
||||
ret_value = H5D_iterate(buf, type_id, space ,H5T_vlen_reclaim, vl_alloc_info);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Dvlen_reclaim() */
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D_vlen_reclaim() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -3728,6 +3761,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
|
||||
{
|
||||
H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0, 0};
|
||||
char bogus; /* bogus value to pass to H5Diterate() */
|
||||
H5S_t *space = NULL;
|
||||
H5P_genclass_t *pclass; /* Property class */
|
||||
H5P_genplist_t *plist; /* Property list */
|
||||
herr_t ret_value=FAIL;
|
||||
@ -3736,10 +3770,13 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
|
||||
H5TRACE4("e","iii*h",dataset_id,type_id,space_id,size);
|
||||
|
||||
/* Check args */
|
||||
if (H5I_DATASET!=H5I_get_type(dataset_id) ||
|
||||
H5I_DATATYPE!=H5I_get_type(type_id) ||
|
||||
H5I_DATASPACE!=H5I_get_type(space_id) || size==NULL)
|
||||
if(H5I_DATASET!=H5I_get_type(dataset_id) ||
|
||||
H5I_DATATYPE!=H5I_get_type(type_id) || size==NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
|
||||
if(NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
|
||||
if(!(H5S_has_extent(space)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
|
||||
|
||||
/* Save the dataset ID */
|
||||
vlen_bufsize.dataset_id=dataset_id;
|
||||
@ -3777,8 +3814,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
|
||||
/* Set the initial number of bytes required */
|
||||
vlen_bufsize.size=0;
|
||||
|
||||
/* Call H5Diterate with args, etc. */
|
||||
ret_value=H5Diterate(&bogus,type_id,space_id,H5D_vlen_get_buf_size,&vlen_bufsize);
|
||||
/* Call H5D_iterate with args, etc. */
|
||||
ret_value = H5D_iterate(&bogus, type_id, space, H5D_vlen_get_buf_size, &vlen_bufsize);
|
||||
|
||||
/* Get the size if we succeeded */
|
||||
if(ret_value>=0)
|
||||
|
213
src/H5Dcontig.c
213
src/H5Dcontig.c
@ -38,6 +38,7 @@
|
||||
#include "H5Fprivate.h" /* Files */
|
||||
#include "H5FDprivate.h" /* File drivers */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5MFprivate.h" /* File memory management */
|
||||
#include "H5Oprivate.h" /* Object headers */
|
||||
#include "H5Pprivate.h" /* Property lists */
|
||||
@ -75,6 +76,9 @@ H5FL_BLK_DEFINE_STATIC(non_zero_fill);
|
||||
/* Declare the free list to manage blocks of zero fill-value data */
|
||||
H5FL_BLK_DEFINE_STATIC(zero_fill);
|
||||
|
||||
/* Declare extern the free list to manage blocks of type conversion data */
|
||||
H5FL_BLK_EXTERN(type_conv);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D_contig_create
|
||||
@ -130,7 +134,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
|
||||
size_t npoints; /* Number of points in space */
|
||||
size_t ptsperbuf; /* Maximum # of points which fit in the buffer */
|
||||
size_t elmt_size; /* Size of each element */
|
||||
size_t bufsize=64*1024; /* Size of buffer to write */
|
||||
size_t bufsize=H5D_XFER_MAX_TEMP_BUF_DEF; /* Size of buffer to write */
|
||||
size_t size; /* Current # of points to write */
|
||||
hsize_t offset; /* Offset of dataset */
|
||||
void *buf = NULL; /* Buffer for fill value writing */
|
||||
@ -976,3 +980,210 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D_contig_writevv() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D_contig_copy
|
||||
*
|
||||
* Purpose: Copy contiguous storage raw data from SRC file to DST file.
|
||||
*
|
||||
* Return: Non-negative on success, negative on failure.
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, November 21, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
|
||||
H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *dt_src, hid_t dxpl_id)
|
||||
{
|
||||
haddr_t addr_src; /* File offset in source dataset */
|
||||
haddr_t addr_dst; /* File offset in destination dataset */
|
||||
H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
|
||||
H5T_t *dt_dst = NULL; /* Destination datatype */
|
||||
H5T_t *dt_mem = NULL; /* Memory datatype */
|
||||
hid_t tid_src = -1; /* Datatype ID for source datatype */
|
||||
hid_t tid_dst = -1; /* Datatype ID for destination datatype */
|
||||
hid_t tid_mem = -1; /* Datatype ID for memory datatype */
|
||||
size_t max_dt_size; /* Max. datatype size */
|
||||
size_t nelmts = 0; /* Number of elements in buffer */
|
||||
hsize_t total_nbytes; /* Total number of bytes to copy */
|
||||
size_t buf_size; /* Size of copy buffer */
|
||||
void *buf = NULL; /* Buffer for copying data */
|
||||
void *reclaim_buf = NULL; /* Buffer for reclaiming data */
|
||||
H5S_t *buf_space = NULL; /* Dataspace describing buffer */
|
||||
hid_t buf_sid = -1; /* ID for buffer dataspace */
|
||||
hsize_t buf_dim; /* Dimension for buffer */
|
||||
hbool_t do_conv; /* Flag to indicate that type conversion should occur */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5D_contig_copy, FAIL)
|
||||
|
||||
/* Check args */
|
||||
HDassert(f_src);
|
||||
HDassert(f_dst);
|
||||
HDassert(layout_src && H5D_CONTIGUOUS == layout_src->type);
|
||||
HDassert(layout_dst && H5D_CONTIGUOUS == layout_dst->type);
|
||||
|
||||
/* Allocate space for destination raw data */
|
||||
if(H5D_contig_create(f_dst, dxpl_id, layout_dst) < 0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to allocate contiguous storage")
|
||||
|
||||
/* Set up number of bytes to copy, and initial buffer size */
|
||||
total_nbytes = layout_src->u.contig.size;
|
||||
buf_size = MIN(H5D_XFER_MAX_TEMP_BUF_DEF, total_nbytes);
|
||||
|
||||
/* If there's a source datatype, set up type conversion information */
|
||||
if(dt_src) {
|
||||
size_t tmp_dt_size; /* Temp. atatype size */
|
||||
|
||||
/* Create datatype ID for src datatype */
|
||||
if((tid_src = H5I_register(H5I_DATATYPE, dt_src)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
|
||||
|
||||
/* create a memory copy of the variable-length datatype */
|
||||
if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
|
||||
if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem)) < 0)
|
||||
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
|
||||
|
||||
/* create variable-length datatype at the destinaton file */
|
||||
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
|
||||
if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
|
||||
if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
|
||||
|
||||
/* Set up the conversion functions */
|
||||
if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
|
||||
if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst, NULL, NULL, dxpl_id, FALSE)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
|
||||
|
||||
/* Determine largest datatype size */
|
||||
if(0 == (max_dt_size = H5T_get_size(dt_src)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
|
||||
if(0 == (tmp_dt_size = H5T_get_size(dt_mem)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
|
||||
max_dt_size = MAX(max_dt_size, tmp_dt_size);
|
||||
if(0 == (tmp_dt_size = H5T_get_size(dt_dst)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
|
||||
max_dt_size = MAX(max_dt_size, tmp_dt_size);
|
||||
|
||||
/* Set number of whole elements that fit in buffer */
|
||||
if(0 == (nelmts = buf_size / max_dt_size))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large")
|
||||
|
||||
/* Adjust buffer size to be multiple of elements */
|
||||
buf_size = nelmts * max_dt_size;
|
||||
|
||||
/* Create dataspace for number of elements in buffer */
|
||||
buf_dim = nelmts;
|
||||
|
||||
/* Create the space and set the initial extent */
|
||||
if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
|
||||
|
||||
/* Atomize */
|
||||
if((buf_sid = H5I_register(H5I_DATASPACE, buf_space)) < 0) {
|
||||
H5S_close(buf_space);
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
|
||||
} /* end if */
|
||||
|
||||
/* Set flag to do type conversion */
|
||||
do_conv = TRUE;
|
||||
} /* end if */
|
||||
else
|
||||
/* Type conversion not necessary */
|
||||
do_conv = FALSE;
|
||||
|
||||
/* Allocate space for copy buffer */
|
||||
HDassert(buf_size);
|
||||
if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
|
||||
|
||||
/* Need extra buffer for datatype conversions, to prevent stranding/leaking memory */
|
||||
if(do_conv) {
|
||||
if(NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
|
||||
} /* end if */
|
||||
|
||||
/* Loop over copying data */
|
||||
addr_src = layout_src->u.contig.addr;
|
||||
addr_dst = layout_dst->u.contig.addr;
|
||||
while(total_nbytes > 0) {
|
||||
size_t nbytes; /* Number of bytes to copy each time */
|
||||
|
||||
/* Compute number of bytes to copy for this pass */
|
||||
if(total_nbytes >= buf_size)
|
||||
nbytes = buf_size;
|
||||
else {
|
||||
nbytes = (size_t)total_nbytes;
|
||||
|
||||
/* Adjust dataspace describing buffer */
|
||||
if(do_conv) {
|
||||
/* Adjust size of buffer's dataspace dimension */
|
||||
buf_dim = nelmts = nbytes / max_dt_size;
|
||||
|
||||
/* Adjust size of buffer's dataspace */
|
||||
if(H5S_set_extent_real(buf_space, &buf_dim) < 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to change buffer dataspace size")
|
||||
} /* end if */
|
||||
} /* end else */
|
||||
|
||||
/* Read raw data from source file */
|
||||
if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, nbytes, H5P_DATASET_XFER_DEFAULT, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data")
|
||||
|
||||
/* Perform datatype conversion, if necessary */
|
||||
if(do_conv) {
|
||||
/* Convert from source file to memory */
|
||||
if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
|
||||
|
||||
/* Copy into another buffer, to reclaim memory later */
|
||||
HDmemcpy(reclaim_buf, buf, nbytes);
|
||||
|
||||
/* Convert from memory to destination file */
|
||||
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
|
||||
} /* end if */
|
||||
|
||||
/* Write raw data to destination file */
|
||||
if(H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, nbytes, H5P_DATASET_XFER_DEFAULT, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data")
|
||||
|
||||
/* Reclaim any space from variable length data */
|
||||
if(do_conv) {
|
||||
if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
|
||||
} /* end if */
|
||||
|
||||
/* Adjust loop variables */
|
||||
addr_src += nbytes;
|
||||
addr_dst += nbytes;
|
||||
total_nbytes -= nbytes;
|
||||
} /* end while */
|
||||
|
||||
done:
|
||||
if(buf_sid > 0)
|
||||
if(H5I_dec_ref(buf_sid) < 0)
|
||||
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary dataspace ID")
|
||||
if(tid_src > 0)
|
||||
if(H5I_dec_ref(tid_src) < 0)
|
||||
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
|
||||
if(tid_dst > 0)
|
||||
if(H5I_dec_ref(tid_dst) < 0)
|
||||
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
|
||||
if(tid_mem > 0)
|
||||
if(H5I_dec_ref(tid_mem) < 0)
|
||||
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
|
||||
if(buf)
|
||||
H5FL_BLK_FREE(type_conv, buf);
|
||||
if(reclaim_buf)
|
||||
H5FL_BLK_FREE(type_conv, reclaim_buf);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D_contig_copy() */
|
||||
|
||||
|
176
src/H5Doh.c
Normal file
176
src/H5Doh.c
Normal file
@ -0,0 +1,176 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
||||
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5FLprivate.h" /* Free lists */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
static htri_t H5O_dset_isa(H5O_t *loc);
|
||||
static void *H5O_dset_get_copy_file_udata(void);
|
||||
static void H5O_dset_free_copy_file_udata(void *);
|
||||
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
/* This message derives from H5O object class */
|
||||
const H5O_obj_class_t H5O_OBJ_DATASET[1] = {{
|
||||
H5G_DATASET, /* object type */
|
||||
"dataset", /* object name, for debugging */
|
||||
H5O_dset_get_copy_file_udata, /* get 'copy file' user data */
|
||||
H5O_dset_free_copy_file_udata, /* free 'copy file' user data */
|
||||
H5O_dset_isa /* "isa" message */
|
||||
}};
|
||||
|
||||
/* Declare a free list to manage the H5D_copy_file_ud_t struct */
|
||||
H5FL_DEFINE(H5D_copy_file_ud_t);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_dset_isa
|
||||
*
|
||||
* Purpose: Determines if an object has the requisite messages for being
|
||||
* a dataset.
|
||||
*
|
||||
* Return: Success: TRUE if the required dataset messages are
|
||||
* present; FALSE otherwise.
|
||||
*
|
||||
* Failure: FAIL if the existence of certain messages
|
||||
* cannot be determined.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, November 2, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
htri_t
|
||||
H5O_dset_isa(H5O_t *oh)
|
||||
{
|
||||
htri_t exists; /* Flag if header message of interest exists */
|
||||
htri_t ret_value = TRUE; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_dset_isa, FAIL)
|
||||
|
||||
HDassert(oh);
|
||||
|
||||
/* Datatype */
|
||||
if((exists = H5O_exists_oh(oh, H5O_DTYPE_ID, 0)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
else if(!exists)
|
||||
HGOTO_DONE(FALSE)
|
||||
|
||||
/* Layout */
|
||||
if((exists = H5O_exists_oh(oh, H5O_SDSPACE_ID, 0)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
else if(!exists)
|
||||
HGOTO_DONE(FALSE)
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_dset_isa() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_dset_get_copy_file_udata
|
||||
*
|
||||
* Purpose: Allocates the user data needed for copying a dataset's
|
||||
* object header from file to file.
|
||||
*
|
||||
* Return: Success: Non-NULL pointer to user data
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, November 21, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_dset_get_copy_file_udata(void)
|
||||
{
|
||||
void *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_dset_get_copy_file_udata)
|
||||
|
||||
/* Allocate space for the 'copy file' user data for copying datasets */
|
||||
if(NULL == (ret_value = H5FL_CALLOC(H5D_copy_file_ud_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_dset_get_copy_file_udata() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_dset_free_copy_file_udata
|
||||
*
|
||||
* Purpose: Release the user data needed for copying a dataset's
|
||||
* object header from file to file.
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, November 21, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
H5O_dset_free_copy_file_udata(void *_udata)
|
||||
{
|
||||
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_dset_free_copy_file_udata)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(udata);
|
||||
|
||||
/* Release copy of dataset's datatype, if it was set */
|
||||
if(udata->src_dtype)
|
||||
H5T_close(udata->src_dtype);
|
||||
|
||||
/* Release space for 'copy file' user data */
|
||||
H5FL_FREE(H5D_copy_file_ud_t, udata);
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5O_dset_free_copy_file_udata() */
|
||||
|
@ -198,6 +198,8 @@ extern H5D_dxpl_cache_t H5D_def_dxpl_cache;
|
||||
|
||||
H5_DLL herr_t H5D_alloc_storage (H5F_t *f, hid_t dxpl_id, H5D_t *dset, H5D_time_alloc_t time_alloc,
|
||||
hbool_t update_time, hbool_t full_overwrite);
|
||||
H5_DLL herr_t H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id,
|
||||
void *buf);
|
||||
|
||||
/* Functions that perform serial I/O operations */
|
||||
H5_DLL herr_t H5D_select_fscat (H5D_io_info_t *io_info,
|
||||
@ -233,6 +235,8 @@ H5_DLL ssize_t H5D_contig_writevv(const H5D_io_info_t *io_info,
|
||||
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
|
||||
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
|
||||
const void *buf);
|
||||
H5_DLL herr_t H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
|
||||
H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *src_dtype, hid_t dxpl_id);
|
||||
|
||||
/* Functions that operate on compact dataset storage */
|
||||
H5_DLL ssize_t H5D_compact_readvv(const H5D_io_info_t *io_info,
|
||||
@ -300,7 +304,6 @@ H5_DLL herr_t H5D_mpio_select_write(H5D_io_info_t *io_info,
|
||||
const struct H5S_t *file_space, const struct H5S_t *mem_space,
|
||||
const void *buf);
|
||||
|
||||
|
||||
/* MPI-IO function to read directly from app buffer to file rky980813 */
|
||||
H5_DLL herr_t H5D_mpio_spaces_read(H5D_io_info_t *io_info,
|
||||
size_t nelmts, size_t elmt_size,
|
||||
|
@ -223,7 +223,6 @@ typedef struct H5D_dcpl_cache_t {
|
||||
H5_DLL herr_t H5D_init(void);
|
||||
H5_DLL H5D_t *H5D_open(const H5G_loc_t *loc, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5D_close(H5D_t *dataset);
|
||||
H5_DLL htri_t H5D_isa(H5O_loc_t *loc, hid_t dxpl_id);
|
||||
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
|
||||
H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset);
|
||||
H5_DLL H5T_t *H5D_typeof(const H5D_t *dset);
|
||||
|
41
src/H5G.c
41
src/H5G.c
@ -1524,47 +1524,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5G_create() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_isa
|
||||
*
|
||||
* Purpose: Determines if an object has the requisite messages for being
|
||||
* a group.
|
||||
*
|
||||
* Return: Success: TRUE if the required group messages are
|
||||
* present; FALSE otherwise.
|
||||
*
|
||||
* Failure: FAIL if the existence of certain messages
|
||||
* cannot be determined.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, November 2, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
htri_t
|
||||
H5G_isa(H5O_loc_t *loc, hid_t dxpl_id)
|
||||
{
|
||||
htri_t stab_exists;
|
||||
htri_t linfo_exists;
|
||||
htri_t ret_value;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5G_isa)
|
||||
|
||||
HDassert(loc);
|
||||
|
||||
/* Check for any of the messages that indicate a group */
|
||||
if((stab_exists = H5O_exists(loc, H5O_STAB_ID, 0, dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
if((linfo_exists = H5O_exists(loc, H5O_LINFO_ID, 0, dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
|
||||
ret_value = (stab_exists > 0 || linfo_exists > 0);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5G_isa() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_open
|
||||
|
102
src/H5Goh.c
Normal file
102
src/H5Goh.c
Normal file
@ -0,0 +1,102 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
||||
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
static htri_t H5O_group_isa(H5O_t *loc);
|
||||
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
/* This message derives from H5O object class */
|
||||
const H5O_obj_class_t H5O_OBJ_GROUP[1] = {{
|
||||
H5G_GROUP, /* object type */
|
||||
"group", /* object name, for debugging */
|
||||
NULL, /* get 'copy file' user data */
|
||||
NULL, /* free 'copy file' user data */
|
||||
H5O_group_isa /* "isa" message */
|
||||
}};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_group_isa
|
||||
*
|
||||
* Purpose: Determines if an object has the requisite messages for being
|
||||
* a group.
|
||||
*
|
||||
* Return: Success: TRUE if the required group messages are
|
||||
* present; FALSE otherwise.
|
||||
*
|
||||
* Failure: FAIL if the existence of certain messages
|
||||
* cannot be determined.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, November 2, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
htri_t
|
||||
H5O_group_isa(struct H5O_t *oh)
|
||||
{
|
||||
htri_t stab_exists; /* Whether the 'stab' message is in the object header */
|
||||
htri_t linfo_exists; /* Whether the 'linfo' message is in the object header */
|
||||
htri_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_group_isa)
|
||||
|
||||
HDassert(oh);
|
||||
|
||||
/* Check for any of the messages that indicate a group */
|
||||
if((stab_exists = H5O_exists_oh(oh, H5O_STAB_ID, 0)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
if((linfo_exists = H5O_exists_oh(oh, H5O_LINFO_ID, 0)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
|
||||
ret_value = (stab_exists > 0 || linfo_exists > 0);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_group_isa() */
|
||||
|
@ -94,9 +94,10 @@ typedef struct {
|
||||
unsigned user_path_hidden; /* Whether the user's path is valid */
|
||||
} H5G_name_t;
|
||||
|
||||
/* Forward declarations */
|
||||
/* Forward declarations (for prototypes & struct definitions) */
|
||||
struct H5P_genplist_t;
|
||||
struct H5O_loc_t;
|
||||
struct H5O_t;
|
||||
|
||||
/*
|
||||
* The "location" of an object in a group hierarchy. This points to an object
|
||||
@ -122,7 +123,6 @@ typedef enum {
|
||||
* Library prototypes... These are the ones that other packages routinely
|
||||
* call.
|
||||
*/
|
||||
H5_DLL htri_t H5G_isa(struct H5O_loc_t *loc, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc);
|
||||
H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
|
||||
H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp);
|
||||
|
@ -54,10 +54,10 @@ typedef enum H5G_link_t {
|
||||
*/
|
||||
typedef enum H5G_obj_t {
|
||||
H5G_UNKNOWN = -1, /* Unknown object type */
|
||||
H5G_LINK, /* Object is a symbolic link */
|
||||
H5G_GROUP, /* Object is a group */
|
||||
H5G_DATASET, /* Object is a dataset */
|
||||
H5G_TYPE, /* Object is a named data type */
|
||||
H5G_LINK, /* Object is a symbolic link */
|
||||
H5G_RESERVED_4, /* Reserved for future use */
|
||||
H5G_RESERVED_5, /* Reserved for future use */
|
||||
H5G_RESERVED_6, /* Reserved for future use */
|
||||
|
@ -40,8 +40,8 @@ static void *H5O_attr_copy_file(H5F_t *file_src, void *native_src,
|
||||
static herr_t H5O_attr_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_ATTR[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_ATTR[1] = {{
|
||||
H5O_ATTR_ID, /* message id number */
|
||||
"attribute", /* message name for debugging */
|
||||
sizeof(H5A_t), /* native message size */
|
||||
@ -55,6 +55,7 @@ const H5O_class_t H5O_ATTR[1] = {{
|
||||
H5O_attr_link, /* link method */
|
||||
NULL, /* get share method */
|
||||
NULL, /* set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_attr_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_attr_debug /* debug the message */
|
||||
@ -155,18 +156,18 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
|
||||
H5O_shared_t *shared; /* Shared information */
|
||||
|
||||
/* Get the shared information */
|
||||
if (NULL == (shared = (H5O_SHARED->decode) (f, dxpl_id, p)))
|
||||
if (NULL == (shared = (H5O_MSG_SHARED->decode) (f, dxpl_id, p)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
|
||||
|
||||
/* Get the actual datatype information */
|
||||
if((attr->dt= H5O_shared_read(f, dxpl_id, shared, H5O_DTYPE, NULL))==NULL)
|
||||
if((attr->dt= H5O_shared_read(f, dxpl_id, shared, H5O_MSG_DTYPE, NULL))==NULL)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype");
|
||||
|
||||
/* Free the shared information */
|
||||
H5O_free_real(H5O_SHARED, shared);
|
||||
H5O_free_real(H5O_MSG_SHARED, shared);
|
||||
} /* end if */
|
||||
else {
|
||||
if((attr->dt=(H5O_DTYPE->decode)(f,dxpl_id,p))==NULL)
|
||||
if((attr->dt=(H5O_MSG_DTYPE->decode)(f,dxpl_id,p))==NULL)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype");
|
||||
} /* end else */
|
||||
if(version < H5O_ATTR_VERSION_NEW)
|
||||
@ -178,7 +179,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
|
||||
if (NULL==(attr->ds = H5FL_CALLOC(H5S_t)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
||||
|
||||
if((extent=(H5O_SDSPACE->decode)(f,dxpl_id,p))==NULL)
|
||||
if((extent=(H5O_MSG_SDSPACE->decode)(f,dxpl_id,p))==NULL)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace");
|
||||
|
||||
/* Copy the extent information */
|
||||
@ -311,16 +312,16 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
|
||||
HDmemset(&sh_mesg,0,sizeof(H5O_shared_t));
|
||||
|
||||
/* Get shared message information from datatype */
|
||||
if ((H5O_DTYPE->get_share)(f, attr->dt, &sh_mesg/*out*/)<0)
|
||||
if ((H5O_MSG_DTYPE->get_share)(f, attr->dt, &sh_mesg/*out*/)<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype");
|
||||
|
||||
/* Encode shared message information for datatype */
|
||||
if((H5O_SHARED->encode)(f,p,&sh_mesg)<0)
|
||||
if((H5O_MSG_SHARED->encode)(f,p,&sh_mesg)<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype");
|
||||
} /* end if */
|
||||
else {
|
||||
/* Encode datatype information */
|
||||
if((H5O_DTYPE->encode)(f,p,attr->dt)<0)
|
||||
if((H5O_MSG_DTYPE->encode)(f,p,attr->dt)<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype");
|
||||
} /* end else */
|
||||
if(version < H5O_ATTR_VERSION_NEW) {
|
||||
@ -331,7 +332,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
|
||||
p += attr->dt_size;
|
||||
|
||||
/* encode the attribute dataspace */
|
||||
if((H5O_SDSPACE->encode)(f,p,&(attr->ds->extent))<0)
|
||||
if((H5O_MSG_SDSPACE->encode)(f,p,&(attr->ds->extent))<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace");
|
||||
if(version < H5O_ATTR_VERSION_NEW) {
|
||||
HDmemset(p+attr->ds_size, 0, H5O_ALIGN(attr->ds_size)-attr->ds_size);
|
||||
@ -745,14 +746,14 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in
|
||||
HDmemset(&sh_mesg,0,sizeof(H5O_shared_t));
|
||||
|
||||
/* Get shared message information from datatype */
|
||||
if ((H5O_DTYPE->get_share)(f, mesg->dt, &sh_mesg/*out*/)<0)
|
||||
if ((H5O_MSG_DTYPE->get_share)(f, mesg->dt, &sh_mesg/*out*/)<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't retrieve shared message information");
|
||||
|
||||
debug=H5O_SHARED->debug;
|
||||
debug=H5O_MSG_SHARED->debug;
|
||||
dt_mesg=&sh_mesg;
|
||||
} /* end if */
|
||||
else {
|
||||
debug=H5O_DTYPE->debug;
|
||||
debug=H5O_MSG_DTYPE->debug;
|
||||
dt_mesg=mesg->dt;
|
||||
} /* end else */
|
||||
if(debug)
|
||||
|
@ -45,8 +45,8 @@ static size_t H5O_bogus_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_BOGUS[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{
|
||||
H5O_BOGUS_ID, /*message id number */
|
||||
"bogus", /*message name for debugging */
|
||||
0, /*native message size */
|
||||
@ -60,6 +60,7 @@ const H5O_class_t H5O_BOGUS[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_bogus_debug /*debug the message */
|
||||
|
146
src/H5Ocache.c
146
src/H5Ocache.c
@ -25,9 +25,6 @@
|
||||
|
||||
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
||||
|
||||
/* Interface initialization */
|
||||
#define H5_INTERFACE_INIT_FUNC H5O_cache_init_interface
|
||||
|
||||
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
@ -57,25 +54,87 @@ const H5AC_class_t H5AC_OHDR[1] = {{
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_cache_init_interface
|
||||
* Function: H5O_flush_msgs
|
||||
*
|
||||
* Purpose: Initialize the H5O interface. (Just calls
|
||||
* H5O_init_iterface currently).
|
||||
* Purpose: Flushes messages for object header.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, September 28, 2005
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Nov 21 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_cache_init_interface(void)
|
||||
herr_t
|
||||
H5O_flush_msgs(H5F_t *f, H5O_t *oh)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_init_interface)
|
||||
uint8_t *p; /* Temporary pointer to encode with */
|
||||
int id; /* ID of message to encode */
|
||||
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
|
||||
herr_t (*encode)(H5F_t*, uint8_t*, const void*) = NULL;
|
||||
unsigned u; /* Local index variable */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_LEAVE_NOAPI(H5O_init())
|
||||
} /* end H5O_cache_init_interface() */
|
||||
FUNC_ENTER_NOAPI(H5O_flush_msgs, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
|
||||
/* Encode any dirty messages */
|
||||
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
|
||||
if(curr_msg->dirty) {
|
||||
p = curr_msg->raw - H5O_SIZEOF_MSGHDR(f);
|
||||
|
||||
id = curr_msg->type->id;
|
||||
UINT16ENCODE(p, id);
|
||||
HDassert(curr_msg->raw_size < H5O_MAX_SIZE);
|
||||
UINT16ENCODE(p, curr_msg->raw_size);
|
||||
*p++ = curr_msg->flags;
|
||||
*p++ = 0; /*reserved*/
|
||||
*p++ = 0; /*reserved*/
|
||||
*p++ = 0; /*reserved*/
|
||||
|
||||
if(curr_msg->native) {
|
||||
HDassert(curr_msg->type->encode);
|
||||
|
||||
/* allocate file space for chunks that have none yet */
|
||||
if(H5O_CONT_ID == id && !H5F_addr_defined(((H5O_cont_t *)(curr_msg->native))->addr))
|
||||
/* We now allocate disk space on insertion, instead
|
||||
* of on flush from the cache, so this case is now an
|
||||
* error. -- JRM
|
||||
*/
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "File space for message not allocated!?!")
|
||||
|
||||
/*
|
||||
* Encode the message. If the message is shared then we
|
||||
* encode a Shared Object message instead of the object
|
||||
* which is being shared.
|
||||
*/
|
||||
HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image);
|
||||
HDassert(curr_msg->raw_size == H5O_ALIGN (curr_msg->raw_size));
|
||||
HDassert(curr_msg->raw + curr_msg->raw_size <=
|
||||
oh->chunk[curr_msg->chunkno].image + oh->chunk[curr_msg->chunkno].size);
|
||||
if(curr_msg->flags & H5O_FLAG_SHARED)
|
||||
encode = H5O_MSG_SHARED->encode;
|
||||
else
|
||||
encode = curr_msg->type->encode;
|
||||
if((encode)(f, curr_msg->raw, curr_msg->native) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
|
||||
} /* end if */
|
||||
curr_msg->dirty = FALSE;
|
||||
oh->chunk[curr_msg->chunkno].dirty = TRUE;
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
|
||||
/* Sanity check for the correct # of messages in object header */
|
||||
if(oh->nmesgs != u)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "corrupt object header - too few messages")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_flush_msgs() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -191,7 +250,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
|
||||
|
||||
/* Skip header messages we don't know about */
|
||||
/* (Usually from future versions of the library */
|
||||
if(id >= NELMTS(message_type_g) || NULL == message_type_g[id]) {
|
||||
if(id >= NELMTS(H5O_msg_class_g) || NULL == H5O_msg_class_g[id]) {
|
||||
skipped_msgs++;
|
||||
continue;
|
||||
} /* end if */
|
||||
@ -208,7 +267,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
|
||||
if (oh->nmesgs >= nmesgs)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header - too many messages");
|
||||
mesgno = oh->nmesgs++;
|
||||
oh->mesg[mesgno].type = message_type_g[id];
|
||||
oh->mesg[mesgno].type = H5O_msg_class_g[id];
|
||||
oh->mesg[mesgno].dirty = FALSE;
|
||||
oh->mesg[mesgno].flags = flags;
|
||||
oh->mesg[mesgno].native = NULL;
|
||||
@ -225,7 +284,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
|
||||
if(H5O_CONT_ID == oh->mesg[curmesg].type->id) {
|
||||
H5O_cont_t *cont;
|
||||
|
||||
cont = (H5O_CONT->decode) (f, dxpl_id, oh->mesg[curmesg].raw);
|
||||
cont = (H5O_MSG_CONT->decode) (f, dxpl_id, oh->mesg[curmesg].raw);
|
||||
oh->mesg[curmesg].native = cont;
|
||||
chunk_addr = cont->addr;
|
||||
chunk_size = cont->size;
|
||||
@ -268,10 +327,7 @@ static herr_t
|
||||
H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh)
|
||||
{
|
||||
uint8_t buf[16], *p;
|
||||
int id;
|
||||
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
|
||||
herr_t (*encode)(H5F_t*, uint8_t*, const void*) = NULL;
|
||||
unsigned combine = 0; /* Whether to combine the object header prefix & the first chunk */
|
||||
hbool_t combine = FALSE; /* Whether to combine the object header prefix & the first chunk */
|
||||
unsigned u; /* Local index variable */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
@ -285,54 +341,8 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh)
|
||||
/* flush */
|
||||
if(oh->cache_info.is_dirty) {
|
||||
/* Encode any dirty messages */
|
||||
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
|
||||
if(curr_msg->dirty) {
|
||||
p = curr_msg->raw - H5O_SIZEOF_MSGHDR(f);
|
||||
|
||||
id = curr_msg->type->id;
|
||||
UINT16ENCODE(p, id);
|
||||
HDassert(curr_msg->raw_size < H5O_MAX_SIZE);
|
||||
UINT16ENCODE(p, curr_msg->raw_size);
|
||||
*p++ = curr_msg->flags;
|
||||
*p++ = 0; /*reserved*/
|
||||
*p++ = 0; /*reserved*/
|
||||
*p++ = 0; /*reserved*/
|
||||
|
||||
if(curr_msg->native) {
|
||||
HDassert(curr_msg->type->encode);
|
||||
|
||||
/* allocate file space for chunks that have none yet */
|
||||
if(H5O_CONT_ID == curr_msg->type->id && !H5F_addr_defined(((H5O_cont_t *)(curr_msg->native))->addr))
|
||||
/* We now allocate disk space on insertion, instead
|
||||
* of on flush from the cache, so this case is now an
|
||||
* error. -- JRM
|
||||
*/
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "File space for message not allocated!?!")
|
||||
|
||||
/*
|
||||
* Encode the message. If the message is shared then we
|
||||
* encode a Shared Object message instead of the object
|
||||
* which is being shared.
|
||||
*/
|
||||
HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image);
|
||||
HDassert(curr_msg->raw_size == H5O_ALIGN (curr_msg->raw_size));
|
||||
HDassert(curr_msg->raw + curr_msg->raw_size <=
|
||||
oh->chunk[curr_msg->chunkno].image + oh->chunk[curr_msg->chunkno].size);
|
||||
if(curr_msg->flags & H5O_FLAG_SHARED)
|
||||
encode = H5O_SHARED->encode;
|
||||
else
|
||||
encode = curr_msg->type->encode;
|
||||
if((encode)(f, curr_msg->raw, curr_msg->native) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
|
||||
} /* end if */
|
||||
curr_msg->dirty = FALSE;
|
||||
oh->chunk[curr_msg->chunkno].dirty = TRUE;
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
|
||||
/* Sanity check for the correct # of messages in object header */
|
||||
if(oh->nmesgs != u)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "corrupt object header - too few messages")
|
||||
if(H5O_flush_msgs(f, oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages")
|
||||
|
||||
/* Encode header prefix */
|
||||
p = buf;
|
||||
@ -359,7 +369,7 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh)
|
||||
|
||||
/* Check if we can combine the object header prefix & the first chunk into one I/O operation */
|
||||
if(oh->chunk[0].dirty && (addr + H5O_SIZEOF_HDR(f)) == oh->chunk[0].addr) {
|
||||
combine = 1;
|
||||
combine = TRUE;
|
||||
} /* end if */
|
||||
else {
|
||||
if(H5F_block_write(f, H5FD_MEM_OHDR, addr, (size_t)H5O_SIZEOF_HDR(f), dxpl_id, buf) < 0)
|
||||
|
@ -46,8 +46,8 @@ static void *H5O_cont_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
static herr_t H5O_cont_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_CONT[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_CONT[1] = {{
|
||||
H5O_CONT_ID, /*message id number */
|
||||
"hdr continuation", /*message name for debugging */
|
||||
sizeof(H5O_cont_t), /*native message size */
|
||||
@ -61,6 +61,7 @@ const H5O_class_t H5O_CONT[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_cont_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_cont_debug /*debugging */
|
||||
|
@ -35,13 +35,15 @@ static herr_t H5O_dtype_get_share (H5F_t *f, const void *_mesg,
|
||||
H5O_shared_t *sh);
|
||||
static herr_t H5O_dtype_set_share (H5F_t *f, void *_mesg,
|
||||
const H5O_shared_t *sh);
|
||||
static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
void *_udata);
|
||||
static herr_t H5O_dtype_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_DTYPE[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{
|
||||
H5O_DTYPE_ID, /* message id number */
|
||||
"data_type", /* message name for debugging */
|
||||
"datatype", /* message name for debugging */
|
||||
sizeof(H5T_t), /* native message size */
|
||||
H5O_dtype_decode, /* decode message */
|
||||
H5O_dtype_encode, /* encode message */
|
||||
@ -53,8 +55,9 @@ const H5O_class_t H5O_DTYPE[1] = {{
|
||||
NULL, /* link method */
|
||||
H5O_dtype_get_share, /* get share method */
|
||||
H5O_dtype_set_share, /* set share method */
|
||||
H5O_dtype_pre_copy_file, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_dtype_debug /* debug the message */
|
||||
}};
|
||||
|
||||
@ -1159,6 +1162,56 @@ H5O_dtype_set_share(H5F_t UNUSED *f, void *_mesg/*in,out*/,
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O_dtype_set_share() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_dtype_pre_copy_file
|
||||
*
|
||||
* Purpose: Perform any necessary actions before copying message between
|
||||
* files
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
*
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* November 21, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_dtype_pre_copy_file(H5F_t *file_src, void *mesg_src, void *_udata)
|
||||
{
|
||||
H5T_t *dt_src = (H5T_t *)mesg_src; /* Source datatype */
|
||||
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_pre_copy_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(file_src);
|
||||
HDassert(dt_src);
|
||||
|
||||
/* If the user data is non-NULL, assume we are copying a dataset
|
||||
* and check if we need to make a copy of the datatype for later in
|
||||
* the object copying process. (We currently only need to make a copy
|
||||
* of the datatype if it's a vlen datatype)
|
||||
*/
|
||||
if(udata) {
|
||||
if(H5T_detect_class(dt_src, H5T_VLEN) > 0) {
|
||||
/* Create a memory copy of the variable-length datatype */
|
||||
if(NULL == (udata->src_dtype = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
|
||||
|
||||
/* Set the location of the source datatype */
|
||||
if(H5T_set_loc(udata->src_dtype, file_src, H5T_LOC_DISK) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_dtype_pre_copy_file() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -1475,3 +1528,4 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED);
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,8 @@ static void *H5O_efl_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
static herr_t H5O_efl_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_EFL[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_EFL[1] = {{
|
||||
H5O_EFL_ID, /*message id number */
|
||||
"external file list", /*message name for debugging */
|
||||
sizeof(H5O_efl_t), /*native message size */
|
||||
@ -53,6 +53,7 @@ const H5O_class_t H5O_EFL[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_efl_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_efl_debug /*debug the message */
|
||||
|
@ -48,8 +48,8 @@ static herr_t H5O_fill_free(void *_mesg);
|
||||
static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O, for old fill value before version 1.5 */
|
||||
const H5O_class_t H5O_FILL[1] = {{
|
||||
/* This message derives from H5O message class, for old fill value before version 1.5 */
|
||||
const H5O_msg_class_t H5O_MSG_FILL[1] = {{
|
||||
H5O_FILL_ID, /*message id number */
|
||||
"fill", /*message name for debugging */
|
||||
sizeof(H5O_fill_t), /*native message size */
|
||||
@ -63,13 +63,14 @@ const H5O_class_t H5O_FILL[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_fill_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* This message derives from H5O, for new fill value after version 1.4 */
|
||||
const H5O_class_t H5O_FILL_NEW[1] = {{
|
||||
/* This message derives from H5O message class, for new fill value after version 1.4 */
|
||||
const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
|
||||
H5O_FILL_NEW_ID, /*message id number */
|
||||
"fill_new", /*message name for debugging */
|
||||
sizeof(H5O_fill_new_t), /*native message size */
|
||||
@ -83,6 +84,7 @@ const H5O_class_t H5O_FILL_NEW[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_fill_new_debug /*debug the message */
|
||||
|
@ -42,8 +42,8 @@ static herr_t H5O_ginfo_free(void *_mesg);
|
||||
static herr_t H5O_ginfo_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_GINFO[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
|
||||
H5O_GINFO_ID, /*message id number */
|
||||
"ginfo", /*message name for debugging */
|
||||
sizeof(H5O_ginfo_t), /*native message size */
|
||||
@ -57,6 +57,7 @@ const H5O_class_t H5O_GINFO[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_ginfo_debug /*debug the message */
|
||||
|
@ -44,8 +44,8 @@ static void *H5O_layout_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
static herr_t H5O_layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_LAYOUT[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{
|
||||
H5O_LAYOUT_ID, /*message id number */
|
||||
"layout", /*message name for debugging */
|
||||
sizeof(H5O_layout_t), /*native message size */
|
||||
@ -59,6 +59,7 @@ const H5O_class_t H5O_LAYOUT[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_layout_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_layout_debug /*debug the message */
|
||||
@ -436,7 +437,7 @@ H5O_layout_meta_size(const H5F_t *f, const void *_mesg)
|
||||
break;
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class");
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class")
|
||||
} /* end switch */
|
||||
|
||||
done:
|
||||
@ -606,7 +607,7 @@ done:
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_layout_copy_file
|
||||
*
|
||||
* Purpose: Copies a data layout message from _MESG to _DEST in file
|
||||
* Purpose: Copies a message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
@ -621,8 +622,9 @@ done:
|
||||
*/
|
||||
static void *
|
||||
H5O_layout_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t UNUSED *map_list, void UNUSED *_udata)
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t UNUSED *map_list, void *_udata)
|
||||
{
|
||||
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
|
||||
H5O_layout_t *layout_src = (H5O_layout_t *) mesg_src;
|
||||
H5O_layout_t *layout_dst = NULL;
|
||||
void *ret_value; /* Return value */
|
||||
@ -646,6 +648,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
if(layout_src->u.compact.buf) {
|
||||
if(NULL == (layout_dst->u.compact.buf = H5MM_malloc(layout_src->u.compact.size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
|
||||
HDassert(!udata->src_dtype);
|
||||
HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size);
|
||||
layout_dst->u.compact.dirty = TRUE;
|
||||
}
|
||||
@ -653,38 +656,18 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
|
||||
case H5D_CONTIGUOUS:
|
||||
if(H5F_addr_defined(layout_src->u.contig.addr)) {
|
||||
haddr_t addr_src, addr_dst;
|
||||
unsigned DRAW_BUF_SIZE = 4096;
|
||||
uint8_t buf[4096];
|
||||
size_t nbytes=0, total_nbytes=0;
|
||||
/* create contig layout */
|
||||
if(H5D_contig_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy contiguous storage")
|
||||
|
||||
/* create layout */
|
||||
if(H5D_contig_create (file_dst, dxpl_id, layout_dst)<0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to initialize contiguous storage")
|
||||
|
||||
/* copy raw data*/
|
||||
nbytes = total_nbytes = 0;
|
||||
while(total_nbytes < layout_src->u.contig.size) {
|
||||
addr_src = layout_src->u.contig.addr + total_nbytes;
|
||||
addr_dst = layout_dst->u.contig.addr + total_nbytes;
|
||||
|
||||
nbytes = layout_src->u.contig.size-total_nbytes;
|
||||
if(nbytes > DRAW_BUF_SIZE)
|
||||
nbytes = DRAW_BUF_SIZE;
|
||||
total_nbytes += nbytes;
|
||||
|
||||
if(H5F_block_read(file_src, H5FD_MEM_DRAW, addr_src, nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read raw data")
|
||||
|
||||
if(H5F_block_write(file_dst, H5FD_MEM_DRAW, addr_dst, nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to write raw data")
|
||||
}
|
||||
/* Freed by copy routine */
|
||||
udata->src_dtype = NULL;
|
||||
} /* if ( H5F_addr_defined(layout_src->u.contig.addr)) */
|
||||
break;
|
||||
|
||||
case H5D_CHUNKED:
|
||||
if(H5F_addr_defined(layout_src->u.chunk.addr)) {
|
||||
|
||||
HDassert(!udata->src_dtype);
|
||||
/* layout is not created in the destination file, undef btree address */
|
||||
layout_dst->u.chunk.addr = HADDR_UNDEF;
|
||||
|
||||
@ -707,7 +690,7 @@ done:
|
||||
H5FL_FREE(H5O_layout_t, layout_dst);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
} /* end H5O_layout_copy_file() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
@ -42,8 +42,8 @@ static herr_t H5O_linfo_free(void *_mesg);
|
||||
static herr_t H5O_linfo_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_LINFO[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
|
||||
H5O_LINFO_ID, /*message id number */
|
||||
"linfo", /*message name for debugging */
|
||||
sizeof(H5O_linfo_t), /*native message size */
|
||||
@ -57,6 +57,7 @@ const H5O_class_t H5O_LINFO[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_linfo_debug /*debug the message */
|
||||
|
@ -49,8 +49,8 @@ static herr_t H5O_link_post_copy_file(H5F_t *file_src, const void *mesg_src,
|
||||
static herr_t H5O_link_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_LINK[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_LINK[1] = {{
|
||||
H5O_LINK_ID, /*message id number */
|
||||
"link", /*message name for debugging */
|
||||
sizeof(H5O_link_t), /*native message size */
|
||||
@ -64,6 +64,7 @@ const H5O_class_t H5O_LINK[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_link_copy_file, /* copy native value to file */
|
||||
H5O_link_post_copy_file, /* post copy native value to file */
|
||||
H5O_link_debug /*debug the message */
|
||||
|
@ -45,8 +45,8 @@ static herr_t H5O_mtime_free(void *_mesg);
|
||||
static herr_t H5O_mtime_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_MTIME[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_MTIME[1] = {{
|
||||
H5O_MTIME_ID, /*message id number */
|
||||
"mtime", /*message name for debugging */
|
||||
sizeof(time_t), /*native message size */
|
||||
@ -60,14 +60,15 @@ const H5O_class_t H5O_MTIME[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_mtime_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* This message derives from H5O */
|
||||
/* This message derives from H5O message class */
|
||||
/* (Only encode, decode & size routines are different from old mtime routines) */
|
||||
const H5O_class_t H5O_MTIME_NEW[1] = {{
|
||||
const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{
|
||||
H5O_MTIME_NEW_ID, /*message id number */
|
||||
"mtime_new", /*message name for debugging */
|
||||
sizeof(time_t), /*native message size */
|
||||
@ -81,6 +82,7 @@ const H5O_class_t H5O_MTIME_NEW[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_mtime_debug /*debug the message */
|
||||
|
@ -42,8 +42,8 @@ static herr_t H5O_name_reset(void *_mesg);
|
||||
static herr_t H5O_name_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_NAME[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_NAME[1] = {{
|
||||
H5O_NAME_ID, /*message id number */
|
||||
"name", /*message name for debugging */
|
||||
sizeof(H5O_name_t), /*native message size */
|
||||
@ -57,6 +57,7 @@ const H5O_class_t H5O_NAME[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_name_debug /*debug the message */
|
||||
|
@ -31,8 +31,8 @@
|
||||
#include "H5Opkg.h" /* Object header functions */
|
||||
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_NULL[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_NULL[1] = {{
|
||||
H5O_NULL_ID, /*message id number */
|
||||
"null", /*message name for debugging */
|
||||
0, /*native message size */
|
||||
@ -46,6 +46,7 @@ const H5O_class_t H5O_NULL[1] = {{
|
||||
NULL, /*no link method */
|
||||
NULL, /*no get share method */
|
||||
NULL, /*no set share method */
|
||||
NULL, /*no pre copy native value to file */
|
||||
NULL, /*no copy native value to file */
|
||||
NULL, /*no post copy native value to file */
|
||||
NULL /*no debug method */
|
||||
|
182
src/H5Opkg.h
182
src/H5Opkg.h
@ -59,8 +59,8 @@
|
||||
2 + /*sizeof message data */ \
|
||||
4) /*reserved */
|
||||
|
||||
typedef struct H5O_class_t {
|
||||
int id; /*message type ID on disk */
|
||||
struct H5O_msg_class_t {
|
||||
unsigned id; /*message type ID on disk */
|
||||
const char *name; /*for debugging */
|
||||
size_t native_size; /*size of native message */
|
||||
void *(*decode)(H5F_t*, hid_t, const uint8_t*);
|
||||
@ -73,13 +73,14 @@ typedef struct H5O_class_t {
|
||||
herr_t (*link)(H5F_t *, hid_t, const void *); /* Increment any links in file reference by this message */
|
||||
herr_t (*get_share)(H5F_t*, const void*, struct H5O_shared_t*); /* Get shared information */
|
||||
herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); /* Set shared information */
|
||||
herr_t (*pre_copy_file)(H5F_t *, void *, void *); /*"pre copy" action when copying native value to file */
|
||||
void *(*copy_file)(H5F_t *, void *, H5F_t *, hid_t, H5SL_t *, void *); /*copy native value to file */
|
||||
herr_t (*post_copy_file)(H5F_t *, const void *, H5O_loc_t *, void *, hbool_t *, hid_t, H5SL_t *); /*"post copy" action when copying native value to file */
|
||||
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int);
|
||||
} H5O_class_t;
|
||||
};
|
||||
|
||||
typedef struct H5O_mesg_t {
|
||||
const H5O_class_t *type; /*type of message */
|
||||
const H5O_msg_class_t *type; /*type of message */
|
||||
hbool_t dirty; /*raw out of date wrt native */
|
||||
uint8_t flags; /*message flags */
|
||||
unsigned chunkno; /*chunk number for this mesg */
|
||||
@ -95,24 +96,41 @@ typedef struct H5O_chunk_t {
|
||||
uint8_t *image; /*image of file */
|
||||
} H5O_chunk_t;
|
||||
|
||||
typedef struct H5O_t {
|
||||
struct H5O_t {
|
||||
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
|
||||
/* first field in structure */
|
||||
int version; /*version number */
|
||||
unsigned version; /*version number */
|
||||
int nlink; /*link count */
|
||||
unsigned nmesgs; /*number of messages */
|
||||
unsigned alloc_nmesgs; /*number of message slots */
|
||||
size_t nmesgs; /*number of messages */
|
||||
size_t alloc_nmesgs; /*number of message slots */
|
||||
H5O_mesg_t *mesg; /*array of messages */
|
||||
unsigned nchunks; /*number of chunks */
|
||||
unsigned alloc_nchunks; /*chunks allocated */
|
||||
size_t nchunks; /*number of chunks */
|
||||
size_t alloc_nchunks; /*chunks allocated */
|
||||
H5O_chunk_t *chunk; /*array of chunks */
|
||||
} H5O_t;
|
||||
};
|
||||
|
||||
/* Callback information for copying dataset */
|
||||
typedef struct {
|
||||
H5T_t *src_dtype; /* Copy of datatype for dataset */
|
||||
} H5D_copy_file_ud_t;
|
||||
|
||||
/* Class for types of objects in file */
|
||||
typedef struct H5O_obj_class_t {
|
||||
H5G_obj_t type; /*object type on disk */
|
||||
const char *name; /*for debugging */
|
||||
void *(*get_copy_file_udata)(void); /*retrieve user data for 'copy file' operation */
|
||||
void (*free_copy_file_udata)(void *); /*free user data for 'copy file' operation */
|
||||
htri_t (*isa)(H5O_t *); /*if a header matches an object class */
|
||||
} H5O_obj_class_t;
|
||||
|
||||
/* H5O inherits cache-like properties from H5AC */
|
||||
H5_DLLVAR const H5AC_class_t H5AC_OHDR[1];
|
||||
|
||||
/* ID to type mapping */
|
||||
H5_DLLVAR const H5O_class_t *const message_type_g[19];
|
||||
/* Header message ID to class mapping */
|
||||
H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[19];
|
||||
|
||||
/* Header object ID to class mapping */
|
||||
H5_DLLVAR const H5O_obj_class_t *const H5O_obj_class_g[3];
|
||||
|
||||
/* Declare external the free list for H5O_t's */
|
||||
H5FL_EXTERN(H5O_t);
|
||||
@ -127,126 +145,114 @@ H5FL_SEQ_EXTERN(H5O_chunk_t);
|
||||
H5FL_BLK_EXTERN(chunk_image);
|
||||
|
||||
/*
|
||||
* Null Message. (0x0000)
|
||||
* Object header messages
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_NULL[1];
|
||||
|
||||
/*
|
||||
* Simple Dataspace Message. (0x0001)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_SDSPACE[1];
|
||||
/* Null Message. (0x0000) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_NULL[1];
|
||||
|
||||
/*
|
||||
* Link Information Message. (0x0002)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_LINFO[1];
|
||||
/* Simple Dataspace Message. (0x0001) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_SDSPACE[1];
|
||||
|
||||
/*
|
||||
* Datatype Message. (0x0003)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_DTYPE[1];
|
||||
/* Link Information Message. (0x0002) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_LINFO[1];
|
||||
|
||||
/*
|
||||
* Old Fill Value Message. (0x0004)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_FILL[1];
|
||||
/* Datatype Message. (0x0003) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_DTYPE[1];
|
||||
|
||||
/*
|
||||
* New Fill Value Message. (0x0005)
|
||||
*
|
||||
/* Old Fill Value Message. (0x0004) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_FILL[1];
|
||||
|
||||
/* New Fill Value Message. (0x0005) */
|
||||
/*
|
||||
* The new fill value message is fill value plus
|
||||
* space allocation time and fill value writing time and whether fill
|
||||
* value is defined.
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_FILL_NEW[1];
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_FILL_NEW[1];
|
||||
|
||||
/*
|
||||
* Link Message. (0x0006)
|
||||
*
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_LINK[1];
|
||||
/* Link Message. (0x0006) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_LINK[1];
|
||||
|
||||
/*
|
||||
* External File List Message. (0x0007)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_EFL[1];
|
||||
/* External File List Message. (0x0007) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_EFL[1];
|
||||
|
||||
/*
|
||||
* Data Layout Message. (0x0008)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_LAYOUT[1];
|
||||
/* Data Layout Message. (0x0008) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_LAYOUT[1];
|
||||
|
||||
#ifdef H5O_ENABLE_BOGUS
|
||||
/* "Bogus" Message. (0x0009) */
|
||||
/*
|
||||
* "Bogus" Message. (0x0009)
|
||||
* Used for debugging - should never be found in valid HDF5 file.
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_BOGUS[1];
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS[1];
|
||||
#endif /* H5O_ENABLE_BOGUS */
|
||||
|
||||
/*
|
||||
* Group Information Message. (0x000a)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_GINFO[1];
|
||||
/* Group Information Message. (0x000a) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_GINFO[1];
|
||||
|
||||
/*
|
||||
* Filter pipeline message. (0x000b)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_PLINE[1];
|
||||
/* Filter pipeline message. (0x000b) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_PLINE[1];
|
||||
|
||||
/*
|
||||
* Attribute Message. (0x000c)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_ATTR[1];
|
||||
/* Attribute Message. (0x000c) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_ATTR[1];
|
||||
|
||||
/*
|
||||
* Object name message. (0x000d)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_NAME[1];
|
||||
/* Object name message. (0x000d) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_NAME[1];
|
||||
|
||||
/* Modification Time Message. (0x000e) */
|
||||
/*
|
||||
* Modification Time Message. (0x000e)
|
||||
*
|
||||
* The message is just a `time_t'.
|
||||
* (See also the "new" modification time message)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_MTIME[1];
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_MTIME[1];
|
||||
|
||||
/*
|
||||
* Shared Object Message. (0x000f)
|
||||
*
|
||||
/* Shared Object Message. (0x000f) */
|
||||
/*
|
||||
* This message ID never really appears in an object
|
||||
* header. Instead, bit 2 of the `Flags' field will be set and the ID field
|
||||
* will be the ID of the pointed-to message.
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_SHARED[1];
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_SHARED[1];
|
||||
|
||||
/*
|
||||
* Object Header Continuation Message. (0x0010)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_CONT[1];
|
||||
/* Object Header Continuation Message. (0x0010) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_CONT[1];
|
||||
|
||||
/*
|
||||
* Symbol Table Message. (0x0011)
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_STAB[1];
|
||||
/* Symbol Table Message. (0x0011) */
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_STAB[1];
|
||||
|
||||
/*
|
||||
* New Modification Time Message. (0x0012)
|
||||
*
|
||||
/* New Modification Time Message. (0x0012) */
|
||||
/*
|
||||
* The message is just a `time_t'.
|
||||
*/
|
||||
H5_DLLVAR const H5O_class_t H5O_MTIME_NEW[1];
|
||||
H5_DLLVAR const H5O_msg_class_t H5O_MSG_MTIME_NEW[1];
|
||||
|
||||
|
||||
/*
|
||||
* Object header "object" types
|
||||
*/
|
||||
|
||||
/* Group Object. (H5G_GROUP - 0) */
|
||||
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_GROUP[1];
|
||||
|
||||
/* Dataset Object. (H5G_DATASET - 1) */
|
||||
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
|
||||
|
||||
/* Datatype Object. (H5G_TYPE - 2) */
|
||||
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
|
||||
|
||||
|
||||
/* Package-local function prototypes */
|
||||
H5_DLL void * H5O_read_real(const H5O_loc_t *loc, const H5O_class_t *type,
|
||||
H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
|
||||
H5_DLL void * H5O_read_real(const H5O_loc_t *loc, const H5O_msg_class_t *type,
|
||||
int sequence, void *mesg, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_free_mesg(H5O_mesg_t *mesg);
|
||||
H5_DLL void * H5O_free_real(const H5O_class_t *type, void *mesg);
|
||||
H5_DLL void * H5O_free_real(const H5O_msg_class_t *type, void *mesg);
|
||||
H5_DLL herr_t H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth);
|
||||
|
||||
/* Shared object operators */
|
||||
H5_DLL void * H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_shared_t *shared,
|
||||
const H5O_class_t *type, void *mesg);
|
||||
const H5O_msg_class_t *type, void *mesg);
|
||||
|
||||
/* Useful metadata cache callbacks */
|
||||
H5_DLL herr_t H5O_dest(H5F_t *f, H5O_t *oh);
|
||||
|
@ -39,8 +39,8 @@ static herr_t H5O_pline_free (void *_mesg);
|
||||
static herr_t H5O_pline_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_PLINE[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
|
||||
H5O_PLINE_ID, /* message id number */
|
||||
"filter pipeline", /* message name for debugging */
|
||||
sizeof(H5O_pline_t), /* native message size */
|
||||
@ -54,6 +54,7 @@ const H5O_class_t H5O_PLINE[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /* get share method */
|
||||
NULL, /* set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_pline_debug /* debug the message */
|
||||
|
@ -39,6 +39,10 @@
|
||||
#include "H5Tprivate.h" /* Datatype functions */
|
||||
#include "H5Zprivate.h" /* I/O pipeline filters */
|
||||
|
||||
/* Forward references of package typedefs */
|
||||
typedef struct H5O_msg_class_t H5O_msg_class_t;
|
||||
typedef struct H5O_t H5O_t;
|
||||
|
||||
/* Object header macros */
|
||||
#define H5O_MIN_SIZE H5O_ALIGN(32) /*min obj header data size */
|
||||
#define H5O_MAX_SIZE 65536 /*max obj header data size */
|
||||
@ -291,6 +295,7 @@ typedef enum {
|
||||
|
||||
/* Forward declarations for prototype arguments */
|
||||
struct H5SL_t;
|
||||
struct H5O_t;
|
||||
|
||||
/* General message operators */
|
||||
H5_DLL herr_t H5O_init(void);
|
||||
@ -302,6 +307,7 @@ H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id);
|
||||
H5_DLL int H5O_count(H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id);
|
||||
H5_DLL htri_t H5O_exists(H5O_loc_t *loc, unsigned type_id, int sequence,
|
||||
hid_t dxpl_id);
|
||||
H5_DLL htri_t H5O_exists_oh(struct H5O_t *oh, unsigned type_id, int sequence);
|
||||
H5_DLL void *H5O_read(const H5O_loc_t *loc, unsigned type_id, int sequence,
|
||||
void *mesg, hid_t dxpl_id);
|
||||
H5_DLL int H5O_modify(H5O_loc_t *loc, unsigned type_id,
|
||||
@ -340,7 +346,7 @@ H5_DLL herr_t H5O_copy_header(const H5O_loc_t *oloc_src,
|
||||
H5O_loc_t *oloc_dst /*out */, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src,
|
||||
H5O_loc_t *oloc_dst /*out */, hid_t dxpl_id, struct H5SL_t *map_list);
|
||||
H5_DLL herr_t H5O_debug_id(hid_t type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth);
|
||||
H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth);
|
||||
H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
|
||||
int fwidth);
|
||||
|
||||
|
@ -34,10 +34,10 @@ static herr_t H5O_sdspace_free (void *_mesg);
|
||||
static herr_t H5O_sdspace_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_SDSPACE[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_SDSPACE[1] = {{
|
||||
H5O_SDSPACE_ID, /* message id number */
|
||||
"simple_dspace", /* message name for debugging */
|
||||
"dataspace", /* message name for debugging */
|
||||
sizeof(H5S_extent_t), /* native message size */
|
||||
H5O_sdspace_decode, /* decode message */
|
||||
H5O_sdspace_encode, /* encode message */
|
||||
@ -49,6 +49,7 @@ const H5O_class_t H5O_SDSPACE[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /* get share method */
|
||||
NULL, /* set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_sdspace_debug /* debug the message */
|
||||
|
@ -46,8 +46,8 @@ static void *H5O_shared_copy_file(H5F_t *file_src, void *native_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_shared_debug (H5F_t*, hid_t dxpl_id, const void*, FILE*, int, int);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_SHARED[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_SHARED[1] = {{
|
||||
H5O_SHARED_ID, /*message id number */
|
||||
"shared", /*message name for debugging */
|
||||
sizeof(H5O_shared_t), /*native message size */
|
||||
@ -61,6 +61,7 @@ const H5O_class_t H5O_SHARED[1] = {{
|
||||
H5O_shared_link, /*link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_shared_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_shared_debug /*debug method */
|
||||
@ -95,7 +96,7 @@ const H5O_class_t H5O_SHARED[1] = {{
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void *
|
||||
H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_shared_t *shared, const H5O_class_t *type, void *mesg)
|
||||
H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_shared_t *shared, const H5O_msg_class_t *type, void *mesg)
|
||||
{
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
||||
|
@ -50,8 +50,8 @@ static herr_t H5O_stab_post_copy_file(H5F_t *file_src, const void *mesg_src,
|
||||
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_STAB[1] = {{
|
||||
/* This message derives from H5O message class */
|
||||
const H5O_msg_class_t H5O_MSG_STAB[1] = {{
|
||||
H5O_STAB_ID, /*message id number */
|
||||
"stab", /*message name for debugging */
|
||||
sizeof(H5O_stab_t), /*native message size */
|
||||
@ -65,6 +65,7 @@ const H5O_class_t H5O_STAB[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_stab_copy_file, /* copy native value to file */
|
||||
H5O_stab_post_copy_file, /* post copy native value to file */
|
||||
H5O_stab_debug /*debug the message */
|
||||
|
34
src/H5T.c
34
src/H5T.c
@ -2963,40 +2963,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T_isa
|
||||
*
|
||||
* Purpose: Determines if an object has the requisite messages for being
|
||||
* a datatype.
|
||||
*
|
||||
* Return: Success: TRUE if the required data type messages are
|
||||
* present; FALSE otherwise.
|
||||
*
|
||||
* Failure: FAIL if the existence of certain messages
|
||||
* cannot be determined.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, November 2, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
htri_t
|
||||
H5T_isa(H5O_loc_t *loc, hid_t dxpl_id)
|
||||
{
|
||||
htri_t ret_value;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5T_isa, FAIL)
|
||||
|
||||
HDassert(loc);
|
||||
|
||||
if((ret_value = H5O_exists(loc, H5O_DTYPE_ID, 0, dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5T_isa() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T_copy
|
||||
|
95
src/H5Toh.c
Normal file
95
src/H5Toh.c
Normal file
@ -0,0 +1,95 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
||||
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
static htri_t H5O_dtype_isa(H5O_t *loc);
|
||||
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
/* This message derives from H5O object class */
|
||||
const H5O_obj_class_t H5O_OBJ_DATATYPE[1] = {{
|
||||
H5G_TYPE, /* object type */
|
||||
"named datatype", /* object name, for debugging */
|
||||
NULL, /* get 'copy file' user data */
|
||||
NULL, /* free 'copy file' user data */
|
||||
H5O_dtype_isa /* "isa" */
|
||||
}};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_dtype_isa
|
||||
*
|
||||
* Purpose: Determines if an object has the requisite messages for being
|
||||
* a datatype.
|
||||
*
|
||||
* Return: Success: TRUE if the required data type messages are
|
||||
* present; FALSE otherwise.
|
||||
*
|
||||
* Failure: FAIL if the existence of certain messages
|
||||
* cannot be determined.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, November 2, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
htri_t
|
||||
H5O_dtype_isa(struct H5O_t *oh)
|
||||
{
|
||||
htri_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_dtype_isa, FAIL)
|
||||
|
||||
HDassert(oh);
|
||||
|
||||
if((ret_value = H5O_exists_oh(oh, H5O_DTYPE_ID, 0)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to read object header")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_dtype_isa() */
|
||||
|
@ -63,10 +63,12 @@ typedef struct H5T_conv_cb_t {
|
||||
void* user_data;
|
||||
} H5T_conv_cb_t;
|
||||
|
||||
/* Forward declarations for prototype arguments */
|
||||
struct H5O_t;
|
||||
|
||||
/* Private functions */
|
||||
H5_DLL herr_t H5TN_init_interface(void);
|
||||
H5_DLL herr_t H5T_init(void);
|
||||
H5_DLL htri_t H5T_isa(struct H5O_loc_t *loc, hid_t dxpl_id);
|
||||
H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
|
||||
H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
|
||||
H5_DLL herr_t H5T_close(H5T_t *dt);
|
||||
|
@ -1184,3 +1184,4 @@ H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info)
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5T_vlen_get_alloc_info() */
|
||||
|
||||
|
@ -1399,7 +1399,6 @@ H5_DLL int H5E_term_interface(void);
|
||||
H5_DLL int H5F_term_interface(void);
|
||||
H5_DLL int H5G_term_interface(void);
|
||||
H5_DLL int H5I_term_interface(void);
|
||||
H5_DLL int H5O_term_interface(void);
|
||||
H5_DLL int H5P_term_interface(void);
|
||||
H5_DLL int H5R_term_interface(void);
|
||||
H5_DLL int H5S_term_interface(void);
|
||||
@ -1407,3 +1406,4 @@ H5_DLL int H5T_term_interface(void);
|
||||
H5_DLL int H5Z_term_interface(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -42,14 +42,16 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
|
||||
H5B2test.c H5BP.c H5BPcache.c H5BPdbg.c H5BPtest.c \
|
||||
H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5BTtest.c H5C.c \
|
||||
H5D.c \
|
||||
H5Dcontig.c \
|
||||
H5Dcompact.c \
|
||||
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \
|
||||
H5Dcontig.c \
|
||||
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Doh.c H5Dselect.c H5Dtest.c \
|
||||
H5E.c H5F.c \
|
||||
H5Fdbg.c H5Fmount.c H5Fsfile.c H5Fsuper.c H5FD.c H5FDcore.c \
|
||||
H5FDfamily.c H5FDfphdf5.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
|
||||
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
|
||||
H5FDstream.c H5FL.c H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c \
|
||||
H5G.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c \
|
||||
H5Goh.c \
|
||||
H5Gstab.c \
|
||||
H5Gtest.c \
|
||||
H5Gtraverse.c \
|
||||
@ -69,7 +71,8 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
|
||||
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.c \
|
||||
H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c H5Tfixed.c \
|
||||
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Topaque.c H5Torder.c \
|
||||
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
|
||||
H5Torder.c \
|
||||
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TS.c H5V.c H5Z.c \
|
||||
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \
|
||||
H5Zscaleoffset.c H5Ztrans.c
|
||||
|
@ -85,31 +85,32 @@ libhdf5_la_LIBADD =
|
||||
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5Bcache.lo \
|
||||
H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2test.lo H5BP.lo \
|
||||
H5BPcache.lo H5BPdbg.lo H5BPtest.lo H5BT.lo H5BTbtree2.lo \
|
||||
H5BTcache.lo H5BTdbg.lo H5BTtest.lo H5C.lo H5D.lo H5Dcontig.lo \
|
||||
H5Dcompact.lo H5Defl.lo H5Dio.lo H5Distore.lo H5Dmpio.lo \
|
||||
H5Dselect.lo H5Dtest.lo H5E.lo H5F.lo H5Fdbg.lo H5Fmount.lo \
|
||||
H5Fsfile.lo H5Fsuper.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
|
||||
H5FDfphdf5.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \
|
||||
H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDstdio.lo \
|
||||
H5FDstream.lo H5FL.lo H5FO.lo H5FP.lo H5FPclient.lo \
|
||||
H5FPserver.lo H5FS.lo H5G.lo H5Gent.lo H5Glink.lo H5Gloc.lo \
|
||||
H5Gname.lo H5Gnode.lo H5Gobj.lo H5Gstab.lo H5Gtest.lo \
|
||||
H5Gtraverse.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo \
|
||||
H5I.lo H5MF.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo H5Oattr.lo \
|
||||
H5Obogus.lo H5Ocache.lo H5Ocont.lo H5Odtype.lo H5Oefl.lo \
|
||||
H5Ofill.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo \
|
||||
H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Osdspace.lo \
|
||||
H5Oshared.lo H5Ostab.lo H5P.lo H5Pdcpl.lo H5Pdxpl.lo \
|
||||
H5Pfapl.lo H5Pfcpl.lo H5Pgcpl.lo H5Pocpl.lo H5Ptest.lo H5R.lo \
|
||||
H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo \
|
||||
H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo H5SH.lo \
|
||||
H5SHcache.lo H5SHdbg.lo H5SL.lo H5ST.lo H5T.lo H5Tarray.lo \
|
||||
H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \
|
||||
H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo \
|
||||
H5Tnative.lo H5Toffset.lo H5Topaque.lo H5Torder.lo H5Tpad.lo \
|
||||
H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo \
|
||||
H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \
|
||||
H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo
|
||||
H5BTcache.lo H5BTdbg.lo H5BTtest.lo H5C.lo H5D.lo \
|
||||
H5Dcompact.lo H5Dcontig.lo H5Defl.lo H5Dio.lo H5Distore.lo \
|
||||
H5Dmpio.lo H5Doh.lo H5Dselect.lo H5Dtest.lo H5E.lo H5F.lo \
|
||||
H5Fdbg.lo H5Fmount.lo H5Fsfile.lo H5Fsuper.lo H5FD.lo \
|
||||
H5FDcore.lo H5FDfamily.lo H5FDfphdf5.lo H5FDlog.lo H5FDmpi.lo \
|
||||
H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo \
|
||||
H5FDstdio.lo H5FDstream.lo H5FL.lo H5FO.lo H5FP.lo \
|
||||
H5FPclient.lo H5FPserver.lo H5FS.lo H5G.lo H5Gent.lo \
|
||||
H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo \
|
||||
H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HG.lo H5HGdbg.lo \
|
||||
H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5MF.lo H5MM.lo H5MP.lo \
|
||||
H5MPtest.lo H5O.lo H5Oattr.lo H5Obogus.lo H5Ocache.lo \
|
||||
H5Ocont.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo \
|
||||
H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omtime.lo H5Oname.lo \
|
||||
H5Onull.lo H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo \
|
||||
H5P.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pgcpl.lo \
|
||||
H5Pocpl.lo H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo \
|
||||
H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \
|
||||
H5Stest.lo H5SH.lo H5SHcache.lo H5SHdbg.lo H5SL.lo H5ST.lo \
|
||||
H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo \
|
||||
H5Tconv.lo H5Tcset.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \
|
||||
H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \
|
||||
H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \
|
||||
H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo \
|
||||
H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo H5Zszip.lo \
|
||||
H5Zscaleoffset.lo H5Ztrans.lo
|
||||
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
H5detect_SOURCES = H5detect.c
|
||||
@ -395,14 +396,16 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
|
||||
H5B2test.c H5BP.c H5BPcache.c H5BPdbg.c H5BPtest.c \
|
||||
H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5BTtest.c H5C.c \
|
||||
H5D.c \
|
||||
H5Dcontig.c \
|
||||
H5Dcompact.c \
|
||||
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \
|
||||
H5Dcontig.c \
|
||||
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Doh.c H5Dselect.c H5Dtest.c \
|
||||
H5E.c H5F.c \
|
||||
H5Fdbg.c H5Fmount.c H5Fsfile.c H5Fsuper.c H5FD.c H5FDcore.c \
|
||||
H5FDfamily.c H5FDfphdf5.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
|
||||
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
|
||||
H5FDstream.c H5FL.c H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c \
|
||||
H5G.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c \
|
||||
H5Goh.c \
|
||||
H5Gstab.c \
|
||||
H5Gtest.c \
|
||||
H5Gtraverse.c \
|
||||
@ -422,7 +425,8 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
|
||||
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.c \
|
||||
H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c H5Tfixed.c \
|
||||
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Topaque.c H5Torder.c \
|
||||
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
|
||||
H5Torder.c \
|
||||
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TS.c H5V.c H5Z.c \
|
||||
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \
|
||||
H5Zscaleoffset.c H5Ztrans.c
|
||||
@ -585,6 +589,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dio.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Distore.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dmpio.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Doh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dselect.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dtest.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5E.Plo@am__quote@
|
||||
@ -618,6 +623,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gname.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gnode.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gobj.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Goh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gstab.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gtest.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gtraverse.Plo@am__quote@
|
||||
@ -689,6 +695,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tinit.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tnative.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Toffset.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Toh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Topaque.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Torder.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tpad.Plo@am__quote@
|
||||
|
1139
test/objcopy.c
1139
test/objcopy.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user