summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-08-03 16:11:27 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-08-03 16:11:27 (GMT)
commitbc1bed2c55981f1802f87f83054d375431a0088f (patch)
tree7f89238033aebca038770f6da775e13ec6902712 /fortran
parent66ce984dee99b7b58ec4632fecad3b2b758d08d5 (diff)
downloadhdf5-bc1bed2c55981f1802f87f83054d375431a0088f.zip
hdf5-bc1bed2c55981f1802f87f83054d375431a0088f.tar.gz
hdf5-bc1bed2c55981f1802f87f83054d375431a0088f.tar.bz2
Squash merge of file locking fixes
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Pf.c77
-rw-r--r--fortran/src/H5Pff.F90102
-rw-r--r--fortran/src/H5f90proto.h2
-rw-r--r--fortran/src/hdf5_fortrandll.def.in2
4 files changed, 183 insertions, 0 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 7cb3db8..9816d7b 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -5241,6 +5241,83 @@ h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr)
return ret_value;
}
+/****if* H5Pf/h5pset_file_locking_c
+ * NAME
+ * h5pset_file_locking_c
+ * PURPOSE
+ * Call H5Pset_file_locking to set file locking properties.
+ * INPUTS
+ * prp_id - file access property list identifier
+ * use_file_locking - TRUE/FALSE flag
+ * ignore_disabled_file_locking - TRUE/FALSE flag
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Dana Robinson
+ * Summer 2020
+ * SOURCE
+*/
+int_f
+h5pset_file_locking_c(hid_t_f *prp_id, int_f *use_file_locking, int_f *ignore_disabled_file_locking)
+/******/
+{
+ int ret_value = 0;
+ hid_t c_prp_id = H5I_INVALID_HID;
+ herr_t status;
+ hbool_t c_use_flag = 1;
+ hbool_t c_ignore_flag = 1;
+
+ if (*use_file_locking == 0) c_use_flag = 0;
+ if (*ignore_disabled_file_locking == 0) c_ignore_flag = 1;
+
+ c_prp_id = (hid_t)*prp_id;
+
+ status = H5Pset_file_locking(c_prp_id, c_use_flag, c_ignore_flag);
+
+ if ( status < 0 ) ret_value = -1;
+
+ return ret_value;
+}
+
+
+/****if* H5Pf/h5pget_file_locking_c
+ * NAME
+ * h5pget_file_locking_c
+ * PURPOSE
+ * Call H5Pget_file_locking to get file locking properties.
+ * INPUTS
+ * prp_id - file access property list identifier
+ * use_file_locking - TRUE/FALSE flag
+ * ignore_disabled_file_locking - TRUE/FALSE flag
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Dana Robinson
+ * Summer 2020
+ * SOURCE
+*/
+int_f
+h5pget_file_locking_c(hid_t_f *prp_id, int_f *use_file_locking, int_f *ignore_disabled_file_locking)
+/******/
+{
+ int ret_value = 0;
+ hid_t c_prp_id = H5I_INVALID_HID;
+ hbool_t c_use_flag = 1;
+ hbool_t c_ignore_flag = 1;
+ herr_t c_ret;
+
+ c_prp_id = (hid_t)*prp_id;
+
+ c_ret = H5Pget_file_locking(c_prp_id, &c_use_flag, &c_ignore_flag);
+
+ if ( c_ret < 0 ) ret_value = -1;
+
+ *use_file_locking = (int_f)c_use_flag;
+ *ignore_disabled_file_locking = (int_f)c_ignore_flag;
+
+ return ret_value;
+}
+
#ifdef H5_HAVE_PARALLEL
/****if* H5Pf/h5pset_fapl_mpio_c
* NAME
diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90
index 7e06cf3..40c4e95 100644
--- a/fortran/src/H5Pff.F90
+++ b/fortran/src/H5Pff.F90
@@ -8263,5 +8263,107 @@ END SUBROUTINE h5pget_virtual_dsetname_f
END SUBROUTINE h5pget_vol_id_f
+!****s* H5P (F03)/h5pget_file_locking_f_F03
+!
+! NAME
+! h5pget_file_locking_f
+!
+! PURPOSE
+! Gets the file locking properties. File locking is mainly used to help
+! enforce SWMR semantics.
+!
+! INPUTS
+! fapl_id - Target file access property list identifier.
+!
+! OUTPUTS
+! use_file_locking - Whether or not to use file locks.
+! ignore_disabled_locks - Whether or not to ignore file locks when locking
+! is disabled on a file system.
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! AUTHOR
+! Dana Robinson
+! Summer 2020
+!
+! Fortran2003 Interface:
+ SUBROUTINE h5pget_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: fapl_id
+ LOGICAL , INTENT(OUT) :: use_file_locking
+ LOGICAL , INTENT(OUT) :: ignore_disabled_locks
+ INTEGER , INTENT(OUT) :: hdferr
+!*****
+ LOGICAL(C_BOOL) :: c_use_flag
+ LOGICAL(C_BOOL) :: c_ignore_flag
+
+ INTERFACE
+ INTEGER FUNCTION h5pget_file_locking_c(fapl_id, use_file_locking, ignore_disabled_locks) BIND(C, NAME='H5Pget_file_locking')
+ IMPORT :: HID_T, C_BOOL
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: fapl_id
+ LOGICAL(C_BOOL), INTENT(OUT) :: use_file_locking
+ LOGICAL(C_BOOL), INTENT(OUT) :: ignore_disabled_locks
+ END FUNCTION h5pget_file_locking_c
+ END INTERFACE
+
+ hdferr = INT(h5pget_file_locking_c(fapl_id, c_use_flag, c_ignore_flag))
+
+ ! Transfer value of C C_BOOL type to Fortran LOGICAL
+ use_file_locking = c_use_flag
+ ignore_disabled_locks = c_ignore_flag
+
+ END SUBROUTINE h5pget_file_locking_f
+
+!****s* H5P (F03)/h5pset_file_locking_f_F03
+!
+! NAME
+! h5pset_file_locking_f
+!
+! PURPOSE
+! Sets the file locking properties. File locking is mainly used to help
+! enforce SWMR semantics.
+!
+! INPUTS
+! fapl_id - Target file access property list identifier.
+! use_file_locking - Whether or not to use file locks.
+! ignore_disabled_locks - Whether or not to ignore file locks when locking
+! is disabled on a file system.
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! AUTHOR
+! Dana Robinson
+! Summer 2020
+!
+! Fortran2003 Interface:
+ SUBROUTINE h5pset_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: fapl_id
+ LOGICAL , INTENT(IN) :: use_file_locking
+ LOGICAL , INTENT(IN) :: ignore_disabled_locks
+ INTEGER , INTENT(OUT) :: hdferr
+!*****
+ LOGICAL(C_BOOL) :: c_use_flag
+ LOGICAL(C_BOOL) :: c_ignore_flag
+
+ INTERFACE
+ INTEGER FUNCTION h5pset_file_locking_c(fapl_id, use_file_locking, ignore_disabled_locks) BIND(C, NAME='H5Pset_file_locking')
+ IMPORT :: HID_T, C_BOOL
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: fapl_id
+ LOGICAL(C_BOOL), INTENT(IN) :: use_file_locking
+ LOGICAL(C_BOOL), INTENT(IN) :: ignore_disabled_locks
+ END FUNCTION h5pset_file_locking_c
+ END INTERFACE
+
+ ! Transfer value of Fortran LOGICAL to C C_BOOL type
+ c_use_flag = use_file_locking
+ c_ignore_flag = ignore_disabled_locks
+
+ hdferr = INT(h5pset_file_locking_c(fapl_id, c_use_flag, c_ignore_flag))
+
+ END SUBROUTINE h5pset_file_locking_f
+
END MODULE H5P
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 695efcd..56a685e 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -481,6 +481,8 @@ H5_FCDLL int_f h5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks);
H5_FCDLL int_f h5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks);
H5_FCDLL int_f h5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0);
H5_FCDLL int_f h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0);
+H5_FCDLL int_f h5pset_file_locking_c(hid_t_f *prp_id, int_f *use_file_locking, int_f *ignore_disabled_file_locking);
+H5_FCDLL int_f h5pget_file_locking_c(hid_t_f *prp_id, int_f *use_file_locking, int_f *ignore_disabled_file_locking);
#ifdef H5_HAVE_PARALLEL
H5_FCDLL int_f h5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode);
H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info);
diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in
index 9c69e5a..4207239 100644
--- a/fortran/src/hdf5_fortrandll.def.in
+++ b/fortran/src/hdf5_fortrandll.def.in
@@ -339,6 +339,8 @@ H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F
H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F
H5P_mp_H5PSET_VOL_F
H5P_mp_H5PGET_VOL_ID_F
+H5P_mp_H5PSET_FILE_LOCKING_F
+H5P_mp_H5PGET_FILE_LOCKING_F
; Parallel
@H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F
@H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F