File Add-H5F-RFIC-boilerplate.patch of Package hdf5.34857

From: Egbert Eich <eich@suse.com>
Date: Tue May 21 13:27:12 2024 +0200
Subject: Add H5F RFIC boilerplate
Patch-mainline: Upstream
Git-repo: https://github.com/HDFGroup/hdf5
Git-commit: cc89f466355fbbb1da91be6d57bead629493f32f
References: bsc#1224158


Signed-off-by: Egbert Eich <eich@suse.de>
---
 src/H5Fpkg.h     |  1 +
 src/H5Fprivate.h |  6 +++++-
 src/H5Fpublic.h  | 14 ++++++++++++++
 src/H5Fquery.c   | 28 ++++++++++++++++++++++++----
 4 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index b5df1c3d73..aecc95ecae 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -304,6 +304,7 @@ struct H5F_shared_t {
     H5FO_t              *open_objs;         /* Open objects in file                 */
     H5UC_t              *grp_btree_shared;  /* Ref-counted group B-tree node info   */
     hbool_t              use_file_locking;  /* Whether or not to use file locking */
+    uint64_t             rfic_flags;        /* Relaxed file integrity check (RFIC) flags */
 
     /* File space allocation information */
     H5F_fspace_strategy_t fs_strategy;  /* File space handling strategy	*/
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 3034841d6a..fc93c2a7c6 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -379,6 +379,7 @@ typedef struct H5F_t H5F_t;
 #define H5F_GET_MIN_DSET_OHDR(F)       ((F)->shared->crt_dset_min_ohdr_flag)
 #define H5F_SET_MIN_DSET_OHDR(F, V)    ((F)->shared->crt_dset_min_ohdr_flag = (V))
 #define H5F_USE_FILE_LOCKING(F)        ((F)->shared->use_file_locking)
+#define H5F_RFIC_FLAGS(F)              ((F)->shared->rfic_flags)
 #else /* H5F_MODULE */
 #define H5F_LOW_BOUND(F)                 (H5F_get_low_bound(F))
 #define H5F_HIGH_BOUND(F)                (H5F_get_high_bound(F))
@@ -441,6 +442,7 @@ typedef struct H5F_t H5F_t;
 #define H5F_GET_MIN_DSET_OHDR(F)       (H5F_get_min_dset_ohdr(F))
 #define H5F_SET_MIN_DSET_OHDR(F, V)    (H5F_set_min_dset_ohdr((F), (V)))
 #define H5F_USE_FILE_LOCKING(F)        (H5F_get_use_file_locking(F))
+#define H5F_RFIC_FLAGS(F)              (H5F_get_rfic_flags(F))
 #endif /* H5F_MODULE */
 
 /* Macros to encode/decode offset/length's for storing in the file */
@@ -614,6 +616,7 @@ typedef struct H5F_t H5F_t;
                         */
 #define H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME                                                              \
     "ignore_disabled_file_locks" /* whether or not we ignore "locks disabled" errors */
+#define H5F_ACS_RFIC_FLAGS_NAME "rfic_flags"           /* Relaxed file integrity check (RFIC) flags */
 
 /* ======================== File Mount properties ====================*/
 #define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */
@@ -852,7 +855,8 @@ H5_DLL hbool_t H5F_get_first_alloc_dealloc(const H5F_t *f);
 H5_DLL haddr_t H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f);
 H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f);
 H5_DLL herr_t  H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize);
-H5_DLL hbool_t H5F_get_file_locking(const H5F_t *f);
+H5_DLL hbool_t H5F_get_use_file_locking(const H5F_t *f);
+H5_DLL uint64_t            H5F_get_rfic_flags(const H5F_t *f);
 
 /* Functions than retrieve values set/cached from the superblock/FCPL */
 H5_DLL haddr_t            H5F_get_base_addr(const H5F_t *f);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 84f4218ee4..f80cd512ae 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -240,6 +240,20 @@ typedef struct H5F_retry_info_t {
  */
 typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata);
 
+/*
+ * These are the bits that can be passed to the `flags' argument of
+ * H5Pset_relax_file_integrity_checks(). Use the bit-wise OR operator (|) to
+ * combine them as needed.
+ */
+#define H5F_RFIC_UNUSUAL_NUM_UNUSED_NUMERIC_BITS                                                             \
+    (0x0001u) /**< Suppress errors for numeric datatypes with an unusually                                   \
+               *   high number of unused bits.  See documentation for                                        \
+               *   H5Pset_relax_file_integrity_checks for details. */
+#define H5F_RFIC_ALL                                                                                         \
+    (H5F_RFIC_UNUSUAL_NUM_UNUSED_NUMERIC_BITS) /**< Suppress all format integrity check errors.  See         \
+                                                *   documentation for H5Pset_relax_file_integrity_checks     \
+                                                *   for details. */
+
 /*********************/
 /* Public Prototypes */
 /*********************/
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 06e5e45343..896710a767 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -1241,16 +1241,16 @@ H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f)
 } /* end H5F_get_eoa_pre_fsm_fsalloc() */
 
 /*-------------------------------------------------------------------------
- * Function: H5F_get_file_locking
+ * Function: H5F_get_use_file_locking
  *
- * Purpose:  Get the file locking flag for the file
+ * Purpose:  Get 'use the file locking' flag for the file
  *
  * Return:   TRUE/FALSE
  *
  *-------------------------------------------------------------------------
  */
 hbool_t
-H5F_get_file_locking(const H5F_t *f)
+H5F_get_use_file_locking(const H5F_t *f)
 {
     FUNC_ENTER_NOAPI_NOINIT_NOERR
 
@@ -1258,4 +1258,24 @@ H5F_get_file_locking(const H5F_t *f)
     HDassert(f->shared);
 
     FUNC_LEAVE_NOAPI(f->shared->use_file_locking)
-} /* end H5F_get_file_locking */
+} /* end H5F_get_use_file_locking */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_rfic_flags
+ *
+ * Purpose:  Get the relaxed file integrity checks (RFIC) flags for the file
+ *
+ * Return:   RFIC flags for a file on success (which can be 0), can't fail
+ *
+ *-------------------------------------------------------------------------
+ */
+uint64_t
+H5F_get_rfic_flags(const H5F_t *f)
+{
+    FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+    assert(f);
+    assert(f->shared);
+
+    FUNC_LEAVE_NOAPI(f->shared->rfic_flags)
+} /* end H5F_get_rfic_flags */
openSUSE Build Service is sponsored by