Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions HDF5Examples/FORTRAN/H5D/h5ex_d_extern.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ PROGRAM main
INTEGER :: i, j
! This change was introduced in the 1.8.12 release
#if H5_VERSION_GE(1,8,12)
INTEGER(OFF_T) :: offset = 0 ! Offset, in bytes, from the beginning of the file to the
! location in the file where the data starts.
INTEGER(C_INT64_T) :: offset = 0 ! Offset, in bytes, from the beginning of the file to the
! location in the file where the data starts.
#else
INTEGER :: offset = 0
#endif
Expand Down
4 changes: 2 additions & 2 deletions c++/src/C2Cppfunction_map.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16851,7 +16851,7 @@
mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>void DSetCreatPropList::setExternal(const char* name, HDoff_t offset,
normal'>void DSetCreatPropList::setExternal(const char* name, uint64_t offset,
hsize_t size)</p>
</td>
<td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
Expand Down Expand Up @@ -16925,7 +16925,7 @@
mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>void DSetCreatPropList::getExternal(unsigned idx, size_t name_size,
char* name, HDoff_t&amp; offset, hsize_t&amp; size)</p>
char* name, uint64_t&amp; offset, hsize_t&amp; size)</p>
</td>
<td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
Expand Down
8 changes: 4 additions & 4 deletions c++/src/H5DcreatProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,10 @@ DSetCreatPropList::setFletcher32() const
/// which is a 32-bit signed long value on Windows, which limited
/// the valid offset that can be set to 2 GiB.
///
///\version 2.0.0 \p offset parameter type changed to HDoff_t from off_t.
///\version 2.0.0 \p offset parameter type changed to uint64_t from off_t.
//--------------------------------------------------------------------------
void
DSetCreatPropList::setExternal(const char *name, HDoff_t offset, hsize_t size) const
DSetCreatPropList::setExternal(const char *name, uint64_t offset, hsize_t size) const
{
herr_t ret_value = H5Pset_external(id, name, offset, size);
if (ret_value < 0) {
Expand Down Expand Up @@ -702,10 +702,10 @@ DSetCreatPropList::getExternalCount() const
/// which is a 32-bit signed long value on Windows, which limited
/// the valid offset that can be returned to 2 GiB.
///
///\version 2.0.0 \p offset parameter type changed to HDoff_t from off_t.
///\version 2.0.0 \p offset parameter type changed to uint64_t from off_t.
//--------------------------------------------------------------------------
void
DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, HDoff_t &offset,
DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, uint64_t &offset,
hsize_t &size) const
{
herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size);
Expand Down
4 changes: 2 additions & 2 deletions c++/src/H5DcreatProp.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class H5CPP_DLL DSetCreatPropList : public ObjCreatPropList {
void setChunk(int ndims, const hsize_t *dim) const;

// Returns information about an external file.
void getExternal(unsigned idx, size_t name_size, char *name, HDoff_t &offset, hsize_t &size) const;
void getExternal(unsigned idx, size_t name_size, char *name, uint64_t &offset, hsize_t &size) const;

// Returns the number of external files for a dataset.
int getExternalCount() const;
Expand Down Expand Up @@ -101,7 +101,7 @@ class H5CPP_DLL DSetCreatPropList : public ObjCreatPropList {
void setDeflate(int level) const;

// Adds an external file to the list of external files.
void setExternal(const char *name, HDoff_t offset, hsize_t size) const;
void setExternal(const char *name, uint64_t offset, hsize_t size) const;

// Adds a filter to the filter pipeline.
void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0,
Expand Down
25 changes: 13 additions & 12 deletions fortran/src/H5Pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1516,18 +1516,19 @@ h5pget_filter_c(hid_t_f *prp_id, int_f *filter_number, int_f *flags, size_t_f *c
* SOURCE
*/
int_f
h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, off_t_f *offset, hsize_t_f *bytes)
h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, uint64_t_f *offset, hsize_t_f *bytes)
/******/
{
int ret_value = -1;
hid_t c_prp_id;
herr_t ret;
hsize_t c_bytes;
char *c_name;
size_t c_namelen = (size_t)*namelen;
off_t c_offset;
int ret_value = -1;
hid_t c_prp_id;
herr_t ret;
hsize_t c_bytes;
char *c_name;
size_t c_namelen = (size_t)*namelen;
uint64_t c_offset;

c_bytes = (hsize_t)*bytes;
c_offset = (off_t)*offset;
c_offset = (uint64_t)*offset;

c_name = (char *)HD5f2cstring(name, c_namelen);
if (c_name == NULL)
Expand Down Expand Up @@ -1600,7 +1601,7 @@ h5pget_external_count_c(hid_t_f *prp_id, int_f *count)
* SOURCE
*/
int_f
h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, off_t_f *offset,
h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, uint64_t_f *offset,
hsize_t_f *bytes)
/******/
{
Expand All @@ -1610,7 +1611,7 @@ h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, o
herr_t status;
size_t c_namelen;
char *c_name = NULL;
HDoff_t c_offset;
uint64_t c_offset;
hsize_t size;

c_namelen = (size_t)*name_size;
Expand All @@ -1632,7 +1633,7 @@ h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, o
if (status < 0)
goto DONE;

*offset = (off_t_f)c_offset;
*offset = (uint64_t_f)c_offset;
*bytes = (hsize_t_f)size;
/* Note: if the size of the fortran buffer is larger then the returned string
* from the function then we need to give HD5packFstring the fortran buffer size so
Expand Down
18 changes: 6 additions & 12 deletions fortran/src/H5Pff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1623,16 +1623,13 @@ END SUBROUTINE h5pget_filter_f
!! \param bytes Size of the external file data.
!! \param hdferr \fortran_error
!!
!! \note On Windows, off_t is typically a 32-bit signed long value, which
!! limits the valid offset that can be set to 2 GiB.
!!
!! See C API: @ref H5Pset_external()
!!
SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(OFF_T), INTENT(IN) :: offset
INTEGER(C_INT64_T), INTENT(IN) :: offset
INTEGER(HSIZE_T), INTENT(IN) :: bytes
INTEGER, INTENT(OUT) :: hdferr
INTEGER :: namelen
Expand All @@ -1641,12 +1638,12 @@ SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr)
INTEGER FUNCTION h5pset_external_c(prp_id, name,namelen, offset, bytes) &
BIND(C,NAME='h5pset_external_c')
IMPORT :: C_CHAR
IMPORT :: HID_T, OFF_T, HSIZE_T
IMPORT :: HID_T, C_INT64_T, HSIZE_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
INTEGER :: namelen
INTEGER(OFF_T), INTENT(IN) :: offset
INTEGER(C_INT64_T), INTENT(IN) :: offset
INTEGER(HSIZE_T), INTENT(IN) :: bytes
END FUNCTION h5pset_external_c
END INTERFACE
Expand Down Expand Up @@ -1697,9 +1694,6 @@ END SUBROUTINE h5pget_external_count_f
!! \param bytes Size of the external file data.
!! \param hdferr \fortran_error
!!
!! \note On Windows, off_t is typically a 32-bit signed long value, which
!! limits the valid offset that can be returned to 2 GiB.
!!
!! See C API: @ref H5Pget_external()
!!
SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset, bytes, hdferr)
Expand All @@ -1708,20 +1702,20 @@ SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset, bytes, hdferr
INTEGER, INTENT(IN) :: idx
INTEGER(SIZE_T), INTENT(IN) :: name_size
CHARACTER(LEN=*), INTENT(OUT) :: name
INTEGER(OFF_T), INTENT(OUT) :: offset
INTEGER(C_INT64_T), INTENT(OUT) :: offset
INTEGER(HSIZE_T), INTENT(OUT) :: bytes
INTEGER, INTENT(OUT) :: hdferr
INTERFACE
INTEGER FUNCTION h5pget_external_c(prp_id, idx, name_size, name, offset, bytes) &
BIND(C,NAME='h5pget_external_c')
IMPORT :: C_CHAR
IMPORT :: HID_T, SIZE_T, HSIZE_T, OFF_T
IMPORT :: HID_T, SIZE_T, HSIZE_T, C_INT64_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER, INTENT(IN) :: idx
INTEGER(SIZE_T), INTENT(IN) :: name_size
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name
INTEGER(OFF_T), INTENT(OUT) :: offset
INTEGER(C_INT64_T), INTENT(OUT) :: offset
INTEGER(HSIZE_T), INTENT(OUT) :: bytes
END FUNCTION h5pget_external_c
END INTERFACE
Expand Down
6 changes: 3 additions & 3 deletions fortran/src/H5f90proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ H5FC_DLL int_f h5pget_filter_c(hid_t_f *prp_id, int_f *filter_number, int_f *fla
int_f *cd_values, size_t_f *namelen, _fcd name, int_f *filter_id);
H5FC_DLL int_f h5pget_filter_by_id_c(hid_t_f *prp_id, int_f *filter_id, int_f *flags, size_t_f *cd_nelmts,
int_f *cd_values, size_t_f *namelen, _fcd name);
H5FC_DLL int_f h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, off_t_f *offset,
H5FC_DLL int_f h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, uint64_t_f *offset,
hsize_t_f *bytes);
H5FC_DLL int_f h5pget_external_count_c(hid_t_f *prp_id, int_f *count);
H5FC_DLL int_f h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, off_t_f *offset,
hsize_t_f *bytes);
H5FC_DLL int_f h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name,
uint64_t_f *offset, hsize_t_f *bytes);
H5FC_DLL int_f h5pget_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right);
H5FC_DLL int_f h5pset_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right);
H5FC_DLL int_f h5pset_fclose_degree_c(hid_t_f *fapl, int_f *degree);
Expand Down
11 changes: 0 additions & 11 deletions fortran/src/H5match_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,6 @@ main(void)
return -1;
}

/* off_t */
for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
if (IntKinds_SizeOf[i] == H5_SIZEOF_OFF_T) {
writeToFiles("int", "OFF_T", "off_t_f", IntKinds[i]);
break;
}
if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
/* Error: couldn't find a size for off_t */
return -1;
}

/* size_t */
for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
if (IntKinds_SizeOf[i] == H5_SIZEOF_SIZE_T) {
Expand Down
4 changes: 2 additions & 2 deletions fortran/test/tH5P.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SUBROUTINE external_test(cleanup, total_error)
INTEGER(HSIZE_T), DIMENSION(1) :: cur_size !data space current size
INTEGER(HSIZE_T), DIMENSION(1) :: max_size !data space maximum size
CHARACTER(LEN=256) :: name !external file name
INTEGER(OFF_T) :: file_offset !external file offset
INTEGER(C_INT64_T) :: file_offset !external file offset
INTEGER(HSIZE_T) :: file_size !sizeof external file segment
INTEGER :: error !error code
INTEGER(SIZE_T) :: int_size !size of integer
Expand Down Expand Up @@ -134,7 +134,7 @@ SUBROUTINE external_test(cleanup, total_error)
CALL h5tget_size_f(H5T_NATIVE_INTEGER, int_size, error)
CALL check("h5tget_size_f",error,total_error)
file_size = int_size * max_size(1)
CALL h5pset_external_f(plist_id, "ext1.data", INT(0,off_t), file_size, error)
CALL h5pset_external_f(plist_id, "ext1.data", INT(0,uint64_t), file_size, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5screate_simple_f(RANK, cur_size, space_id, error, max_size)
CALL check("h5screate_simple_f", error, total_error)
Expand Down
8 changes: 4 additions & 4 deletions fortran/test/tH5P_F03.F90
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,13 @@ SUBROUTINE external_test_offset(cleanup,total_error)

CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error)
CALL check("h5pcreate_f", error, total_error)
CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,uint64_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,uint64_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,uint64_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,uint64_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)

cur_size(1) = 100
Expand Down
6 changes: 3 additions & 3 deletions java/src/jni/h5pDCPLImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1external(JNIEnv *env, jclass clss, jlong plist, jstr

PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Pset_external: file name not pinned");

if ((status = H5Pset_external((hid_t)plist, fileName, (HDoff_t)offset, (hsize_t)size)) < 0)
if ((status = H5Pset_external((hid_t)plist, fileName, (uint64_t)offset, (hsize_t)size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);

done:
Expand All @@ -1083,7 +1083,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint
jboolean isCopy;
jstring str;
hsize_t s;
HDoff_t o;
uint64_t o;
jsize arrLen;
jlong *theArray = NULL;
char *file = NULL;
Expand Down Expand Up @@ -1112,7 +1112,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint
if (NULL != size) {
PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_external: size array not pinned");

theArray[0] = o;
theArray[0] = (jlong)o;
theArray[1] = (jlong)s;
}

Expand Down
25 changes: 13 additions & 12 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -654,17 +654,12 @@ New Features
developers who wish to provide an ID for their driver should create
a routine specific to their individual implementation.

- H5Pset_external() now uses HDoff_t, which is always a 64-bit type
- H5P(set|get)_external() now take a uint64_t offset parameter

The H5Pset_external() call took an off_t parameter in HDF5 1.14.x and
earlier. On POSIX systems, off_t is specified as a 64-bit type via
POSIX large-file support (LFS). On Windows, however, off_t is defined
as a 32-bit type, even on 64-bit Windows.

HDoff_t has been added to H5public.h and is defined to be int64_t on
Windows and the library has been updated to use HDoff_t in place of
off_t throughout. The H5Pset_external() offset parameter has also been
updated to be HDoff_t.
These calls took an off_t parameter in HDF5 1.14.x and earlier. On POSIX
systems, off_t is specified as a 64-bit type via POSIX large-file support
(LFS). On Windows, however, off_t is defined as a 32-bit type, even on
64-bit Windows, which limited external files to 2 GiB.

There is no API compatibility wrapper for this change.

Expand Down Expand Up @@ -969,7 +964,10 @@ Bug Fixes since HDF5-2.0.0 release

Fortran API
-----------
-
- The offset parameter for H5P(set|get)_external_f() is now always a 64-bit type

The parameter was changed from an INTEGER of KIND OFF_T to C_INT64_T, and
OFF_T is no longer a defined INTEGER KIND.


High-Level Library
Expand Down Expand Up @@ -999,7 +997,10 @@ Bug Fixes since HDF5-2.0.0 release

C++ APIs
--------
-
- The offset parameter in (get|set)External is now a uint64_t

This has been changed from off_t. See the main library section for
the justification.


Testing
Expand Down
4 changes: 2 additions & 2 deletions src/H5Defl.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name");
if ((fd = HDopen(full_name, O_RDONLY)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file");
if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file");
#ifndef NDEBUG
tempto_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size);
Expand Down Expand Up @@ -434,7 +434,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
else
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file");
} /* end if */
if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file");
#ifndef NDEBUG
tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size);
Expand Down
Loading
Loading