Coverage Report

Created: 2026-11-22 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hdf5/src/H5Cepoch.c
Line
Count
Source
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
 * Copyright by The HDF Group.                                               *
3
 * All rights reserved.                                                      *
4
 *                                                                           *
5
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
6
 * terms governing use, modification, and redistribution, is contained in    *
7
 * the LICENSE file, which can be found at the root of the source code       *
8
 * distribution tree, or in https://www.hdfgroup.org/licenses.               *
9
 * If you do not have access to either file, you may request a copy from     *
10
 * help@hdfgroup.org.                                                        *
11
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13
/*-------------------------------------------------------------------------
14
 *
15
 * Created:     H5Cepoch.c
16
 *
17
 * Purpose:     Metadata cache epoch callbacks
18
 *
19
 *-------------------------------------------------------------------------
20
 */
21
22
/****************/
23
/* Module Setup */
24
/****************/
25
26
#include "H5Cmodule.h" /* This source code file is part of the H5C module */
27
28
/***********/
29
/* Headers */
30
/***********/
31
#include "H5private.h"   /* Generic Functions                        */
32
#include "H5ACprivate.h" /* Metadata Cache                           */
33
#include "H5Cpkg.h"      /* Cache                                    */
34
#include "H5Eprivate.h"  /* Error Handling                           */
35
#include "H5Fprivate.h"  /* Files                                    */
36
37
/****************/
38
/* Local Macros */
39
/****************/
40
41
/******************/
42
/* Local Typedefs */
43
/******************/
44
45
/********************/
46
/* Local Prototypes */
47
/********************/
48
49
/****************************************************************************
50
 *
51
 * declarations for epoch marker cache entries.
52
 *
53
 * As a strategy for automatic cache size reduction, the cache may insert
54
 * marker entries in the LRU list at the end of each epoch.  These markers
55
 * are then used to identify entries that have not been accessed for 'n'
56
 * epochs so that they can be evicted from the cache.
57
 *
58
 ****************************************************************************/
59
static herr_t H5C__epoch_marker_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr);
60
static herr_t H5C__epoch_marker_get_final_load_size(const void *image_ptr, size_t image_len_ptr,
61
                                                    void *udata_ptr, size_t *actual_len);
62
static htri_t H5C__epoch_marker_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
63
static void  *H5C__epoch_marker_deserialize(const void *image_ptr, size_t len, void *udata, bool *dirty_ptr);
64
static herr_t H5C__epoch_marker_image_len(const void *thing, size_t *image_len_ptr);
65
static herr_t H5C__epoch_marker_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len,
66
                                              haddr_t *new_addr_ptr, size_t *new_len_ptr,
67
                                              unsigned *flags_ptr);
68
static herr_t H5C__epoch_marker_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
69
static herr_t H5C__epoch_marker_notify(H5C_notify_action_t action, void *thing);
70
static herr_t H5C__epoch_marker_free_icr(void *thing);
71
static herr_t H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED *thing,
72
                                         hsize_t H5_ATTR_UNUSED    *fsf_size_ptr);
73
74
/*********************/
75
/* Package Variables */
76
/*********************/
77
78
/*****************************/
79
/* Library Private Variables */
80
/*****************************/
81
82
/*******************/
83
/* Local Variables */
84
/*******************/
85
86
const H5AC_class_t H5AC_EPOCH_MARKER[1] = {
87
    {/* id                    = */ H5AC_EPOCH_MARKER_ID,
88
     /* name                  = */ "epoch marker",
89
     /* mem_type              = */ H5FD_MEM_DEFAULT, /* value doesn't matter */
90
     /* flags                 = */ H5AC__CLASS_NO_FLAGS_SET,
91
     /* get_initial_load_size = */ H5C__epoch_marker_get_initial_load_size,
92
     /* get_final_load_size   = */ H5C__epoch_marker_get_final_load_size,
93
     /* verify_chksum         = */ H5C__epoch_marker_verify_chksum,
94
     /* deserialize           = */ H5C__epoch_marker_deserialize,
95
     /* image_len             = */ H5C__epoch_marker_image_len,
96
     /* pre_serialize         = */ H5C__epoch_marker_pre_serialize,
97
     /* serialize             = */ H5C__epoch_marker_serialize,
98
     /* notify                = */ H5C__epoch_marker_notify,
99
     /* free_icr              = */ H5C__epoch_marker_free_icr,
100
     /* fsf_size              = */ H5C__epoch_marker_fsf_size}};
101
102
/***************************************************************************
103
 * Class functions for H5C__EPOCH_MAKER_TYPE:
104
 *
105
 * None of these functions should ever be called, so there is no point in
106
 * documenting them separately.
107
 *
108
 ***************************************************************************/
109
110
static herr_t
111
H5C__epoch_marker_get_initial_load_size(void H5_ATTR_UNUSED *udata_ptr, size_t H5_ATTR_UNUSED *image_len_ptr)
112
0
{
113
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
114
0
115
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
116
117
0
    FUNC_LEAVE_NOAPI(FAIL)
118
0
} /* end H5C__epoch_marker_get_initial_load_size() */
119
120
static herr_t
121
H5C__epoch_marker_get_final_load_size(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED image_len,
122
                                      void H5_ATTR_UNUSED *udata_ptr, size_t H5_ATTR_UNUSED *actual_len)
123
0
{
124
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
125
0
126
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
127
128
0
    FUNC_LEAVE_NOAPI(FAIL)
129
0
} /* end H5C__epoch_marker_final_get_load_size() */
130
131
static htri_t
132
H5C__epoch_marker_verify_chksum(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len,
133
                                void H5_ATTR_UNUSED *udata_ptr)
134
0
{
135
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
136
0
137
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
138
139
0
    FUNC_LEAVE_NOAPI(false)
140
0
} /* end H5C__epoch_marker_verify_chksum() */
141
142
static void *
143
H5C__epoch_marker_deserialize(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len,
144
                              void H5_ATTR_UNUSED *udata, bool H5_ATTR_UNUSED *dirty_ptr)
145
0
{
146
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
147
0
148
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
149
150
0
    FUNC_LEAVE_NOAPI(NULL)
151
0
} /* end H5C__epoch_marker_deserialize() */
152
153
static herr_t
154
H5C__epoch_marker_image_len(const void H5_ATTR_UNUSED *thing, size_t H5_ATTR_UNUSED *image_len_ptr)
155
0
{
156
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
157
0
158
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
159
160
0
    FUNC_LEAVE_NOAPI(FAIL)
161
0
} /* end H5C__epoch_marker_image_len() */
162
163
static herr_t
164
H5C__epoch_marker_pre_serialize(H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *thing,
165
                                haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len,
166
                                haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr,
167
                                unsigned H5_ATTR_UNUSED *flags_ptr)
168
0
{
169
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
170
0
171
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
172
173
0
    FUNC_LEAVE_NOAPI(FAIL)
174
0
} /* end H5C__epoch_marker_pre_serialize() */
175
176
static herr_t
177
H5C__epoch_marker_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *image_ptr,
178
                            size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
179
0
{
180
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
181
0
182
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
183
184
0
    FUNC_LEAVE_NOAPI(FAIL)
185
0
} /* end H5C__epoch_marker_serialize() */
186
187
static herr_t
188
H5C__epoch_marker_notify(H5C_notify_action_t H5_ATTR_UNUSED action, void H5_ATTR_UNUSED *thing)
189
0
{
190
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
191
0
192
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
193
194
0
    FUNC_LEAVE_NOAPI(FAIL)
195
0
} /* end H5C__epoch_marker_notify() */
196
197
static herr_t
198
H5C__epoch_marker_free_icr(void H5_ATTR_UNUSED *thing)
199
0
{
200
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
201
0
202
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
203
204
0
    FUNC_LEAVE_NOAPI(FAIL)
205
0
} /* end H5C__epoch_marker_free_icr() */
206
207
static herr_t
208
H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED *thing, hsize_t H5_ATTR_UNUSED *fsf_size_ptr)
209
0
{
210
0
    FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */
211
0
212
0
        HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
213
214
0
    FUNC_LEAVE_NOAPI(FAIL)
215
0
} /* end H5C__epoch_marker_fsf_size() */