[svn-r12700] Alert:

File format is not stable, don't keep files produced!

Description:
    First stage of checkins modifying the format of groups to support creation
order.  Implement "dense" storage for links in groups.

    Try to clarify some of the symbols for the H5L API.

    Add the H5Pset_latest_format() flag for FAPLs, to choose to use the newest
file format options (including "dense" link storage in groups)

    Add the H5Pset_track_creation_order() flag for GCPLs, to enable creation
order tracking in groups (although no index on creation order yet).

    Remove --enable-group-revision configure flag, as file format issues are
now handled in a backwardly/forwardly compatible way.

    Clean up lots of compiler warnings and other minor formatting issues.

Tested on:
    FreeBSD/32 4.11 (sleipnir) w/threadsafe
    Linux/32 2.4 (heping) w/FORTRAN & C++
    Linux/64 2.4 (mir) w/enable-v1.6 compa
    Mac OSX/32 10.4.8 (amazon)
    AIX 5.3 (copper) w/parallel & FORTRAN
This commit is contained in:
Quincey Koziol 2006-10-02 05:24:03 -05:00
parent 9bc29ea538
commit a6f6462541
113 changed files with 8491 additions and 6212 deletions

View File

@ -497,6 +497,8 @@
./src/H5FSpublic.h
./src/H5FSsection.c
./src/H5G.c
./src/H5Gbtree2.c
./src/H5Gdense.c
./src/H5Gdeprec.c
./src/H5Gent.c
./src/H5Glink.c

View File

@ -50,7 +50,7 @@ $Source = "";
"H5FD_stream_fapl_t*" => "x",
"H5G_obj_t" => "Go",
"H5G_stat_t*" => "Gs",
"H5L_link_t" => "Ll",
"H5L_type_t" => "Ll",
"unsigned long" => "Lu",
"hsize_t" => "h",
"hssize_t" => "Hs",
@ -88,7 +88,7 @@ $Source = "";
"H5E_auto_t" => "x",
"H5E_walk_t" => "x",
"H5G_iterate_t" => "x",
"H5L_link_class_t" => "x",
"H5L_class_t" => "x",
"H5MM_allocate_t" => "x",
"H5MM_free_t" => "x",
"H5P_cls_create_func_t" => "x",

90
configure vendored
View File

@ -1071,8 +1071,6 @@ Optional Features:
is most packages.
--enable-codestack Enable the function stack tracing (for developer
debugging).
--enable-group-revision Enable the group revision code (for internal
developers only).
--enable-metadata-trace-file
Enable metadata trace file collection.
--enable-trace Enable API tracing capability. Default=no if debug
@ -3521,7 +3519,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:3524:" \
echo "$as_me:3522:" \
"checking for Fortran compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -3816,7 +3814,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_verb"
(eval echo $as_me:3819: \"$ac_link\") >&5
(eval echo $as_me:3817: \"$ac_link\") >&5
ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_fc_v_output" >&5
FCFLAGS=$ac_save_FFLAGS
@ -3894,7 +3892,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_cv_prog_fc_v"
(eval echo $as_me:3897: \"$ac_link\") >&5
(eval echo $as_me:3895: \"$ac_link\") >&5
ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_fc_v_output" >&5
FCFLAGS=$ac_save_FFLAGS
@ -6619,7 +6617,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 6622 "configure"' > conftest.$ac_ext
echo '#line 6620 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -7749,7 +7747,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:7752:" \
echo "$as_me:7750:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -8818,11 +8816,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:8821: $lt_compile\"" >&5)
(eval echo "\"\$as_me:8819: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:8825: \$? = $ac_status" >&5
echo "$as_me:8823: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -9073,11 +9071,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:9076: $lt_compile\"" >&5)
(eval echo "\"\$as_me:9074: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:9080: \$? = $ac_status" >&5
echo "$as_me:9078: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -9133,11 +9131,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:9136: $lt_compile\"" >&5)
(eval echo "\"\$as_me:9134: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:9140: \$? = $ac_status" >&5
echo "$as_me:9138: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -11405,7 +11403,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11408 "configure"
#line 11406 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11503,7 +11501,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11506 "configure"
#line 11504 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -13739,11 +13737,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:13742: $lt_compile\"" >&5)
(eval echo "\"\$as_me:13740: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:13746: \$? = $ac_status" >&5
echo "$as_me:13744: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -13799,11 +13797,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:13802: $lt_compile\"" >&5)
(eval echo "\"\$as_me:13800: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:13806: \$? = $ac_status" >&5
echo "$as_me:13804: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -15218,7 +15216,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 15221 "configure"
#line 15219 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -15316,7 +15314,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 15319 "configure"
#line 15317 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -16171,11 +16169,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16174: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16172: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:16178: \$? = $ac_status" >&5
echo "$as_me:16176: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -16231,11 +16229,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16234: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16232: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:16238: \$? = $ac_status" >&5
echo "$as_me:16236: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -18287,11 +18285,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18290: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18288: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:18294: \$? = $ac_status" >&5
echo "$as_me:18292: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -18542,11 +18540,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18545: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18543: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:18549: \$? = $ac_status" >&5
echo "$as_me:18547: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -18602,11 +18600,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18605: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18603: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:18609: \$? = $ac_status" >&5
echo "$as_me:18607: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -20874,7 +20872,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 20877 "configure"
#line 20875 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -20972,7 +20970,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 20975 "configure"
#line 20973 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -48163,32 +48161,6 @@ echo "${ECHO_T}no" >&6
;;
esac
echo "$as_me:$LINENO: checking whether group revision code is enabled" >&5
echo $ECHO_N "checking whether group revision code is enabled... $ECHO_C" >&6
# Check whether --enable-group-revision or --disable-group-revision was given.
if test "${enable_group_revision+set}" = set; then
enableval="$enable_group_revision"
GROUPREVISION=$enableval
fi;
case "X-$GROUPREVISION" in
X-yes)
GROUPREVISION=yes
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define GROUP_REVISION 1
_ACEOF
;;
*)
GROUPREVISION=no
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
esac
echo "$as_me:$LINENO: checking whether metadata trace file code is enabled" >&5
echo $ECHO_N "checking whether metadata trace file code is enabled... $ECHO_C" >&6
# Check whether --enable-metadata-trace-file or --disable-metadata-trace-file was given.

View File

@ -2026,28 +2026,6 @@ case "X-$CODESTACK" in
;;
esac
dnl ----------------------------------------------------------------------
dnl Check if they would like the group revision code compiled in
dnl
AC_MSG_CHECKING([whether group revision code is enabled])
AC_ARG_ENABLE([group-revision],
[AC_HELP_STRING([--enable-group-revision],
[Enable the group revision code (for internal developers only).])],
[GROUPREVISION=$enableval])
case "X-$GROUPREVISION" in
X-yes)
GROUPREVISION=yes
AC_MSG_RESULT([yes])
AC_DEFINE([GROUP_REVISION], [1],
[Define if the group revision code is to be compiled in])
;;
*)
GROUPREVISION=no
AC_MSG_RESULT([no])
;;
esac
dnl ----------------------------------------------------------------------
dnl Check if they would like the metadata trace file code compiled in
dnl

View File

@ -118,9 +118,9 @@ error:
return -1;
}
const H5L_link_class_t elink_unix2win_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
H5L_LINK_EXTERNAL, /* Link type id number */
const H5L_class_t elink_unix2win_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
H5L_TYPE_EXTERNAL, /* Link type id number */
"unix2win external link", /* Link class name for debugging */
NULL, /* Creation callback */
NULL, /* Move callback */

View File

@ -219,12 +219,12 @@ void soft_link_example()
* A link class can have NULL for any callback except its traverse
* callback.
*/
const H5L_link_class_t UD_soft_class[1] = {{
const H5L_class_t UD_soft_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
* This field is always H5L_LINK_CLASS_T_VERS */
UD_SOFT_CLASS, /* Link class id number. This can be any
* value between H5L_LINK_UD_MIN (64) and
* H5L_LINK_MAX (255). It should be a
* value between H5L_TYPE_UD_MIN (64) and
* H5L_TYPE_MAX (255). It should be a
* value that isn't already being used by
* another kind of link. We'll use 65. */
"UD_soft_link", /* Link class name for debugging */
@ -318,12 +318,12 @@ void hard_link_example()
* A link class can have NULL for any callback except its traverse
* callback.
*/
const H5L_link_class_t UD_hard_class[1] = {{
const H5L_class_t UD_hard_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
* This field is always H5L_LINK_CLASS_T_VERS */
UD_HARD_CLASS, /* Link class id number. This can be any
* value between H5L_LINK_UD_MIN (64) and
* H5L_LINK_MAX (255). It should be a
* value between H5L_TYPE_UD_MIN (64) and
* H5L_TYPE_MAX (255). It should be a
* value that isn't already being used by
* another kind of link. We'll use 66. */
"UD_hard_link", /* Link class name for debugging */
@ -533,12 +533,12 @@ void plist_link_example()
* A link class can have NULL for any callback except its traverse
* callback.
*/
const H5L_link_class_t UD_plist_class[1] = {{
const H5L_class_t UD_plist_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
* This field is always H5L_LINK_CLASS_T_VERS */
UD_PLIST_CLASS, /* Link class id number. This can be any
* value between H5L_LINK_UD_MIN (64) and
* H5L_LINK_MAX (255). It should be a
* value between H5L_TYPE_UD_MIN (64) and
* H5L_TYPE_MAX (255). It should be a
* value that isn't already being used by
* another kind of link. We'll use 67. */
"UD_plist_link", /* Link class name for debugging */

View File

@ -128,22 +128,3 @@ nh5_exit_c(int_f *status)
HDexit((int)*status);
} /* h5_exit_c */
/*----------------------------------------------------------------------------
* Name: h5_group_revision_c
* Purpose: Checks if H5_GROUP_REVISION variable defined
* Inputs:
* Returns: 1 if defines, 0 otherwise
* Programmer: Elena Pourmal
* Saturday, May 13, 2006
* Modifications:
*---------------------------------------------------------------------------*/
int_f
nh5_group_revision_c()
{
int_f ret =0;
#ifdef H5_GROUP_REVISION
ret = 1;
#endif
return ret;
} /* h5_group_revision_c */

View File

@ -25,7 +25,6 @@ char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
# define nh5_fixname_c H5_FC_FUNC_(h5_fixname_c, H5_FIXNAME_C)
# define nh5_cleanup_c H5_FC_FUNC_(h5_cleanup_c, H5_CLEANUP_C)
# define nh5_exit_c H5_FC_FUNC_(h5_exit_c, H5_EXIT_C)
# define nh5_group_revision_c H5_FC_FUNC_(h5_group_revision_c, H5_GROUP_REVISION_C)
H5_FCTESTDLL int_f nh5_fixname_c
(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl, _fcd full_name, size_t_f *full_namelen);
@ -36,4 +35,3 @@ H5_FCTESTDLL int_f nh5_cleanup_c
H5_FCTESTDLL void nh5_exit_c
(int_f *status);
H5_FCTESTDLL int_f nh5_group_revision_c();

View File

@ -747,16 +747,8 @@
! Check the free space now
CALL h5fget_freespace_f(fid, free_space, error)
CALL h5_group_revision_f(flag)
CALL check("h5fget_freespace_f",error,total_error)
if(flag .eq. 1) then
free_space_out = 232
else
free_space_out = 1024
endif
if(error .eq.0 .and. free_space .ne. free_space_out) then
! if(error .eq.0 .and. free_space .ne. 232) then
! if(error .eq.0 .and. free_space .ne. 1024) then
if(error .eq.0 .and. free_space .ne. 0) then
total_error = total_error + 1
write(*,*) "3: Wrong amount of free space reported, ", free_space
endif

View File

@ -201,38 +201,3 @@
END SUBROUTINE h5_exit_f
!----------------------------------------------------------------------
! Name: h5_group_revision_f
!
! Purpose: Checks if group revisions are defined
!
! Inputs:
!
! Outputs:
! flag
!
! Programmer: Elena Pourmal
! May 13, 2006
!
!
!----------------------------------------------------------------------
SUBROUTINE h5_group_revision_f(flag)
!
!This definition is needed for Windows DLLs
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$attributes dllexport :: h5_group_revision_f
!DEC$endif
IMPLICIT NONE
INTEGER, INTENT(OUT) :: flag ! Return code
INTEGER :: flag1
INTERFACE
INTEGER FUNCTION h5_group_revision_c()
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
!MS$ATTRIBUTES C,reference,alias:'_H5_GROUP_REVISION_C':: h5_group_revision_c
!DEC$ ENDIF
END FUNCTION h5_group_revision_c
END INTERFACE
flag = h5_group_revision_c()
END SUBROUTINE h5_group_revision_f

View File

@ -1008,7 +1008,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
#ifdef H5_GROUP_REVISION
/*--------------------------------------------------------------------------
NAME
@ -1063,8 +1062,7 @@ H5Aget_create_plist(hid_t attr_id)
done:
FUNC_LEAVE_API(ret_value)
}
#endif /* H5_GROUP_REVISION */
} /* end H5Aget_create_plist() */
/*--------------------------------------------------------------------------

View File

@ -38,9 +38,7 @@ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
H5_DLL herr_t H5Aclose(hid_t attr_id);
H5_DLL hid_t H5Aget_space(hid_t attr_id);
H5_DLL hid_t H5Aget_type(hid_t attr_id);
#ifdef H5_GROUP_REVISION
H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
#endif /* H5_GROUP_REVISION */
H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id);
H5_DLL int H5Aget_num_attrs(hid_t loc_id);

View File

@ -2115,12 +2115,13 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data)
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
void *node=NULL; /* Pointers to current node */
uint8_t *native; /* Pointers to node's native records */
H5B2_node_ptr_t *node_ptrs=NULL; /* Pointers to node's node pointers */
const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
void *node = NULL; /* Pointers to current node */
uint8_t *node_native; /* Pointers to node's native records */
uint8_t *native = NULL; /* Pointers to copy of node's native records */
H5B2_node_ptr_t *node_ptrs = NULL; /* Pointers to node's node pointers */
unsigned u; /* Local index */
herr_t ret_value = H5B2_ITER_CONT;
herr_t ret_value = H5B2_ITER_CONT; /* Iterator return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_iterate_node)
@ -2145,8 +2146,14 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_INT;
node = internal;
native = internal->int_native;
node_ptrs = internal->node_ptrs;
node_native = internal->int_native;
/* Allocate space for the node pointers in memory */
if((node_ptrs = H5FL_FAC_MALLOC(shared->node_info[depth].node_ptr_fac)) == NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
/* Copy the node pointers */
HDmemcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (curr_node->node_nrec + 1)));
} /* end if */
else {
H5B2_leaf_t *leaf; /* Pointer to leaf node */
@ -2158,9 +2165,21 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_LEAF;
node = leaf;
native = leaf->leaf_native;
node_native = leaf->leaf_native;
} /* end else */
/* Allocate space for the native keys in memory */
if((native = H5FL_FAC_MALLOC(shared->node_info[depth].nat_rec_fac)) == NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
/* Copy the native keys */
HDmemcpy(native, node_native, (shared->type->nrec_size * curr_node->node_nrec));
/* Unlock the node */
if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
node = NULL;
/* Iterate through records, in order */
for(u = 0; u < curr_node->node_nrec && !ret_value; u++) {
/* Descend into child node, if current node is an internal node */
@ -2170,8 +2189,10 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
} /* end if */
/* Make callback for current record */
if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
if(!ret_value) {
if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
} /* end if */
} /* end for */
/* Descend into last child node, if current node is an internal node */
@ -2181,10 +2202,11 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
} /* end if */
done:
/* Unlock current node */
if(node)
if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Release the node pointers & native records, if they were copied */
if(node_ptrs)
H5FL_FAC_FREE(shared->node_info[depth].node_ptr_fac, node_ptrs);
if(native)
H5FL_FAC_FREE(shared->node_info[depth].nat_rec_fac, native);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_iterate_node() */

View File

@ -56,13 +56,15 @@ typedef enum H5B2_subid_t {
H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */
H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */
H5B2_GRP_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" link storage in groups */
H5B2_GRP_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" link storage in groups */
H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
} H5B2_subid_t;
/* Define the operator callback function pointer for H5B2_iterate() */
typedef int (*H5B2_operator_t)(const void *record, void *op_data);
/* Define the 'found' callback function pointer for H5B2_find() & H5B2_neighbor() */
/* Define the 'found' callback function pointer for H5B2_find(), H5B2_neighbor() & H5B2_index() */
typedef herr_t (*H5B2_found_t)(const void *record, void *op_data);
/* Define the 'modify' callback function pointer for H5B2_modify() */
@ -106,7 +108,7 @@ struct H5B2_class_t {
/* v2 B-tree metadata statistics info */
typedef struct H5B2_stat_t {
unsigned depth; /* Depth of B-tree */
unsigned nrecords; /* Number of records */
hsize_t nrecords; /* Number of records */
} H5B2_stat_t;
/*****************************/

File diff suppressed because it is too large Load Diff

View File

@ -103,6 +103,7 @@ hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */
hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */
hid_t H5E_BADITER_g = FAIL; /* Iteration failed */
hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */
hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */
/* System level errors */
hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */

View File

@ -377,6 +377,11 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
assert(H5E_CANTRESET_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* System level errors */
assert(H5E_SYSERRSTR_g==(-1));

View File

@ -168,6 +168,7 @@ H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */
#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g)
#define H5E_BADITER (H5OPEN H5E_BADITER_g)
#define H5E_CANTPACK (H5OPEN H5E_CANTPACK_g)
#define H5E_CANTRESET (H5OPEN H5E_CANTRESET_g)
H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */
H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */
H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */
@ -175,6 +176,7 @@ H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */
H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */
H5_DLLVAR hid_t H5E_BADITER_g; /* Iteration failed */
H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */
H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */
/* System level errors */
#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g)

View File

@ -104,7 +104,8 @@ H5E_ALIGNMENT_g=
H5E_BADMESG_g=
H5E_CANTDELETE_g=
H5E_BADITER_g=
H5E_CANTPACK_g=
H5E_CANTPACK_g=
H5E_CANTRESET_g=
/* System level errors */
H5E_SYSERRSTR_g=

152
src/H5F.c
View File

@ -232,52 +232,52 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE)<0)
if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the user block size */
if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for symbol table leaf nodes */
if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for btree internal nodes */
if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for an address */
if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for object size */
if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the superblock version number */
if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free-space version number */
if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the object directory version number */
if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared-header version number */
if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_FILE_CREATE_g==(-1)) {
/* Register the default file creation property list */
if((H5P_LST_FILE_CREATE_g = H5P_create_id(crt_pclass))<0)
if((H5P_LST_FILE_CREATE_g = H5P_create_id(crt_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@ -289,78 +289,78 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE)<0)
if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the initial metadata cache resize configuration */
if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_INIT_CONFIG_NAME,H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_INIT_CONFIG_NAME,H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache (elements) */
if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the threshold for alignment */
if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the alignment */
if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum metadata allocation block size */
if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the maximum sieve buffer size */
if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum "small data" allocation block size */
if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the garbage collection reference */
if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver ID */
if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver info */
if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file close degree */
if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the offset of family driver info */
if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of new family file size. It's used by h5repart only. */
if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */
if(H5P_register(acs_pclass,H5F_ACS_FAMILY_TO_SEC2_NAME,H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_FAMILY_TO_SEC2_NAME,H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data type of multi driver info */
if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 'use the latest version of the format' flag */
@ -371,7 +371,7 @@ H5F_init_interface(void)
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_FILE_ACCESS_g==(-1)) {
/* Register the default file access property list */
if((H5P_LST_FILE_ACCESS_g = H5P_create_id(acs_pclass))<0)
if((H5P_LST_FILE_ACCESS_g = H5P_create_id(acs_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@ -383,20 +383,20 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE)<0)
if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register property of whether symlinks is local to file */
if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_MOUNT_g==(-1)) {
/* Register the default file mount property list */
if((H5P_LST_MOUNT_g = H5P_create_id(mnt_pclass))<0)
if((H5P_LST_MOUNT_g = H5P_create_id(mnt_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@ -489,7 +489,7 @@ H5F_acs_create(hid_t fapl_id, void UNUSED *copy_data)
if(driver_id > 0) {
/* Set the driver for the property list */
if(H5FD_fapl_open(plist, driver_id, driver_info)<0)
if(H5FD_fapl_open(plist, driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
@ -539,7 +539,7 @@ H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, void UNUSED *copy_data)
if(driver_id > 0) {
/* Set the driver for the property list */
if(H5FD_fapl_open(new_plist, driver_id, driver_info)<0)
if(H5FD_fapl_open(new_plist, driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
@ -588,7 +588,7 @@ H5F_acs_close(hid_t fapl_id, void UNUSED *close_data)
if(driver_id > 0) {
/* Close the driver for the property list */
if(H5FD_fapl_close(driver_id, driver_info)<0)
if(H5FD_fapl_close(driver_id, driver_info) < 0)
HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */
}
@ -885,7 +885,7 @@ H5F_get_access_plist(H5F_t *f)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information")
/* Increment the reference count on the driver ID and insert it into the property list */
if(H5I_inc_ref(f->shared->lf->driver_id)<0)
if(H5I_inc_ref(f->shared->lf->driver_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver")
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID")
@ -936,7 +936,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
if( (types&H5F_OBJ_ALL)==0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type")
if((ret_value = H5F_get_obj_count(f, types))<0)
if((ret_value = H5F_get_obj_count(f, types)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOUNT, FAIL, "can't get object count")
done:
@ -1328,9 +1328,9 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id)
*/
for (n=8; n<maxpow; n++) {
addr = (8==n) ? 0 : (haddr_t)1 << n;
if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN)<0)
if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature")
if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf)<0)
if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature")
if (!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
break;
@ -1396,7 +1396,7 @@ H5Fis_hdf5(const char *name)
done:
/* Close the file */
if (file)
if(H5FD_close(file)<0 && ret_value>=0)
if(H5FD_close(file) < 0 && ret_value>=0)
HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
FUNC_LEAVE_API(ret_value)
@ -1475,13 +1475,13 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
f->shared->fcpl_id = H5P_copy_plist(plist);
/* Get the FCPL values to cache */
if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &f->shared->sizeof_addr)<0)
if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &f->shared->sizeof_addr) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for address")
if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size)<0)
if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size")
if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &f->shared->sym_leaf_k)<0)
if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &f->shared->sym_leaf_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size")
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &f->shared->btree_k[0])<0)
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &f->shared->btree_k[0]) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get rank for btree internal nodes")
/* Check for non-default indexed storage B-tree internal 'K' value
@ -1510,11 +1510,11 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get preempt read chunk")
if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold))<0)
if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold")
if(H5P_get(plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment")
if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME,&(f->shared->gc_ref))<0)
if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME,&(f->shared->gc_ref)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference")
if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
@ -1530,7 +1530,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache")
/* Create the file's "open object" information */
if(H5FO_create(f)<0)
if(H5FO_create(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Add new "shared" struct to list of open files */
@ -1541,7 +1541,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
f->shared->nrefs++;
/* Create the file's "top open object" information */
if(H5FO_top_create(f)<0)
if(H5FO_top_create(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Set return value */
@ -1614,12 +1614,12 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
*/
if (f->shared->root_grp) {
/* Free the ID to name buffer */
if(H5G_free_grp_name(f->shared->root_grp)<0)
if(H5G_free_grp_name(f->shared->root_grp) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
/* Free the memory for the root group */
if(H5G_free(f->shared->root_grp)<0)
if(H5G_free(f->shared->root_grp) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
f->shared->root_grp=NULL;
@ -1627,11 +1627,11 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
if (H5AC_dest(f, dxpl_id))
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
if (H5FO_dest(f)<0)
if (H5FO_dest(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
f->shared->cwfs = H5MM_xfree (f->shared->cwfs);
if (H5G_node_close(f)<0)
if (H5G_node_close(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
@ -1644,7 +1644,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list")
/* Close low-level file */
if (H5FD_close(f->shared->lf)<0)
if (H5FD_close(f->shared->lf) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file")
@ -1823,7 +1823,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* exists), or if the new request adds write access (since the
* readers don't expect the file to change under them).
*/
if(H5FD_close(lf)<0)
if(H5FD_close(lf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
if (flags & H5F_ACC_TRUNC)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to truncate a file which is already open")
@ -1843,7 +1843,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* open it are different than the desired flags. Close the tentative
* file and open it for real.
*/
if(H5FD_close(lf)<0) {
if(H5FD_close(lf) < 0) {
file = NULL; /*to prevent destruction of wrong file*/
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
} /* end if */
@ -1911,7 +1911,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
/* (This must be after the space for the superblock is allocated in
* the file)
*/
if (H5G_mkroot(file, dxpl_id, NULL)<0)
if (H5G_mkroot(file, dxpl_id, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group")
/* Write the superblock to the file */
@ -1927,7 +1927,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
/* Make sure we can open the root group */
if (H5G_mkroot(file, dxpl_id, &root_loc)<0)
if (H5G_mkroot(file, dxpl_id, &root_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group")
}
@ -1957,7 +1957,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
done:
if (!ret_value && file)
if(H5F_dest(file, dxpl_id)<0)
if(H5F_dest(file, dxpl_id) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
FUNC_LEAVE_NOAPI(ret_value)
@ -2065,7 +2065,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
/* Get an atom for the file */
if ((ret_value = H5I_register(H5I_FILE, new_file))<0)
if ((ret_value = H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
/* Keep this ID in file object structure */
@ -2073,7 +2073,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
done:
if (ret_value<0 && new_file)
if(H5F_close(new_file)<0)
if(H5F_close(new_file) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
FUNC_LEAVE_API(ret_value)
}
@ -2145,7 +2145,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file")
/* Get an atom for the file */
if ((ret_value = H5I_register(H5I_FILE, new_file))<0)
if ((ret_value = H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
/* Keep this ID in file object structure */
@ -2153,7 +2153,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
done:
if (ret_value<0 && new_file)
if(H5F_close(new_file)<0)
if(H5F_close(new_file) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
FUNC_LEAVE_API(ret_value)
}
@ -2673,7 +2673,7 @@ H5Fclose(hid_t file_id)
* Decrement reference count on atom. When it reaches zero the file will
* be closed.
*/
if(H5I_dec_ref (file_id) < 0)
if(H5I_dec_ref(file_id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
@ -2726,7 +2726,7 @@ H5Freopen(hid_t file_id)
/* Duplicate old file's name */
new_file->name = H5MM_xstrdup(old_file->name);
if ((ret_value=H5I_register(H5I_FILE, new_file))<0)
if ((ret_value=H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
/* Keep this ID in file object structure */
@ -2734,7 +2734,7 @@ H5Freopen(hid_t file_id)
done:
if (ret_value<0 && new_file)
if(H5F_dest(new_file, H5AC_dxpl_id)<0)
if(H5F_dest(new_file, H5AC_dxpl_id) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
FUNC_LEAVE_API(ret_value)
}
@ -3135,7 +3135,7 @@ H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
assert(filenum);
/* Retrieve the file's serial number */
if(H5FD_get_fileno(f->shared->lf,filenum)<0)
if(H5FD_get_fileno(f->shared->lf,filenum) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno")
done:
@ -3171,7 +3171,7 @@ H5F_get_id(H5F_t *file)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
} else {
/* Increment reference count on atom. */
if(H5I_inc_ref(file->file_id)<0)
if(H5I_inc_ref(file->file_id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
} /* end else */
@ -3271,7 +3271,7 @@ H5F_mpi_get_rank(const H5F_t *f)
assert(f && f->shared);
/* Dispatch to driver */
if ((ret_value=H5FD_mpi_get_rank(f->shared->lf))<0)
if ((ret_value=H5FD_mpi_get_rank(f->shared->lf)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed")
done:
@ -3339,7 +3339,7 @@ H5F_mpi_get_size(const H5F_t *f)
assert(f && f->shared);
/* Dispatch to driver */
if ((ret_value=H5FD_mpi_get_size(f->shared->lf))<0)
if ((ret_value=H5FD_mpi_get_size(f->shared->lf)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed")
done:
@ -3522,7 +3522,7 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t
abs_addr = f->shared->base_addr + addr;
/* Read the data */
if (H5FD_read(f->shared->lf, type, dxpl_id, abs_addr, size, buf)<0)
if(H5FD_read(f->shared->lf, type, dxpl_id, abs_addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
done:
@ -3682,9 +3682,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
/*-------------------------------------------------------------------------
* Function: H5Fget_freespace
*
* Purpose: Retrieves the amount of free space (of a given type) in the
* file. If TYPE is 'H5FD_MEM_DEFAULT', then the amount of free
* space for all types is returned.
* Purpose: Retrieves the amount of free space in the file.
*
* Return: Success: Amount of free space for type
* Failure: Negative
@ -3693,8 +3691,6 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
* koziol@ncsa.uiuc.edu
* Oct 6, 2003
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
hssize_t
@ -3707,11 +3703,11 @@ H5Fget_freespace(hid_t file_id)
H5TRACE1("Hs","i",file_id);
/* Check args */
if(NULL==(file=H5I_object_verify(file_id, H5I_FILE)))
if(NULL == (file = H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Go get the actual amount of free space in the file */
if((ret_value = H5FD_get_freespace(file->shared->lf))<0)
if((ret_value = H5FD_get_freespace(file->shared->lf)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
done:

File diff suppressed because it is too large Load Diff

View File

@ -228,17 +228,19 @@ struct H5FD_t {
* allocation region left */
haddr_t eoma; /* End of metadata
* allocated region */
/* (ie. beginning of space available) */
/* "Small data" aggregation fields */
hsize_t def_sdata_block_size; /* "Small data"
* allocation block size
* (if aggregating "small
* data") */
hsize_t cur_sdata_block_size; /* Current size of "small
* data" allocation
* region left */
haddr_t eosda; /* End of "small data"
* allocated region */
hsize_t def_sdata_block_size; /* "Small data"
* allocation block size
* (if aggregating "small
* data") */
hsize_t cur_sdata_block_size; /* Current size of "small
* data" allocation
* region left */
haddr_t eosda; /* End of "small data"
* allocated region */
/* (ie. beginning of space available) */
/* Metadata accumulator fields */
unsigned char *meta_accum; /* Buffer to hold the accumulated metadata */

View File

@ -231,6 +231,7 @@ herr_t
H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr)
{
H5FS_t *fspace = NULL; /* Free space header loaded from file */
H5FS_prot_t fs_prot; /* Temporary information for protecting free space header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FS_delete, FAIL)
@ -242,8 +243,14 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC);
HDassert(f);
HDassert(H5F_addr_defined(fs_addr));
/* Initialize user data for protecting the free space manager */
/* (no class information necessary for delete) */
fs_prot.nclasses = 0;
fs_prot.classes = NULL;
fs_prot.cls_init_udata = NULL;
/* Protect the free space header */
if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, NULL, NULL, H5AC_WRITE)))
if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header")
/* Delete serialized section storage, if there are any */
@ -404,7 +411,7 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
FUNC_ENTER_NOAPI_NOINIT(H5FS_new)
/* Check arguments. */
HDassert(nclasses || classes);
HDassert(nclasses == 0 || (nclasses > 0 && classes));
/*
* Allocate free space structure

View File

@ -209,9 +209,10 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr);
H5F_DECODE_LENGTH(f, p, fspace->ghost_sect_count);
/* # of section classes */
/* (only check if we actually have some classes) */
UINT16DECODE(p, nclasses);
if(fspace->nclasses != nclasses)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown section class count mismatch")
if(fspace->nclasses > 0 && fspace->nclasses != nclasses)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch")
/* Shrink percent */
UINT16DECODE(p, fspace->shrink_percent);
@ -409,7 +410,8 @@ H5FS_cache_hdr_dest(H5F_t UNUSED *f, H5FS_t *fspace)
} /* end for */
/* Release the memory for the free space section classes */
fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
if(fspace->sect_cls)
fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
/* Free free space info */
H5FL_FREE(H5FS_t, fspace);

View File

@ -48,13 +48,13 @@
* | | | file. |
* +--------------+------------+--------------------------------+
* | File ID | "foo/bar" | Find `foo' within `bar' within |
* | | | the current working group of |
* | | | the specified file. |
* | | | the root group of the specified|
* | | | file. |
* +--------------+------------+--------------------------------+
* | File ID | "/" | The root group of the specified|
* | | | file. |
* +--------------+------------+--------------------------------+
* | File ID | "." | The current working group of |
* | File ID | "." | The root group of the specified|
* | | | the specified file. |
* +--------------+------------+--------------------------------+
* | Group ID | "/foo/bar" | Find `foo' within `bar' within |
@ -93,7 +93,6 @@
#include "H5Pprivate.h" /* Property lists */
/* Local macros */
#define H5G_INIT_HEAP 8192
#define H5G_RESERVED_ATOMS 0
/* Local typedefs */
@ -201,7 +200,6 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
#ifdef H5_GROUP_REVISION
/* Check if we need to create a non-standard GCPL */
if(size_hint > 0) {
H5P_genplist_t *gc_plist; /* Property list created */
@ -229,7 +227,6 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
} /* end if */
else
#endif /* H5_GROUP_REVISION */
tmp_gcpl = H5P_GROUP_CREATE_DEFAULT;
/* What file is the group being added to? This may not be the same file
@ -246,16 +243,19 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
if(NULL == (grp = H5G_create(file, H5AC_dxpl_id, tmp_gcpl, H5P_DEFAULT)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
/* Get an ID for the newly created group */
if((grp_id = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Get the new group's location */
if(H5G_loc(grp_id, &grp_loc) <0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get location for new group")
/* Link the group */
if( H5L_link(&loc, name, &grp_loc, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
/* Link the new group to its parent group */
if(H5L_link(&loc, name, &grp_loc, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link to group")
/* Set the return value */
ret_value = grp_id;
done:
@ -277,7 +277,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate() */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Gcreate_expand
@ -345,6 +344,7 @@ H5Gcreate_expand(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
/* Create the new group & get its ID */
if(NULL == (grp = H5G_create(loc.oloc->file, H5AC_dxpl_id, gcpl_id, gapl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
if((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
@ -358,7 +358,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate_expand() */
#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@ -581,8 +580,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p,
H5G_iterate_t op, void *op_data)
H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
void *op_data)
{
int last_obj; /* Index of last object looked at */
int idx; /* Internal location to hold index */
@ -604,7 +603,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
last_obj = 0;
/* Call private function. */
if((ret_value = H5G_obj_iterate(loc_id, name, idx, &last_obj, op, op_data, H5AC_ind_dxpl_id)) < 0)
if((ret_value = H5G_obj_iterate(loc_id, name, H5_ITER_INC, idx, &last_obj, op, op_data, H5AC_ind_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Check for too high of a starting index (ex post facto :-) */
@ -614,7 +613,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
/* Set the index we stopped at */
if(idx_p)
*idx_p=last_obj;
*idx_p = last_obj;
done:
FUNC_LEAVE_API(ret_value)
@ -868,7 +867,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_comment() */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Gget_create_plist
@ -937,7 +935,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_create_plist() */
#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@ -1380,20 +1377,16 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
*/
if (loc == NULL) {
H5P_genplist_t *fc_plist; /* File creation property list */
#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info parameters */
#endif /* H5_GROUP_REVISION */
/* Get the file creation property list */
/* (Which is a sub-class of the group creation property class) */
if(NULL == (fc_plist = H5I_object(f->shared->fcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
#ifdef H5_GROUP_REVISION
/* Get the group info property */
if(H5P_get(fc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
#endif /* H5_GROUP_REVISION */
/* Set up group location for root group */
new_root_loc.oloc = &new_root_oloc;
@ -1401,11 +1394,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
H5G_loc_reset(&new_root_loc);
loc = &new_root_loc;
if(H5G_obj_create(f, dxpl_id,
#ifdef H5_GROUP_REVISION
&ginfo,
#endif /* H5_GROUP_REVISION */
loc->oloc/*out*/) < 0)
if(H5G_obj_create(f, dxpl_id, &ginfo, loc->oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
if(1 != H5O_link(loc->oloc, 1, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)")
@ -1470,9 +1459,7 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
{
H5G_t *grp = NULL; /*new group */
H5P_genplist_t *gc_plist; /* Property list created */
#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info */
#endif /* H5_GROUP_REVISION */
unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */
H5G_t *ret_value; /* Return value */
@ -1495,18 +1482,12 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
if(NULL == (gc_plist = H5I_object(gcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
#ifdef H5_GROUP_REVISION
/* Get the group info property */
if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get group info")
#endif /* H5_GROUP_REVISION */
/* Create the group object header */
if(H5G_obj_create(file, dxpl_id,
#ifdef H5_GROUP_REVISION
&ginfo,
#endif /* H5_GROUP_REVISION */
&(grp->oloc)/*out*/) < 0)
if(H5G_obj_create(file, dxpl_id, &ginfo, &(grp->oloc)/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header")
oloc_init = 1; /* Indicate that the object location information is valid */
@ -1516,6 +1497,7 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects")
/* Set the count of times the object is opened */
grp->shared->fo_count = 1;
/* Set return value */
@ -1671,11 +1653,8 @@ H5G_open_oid(H5G_t *grp, hid_t dxpl_id)
obj_opened = TRUE;
/* Check if this object has the right message(s) to be treated as a group */
if(H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id) <= 0
#ifdef H5_GROUP_REVISION
&& H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, dxpl_id) <= 0
#endif /* H5_GROUP_REVISION */
)
if((H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id) <= 0)
&& (H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, dxpl_id) <= 0))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group")
done:
@ -1931,10 +1910,9 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
/* Info for soft and UD links is gotten by H5L_get_linkinfo. If we have
* a hard link, follow it and get info on the object */
if(udata->follow_link || !lnk ||
(lnk->type == H5L_LINK_HARD)) {
* a hard link, follow it and get info on the object
*/
if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
/* Get object type */
statbuf->type = H5O_obj_type(obj_loc->oloc, udata->dxpl_id);
if(statbuf->type == H5G_UNKNOWN)
@ -2029,16 +2007,16 @@ H5G_get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
ret = H5L_get_linkinfo(loc, name, &linfo, H5P_DEFAULT, dxpl_id);
} H5E_END_TRY
if(ret >=0 && linfo.linkclass != H5L_LINK_HARD)
if(ret >=0 && linfo.type != H5L_TYPE_HARD)
{
statbuf->linklen = linfo.u.link_size;
if(linfo.linkclass == H5L_LINK_SOFT)
if(linfo.type == H5L_TYPE_SOFT)
{
statbuf->type = H5G_LINK;
}
else /* UD link. H5L_get_linkinfo checked for invalid link classes */
{
HDassert(linfo.linkclass >= H5L_LINK_UD_MIN && linfo.linkclass <= H5L_LINK_MAX);
HDassert(linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX);
statbuf->type = H5G_UDLINK;
}
}

376
src/H5Gbtree2.c Normal file
View File

@ -0,0 +1,376 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
* Created: H5Gbtree2.c
* Sep 9 2006
* Quincey Koziol <koziol@hdfgroup.org>
*
* Purpose: v2 B-tree callbacks for indexing fields on links
*
*-------------------------------------------------------------------------
*/
/****************/
/* Module Setup */
/****************/
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
/****************/
/* Local Macros */
/****************/
/******************/
/* Local Typedefs */
/******************/
/*
* Data exchange structure for dense link storage. This structure is
* passed through the fractal heap layer to compare links.
*/
typedef struct H5G_fh_ud_cmp_t {
/* downward */
H5F_t *f; /* Pointer to file that fractal heap is in */
hid_t dxpl_id; /* DXPL for operation */
const char *name; /* Name of link to compare */
H5B2_found_t found_op; /* Callback when correct link is found */
void *found_op_data; /* Callback data when correct link is found */
/* upward */
int cmp; /* Comparison of two link names */
} H5G_fh_ud_cmp_t;
/********************/
/* Package Typedefs */
/********************/
/********************/
/* Local Prototypes */
/********************/
/* v2 B-tree function callbacks */
/* v2 B-tree driver callbacks */
static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
static herr_t H5G_dense_btree2_name_retrieve(void *udata, const void *native);
static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2);
static herr_t H5G_dense_btree2_name_encode(const H5F_t *f, uint8_t *raw,
const void *native);
static herr_t H5G_dense_btree2_name_decode(const H5F_t *f, const uint8_t *raw,
void *native);
static herr_t H5G_dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
/* Fractal heap function callbacks */
static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
/*********************/
/* Package Variables */
/*********************/
/* v2 B-tree class for indexing 'name' field of links */
const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
H5B2_GRP_DENSE_NAME_ID, /* Type of B-tree */
sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */
H5G_dense_btree2_name_store, /* Record storage callback */
H5G_dense_btree2_name_retrieve, /* Record retrieval callback */
H5G_dense_btree2_name_compare, /* Record comparison callback */
H5G_dense_btree2_name_encode, /* Record encoding callback */
H5G_dense_btree2_name_decode, /* Record decoding callback */
H5G_dense_btree2_name_debug /* Record debugging callback */
}};
/*****************************/
/* Library Private Variables */
/*****************************/
/*******************/
/* Local Variables */
/*******************/
/*-------------------------------------------------------------------------
* Function: H5G_dense_fh_name_cmp
*
* Purpose: Compares the name of a link in a fractal heap to another
* name
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Sep 11 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata)
{
H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
H5O_link_t *lnk; /* Pointer to link created from heap object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_dense_fh_name_cmp)
/* Decode link information */
if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Compare the string values */
udata->cmp = HDstrcmp(udata->name, lnk->name);
/* Check for correct link & callback to make */
if(udata->cmp == 0 && udata->found_op) {
if((udata->found_op)(lnk, udata->found_op_data) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed")
} /* end if */
/* Release the space allocated for the link */
H5O_free(H5O_LINK_ID, lnk);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_dense_fh_name_cmp() */
/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_name_store
*
* Purpose: Store user information into native record for v2 B-tree
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Saturday, September 9, 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
{
const H5G_bt2_ud_ins_t *udata = (const H5G_bt2_ud_ins_t *)_udata;
H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_store)
/* Copy user information info native record */
nrecord->hash = udata->common.name_hash;
HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_store() */
/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_name_retrieve
*
* Purpose: Retrieve native information from record for v2 B-tree
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Monday, September 11, 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_name_retrieve(void *udata, const void *nrecord)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_retrieve)
*(H5G_dense_bt2_name_rec_t *)udata = *(const H5G_dense_bt2_name_rec_t *)nrecord;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_retrieve() */
/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_name_compare
*
* Purpose: Compare two native information records, according to some key
*
* Return: <0 if rec1 < rec2
* =0 if rec1 == rec2
* >0 if rec1 > rec2
*
* Programmer: Quincey Koziol
* Monday, September 11, 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
{
const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata;
const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec;
herr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_compare)
/* Sanity check */
HDassert(bt2_udata);
HDassert(bt2_rec);
#ifdef QAK
{
unsigned u;
HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G_dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash);
HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G_dense_btree2_name_compare", (unsigned)bt2_rec->hash);
for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
}
#endif /* QAK */
/* Check hash value */
if(bt2_udata->name_hash < bt2_rec->hash)
HGOTO_DONE(-1)
else if(bt2_udata->name_hash > bt2_rec->hash)
HGOTO_DONE(1)
else {
H5G_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
herr_t status; /* Status from fractal heap 'op' routine */
/* Sanity check */
HDassert(bt2_udata->name_hash == bt2_rec->hash);
/* Prepare user data for callback */
/* down */
fh_udata.f = bt2_udata->f;
fh_udata.dxpl_id = bt2_udata->dxpl_id;
fh_udata.name = bt2_udata->name;
fh_udata.found_op = bt2_udata->found_op;
fh_udata.found_op_data = bt2_udata->found_op_data;
/* up */
fh_udata.cmp = 0;
/* Check if the user's link and the B-tree's link have the same name */
status = H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id,
H5G_dense_fh_name_cmp, &fh_udata);
HDassert(status >= 0);
/* Callback will set comparison value */
HGOTO_DONE(fh_udata.cmp)
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_dense_btree2_name_compare() */
/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_name_encode
*
* Purpose: Encode native information into raw form for storing on disk
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Monday, September 11, 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_name_encode(const H5F_t UNUSED *f, uint8_t *raw, const void *_nrecord)
{
const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_encode)
/* Encode the record's fields */
UINT32ENCODE(raw, nrecord->hash)
HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_encode() */
/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_name_decode
*
* Purpose: Decode raw disk form of record into native form
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Monday, September 11, 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_name_decode(const H5F_t UNUSED *f, const uint8_t *raw, void *_nrecord)
{
H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_decode)
/* Decode the record's fields */
UINT32DECODE(raw, nrecord->hash)
HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_decode() */
/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_name_debug
*
* Purpose: Debug native form of record
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Monday, September 11, 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord,
const void UNUSED *_udata)
{
const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
unsigned u; /* Local index variable */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_debug)
HDfprintf(stream, "%*s%-*s {%lx, ", indent, "", fwidth, "Record:",
nrecord->hash);
for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_name_debug() */

1374
src/H5Gdense.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -43,29 +43,29 @@
*-------------------------------------------------------------------------
*/
herr_t
H5Glink(hid_t cur_loc_id, H5L_link_t type, const char *cur_name, const char *new_name)
H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, const char *new_name)
{
herr_t ret_value;
FUNC_ENTER_API(H5Glink, FAIL)
H5TRACE4("e","iLlss",cur_loc_id,type,cur_name,new_name);
if(type == H5L_LINK_HARD)
if(type == H5L_TYPE_HARD)
{
if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
else if(type == H5L_LINK_SOFT)
else if(type == H5L_TYPE_SOFT)
{
if((ret_value = H5Lcreate_soft(cur_name, cur_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
if((ret_value = H5Lcreate_soft(cur_name, cur_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
done:
FUNC_LEAVE_API(ret_value)
}
} /* end H5Glink() */
/*-------------------------------------------------------------------------
@ -77,7 +77,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_link_t type,
H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type,
hid_t new_loc_id, const char *new_name)
{
herr_t ret_value;
@ -85,11 +85,11 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_link_t type,
FUNC_ENTER_API(H5Glink2, FAIL)
H5TRACE5("e","isLlis",cur_loc_id,cur_name,type,new_loc_id,new_name);
if(type == H5L_LINK_HARD) {
if(type == H5L_TYPE_HARD) {
if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, new_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
else if(type == H5L_LINK_SOFT) {
else if(type == H5L_TYPE_SOFT) {
/* Soft links only need one location, the new_loc_id, but it's possible that
* new_loc_id is H5L_SAME_LOC */
if(new_loc_id == H5L_SAME_LOC)

View File

@ -183,11 +183,6 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
UINT32DECODE (*pp, ent->cache.slink.lval_offset);
break;
case H5G_CACHED_ULINK:
UINT32DECODE (*pp, ent->cache.ulink.udata_size);
UINT32DECODE (*pp, ent->cache.ulink.udata_offset);
UINT32DECODE (*pp, ent->cache.ulink.link_type);
break;
default:
/* Error or unknown type. Bail out. */
return -1;
@ -302,12 +297,6 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
UINT32ENCODE (*pp, ent->cache.slink.lval_offset);
break;
case H5G_CACHED_ULINK:
UINT32ENCODE (*pp, ent->cache.ulink.udata_size);
UINT32ENCODE (*pp, ent->cache.ulink.udata_offset);
UINT32ENCODE (*pp, ent->cache.ulink.link_type);
break;
default:
/* Unknown cached type. Bail out. */
return -1;
@ -411,10 +400,8 @@ H5G_ent_reset(H5G_entry_t *ent)
*
* Purpose: Convert a link to a symbol table entry
*
* Return: Success: Non-negative, with *pp pointing to the first byte
* after the last symbol.
*
* Failure: Negative
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@ -450,12 +437,12 @@ H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name, const H5O_link_t
/* Build correct information for symbol table entry based on link type */
switch(lnk->type) {
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
ent->type = H5G_NOTHING_CACHED;
ent->header = lnk->u.hard.addr;
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
{
size_t lnk_offset; /* Offset to sym-link value */
@ -470,24 +457,7 @@ H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name, const H5O_link_t
break;
default:
if(lnk->type < H5L_LINK_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
{
size_t udata_offset = (size_t) (-1); /* Offset to data buffer */
if(lnk->u.ud.size > 0)
{
if((size_t)(-1) == (udata_offset = H5HL_insert(f, dxpl_id,
heap_addr, lnk->u.ud.size, lnk->u.ud.udata)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write user data to local heap")
}
ent->type = H5G_CACHED_ULINK;
ent->cache.ulink.udata_size = lnk->u.ud.size;
ent->cache.ulink.udata_offset = udata_offset;
ent->cache.ulink.link_type = lnk->type;
}
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
} /* end switch */
/* Set the file for the entry */
@ -536,7 +506,7 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
ent->dirty ? "Yes" : "No");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
"Cache info type:");
switch (ent->type) {
switch(ent->type) {
case H5G_NOTHING_CACHED:
HDfprintf(stream, "Nothing Cached\n");
break;
@ -554,88 +524,30 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
break;
case H5G_CACHED_SLINK:
HDfprintf (stream, "Symbolic Link\n");
HDfprintf(stream, "Symbolic Link\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
"Cached information:");
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
HDfprintf(stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"Link value offset:",
(unsigned long)(ent->cache.slink.lval_offset));
if (heap>0 && H5F_addr_defined(heap)) {
if(heap > 0 && H5F_addr_defined(heap)) {
const H5HL_t *heap_ptr;
heap_ptr = H5HL_protect(ent->file, dxpl_id, heap);
lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.slink.lval_offset);
HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"Link value:",
lval);
H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET);
}
} /* end if */
else
HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given, name not displayed!");
break;
case H5G_CACHED_ULINK:
if(ent->cache.ulink.link_type == H5L_LINK_EXTERNAL)
{
HDfprintf (stream, "External Link\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
"Cached information:");
if(ent->cache.ulink.udata_size > 0)
{
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"User data offset:",
(unsigned long)(ent->cache.ulink.udata_offset));
}
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"User data size:",
(unsigned long)(ent->cache.ulink.udata_size));
if (heap>0 && H5F_addr_defined(heap)) {
const H5HL_t *heap_ptr;
char * filename;
char * pathname;
heap_ptr = H5HL_protect(ent->file, dxpl_id, heap);
lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.ulink.udata_offset);
if(H5Lunpack_elink_val(lval, &filename, &pathname) < 0) return FAIL;
HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"External link file name:",
lval);
HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"External link object name:",
pathname);
H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET);
} else {
HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given!");
}
}
else
{
HDfprintf (stream, "User-defined Link\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
"Cached information:");
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"Link class:",
(unsigned long)(ent->cache.ulink.link_type));
if(ent->cache.ulink.udata_size > 0)
{
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"User data offset:",
(unsigned long)(ent->cache.ulink.udata_offset));
}
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"User data size:",
(unsigned long)(ent->cache.ulink.udata_size));
if (heap<=0 || !H5F_addr_defined(heap)) {
HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given!");
}
}
break;
default:
HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type);
break;
}
} /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED);
}

View File

@ -33,15 +33,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#ifdef H5_GROUP_REVISION
/* Private typedefs */
/* Data structure to hold table of links for a group */
typedef struct {
size_t nlinks; /* # of links in table */
H5O_link_t *lnks; /* Pointer to array of links */
} H5G_link_table_t;
/* User data for link message iteration when building link table */
typedef struct {
H5G_link_table_t *ltable; /* Pointer to link table to build */
@ -93,37 +86,9 @@ typedef struct {
/* Private macros */
/* PRIVATE PROTOTYPES */
static int H5G_link_cmp_name(const void *lnk1, const void *lnk2);
static herr_t H5G_link_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
static herr_t H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id,
H5G_link_table_t *ltable);
static herr_t H5G_link_release_table(H5G_link_table_t *ltable);
/*-------------------------------------------------------------------------
* Function: H5G_link_cmp_name
*
* Purpose: Callback routine for comparing two link messages.
*
* Return: An integer less than, equal to, or greater than zero if the
* first argument is considered to be respectively less than,
* equal to, or greater than the second. If two members compare
* as equal, their order in the sorted array is undefined.
* (i.e. same as strcmp())
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Sep 5 2005
*
*-------------------------------------------------------------------------
*/
static int
H5G_link_cmp_name(const void *lnk1, const void *lnk2)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_link_cmp_name)
FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
} /* end H5G_link_cmp_name() */
const H5O_linfo_t *linfo, H5_iter_order_t order, H5G_link_table_t *ltable);
/*-------------------------------------------------------------------------
@ -181,23 +146,21 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, H5G_link_table_t *ltable)
H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
H5_iter_order_t order, H5G_link_table_t *ltable)
{
H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_link_build_table)
/* Sanity check */
HDassert(oloc);
/* Retrieve the link info */
if(NULL == H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
HDassert(linfo);
HDassert(ltable);
/* Set size of table */
H5_CHECK_OVERFLOW(linfo.nlinks, hsize_t, size_t);
ltable->nlinks = (size_t)linfo.nlinks;
H5_CHECK_OVERFLOW(linfo->nlinks, hsize_t, size_t);
ltable->nlinks = (size_t)linfo->nlinks;
/* Allocate space for the table entries */
if(ltable->nlinks > 0) {
@ -214,8 +177,14 @@ H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, H5G_link_table_t *ltable)
if(H5O_iterate(oloc, H5O_LINK_ID, H5G_link_build_table_cb, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
/* Sort link table (XXX: alphabetically, for now) */
HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_name);
/* Sort link table in correct iteration order */
/* (XXX: by name, currently) */
if(order == H5_ITER_INC)
HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_inc);
else if(order == H5_ITER_INC)
HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_dec);
else
HDassert(order == H5_ITER_NATIVE);
} /* end if */
else
ltable->lnks = NULL;
@ -224,136 +193,189 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_build_table() */
/*-------------------------------------------------------------------------
* Function: H5G_link_release_table
*
* Purpose: Release table containing a list of links for a group
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Sep 6, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_link_release_table(H5G_link_table_t *ltable)
{
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_link_release_table)
/* Sanity check */
HDassert(ltable);
/* Release link info, if any */
if(ltable->nlinks > 0) {
/* Free link message information */
for(u = 0; u < ltable->nlinks; u++)
if(H5O_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message")
/* Free table of links */
H5MM_xfree(ltable->lnks);
} /* end if */
else
HDassert(ltable->lnks == NULL);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_release_table() */
/*-------------------------------------------------------------------------
* Function: H5G_link_convert
*
* Purpose: Converts a group entry into a link object.
* Purpose: Convert a symbol table entry to a link
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Sep 5 2005
* koziol@hdfgroup.org
* Sep 16 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_link_convert(H5O_link_t *lnk, const H5G_entry_t *ent, const H5HL_t *heap,
const char *name)
H5G_link_convert(H5F_t *f, hid_t dxpl_id, H5O_link_t *lnk, haddr_t lheap_addr,
const H5G_entry_t *ent, const char *name)
{
herr_t ret_value = SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_link_convert, FAIL)
/* Check arguments. */
/* check arguments */
HDassert(f);
HDassert(lnk);
HDassert(ent);
HDassert(name);
/* Create link message from object entry */
HDassert(ent->type == H5G_NOTHING_CACHED || ent->type == H5G_CACHED_SLINK
|| ent->type == H5G_CACHED_ULINK);
/* XXX: Set character set & creation time for real? */
/* Set (default) common info for link */
lnk->cset = H5F_CRT_DEFAULT_CSET;
lnk->ctime = 0;
lnk->name = H5MM_xstrdup(name); /* Casting away const OK -QAK */
HDassert(lnk->name);
lnk->corder = 0;
lnk->corder_valid = FALSE; /* Creation order not valid for this link */
lnk->name = H5MM_xstrdup(name);
/* Object is a symbolic or hard link */
switch(ent->type) {
case H5G_NOTHING_CACHED:
lnk->type = H5L_LINK_HARD;
lnk->u.hard.addr = ent->header;
break;
case H5G_CACHED_SLINK:
{
const char *s; /* Pointer to link value in heap */
{
const char *s; /* Pointer to link value */
const H5HL_t *heap; /* Pointer to local heap for group */
lnk->type = H5L_LINK_SOFT;
/* Lock the local heap */
if(NULL == (heap = H5HL_protect(f, dxpl_id, lheap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
s = H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset);
HDassert(s);
s = H5HL_offset_into(f, heap, ent->cache.slink.lval_offset);
/* Copy to link */
lnk->u.soft.name = H5MM_xstrdup(s);
HDassert(lnk->u.soft.name);
}
break;
/* Copy the link value */
lnk->u.soft.name = H5MM_xstrdup(s);
case H5G_CACHED_ULINK:
{
const char *s; /* Pointer to link name in heap */
/* Release the local heap */
if(H5HL_unprotect(f, dxpl_id, heap, lheap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
/* Copy link type and udata size from entry info */
lnk->type = ent->cache.ulink.link_type;
lnk->u.ud.size = ent->cache.ulink.udata_size;
/* Get pointer to udata in heap */
s = H5HL_offset_into(ent->file, heap, ent->cache.ulink.udata_offset);
HDassert(s);
/* Read udata from heap if it exists */
if(lnk->u.ud.size > 0)
{
if(NULL== (lnk->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for user link data")
HDmemcpy(lnk->u.ud.udata, s, lnk->u.ud.size);
}
else
lnk->u.ud.udata = NULL;
}
break;
/* Set link type */
lnk->type = H5L_TYPE_SOFT;
}
break;
default:
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
/* Set address of object */
lnk->u.hard.addr = ent->header;
/* Set link type */
lnk->type = H5L_TYPE_HARD;
break;
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_convert() */
/*-------------------------------------------------------------------------
* Function: H5G_link_copy_file
*
* Purpose: Copy a link and the object it points to from one file to
* another.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Sep 29 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info)
{
H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */
const H5O_link_t *src_lnk = _src_lnk; /* Source link */
hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_link_copy_file, FAIL)
/* check arguments */
HDassert(dst_file);
HDassert(src_lnk);
HDassert(dst_lnk);
HDassert(cpy_info);
/* Expand soft link */
if(H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) {
H5G_stat_t statbuf; /* Information about object pointed to by soft link */
H5G_loc_t grp_loc; /* Group location holding soft link */
H5G_name_t grp_path; /* Path for group holding soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy message")
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
grp_loc.path = &grp_path;
grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
/* Check if the object pointed by the soft link exists in the source file */
/* (It would be more efficient to make a specialized traversal callback,
* but this is good enough for now... -QAK)
*/
if(H5G_get_objinfo(&grp_loc, tmp_src_lnk.u.soft.name, TRUE, &statbuf, dxpl_id) >= 0) {
/* Convert soft link to hard link */
tmp_src_lnk.u.soft.name = H5MM_xfree(tmp_src_lnk.u.soft.name);
tmp_src_lnk.type = H5L_TYPE_HARD;
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
tmp_src_lnk.u.hard.addr = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
#else
tmp_src_lnk.u.hard.addr = statbuf.objno[0];
#endif
src_lnk = &tmp_src_lnk;
} /* end if */
else {
/* Discard any errors from a dangling soft link */
H5E_clear_stack(NULL);
/* Release any information copied for temporary src link */
H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
} /* end else */
} /* end if */
/* Copy src link information to dst link information */
if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, dst_lnk))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy message")
dst_lnk_init = TRUE;
/* Check if object in source group is a hard link & copy it */
if(H5L_TYPE_HARD == src_lnk->type) {
H5O_loc_t new_dst_oloc; /* Copied object location in destination */
H5O_loc_t tmp_src_oloc; /* Temporary object location for source object */
/* Set up copied object location to fill in */
H5O_loc_reset(&new_dst_oloc);
new_dst_oloc.file = dst_file;
/* Build temporary object location for source */
H5O_loc_reset(&tmp_src_oloc);
tmp_src_oloc.file = src_oloc->file;
HDassert(H5F_addr_defined(src_lnk->u.hard.addr));
tmp_src_oloc.addr = src_lnk->u.hard.addr;
/* Copy the shared object from source to destination */
if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy object")
/* Copy new destination object's information for eventual insertion */
dst_lnk->u.hard.addr = new_dst_oloc.addr;
} /* end if */
done:
/* Check if we used a temporary src link */
if(src_lnk != _src_lnk) {
HDassert(src_lnk == &tmp_src_lnk);
H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
} /* end if */
if(ret_value < 0)
if(dst_lnk_init)
H5O_reset(H5O_LINK_ID, dst_lnk);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_copy_file() */
/*-------------------------------------------------------------------------
* Function: H5G_link_insert
@ -396,7 +418,7 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
* Return: Success: Non-negative
* Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Quincey Koziol
@ -405,8 +427,8 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
size_t size, hid_t dxpl_id)
H5G_link_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
const H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
ssize_t ret_value; /* Return value */
@ -417,7 +439,7 @@ H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
HDassert(oloc);
/* Build table of all link messages */
if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
if(H5G_link_build_table(oloc, dxpl_id, linfo, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
@ -438,7 +460,7 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
if(H5G_link_release_table(&ltable) < 0)
if(H5G_obj_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
@ -460,7 +482,8 @@ done:
*-------------------------------------------------------------------------
*/
H5G_obj_t
H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
H5G_link_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
hsize_t idx)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
H5G_obj_t ret_value; /* Return value */
@ -471,7 +494,7 @@ H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HDassert(oloc);
/* Build table of all link messages */
if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
if(H5G_link_build_table(oloc, dxpl_id, linfo, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
/* Check for going out of bounds */
@ -479,11 +502,11 @@ H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
if(ltable.lnks[idx].type == H5L_LINK_SOFT)
if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
ret_value = H5G_LINK;
else if(ltable.lnks[idx].type >= H5L_LINK_UD_MIN)
else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
ret_value = H5G_UDLINK;
else if(ltable.lnks[idx].type == H5L_LINK_HARD){
else if(ltable.lnks[idx].type == H5L_TYPE_HARD){
H5O_loc_t tmp_oloc; /* Temporary object location */
/* Build temporary object location */
@ -501,7 +524,7 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
if(H5G_link_release_table(&ltable) < 0)
if(H5G_obj_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
} /* end if */
@ -540,7 +563,7 @@ H5G_link_remove_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
if(HDstrcmp(lnk->name, udata->name) == 0) {
switch(lnk->type)
{
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
{
H5O_loc_t tmp_oloc; /* Temporary object location */
@ -554,13 +577,13 @@ H5G_link_remove_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
}
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
*(udata->obj_type) = H5G_LINK;
break;
default: /* User-defined link */
if(lnk->type < H5L_LINK_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type");
if(lnk->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
*(udata->obj_type) = H5G_UDLINK;
}
@ -615,7 +638,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_link_iterate
*
* Purpose: Iterate over the objects in a group
* Purpose: Iterate over the links in a group
*
* Return: Non-negative on success/Negative on failure
*
@ -625,8 +648,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
H5G_iterate_t op, void *op_data, hid_t dxpl_id)
H5G_link_iterate(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
H5_iter_order_t order, hid_t gid, hbool_t lib_internal, int skip,
int *last_obj, H5G_link_iterate_t op, void *op_data)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
size_t u; /* Local index variable */
@ -636,24 +660,24 @@ H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
/* Sanity check */
HDassert(oloc);
HDassert(H5I_GROUP == H5I_get_type(gid));
HDassert(last_obj);
HDassert(op);
HDassert(lib_internal || H5I_GROUP == H5I_get_type(gid));
HDassert(op.lib_op);
/* Build table of all link messages */
if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "can't create link message table")
/* Check for going out of bounds */
if(skip > 0 && (size_t)skip >= ltable.nlinks)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5B_ITER_ERROR, "index out of bound")
if(H5G_link_build_table(oloc, dxpl_id, linfo, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Iterate over link messages */
for(u = 0, ret_value = H5B_ITER_CONT; u < ltable.nlinks && !ret_value; u++) {
if(skip > 0)
--skip;
else
ret_value = (op)(gid, ltable.lnks[u].name, op_data);
else {
/* Check for internal callback with link info */
if(lib_internal)
ret_value = (op.lib_op)(&(ltable.lnks[u]), op_data);
else
ret_value = (op.app_op)(gid, ltable.lnks[u].name, op_data);
} /* end else */
/* Increment the number of entries passed through */
/* (whether we skipped them or not) */
@ -668,8 +692,8 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
if(H5G_link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5B_ITER_ERROR, "unable to release link table")
if(H5G_obj_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@ -765,5 +789,4 @@ H5G_link_lookup(H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_lookup() */
#endif /* H5_GROUP_REVISION */

View File

@ -364,7 +364,7 @@ done:
*/
herr_t
H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
hbool_t inc_link, hid_t dxpl_id)
hid_t dxpl_id)
{
H5O_link_t lnk; /* Link for object to insert */
herr_t ret_value = SUCCEED; /* Return value */
@ -376,25 +376,17 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
HDassert(name && *name);
HDassert(obj_loc);
/* "Translate" object location into link object */
lnk.type = H5L_LINK_HARD;
#ifdef H5_HAVE_GETTIMEOFDAY
{
struct timeval now_tv;
HDgettimeofday(&now_tv, NULL);
lnk.ctime = now_tv.tv_sec;
}
#else /* H5_HAVE_GETTIMEOFDAY */
lnk.ctime = HDtime(NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Create link object for the object location */
lnk.type = H5L_TYPE_HARD;
lnk.cset = H5F_CRT_DEFAULT_CSET;
lnk.corder = 0; /* Will be reset if the group is tracking creation order */
lnk.corder_valid = FALSE; /* Indicate that the creation order isn't valid (yet) */
/* Casting away const OK -QAK */
lnk.name = (char *)name;
lnk.u.hard.addr = obj_loc->oloc->addr;
/* Insert new group into current group's symbol table */
if(H5G_obj_insert(grp_loc->oloc, name, &lnk, inc_link, dxpl_id) < 0)
if(H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert object")
/* Set the name of the object location */
@ -404,6 +396,7 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_loc_insert() */
/*-------------------------------------------------------------------------
* Function: H5G_loc_exists

View File

@ -382,18 +382,18 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
if ((buf=H5FL_BLK_MALLOC(symbol_node,size))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for symbol table node");
p=buf;
if (NULL==(sym = H5FL_CALLOC(H5G_node_t)) ||
NULL==(sym->entry=H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f)))))
if(NULL == (sym = H5FL_CALLOC(H5G_node_t)) ||
NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read symbol table node");
/* magic */
if (HDmemcmp(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC))
if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature");
p += 4;
/* version */
if (H5G_NODE_VERS != *p++)
if(H5G_NODE_VERS != *p++)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node version");
/* reserved */
p++;
@ -402,16 +402,16 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
UINT16DECODE(p, sym->nsyms);
/* entries */
if (H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0)
if(H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries");
/* Set return value */
ret_value = sym;
done:
if (buf)
if(buf)
H5FL_BLK_FREE(symbol_node,buf);
if (!ret_value) {
if(!ret_value) {
if (sym)
if(H5G_node_dest(f, sym)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node");
@ -543,7 +543,7 @@ H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf)
p = buf;
/* magic number */
HDmemcpy(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC);
HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC);
p += 4;
/* version number */
@ -717,16 +717,16 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
assert(f);
assert(H5B_INS_FIRST == op);
if (NULL==(sym = H5FL_CALLOC(H5G_node_t)))
if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
size = H5G_node_size(f);
if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space");
sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f)));
if (NULL==sym->entry)
sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)));
if(NULL==sym->entry)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
if (H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node");
/*
* The left and right symbols in an empty tree are both the
@ -734,17 +734,17 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
* allows the comparison functions to work correctly without knowing
* that there are no symbols.
*/
if (lt_key)
if(lt_key)
lt_key->offset = 0;
if (rt_key)
if(rt_key)
rt_key->offset = 0;
done:
if(ret_value<0) {
if(sym!=NULL) {
if(sym->entry!=NULL)
H5FL_SEQ_FREE(H5G_entry_t,sym->entry);
H5FL_FREE(H5G_node_t,sym);
if(ret_value < 0) {
if(sym != NULL) {
if(sym->entry != NULL)
H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
H5FL_FREE(H5G_node_t, sym);
} /* end if */
} /* end if */
@ -793,23 +793,23 @@ H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
assert(rt_key);
/* Get base address of heap */
if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name")
base = H5HL_offset_into(f, heap, 0);
base = H5HL_offset_into(f, heap, (size_t)0);
/* Get pointers to string names */
s1=base+lt_key->offset;
s2=base+rt_key->offset;
s1 = base + lt_key->offset;
s2 = base + rt_key->offset;
/* Set return value */
ret_value = HDstrcmp(s1, s2);
done:
if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name")
FUNC_LEAVE_NOAPI(ret_value);
FUNC_LEAVE_NOAPI(ret_value)
}
@ -854,10 +854,10 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
FUNC_ENTER_NOAPI_NOINIT(H5G_node_cmp3);
/* Get base address of heap */
if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
base = H5HL_offset_into(f, heap, 0);
base = H5HL_offset_into(f, heap, (size_t)0);
/* left side */
s=base+lt_key->offset;
@ -935,7 +935,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name")
base = H5HL_offset_into(f, heap, 0);
base = H5HL_offset_into(f, heap, (size_t)0);
/*
* Binary search.
@ -1048,7 +1048,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
base = H5HL_offset_into(f, heap, 0);
base = H5HL_offset_into(f, heap, (size_t)0);
/*
* Where does the new symbol get inserted? We use a binary search.
@ -1228,7 +1228,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
base = H5HL_offset_into(f, heap, 0);
base = H5HL_offset_into(f, heap, (size_t)0);
/* Find the name with a binary search */
rt = sn->nsyms;
@ -1251,84 +1251,51 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
switch(sn->entry[idx].type)
{
case H5G_CACHED_SLINK:
{
/* Set the type of the link removed */
*(udata->obj_type) = H5G_LINK;
case H5G_CACHED_SLINK:
/* Set the type of the link removed */
*(udata->obj_type) = H5G_LINK;
/* Remove the symbolic link value */
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
/* Remove the symbolic link value */
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset);
if(s) {
len = HDstrlen(s) + 1;
found = 1;
} /* end if */
else
found = 0;
s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset);
if(s) {
len = HDstrlen(s) + 1;
found = 1;
} /* end if */
else
found = 0;
if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
heap = NULL; s = NULL;
if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
heap = NULL; s = NULL;
if(found)
H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
if(found)
H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
H5E_clear_stack(NULL); /* no big deal */
}
break;
H5E_clear_stack(NULL); /* no big deal */
break;
case H5G_CACHED_ULINK:
{
size_t ud_data_size = 0; /* User link data size */
hbool_t ud_data_found; /* Indicate that the link user data was found */
/* Set the type of the link removed */
*(udata->obj_type) = H5G_UDLINK;
/* Remove the link user data from the heap */
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
s = H5HL_offset_into(f, heap, sn->entry[idx].cache.ulink.udata_offset);
if(s)
default:
{
ud_data_found = 1;
ud_data_size = sn->entry[idx].cache.ulink.udata_size;
H5O_loc_t tmp_oloc; /* Temporary object location */
/* Build temporary object location */
tmp_oloc.file = f;
HDassert(H5F_addr_defined(sn->entry[idx].header));
tmp_oloc.addr = sn->entry[idx].header;
/* Get the type of the object */
if((*(udata->obj_type) = H5O_obj_type(&tmp_oloc, dxpl_id)) == H5G_UNKNOWN)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to determine object type")
/* Decrement the reference count, if requested */
if(udata->adj_link)
if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
break;
}
else
ud_data_found = 0;
if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
heap = NULL; s = NULL;
if(ud_data_found)
H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.ulink.udata_offset, ud_data_size);
H5E_clear_stack(NULL); /* no big deal */
}
break;
default:
{
H5O_loc_t tmp_oloc; /* Temporary object location */
/* Build temporary object location */
tmp_oloc.file = f;
HDassert(H5F_addr_defined(sn->entry[idx].header));
tmp_oloc.addr = sn->entry[idx].header;
/* Get the type of the object */
if((*(udata->obj_type) = H5O_obj_type(&tmp_oloc, dxpl_id)) == H5G_UNKNOWN)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to determine object type")
/* Decrement the reference count, if requested */
if(udata->adj_link) {
if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
} /* end if */
}
} /* end switch */
/* Remove the name from the local heap */
@ -1418,8 +1385,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Reduce the link count for all entries in this node */
for(idx = 0; idx < sn->nsyms; idx++) {
if(!(H5G_CACHED_SLINK == sn->entry[idx].type ||
H5G_CACHED_ULINK == sn->entry[idx].type)) {
if(!(H5G_CACHED_SLINK == sn->entry[idx].type)) {
/* Decrement the reference count, if requested */
if(udata->adj_link) {
HDassert(H5F_addr_defined(sn->entry[idx].header));
@ -1471,14 +1437,15 @@ done:
*-------------------------------------------------------------------------
*/
int
H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_it_ud1_t *udata = (H5G_bt_it_ud1_t *)_udata;
H5G_node_t *sn = NULL;
const H5HL_t *heap = NULL;
unsigned nsyms; /* # of symbols in node */
size_t n, *name_off=NULL;
H5G_entry_t *ents = NULL; /* Copy of entries in this node */
size_t n;
const char *name;
char buf[1024], *s;
unsigned u; /* Local index variable */
@ -1497,18 +1464,17 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
* Save information about the symbol table node since we can't lock it
* because we're about to call an application function.
*/
if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node")
nsyms = sn->nsyms;
if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, (size_t)nsyms)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
for(u = 0; u < nsyms; u++)
name_off[u] = sn->entry[u].name_off;
if(NULL == (ents = H5FL_SEQ_MALLOC(H5G_entry_t, (size_t)nsyms)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed")
HDmemcpy(ents, sn->entry, sizeof(H5G_entry_t) * nsyms);
if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
if(H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
}
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
} /* end if */
sn=NULL; /* Make certain future references will be caught */
@ -1516,49 +1482,72 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
* Iterate over the symbol table node entries.
*/
for(u = 0, ret_value = H5B_ITER_CONT; u < nsyms && !ret_value; u++) {
if (udata->skip>0) {
if(udata->skip > 0)
--udata->skip;
} else {
if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name");
else {
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name")
name = H5HL_offset_into(f, heap, name_off[u]);
assert (name);
n = HDstrlen (name);
name = H5HL_offset_into(f, heap, ents[u].name_off);
HDassert(name);
n = HDstrlen(name);
if (n+1>sizeof(buf)) {
if (NULL==(s = H5MM_malloc (n+1)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
} else {
/* Allocate space or point to existing buffer */
if((n + 1) > sizeof(buf)) {
if(NULL == (s = H5MM_malloc(n + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed")
} /* end if */
else
s = buf;
}
HDstrcpy (s, name);
if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
heap=NULL; name=NULL;
/* Make a copy of the name */
HDstrcpy(s, name);
ret_value = (udata->op)(udata->group_id, s, udata->op_data);
if (s!=buf)
H5MM_xfree (s);
}
if(H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
heap = NULL; name = NULL;
/* Check for internal callback with link info */
if(udata->lib_internal) {
H5O_link_t lnk; /* Link for entry */
/* Convert the entry to a link */
if(H5G_link_convert(f, dxpl_id, &lnk, udata->heap_addr, &ents[u], s) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_ITER_ERROR, "unable to convert symbol table entry to link")
/* Call the library's callback */
ret_value = (udata->op.lib_op)(&lnk, udata->op_data);
/* Release memory for link object */
if(H5O_reset(H5O_LINK_ID, &lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, H5B_ITER_ERROR, "unable to release link message")
} /* end if */
else
/* Make the application's callback */
ret_value = (udata->op.app_op)(udata->group_id, s, udata->op_data);
/* Free the memory for the name, if we used a dynamically allocated buffer */
if(s != buf)
H5MM_xfree(s);
} /* end else */
/* Increment the number of entries passed through */
/* (whether we skipped them or not) */
(*udata->final_ent)++;
}
if (ret_value<0)
HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
if(udata->final_ent)
(*udata->final_ent)++;
} /* end for */
if(ret_value < 0)
HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
done:
if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
if(name_off)
H5FL_SEQ_FREE(size_t,name_off);
if(ents)
H5FL_SEQ_FREE(H5G_entry_t, ents);
FUNC_LEAVE_NOAPI(ret_value);
}
@ -1717,23 +1706,19 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
loc_idx = udata->idx - udata->num_objs;
/* Check for a soft link */
switch(sn->entry[loc_idx].type)
{
case H5G_CACHED_SLINK:
udata->type = H5G_LINK;
break;
case H5G_CACHED_ULINK:
udata->type = H5G_UDLINK;
break;
switch(sn->entry[loc_idx].type) {
case H5G_CACHED_SLINK:
udata->type = H5G_LINK;
break;
default:
/* Build temporary object location */
tmp_oloc.file = f;
HDassert(H5F_addr_defined(sn->entry[loc_idx].header));
tmp_oloc.addr = sn->entry[loc_idx].header;
default:
/* Build temporary object location */
tmp_oloc.file = f;
HDassert(H5F_addr_defined(sn->entry[loc_idx].header));
tmp_oloc.addr = sn->entry[loc_idx].header;
udata->type = H5O_obj_type(&tmp_oloc, dxpl_id);
break;
udata->type = H5O_obj_type(&tmp_oloc, dxpl_id);
break;
}
ret_value = H5B_ITER_STOP;
} else {
@ -1747,78 +1732,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5G_node_type() */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5G_node_stab_convert
*
* Purpose: This function gets called when the entries in a group are
* converted from a symbol table to link messages.
*
* Return: 0 if object isn't found in this node; 1 if found;
* Negative on failure
*
* Programmer: Quincey Koziol
* Sep 5, 2005
*
*-------------------------------------------------------------------------
*/
int
H5G_node_stab_convert(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_it_ud4_t *udata = (H5G_bt_it_ud4_t*)_udata;
H5G_node_t *sn = NULL; /* Pointer to symbol table node to operate on */
const H5HL_t *heap = NULL; /* Pointer to local heap for group */
const char *name; /* Pointer to name of link */
const H5G_entry_t *ent; /* Pointer to current entry */
unsigned u; /* Local index variable */
int ret_value = H5B_ITER_CONT;
FUNC_ENTER_NOAPI(H5G_node_stab_convert, H5B_ITER_ERROR)
/* Check arguments. */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(udata);
/* Lock the symbol table node */
if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node")
/* Lock the local heap */
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name")
/* Convert all the entries from this node into link messages */
for(u = 0, ent = sn->entry; u < sn->nsyms; u++, ent++) {
/* Get a pointer to the link's name in the local heap */
name = H5HL_offset_into(f, heap, ent->name_off);
HDassert(name);
/* Check for too many links for link table */
if(udata->nlinks >= udata->max_links)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "too many links for table")
/* Convert entry into link message object */
if(H5G_link_convert(&(udata->lnk_table[udata->nlinks]), ent, heap, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "can't convert entry to link message")
/* Increment number of links stored */
udata->nlinks++;
} /* end for */
done:
if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_node_stab_convert() */
#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
* Function: H5G_node_init
@ -1961,7 +1874,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_it_ud5_t *udata = (H5G_bt_it_ud5_t *)_udata;
H5O_loc_t *parent_src_oloc = udata->src_oloc;
const H5O_loc_t *src_oloc = udata->src_oloc;
H5O_copy_t *cpy_info = udata->cpy_info;
const H5HL_t *heap = NULL;
H5G_node_t *sn = NULL;
@ -1993,87 +1906,73 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* expand soft link */
if(H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) {
H5G_stat_t statbuf; /* Information about object pointed to by soft link */
H5G_loc_t grp_loc; /* Group location for parent of soft link */
H5G_name_t grp_path; /* Path for parent of soft link */
H5G_loc_t grp_loc; /* Group location holding soft link */
H5G_name_t grp_path; /* Path for group holding soft link */
char *link_name; /* Pointer to value of soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
HDmemcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t));
src_ent = &tmp_src_ent;
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
grp_loc.path = &grp_path;
grp_loc.oloc = parent_src_oloc;
grp_loc.oloc = (H5O_loc_t *)src_oloc;
/* Get pointer to link value in local heap */
link_name = (char *)H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset);
link_name = (char *)H5HL_offset_into(f, heap, tmp_src_ent.cache.slink.lval_offset);
/* Check if the object pointed by the soft link exists in the source file */
/* (It would be more efficient to make a specialized traversal callback,
* but this is good enough for now... -QAK)
*/
if(H5G_get_objinfo(&grp_loc, link_name, TRUE, &statbuf, H5AC_ind_dxpl_id) >= 0) {
if(H5G_get_objinfo(&grp_loc, link_name, TRUE, &statbuf, dxpl_id) >= 0) {
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
src_ent->header = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
tmp_src_ent.header = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
#else
src_ent->header = statbuf.objno[0];
tmp_src_ent.header = statbuf.objno[0];
#endif
src_ent = &tmp_src_ent;
} /* end if */
else
H5E_clear_stack(NULL); /* discard any errors from a dangling soft link */
} /* if ((H5G_CACHED_SLINK == src_ent->type)... */
/* Check if object in source group is a hard link */
if(H5F_addr_defined(src_ent->header)) {
H5O_loc_t new_oloc; /* Copied object object location */
H5O_loc_t src_oloc; /* Temporary object location for source object */
H5O_loc_t new_dst_oloc; /* Copied object location in destination */
H5O_loc_t tmp_src_oloc; /* Temporary object location for source object */
/* Set up copied object location to fill in */
H5O_loc_reset(&new_oloc);
new_oloc.file = udata->dst_file;
H5O_loc_reset(&new_dst_oloc);
new_dst_oloc.file = udata->dst_file;
/* Build temporary object location for source */
src_oloc.file = f;
HDassert(H5F_addr_defined(src_ent->header));
src_oloc.addr = src_ent->header;
H5O_loc_reset(&tmp_src_oloc);
tmp_src_oloc.file = f;
tmp_src_oloc.addr = src_ent->header;
/* Copy the shared object from source to destination */
if(H5O_copy_header_map(&src_oloc, &new_oloc, dxpl_id, cpy_info, TRUE) < 0)
if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B_ITER_ERROR, "unable to copy object")
/* Construct link information for eventual insertion */
lnk.type = H5L_LINK_HARD;
lnk.u.hard.addr = new_oloc.addr;
lnk.type = H5L_TYPE_HARD;
lnk.u.hard.addr = new_dst_oloc.addr;
} /* ( H5F_addr_defined(src_ent->header)) */
else if(H5G_CACHED_SLINK == src_ent->type) {
/* it is a soft link */
/* Construct link information for eventual insertion */
lnk.type = H5L_LINK_SOFT;
lnk.type = H5L_TYPE_SOFT;
lnk.u.soft.name = H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset);
} /* else if */
else if(H5G_CACHED_ULINK == src_ent->type) {
/* user-defined link */
/* Construct link information for eventual insertion */
lnk.type = src_ent->cache.ulink.link_type;
lnk.u.ud.size = src_ent->cache.ulink.udata_size;
lnk.u.ud.udata = H5HL_offset_into(f, heap, src_ent->cache.ulink.udata_offset);
} /* else if */
else
HDassert(0 && "Unknown entry type");
/* Set up common link data */
#ifdef H5_HAVE_GETTIMEOFDAY
{
struct timeval now_tv;
HDgettimeofday(&now_tv, NULL);
lnk.ctime = now_tv.tv_sec;
}
#else /* H5_HAVE_GETTIMEOFDAY */
lnk.ctime = HDtime(NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
lnk.cset = H5F_CRT_DEFAULT_CSET; /* XXX: Allow user to set this */
lnk.corder = 0; /* Creation order is not tracked for old-style links */
lnk.corder_valid = FALSE; /* Creation order is not valid */
/* lnk.name = name; */ /* This will be set in callback */
/* Determine name of source object */

File diff suppressed because it is too large Load Diff

View File

@ -81,9 +81,7 @@ htri_t
H5O_group_isa(struct H5O_t *oh)
{
htri_t stab_exists; /* Whether the 'stab' message is in the object header */
#ifdef H5_GROUP_REVISION
htri_t linfo_exists; /* Whether the 'linfo' message is in the object header */
#endif /* H5_GROUP_REVISION */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_group_isa)
@ -93,16 +91,10 @@ H5O_group_isa(struct H5O_t *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")
#ifdef H5_GROUP_REVISION
if((linfo_exists = H5O_exists_oh(oh, H5O_LINFO_ID, 0)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
#endif /* H5_GROUP_REVISION */
#ifdef H5_GROUP_REVISION
ret_value = (stab_exists > 0 || linfo_exists > 0);
#else /* H5_GROUP_REVISION */
ret_value = stab_exists > 0;
#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -32,13 +32,13 @@
/* Other private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5B2private.h" /* v2 B-trees */
#include "H5HFprivate.h" /* Fractal heaps */
#include "H5Oprivate.h" /* Object headers */
#include "H5SLprivate.h" /* Skip lists */
#define H5G_SIZE_HINT 256 /* default root grp size hint */
/* H5G_NLINKS is deprecated */
#define H5G_NLINKS H5L_NLINKS_DEF
/* Standard length of fractal heap ID for link */
#define H5G_DENSE_FHEAP_ID_LEN 7
/*
* Various types of object header information can be cached in a symbol
@ -51,9 +51,8 @@ typedef enum H5G_type_t {
H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
H5G_CACHED_STAB = 1, /*symbol table, `stab' */
H5G_CACHED_SLINK = 2, /*symbolic link */
H5G_CACHED_ULINK = 3, /*user-defined link */
H5G_NCACHED = 4 /*THIS MUST BE LAST */
H5G_NCACHED /*THIS MUST BE LAST */
} H5G_type_t;
/*
@ -72,12 +71,6 @@ typedef union H5G_cache_t {
struct {
size_t lval_offset; /*link value offset */
} slink;
struct {
size_t udata_size; /*size of user data buffer */
size_t udata_offset; /*link's user data buffer */
H5L_link_t link_type; /*link type ID */
} ulink;
} H5G_cache_t;
/*
@ -113,6 +106,15 @@ struct H5G_t {
H5G_name_t path; /* Group hierarchy path */
};
/* Link iteration operator for internal library callbacks */
typedef herr_t (*H5G_lib_iterate_t)(const H5O_link_t *lnk, void *op_data);
/* Some syntactic sugar to make the compiler happy with two different kinds of iterator callbacks */
typedef union {
H5G_iterate_t app_op; /* Application callback for each link */
H5G_lib_iterate_t lib_op; /* Library internal callback for each link */
} H5G_link_iterate_t;
/*
* Common data exchange structure for symbol table nodes. This structure is
* passed through the B-link tree layer to the methods for the objects
@ -182,9 +184,10 @@ typedef struct H5G_bt_it_ud1_t {
/* downward */
hid_t group_id; /*group id to pass to iteration operator */
haddr_t heap_addr; /*symbol table heap address */
H5G_iterate_t op; /*iteration operator */
H5G_link_iterate_t op; /*iteration operator */
void *op_data; /*user-defined operator data */
int skip; /*initial entries to skip */
hbool_t lib_internal; /* Callback is library internal */
/* upward */
int *final_ent; /*final entry looked at */
@ -233,13 +236,48 @@ typedef struct H5G_bt_it_ud4_t {
/* Data passed to B-tree iteration for copying copy symblol table content */
typedef struct H5G_bt_it_ud5_t {
H5O_loc_t *src_oloc; /* source object location */
haddr_t src_heap_addr; /* heap address of the source symbol table */
const H5O_loc_t *src_oloc; /* Source object location */
haddr_t src_heap_addr; /* Heap address of the source symbol table */
H5F_t *dst_file; /* File of destination group */
H5O_stab_t *dst_stab; /* symbol table info for destination group */
H5O_stab_t *dst_stab; /* Symbol table message for destination group */
H5O_copy_t *cpy_info; /* Information for copy operation */
} H5G_bt_it_ud5_t;
/* Typedefs for "new format" groups */
/* (fractal heap & v2 B-tree info) */
/* Typedef for native 'name' field index records in the v2 B-tree */
typedef struct H5G_dense_bt2_name_rec_t {
uint32_t hash; /* Hash of 'name' field value */
uint8_t id[H5G_DENSE_FHEAP_ID_LEN]; /* Heap ID for link */
} H5G_dense_bt2_name_rec_t;
/*
* Common data exchange structure for dense link storage. This structure is
* passed through the v2 B-tree layer to the methods for the objects
* to which the v2 B-tree points.
*/
typedef struct H5G_bt2_ud_common_t {
/* downward */
H5F_t *f; /* Pointer to file that fractal heap is in */
hid_t dxpl_id; /* DXPL for operation */
H5HF_t *fheap; /* Fractal heap handle */
const char *name; /* Name of link to compare */
uint32_t name_hash; /* Hash of name of link to compare */
H5B2_found_t found_op; /* Callback when correct link is found */
void *found_op_data; /* Callback data when correct link is found */
} H5G_bt2_ud_common_t;
/*
* Data exchange structure for dense link storage. This structure is
* passed through the v2 B-tree layer when inserting links.
*/
typedef struct H5G_bt2_ud_ins_t {
/* downward */
H5G_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
uint8_t id[H5G_DENSE_FHEAP_ID_LEN]; /* Heap ID of link to insert */
} H5G_bt2_ud_ins_t;
/* Typedef for path traversal operations */
/* grp_loc is the location of the group in which the targeted object is located.
* name is the last component of the object's name
@ -265,6 +303,12 @@ typedef herr_t (*H5G_traverse_t)(H5G_loc_t *grp_loc/*in*/, const char *name,
#define H5G_TARGET_UDLINK 0x0004
#define H5G_CRT_INTMD_GROUP 0x0008
/* Data structure to hold table of links for a group */
typedef struct {
size_t nlinks; /* # of links in table */
H5O_link_t *lnks; /* Pointer to array of links */
} H5G_link_table_t;
/*
* This is the class identifier to give to the B-tree functions.
*/
@ -288,15 +332,17 @@ H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name,
* functions that understand names are exported to the rest of
* the library and appear in H5Gprivate.h.
*/
H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id,
const H5O_ginfo_t *ginfo, H5O_stab_t *stab);
H5_DLL herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link);
H5_DLL herr_t H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip,
int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_iterate(H5O_loc_t *oloc, H5_iter_order_t order,
hid_t gid, hbool_t lib_internal, int skip, int *last_obj,
H5G_link_iterate_t op, void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id);
H5_DLL ssize_t H5G_stab_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
size_t size, hid_t dxpl_id);
@ -323,11 +369,9 @@ H5_DLL herr_t H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name,
H5_DLL herr_t H5G_ent_debug(H5F_t *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream,
int indent, int fwidth, haddr_t heap);
struct H5HL_t; /* defined in H5HLprivate.h */
/* Functions that understand symbol table nodes */
H5_DLL herr_t H5G_node_init(H5F_t *f);
H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
H5_DLL int H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
@ -337,41 +381,60 @@ H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t a
const void *_rt_key, void *_udata);
H5_DLL int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
#ifdef H5_GROUP_REVISION
H5_DLL int H5G_node_stab_convert(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
#endif /* H5_GROUP_REVISION */
/* Functions that understand link messages */
/* forward reference for later use */
struct H5HL_t; /* defined in H5HLprivate.h */
H5_DLL herr_t H5G_link_convert(H5O_link_t *lnk, const H5G_entry_t *ent,
const struct H5HL_t *_heap, const char *name);
H5_DLL herr_t H5G_link_convert(H5F_t *f, hid_t dxpl_id, H5O_link_t *lnk,
haddr_t lheap_addr, const H5G_entry_t *ent, const char *name);
H5_DLL herr_t H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id,
const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk,
H5O_copy_t *cpy_info);
H5_DLL herr_t H5G_link_insert(H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk,
hid_t dxpl_id);
H5_DLL ssize_t H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
size_t size, hid_t dxpl_id);
H5_DLL H5G_obj_t H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx,
hid_t dxpl_id);
H5_DLL ssize_t H5G_link_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
const H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size);
H5_DLL H5G_obj_t H5G_link_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
const H5O_linfo_t *linfo, hsize_t idx);
H5_DLL herr_t H5G_link_remove(const H5O_loc_t *oloc, const char *name,
H5G_obj_t *obj_type, hid_t dxpl_id);
H5_DLL herr_t H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip,
int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_link_iterate(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
H5_iter_order_t order, hid_t gid, hbool_t lib_internal, int skip,
int *last_obj, H5G_link_iterate_t op, void *op_data);
H5_DLL herr_t H5G_link_lookup(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk, hid_t dxpl_id);
/* Functions that understand "dense" link storage */
H5_DLL herr_t H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
H5_iter_order_t order, H5G_link_table_t *ltable);
H5_DLL herr_t H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo);
H5_DLL herr_t H5G_dense_insert(H5F_t *f, hid_t dxpl_id,
const H5O_linfo_t *linfo, const H5O_link_t *lnk);
H5_DLL herr_t H5G_dense_lookup(H5F_t *f, hid_t dxpl_id,
const H5O_linfo_t *linfo, const char *name, H5O_link_t *lnk);
H5_DLL herr_t H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, H5_iter_order_t order,
hid_t gid, const H5O_linfo_t *linfo, hbool_t lib_internal, int skip,
int *last_lnk, H5G_link_iterate_t op, void *op_data);
H5_DLL ssize_t H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id,
H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size);
H5_DLL H5G_obj_t H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id,
H5O_linfo_t *linfo, hsize_t idx);
H5_DLL herr_t H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
const char *name, H5G_obj_t *obj_type);
H5_DLL herr_t H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
hbool_t adj_link);
/* Functions that understand objects */
H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id,
#ifdef H5_GROUP_REVISION
H5O_ginfo_t *ginfo,
#endif /* H5_GROUP_REVISION */
H5_DLL int H5G_obj_cmp_name_inc(const void *lnk1, const void *lnk2);
H5_DLL int H5G_obj_cmp_name_dec(const void *lnk1, const void *lnk2);
H5_DLL herr_t H5G_obj_release_table(H5G_link_table_t *ltable);
H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5O_loc_t *oloc/*out*/);
H5_DLL herr_t H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *obj_lnk, hbool_t inc_link, hid_t dxpl_id);
H5O_link_t *obj_lnk, hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_iterate(hid_t loc_id, const char *name, int skip,
int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_iterate(hid_t loc_id, const char *name,
H5_iter_order_t order, int skip, int *last_obj, H5G_iterate_t op,
void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id);
H5_DLL ssize_t H5G_obj_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx,
char* name, size_t size, hid_t dxpl_id);
@ -394,7 +457,7 @@ H5_DLL herr_t H5G_name_set(H5G_name_t *loc, H5G_name_t *obj, const char *name);
*/
H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, H5G_loc_t *src, H5_copy_depth_t depth);
H5_DLL herr_t H5G_loc_insert(H5G_loc_t *grp_loc, const char *name,
H5G_loc_t *obj_loc, hbool_t inc_link, hid_t dxpl_id);
H5G_loc_t *obj_loc, hid_t dxpl_id);
H5_DLL herr_t H5G_loc_exists(const H5G_loc_t *loc, const char *name, hid_t dxpl_id);
H5_DLL herr_t H5G_loc_remove(H5G_loc_t *grp_loc, const char *name,
H5G_loc_t *obj_loc, hid_t dxpl_id);
@ -404,6 +467,7 @@ H5_DLL herr_t H5G_loc_remove(H5G_loc_t *grp_loc, const char *name,
H5_DLL htri_t H5G_is_empty_test(hid_t gid);
H5_DLL htri_t H5G_has_links_test(hid_t gid, unsigned *nmsgs);
H5_DLL htri_t H5G_has_stab_test(hid_t gid);
H5_DLL htri_t H5G_is_new_dense_test(hid_t gid);
H5_DLL herr_t H5G_lheap_size_test(hid_t gid, size_t *lheap_size);
H5_DLL herr_t H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *user_path_hidden);
#endif /* H5G_TESTING */

View File

@ -58,8 +58,24 @@
/* ========= Group Creation properties ============ */
/* Defaults for link info values */
#define H5G_CRT_LINFO_NLINKS 0
#define H5G_CRT_LINFO_MIN_CORDER 0
#define H5G_CRT_LINFO_MAX_CORDER 0
#define H5G_CRT_LINFO_LINK_FHEAP_ADDR HADDR_UNDEF
#define H5G_CRT_LINFO_NAME_BT2_ADDR HADDR_UNDEF
#define H5G_CRT_LINFO_CORDER_BT2_ADDR HADDR_UNDEF
#define H5G_CRT_LINK_INFO_DEF {H5G_CRT_LINFO_NLINKS, \
H5G_CRT_LINFO_MIN_CORDER, \
H5G_CRT_LINFO_MAX_CORDER, \
H5G_CRT_LINFO_LINK_FHEAP_ADDR, \
H5G_CRT_LINFO_NAME_BT2_ADDR, \
H5G_CRT_LINFO_CORDER_BT2_ADDR}
/* Defaults for group info values */
#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
#define H5G_CRT_GINFO_TRACK_CORDER FALSE
#define H5G_CRT_GINFO_INDEX_CORDER FALSE
#define H5G_CRT_GINFO_MAX_COMPACT 8
#define H5G_CRT_GINFO_MIN_DENSE 6
#define H5G_CRT_GINFO_EST_NUM_ENTRIES 4
@ -69,6 +85,8 @@
#define H5G_CRT_GROUP_INFO_NAME "group info"
#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
#define H5G_CRT_GROUP_INFO_DEF {H5G_CRT_GINFO_LHEAP_SIZE_HINT, \
H5G_CRT_GINFO_TRACK_CORDER, \
H5G_CRT_GINFO_INDEX_CORDER, \
H5G_CRT_GINFO_MAX_COMPACT, \
H5G_CRT_GINFO_MIN_DENSE, \
H5G_CRT_GINFO_EST_NUM_ENTRIES, \

View File

@ -100,11 +100,9 @@ H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name,
const char *comment);
H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
char *buf);
#ifdef H5_GROUP_REVISION
H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, hid_t gcpl_id,
hid_t gapl_id);
H5_DLL hid_t H5Gget_create_plist(hid_t group_id);
#endif /* H5_GROUP_REVISION */
H5_DLL herr_t H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
@ -112,22 +110,22 @@ H5_DLL herr_t H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
* of the HDF5 API.
* Use of these functions and variables is depreciated.
*/
H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_link_t type,
H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type,
const char *cur_name, const char *new_name);
H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name,
const char *dst_name);
H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name,
H5L_link_t type, hid_t new_loc_id, const char *new_name);
H5L_type_t type, hid_t new_loc_id, const char *new_name);
H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name,
hid_t dst_loc_id, const char *dst_name);
H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name,
size_t size, char *buf/*out*/);
#define H5G_LINK_ERROR H5L_LINK_ERROR
#define H5G_LINK_HARD H5L_LINK_HARD
#define H5G_LINK_SOFT H5L_LINK_SOFT
#define H5G_link_t H5L_link_t
#define H5G_LINK_ERROR H5L_TYPE_ERROR
#define H5G_LINK_HARD H5L_TYPE_HARD
#define H5G_LINK_SOFT H5L_TYPE_SOFT
#define H5G_link_t H5L_type_t
#define H5G_SAME_LOC H5L_SAME_LOC
@ -136,4 +134,3 @@ H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name,
#endif
#endif

View File

@ -155,12 +155,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id)
H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5O_stab_t *stab)
{
#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info message */
size_t heap_hint; /* Local heap size hint */
#endif /* H5_GROUP_REVISION */
size_t size_hint; /* Local heap size hint */
herr_t ret_value = SUCCEED; /* Return value */
@ -172,21 +170,16 @@ H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id)
HDassert(grp_oloc);
HDassert(stab);
#ifdef H5_GROUP_REVISION
/* Get the group info */
if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
/* Adjust the size hint, if necessary */
if(ginfo.lheap_size_hint == 0)
heap_hint = ginfo.est_num_entries * (ginfo.est_name_len + 1);
if(ginfo->lheap_size_hint == 0)
heap_hint = 8 + /* "null" name inserted for B-tree */
(ginfo->est_num_entries * H5HL_ALIGN(ginfo->est_name_len + 1)) + /* estimated size of names for links, aligned for inserting into local heap */
H5HL_SIZEOF_FREE(grp_oloc->file); /* Free list entry in local heap */
else
heap_hint = ginfo.lheap_size_hint;
heap_hint = ginfo->lheap_size_hint;
size_hint = MAX(heap_hint, H5HL_SIZEOF_FREE(grp_oloc->file) + 2);
#else /* H5_GROUP_REVISION */
size_hint = 4 * (H5HL_SIZEOF_FREE(grp_oloc->file) + 2);
#endif /* H5_GROUP_REVISION */
/* Go create the B-tree & local heap */
if(H5G_stab_create_components(grp_oloc->file, stab, size_hint, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components")
@ -363,11 +356,11 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_lin
udata.adj_link = adj_link;
/* Delete entire B-tree */
if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata)<0)
if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree");
/* Delete local heap for names */
if(H5HL_delete(f, dxpl_id, stab->heap_addr)<0)
if(H5HL_delete(f, dxpl_id, stab->heap_addr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap");
done:
@ -388,8 +381,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
H5G_iterate_t op, void *op_data, hid_t dxpl_id)
H5G_stab_iterate(H5O_loc_t *oloc, H5_iter_order_t order, hid_t gid,
hbool_t lib_internal, int skip, int *last_lnk, H5G_link_iterate_t op,
void *op_data, hid_t dxpl_id)
{
H5G_bt_it_ud1_t udata; /* User data to pass to B-tree callback */
H5O_stab_t stab; /* Info about symbol table */
@ -399,26 +393,34 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
/* Sanity check */
HDassert(oloc);
HDassert(H5I_GROUP == H5I_get_type(gid));
HDassert(last_obj);
HDassert(op);
HDassert(lib_internal || H5I_GROUP == H5I_get_type(gid));
HDassert(op.lib_op);
/* Get the B-tree info */
if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
udata.group_id = gid;
udata.skip = skip;
udata.heap_addr = stab.heap_addr;
udata.op = op;
udata.op_data = op_data;
udata.final_ent = last_obj;
/* Check on iteration order */
/* ("native" iteration order is increasing for this link storage mechanism) */
if(order != H5_ITER_DEC) {
/* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
udata.group_id = gid;
udata.skip = skip;
udata.heap_addr = stab.heap_addr;
udata.lib_internal = lib_internal;
udata.op = op;
udata.op_data = op_data;
udata.final_ent = last_lnk;
/* Iterate over the group members */
if((ret_value = H5B_iterate(oloc->file, H5AC_dxpl_id, H5B_SNODE,
H5G_node_iterate, stab.btree_addr, &udata))<0)
HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
/* Iterate over the group members */
if((ret_value = H5B_iterate(oloc->file, H5AC_dxpl_id, H5B_SNODE,
H5G_node_iterate, stab.btree_addr, &udata)) < 0)
HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
} /* end if */
else {
HDfprintf(stderr, "%s: Decreasing iteration order for symbol table storage not supported yet!\n", FUNC);
HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "decreasing iteration order for symbol table storage not supported yet")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -428,7 +430,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_stab_count
*
* Purpose: Count the # of objects in a group
* Purpose: Count the # of links in a group
*
* Return: Non-negative on success/Negative on failure
*
@ -470,7 +472,7 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
* Return: Success: Non-negative
* Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Raymond Lu
@ -502,7 +504,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
udata.name = NULL;
/* Iterate over the group members */
if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_name, stab.btree_addr, &udata))<0)
if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_name, stab.btree_addr, &udata)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed")
/* If we don't know the name now, we almost certainly went out of bounds */
@ -603,80 +605,10 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata)
/* Set link info */
if(udata->lnk) {
/* Set (default) common info for link */
udata->lnk->cset = H5F_CRT_DEFAULT_CSET;
udata->lnk->ctime = 0;
udata->lnk->name = H5MM_xstrdup(udata->name);
/* Object is a symbolic or user-defined link */
switch(ent->type)
{
case H5G_CACHED_SLINK:
{
const char *s; /* Pointer to link value */
const H5HL_t *heap; /* Pointer to local heap for group */
/* Lock the local heap */
if(NULL == (heap = H5HL_protect(udata->file, udata->dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
s = H5HL_offset_into(udata->file, heap, ent->cache.slink.lval_offset);
/* Copy the link value */
udata->lnk->u.soft.name = H5MM_xstrdup(s);
/* Release the local heap */
if(H5HL_unprotect(udata->file, udata->dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
/* Set link type */
udata->lnk->type = H5L_LINK_SOFT;
}
break;
case H5G_CACHED_ULINK:
{
void * s; /* Pointer to heap value */
const H5HL_t *heap; /* Pointer to local heap for group */
size_t data_size; /* Size of user link data */
/* Lock the local heap */
if(NULL == (heap = H5HL_protect(udata->file, udata->dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
data_size =ent->cache.ulink.udata_size;
/* If there is user data, allocate space for it and copy it from the heap */
if(data_size > 0)
{
s = H5HL_offset_into(udata->file, heap, ent->cache.ulink.udata_offset);
udata->lnk->u.ud.udata = H5MM_malloc(data_size);
HDmemcpy(udata->lnk->u.ud.udata, s, data_size);
} /* end if */
else
udata->lnk->u.ud.udata = NULL;
/* Release the local heap */
if(H5HL_unprotect(udata->file, udata->dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
{
/* Release allocated memory before exiting */
H5MM_free(udata->lnk->u.ud.udata);
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
}
/* Set link size and type */
udata->lnk->u.ud.size = data_size;
udata->lnk->type = ent->cache.ulink.link_type;
}
break;
default:
/* Set address of object */
udata->lnk->u.hard.addr = ent->header;
/* Set link type */
udata->lnk->type = H5L_LINK_HARD;
} /* end switch */
/* Convert the entry to a link */
if(H5G_link_convert(udata->file, udata->dxpl_id, udata->lnk, udata->heap_addr,
ent, udata->name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link")
} /* end if */
done:
@ -738,4 +670,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_stab_lookup() */

View File

@ -29,7 +29,6 @@
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
#ifdef H5_GROUP_REVISION
/*--------------------------------------------------------------------------
NAME
@ -43,7 +42,7 @@
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
Checks to see if the group has no link messages and no symbol table message
dimensionality and shape.
and no "dense" link storage
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
@ -54,7 +53,8 @@ htri_t
H5G_is_empty_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
htri_t msg_exists = FALSE; /* Indicate that a header message is present */
htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5G_is_empty_test, FAIL)
@ -63,17 +63,79 @@ H5G_is_empty_test(hid_t gid)
if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* "New format" checks */
/* Check if the group has any link messages */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
if(msg_exists > 0) {
/* Sanity check that new group format shouldn't have old messages */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
HGOTO_DONE(FALSE)
} /* end if */
/* Check for a link info message */
if((linfo_exists = H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(linfo_exists > 0) {
H5O_linfo_t linfo; /* Link info message */
/* Sanity check that new group format shouldn't have old messages */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
/* Get the link info */
if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
/* Check for 'dense' link storage file addresses being defined */
if(H5F_addr_defined(linfo.link_fheap_addr))
HGOTO_DONE(FALSE)
if(H5F_addr_defined(linfo.name_bt2_addr))
HGOTO_DONE(FALSE)
if(H5F_addr_defined(linfo.corder_bt2_addr))
HGOTO_DONE(FALSE)
/* Check for link count */
if(linfo.nlinks > 0)
HGOTO_DONE(FALSE)
} /* end if */
/* "Old format" checks */
/* Check if the group has a symbol table message */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_DONE(FALSE)
if(msg_exists > 0) {
H5O_stab_t stab; /* Info about local heap & B-tree */
hsize_t nlinks; /* Number of links in the group */
/* Sanity check that old group format shouldn't have new messages */
if(linfo_exists > 0)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
if((msg_exists = H5O_exists(&(grp->oloc), H5O_GINFO_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found")
/* Get the B-tree & local heap info */
if(NULL == H5O_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message")
/* Get the count of links in the group */
if(H5G_stab_count(&(grp->oloc), &nlinks, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links")
/* Check for link count */
if(nlinks > 0)
HGOTO_DONE(FALSE)
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -185,7 +247,73 @@ H5G_has_stab_test(hid_t gid)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_has_stab_test() */
#endif /* H5_GROUP_REVISION */
/*--------------------------------------------------------------------------
NAME
H5G_is_new_dense_test
PURPOSE
Determine whether a group is in the "new" format and dense
USAGE
htri_t H5G_is_new_dense_test(gid)
hid_t gid; IN: group to check
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
Checks to see if the group is in the "new" format for groups (link messages/
fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has
a name B-tree index).
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
H5G_is_new_dense_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5G_is_new_dense_test, FAIL)
/* Get group structure */
if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Check if the group has a symbol table message */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_DONE(FALSE)
/* Check if the group has any link messages */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0)
HGOTO_DONE(FALSE)
/* Check if the group has link info message */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(msg_exists > 0) {
H5O_linfo_t linfo; /* Link info message */
/* Get the link info */
if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
/* Check for 'dense' link storage file addresses being defined */
if(!H5F_addr_defined(linfo.link_fheap_addr))
HGOTO_DONE(FALSE)
if(!H5F_addr_defined(linfo.name_bt2_addr))
HGOTO_DONE(FALSE)
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_is_new_dense_test() */
/*--------------------------------------------------------------------------

View File

@ -150,7 +150,7 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t lapl_id,
hid_t dxpl_id)
{
const H5L_link_class_t *link_class; /* User-defined link class */
const H5L_class_t *link_class; /* User-defined link class */
hid_t cb_return = -1; /* The ID the user-defined callback returned */
H5G_loc_t grp_loc_copy;
H5G_name_t grp_path_copy;
@ -168,7 +168,7 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
HDassert(lnk->type >= H5L_LINK_UD_MIN);
HDassert(lnk->type >= H5L_TYPE_UD_MIN);
HDassert(obj_loc);
HDassert(nlinks);
@ -310,7 +310,7 @@ H5G_traverse_slink(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
HDassert(lnk->type == H5L_LINK_SOFT);
HDassert(lnk->type == H5L_TYPE_SOFT);
HDassert(nlinks);
/* Set up temporary location */
@ -545,16 +545,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* If there's valid information in the link, reset it */
if(link_valid) {
#ifdef H5_GROUP_REVISION
H5O_reset(H5O_LINK_ID, &lnk);
#else /* H5_GROUP_REVISION */
/* Free information for link (but don't free link pointer) */
if(lnk.type == H5L_LINK_SOFT)
lnk.u.soft.name = H5MM_xfree(lnk.u.soft.name);
else if(lnk.type >= H5L_LINK_UD_MIN && lnk.u.ud.size > 0)
lnk.u.ud.udata = H5MM_xfree(lnk.u.ud.udata);
lnk.name = H5MM_xfree(lnk.name);
#endif /* H5_GROUP_REVISION */
link_valid = FALSE;
} /* end if */
@ -565,8 +556,8 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* If the lookup was OK, try traversing soft links and mount points, if allowed */
if(lookup_status >= 0) {
/* Indicate that the link info is valid */
HDassert(lnk.type >= H5L_LINK_HARD);
if(lnk.type >H5L_LINK_BUILTIN_MAX && lnk.type < H5L_LINK_UD_MIN)
HDassert(lnk.type >= H5L_TYPE_HARD);
if(lnk.type >H5L_TYPE_BUILTIN_MAX && lnk.type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "unknown link type")
link_valid = TRUE;
@ -577,7 +568,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Set the object location, if it's a hard link set the address also */
obj_loc.oloc->file = grp_loc.oloc->file;
obj_loc.oloc->holding_file = FALSE;
if(lnk.type == H5L_LINK_HARD)
if(lnk.type == H5L_TYPE_HARD)
obj_loc.oloc->addr = lnk.u.hard.addr;
obj_loc_valid = TRUE;
@ -586,7 +577,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* is the last component of the name and the H5G_TARGET_SLINK bit of
* TARGET is set then we don't follow it.
*/
if(H5L_LINK_SOFT == lnk.type &&
if(H5L_TYPE_SOFT == lnk.type &&
(0 == (target & H5G_TARGET_SLINK) || !last_comp)) {
if((*nlinks)-- <= 0)
HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links")
@ -599,7 +590,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* is the last component of the name and the H5G_TARGET_UDLINK bit of
* TARGET is set then we don't follow it.
*/
if( lnk.type >= H5L_LINK_UD_MIN && ((0 == (target & H5G_TARGET_UDLINK)) || !last_comp) ) {
if( lnk.type >= H5L_TYPE_UD_MIN && ((0 == (target & H5G_TARGET_UDLINK)) || !last_comp) ) {
if((*nlinks)-- <= 0)
HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links")
if(H5G_traverse_ud(&grp_loc/*in,out*/, &lnk/*in*/, &obj_loc, nlinks, lapl_id, dxpl_id) < 0)
@ -660,26 +651,29 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
if(lookup_status < 0) {
/* If an intermediate group doesn't exist & flag is set, create the group */
if(target & H5G_CRT_INTMD_GROUP) {
#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info message for parent group */
/* Get the group info for parent group */
if(NULL == H5O_read(grp_loc.oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
#endif /* H5_GROUP_REVISION */
/* (OK if not found) */
if(NULL == H5O_read(grp_loc.oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) {
H5O_ginfo_t def_ginfo = H5G_CRT_GROUP_INFO_DEF;
/* Clear error stack from not finding the group info message */
H5E_clear_stack(NULL);
/* Use default group info settings */
HDmemcpy(&ginfo, &def_ginfo, sizeof(H5O_ginfo_t));
} /* end if */
/* Create the intermediate group */
/* XXX: Should we allow user to control the group creation params here? -QAK */
if(H5G_obj_create(grp_oloc.file, dxpl_id,
#ifdef H5_GROUP_REVISION
&ginfo,
#endif /* H5_GROUP_REVISION */
obj_loc.oloc/*out*/) < 0)
if(H5G_obj_create(grp_oloc.file, dxpl_id, &ginfo, obj_loc.oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
/* Insert new group into current group's symbol table */
if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, TRUE, dxpl_id) < 0)
if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group")
/* Close new group */
if(H5O_close(obj_loc.oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close")
@ -742,18 +736,8 @@ done:
H5G_loc_free(&grp_loc);
/* If there's valid information in the link, reset it */
if(link_valid) {
#ifdef H5_GROUP_REVISION
if(link_valid)
H5O_reset(H5O_LINK_ID, &lnk);
#else /* H5_GROUP_REVISION */
/* Free information for link (but don't free link pointer) */
if(lnk.type == H5L_LINK_SOFT)
lnk.u.soft.name = H5MM_xfree(lnk.u.soft.name);
else if(lnk.type >= H5L_LINK_UD_MIN && lnk.u.ud.size > 0)
lnk.u.ud.udata = H5MM_xfree(lnk.u.ud.udata);
lnk.name = H5MM_xfree(lnk.name);
#endif /* H5_GROUP_REVISION */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_real() */

View File

@ -373,7 +373,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
UINT32DECODE(p, hdr->pline_root_direct_filter_mask);
/* Decode I/O filter information */
if(NULL == (pline = H5O_decode(hdr->f, p, H5O_PLINE_ID)))
if(NULL == (pline = H5O_decode(hdr->f, dxpl_id, p, H5O_PLINE_ID)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
p += hdr->filter_len;

View File

@ -42,7 +42,7 @@
/* Private macros */
#define H5HL_FREE_NULL 1 /*end of free list on disk */
#define H5HL_MIN_HEAP 256 /* Minimum size to reduce heap buffer to */
#define H5HL_MIN_HEAP 128 /* Minimum size to reduce heap buffer to */
/*
* Local heap collection version.
@ -343,8 +343,8 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
FUNC_ENTER_NOAPI(H5HL_minimize_heap_space, FAIL)
/* check args */
HDassert( f );
HDassert( heap );
HDassert(f);
HDassert(heap);
sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */
@ -358,12 +358,12 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
H5HL_free_t *last_fl = NULL;
/* Search for a free block at the end of the buffer */
for (tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next)
for(tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next)
/* Check if the end of this free block is at the end of the buffer */
if (tmp_fl->offset + tmp_fl->size == heap->heap_alloc) {
if(tmp_fl->offset + tmp_fl->size == heap->heap_alloc) {
last_fl = tmp_fl;
break;
}
} /* end if */
/*
* Found free block at the end of the buffer, decide what to do
@ -980,16 +980,16 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *
HDassert(buf_size > 0);
HDassert(buf);
if (0==(f->intent & H5F_ACC_RDWR))
HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file");
if(0 == (f->intent & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file")
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap");
if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap")
heap_flags |= H5AC__DIRTIED_FLAG;
/* Cache this for later */
sizeof_hdr= H5HL_SIZEOF_HDR(f);
sizeof_hdr = H5HL_SIZEOF_HDR(f);
/*
* In order to keep the free list descriptors aligned on word boundaries,
@ -1280,21 +1280,21 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
FUNC_ENTER_NOAPI(H5HL_remove, FAIL);
/* check arguments */
HDassert( f );
HDassert( H5F_addr_defined(addr) );
HDassert( size > 0 );
HDassert( offset == H5HL_ALIGN(offset) );
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(size > 0);
HDassert(offset == H5HL_ALIGN(offset));
if (0==(f->intent & H5F_ACC_RDWR))
HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file");
if(0 == (f->intent & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
size = H5HL_ALIGN (size);
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap");
if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap")
HDassert( offset < heap->heap_alloc );
HDassert( offset + size <= heap->heap_alloc );
HDassert(offset < heap->heap_alloc);
HDassert(offset + size <= heap->heap_alloc);
fl = heap->freelist;
heap_flags |= H5AC__DIRTIED_FLAG;
@ -1304,106 +1304,105 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
* free chunk. It might also fall between two chunks in such a way
* that all three chunks can be combined into one.
*/
while (fl) {
if (offset + size == fl->offset) {
while(fl) {
if((offset + size) == fl->offset) {
fl->offset = offset;
fl->size += size;
assert (fl->offset==H5HL_ALIGN (fl->offset));
assert (fl->size==H5HL_ALIGN (fl->size));
HDassert(fl->offset==H5HL_ALIGN (fl->offset));
HDassert(fl->size==H5HL_ALIGN (fl->size));
fl2 = fl->next;
while (fl2) {
if (fl2->offset + fl2->size == fl->offset) {
while(fl2) {
if((fl2->offset + fl2->size) == fl->offset) {
fl->offset = fl2->offset;
fl->size += fl2->size;
assert (fl->offset==H5HL_ALIGN (fl->offset));
assert (fl->size==H5HL_ALIGN (fl->size));
HDassert(fl->offset == H5HL_ALIGN (fl->offset));
HDassert(fl->size == H5HL_ALIGN (fl->size));
fl2 = H5HL_remove_free(heap, fl2);
if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
( (2 * fl->size) > heap->heap_alloc ) ) {
if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
if(((fl->offset + fl->size) == heap->heap_alloc ) &&
((2 * fl->size) > heap->heap_alloc )) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl2 = fl2->next;
}
if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
( (2 * fl->size) > heap->heap_alloc ) ) {
if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0 )
if(((fl->offset + fl->size) == heap->heap_alloc) &&
((2 * fl->size) > heap->heap_alloc)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
} else if (fl->offset + fl->size == offset) {
} else if(fl->offset + fl->size == offset) {
fl->size += size;
fl2 = fl->next;
assert (fl->size==H5HL_ALIGN (fl->size));
while (fl2) {
if (fl->offset + fl->size == fl2->offset) {
HDassert(fl->size==H5HL_ALIGN (fl->size));
while(fl2) {
if(fl->offset + fl->size == fl2->offset) {
fl->size += fl2->size;
assert (fl->size==H5HL_ALIGN (fl->size));
HDassert(fl->size==H5HL_ALIGN (fl->size));
fl2 = H5HL_remove_free(heap, fl2);
if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
( (2 * fl->size) > heap->heap_alloc ) ) {
if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
if(((fl->offset + fl->size) == heap->heap_alloc) &&
((2 * fl->size) > heap->heap_alloc)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl2 = fl2->next;
}
if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
( (2 * fl->size) > heap->heap_alloc ) ) {
if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
if(((fl->offset + fl->size) == heap->heap_alloc) &&
((2 * fl->size) > heap->heap_alloc)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl = fl->next;
}
} /* end while */
/*
* The amount which is being removed must be large enough to
* hold the free list data. If not, the freed chunk is forever
* lost.
*/
if (size < H5HL_SIZEOF_FREE(f)) {
if(size < H5HL_SIZEOF_FREE(f)) {
#ifdef H5HL_DEBUG
if (H5DEBUG(HL)) {
if(H5DEBUG(HL)) {
fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n",
(unsigned long) size);
}
#endif
HGOTO_DONE(SUCCEED);
}
} /* end if */
/*
* Add an entry to the free list.
*/
if (NULL==(fl = H5FL_MALLOC(H5HL_free_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
if(NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
fl->offset = offset;
fl->size = size;
assert (fl->offset==H5HL_ALIGN (fl->offset));
assert (fl->size==H5HL_ALIGN (fl->size));
HDassert(fl->offset == H5HL_ALIGN(fl->offset));
HDassert(fl->size == H5HL_ALIGN(fl->size));
fl->prev = NULL;
fl->next = heap->freelist;
if (heap->freelist)
if(heap->freelist)
heap->freelist->prev = fl;
heap->freelist = fl;
if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
( (2 * fl->size) > heap->heap_alloc ) ) {
if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
if(((fl->offset + fl->size) == heap->heap_alloc) &&
((2 * fl->size) > heap->heap_alloc)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
} /* end if */
done:
if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value);
}
} /* end H5HL_remove() */
/*-------------------------------------------------------------------------

158
src/H5L.c
View File

@ -121,13 +121,13 @@ static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/,
static herr_t H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
const H5O_link_t *lnk, H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
static int H5L_find_class_idx(H5L_link_t id);
static int H5L_find_class_idx(H5L_type_t id);
/* Information about user-defined links */
static size_t H5L_table_alloc_g = 0;
static size_t H5L_table_used_g = 0;
static H5L_link_class_t *H5L_table_g = NULL;
static size_t H5L_table_alloc_g = 0;
static size_t H5L_table_used_g = 0;
static H5L_class_t *H5L_table_g = NULL;
@ -172,7 +172,7 @@ done:
*
* The link class passed in will override any existing link
* class for the specified link class ID. It must at least
* include a H5L_link_class_t version (which should be
* include a H5L_class_t version (which should be
* H5L_LINK_CLASS_T_VERS), a link class ID, and a traversal
* function.
*
@ -184,7 +184,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5Lregister(const H5L_link_class_t *cls)
H5Lregister(const H5L_class_t *cls)
{
herr_t ret_value=SUCCEED; /* Return value */
@ -195,13 +195,13 @@ H5Lregister(const H5L_link_class_t *cls)
if (cls==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
/* Check H5L_link_class_t version number; this is where a function to convert
/* Check H5L_class_t version number; this is where a function to convert
* from an outdated version should be called.
*/
if(cls->version != H5L_LINK_CLASS_T_VERS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_link_class_t version number");
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number");
if (cls->id<H5L_LINK_UD_MIN || cls->id>H5L_LINK_MAX)
if (cls->id<H5L_TYPE_UD_MIN || cls->id>H5L_TYPE_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number")
if (cls->trav_func==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified")
@ -231,7 +231,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
H5L_find_class_idx(H5L_link_t id)
H5L_find_class_idx(H5L_type_t id)
{
size_t i; /* Local index variable */
int ret_value=FAIL; /* Return value */
@ -261,11 +261,11 @@ done:
*
*-------------------------------------------------------------------------
*/
const H5L_link_class_t *
H5L_find_class(H5L_link_t id)
const H5L_class_t *
H5L_find_class(H5L_type_t id)
{
int idx; /* Filter index in global table */
H5L_link_class_t *ret_value=NULL; /* Return value */
H5L_class_t *ret_value=NULL; /* Return value */
FUNC_ENTER_NOAPI(H5L_find_class, NULL)
@ -541,6 +541,8 @@ H5Llink(hid_t new_loc_id, const char *new_name, hid_t obj_id, hid_t lcpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long")
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@ -691,7 +693,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_link_t link_type,
H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc;
@ -856,7 +858,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5Lunregister(H5L_link_t id)
H5Lunregister(H5L_type_t id)
{
herr_t ret_value=SUCCEED; /* Return value */
@ -864,7 +866,7 @@ H5Lunregister(H5L_link_t id)
H5TRACE1("e","Ll",id);
/* Check args */
if (id<0 || id>H5L_LINK_MAX)
if (id<0 || id>H5L_TYPE_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
/* Do it */
@ -891,7 +893,7 @@ done:
*
*-------------------------------------------------------------------------
*/
htri_t H5Lis_registered(H5L_link_t id)
htri_t H5Lis_registered(H5L_type_t id)
{
size_t i; /* Local index variable */
htri_t ret_value=FALSE; /* Return value */
@ -899,7 +901,7 @@ htri_t H5Lis_registered(H5L_link_t id)
FUNC_ENTER_API(H5Lis_registered, FAIL)
/* Check args */
if(id<0 || id>H5L_LINK_MAX)
if(id<0 || id>H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number")
/* Is the link class already registered? */
@ -938,7 +940,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5L_register (const H5L_link_class_t *cls)
H5L_register (const H5L_class_t *cls)
{
size_t i;
herr_t ret_value=SUCCEED; /* Return value */
@ -946,7 +948,7 @@ H5L_register (const H5L_link_class_t *cls)
FUNC_ENTER_NOAPI(H5L_register, FAIL)
assert (cls);
assert (cls->id>=0 && cls->id<=H5L_LINK_MAX);
assert (cls->id>=0 && cls->id<=H5L_TYPE_MAX);
/* Is the link type already registered? */
for (i=0; i<H5L_table_used_g; i++)
@ -957,8 +959,8 @@ H5L_register (const H5L_link_class_t *cls)
if (i>=H5L_table_used_g) {
if (H5L_table_used_g>=H5L_table_alloc_g) {
size_t n = MAX(H5L_MIN_TABLE_SIZE, 2*H5L_table_alloc_g);
H5L_link_class_t *table = H5MM_realloc(H5L_table_g,
n*sizeof(H5L_link_class_t));
H5L_class_t *table = H5MM_realloc(H5L_table_g,
n*sizeof(H5L_class_t));
if (!table)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table")
H5L_table_g = table;
@ -967,12 +969,12 @@ H5L_register (const H5L_link_class_t *cls)
/* Initialize */
i = H5L_table_used_g++;
HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_link_class_t));
HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t));
} /* end if */
/* Filter already registered */
else {
/* Replace old contents */
HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_link_class_t));
HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t));
} /* end else */
done:
@ -995,14 +997,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5L_unregister (H5L_link_t id)
H5L_unregister (H5L_type_t id)
{
size_t i; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5L_unregister,FAIL)
assert (id>=0 && id<=H5L_LINK_MAX);
assert (id>=0 && id<=H5L_TYPE_MAX);
/* Is the filter already registered? */
for (i=0; i<H5L_table_used_g; i++)
@ -1015,7 +1017,7 @@ H5L_unregister (H5L_link_t id)
/* Remove filter from table */
/* Don't worry about shrinking table size (for now) */
HDmemmove(&H5L_table_g[i],&H5L_table_g[i+1],sizeof(H5L_link_class_t)*((H5L_table_used_g-1)-i));
HDmemmove(&H5L_table_g[i],&H5L_table_g[i+1],sizeof(H5L_class_t)*((H5L_table_used_g-1)-i));
H5L_table_used_g--;
done:
@ -1056,7 +1058,7 @@ H5L_link(H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc,
*/
/* Construct link information for eventual insertion */
lnk.type = H5L_LINK_HARD;
lnk.type = H5L_TYPE_HARD;
lnk.u.hard.addr = obj_loc->oloc->addr;
/* Create the link */
@ -1099,7 +1101,7 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name already exists")
/* Check for crossing file boundaries with a new hard link */
if(udata->lnk->type == H5L_LINK_HARD) {
if(udata->lnk->type == H5L_TYPE_HARD) {
/* Check that both objects are in same file */
if(grp_loc->oloc->file->shared != udata->file->shared)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "interfile hard links are not allowed")
@ -1110,22 +1112,18 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
udata->lnk->name = (char *)name;
/* Insert link into group */
if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, (hbool_t)(udata->lnk->type == H5L_LINK_HARD ? TRUE : FALSE), udata->dxpl_id) < 0)
if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object")
/* Set object's path if it has been passed in and is not set */
if(udata->path != NULL && udata->path->user_path_r == NULL)
{
if(H5G_name_set(grp_loc->path, udata->path, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")
}
if(H5G_name_set(grp_loc->path, udata->path, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")
/* If link is a user-defined link, trigger its creation callback if it has one*/
if(udata->lnk->type >= H5L_LINK_UD_MIN)
if(udata->lnk->type >= H5L_TYPE_UD_MIN)
{
const H5L_link_class_t *link_class; /* User-defined link class */
H5O_loc_t temp_oloc;
H5G_name_t temp_path;
const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(udata->lnk->type)))
@ -1133,6 +1131,9 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
if(link_class->create_func != NULL)
{
H5O_loc_t temp_oloc;
H5G_name_t temp_path;
/* Create a temporary location (or else H5G_open will do a shallow
* copy and wipe out grp_loc)
*/
@ -1184,8 +1185,7 @@ done:
* Purpose: Creates a link at a path location
*
* lnk should have linkclass-specific information already
* set, but this function will take care of setting
* creation time and name.
* set, but this function will take care of setting name.
*
* obj_path can be NULL if the object's path doesn't need to
* be set, and obj_file can be NULL if the object is not a
@ -1215,7 +1215,7 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path
HDassert(lnk);
HDassert(link_loc);
HDassert(link_name && *link_name);
HDassert(lnk->type >= H5L_LINK_HARD && lnk->type <= H5L_LINK_MAX);
HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX);
/* Get normalized link name */
if((norm_link_name = H5G_normalize(link_name)) == NULL)
@ -1246,16 +1246,8 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path
/* Fill in common data for the link struct */
lnk->cset = char_encoding;
#ifdef H5_HAVE_GETTIMEOFDAY
{
struct timeval now_tv;
HDgettimeofday(&now_tv, NULL);
lnk->ctime = now_tv.tv_sec;
}
#else /* H5_HAVE_GETTIMEOFDAY */
lnk->ctime = HDtime(NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
lnk->corder = 0; /* Will be re-written during group insertion, if the group is tracking creation order */
lnk->corder_valid = FALSE; /* Creation order not valid (yet) */
/* Set up user data
* file is used to make sure that hard links don't cross files, and
@ -1325,7 +1317,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name")
/* Set up link data specific to hard links */
lnk.type = H5L_LINK_HARD;
lnk.type = H5L_TYPE_HARD;
/* Get object location for object pointed to */
obj_loc.path = &path;
@ -1394,7 +1386,7 @@ H5L_create_soft( const char *target_path, H5G_loc_t *link_loc,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name")
/* Set up link data specific to soft links */
lnk.type = H5L_LINK_SOFT;
lnk.type = H5L_TYPE_SOFT;
lnk.u.soft.name = norm_target;
/* Create actual link to the object */
@ -1426,7 +1418,7 @@ done:
*/
herr_t
H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, const void * ud_data,
size_t ud_data_size, H5L_link_t type, hid_t lcpl_id, hid_t lapl_id,
size_t ud_data_size, H5L_type_t type, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id)
{
H5O_link_t lnk; /* Link to insert */
@ -1435,7 +1427,7 @@ H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, const void * ud_data,
FUNC_ENTER_NOAPI_NOINIT(H5L_create_ud)
/* Check args */
HDassert(type >= H5L_LINK_UD_MIN && type <= H5L_LINK_MAX);
HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX);
HDassert(link_loc);
HDassert(link_name && *link_name);
HDassert(ud_data_size == 0 || ud_data);
@ -1489,7 +1481,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5L_trav_ud5_t *udata = (H5L_trav_ud5_t *)_udata; /* User data passed in */
const H5L_link_class_t *link_class; /* User-defined link class */
const H5L_class_t *link_class; /* User-defined link class */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_linkval_cb)
@ -1498,7 +1490,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
if(lnk == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
if(H5L_LINK_SOFT == lnk->type)
if(H5L_TYPE_SOFT == lnk->type)
{
/* Copy to output buffer */
if(udata->size > 0 && udata->buf) {
@ -1507,7 +1499,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
udata->buf[udata->size - 1] = '\0';
} /* end if */
}
else if(lnk->type >= H5L_LINK_UD_MIN)
else if(lnk->type >= H5L_TYPE_UD_MIN)
{
/* Get the link class for this type of link. It's okay if the class isn't registered, though--we
* just can't give any more information about it */
@ -1607,11 +1599,9 @@ H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "can't delete self")
/* If there is a user-defined callback, call it before deleting the link */
if(lnk->type >= H5L_LINK_UD_MIN)
if(lnk->type >= H5L_TYPE_UD_MIN)
{
const H5L_link_class_t *link_class; /* User-defined link class */
H5O_loc_t temp_oloc;
H5G_name_t temp_path;
const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(lnk->type)))
@ -1619,6 +1609,9 @@ H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
if(link_class->del_func != NULL)
{
H5O_loc_t temp_oloc;
H5G_name_t temp_path;
H5G_name_reset(&temp_path);
if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
@ -1738,7 +1731,7 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "an object with that name already exists")
/* Check for crossing file boundaries with a new hard link */
if(udata->lnk->type == H5L_LINK_HARD) {
if(udata->lnk->type == H5L_TYPE_HARD) {
/* Check that both objects are in same file */
if(grp_loc->oloc->file->shared != udata->file->shared)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
@ -1747,19 +1740,16 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
/* Give the object its new name */
/* Casting away const okay -JML */
HDassert(udata->lnk->name == NULL);
/* JAMES udata->lnk->name = H5MM_xfree(udata->lnk->name); */
udata->lnk->name= (char *)name;
udata->lnk->name = (char *)name;
/* Insert the link into the group */
if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, (hbool_t)(udata->lnk->type == H5L_LINK_HARD ? TRUE : FALSE), udata->dxpl_id) < 0)
if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
/* If the link was a user-defined link, call its move callback if it has one */
if(udata->lnk->type >= H5L_LINK_UD_MIN)
if(udata->lnk->type >= H5L_TYPE_UD_MIN)
{
const H5L_link_class_t *link_class; /* User-defined link class */
H5O_loc_t temp_oloc;
H5G_name_t temp_path;
const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(udata->lnk->type)))
@ -1767,6 +1757,9 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
if((!udata->copy && link_class->move_func != NULL) || (udata->copy && link_class->move_func))
{
H5O_loc_t temp_oloc;
H5G_name_t temp_path;
/* Create a temporary location (or else H5G_open will do a shallow
* copy and wipe out grp_loc)
*/
@ -1860,23 +1853,23 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
/* Get object type */
switch(lnk->type) {
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
if(H5G_UNKNOWN == (type = H5O_obj_type(obj_loc->oloc, udata->dxpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object type to move")
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
type = H5G_LINK;
break;
default:
if(lnk->type < H5L_LINK_UD_MIN)
if(lnk->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unrecognized link type")
type = H5G_UDLINK;
} /* end switch */
/* Set up user data for move_dest_cb */
if((udata_out.lnk = H5O_link_copy(lnk, NULL, 0)) == NULL)
if((udata_out.lnk = H5O_copy(H5O_LINK_ID, lnk, NULL)) == NULL)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved");
/* In this special case, the link's name is going to be replaced at its
* destination, so we should free it here.
@ -1922,9 +1915,9 @@ done:
*/
if(link_copied)
{
if(udata_out.lnk->type == H5L_LINK_SOFT)
if(udata_out.lnk->type == H5L_TYPE_SOFT)
udata_out.lnk->u.soft.name = H5MM_xfree(udata_out.lnk->u.soft.name);
else if(udata_out.lnk->type >= H5L_LINK_UD_MIN && udata_out.lnk->u.ud.size > 0)
else if(udata_out.lnk->type >= H5L_TYPE_UD_MIN && udata_out.lnk->u.ud.size > 0)
udata_out.lnk->u.ud.udata = H5MM_xfree(udata_out.lnk->u.ud.udata);
/* JAMES: the dest_cb already frees the link name. Hmm. */
H5MM_xfree(udata_out.lnk);
@ -2048,7 +2041,7 @@ H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const
{
H5L_trav_ud1_t *udata = (H5L_trav_ud1_t *)_udata; /* User data passed in */
H5L_linkinfo_t *linfo = udata->linfo;
const H5L_link_class_t *link_class; /* User-defined link class */
const H5L_class_t *link_class; /* User-defined link class */
ssize_t cb_ret; /* Return value from UD callback */
herr_t ret_value = SUCCEED; /* Return value */
@ -2062,21 +2055,22 @@ H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const
if(linfo)
{
linfo->cset = lnk->cset;
linfo->ctime = lnk->ctime;
linfo->linkclass = lnk->type;
linfo->corder = lnk->corder;
linfo->corder_valid = lnk->corder_valid;
linfo->type = lnk->type;
switch(lnk->type)
{
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
linfo->u.address = lnk->u.hard.addr;
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
linfo->u.link_size = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/
break;
default:
if(lnk->type < H5L_LINK_UD_MIN || lnk->type > H5L_LINK_MAX)
if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unknown link class")
/* User-defined link; call its query function to get the link udata size. */

View File

@ -32,9 +32,9 @@ static ssize_t H5L_extern_query(const char UNUSED * link_name, void * udata,
size_t udata_size, void * buf /*out*/, size_t buf_size);
/* Default External Link link class */
const H5L_link_class_t H5L_EXTERN_LINK_CLASS[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
H5L_LINK_EXTERNAL, /* Link type id number */
const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
H5L_TYPE_EXTERNAL, /* Link type id number */
"external_link", /* Link name for debugging */
NULL, /* Creation callback */
NULL, /* Move callback */
@ -243,7 +243,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HDstrcpy(temp_name + (HDstrlen(file_name) + 1), obj_name);
/* Create an external link */
if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_LINK_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:

View File

@ -35,7 +35,7 @@
/******************************/
H5_DLL herr_t H5L_create_ud(H5G_loc_t *link_loc, const char *link_name,
const void * ud_data, size_t ud_data_size, H5L_link_t type,
const void * ud_data, size_t ud_data_size, H5L_type_t type,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id);

View File

@ -53,9 +53,9 @@ H5_DLL herr_t H5L_init(void);
H5_DLL herr_t H5L_register_external(void);
/* User-defined link functions */
H5_DLL herr_t H5L_register (const H5L_link_class_t *cls);
H5_DLL herr_t H5L_unregister (H5L_link_t id);
H5_DLL const H5L_link_class_t *H5L_find_class(H5L_link_t id);
H5_DLL herr_t H5L_register(const H5L_class_t *cls);
H5_DLL herr_t H5L_unregister(H5L_type_t id);
H5_DLL const H5L_class_t *H5L_find_class(H5L_type_t id);
#endif /* _H5Lprivate_H */

View File

@ -34,28 +34,34 @@
extern "C" {
#endif
/* Link classes.
/* Maximum length of a link's name */
/* (encoded in a 32-bit unsigned integer) */
#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
/* Link class types.
* Values less than 64 are reserved for the HDF5 library's internal use.
* Values 64 to 255 are for "user-defined" link types; these types are
* Values 64 to 255 are for "user-defined" link class types; these types are
* defined by HDF5 but their behavior can be overridden by users.
* Users who want to create new classes of links should contact the HDF5
* development team at hdfhelp@ncsa.uiuc.edu .
* These values can never change because they appear in HDF5 files.
*/
typedef int H5L_link_t;
#define H5L_LINK_ERROR (-1)
#define H5L_LINK_HARD 0
#define H5L_LINK_SOFT 1
#define H5L_LINK_BUILTIN_MAX H5L_LINK_SOFT /* Maximum value link value for "built-in" link types */
#define H5L_LINK_UD_MIN 64 /*link ids at or above this value are "user-defined" link types. */
#define H5L_LINK_EXTERNAL 64
#define H5L_LINK_MAX 255 /*maximum link id */
typedef enum {
H5L_TYPE_ERROR = (-1), /* Invalid link type id */
H5L_TYPE_HARD = 0, /* Hard link id */
H5L_TYPE_SOFT = 1, /* Soft link id */
H5L_TYPE_EXTERNAL = 64, /* External link id */
H5L_TYPE_MAX = 255 /* Maximum link type id */
} H5L_type_t;
#define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT /* Maximum value link value for "built-in" link types */
#define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL /* Link ids at or above this value are "user-defined" link types. */
/* Metadata buffer for user query function */
typedef struct H5L_linkinfo_t {
typedef struct {
H5T_cset_t cset; /* Character set of link name */
time_t ctime; /* Creation time */
H5L_link_t linkclass; /* Type of link */
int64_t corder; /* Creation order */
hbool_t corder_valid; /* Indicate if creation order is valid */
H5L_type_t type; /* Type of link */
union {
haddr_t address; /* Address hard link points to */
size_t link_size; /* Size of a soft link or UD link */
@ -64,11 +70,11 @@ typedef struct H5L_linkinfo_t {
#define H5L_SAME_LOC 0
/* The H5L_link_class_t struct can be used to override the behavior of a
/* The H5L_class_t struct can be used to override the behavior of a
* "user-defined" link class. Users should populate the struct with callback
* functions defined below.
*/
/* Current version of the H5L_link_class_t struct */
/* Current version of the H5L_class_t struct */
#define H5L_LINK_CLASS_T_VERS (0)
/* Callback prototypes for user-defined links */
@ -78,11 +84,11 @@ typedef herr_t (*H5L_create_func_t)(const char * link_name, hid_t loc_group, voi
/* Callback for when the link is moved */
typedef herr_t (*H5L_move_func_t)(const char * new_name, hid_t new_loc, void * udata, size_t udata_size);
/* Callback for when the link is moved */
/* Callback for when the link is copied */
typedef herr_t (*H5L_copy_func_t)(const char * new_name, hid_t new_loc, void * udata, size_t udata_size);
/* The actual link function, called during traversal */
typedef herr_t (*H5L_func_t)(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id);
/* Callback during link traversal */
typedef herr_t (*H5L_traverse_func_t)(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id);
/* Callback for when the link is deleted */
typedef herr_t (*H5L_delete_func_t)(const char * link_name, hid_t loc_group, void * udata, size_t udata_size);
@ -92,17 +98,17 @@ typedef herr_t (*H5L_delete_func_t)(const char * link_name, hid_t loc_group, voi
typedef ssize_t (*H5L_query_func_t)(const char * link_name, void * udata, size_t udata_size, void * buf /*out*/, size_t buf_size);
/* User-defined link types */
typedef struct H5L_link_class_t {
typedef struct {
int version; /* Version number of this struct */
H5L_link_t id; /* Link type ID */
H5L_type_t id; /* Link type ID */
const char *comment; /* Comment for debugging */
H5L_create_func_t create_func; /* Callback during link creation */
H5L_move_func_t move_func; /* Callback after moving link */
H5L_copy_func_t copy_func; /* Callback after copying link */
H5L_func_t trav_func; /* The main traversal function */
H5L_traverse_func_t trav_func; /* Callback during link traversal */
H5L_delete_func_t del_func; /* Callback for link deletion */
H5L_query_func_t query_func; /* Callback for queries */
} H5L_link_class_t;
} H5L_class_t;
#define H5L_ELINK_PREFIX_PROP "elink_prefix"
@ -127,11 +133,11 @@ H5_DLL herr_t H5Lget_linkinfo(hid_t loc_id, const char *name,
/* UD link functions */
H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name,
H5L_link_t link_type, const void * udata, size_t udata_size,
H5L_type_t link_type, const void * udata, size_t udata_size,
hid_t lcpl_id, hid_t lapl_id);
H5_DLL herr_t H5Lregister(const H5L_link_class_t *cls);
H5_DLL herr_t H5Lunregister(H5L_link_t id);
H5_DLL htri_t H5Lis_registered(H5L_link_t id);
H5_DLL herr_t H5Lregister(const H5L_class_t *cls);
H5_DLL herr_t H5Lunregister(H5L_type_t id);
H5_DLL htri_t H5Lis_registered(H5L_type_t id);
/* External link functions */
H5_DLL herr_t H5Lunpack_elink_val(char * ext_linkval/*in*/,

173
src/H5O.c
View File

@ -111,19 +111,11 @@ typedef struct H5O_addr_map_t {
const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_NULL, /*0x0000 Null */
H5O_MSG_SDSPACE, /*0x0001 Simple Dimensionality */
#ifdef H5_GROUP_REVISION
H5O_MSG_LINFO, /*0x0002 Link information */
#else /* H5_GROUP_REVISION */
NULL,
#endif /* H5_GROUP_REVISION */
H5O_MSG_DTYPE, /*0x0003 Data Type */
H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
H5O_MSG_FILL_NEW, /*0x0005 New Data storage -- fill value */
#ifdef H5_GROUP_REVISION
H5O_MSG_LINK, /*0x0006 Link */
#else /* H5_GROUP_REVISION */
NULL,
#endif /* H5_GROUP_REVISION */
H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
H5O_MSG_LAYOUT, /*0x0008 Data Layout */
#ifdef H5O_ENABLE_BOGUS
@ -131,11 +123,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
#else /* H5O_ENABLE_BOGUS */
NULL, /*0x0009 "Bogus" */
#endif /* H5O_ENABLE_BOGUS */
#ifdef H5_GROUP_REVISION
H5O_MSG_GINFO, /*0x000A Group Information */
#else /* H5_GROUP_REVISION */
NULL,
#endif /* H5_GROUP_REVISION */
H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
H5O_MSG_ATTR, /*0x000C Attribute list */
H5O_MSG_NAME, /*0x000D Object name */
@ -458,7 +446,7 @@ H5Oincr_refcount(hid_t object_id)
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Oincr_refcount, FAIL)
H5TRACE1("Is","i",object_id);
H5TRACE1("e","i",object_id);
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_oloc(object_id)) == NULL)
@ -499,7 +487,7 @@ H5Odecr_refcount(hid_t object_id)
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Odecr_refcount, FAIL)
H5TRACE1("Is","i",object_id);
H5TRACE1("e","i",object_id);
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_oloc(object_id)) == NULL)
@ -896,22 +884,22 @@ done:
herr_t
H5O_reset(unsigned type_id, void *native)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
herr_t ret_value; /* Return value */
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_reset,FAIL);
FUNC_ENTER_NOAPI(H5O_reset, FAIL)
/* check args */
assert(type_id < NELMTS(H5O_msg_class_g));
type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
assert(type);
HDassert(type_id < NELMTS(H5O_msg_class_g));
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
/* Call the "real" reset routine */
if((ret_value=H5O_reset_real(type, native)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to reset object header");
if(H5O_reset_real(type, native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header")
done:
FUNC_LEAVE_NOAPI(ret_value);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_reset() */
@ -933,24 +921,23 @@ done:
static herr_t
H5O_reset_real(const H5O_msg_class_t *type, void *native)
{
herr_t ret_value=SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_reset_real);
FUNC_ENTER_NOAPI_NOINIT(H5O_reset_real)
/* check args */
assert(type);
HDassert(type);
if (native) {
if (type->reset) {
if ((type->reset) (native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "reset method failed");
} else {
if(native) {
if(type->reset) {
if((type->reset)(native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
} else
HDmemset(native, 0, type->native_size);
}
}
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_reset_real() */
@ -972,7 +959,7 @@ done:
*-------------------------------------------------------------------------
*/
void *
H5O_free (unsigned type_id, void *mesg)
H5O_free(unsigned type_id, void *mesg)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
void * ret_value; /* Return value */
@ -2011,11 +1998,11 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_msg_class_t *orig_t
} /* end else */
/* Compute the size needed to store the message on disk */
if ((size = ((*new_type)->raw_size) (f, *new_mesg)) >=H5O_MAX_SIZE)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large");
if((size = ((*new_type)->raw_size)(f, *new_mesg)) >=H5O_MAX_SIZE)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large")
/* Allocate space in the object headed for the message */
if ((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
if((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message");
/* Increment any links in message */
@ -2124,18 +2111,18 @@ H5O_touch_oh(H5F_t *f,
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Create a new message */
if (idx==oh->nmesgs) {
if (!force)
if(idx == oh->nmesgs) {
if(!force)
HGOTO_DONE(SUCCEED); /*nothing to do*/
size = (H5O_MSG_MTIME_NEW->raw_size)(f, &now);
if ((idx=H5O_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, size, oh_flags_ptr))==UFAIL)
if((idx = H5O_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, size, oh_flags_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message");
}
} /* end if */
/* Update the native part */
if (NULL==oh->mesg[idx].native) {
if (NULL==(oh->mesg[idx].native = H5FL_MALLOC(time_t)))
if(NULL==oh->mesg[idx].native) {
if(NULL==(oh->mesg[idx].native = H5FL_MALLOC(time_t)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for modification time message");
}
*((time_t*)(oh->mesg[idx].native)) = now;
@ -3324,13 +3311,11 @@ H5O_alloc_new_chunk(H5F_t *f,
(found_attr < 0 ||
oh->mesg[u].raw_size < oh->mesg[found_attr].raw_size))
found_attr = u;
#ifdef H5_GROUP_REVISION
} else if(H5O_LINK_ID == msg_id) {
if(oh->mesg[u].raw_size >= cont_size &&
(found_link < 0 ||
oh->mesg[u].raw_size < oh->mesg[found_link].raw_size))
found_link = u;
#endif /* H5_GROUP_REVISION */
} else {
if(oh->mesg[u].raw_size >= cont_size &&
(found_other < 0 ||
@ -3671,18 +3656,18 @@ H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg)
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_raw_size,0)
FUNC_ENTER_NOAPI(H5O_raw_size, 0)
/* Check args */
HDassert(type_id < NELMTS(H5O_msg_class_g));
type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
HDassert(type->raw_size);
HDassert(f);
HDassert(mesg);
/* Compute the raw data size for the mesg */
if ((ret_value = (type->raw_size)(f, mesg))==0)
if((ret_value = (type->raw_size)(f, mesg)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
done:
@ -3705,16 +3690,16 @@ done:
*-------------------------------------------------------------------------
*/
size_t
H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg)
H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg, size_t extra_raw)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_mesg_size,0)
FUNC_ENTER_NOAPI(H5O_mesg_size, 0)
/* Check args */
HDassert(type_id < NELMTS(H5O_msg_class_g));
type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
HDassert(type->raw_size);
HDassert(f);
@ -3724,6 +3709,9 @@ H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg)
if((ret_value = (type->raw_size)(f, mesg)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
/* Add in "extra" raw space */
ret_value += extra_raw;
/* Adjust size for alignment, if necessary */
ret_value = H5O_ALIGN(ret_value);
@ -3999,37 +3987,38 @@ done:
* slu@ncsa.uiuc.edu
* July 13, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id)
H5O_encode(H5F_t *f, unsigned char *buf, const void *obj, unsigned type_id)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
herr_t ret_value = SUCCEED; /* Return value */
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_encode,FAIL);
FUNC_ENTER_NOAPI(H5O_encode,FAIL)
/* check args */
assert(type_id < NELMTS(H5O_msg_class_g));
type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
assert(type);
HDassert(type_id < NELMTS(H5O_msg_class_g));
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
/* Encode */
if ((type->encode)(f, buf, obj) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
if((type->encode)(f, buf, obj) < 0)
HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message")
done:
FUNC_LEAVE_NOAPI(ret_value);
}
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_encode() */
/*-------------------------------------------------------------------------
* Function: H5O_decode
*
* Purpose: Decode a binary object(data type and data space only)
* description and return a new object handle.
* Purpose: Decode a binary object description and return a new
* object handle.
*
* Note: This routine is not guaranteed to work with all possible
* header messages, use with care.
*
* Return: Success: Pointer to object(data type or space)
*
@ -4039,30 +4028,28 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void*
H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id)
void *
H5O_decode(H5F_t *f, hid_t dxpl_id, const unsigned char *buf, unsigned type_id)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
void *ret_value=NULL; /* Return value */
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_decode,NULL);
FUNC_ENTER_NOAPI(H5O_decode, NULL)
/* check args */
assert(type_id < NELMTS(H5O_msg_class_g));
type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
assert(type);
HDassert(type_id < NELMTS(H5O_msg_class_g));
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
/* decode */
if((ret_value = (type->decode)(f, 0, buf))==NULL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message");
if((ret_value = (type->decode)(f, dxpl_id, buf)) == NULL)
HGOTO_ERROR (H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message")
done:
FUNC_LEAVE_NOAPI(ret_value);
}
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_decode() */
/*-------------------------------------------------------------------------
@ -4431,7 +4418,6 @@ H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth)
*/
if(src->holding_file)
dst->file->nopen_objs++;
;
} else if(depth == H5_COPY_SHALLOW) {
/* Discarding 'const' qualifier OK - QAK */
H5O_loc_reset((H5O_loc_t *)src);
@ -4772,13 +4758,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message")
} /* end else */
/*
* Encode the message. If the message is shared then we
* encode a Shared Object message instead of the object
* which is being shared.
*/
if((copy_type->encode)(oloc_dst->file, mesg_dst->raw, mesg_dst->native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
/* Mark the message in the destination as dirty, so it'll get encoded when the object header is flushed */
mesg_dst->dirty = TRUE;
} /* end if (mesg_src->type->copy_file) */
} /* end of mesgno loop */
@ -4820,22 +4801,14 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HDassert(copy_type);
if(copy_type->post_copy_file && mesg_src->native) {
hbool_t modified = FALSE;
/* Get destination message */
/* Sanity check destination message */
HDassert(mesg_dst->type == mesg_src->type);
/* Make certain the destination's native info is available */
LOAD_NATIVE(oloc_dst->file, dxpl_id, mesg_dst, FAIL)
HDassert(mesg_dst->native);
/* Perform "post copy" operation on messge */
if((copy_type->post_copy_file)(oloc_src, mesg_src->native, oloc_dst,
mesg_dst->native, &modified, dxpl_id, cpy_info) < 0)
mesg_dst->native, dxpl_id, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to perform 'post copy' operation on message")
/* Mark message and header as dirty if the destination message was modified */
if(modified)
mesg_dst->dirty = TRUE;
} /* end if */
} /* end for */

View File

@ -33,7 +33,6 @@
#include "H5Opkg.h" /* Object headers */
#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_ginfo_encode(H5F_t *f, uint8_t *p, const void *_mesg);
@ -67,6 +66,10 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
/* Current version of group info information */
#define H5O_GINFO_VERSION 1
/* Flags for group flag encoding */
#define H5O_GINFO_FLAG_TRACK_CORDER 0x01
#define H5O_GINFO_FLAG_INDEX_CORDER 0x02
/* Declare a free list to manage the H5O_ginfo_t struct */
H5FL_DEFINE_STATIC(H5O_ginfo_t);
@ -90,9 +93,10 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t);
*-------------------------------------------------------------------------
*/
static void *
H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
H5O_ginfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */
unsigned char flags; /* Flags for encoding group info */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_ginfo_decode)
@ -101,7 +105,7 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HDassert(f);
HDassert(p);
/* decode */
/* Version of message */
if(*p++ != H5O_GINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
@ -109,8 +113,10 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Get the local heap size hint */
UINT32DECODE(p, ginfo->lheap_size_hint)
/* Get the flags for the group */
flags = *p++;
ginfo->track_corder = (flags & H5O_GINFO_FLAG_TRACK_CORDER) ? TRUE : FALSE;
ginfo->index_corder = (flags & H5O_GINFO_FLAG_INDEX_CORDER) ? TRUE : FALSE;
/* Get the max. # of links to store compactly & the min. # of links to store densely */
UINT32DECODE(p, ginfo->max_compact)
@ -148,9 +154,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
H5O_ginfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
unsigned char flags; /* Flags for encoding group info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_ginfo_encode)
@ -162,14 +169,16 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_GINFO_VERSION;
/* Store the local heap size hint for the group */
UINT32ENCODE(p, ginfo->lheap_size_hint)
/* The flags for the group */
flags = ginfo->track_corder ? H5O_GINFO_FLAG_TRACK_CORDER : 0;
flags |= ginfo->index_corder ? H5O_GINFO_FLAG_INDEX_CORDER : 0;
*p++ = flags;
/* Store the max. # of links to store compactly & the min. # of links to store densely */
UINT32ENCODE(p, ginfo->max_compact)
UINT32ENCODE(p, ginfo->min_dense)
/* Store the estimated # of entries & name lengths */
/* Estimated # of entries & name lengths */
UINT32ENCODE(p, ginfo->est_num_entries)
UINT32ENCODE(p, ginfo->est_name_len)
@ -240,7 +249,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg)
H5O_ginfo_size(const H5F_t *f, const void UNUSED *_mesg)
{
size_t ret_value; /* Return value */
@ -248,7 +257,7 @@ H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg)
/* Set return value */
ret_value = 1 + /* Version */
4 + /* Local heap size hint */
1 + /* Flags */
4 + /* "Max compact" links */
4 + /* "Min dense" links */
4 + /* Estimated # of entries in group */
@ -315,22 +324,19 @@ H5O_ginfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Local heap size hint:", ginfo->lheap_size_hint);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"Track creation order of links:", ginfo->track_corder);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"Index creation order of links:", ginfo->index_corder);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Max. compact links:", ginfo->max_compact);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Min. dense links:", ginfo->min_dense);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated # of objects in group:", ginfo->est_num_entries);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated length of object in group's name:", ginfo->est_name_len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ginfo_debug() */
#endif /* H5_GROUP_REVISION */

View File

@ -25,23 +25,27 @@
*-------------------------------------------------------------------------
*/
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5Gpkg.h" /* Groups */
#include "H5Opkg.h" /* Object headers */
#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_linfo_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_linfo_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_linfo_free(void *_mesg);
static herr_t H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
static void *H5O_linfo_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
static herr_t H5O_linfo_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_linfo_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@ -56,19 +60,28 @@ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
H5O_linfo_size, /*size of symbol table entry */
NULL, /*default reset method */
H5O_linfo_free, /* free method */
NULL, /* file delete method */
H5O_linfo_delete, /* file delete method */
NULL, /* link method */
NULL, /*get share method */
NULL, /*set share method */
NULL, /* pre copy native value to file */
H5O_linfo_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
H5O_linfo_post_copy_file, /* post copy native value to file */
H5O_linfo_debug /*debug the message */
}};
/* Current version of link info information */
#define H5O_LINFO_VERSION 1
/* Data exchange structure to use when copying links from src to dst */
typedef struct {
const H5O_loc_t *src_oloc; /* Source object location */
H5O_loc_t *dst_oloc; /* Destination object location */
H5O_linfo_t *dst_linfo; /* Destination object's link info message */
hid_t dxpl_id; /* DXPL for operation */
H5O_copy_t *cpy_info; /* Information for copy operation */
} H5O_linfo_postcopy_ud_t;
/* Declare a free list to manage the hsize_t struct */
H5FL_DEFINE_STATIC(H5O_linfo_t);
@ -111,9 +124,22 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if (NULL == (linfo = H5FL_MALLOC(H5O_linfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Get the number of links in the group */
/* Number of links in the group */
H5F_DECODE_LENGTH(f, p, linfo->nlinks)
/* Min. & max creation order value for the group */
INT64DECODE(p, linfo->min_corder)
INT64DECODE(p, linfo->max_corder)
/* Address of fractal heap to store "dense" links */
H5F_addr_decode(f, &p, &(linfo->link_fheap_addr));
/* Address of v2 B-tree to index names of links */
H5F_addr_decode(f, &p, &(linfo->name_bt2_addr));
/* Address of v2 B-tree to index creation order of links */
H5F_addr_decode(f, &p, &(linfo->corder_bt2_addr));
/* Set return value */
ret_value = linfo;
@ -156,9 +182,22 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_LINFO_VERSION;
/* Store the number of links in the group */
/* Number of links in the group */
H5F_ENCODE_LENGTH(f, p, linfo->nlinks)
/* Min. & max creation order value for the group */
INT64ENCODE(p, linfo->min_corder)
INT64ENCODE(p, linfo->max_corder)
/* Address of fractal heap to store "dense" links */
H5F_addr_encode(f, &p, linfo->link_fheap_addr);
/* Address of v2 B-tree to index names of links */
H5F_addr_encode(f, &p, linfo->name_bt2_addr);
/* Address of v2 B-tree to index creation order of links */
H5F_addr_encode(f, &p, linfo->corder_bt2_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_encode() */
@ -199,7 +238,7 @@ H5O_linfo_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
*dest = *linfo;
/* Set return value */
ret_value=dest;
ret_value = dest;
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -233,8 +272,13 @@ H5O_linfo_size(const H5F_t *f, const void UNUSED *_mesg)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_linfo_size)
/* Set return value */
ret_value = 1 + /* Version */
H5F_SIZEOF_SIZE(f); /* Number of links */
ret_value = 1 /* Version */
+ H5F_SIZEOF_SIZE(f) /* Number of links */
+ 8 /* Min. creation order value */
+ 8 /* Max. creation order value */
+ H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */
+ H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */
+ H5F_SIZEOF_ADDR(f); /* Address of v2 B-tree for indexing creation order values of links */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_size() */
@ -266,6 +310,40 @@ H5O_linfo_free(void *mesg)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_free() */
/*-------------------------------------------------------------------------
* Function: H5O_linfo_delete
*
* Purpose: Free file space referenced by message
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Saturday, September 16, 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
{
const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_delete)
/* check args */
HDassert(f);
HDassert(linfo);
/* If the group is using "dense" link storage, delete it */
if(H5F_addr_defined(linfo->link_fheap_addr))
if(H5G_dense_delete(f, dxpl_id, (H5O_linfo_t *)linfo, adj_link) < 0) /* Casting away const OK - QAK */
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense link storage")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_delete() */
/*-------------------------------------------------------------------------
* Function: H5O_linfo_copy_file
@ -282,8 +360,8 @@ H5O_linfo_free(void *mesg)
*-------------------------------------------------------------------------
*/
static void *
H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_dst,
hid_t UNUSED dxpl_id, H5O_copy_t *cpy_info, void UNUSED *udata)
H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
hid_t dxpl_id, H5O_copy_t *cpy_info, void UNUSED *udata)
{
H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src;
H5O_linfo_t *linfo_dst = NULL;
@ -300,11 +378,26 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed")
/* If we are performing a 'shallow hierarchy' copy, and the links in this
* group won't be included in the destination, reset the link count for
* group won't be included in the destination, reset the link info for
* this group.
*/
if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth)
if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth) {
linfo_dst->nlinks = 0;
linfo_dst->min_corder = linfo_dst->max_corder = 0;
linfo_dst->link_fheap_addr = HADDR_UNDEF;
linfo_dst->name_bt2_addr = HADDR_UNDEF;
linfo_dst->corder_bt2_addr = HADDR_UNDEF;
} /* end if */
else {
/* Create the components of the dense link storage for the destination group */
/* (XXX: should probably get the "creation" parameters for the source group's
* dense link storage components and use those - QAK)
*/
if(H5F_addr_defined(linfo_src->link_fheap_addr)) {
if(H5G_dense_create(file_dst, dxpl_id, linfo_dst) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create 'dense' form of new format group")
} /* end if */
} /* end else */
/* Set return value */
ret_value = linfo_dst;
@ -317,6 +410,114 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_linfo_copy_file() */
/*-------------------------------------------------------------------------
* Function: H5O_linfo_post_copy_file_cb
*
* Purpose: Callback routine for copying links from src to dst file
* during "post copy" routine
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Sept 26 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata)
{
H5O_linfo_postcopy_ud_t *udata = (H5O_linfo_postcopy_ud_t *)_udata; /* 'User data' passed in */
H5O_link_t dst_lnk; /* Destination link to insert */
hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
herr_t ret_value = H5B2_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_post_copy_file_cb)
/* Check arguments */
HDassert(src_lnk);
HDassert(udata);
/* Copy the link (and the object it points to) */
if(H5G_link_copy_file(udata->dst_oloc->file, udata->dxpl_id, src_lnk,
udata->src_oloc, &dst_lnk, udata->cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy link")
dst_lnk_init = TRUE;
/* Insert the new object in the destination file's group */
/* (Doesn't increment the link count - that's already been taken care of for hard links) */
if(H5G_dense_insert(udata->dst_oloc->file, udata->dxpl_id, udata->dst_linfo, &dst_lnk) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5B2_ITER_ERROR, "unable to insert destination link")
done:
/* Check if the destination link has been initialized */
if(dst_lnk_init)
H5O_reset(H5O_LINK_ID, &dst_lnk);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_post_copy_file_cb() */
/*-------------------------------------------------------------------------
* Function: H5O_linfo_post_copy_file
*
* Purpose: Finish copying a message from between files
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* September 26, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_linfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
const H5O_linfo_t *linfo_src = (const H5O_linfo_t *)mesg_src;
H5O_linfo_t *linfo_dst = (H5O_linfo_t *)mesg_dst;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_post_copy_file)
/* check args */
HDassert(src_oloc && src_oloc->file);
HDassert(linfo_src);
HDassert(dst_oloc && dst_oloc->file);
HDassert(H5F_addr_defined(dst_oloc->addr));
HDassert(linfo_dst);
HDassert(cpy_info);
/* If we are performing a 'shallow hierarchy' copy, get out now */
if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth)
HGOTO_DONE(SUCCEED)
/* Check for copying dense link storage */
if(H5F_addr_defined(linfo_src->link_fheap_addr)) {
H5O_linfo_postcopy_ud_t udata; /* User data for iteration callback */
H5G_link_iterate_t lnk_op; /* Link operator */
/* Set up dense link iteration user data */
udata.src_oloc = src_oloc;
udata.dst_oloc = dst_oloc;
udata.dst_linfo = linfo_dst;
udata.dxpl_id = dxpl_id;
udata.cpy_info = cpy_info;
/* Build iterator operator */
lnk_op.lib_op = H5O_linfo_post_copy_file_cb;
/* Iterate over the links in the group, building a table of the link messages */
if(H5G_dense_iterate(src_oloc->file, dxpl_id, H5_ITER_NATIVE, 0, linfo_src, TRUE, 0, NULL, lnk_op, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_linfo_post_copy_file() */
/*-------------------------------------------------------------------------
* Function: H5O_linfo_debug
@ -350,8 +551,18 @@ H5O_linfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Number of links:", linfo->nlinks);
HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth,
"Min. creation order value:", linfo->min_corder);
HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth,
"Max. creation order value:", linfo->max_corder);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"'Dense' link storage fractal heap address:", linfo->link_fheap_addr);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_debug() */
#endif /* H5_GROUP_REVISION */

View File

@ -20,24 +20,24 @@
*
* Purpose: Link messages.
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5Gpkg.h" /* Groups */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_link_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_link_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_link_reset(void *_mesg);
static herr_t H5O_link_free(void *_mesg);
@ -46,8 +46,8 @@ static herr_t H5O_link_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *typ
void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static void *H5O_link_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
static herr_t H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_link_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@ -75,12 +75,12 @@ const H5O_msg_class_t H5O_MSG_LINK[1] = {{
/* Current version of link information */
#define H5O_LINK_VERSION 1
#endif /* H5_GROUP_REVISION */
/* Flags for link flag encoding */
#define H5O_LINK_FLAG_HAS_CORDER 0x01
/* Declare a free list to manage the H5O_link_t struct */
H5FL_DEFINE_STATIC(H5O_link_t);
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5O_link_decode
@ -96,16 +96,14 @@ H5FL_DEFINE_STATIC(H5O_link_t);
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void *
H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
H5O_link_t *lnk = NULL; /* Pointer to link message */
uint16_t len; /* Length of a string in the message */
uint32_t tmp_time; /* Temporary copy of the time */
size_t len; /* Length of a string in the message */
unsigned char link_flags; /* Flags for encoding link info */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_decode)
@ -122,14 +120,23 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if(NULL == (lnk = H5FL_CALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Get the encoding flags for the link */
link_flags = *p++;
/* Get the type of the link */
lnk->type = *p++;
if(lnk->type < H5L_LINK_HARD || lnk->type > H5L_LINK_MAX)
if(lnk->type < H5L_TYPE_HARD || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad link type")
/* Get the link creation time from the file */
UINT32DECODE(p, tmp_time)
lnk->ctime = (time_t)tmp_time;
if(link_flags & H5O_LINK_FLAG_HAS_CORDER) {
INT64DECODE(p, lnk->corder)
lnk->corder_valid = TRUE;
} /* end if */
else {
lnk->corder = 0;
lnk->corder_valid = FALSE;
} /* end else */
/* Get the link name's character set */
lnk->cset = (H5T_cset_t)*p++;
@ -137,10 +144,10 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad cset type")
/* Get the link's name */
UINT16DECODE(p, len)
UINT32DECODE(p, len)
if(len == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length")
if(NULL == (lnk->name = H5MM_malloc((size_t)len + 1)))
if(NULL == (lnk->name = H5MM_malloc(len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(lnk->name, p, len);
lnk->name[len] = '\0';
@ -148,12 +155,12 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* Get the appropriate information for each type of link */
switch(lnk->type) {
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
/* Get the address of the object the link points to */
H5F_addr_decode(f, &p, &(lnk->u.hard.addr));
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
/* Get the link value */
UINT16DECODE(p, len)
if(len == 0)
@ -167,7 +174,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* User-defined links */
default:
if(lnk->type < H5L_LINK_UD_MIN || lnk->type > H5L_LINK_MAX)
if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown link type")
/* A UD link. Get the user-supplied data */
@ -185,16 +192,16 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
} /* end switch */
/* Set return value */
ret_value=lnk;
ret_value = lnk;
done:
if(ret_value == NULL)
if(lnk != NULL) {
if(lnk->name != NULL)
H5MM_xfree(lnk->name);
if(lnk->type == H5L_LINK_SOFT && lnk->u.soft.name != NULL)
if(lnk->type == H5L_TYPE_SOFT && lnk->u.soft.name != NULL)
H5MM_xfree(lnk->u.soft.name);
if(lnk->type >= H5L_LINK_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL)
if(lnk->type >= H5L_TYPE_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL)
H5MM_xfree(lnk->u.ud.udata);
H5FL_FREE(H5O_link_t, lnk);
} /* end if */
@ -214,16 +221,14 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
uint16_t len; /* Length of a string in the message */
uint32_t tmp_time; /* Temporary copy of the time */
size_t len; /* Length of a string in the message */
unsigned char link_flags; /* Flags for encoding link info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_link_encode)
@ -235,31 +240,35 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_LINK_VERSION;
/* The encoding flags for the link */
link_flags = lnk->corder_valid ? H5O_LINK_FLAG_HAS_CORDER : 0;
*p++ = link_flags;
/* Store the type of the link */
*p++ = lnk->type;
/* Store the link creation time from the file */
tmp_time = lnk->ctime;
UINT32ENCODE(p, tmp_time)
/* Store the link creation order in the file, if its valid */
if(lnk->corder_valid)
INT64ENCODE(p, lnk->corder)
/* Store the link name's character set */
*p++ = (uint8_t)lnk->cset;
/* Store the link's name */
len = (uint16_t)HDstrlen(lnk->name);
len = HDstrlen(lnk->name);
HDassert(len > 0);
UINT16ENCODE(p, len)
UINT32ENCODE(p, (uint32_t)len)
HDmemcpy(p, lnk->name, len);
p += len;
/* Store the appropriate information for each type of link */
switch(lnk->type) {
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
/* Store the address of the object the link points to */
H5F_addr_encode(f, &p, lnk->u.hard.addr);
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
/* Store the link value */
len = (uint16_t)HDstrlen(lnk->u.soft.name);
HDassert(len > 0);
@ -270,7 +279,7 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* User-defined links */
default:
HDassert(lnk->type >= H5L_LINK_UD_MIN && lnk->type <= H5L_LINK_MAX);
HDassert(lnk->type >= H5L_TYPE_UD_MIN && lnk->type <= H5L_TYPE_MAX);
/* Store the user-supplied data, however long it is */
len = (uint16_t)lnk->u.ud.size;
@ -285,7 +294,6 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_link_encode() */
#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@ -302,11 +310,9 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void *
static void *
H5O_link_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
@ -315,35 +321,40 @@ H5O_link_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy)
/* check args */
/* Check args */
HDassert(lnk);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
/* Copy static information */
*dest = *lnk;
/* Duplicate the link's name */
HDassert(lnk->name);
dest->name = H5MM_xstrdup(lnk->name);
if(lnk->type == H5L_LINK_SOFT)
dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name);
else if(lnk->type >= H5L_LINK_UD_MIN) {
if(lnk->u.ud.size > 0)
{
if(NULL == (dest->name = H5MM_xstrdup(lnk->name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate link name")
/* Copy other information needed for different link types */
if(lnk->type == H5L_TYPE_SOFT) {
if(NULL == (dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate soft link value")
} /* end if */
else if(lnk->type >= H5L_TYPE_UD_MIN) {
if(lnk->u.ud.size > 0) {
if(NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size);
}
}/* end if */
} /* end if */
} /* end if */
/* Set return value */
ret_value=dest;
ret_value = dest;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_copy() */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5O_link_size
*
@ -371,25 +382,26 @@ H5O_link_size(const H5F_t *f, const void *_mesg)
/* Set return value */
ret_value = 1 + /* Version */
1 + /* Link encoding flags */
1 + /* Link type */
4 + /* Creation time */
(lnk->corder_valid ? 8 : 0) + /* Creation order */
1 + /* Character set */
2 + /* Name length */
4 + /* Name length */
HDstrlen(lnk->name); /* Name */
/* Add the appropriate length for each type of link */
switch(lnk->type) {
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
ret_value += H5F_SIZEOF_ADDR(f);
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
ret_value += 2 + /* Link value length */
HDstrlen(lnk->u.soft.name); /* Link value */
break;
default: /* Default is user-defined link type */
HDassert(lnk->type >= H5L_LINK_UD_MIN);
HDassert(lnk->type >= H5L_TYPE_UD_MIN);
ret_value += 2 + /* User-defined data size */
lnk->u.ud.size; /* User-defined data */
break;
@ -421,13 +433,11 @@ H5O_link_reset(void *_mesg)
if(lnk) {
/* Free information for link (but don't free link pointer) */
if(lnk->type == H5L_LINK_SOFT)
if(lnk->type == H5L_TYPE_SOFT)
lnk->u.soft.name = H5MM_xfree(lnk->u.soft.name);
else if (lnk->type >= H5L_LINK_UD_MIN) {
else if (lnk->type >= H5L_TYPE_UD_MIN) {
if(lnk->u.ud.size > 0)
{
lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata);
}
lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata);
} /* end if */
lnk->name = H5MM_xfree(lnk->name);
} /* end if */
@ -489,8 +499,8 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(f);
HDassert(lnk);
/* Decrement reference count to the object, for hard links */
if(lnk->type == H5L_LINK_HARD) {
/* Decrement reference count to the object (if requested), for hard links */
if(lnk->type == H5L_TYPE_HARD && adj_link) {
H5O_loc_t oloc;
/* Construct object location for object, in order to decrement it's ref count */
@ -499,10 +509,9 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(H5F_addr_defined(lnk->u.hard.addr));
oloc.addr = lnk->u.hard.addr;
/* Decrement the ref count for the object, if requested */
if(adj_link)
if(H5O_link(&oloc, -1, dxpl_id)<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
/* Decrement the ref count for the object */
if(H5O_link(&oloc, -1, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
} /* end if */
done:
@ -566,56 +575,25 @@ static void *
H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_dst,
hid_t UNUSED dxpl_id, H5O_copy_t UNUSED *cpy_info, void UNUSED *udata)
{
H5O_link_t *link_src = (H5O_link_t *) native_src;
H5O_link_t *link_dst = NULL;
void *ret_value; /* Return value */
H5O_link_t *link_src = (H5O_link_t *)native_src;
H5O_link_t *link_dst = NULL;
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy_file)
/* check args */
HDassert(link_src);
HDassert(file_dst);
HDassert(cpy_info);
HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth);
/* Allocate space for the destination stab */
if(NULL == (link_dst = H5FL_MALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Sanity check source link type */
if(link_src->type > H5L_TYPE_SOFT && link_src->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized built-in link type")
/* Copy top-level information */
*link_dst = *link_src;
/* Deep copy the link's name */
if(NULL == (link_dst->name = H5MM_xstrdup(link_src->name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* "Deep copy" other information for each kind of link */
switch(link_src->type) {
case H5L_LINK_HARD:
/* Set link's address undefined here, will be fixed up in "post copy" callback */
link_dst->u.hard.addr = HADDR_UNDEF;
break;
case H5L_LINK_SOFT:
/* Copy the soft link's value */
if(NULL == (link_dst->u.soft.name = H5MM_xstrdup(link_src->u.soft.name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
break;
default:
if(link_src->type >= H5L_LINK_UD_MIN)
{
/* Copy the user-defined link's user data if it exists */
if(link_src->u.ud.size > 0)
{
if(NULL == (link_dst->u.ud.udata = H5MM_malloc(link_src->u.ud.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(link_dst->u.ud.udata, link_src->u.ud.udata, link_src->u.ud.size);
}
}
else
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized link type")
} /* end switch */
/* Allocate "blank" link for destination */
/* (values will be filled in during 'post copy' operation) */
if(NULL == (link_dst = H5FL_CALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set return value */
ret_value = link_dst;
@ -623,7 +601,7 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_
done:
if(!ret_value)
if(link_dst)
H5FL_FREE(H5O_link_t, link_dst);
H5O_link_free(link_dst);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_link_copy_file() */
@ -642,13 +620,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info)
H5O_link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
H5O_link_t *link_src = (H5O_link_t *)mesg_src; /* Casting away const OK... -QAK */
H5O_link_t tmp_link_src;
H5O_link_t *link_dst = (H5O_link_t *)mesg_dst;
herr_t ret_value = SUCCEED; /* Return value */
const H5O_link_t *link_src = (const H5O_link_t *)mesg_src;
H5O_link_t *link_dst = (H5O_link_t *)mesg_dst;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_post_copy_file)
@ -658,82 +635,13 @@ H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src,
HDassert(H5F_addr_defined(dst_oloc->addr));
HDassert(dst_oloc->file);
HDassert(link_dst);
HDassert(modified && *modified == FALSE);
HDassert(cpy_info);
HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth);
/* Expand soft link */
if(H5L_LINK_SOFT == link_src->type && cpy_info->expand_soft_link) {
H5G_stat_t statbuf; /* Information about object pointed to by soft link */
H5G_loc_t grp_loc; /* Group location for parent of soft link */
H5G_name_t grp_path; /* Path for parent of soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
HDmemcpy(&tmp_link_src, link_src, sizeof(H5O_link_t));
link_src = &tmp_link_src;
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
grp_loc.path = &grp_path;
grp_loc.oloc = (H5O_loc_t *)parent_src_oloc; /* Casting away const OK... -QAK */
/* Check if the object pointed by the soft link exists in the source file */
/* (It would be more efficient to make a specialized traversal callback,
* but this is good enough for now... -QAK)
*/
if(H5G_get_objinfo(&grp_loc, link_src->u.soft.name, TRUE, &statbuf, H5AC_ind_dxpl_id) >= 0) {
/* Convert temp. copy of source soft link to hard link */
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
link_src->u.hard.addr = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
#else
link_src->u.hard.addr = statbuf.objno[0];
#endif
link_src->type = H5L_LINK_HARD;
/* Convert destination link to hard link */
link_dst->type = H5L_LINK_HARD;
link_dst->u.soft.name = H5MM_xfree(link_dst->u.soft.name);
} /* end if */
} /* if ((H5G_CACHED_SLINK == src_ent->type)... */
/* Additional "deep copy" for each kind of link */
switch(link_src->type) {
case H5L_LINK_HARD:
/* Copy the object pointed to */
{
H5O_loc_t src_oloc; /* Temporary object location for source object */
H5O_loc_t new_oloc; /* Temporary object location for source object */
/* Build temporary object location for source */
H5O_loc_reset(&src_oloc);
src_oloc.file = parent_src_oloc->file;
HDassert(H5F_addr_defined(link_src->u.hard.addr));
src_oloc.addr = link_src->u.hard.addr;
/* Build temporary object location for destination */
H5O_loc_reset(&new_oloc);
new_oloc.file = dst_oloc->file;
/* Copy the shared object from source to destination */
if(H5O_copy_header_map(&src_oloc, &new_oloc, dxpl_id, cpy_info, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Update link information with new destination object's address */
link_dst->u.hard.addr = new_oloc.addr;
/* Indicate that the destination message was modified */
*modified = TRUE;
} /* end case */
break;
case H5L_LINK_SOFT:
case H5L_LINK_EXTERNAL:
HGOTO_DONE(SUCCEED)
break;
default:
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
} /* end switch */
/* Copy the link (and the object it points to) */
if(H5G_link_copy_file(dst_oloc->file, dxpl_id, link_src, src_oloc, link_dst,
cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy link")
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -751,19 +659,16 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth)
{
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
struct tm *tm;
char buf[128];
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_link_debug)
FUNC_ENTER_NOAPI_NOINIT(H5O_link_debug)
/* check args */
HDassert(f);
@ -773,15 +678,14 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Type:", (lnk->type == H5L_LINK_HARD ? "Hard" :
(lnk->type == H5L_LINK_SOFT ? "Soft" :
(lnk->type == H5L_LINK_EXTERNAL ? "External" :
(lnk->type >= H5L_LINK_UD_MIN ? "User-defined" : "Unknown")))));
"Link Type:", (lnk->type == H5L_TYPE_HARD ? "Hard" :
(lnk->type == H5L_TYPE_SOFT ? "Soft" :
(lnk->type == H5L_TYPE_EXTERNAL ? "External" :
(lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown")))));
tm = HDlocaltime(&(lnk->ctime));
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Creation Time:", buf);
if(lnk->corder_valid)
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Creation Order:", lnk->corder);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name Character Set:", (lnk->cset == H5T_CSET_ASCII ?
@ -789,31 +693,39 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name:", lnk->name);
/* Display link-specific information */
switch(lnk->type) {
case H5L_LINK_HARD:
case H5L_TYPE_HARD:
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Object address:", lnk->u.hard.addr);
break;
case H5L_LINK_SOFT:
case H5L_TYPE_SOFT:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Value:", lnk->u.soft.name);
break;
case H5L_LINK_EXTERNAL:
{
char * objname = (char *) lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link File Name:", lnk->u.ud.udata);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Object Name:", objname);
}
default:
if(lnk->type >= H5L_TYPE_UD_MIN) {
if(lnk->type == H5L_TYPE_EXTERNAL) {
const char * objname = (const char *)lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"External File Name:", lnk->u.ud.udata);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"External Object Name:", objname);
} /* end if */
else {
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"User-Defined Link Size:", lnk->u.ud.size);
} /* end else */
} /* end if */
else
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
break;
} /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_debug() */
#endif /* H5_GROUP_REVISION */

View File

@ -74,7 +74,7 @@ struct H5O_msg_class_t {
herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); /* Set shared information */
herr_t (*pre_copy_file)(H5F_t *, const H5O_msg_class_t *, void *, hbool_t *, const H5O_copy_t *, void *); /*"pre copy" action when copying native value to file */
void *(*copy_file)(H5F_t *, void *, H5F_t *, hid_t, H5O_copy_t *, void *); /*copy native value to file */
herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, hbool_t *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */
herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int);
};

View File

@ -84,21 +84,15 @@ typedef struct H5O_copy_t {
/* Header message IDs */
#define H5O_NULL_ID 0x0000 /* Null Message. */
#define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */
#ifdef H5_GROUP_REVISION
#define H5O_LINFO_ID 0x0002 /* Link Info Message. */
#endif /* H5_GROUP_REVISION */
#define H5O_DTYPE_ID 0x0003 /* Datatype Message. */
#define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */
#define H5O_FILL_NEW_ID 0x0005 /* Fill Value Message. (New) */
#ifdef H5_GROUP_REVISION
#define H5O_LINK_ID 0x0006 /* Link Message. */
#endif /* H5_GROUP_REVISION */
#define H5O_EFL_ID 0x0007 /* External File List Message */
#define H5O_LAYOUT_ID 0x0008 /* Data Storage Layout Message. */
#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */
#ifdef H5_GROUP_REVISION
#define H5O_GINFO_ID 0x000a /* Group Info Message. */
#endif /* H5_GROUP_REVISION */
#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */
#define H5O_ATTR_ID 0x000c /* Attribute Message. */
#define H5O_NAME_ID 0x000d /* Object name message. */
@ -108,15 +102,19 @@ typedef struct H5O_copy_t {
#define H5O_STAB_ID 0x0011 /* Symbol table message. */
#define H5O_MTIME_NEW_ID 0x0012 /* Modification time message. (New) */
#ifdef H5_GROUP_REVISION
/*
* Link Info Message.
* (Contains dynamic information about links in a group)
* (Data structure in memory)
*/
typedef struct H5O_linfo_t {
hsize_t nlinks; /* Number of links in the group */
hsize_t nlinks; /* Number of links in the group */
int64_t min_corder; /* Min. creation order value for group */
int64_t max_corder; /* Max. creation order value for group */
haddr_t link_fheap_addr; /* Address of fractal heap for storing "dense" links */
haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of links */
haddr_t corder_bt2_addr; /* Address of v2 B-tree for indexing creation order values of links */
} H5O_linfo_t;
#endif /* H5_GROUP_REVISION */
/*
* Fill Value Message. (Old)
@ -161,8 +159,9 @@ typedef struct H5O_link_ud_t {
} H5O_link_ud_t;
typedef struct H5O_link_t {
H5L_link_t type; /* Type of link */
time_t ctime; /* Time link was createed */
H5L_type_t type; /* Type of link */
hbool_t corder_valid; /* Creation order for link is valid (not stored) */
int64_t corder; /* Creation order for link (stored if it's valid) */
H5T_cset_t cset; /* Character set of link name */
char *name; /* Link name */
union {
@ -244,14 +243,20 @@ typedef struct H5O_bogus_t {
/*
* Group info message.
* (Contains static information about a group)
* (Data structure in memory)
*/
typedef struct H5O_ginfo_t {
size_t lheap_size_hint; /* Local heap size hint */
unsigned max_compact; /* Maximum # of compact links */
unsigned min_dense; /* Minimum # of "dense" links */
unsigned est_num_entries; /* Estimated # of entries in group */
unsigned est_name_len; /* Estimated length of entry name */
/* "Old" format group info (not stored) */
uint32_t lheap_size_hint; /* Local heap size hint */
/* "New" format group info (stored) */
hbool_t track_corder; /* Are creation order values tracked on links? */
hbool_t index_corder; /* Are creation order values indexed on links? */
uint32_t max_compact; /* Maximum # of compact links */
uint32_t min_dense; /* Minimum # of "dense" links */
uint32_t est_num_entries; /* Estimated # of entries in group */
uint32_t est_name_len; /* Estimated length of entry name */
} H5O_ginfo_t;
/*
@ -355,11 +360,13 @@ H5_DLL herr_t H5O_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence
H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5O_reset(unsigned type_id, void *native);
H5_DLL void *H5O_free(unsigned type_id, void *mesg);
H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id);
H5_DLL void* H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id);
H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, const void *obj, unsigned type_id);
H5_DLL void* H5O_decode(H5F_t *f, hid_t dxpl_id, const unsigned char *buf,
unsigned type_id);
H5_DLL void *H5O_copy(unsigned type_id, const void *mesg, void *dst);
H5_DLL size_t H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg);
H5_DLL size_t H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg);
H5_DLL size_t H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg,
size_t extra_raw);
H5_DLL herr_t H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share);
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_info(H5O_loc_t *loc, H5O_stat_t *ostat, hid_t dxpl_id);
@ -377,12 +384,6 @@ H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id
H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
int fwidth);
/*
* These functions operate on links
*/
H5_DLL void *H5O_link_copy(const void *_mesg, void *_dest, unsigned update_flags);
/*
* These functions operate on object locations
*/

View File

@ -45,8 +45,8 @@ static herr_t H5O_stab_free(void *_mesg);
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
static void *H5O_stab_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
static herr_t H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@ -272,23 +272,21 @@ H5O_stab_free (void *mesg)
* Programmer: Quincey Koziol
* Thursday, March 20, 2003
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *mesg, hbool_t adj_link)
{
herr_t ret_value=SUCCEED; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_delete)
/* check args */
assert(f);
assert(mesg);
HDassert(f);
HDassert(mesg);
/* Free the file space for the symbol table */
if (H5G_stab_delete(f, dxpl_id, mesg, adj_link)<0)
if(H5G_stab_delete(f, dxpl_id, mesg, adj_link) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table")
done:
@ -362,19 +360,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hbool_t UNUSED *modified, hid_t dxpl_id, H5O_copy_t *cpy_info)
H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
H5G_bt_it_ud5_t udata; /* B-tree user data */
const H5O_stab_t *stab_src = (const H5O_stab_t *)mesg_src;
H5O_stab_t *stab_dst = (H5O_stab_t *)mesg_dst;
H5F_t *file_src = parent_src_oloc->file;
H5G_bt_it_ud5_t udata; /* B-tree user data */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_post_copy_file)
/* check args */
HDassert(file_src);
HDassert(stab_src);
HDassert(H5F_addr_defined(dst_oloc->addr));
HDassert(dst_oloc->file);
@ -386,14 +382,14 @@ H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src,
HGOTO_DONE(SUCCEED)
/* Set up B-tree iteration user data */
udata.src_oloc = (H5O_loc_t *)parent_src_oloc; /* Casting away const OK - QAK */
udata.src_oloc = src_oloc;
udata.src_heap_addr = stab_src->heap_addr;
udata.dst_file = dst_oloc->file;
udata.dst_stab = stab_dst;
udata.cpy_info = cpy_info;
/* Iterate over objects in group, copying them */
if((H5B_iterate(file_src, dxpl_id, H5B_SNODE, H5G_node_copy, stab_src->btree_addr, &udata)) < 0)
if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, H5G_node_copy, stab_src->btree_addr, &udata)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed")
done:

View File

@ -24,7 +24,6 @@
/* Static function prototypes */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_local_heap_size_hint
@ -292,7 +291,87 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_est_link_info() */
/*-------------------------------------------------------------------------
* Function: H5Pset_creation_order_tracking
*
* Purpose: Set the flag to track creation order of links in a group
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* September 12, 2006
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_creation_order_tracking(hid_t plist_id, hbool_t track_corder)
{
H5P_genplist_t *plist; /* Property list pointer */
H5O_ginfo_t ginfo; /* Group information structure */
herr_t ret_value = SUCCEED; /* Return value */
#endif /* H5_GROUP_REVISION */
FUNC_ENTER_API(H5Pset_creation_order_tracking, FAIL)
H5TRACE2("e","ib",plist_id,track_corder);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get group info */
if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
/* Update fields */
ginfo.track_corder = track_corder;
/* Set group info */
if(H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_creation_order_tracking() */
/*-------------------------------------------------------------------------
* Function: H5Pget_creation_order_tracking
*
* Purpose: Returns the flag indicating that creation order is tracked
* for links in a group.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* September 12, 2006
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_creation_order_tracking(hid_t plist_id, hbool_t *track_corder /*out*/)
{
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(H5Pget_creation_order_tracking, FAIL)
H5TRACE2("e","ix",plist_id,track_corder);
/* Get values */
if(track_corder) {
H5P_genplist_t *plist; /* Property list pointer */
H5O_ginfo_t ginfo; /* Group information structure */
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get group info */
if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
if(track_corder)
*track_corder = ginfo.track_corder;
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_creation_order_tracking() */

View File

@ -24,7 +24,6 @@
/* Static function prototypes */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_create_intermediate_group
@ -97,5 +96,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_create_intermediate_group() */
#endif /* H5_GROUP_REVISION */

View File

@ -25,10 +25,10 @@
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Cpublic.h"
#include "H5Ipublic.h"
#include "H5Dpublic.h"
#include "H5Fpublic.h"
#include "H5FDpublic.h"
#include "H5Ipublic.h"
#include "H5MMpublic.h"
#include "H5Tpublic.h"
#include "H5Zpublic.h"
@ -357,7 +357,6 @@ H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size/*out*/);
H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void* operate_data);
H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void** operate_data);
#ifdef H5_GROUP_REVISION
/* Link creation property list (LCPL) routines */
H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/);
@ -369,13 +368,13 @@ H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, uns
H5_DLL herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/);
H5_DLL herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len);
H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */, unsigned *est_name_len /* out */);
H5_DLL herr_t H5Pset_creation_order_tracking(hid_t plist_id, hbool_t track_corder);
H5_DLL herr_t H5Pget_creation_order_tracking(hid_t plist_id, hbool_t *track_corder /* out */);
/* String creation property list (SCPL) routines */
H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding);
H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/);
#endif /* H5_GROUP_REVISION */
/* Link access property list (LAPL) routines */
H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks);
H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks);

View File

@ -23,7 +23,6 @@
/* Static function prototypes */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_char_encoding
*
@ -97,5 +96,3 @@ done:
FUNC_LEAVE_API(ret_value);
} /* end H5Pget_char_encoding() */
#endif /* H5_GROUP_REVISION */

113
src/H5S.c
View File

@ -1717,32 +1717,33 @@ done:
static herr_t
H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
{
size_t extent_size;
hssize_t sselect_size;
size_t select_size;
H5F_t f; /* fake file structure*/
size_t extent_size; /* Size of serialized dataspace extent */
hssize_t sselect_size; /* Signed size of serialized dataspace selection */
size_t select_size; /* Size of serialized dataspace selection */
H5F_t f; /* Fake file structure*/
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5S_encode, FAIL);
/* Fake file structure, used only for header message operation */
f.shared = (H5F_file_t*)H5MM_calloc(sizeof(H5F_file_t));
HDassert(f.shared);
f.shared->sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF;
/* Find out the size of buffer needed for extent */
if((extent_size=H5O_raw_size(H5O_SDSPACE_ID, &f, obj))==0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size");
if((extent_size = H5O_raw_size(H5O_SDSPACE_ID, &f, obj)) == 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size")
if((sselect_size=H5S_SELECT_SERIAL_SIZE(obj))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size");
H5_ASSIGN_OVERFLOW(select_size,sselect_size,hssize_t,size_t);
if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size")
H5_ASSIGN_OVERFLOW(select_size, sselect_size, hssize_t, size_t);
/* Verify the size of buffer. If it's not big enough, simply return the
* right size without filling the buffer. */
if(!buf || *nalloc<(extent_size+select_size+1+1+1+4)) {
*nalloc = extent_size+select_size+1+1+1+4;
HGOTO_DONE(ret_value);
}
if(!buf || *nalloc<(extent_size + select_size + 1 + 1 + 1 + 4)) {
*nalloc = extent_size + select_size + 1 + 1 + 1 + 4;
HGOTO_DONE(ret_value)
} /* end if */
/* Encode the type of the information */
*buf++ = H5O_SDSPACE_ID;
@ -1757,26 +1758,26 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
UINT32ENCODE(buf, extent_size);
/* Encode the extent part of dataspace */
if(H5O_encode(&f, buf, obj, H5O_SDSPACE_ID)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space");
buf +=extent_size;
if(H5O_encode(&f, buf, obj, H5O_SDSPACE_ID) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space")
buf += extent_size;
/* Encode the selection part of dataspace. */
if(H5S_SELECT_SERIALIZE(obj, buf) <0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space");
if(H5S_SELECT_SERIALIZE(obj, buf) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space")
done:
if(f.shared)
H5MM_free(f.shared);
FUNC_LEAVE_NOAPI(ret_value);
}
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_encode() */
/*-------------------------------------------------------------------------
* Function: H5Sdecode
*
* Purpose: Decode a binary object description of data space and
* Purpose: Decode a binary object description of dataspace and
* return a new object handle.
*
* Return: Success: dataspace ID(non-negative)
@ -1787,8 +1788,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
hid_t
@ -1797,22 +1796,22 @@ H5Sdecode(const void *buf)
H5S_t *ds;
hid_t ret_value;
FUNC_ENTER_API (H5Sdecode, FAIL);
FUNC_ENTER_API (H5Sdecode, FAIL)
H5TRACE1("i","x",buf);
if (buf==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
if((ds = H5S_decode(buf))==NULL)
if((ds = H5S_decode(buf)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object");
/* Register the type and return the ID */
if ((ret_value=H5I_register (H5I_DATASPACE, ds))<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace");
if((ret_value = H5I_register(H5I_DATASPACE, ds)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
FUNC_LEAVE_API(ret_value);
}
FUNC_LEAVE_API(ret_value)
} /* end H5Sdecode() */
/*-------------------------------------------------------------------------
@ -1829,23 +1828,21 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static H5S_t*
H5S_decode(const unsigned char *buf)
{
H5S_t *ds;
H5S_extent_t *extent;
H5S_extent_t *extent;
size_t extent_size; /* size of the extent message*/
H5F_t f; /* fake file structure*/
H5S_t *ret_value;
FUNC_ENTER_NOAPI(H5S_decode, NULL);
FUNC_ENTER_NOAPI(H5S_decode, NULL)
/* Initialize this before anything goes bad... */
f.shared=NULL;
f.shared = NULL;
/* Decode the type of the information */
if(*buf++ != H5O_SDSPACE_ID)
@ -1865,35 +1862,36 @@ H5S_decode(const unsigned char *buf)
UINT32DECODE(buf, extent_size);
/* Decode the extent part of dataspace */
if((extent = H5O_decode(&f, buf, H5O_SDSPACE_ID))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object");
/* (pass mostly bogus file pointer and bogus DXPL) */
if((extent = H5O_decode(&f, H5P_DEFAULT, buf, H5O_SDSPACE_ID))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
buf += extent_size;
/* Copy the extent into dataspace structure */
if((ds = H5FL_CALLOC(H5S_t))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table");
if(H5O_copy(H5O_SDSPACE_ID, extent, &(ds->extent))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object");
if(H5S_extent_release(extent)<0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace");
H5FL_FREE(H5S_extent_t,extent);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table")
if(H5O_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
if(H5S_extent_release(extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace")
H5FL_FREE(H5S_extent_t, extent);
/* Initialize to "all" selection. Deserialization relies on valid existing selection. */
if(H5S_select_all(ds,0)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection");
if(H5S_select_all(ds, 0) < 0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
/* Decode the select part of dataspace. I believe this part always exists. */
if(H5S_SELECT_DESERIALIZE(ds, buf)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection");
if(H5S_SELECT_DESERIALIZE(ds, buf) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection")
/* Set return value */
ret_value=ds;
ret_value = ds;
done:
H5MM_xfree(f.shared);
FUNC_LEAVE_NOAPI(ret_value);
}
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_decode() */
/*-------------------------------------------------------------------------
@ -1908,22 +1906,15 @@ done:
* koziol@ncsa.uiuc.edu
* October 14, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
size_t
H5S_raw_size(const H5F_t *f, const H5S_t *space)
{
size_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_raw_size)
FUNC_ENTER_NOAPI(H5S_raw_size, 0);
/* Find out the size of buffer needed for extent */
ret_value=H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent));
done:
FUNC_LEAVE_NOAPI(ret_value);
/* Return the size of buffer needed for extent */
FUNC_LEAVE_NOAPI(H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent)))
} /* end H5S_raw_size() */

View File

@ -2797,8 +2797,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
hid_t
@ -2810,19 +2808,19 @@ H5Tdecode(const void *buf)
FUNC_ENTER_API (H5Tdecode, FAIL);
H5TRACE1("i","x",buf);
if (buf==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
if((dt = H5T_decode(buf))==NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object");
if((dt = H5T_decode(buf)) == NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object")
/* Register the type and return the ID */
if ((ret_value=H5I_register (H5I_DATATYPE, dt))<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type");
if((ret_value = H5I_register (H5I_DATATYPE, dt)) < 0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type")
done:
FUNC_LEAVE_API(ret_value);
}
FUNC_LEAVE_API(ret_value)
} /* end H5Tdecode() */
/*-------------------------------------------------------------------------
* API functions are above; library-private functions are below...
@ -2895,8 +2893,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static H5T_t *
@ -2904,22 +2900,24 @@ H5T_decode(const unsigned char *buf)
{
H5T_t *ret_value;
FUNC_ENTER_NOAPI(H5T_decode, NULL);
FUNC_ENTER_NOAPI(H5T_decode, NULL)
/* Decode the type of the information */
if(*buf++ != H5O_DTYPE_ID)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype");
HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype")
/* Decode the version of the datatype information */
if(*buf++ != H5T_ENCODE_VERSION)
HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype");
HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype")
if((ret_value = H5O_decode(NULL, buf, H5O_DTYPE_ID))==NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object");
/* Decode the serialized datatype message */
/* (pass bogus file pointer and DXPL) */
if((ret_value = H5O_decode(NULL, H5P_DEFAULT, buf, H5O_DTYPE_ID)) == NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object")
done:
FUNC_LEAVE_NOAPI(ret_value);
}
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_decode() */
/*-------------------------------------------------------------------------

View File

@ -154,7 +154,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit() */
#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Tcommit_expand
@ -209,7 +208,6 @@ H5Tcommit_expand(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit_expand() */
#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------

View File

@ -123,3 +123,4 @@
#endif
#endif /* H5API_ADPT_H */

View File

@ -39,9 +39,6 @@
/* Define if gettimeofday() populates the tz pointer passed in */
#undef GETTIMEOFDAY_GIVES_TZ
/* Define if the group revision code is to be compiled in */
#undef GROUP_REVISION
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM

View File

@ -188,6 +188,7 @@ MINOR, OHDR, H5E_BADMESG, Unrecognized message
MINOR, OHDR, H5E_CANTDELETE, Can't delete message
MINOR, OHDR, H5E_BADITER, Iteration failed
MINOR, OHDR, H5E_CANTPACK, Can't pack messages
MINOR, OHDR, H5E_CANTRESET, Can't reset object
# Group related errors
MINOR, GROUP, H5E_CANTOPENOBJ, Can't open object

View File

@ -57,6 +57,7 @@
#endif
/* Include the Windows API adapter header early */
#include "H5api_adpt.h"
#ifdef __cplusplus
@ -206,6 +207,13 @@ typedef ssize_t hssize_t;
#endif
#define HADDR_MAX (HADDR_UNDEF-1)
/* Common iteration orders */
typedef enum {
H5_ITER_INC, /* Increasing order */
H5_ITER_DEC, /* Decreasing order */
H5_ITER_NATIVE /* No particular order, whatever is fastest */
} H5_iter_order_t;
/* Functions in H5.c */
H5_DLL herr_t H5open(void);
H5_DLL herr_t H5close(void);

View File

@ -546,147 +546,147 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
break;
case 'F':
switch (type[1]) {
case 'd':
if (ptr) {
if (vp) {
fprintf(out, "0x%lx", (unsigned long)vp);
} else {
fprintf(out, "NULL");
}
} else {
H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */
switch (degree) {
case H5F_CLOSE_DEFAULT:
fprintf(out, "H5F_CLOSE_DEFAULT");
break;
case H5F_CLOSE_WEAK:
fprintf(out, "H5F_CLOSE_WEAK");
break;
case H5F_CLOSE_SEMI:
fprintf(out, "H5F_CLOSE_SEMI");
break;
case H5F_CLOSE_STRONG:
fprintf(out, "H5F_CLOSE_STRONG");
break;
}
}
break;
switch(type[1]) {
case 'd':
if(ptr) {
if(vp)
fprintf(out, "0x%lx", (unsigned long)vp);
else
fprintf(out, "NULL");
} else {
H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */
case 's':
if (ptr) {
if (vp) {
fprintf(out, "0x%lx", (unsigned long)vp);
} else {
fprintf(out, "NULL");
}
} else {
H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */
switch (scope) {
case H5F_SCOPE_LOCAL:
fprintf(out, "H5F_SCOPE_LOCAL");
break;
case H5F_SCOPE_GLOBAL:
fprintf(out, "H5F_SCOPE_GLOBAL");
break;
case H5F_SCOPE_DOWN:
fprintf(out, "H5F_SCOPE_DOWN "
"/*FOR INTERNAL USE ONLY!*/");
break;
}
}
break;
switch(degree) {
case H5F_CLOSE_DEFAULT:
fprintf(out, "H5F_CLOSE_DEFAULT");
break;
case H5F_CLOSE_WEAK:
fprintf(out, "H5F_CLOSE_WEAK");
break;
case H5F_CLOSE_SEMI:
fprintf(out, "H5F_CLOSE_SEMI");
break;
case H5F_CLOSE_STRONG:
fprintf(out, "H5F_CLOSE_STRONG");
break;
}
}
break;
default:
fprintf(out, "BADTYPE(F%c)", type[1]);
goto error;
case 's':
if(ptr) {
if(vp)
fprintf(out, "0x%lx", (unsigned long)vp);
else
fprintf(out, "NULL");
} else {
H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */
switch(scope) {
case H5F_SCOPE_LOCAL:
fprintf(out, "H5F_SCOPE_LOCAL");
break;
case H5F_SCOPE_GLOBAL:
fprintf(out, "H5F_SCOPE_GLOBAL");
break;
case H5F_SCOPE_DOWN:
fprintf(out, "H5F_SCOPE_DOWN "
"/*FOR INTERNAL USE ONLY!*/");
break;
}
}
break;
default:
fprintf(out, "BADTYPE(F%c)", type[1]);
goto error;
}
break;
case 'G':
switch (type[1]) {
case 'l':
if (ptr) {
if (vp) {
fprintf (out, "0x%lx", (unsigned long)vp);
} else {
fprintf(out, "NULL");
}
} else {
H5L_link_t link_type = va_arg (ap, H5L_link_t); /*lint !e64 Type mismatch not really occuring */
switch (link_type) {
case H5L_LINK_ERROR:
fprintf (out, "H5L_LINK_ERROR");
break;
case H5L_LINK_HARD:
fprintf (out, "H5L_LINK_HARD");
break;
case H5L_LINK_SOFT:
fprintf (out, "H5L_LINK_SOFT");
break;
default:
fprintf (out, "%ld", (long)link_type);
break;
}
}
break;
switch(type[1]) {
case 'l':
if(ptr) {
if(vp)
fprintf (out, "0x%lx", (unsigned long)vp);
else
fprintf(out, "NULL");
} else {
H5L_type_t link_type = va_arg(ap, H5L_type_t); /*lint !e64 Type mismatch not really occuring */
case 'o':
if (ptr) {
if (vp) {
fprintf (out, "0x%lx", (unsigned long)vp);
} else {
fprintf(out, "NULL");
}
} else {
H5G_obj_t obj_type = va_arg (ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */
switch (obj_type) {
case H5G_UNKNOWN:
fprintf (out, "H5G_UNKNOWN");
break;
case H5G_LINK:
fprintf (out, "H5G_LINK");
break;
case H5G_UDLINK:
fprintf (out, "H5G_UDLINK");
break;
case H5G_GROUP:
fprintf (out, "H5G_GROUP");
break;
case H5G_DATASET:
fprintf (out, "H5G_DATASET");
break;
case H5G_TYPE:
fprintf (out, "H5G_TYPE");
break;
case H5G_RESERVED_5:
case H5G_RESERVED_6:
case H5G_RESERVED_7:
fprintf (out, "H5G_RESERVED(%ld)",(long)obj_type);
break;
default:
fprintf (out, "%ld", (long)obj_type);
break;
}
}
break;
switch(link_type) {
case H5L_TYPE_ERROR:
fprintf(out, "H5L_TYPE_ERROR");
break;
case H5L_TYPE_HARD:
fprintf(out, "H5L_TYPE_HARD");
break;
case H5L_TYPE_SOFT:
fprintf(out, "H5L_TYPE_SOFT");
break;
default:
fprintf(out, "%ld", (long)link_type);
break;
}
}
break;
case 's':
if (ptr) {
if (vp) {
fprintf (out, "0x%lx", (unsigned long)vp);
} else {
fprintf(out, "NULL");
}
} else {
H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
fprintf (out, "0x%lx", (unsigned long)statbuf);
}
break;
case 'o':
if(ptr) {
if(vp)
fprintf (out, "0x%lx", (unsigned long)vp);
else
fprintf(out, "NULL");
} else {
H5G_obj_t obj_type = va_arg(ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */
default:
fprintf (out, "BADTYPE(G%c)", type[1]);
goto error;
switch(obj_type) {
case H5G_UNKNOWN:
fprintf(out, "H5G_UNKNOWN");
break;
case H5G_LINK:
fprintf(out, "H5G_LINK");
break;
case H5G_UDLINK:
fprintf(out, "H5G_UDLINK");
break;
case H5G_GROUP:
fprintf(out, "H5G_GROUP");
break;
case H5G_DATASET:
fprintf(out, "H5G_DATASET");
break;
case H5G_TYPE:
fprintf(out, "H5G_TYPE");
break;
case H5G_RESERVED_5:
case H5G_RESERVED_6:
case H5G_RESERVED_7:
fprintf(out, "H5G_RESERVED(%ld)",(long)obj_type);
break;
default:
fprintf(out, "%ld", (long)obj_type);
break;
}
}
break;
case 's':
if(ptr) {
if(vp)
fprintf (out, "0x%lx", (unsigned long)vp);
else
fprintf(out, "NULL");
} else {
H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
fprintf(out, "0x%lx", (unsigned long)statbuf);
}
break;
default:
fprintf(out, "BADTYPE(G%c)", type[1]);
goto error;
}
break;

View File

@ -50,8 +50,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \
H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5G.c H5Gbtree2.c H5Gdense.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c \
H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \

View File

@ -91,29 +91,30 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Fsfile.lo H5Fsuper.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
H5FDlog.lo H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \
H5FDsec2.lo H5FDstdio.lo H5FDstream.lo H5FL.lo H5FO.lo H5FS.lo \
H5FScache.lo H5FSdbg.lo H5FSsection.lo H5G.lo H5Gdeprec.lo \
H5Gent.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \
H5Goh.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \
H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \
H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
H5HFtiny.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo \
H5I.lo H5MF.lo H5MM.lo H5MP.lo H5MPtest.lo H5L.lo \
H5Lexternal.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 H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \
H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pstrcpl.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 \
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
H5FScache.lo H5FSdbg.lo H5FSsection.lo H5G.lo H5Gbtree2.lo \
H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Glink.lo H5Gloc.lo \
H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Gstab.lo H5Gtest.lo \
H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo \
H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \
H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \
H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \
H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5MF.lo H5MM.lo \
H5MP.lo H5MPtest.lo H5L.lo H5Lexternal.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 H5Pacpl.lo H5Pdcpl.lo \
H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pgcpl.lo H5Plapl.lo \
H5Plcpl.lo H5Pocpl.lo H5Pstrcpl.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 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
@ -399,8 +400,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \
H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5G.c H5Gbtree2.c H5Gdense.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c \
H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
@ -599,6 +600,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsfile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsuper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5G.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gbtree2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdense.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdeprec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Glink.Plo@am__quote@

View File

@ -98,7 +98,7 @@ flush2.chkexe_: flush1.chkexe_
# prefix or low-level driver with environment variables will influence
# the temporary file name in ways that the makefile is not aware of.
CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5\
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab[1-2].h5 \
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \
extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2]\
links.h5 links[1-3].h5 big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 \

View File

@ -593,9 +593,9 @@ TRACE = perl $(top_srcdir)/bin/trace
# the temporary file name in ways that the makefile is not aware of.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
compact_dataset.h5 dataset.h5 extend.h5 istore.h5 \
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 \
stab[1-2].h5 extern_[1-3].h5 extern_[1-4][ab].raw \
gheap[0-4].h5 dt_arith[1-2] links.h5 links[1-3].h5 big.data \
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \
extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
dt_arith[1-2] links.h5 links[1-3].h5 big.data \
big[0-9][0-9][0-9][0-9][0-9].h5 dtypes[1-8].h5 \
dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 unlink.h5 \
unicode.h5 fillval_[0-9].h5 fillval.raw mount_[0-9].h5 \

Binary file not shown.

Binary file not shown.

View File

@ -2196,7 +2196,7 @@ unprotect_entry(H5C_t * cache_ptr,
result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]),
entry_ptr->addr, (void *)entry_ptr,
flags, 0);
flags, (size_t)0);
if ( ( result < 0 ) ||
( entry_ptr->header.is_protected ) ||

View File

@ -32,8 +32,8 @@
int main(void)
{
#ifdef H5_GROUP_REVISION
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list ID */
hid_t fcpl = -1; /* File creation property list ID */
hid_t gid = -1; /* Group creation property list ID */
hid_t sid = -1; /* Dataspace ID */
@ -43,11 +43,20 @@ int main(void)
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error;
/* Adjust group creation parameters for root group */
/* (So that it is created in symbol-table form) */
/* (So that it is created in "dense storage" form) */
if(H5Pset_link_phase_change(fcpl, 0, 0) < 0) goto error;
/* Copy the file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
/* Set the "use the latest version of the format" flag for creating objects in the file */
if(H5Pset_latest_format(fapl, TRUE) < 0) TEST_ERROR
/* Create file for test groups */
if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) <0) goto error;
if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) <0) goto error;
/* Close file access property list */
if(H5Pclose(fapl) < 0) goto error;
/* Close file creation property list */
if(H5Pclose(fcpl) < 0) goto error;
@ -78,20 +87,18 @@ int main(void)
/* Close file */
if(H5Fclose(fid) < 0) goto error;
#endif /* H5_GROUP_REVISION */
return 0;
#ifdef H5_GROUP_REVISION
error:
H5E_BEGIN_TRY {
H5Pclose(did);
H5Dclose(did);
H5Sclose(sid);
H5Dclose(gid);
H5Dclose(fcpl);
H5Gclose(gid);
H5Pclose(fcpl);
H5Pclose(fapl);
H5Fclose(fid);
} H5E_END_TRY;
return 1;
#endif /* H5_GROUP_REVISION */
}

View File

@ -69,6 +69,9 @@ main (void)
/* Create an external link in the first file pointing to the group in the second file */
if(H5Lcreate_external(filename2, "group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) goto error;
if((H5Fclose(fid1)) < 0) goto error;
if((H5Fclose(fid2)) < 0) goto error;
return 0;
error:

View File

@ -224,7 +224,7 @@ h5_reset(void)
H5E_BEGIN_TRY {
hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT);
hid_t grp = H5Gcreate(file, "emit", 0);
hid_t grp = H5Gcreate(file, "emit", (size_t)0);
H5Gclose(grp);
H5Fclose(file);
HDunlink(filename);
@ -466,10 +466,10 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
*
*-------------------------------------------------------------------------
*/
char *
const char *
h5_rmprefix(const char *filename)
{
char *ret_ptr;
const char *ret_ptr;
if ((ret_ptr = HDstrstr(filename, ":")) == NULL)
ret_ptr = filename;
@ -527,7 +527,7 @@ h5_fileaccess(void)
if (H5Pset_fapl_stdio(fapl)<0) return -1;
} else if (!HDstrcmp(name, "core")) {
/* In-core temporary file with 1MB increment */
if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
if (H5Pset_fapl_core(fapl, (size_t)1024*1024, FALSE)<0) return -1;
} else if (!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
if (H5Pset_fapl_split(fapl,
@ -575,7 +575,7 @@ h5_fileaccess(void)
if ((val = HDstrtok(NULL, " \t\n\r")))
log_flags = (unsigned)HDstrtol(val, NULL, 0);
if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0)
if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
return -1;
} else {
/* Unknown driver */
@ -675,9 +675,8 @@ h5_show_hostname(void)
#endif
#ifdef H5_HAVE_GETHOSTNAME
if (gethostname(hostname, 80) < 0){
if (gethostname(hostname, (size_t)80) < 0)
printf(" gethostname failed\n");
}
else
printf(" hostname=%s\n", hostname);
#else

View File

@ -106,6 +106,7 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define STACK_ERROR {H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
#define FAIL_STACK_ERROR {H5_FAILED(); AT(); \
H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); puts(s); goto error;}
/*
* Alarm definitions to wait up (terminate) a test that runs too long.
@ -126,7 +127,7 @@ H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname,
size_t size);
H5TEST_DLL hid_t h5_fileaccess(void);
H5TEST_DLL void h5_no_hwconv(void);
H5TEST_DLL char *h5_rmprefix(const char *filename);
H5TEST_DLL const char *h5_rmprefix(const char *filename);
H5TEST_DLL void h5_reset(void);
H5TEST_DLL void h5_show_hostname(void);
H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename);

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -71,8 +71,8 @@ setup(hid_t fapl)
if (H5Gclose(H5Gcreate(file, "/mnt1/file1", (size_t)0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/mnt_unlink", (size_t)0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/mnt_move_a", (size_t)0))<0) goto error;
if (H5Glink(file, H5L_LINK_HARD, "/mnt1/file1", "/file1")<0) goto error;
if (H5Glink(file, H5L_LINK_HARD, "/mnt1", "/mnt1_link")<0) goto error;
if (H5Glink(file, H5L_TYPE_HARD, "/mnt1/file1", "/file1")<0) goto error;
if (H5Glink(file, H5L_TYPE_HARD, "/mnt1", "/mnt1_link")<0) goto error;
if (H5Fclose(file)<0) goto error;
/* file 2 */
@ -854,7 +854,7 @@ test_interlink(hid_t fapl)
/* Try an interfile hard link directly */
H5E_BEGIN_TRY {
status = H5Glink(file1, H5L_LINK_HARD, "/mnt1/file2", "/file2");
status = H5Glink(file1, H5L_TYPE_HARD, "/mnt1/file2", "/file2");
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@ -1108,9 +1108,9 @@ test_mount_after_close(hid_t fapl)
TEST_ERROR
if((gidABM = H5Gcreate(gidAB , "M", (size_t)0)) < 0) /* Mount point */
TEST_ERROR
if(H5Glink(gidAB, H5L_LINK_SOFT, "./M/X/Y", "C") < 0) /* Soft link */
if(H5Glink(gidAB, H5L_TYPE_SOFT, "./M/X/Y", "C") < 0) /* Soft link */
TEST_ERROR
if(H5Glink(gidAB, H5L_LINK_SOFT, "/A", "T") < 0) /* Soft link */
if(H5Glink(gidAB, H5L_TYPE_SOFT, "/A", "T") < 0) /* Soft link */
TEST_ERROR
/* Close groups and file */
@ -1144,7 +1144,7 @@ test_mount_after_close(hid_t fapl)
TEST_ERROR
if((did = H5Dcreate(gidXY, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0)
TEST_ERROR
if(H5Glink(gidX, H5L_LINK_SOFT, "./Y", "T") < 0) /* Soft link */
if(H5Glink(gidX, H5L_TYPE_SOFT, "./Y", "T") < 0) /* Soft link */
TEST_ERROR
/* Write data to the dataset. */
@ -3686,7 +3686,7 @@ test_symlink(hid_t fapl)
TEST_ERROR
/* Create soft link to mounted object */
if(H5Glink(fid1, H5L_LINK_SOFT, "./A/D/H", "L") < 0) /* Soft link */
if(H5Glink(fid1, H5L_TYPE_SOFT, "./A/D/H", "L") < 0) /* Soft link */
TEST_ERROR
if(H5Fclose(fid1) < 0)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -459,7 +459,6 @@ test_attr_flush(void)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_flush() */
#ifdef H5_GROUP_REVISION
/****************************************************************
**
** test_attr_plist(): Test Attribute Creation Property Lists
@ -571,7 +570,6 @@ test_attr_plist(void)
ret=H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_plist() */
#endif /* H5_GROUP_REVISION */
/****************************************************************
**
@ -1686,9 +1684,7 @@ test_attr(void)
test_attr_flush(); /* Test H5A I/O in the presence of H5Fflush calls */
/* This next test uses the same file information */
#ifdef H5_GROUP_REVISION
test_attr_plist(); /* Test attribute property lists */
#endif /* H5_GROUP_REVISION */
/* These next two tests use the same file information */
test_attr_compound_write(); /* Test complex datatype H5A writing code */

View File

@ -1221,12 +1221,12 @@ test_file_freespace(void)
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set the space allocation time to early */
ret = H5Pset_alloc_time(dcpl,H5D_ALLOC_TIME_EARLY);
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
CHECK(ret, FAIL, "H5Pset_alloc_time");
/* Create datasets in file */
for(u=0; u<10; u++) {
sprintf(name,"Dataset %u",u);
for(u = 0; u < 10; u++) {
sprintf(name, "Dataset %u", u);
dset = H5Dcreate(file, name, H5T_STD_U32LE, dspace, dcpl);
CHECK(dset, FAIL, "H5Dcreate");
@ -1239,22 +1239,21 @@ test_file_freespace(void)
CHECK(ret, FAIL, "H5Sclose");
/* Close dataset creation property list */
ret=H5Pclose(dcpl);
ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
#ifdef H5_GROUP_REVISION
/* Check that there is the right amount of free space in the file */
free_space = H5Fget_freespace(file);
CHECK(free_space, FAIL, "H5Fget_freespace");
#ifdef H5_HAVE_LARGE_HSIZET
VERIFY(free_space, 420, "H5Fget_freespace");
VERIFY(free_space, 2368, "H5Fget_freespace");
#else /* H5_HAVE_LARGE_HSIZET */
VERIFY(free_space, 588, "H5Fget_freespace");
VERIFY(free_space, 588, "H5Fget_freespace"); /* XXX: fix me */
#endif /* H5_HAVE_LARGE_HSIZET */
/* Delete datasets in file */
for(u=0; u<10; u++) {
sprintf(name,"Dataset %u",u);
for(u = 0; u < 10; u++) {
sprintf(name, "Dataset %u", u);
ret = H5Gunlink(file, name);
CHECK(ret, FAIL, "H5Gunlink");
} /* end for */
@ -1263,16 +1262,14 @@ test_file_freespace(void)
free_space = H5Fget_freespace(file);
CHECK(free_space, FAIL, "H5Fget_freespace");
#ifdef H5_HAVE_LARGE_HSIZET
VERIFY(free_space, 4628, "H5Fget_freespace");
VERIFY(free_space, 5512, "H5Fget_freespace");
#else /* H5_HAVE_LARGE_HSIZET */
VERIFY(free_space, 4592, "H5Fget_freespace");
VERIFY(free_space, 4592, "H5Fget_freespace"); /* XXX: fix me */
#endif /* H5_HAVE_LARGE_HSIZET */
#endif /* H5_GROUP_REVISION */
/* Close file */
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
} /* end test_file_freespace() */
/****************************************************************

View File

@ -46,7 +46,8 @@
typedef enum {
RET_ZERO,
RET_TWO,
RET_CHANGE
RET_CHANGE,
RET_CHANGE2
} iter_enum;
/* Custom group iteration callback data */
@ -70,7 +71,7 @@ herr_t aiter_cb(hid_t loc_id, const char *name, void *op_data);
****************************************************************/
int iter_strcmp(const void *s1, const void *s2)
{
return(strcmp(*(const char * const *)s1,*(const char * const *)s2));
return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2));
}
/****************************************************************
@ -80,10 +81,11 @@ int iter_strcmp(const void *s1, const void *s2)
****************************************************************/
herr_t giter_cb(hid_t UNUSED group, const char *name, void *op_data)
{
iter_info *info=(iter_info *)op_data;
static int count=0;
iter_info *info = (iter_info *)op_data;
static int count = 0;
static int count2 = 0;
strcpy(info->name,name);
HDstrcpy(info->name, name);
switch(info->command) {
case RET_ZERO:
@ -94,20 +96,24 @@ herr_t giter_cb(hid_t UNUSED group, const char *name, void *op_data)
case RET_CHANGE:
count++;
return(count>10 ? 1: 0);
return(count > 10 ? 1 : 0);
case RET_CHANGE2:
count2++;
return(count2 > 10 ? 1 : 0);
default:
printf("invalid iteration command");
return(-1);
} /* end switch */
}
} /* end giter_cb() */
/****************************************************************
**
** test_iter_group(): Test group iteration functionality
**
****************************************************************/
static void test_iter_group(void)
static void test_iter_group(hid_t fapl, hbool_t new_format)
{
hid_t file; /* File ID */
hid_t dataset; /* Dataset ID */
@ -117,7 +123,7 @@ static void test_iter_group(void)
int i; /* counting variable */
int idx; /* Index in the group */
char name[NAMELEN]; /* temporary name buffer */
char *dnames[NDATASETS];/* Names of the datasets created */
char *lnames[NDATASETS + 2];/* Names of the links created */
char dataset_name[NAMELEN]; /* dataset name */
iter_info info; /* Custom iteration information */
hsize_t num_membs; /* Number of group members */
@ -127,7 +133,7 @@ static void test_iter_group(void)
MESSAGE(5, ("Testing Group Iteration Functionality\n"));
/* Create the test file with the datasets */
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
/* Test iterating over empty group */
@ -148,12 +154,12 @@ static void test_iter_group(void)
CHECK(dataset, FAIL, "H5Dcreate");
/* Keep a copy of the dataset names around for later */
dnames[i]=HDstrdup(name);
CHECK(dnames[i], NULL, "strdup");
lnames[i] = HDstrdup(name);
CHECK(lnames[i], NULL, "strdup");
ret=H5Dclose(dataset);
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
}
} /* end for */
/* Create a group and named datatype under root group for testing
* H5Gget_objtype_by_idx.
@ -161,9 +167,15 @@ static void test_iter_group(void)
grp = H5Gcreate(file, "grp", 0);
CHECK(ret, FAIL, "H5Gcreate");
lnames[NDATASETS] = HDstrdup("grp");
CHECK(lnames[NDATASETS], NULL, "strdup");
ret = H5Tcommit(file, "dtype", datatype);
CHECK(ret, FAIL, "H5Tcommit");
lnames[NDATASETS + 1] = HDstrdup("dtype");
CHECK(lnames[NDATASETS], NULL, "strdup");
/* Close everything up */
ret=H5Tclose(datatype);
CHECK(ret, FAIL, "H5Tclose");
@ -178,11 +190,11 @@ static void test_iter_group(void)
CHECK(ret, FAIL, "H5Fclose");
/* Sort the dataset names */
HDqsort(dnames,NDATASETS,sizeof(char *),iter_strcmp);
HDqsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp);
/* Iterate through the datasets in the root group in various ways */
file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
/* These two functions, H5Gget_num_objs and H5Gget_objname_by_idx, actually
@ -194,9 +206,9 @@ static void test_iter_group(void)
ret = H5Gget_num_objs(root_group, &num_membs);
CHECK(ret, FAIL, "H5Gget_num_objs");
VERIFY(num_membs,NDATASETS+2,"H5Gget_num_objs");
VERIFY(num_membs, (NDATASETS + 2), "H5Gget_num_objs");
for(i=0; i< (int)num_membs; i++) {
for(i = 0; i< (int)num_membs; i++) {
H5G_obj_t obj_type; /* Type of object in file */
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN);
@ -204,7 +216,7 @@ static void test_iter_group(void)
obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx");
}
} /* end for */
H5E_BEGIN_TRY {
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN);
@ -222,9 +234,9 @@ static void test_iter_group(void)
{
ret = H5Gget_num_objs(file, &num_membs);
CHECK(ret, FAIL, "H5Gget_num_objs");
VERIFY(num_membs,NDATASETS+2,"H5Gget_num_objs");
VERIFY(num_membs, NDATASETS + 2, "H5Gget_num_objs");
for(i=0; i< (int)num_membs; i++) {
for(i = 0; i< (int)num_membs; i++) {
H5G_obj_t obj_type; /* Type of object in file */
ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, NAMELEN);
@ -235,116 +247,95 @@ static void test_iter_group(void)
}
H5E_BEGIN_TRY {
ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN);
ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)(NDATASETS + 3), dataset_name, NAMELEN);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Gget_objname_by_idx");
}
/* Test invalid indices for starting iteration */
info.command=RET_ZERO;
idx=-1;
info.command = RET_ZERO;
idx = -1;
H5E_BEGIN_TRY {
ret=H5Giterate(file,"/",&idx,giter_cb,&info);
ret = H5Giterate(file, "/", &idx, giter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Giterate");
/* Test skipping exactly as many entries as in the group */
idx=NDATASETS+2;
idx = NDATASETS + 2;
H5E_BEGIN_TRY {
ret=H5Giterate(file,"/",&idx,giter_cb,&info);
ret = H5Giterate(file, "/", &idx, giter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Giterate");
/* Test skipping more entries than are in the group */
idx=NDATASETS+3;
idx = NDATASETS + 3;
H5E_BEGIN_TRY {
ret=H5Giterate(file,"/",&idx,giter_cb,&info);
ret = H5Giterate(file, "/", &idx, giter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Giterate");
/* Test all objects in group, when callback always returns 0 */
info.command=RET_ZERO;
idx=0;
if((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>0)
info.command = RET_ZERO;
idx = 0;
if((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) > 0)
TestErrPrintf("Group iteration function didn't return zero correctly!\n");
/* Test all objects in group, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command=RET_TWO;
idx=i=0;
while((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>0) {
info.command = RET_TWO;
idx = i = 0;
while((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret,2,"H5Giterate");
VERIFY(ret, 2, "H5Giterate");
/* Increment the number of times "1" is returned */
/* Increment the number of times "2" is returned */
i++;
/* Verify that the index is the correct value */
VERIFY(idx,i,"H5Giterate");
VERIFY(idx, i, "H5Giterate");
if(idx > (NDATASETS + 2))
TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
if(idx<=NDATASETS) {
if(HDstrcmp(info.name,dnames[idx-1])!=0)
TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx);
} /* end if */
else if(idx==(NDATASETS+1)) {
if(HDstrcmp(info.name,"dtype")!=0)
TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
} /* end if */
else if(idx==(NDATASETS+2)) {
if(HDstrcmp(info.name,"grp")!=0)
TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
} /* end if */
else
TestErrPrintf("Group iteration function walked too far!\n");
}
VERIFY(ret,-1,"H5Giterate");
if(HDstrcmp(info.name, lnames[idx - 1]) != 0)
TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (idx - 1), lnames[idx - 1]);
} /* end while */
VERIFY(ret, -1, "H5Giterate");
if(i!=(NDATASETS+2))
if(i != (NDATASETS + 2))
TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n");
/* Test all objects in group, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command=RET_CHANGE;
idx=i=0;
while((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>=0) {
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
idx = i = 0;
while((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) >= 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret,1,"H5Giterate");
VERIFY(ret, 1, "H5Giterate");
/* Increment the number of times "1" is returned */
i++;
/* Verify that the index is the correct value */
VERIFY(idx,i+10,"H5Giterate");
VERIFY(idx, (i + 10), "H5Giterate");
if(idx > (NDATASETS + 2))
TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
if(idx<=NDATASETS) {
if(HDstrcmp(info.name,dnames[idx-1])!=0)
TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx);
} /* end if */
else if(idx==(NDATASETS+1)) {
if(HDstrcmp(info.name,"dtype")!=0)
TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
} /* end if */
else if(idx==(NDATASETS+2)) {
if(HDstrcmp(info.name,"grp")!=0)
TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
} /* end if */
else
TestErrPrintf("Group iteration function walked too far!\n");
}
VERIFY(ret,-1,"H5Giterate");
if(HDstrcmp(info.name, lnames[idx - 1]) != 0)
TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (idx - 1), lnames[idx - 1]);
} /* end while */
VERIFY(ret, -1, "H5Giterate");
if(i!=42 || idx!=52)
if(i != 42 || idx != 52)
TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n");
ret=H5Fclose(file);
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Free the dataset names */
for(i=0; i< NDATASETS; i++)
HDfree(dnames[i]);
for(i = 0; i< (NDATASETS + 2); i++)
HDfree(lnames[i]);
} /* test_iter_group() */
/****************************************************************
@ -352,12 +343,14 @@ static void test_iter_group(void)
** aiter_cb(): Custom group iteration callback routine.
**
****************************************************************/
herr_t aiter_cb(hid_t UNUSED group, const char *name, void *op_data)
herr_t
aiter_cb(hid_t UNUSED group, const char *name, void *op_data)
{
iter_info *info=(iter_info *)op_data;
static int count=0;
iter_info *info = (iter_info *)op_data;
static int count = 0;
static int count2 = 0;
strcpy(info->name,name);
HDstrcpy(info->name, name);
switch(info->command) {
case RET_ZERO:
@ -368,20 +361,24 @@ herr_t aiter_cb(hid_t UNUSED group, const char *name, void *op_data)
case RET_CHANGE:
count++;
return(count>10 ? 1: 0);
return(count > 10 ? 1: 0);
case RET_CHANGE2:
count2++;
return(count2 > 10 ? 1: 0);
default:
printf("invalid iteration command");
return(-1);
} /* end switch */
}
} /* end aiter_cb() */
/****************************************************************
**
** test_iter_attr(): Test attribute iteration functionality
**
****************************************************************/
static void test_iter_attr(void)
static void test_iter_attr(hid_t fapl, hbool_t new_format)
{
hid_t file; /* File ID */
hid_t dataset; /* Common Dataset ID */
@ -398,7 +395,7 @@ static void test_iter_attr(void)
MESSAGE(5, ("Testing Attribute Iteration Functionality\n"));
/* Create the test file with the datasets */
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
filespace=H5Screate(H5S_SCALAR);
@ -432,7 +429,7 @@ static void test_iter_attr(void)
/* Iterate through the attributes on the dataset in various ways */
file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
dataset=H5Dopen(file, "Dataset");
@ -486,7 +483,7 @@ static void test_iter_attr(void)
/* Test all attributes on dataset, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command=RET_CHANGE;
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
idx=i=0;
while((ret=H5Aiterate(dataset,&idx,aiter_cb,&info))>0) {
/* Verify return value from iterator gets propagated correctly */
@ -525,8 +522,8 @@ static void test_iter_attr(void)
****************************************************************/
int iter_strcmp2(const void *s1, const void *s2)
{
return(strcmp((const char *)s1,(const char *)s2));
}
return(HDstrcmp((const char *)s1,(const char *)s2));
} /* end iter_strcmp2() */
/****************************************************************
**
@ -535,23 +532,23 @@ int iter_strcmp2(const void *s1, const void *s2)
****************************************************************/
herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata)
{
const iter_info *test_info=(const iter_info *)opdata;
herr_t ret; /* Generic return value */
const iter_info *test_info = (const iter_info *)opdata;
H5G_stat_t statbuf;
herr_t ret; /* Generic return value */
if(HDstrcmp(name,test_info->name)) {
TestErrPrintf("name=%s, test_info=%s\n",name,test_info->name);
if(HDstrcmp(name, test_info->name)) {
TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name);
return(-1);
} /* end if */
/*
* Get type of the object and check it.
*/
ret=H5Gget_objinfo(loc_id, name, FALSE, &statbuf);
ret = H5Gget_objinfo(loc_id, name, FALSE, &statbuf);
CHECK(ret, FAIL, "H5Gget_objinfo");
if(test_info->type!=statbuf.type) {
TestErrPrintf("test_info->type=%d, statbuf.type=%d\n",test_info->type,statbuf.type);
if(test_info->type != statbuf.type) {
TestErrPrintf("test_info->type = %d, statbuf.type = %d\n", test_info->type, statbuf.type);
return(-1);
} /* end if */
@ -564,7 +561,7 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata)
** for groups with large #'s of objects
**
****************************************************************/
static void test_iter_group_large(void)
static void test_iter_group_large(hid_t fapl)
{
hid_t file; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@ -585,13 +582,13 @@ static void test_iter_group_large(void)
float c;
} s1_t;
memset(names, 0, sizeof names);
HDmemset(names, 0, sizeof names);
/* Output message about test being performed */
MESSAGE(5, ("Testing Large Group Iteration Functionality\n"));
/* Create file */
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
/* Create dataspace for datasets */
@ -599,29 +596,29 @@ static void test_iter_group_large(void)
CHECK(sid, FAIL, "H5Screate_simple");
/* Create a bunch of groups */
for (i=0; i<ITER_NGROUPS; i++) {
for(i = 0; i < ITER_NGROUPS; i++) {
sprintf(gname, "Group_%d", i);
/* Add the name to the list of objects in the root group */
strcpy(names[i].name,gname);
names[i].type=H5G_GROUP;
HDstrcpy(names[i].name, gname);
names[i].type = H5G_GROUP;
/* Create a group */
group=H5Gcreate(file,gname,0);
group = H5Gcreate(file, gname, 0);
CHECK(group, FAIL, "H5Gcreate");
/* Close a group */
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
}
} /* end for */
/* Create a dataset */
dataset=H5Dcreate(file,"Dataset1",H5T_STD_U32LE,sid,H5P_DEFAULT);
dataset = H5Dcreate(file, "Dataset1", H5T_STD_U32LE, sid, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Add the name to the list of objects in the root group */
strcpy(names[ITER_NGROUPS].name,"Dataset1");
names[ITER_NGROUPS].type=H5G_DATASET;
HDstrcpy(names[ITER_NGROUPS].name, "Dataset1");
names[ITER_NGROUPS].type = H5G_DATASET;
/* Close Dataset */
ret = H5Dclose(dataset);
@ -632,40 +629,42 @@ static void test_iter_group_large(void)
CHECK(ret, FAIL, "H5Sclose");
/* Create a datatype */
tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
CHECK(tid, FAIL, "H5Tcreate");
/* Insert fields */
ret=H5Tinsert (tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
ret = H5Tinsert(tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
ret=H5Tinsert (tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
ret = H5Tinsert(tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
ret=H5Tinsert (tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
ret = H5Tinsert(tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
ret=H5Tcommit (file, "Datatype1", tid);
ret = H5Tcommit(file, "Datatype1", tid);
CHECK(ret, FAIL, "H5Tcommit");
/* Add the name to the list of objects in the root group */
strcpy(names[ITER_NGROUPS+1].name,"Datatype1");
names[ITER_NGROUPS+1].type=H5G_TYPE;
HDstrcpy(names[ITER_NGROUPS + 1].name, "Datatype1");
names[ITER_NGROUPS + 1].type = H5G_TYPE;
/* Close datatype */
ret = H5Tclose(tid);
CHECK(ret, FAIL, "H5Tclose");
/* Need to sort the names in the root group, cause that's what the library does */
qsort(names,ITER_NGROUPS+2,sizeof(iter_info),iter_strcmp2);
HDqsort(names, (ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2);
/* Iterate through the file to see members of the root group */
curr_name=&names[0];
H5Giterate(file, "/", NULL, giter_cb2, curr_name);
for (i=1; i<100; ) {
curr_name=&names[i];
H5Giterate(file, "/", &i, giter_cb2, curr_name);
curr_name = &names[0];
ret = H5Giterate(file, "/", NULL, giter_cb2, curr_name);
CHECK(ret, FAIL, "H5Giterate");
for(i = 1; i < 100; ) {
curr_name = &names[i];
ret = H5Giterate(file, "/", &i, giter_cb2, curr_name);
CHECK(ret, FAIL, "H5Giterate");
} /* end for */
/* Close file */
@ -679,7 +678,7 @@ static void test_iter_group_large(void)
** functionality
**
****************************************************************/
static void test_grp_memb_funcs(void)
static void test_grp_memb_funcs(hid_t fapl)
{
hid_t file; /* File ID */
hid_t dataset; /* Dataset ID */
@ -699,7 +698,7 @@ static void test_grp_memb_funcs(void)
MESSAGE(5, ("Testing Group Member Information Functionality\n"));
/* Create the test file with the datasets */
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
datatype = H5Tcopy(H5T_NATIVE_INT);
@ -708,18 +707,18 @@ static void test_grp_memb_funcs(void)
filespace=H5Screate(H5S_SCALAR);
CHECK(filespace, FAIL, "H5Screate");
for(i=0; i< NDATASETS; i++) {
for(i = 0; i< NDATASETS; i++) {
sprintf(name,"Dataset %d",i);
dataset = H5Dcreate(file, name, datatype, filespace, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Keep a copy of the dataset names around for later */
dnames[i]=HDstrdup(name);
dnames[i] = HDstrdup(name);
CHECK(dnames[i], NULL, "strdup");
ret=H5Dclose(dataset);
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
}
} /* end for */
/* Create a group and named datatype under root group for testing
* H5Gget_objtype_by_idx.
@ -727,33 +726,33 @@ static void test_grp_memb_funcs(void)
grp = H5Gcreate(file, "grp", 0);
CHECK(ret, FAIL, "H5Gcreate");
dnames[NDATASETS]=HDstrdup("grp");
dnames[NDATASETS] = HDstrdup("grp");
CHECK(dnames[NDATASETS], NULL, "strdup");
ret = H5Tcommit(file, "dtype", datatype);
CHECK(ret, FAIL, "H5Tcommit");
dnames[NDATASETS+1]=HDstrdup("dtype");
dnames[NDATASETS + 1] = HDstrdup("dtype");
CHECK(dnames[NDATASETS], NULL, "strdup");
/* Close everything up */
ret=H5Tclose(datatype);
ret = H5Tclose(datatype);
CHECK(ret, FAIL, "H5Tclose");
ret=H5Gclose(grp);
ret = H5Gclose(grp);
CHECK(ret, FAIL, "H5Gclose");
ret=H5Sclose(filespace);
ret = H5Sclose(filespace);
CHECK(ret, FAIL, "H5Sclose");
ret=H5Fclose(file);
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Sort the dataset names */
HDqsort(dnames,NDATASETS+2,sizeof(char *),iter_strcmp);
HDqsort(dnames, (NDATASETS + 2), sizeof(char *), iter_strcmp);
/* Iterate through the datasets in the root group in various ways */
file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
/* These two functions, H5Gget_num_objs and H5Gget_objname_by_idx, actually
@ -773,14 +772,14 @@ static void test_grp_memb_funcs(void)
name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, NAMELEN);
CHECK(name_len, FAIL, "H5Gget_objname_by_idx");
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)(name_len+1));
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)(name_len + 1));
CHECK(ret, FAIL, "H5Gget_objname_by_idx");
/* Double-check that the length is the same */
VERIFY(ret, name_len, "H5Gget_objname_by_idx");
/* Keep a copy of the dataset names around for later */
obj_names[i]=HDstrdup(dataset_name);
obj_names[i] = HDstrdup(dataset_name);
CHECK(obj_names[i], NULL, "strdup");
obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
@ -792,7 +791,7 @@ static void test_grp_memb_funcs(void)
VERIFY(obj_type, H5G_TYPE, "H5Gget_objname_by_idx");
if(!HDstrncmp(dataset_name, "Dataset", 7))
VERIFY(obj_type, H5G_DATASET, "H5Gget_objname_by_idx");
}
} /* end for */
H5E_BEGIN_TRY {
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN);
@ -800,27 +799,26 @@ static void test_grp_memb_funcs(void)
VERIFY(ret, FAIL, "H5Gget_objname_by_idx");
/* Sort the dataset names */
qsort(obj_names,NDATASETS+2,sizeof(char *),iter_strcmp);
HDqsort(obj_names, (NDATASETS + 2), sizeof(char *), iter_strcmp);
/* Compare object names */
for(i=0; i< (int)num_membs; i++) {
for(i = 0; i< (int)num_membs; i++) {
ret = HDstrcmp(dnames[i], obj_names[i]);
VERIFY(ret, 0, "HDstrcmp");
}
} /* end for */
ret = H5Gclose(root_group);
CHECK(ret, FAIL, "H5Gclose");
ret=H5Fclose(file);
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Free the dataset names */
for(i=0; i< NDATASETS+2; i++) {
free(dnames[i]);
free(obj_names[i]);
}
for(i = 0; i< (NDATASETS + 2); i++) {
HDfree(dnames[i]);
HDfree(obj_names[i]);
} /* end for */
} /* test_grp_memb_funcs() */
/****************************************************************
@ -828,7 +826,7 @@ static void test_grp_memb_funcs(void)
** test_links(): Test soft and hard link iteration
**
****************************************************************/
static void test_links(void)
static void test_links(hid_t fapl)
{
hid_t file; /* File ID */
char obj_name[NAMELEN]; /* Names of the object in group */
@ -843,7 +841,7 @@ static void test_links(void)
MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality\n"));
/* Create the test file with the datasets */
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
/* create groups */
@ -854,10 +852,10 @@ static void test_links(void)
CHECK(gid1, FAIL, "H5Gcreate");
/* create soft and hard links to the group "/g1". */
ret = H5Glink (gid, H5L_LINK_SOFT, "something", "softlink");
ret = H5Glink (gid, H5L_TYPE_SOFT, "something", "softlink");
CHECK(ret, FAIL, "H5Glink");
ret = H5Glink (gid, H5L_LINK_HARD, "/g1", "hardlink");
ret = H5Glink (gid, H5L_TYPE_HARD, "/g1", "hardlink");
CHECK(ret, FAIL, "H5Glink");
ret = H5Gget_num_objs(gid, &nobjs);
@ -865,7 +863,7 @@ static void test_links(void)
VERIFY(nobjs,3,"H5Gget_num_objs");
/* Test these two functions, H5Gget_num_objs and H5Gget_objname_by_idx */
for(i=0; i<nobjs; i++) {
for(i = 0; i < nobjs; i++) {
/* Get object name */
name_len = H5Gget_objname_by_idx(gid, i, obj_name, NAMELEN);
CHECK(name_len, FAIL, "H5Gget_objname_by_idx");
@ -883,13 +881,13 @@ static void test_links(void)
CHECK(0, 0, "unknown object name");
}
ret=H5Gclose(gid);
ret = H5Gclose(gid);
CHECK(ret, FAIL, "H5Gclose");
ret=H5Gclose(gid1);
ret = H5Gclose(gid1);
CHECK(ret, FAIL, "H5Gclose");
ret=H5Fclose(file);
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
} /* test_links() */
@ -901,15 +899,39 @@ static void test_links(void)
void
test_iterate(void)
{
hid_t fapl, fapl2; /* File access property lists */
hbool_t new_format; /* Whether to use the new format or not */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Iteration Operations\n"));
/* Get the default FAPL */
fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(fapl, FAIL, "H5Pcreate");
/* Copy the file access property list */
fapl2 = H5Pcopy(fapl);
CHECK(fapl2, FAIL, "H5Pcopy");
/* Set the "use the latest version of the format" flag for creating objects in the file */
ret = H5Pset_latest_format(fapl2, TRUE);
CHECK(ret, FAIL, "H5Pset_latest_format");
/* These next tests use the same file */
test_iter_group(); /* Test group iteration */
test_iter_group_large(); /* Test group iteration for large # of objects */
test_iter_attr(); /* Test attribute iteration */
test_grp_memb_funcs(); /* Test group member information functions */
test_links(); /* Test soft and hard link iteration */
for(new_format = FALSE; new_format <= TRUE; new_format++) {
test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */
test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */
test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
} /* end for */
/* Close FAPLs */
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
ret = H5Pclose(fapl2);
CHECK(ret, FAIL, "H5Pclose");
} /* test_iterate() */

View File

@ -3768,7 +3768,6 @@ test_misc22(void)
} /* end test_misc22() */
#endif /* H5_HAVE_FILTER_SZIP */
#ifdef H5_GROUP_REVISION
/****************************************************************
**
** test_misc23(): Test intermediate group creation.
@ -4075,7 +4074,6 @@ test_misc23(void)
CHECK(status, FAIL, "H5Fclose");
} /* end test_misc23() */
#endif /* H5_GROUP_REVISION */
/****************************************************************
**
@ -4114,13 +4112,13 @@ test_misc24(void)
CHECK(ret, FAIL, "H5Tcommit");
/* Create soft links to the objects created */
ret = H5Glink2(file_id, MISC24_GROUP_NAME, H5L_LINK_SOFT, file_id, MISC24_GROUP_LINK);
ret = H5Glink2(file_id, MISC24_GROUP_NAME, H5L_TYPE_SOFT, file_id, MISC24_GROUP_LINK);
CHECK(ret, FAIL, "H5Glink2");
ret = H5Glink2(file_id, MISC24_DATASET_NAME, H5L_LINK_SOFT, file_id, MISC24_DATASET_LINK);
ret = H5Glink2(file_id, MISC24_DATASET_NAME, H5L_TYPE_SOFT, file_id, MISC24_DATASET_LINK);
CHECK(ret, FAIL, "H5Glink2");
ret = H5Glink2(file_id, MISC24_DATATYPE_NAME, H5L_LINK_SOFT, file_id, MISC24_DATATYPE_LINK);
ret = H5Glink2(file_id, MISC24_DATATYPE_NAME, H5L_TYPE_SOFT, file_id, MISC24_DATATYPE_LINK);
CHECK(ret, FAIL, "H5Glink2");
/* Close IDs for objects */
@ -4668,9 +4666,7 @@ test_misc(void)
test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */
test_misc22(); /* check szip bits per pixel */
#endif /* H5_HAVE_FILTER_SZIP */
#ifdef H5_GROUP_REVISION
test_misc23(); /* Test intermediate group creation */
#endif /* H5_GROUP_REVISION */
test_misc24(); /* Test inappropriate API opens of objects */
test_misc25a(); /* Exercise null object header message merge bug */
test_misc25b(); /* Exercise null object header message merge bug on existing file */

File diff suppressed because it is too large Load Diff

View File

@ -49,8 +49,8 @@ static hid_t UD_traverse(UNUSED const char * link_name, UNUSED hid_t cur_group,
{
return -1;
}
const H5L_link_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
const H5L_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
MY_LINKCLASS, /* Link type id number */
"UD link class", /* name for debugging */
NULL, /* Creation callback */
@ -2242,8 +2242,8 @@ int test_types(const char *file1,
*-------------------------------------------------------------------------
*/
status = H5Glink(fid1, H5L_LINK_SOFT, "g1", "l1");
status = H5Glink(fid1, H5L_LINK_SOFT, "g2", "l2");
status = H5Glink(fid1, H5L_TYPE_SOFT, "g1", "l1");
status = H5Glink(fid1, H5L_TYPE_SOFT, "g2", "l2");
/*-------------------------------------------------------------------------
* H5G_UDLINK

View File

@ -1544,9 +1544,9 @@ dump_all(hid_t group, const char *name, void * op_data)
case H5G_UDLINK:
{
indentation(indent);
switch(linfo.linkclass)
switch(linfo.type)
{
case H5L_LINK_EXTERNAL:
case H5L_TYPE_EXTERNAL:
{
char *targbuf;
char *filename;
@ -1569,7 +1569,7 @@ dump_all(hid_t group, const char *name, void * op_data)
} else {
if (!doxml) {
indentation(indent + COL);
printf("LINKCLASS %d\n", linfo.linkclass);
printf("LINKCLASS %d\n", linfo.type);
indentation(indent + COL);
printf("TARGETFILE \"%s\"\n", filename);
indentation(indent + COL);
@ -1625,7 +1625,7 @@ dump_all(hid_t group, const char *name, void * op_data)
indentation(indent + COL);
}
if (!doxml) {
printf("LINKCLASS %d\n", linfo.linkclass);
printf("LINKCLASS %d\n", linfo.type);
}
else /* XML */
{
@ -1648,7 +1648,7 @@ dump_all(hid_t group, const char *name, void * op_data)
t_name, /* LinkName */
linkxid, /* OBJ-XID */
t_obj_path, /* H5SourcePath */
linfo.linkclass, /* LinkClass */
linfo.type, /* LinkClass */
parentxid, /* Parents */
t_prefix); /* H5ParentPaths */
HDfree(t_prefix);
@ -3237,14 +3237,14 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
begin_obj(dump_header_format->udlinkbegin, links,
dump_header_format->udlinkblockbegin);
indentation(COL);
switch(linfo.linkclass) {
case H5L_LINK_EXTERNAL:
switch(linfo.type) {
case H5L_TYPE_EXTERNAL:
begin_obj(dump_header_format->extlinkbegin, links,
dump_header_format->extlinkblockbegin);
if (H5Lget_linkval(fid, links, statbuf.linklen, buf, H5P_DEFAULT) >= 0) {
if(H5Lunpack_elink_val(buf, &elink_file, &elink_path)>=0) {
indentation(COL);
printf("LINKCLASS %d\n", linfo.linkclass);
printf("LINKCLASS %d\n", linfo.type);
indentation(COL);
printf("TARGETFILE \"%s\"\n", elink_file);
indentation(COL);
@ -3266,7 +3266,7 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
begin_obj(dump_header_format->udlinkbegin, links,
dump_header_format->udlinkblockbegin);
indentation(COL);
printf("LINKCLASS %d\n", linfo.linkclass);
printf("LINKCLASS %d\n", linfo.type);
end_obj(dump_header_format->udlinkend,
dump_header_format->udlinkblockend);
}

View File

@ -131,8 +131,8 @@ return -1;
#define MY_LINKCLASS 187
const H5L_link_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
const H5L_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
MY_LINKCLASS, /* Link type id number */
"UD link class", /* name for debugging */
NULL, /* Creation callback */
@ -426,8 +426,8 @@ static void gent_softlink(void)
fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen (fid, "/");
H5Glink (root, H5L_LINK_SOFT, "somevalue", "slink1");
H5Glink (root, H5L_LINK_SOFT, "linkvalue", "slink2");
H5Glink (root, H5L_TYPE_SOFT, "somevalue", "slink1");
H5Glink (root, H5L_TYPE_SOFT, "linkvalue", "slink2");
H5Gclose(root);
H5Fclose(fid);
@ -464,15 +464,15 @@ static void gent_hardlink(void)
H5Dclose(dataset);
group = H5Gcreate (fid, "/g1", 0);
H5Glink (group, H5L_LINK_HARD, "/dset1", "dset2");
H5Glink (group, H5L_TYPE_HARD, "/dset1", "dset2");
H5Gclose(group);
group = H5Gcreate (fid, "/g2", 0);
H5Glink (group, H5L_LINK_HARD, "/dset1", "dset3");
H5Glink (group, H5L_TYPE_HARD, "/dset1", "dset3");
H5Gclose(group);
group = H5Gopen(fid, "/g1");
H5Glink (group, H5L_LINK_HARD, "/g2", "g1.1");
H5Glink (group, H5L_TYPE_HARD, "/g2", "g1.1");
H5Gclose(group);
H5Fclose(fid);
}
@ -888,13 +888,14 @@ g2 : dset2.1 dset2.2 udlink
*/
static void gent_all(void) {
hid_t fid, group, attr, dataset, space;
hsize_t dims[2];
int data[2][2], dset1[10][10], dset2[20];
char buf[60];
int i, j;
float dset2_1[10], dset2_2[3][5];
static void gent_all(void)
{
hid_t fid, group, attr, dataset, space;
hsize_t dims[2];
int data[2][2], dset1[10][10], dset2[20];
char buf[60];
int i, j;
float dset2_1[10], dset2_2[3][5];
fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@ -983,7 +984,7 @@ float dset2_1[10], dset2_2[3][5];
/* soft link */
group = H5Gopen (fid, "/g1/g1.2/g1.2.1");
H5Glink (group, H5L_LINK_SOFT, "somevalue", "slink");
H5Glink (group, H5L_TYPE_SOFT, "somevalue", "slink");
H5Gclose(group);
group = H5Gopen (fid, "/g2");
@ -1040,8 +1041,8 @@ hid_t fid, group;
group = H5Gcreate (fid, "/g2", 0);
H5Gclose(group);
H5Glink(fid, H5L_LINK_HARD, "/g2", "/g1/g1.1");
H5Glink(fid, H5L_LINK_HARD, "/g1", "/g2/g2.1");
H5Glink(fid, H5L_TYPE_HARD, "/g2", "/g1/g1.1");
H5Glink(fid, H5L_TYPE_HARD, "/g1", "/g2/g2.1");
H5Fclose(fid);
}
@ -1060,10 +1061,10 @@ hid_t fid, group;
H5Gclose(group);
/* create path from object at /g1 to object at /g2 and name it g1.1 */
H5Glink (fid, H5L_LINK_HARD, "/g2", "/g1/g1.1");
H5Glink (fid, H5L_TYPE_HARD, "/g2", "/g1/g1.1");
/* create path from object at /g2 to object at /g1 and name it g2.1 */
H5Glink (fid, H5L_LINK_SOFT, "/g1", "/g2/g2.1");
H5Glink (fid, H5L_TYPE_SOFT, "/g1", "/g2/g2.1");
H5Fclose(fid);
@ -1080,7 +1081,8 @@ hid_t fid, group;
(dset1) (udlink)
*/
static void gent_many(void) {
static void gent_many(void)
{
hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
hid_t array_dt;
hsize_t dims[2];
@ -1210,11 +1212,11 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gcreate (fid, "/g1/g1.2", 0);
H5Glink (group, H5L_LINK_HARD, "/g1/g1.1/dset1", "link1");
H5Glink (group, H5L_TYPE_HARD, "/g1/g1.1/dset1", "link1");
H5Gclose(group);
group = H5Gcreate (fid, "/g2", 0);
H5Glink (group, H5L_LINK_SOFT, "/g1", "slink2");
H5Glink (group, H5L_TYPE_SOFT, "/g1", "slink2");
H5Gclose(group);
group = H5Gcreate (fid, "/g3", 0);
@ -1238,7 +1240,7 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gopen(fid, "/g3");
H5Glink (group, H5L_LINK_HARD, "/g4/dset2", "link3");
H5Glink (group, H5L_TYPE_HARD, "/g4/dset2", "link3");
H5Gclose(group);
group = H5Gcreate (fid, "/g5", 0);
@ -1261,7 +1263,7 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gopen(fid, "/g5");
H5Glink (group, H5L_LINK_SOFT, "/g6/dset3", "slink4");
H5Glink (group, H5L_TYPE_SOFT, "/g6/dset3", "slink4");
H5Gclose(group);
H5Pclose(create_plist);
@ -1276,14 +1278,15 @@ static void gent_many(void) {
H5Lcreate_ud(fid, "/g8/udlink", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
/* Create links to external and UD links */
ret= H5Glink (fid, H5L_LINK_SOFT, "/g8/elink", "/g7/slink5");
ret= H5Glink (fid, H5L_TYPE_SOFT, "/g8/elink", "/g7/slink5");
HDassert(ret >= 0);
ret= H5Glink (fid, H5L_LINK_SOFT, "/g8/udlink", "/g7/slink6");
ret= H5Glink (fid, H5L_TYPE_SOFT, "/g8/udlink", "/g7/slink6");
HDassert(ret >= 0);
H5Fclose(fid);
}
static hid_t mkstr(int size, H5T_str_t pad) {
hid_t type;
@ -5003,39 +5006,39 @@ static void gent_fcontents(void)
/* hard link to "dset" */
gid1 = H5Gcreate (fid, "/g1", 0);
H5Glink (gid1, H5L_LINK_HARD, "/dset", "dset1");
H5Glink (gid1, H5L_TYPE_HARD, "/dset", "dset1");
H5Gclose(gid1);
/* hard link to "dset" */
gid1 = H5Gcreate (fid, "/g2", 0);
H5Glink (gid1, H5L_LINK_HARD, "/dset", "dset2");
H5Glink (gid1, H5L_TYPE_HARD, "/dset", "dset2");
H5Gclose(gid1);
/* hard link to "g2" */
gid1 = H5Gopen(fid, "/g1");
H5Glink (gid1, H5L_LINK_HARD, "/g2", "g1.1");
H5Glink (gid1, H5L_TYPE_HARD, "/g2", "g1.1");
H5Gclose(gid1);
/* hard link to "dset" */
ret=H5Glink (fid, H5L_LINK_HARD, "/dset", "dset3");
ret=H5Glink (fid, H5L_TYPE_HARD, "/dset", "dset3");
assert(ret>=0);
/* hard link to "dset" */
ret=H5Glink (fid, H5L_LINK_HARD, "/dset", "dset4");
ret=H5Glink (fid, H5L_TYPE_HARD, "/dset", "dset4");
assert(ret>=0);
/* soft link to itself */
ret=H5Glink (fid, H5L_LINK_SOFT, "mylink", "mylink");
ret=H5Glink (fid, H5L_TYPE_SOFT, "mylink", "mylink");
assert(ret>=0);
/* soft link to "dset" */
ret=H5Glink (fid, H5L_LINK_SOFT, "/dset", "softlink");
ret=H5Glink (fid, H5L_TYPE_SOFT, "/dset", "softlink");
assert(ret>=0);
/* dangling external link */

View File

@ -121,17 +121,18 @@ typedef struct s1_t {
#define VLSTR_TYPE "vl_string_type"
/* A UD link traversal function. Shouldn't actually be called. */
static hid_t UD_traverse(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id)
static hid_t UD_traverse(const char UNUSED * link_name, hid_t UNUSED cur_group, void UNUSED * udata, size_t UNUSED udata_size, hid_t UNUSED lapl_id)
{
return -1;
}
#define MY_LINKCLASS 187
const H5L_link_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
const H5L_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
MY_LINKCLASS, /* Link type id number */
"UD link class", /* name for debugging */
NULL, /* Creation callback */
NULL, /* Move/rename callback */
NULL, /* Copy callback */
UD_traverse, /* The actual traversal function */
NULL, /* Deletion callback */
NULL /* Query callback */
@ -156,21 +157,24 @@ g2 : dset2.1 dset2.2 udlink
*/
static void gent_ub(const char * filename, int ub_size, int ub_fill) {
hid_t fid, group, attr, dataset, space;
hid_t create_plist;
hsize_t dims[2];
int data[2][2], dset1[10][10], dset2[20];
char buf[BUF_SIZE];
int i, j;
float dset2_1[10], dset2_2[3][5];
int fd;
char *bp;
static void
gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
{
hid_t fid, group, attr, dataset, space;
hid_t create_plist;
hsize_t dims[2];
int data[2][2], dset1[10][10], dset2[20];
char buf[BUF_SIZE];
int i, j;
size_t u;
float dset2_1[10], dset2_2[3][5];
int fd;
char *bp;
if(ub_size > 0)
{
create_plist = H5Pcreate(H5P_FILE_CREATE);
H5Pset_userblock(create_plist,(hsize_t)ub_size);
H5Pset_userblock(create_plist, (hsize_t)ub_size);
fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
}
else
@ -179,23 +183,23 @@ char *bp;
}
/* create groups */
group = H5Gcreate (fid, "/g1", 0);
group = H5Gcreate(fid, "/g1", (size_t)0);
H5Gclose(group);
group = H5Gcreate (fid, "/g2", 0);
group = H5Gcreate(fid, "/g2", (size_t)0);
H5Gclose(group);
group = H5Gcreate (fid, "/g1/g1.1", 0);
group = H5Gcreate(fid, "/g1/g1.1", (size_t)0);
H5Gclose(group);
group = H5Gcreate (fid, "/g1/g1.2", 0);
group = H5Gcreate(fid, "/g1/g1.2", (size_t)0);
H5Gclose(group);
group = H5Gcreate (fid, "/g1/g1.2/g1.2.1", 0);
group = H5Gcreate(fid, "/g1/g1.2/g1.2.1", (size_t)0);
H5Gclose(group);
/* root attributes */
group = H5Gopen (fid, "/");
group = H5Gopen(fid, "/");
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
@ -263,7 +267,7 @@ char *bp;
/* soft link */
group = H5Gopen (fid, "/g1/g1.2/g1.2.1");
H5Glink (group, H5L_LINK_SOFT, "somevalue", "slink");
H5Glink (group, H5L_TYPE_SOFT, "somevalue", "slink");
H5Gclose(group);
group = H5Gopen (fid, "/g2");
@ -293,38 +297,37 @@ char *bp;
/* user-defined link */
H5Lregister(UD_link_class);
H5Lcreate_ud(fid, "/g2/udlink", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
H5Lcreate_ud(fid, "/g2/udlink", MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
H5Fclose(fid);
/* If a user block is being used, write to it here */
if(ub_size > 0)
{
HDassert(ub_size < BUF_SIZE);
HDassert(ub_size <= BUF_SIZE);
fd = HDopen(filename, O_RDWR, 0);
HDassert(fd >= 0);
fd = HDopen(filename,O_RDWR, 0);
if (fd < 0) {
/* panic */
}
/* fill buf with pattern */
memset(buf,'\0',ub_size);
HDmemset(buf, '\0', ub_size);
bp = buf;
for (i = 0; i < ub_fill; i++) {
*bp++ = pattern[i%10];
}
for (u = 0; u < ub_fill; u++)
*bp++ = pattern[u % 10];
HDwrite(fd,buf,ub_size);
HDwrite(fd, buf, ub_size);
close(fd);
}
}
static void
create_textfile(const char *name, size_t size) {
char *buf;
int fd;
size_t i;
char *bp;
create_textfile(const char *name, size_t size)
{
char *buf;
int fd;
size_t i;
char *bp;
#ifdef WIN32
fd = _creat(name, _S_IREAD | _S_IWRITE);
@ -334,7 +337,7 @@ char *bp;
if (fd < 0) {
/* panic */
}
buf = calloc(size,1);
buf = calloc(size, (size_t)1);
if (buf == NULL) {
/* panic */
}
@ -353,29 +356,27 @@ char *bp;
#ifdef notdef
/* not used yet */
void
create_binfile(char *name, off_t size) {
char *buf;
int fd;
int i;
char *bp;
create_binfile(char *name, off_t size)
{
char *buf;
int fd;
int i;
char *bp;
fd = creat(name,0777);
if (fd < 0) {
/* panic */
}
buf = calloc(size,1);
if (buf == NULL) {
/* panic */
}
/* fill buf with pattern */
bp = buf;
for (i = 0; i < size; i++) {
*bp++ = (char) i & 0xff;
}
fd = creat(name,0777);
HDassert(fd >= 0);
HDwrite(fd,buf,size);
buf = calloc(size,1);
HDassert(buf);
close(fd);
/* fill buf with pattern */
bp = buf;
for (i = 0; i < size; i++)
*bp++ = (char) i & 0xff;
HDwrite(fd,buf,size);
close(fd);
}
#endif
@ -390,30 +391,30 @@ int main(void)
{
/*
create_textfile(UBTXT1,0);
create_textfile(UBTXT1, (size_t)0);
*/
create_textfile(UBTXT2,10);
create_textfile(UBTXT3,511);
create_textfile(UBTXT4,512);
create_textfile(UBTXT5,513);
create_textfile(UBTXT2, (size_t)10);
create_textfile(UBTXT3, (size_t)511);
create_textfile(UBTXT4, (size_t)512);
create_textfile(UBTXT5, (size_t)513);
/*
create_textfile(UBTXT6,1023);
create_textfile(UBTXT7,1024);
create_textfile(UBTXT8,1025);
create_textfile(UBTXT9,2047);
create_textfile(UBTXT10,2048);
create_textfile(UBTXT11,2049);
create_textfile(UBTXT6, (size_t)1023);
create_textfile(UBTXT7, (size_t)1024);
create_textfile(UBTXT8, (size_t)1025);
create_textfile(UBTXT9, (size_t)2047);
create_textfile(UBTXT10, (size_t)2048);
create_textfile(UBTXT11, (size_t)2049);
create_binfile(UBBIN1,0);
create_binfile(UBBIN2,10);
create_binfile(UBBIN3,511);
create_binfile(UBBIN4,512);
create_binfile(UBBIN5,513);
create_binfile(UBBIN1, (off_t)0);
create_binfile(UBBIN2, (off_t)10);
create_binfile(UBBIN3, (off_t)511);
create_binfile(UBBIN4, (off_t)512);
create_binfile(UBBIN5, (off_t)513);
*/
gent_ub(FILE7, 0, 0);
gent_ub(FILE8, 512, strlen(pattern));
gent_ub(FILE9, 1024, 513);
gent_ub(FILE7, (size_t)0, (size_t)0);
gent_ub(FILE8, (size_t)512, HDstrlen(pattern));
gent_ub(FILE9, (size_t)1024, (size_t)513);
return 0;
}

View File

@ -1770,10 +1770,10 @@ udlink_open(hid_t location, const char *name)
if(H5Lget_linkinfo(location, name, &linfo, H5P_DEFAULT) < 0) return -1;
switch(linfo.linkclass)
switch(linfo.type)
{
/* For external links, try to display info for the object it points to */
case H5L_LINK_EXTERNAL:
case H5L_TYPE_EXTERNAL:
if ((buf = HDmalloc(linfo.u.link_size))==NULL) goto error;
if (H5Lget_linkval (location, name, sizeof(buf), buf, H5P_DEFAULT)<0) goto error;

View File

@ -93,7 +93,7 @@ int do_copy_refobjs(hid_t fidin,
for ( j=0; j<travt->objs[i].nlinks; j++)
{
H5Glink(fidout,
H5L_LINK_HARD,
H5L_TYPE_HARD,
travt->objs[i].name,
travt->objs[i].links[j].new_name);
}
@ -339,7 +339,7 @@ int do_copy_refobjs(hid_t fidin,
{
for ( j=0; j<travt->objs[i].nlinks; j++){
H5Glink(fidout,
H5L_LINK_HARD,
H5L_TYPE_HARD,
travt->objs[i].name,
travt->objs[i].links[j].new_name);
}

View File

@ -128,7 +128,7 @@ void write_dset_in(hid_t loc_id,
/* create hard link */
status = H5Glink(loc_id, H5L_LINK_HARD, "string", "string_link");
status = H5Glink(loc_id, H5L_TYPE_HARD, "string", "string_link");
/*-------------------------------------------------------------------------
* H5T_BITFIELD

View File

@ -36,7 +36,7 @@
const char *progname = "h5repacktst";
int d_status = EXIT_SUCCESS;
int main (int argc, char **argv)
int main (int argc, const char *argv[])
{
pack_opt_t pack_options;
diff_opt_t diff_options;

View File

@ -259,7 +259,7 @@ int make_all_objects(hid_t loc_id)
*-------------------------------------------------------------------------
*/
H5Glink(loc_id, H5L_LINK_SOFT, "dset", "link");
H5Glink(loc_id, H5L_TYPE_SOFT, "dset", "link");
/*-------------------------------------------------------------------------
* H5G_UDLINK
@ -357,11 +357,11 @@ int make_hlinks(hid_t loc_id)
if (write_dset(loc_id,2,dims,"dset",H5T_NATIVE_INT,buf)<0)
return -1;
if (H5Glink(loc_id, H5L_LINK_HARD, "dset", "link1 to dset")<0)
if (H5Glink(loc_id, H5L_TYPE_HARD, "dset", "link1 to dset")<0)
return -1;
if (H5Glink(loc_id, H5L_LINK_HARD, "dset", "link2 to dset")<0)
if (H5Glink(loc_id, H5L_TYPE_HARD, "dset", "link2 to dset")<0)
return -1;
if (H5Glink(loc_id, H5L_LINK_HARD, "dset", "link3 to dset")<0)
if (H5Glink(loc_id, H5L_TYPE_HARD, "dset", "link3 to dset")<0)
return -1;
@ -377,9 +377,9 @@ int make_hlinks(hid_t loc_id)
if ((group3_id = H5Gcreate(group2_id,"g3",0))<0)
return -1;
if (H5Glink2(loc_id, "g1", H5L_LINK_HARD, group2_id, "link1 to g1")<0)
if (H5Glink2(loc_id, "g1", H5L_TYPE_HARD, group2_id, "link1 to g1")<0)
return -1;
if (H5Glink2(group1_id, "g2", H5L_LINK_HARD, group3_id, "link1 to g2")<0)
if (H5Glink2(group1_id, "g2", H5L_TYPE_HARD, group3_id, "link1 to g2")<0)
return -1;
H5Gclose(group1_id);

View File

@ -1085,7 +1085,7 @@ hsize_t diff (hid_t file1_id,
goto out;
/* Only external links will have a query function registered */
if(li1.linkclass == H5L_LINK_EXTERNAL && li2.linkclass == H5L_LINK_EXTERNAL)
if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL)
{
buf1 = HDmalloc (li1.u.link_size);
buf2 = HDmalloc (li2.u.link_size);
@ -1134,7 +1134,7 @@ hsize_t diff (hid_t file1_id,
/* If the link classes or the buffer length are not the
* same, the links are "different"
*/
if((li1.linkclass != li2.linkclass) || (li1.u.link_size != li2.u.link_size))
if((li1.type != li2.type) || (li1.u.link_size != li2.u.link_size))
nfound = 1;
else
nfound = 0;

View File

@ -511,7 +511,7 @@ static int traverse( hid_t loc_id,
H5Lget_linkinfo( loc_id, path, &linkbuf, H5P_DEFAULT);
} H5E_END_TRY;
if(linkbuf.linkclass == H5L_LINK_EXTERNAL)
if(linkbuf.type == H5L_TYPE_EXTERNAL)
{
if (statbuf.linklen>0)
{

View File

@ -587,7 +587,11 @@ dataset_stats (hid_t group, const char *name, H5G_stat_t * _sb, iter_t *_iter)
if (nfltr == 0) iter->dset_comptype[0]++;
for (u=0; u < (unsigned) nfltr; u++) {
#ifdef H5_WANT_H5_V1_6_COMPAT
fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0);
#else /* H5_WANT_H5_V1_6_COMPAT */
fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0, NULL);
#endif /* H5_WANT_H5_V1_6_COMPAT */
if (fltr < (H5_NFILTERS_IMPL-1))
iter->dset_comptype[fltr]++;
else

Some files were not shown because too many files have changed in this diff Show More