1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * Copyright by the Board of Trustees of the University of Illinois.         *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the COPYING file, which can be found at the root of the source code       *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
10  * If you do not have access to either file, you may request a copy from     *
11  * help@hdfgroup.org.                                                        *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15  * Programmer:	Quincey Koziol <koziol@ncsa.uiuc.edu>
16  *		Friday, February 24, 2006
17  *
18  * Purpose:	This file contains declarations which are visible only within
19  *		the H5HF package.  Source files outside the H5HF package should
20  *		include H5HFprivate.h instead.
21  */
22 #if !(defined H5HF_FRIEND || defined H5HF_MODULE)
23 #error "Do not include this file outside the H5HF package!"
24 #endif
25 
26 #ifndef _H5HFpkg_H
27 #define _H5HFpkg_H
28 
29 /* Get package's private header */
30 #include "H5HFprivate.h"
31 
32 /* Other private headers needed by this file */
33 #include "H5ACprivate.h"	/* Metadata cache			*/
34 #include "H5B2private.h"	/* v2 B-trees				*/
35 #include "H5FLprivate.h"	/* Free Lists                           */
36 #include "H5FSprivate.h"	/* Free space manager			*/
37 #include "H5SLprivate.h"	/* Skip lists				*/
38 
39 /**************************/
40 /* Package Private Macros */
41 /**************************/
42 
43 /* Size of checksum information (on disk) */
44 #define H5HF_SIZEOF_CHKSUM      4
45 
46 /* "Standard" size of prefix information for fractal heap metadata */
47 #define H5HF_METADATA_PREFIX_SIZE(c) (                                        \
48     H5_SIZEOF_MAGIC   /* Signature */                                         \
49     + (unsigned)1 /* Version */                                               \
50     + ((c) ? (unsigned)H5HF_SIZEOF_CHKSUM : (unsigned)0) /* Metadata checksum */ \
51     )
52 
53 /* Size of doubling-table information */
54 #define H5HF_DTABLE_INFO_SIZE(h) (                                            \
55     (unsigned)2   /* Width of table (i.e. # of columns) */                    \
56     + (unsigned)(h)->sizeof_size /* Starting block size */                    \
57     + (unsigned)(h)->sizeof_size /* Maximum direct block size */              \
58     + (unsigned)2 /* Max. size of heap (log2 of actual value - i.e. the # of bits) */   \
59     + (unsigned)2 /* Starting # of rows in root indirect block */             \
60     + (unsigned)(h)->sizeof_addr /* File address of table managed */          \
61     + (unsigned)2 /* Current # of rows in root indirect block */              \
62     )
63 
64 /* Flags for status byte */
65 #define H5HF_HDR_FLAGS_HUGE_ID_WRAPPED 0x01     /* "huge" object IDs have wrapped */
66 #define H5HF_HDR_FLAGS_CHECKSUM_DBLOCKS 0x02    /* checksum direct blocks */
67 
68 /* Size of the fractal heap header on disk */
69 /* (this is the fixed-len portion, the variable-len I/O filter information
70  *      follows this information, if there are I/O filters for the heap)
71  */
72 #define H5HF_HEADER_SIZE(h)     (                                             \
73     /* General metadata fields */                                             \
74     H5HF_METADATA_PREFIX_SIZE(TRUE)                                           \
75                                                                               \
76     /* Fractal Heap Header specific fields */                                 \
77                                                                               \
78     /* General heap information */                                            \
79     + (unsigned)2 /* Heap ID len */                                           \
80     + (unsigned)2 /* I/O filters' encoded len */                              \
81     + (unsigned)1 /* Status flags */                                          \
82                                                                               \
83     /* "Huge" object fields */                                                \
84     + (unsigned)4 /* Max. size of "managed" object */                         \
85     + (unsigned)(h)->sizeof_size /* Next ID for "huge" object */              \
86     + (unsigned)(h)->sizeof_addr /* File address of "huge" object tracker B-tree  */    \
87                                                                               \
88     /* "Managed" object free space fields */                                  \
89     + (unsigned)(h)->sizeof_size /* Total man. free space */                  \
90     + (unsigned)(h)->sizeof_addr /* File address of free section header */    \
91                                                                               \
92     /* Statistics fields */                                                   \
93     + (unsigned)(h)->sizeof_size /* Size of man. space in heap */             \
94     + (unsigned)(h)->sizeof_size /* Size of man. space iterator offset in heap */ \
95     + (unsigned)(h)->sizeof_size /* Size of alloacted man. space in heap */   \
96     + (unsigned)(h)->sizeof_size /* Number of man. objects in heap */         \
97     + (unsigned)(h)->sizeof_size /* Size of huge space in heap */             \
98     + (unsigned)(h)->sizeof_size /* Number of huge objects in heap */         \
99     + (unsigned)(h)->sizeof_size /* Size of tiny space in heap */             \
100     + (unsigned)(h)->sizeof_size /* Number of tiny objects in heap */         \
101                                                                               \
102     /* "Managed" object doubling table info */                                \
103     + H5HF_DTABLE_INFO_SIZE(h) /* Size of managed obj. doubling-table info */ \
104     )
105 
106 /* Size of overhead for a direct block */
107 #define H5HF_MAN_ABS_DIRECT_OVERHEAD(h) (                                     \
108     /* General metadata fields */                                             \
109     H5HF_METADATA_PREFIX_SIZE(h->checksum_dblocks)                            \
110                                                                               \
111     /* Fractal heap managed, absolutely mapped direct block specific fields */ \
112     + (unsigned)(h)->sizeof_addr          /* File address of heap owning the block */ \
113     + (unsigned)(h)->heap_off_size        /* Offset of the block in the heap */ \
114     )
115 
116 /* Size of managed indirect block entry for a child direct block */
117 #define H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h) (                           \
118     ((h)->filter_len > 0 ?                                                    \
119         ((unsigned)(h)->sizeof_addr + (unsigned)(h)->sizeof_size + (unsigned)4) : /* Size of entries for filtered direct blocks */ \
120         (unsigned)(h)->sizeof_addr)             /* Size of entries for un-filtered direct blocks */ \
121     )
122 
123 /* Size of managed indirect block */
124 #define H5HF_MAN_INDIRECT_SIZE(h, r) (                                        \
125     /* General metadata fields */                                             \
126     H5HF_METADATA_PREFIX_SIZE(TRUE)                                           \
127                                                                               \
128     /* Fractal heap managed, absolutely mapped indirect block specific fields */ \
129     + (unsigned)(h)->sizeof_addr          /* File address of heap owning the block */   \
130     + (unsigned)(h)->heap_off_size        /* Offset of the block in the heap */         \
131     + (MIN(r, (h)->man_dtable.max_direct_rows) * (h)->man_dtable.cparam.width * H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h)) /* Size of entries for direct blocks */ \
132     + (((r > (h)->man_dtable.max_direct_rows) ? (r - (h)->man_dtable.max_direct_rows) : 0)  * (h)->man_dtable.cparam.width * (h)->sizeof_addr) /* Size of entries for indirect blocks */ \
133     )
134 
135 /* Compute the # of bytes required to store an offset into a given buffer size */
136 #define H5HF_SIZEOF_OFFSET_BITS(b)   (((b) + 7) / 8)
137 #define H5HF_SIZEOF_OFFSET_LEN(l)   H5HF_SIZEOF_OFFSET_BITS(H5VM_log2_of2((unsigned)(l)))
138 
139 /* Heap ID bit flags */
140 /* Heap ID version (2 bits: 6-7) */
141 #define H5HF_ID_VERS_CURR       0x00    /* Current version of ID format */
142 #define H5HF_ID_VERS_MASK       0xC0    /* Mask for getting the ID version from flags */
143 /* Heap ID type (2 bits: 4-5) */
144 #define H5HF_ID_TYPE_MAN        0x00    /* "Managed" object - stored in fractal heap blocks */
145 #define H5HF_ID_TYPE_HUGE       0x10    /* "Huge" object - stored in file directly */
146 #define H5HF_ID_TYPE_TINY       0x20    /* "Tiny" object - stored in heap ID directly */
147 #define H5HF_ID_TYPE_RESERVED   0x30    /* "?" object - reserved for future use */
148 #define H5HF_ID_TYPE_MASK       0x30    /* Mask for getting the ID type from flags */
149 /* Heap ID bits 0-3 reserved for future use */
150 
151 /* Encode a "managed" heap ID */
152 #define H5HF_MAN_ID_ENCODE(i, h, o, l)                                        \
153     *(i) = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN;                              \
154     (i)++;                                                                    \
155     UINT64ENCODE_VAR((i), (o), (h)->heap_off_size);                           \
156     UINT64ENCODE_VAR((i), (l), (h)->heap_len_size)
157 
158 /* Decode a "managed" heap ID */
159 #define H5HF_MAN_ID_DECODE(i, h, f, o, l)                                     \
160     f = *(uint8_t *)i++;                                                      \
161     UINT64DECODE_VAR((i), (o), (h)->heap_off_size);                           \
162     UINT64DECODE_VAR((i), (l), (h)->heap_len_size)
163 
164 /* Free space section types for fractal heap */
165 /* (values stored in free space data structures in file) */
166 #define H5HF_FSPACE_SECT_SINGLE         0       /* Section is a range of actual bytes in a direct block */
167 #define H5HF_FSPACE_SECT_FIRST_ROW      1       /* Section is first range of blocks in an indirect block row */
168 #define H5HF_FSPACE_SECT_NORMAL_ROW     2       /* Section is a range of blocks in an indirect block row */
169 #define H5HF_FSPACE_SECT_INDIRECT       3       /* Section is a span of blocks in an indirect block */
170 
171 /* Flags for 'op' operations */
172 #define H5HF_OP_MODIFY          0x0001          /* Operation will modify object */
173 #define H5HF_OP_FLAGS           (H5HF_OP_MODIFY)        /* Bit-wise OR of all op flags */
174 
175 /* Flags for 'root_iblock_flags' field in header */
176 #define H5HF_ROOT_IBLOCK_PINNED         0x01
177 #define H5HF_ROOT_IBLOCK_PROTECTED      0x02
178 
179 
180 /****************************/
181 /* Package Private Typedefs */
182 /****************************/
183 
184 /* Doubling-table info */
185 typedef struct H5HF_dtable_t {
186     /* Immutable, pre-set information for table */
187     H5HF_dtable_cparam_t    cparam;     /* Creation parameters for table */
188 
189     /* Derived information (stored, varies during lifetime of table) */
190     haddr_t     table_addr;     /* Address of first block for table */
191                                 /* Undefined if no space allocated for table */
192     unsigned    curr_root_rows; /* Current number of rows in the root indirect block */
193                                 /* 0 indicates that the TABLE_ADDR field points
194                                  * to direct block (of START_BLOCK_SIZE) instead
195                                  * of indirect root block.
196                                  */
197 
198     /* Computed information (not stored) */
199     unsigned    max_root_rows;      /* Maximum # of rows in root indirect block */
200     unsigned    max_direct_rows;    /* Maximum # of direct rows in any indirect block */
201     unsigned    start_bits;         /* # of bits for starting block size (i.e. log2(start_block_size)) */
202     unsigned    max_direct_bits;    /* # of bits for max. direct block size (i.e. log2(max_direct_size)) */
203     unsigned    max_dir_blk_off_size;   /* Max. size of offsets in direct blocks */
204     unsigned    first_row_bits;     /* # of bits in address of first row */
205     hsize_t     num_id_first_row;   /* Number of IDs in first row of table */
206     hsize_t     *row_block_size;    /* Block size per row of indirect block */
207     hsize_t     *row_block_off;     /* Cumulative offset per row of indirect block */
208     hsize_t     *row_tot_dblock_free;   /* Total free space in dblocks for this row */
209                                     /* (For indirect block rows, it's the total
210                                      * free space in all direct blocks referenced
211                                      * from the indirect block)
212                                      */
213     size_t      *row_max_dblock_free;   /* Max. free space in dblocks for this row */
214                                     /* (For indirect block rows, it's the maximum
215                                      * free space in a direct block referenced
216                                      * from the indirect block)
217                                      */
218 } H5HF_dtable_t;
219 
220 /* Fractal heap free list info (forward decl - defined in H5HFflist.c) */
221 typedef struct H5HF_freelist_t H5HF_freelist_t;
222 
223 /* Forward decl indirect block info */
224 typedef struct H5HF_indirect_t H5HF_indirect_t;
225 
226 /* Fractal heap block location */
227 typedef struct H5HF_block_loc_t {
228     /* Necessary table fields */
229     unsigned    row;            /* Row of block in doubling table             */
230     unsigned    col;            /* Column of block in doubling table          */
231 
232     /* Derived/computed/cached table fields */
233     unsigned    entry;          /* Entry of block in doubling table           */
234 
235     /* Infrastructure */
236     H5HF_indirect_t *context;   /* Pointer to the indirect block containing the block */
237     struct H5HF_block_loc_t *up;  /* Pointer to next level up in the stack of levels */
238 } H5HF_block_loc_t;
239 
240 /* Fractal heap block iterator info */
241 typedef struct H5HF_block_iter_t {
242     hbool_t ready;              /* Set if iterator is finished initializing   */
243     H5HF_block_loc_t *curr;     /* Pointer to the current level information for iterator */
244 } H5HF_block_iter_t;
245 
246 /* Fractal heap free space section info */
247 typedef struct H5HF_free_section_t {
248     H5FS_section_info_t sect_info;              /* Free space section information (must be first in struct) */
249     union {
250         struct {
251             H5HF_indirect_t *parent;            /* Indirect block parent for free section's direct block */
252             unsigned par_entry;                 /* Entry of free section's direct block in parent indirect block */
253         } single;
254         struct {
255             struct H5HF_free_section_t *under;  /* Pointer to indirect block underlying row section */
256             unsigned    row;                    /* Row for range of blocks */
257             unsigned    col;                    /* Column for range of blocks */
258             unsigned    num_entries;            /* Number of entries covered */
259 
260             /* Fields that aren't stored */
261             hbool_t     checked_out;            /* Flag to indicate that a row section is temporarily out of the free space manager */
262         } row;
263         struct {
264             /* Holds either a pointer to an indirect block (if its "live") or
265              *  the block offset of it's indirect block (if its "serialized")
266              *  (This allows the indirect block that the section is within to
267              *          be compared with other sections, whether it's serialized
268              *          or not)
269              */
270             union {
271                 H5HF_indirect_t *iblock;        /* Indirect block for free section */
272                 hsize_t iblock_off;             /* Indirect block offset in "heap space" */
273             } u;
274             unsigned    row;                    /* Row for range of blocks */
275             unsigned    col;                    /* Column for range of blocks */
276             unsigned    num_entries;            /* Number of entries covered */
277 
278             /* Fields that aren't stored */
279             struct H5HF_free_section_t *parent; /* Pointer to "parent" indirect section */
280             unsigned    par_entry;              /* Entry within parent indirect section */
281             hsize_t     span_size;              /* Size of space tracked, in "heap space" */
282             unsigned    iblock_entries;         /* Number of entries in indirect block where section is located */
283             unsigned    rc;                     /* Reference count of outstanding row & child indirect sections */
284             unsigned    dir_nrows;              /* Number of direct rows in section */
285             struct H5HF_free_section_t **dir_rows;  /* Array of pointers to outstanding row sections */
286             unsigned    indir_nents;            /* Number of indirect entries in section */
287             struct H5HF_free_section_t **indir_ents; /* Array of pointers to outstanding child indirect sections */
288         } indirect;
289     } u;
290 } H5HF_free_section_t;
291 
292 /* The fractal heap header information */
293 /* (Each fractal heap header has certain information that is shared across all
294  * the instances of blocks in that fractal heap)
295  */
296 typedef struct H5HF_hdr_t {
297     /* Information for H5AC cache functions, _must_ be first field in structure */
298     H5AC_info_t cache_info;
299 
300     /* General header information (stored in header) */
301     unsigned    id_len;         /* Size of heap IDs (in bytes) */
302     unsigned    filter_len;     /* Size of I/O filter information (in bytes) */
303 
304     /* Flags for heap settings (stored in status byte in header) */
305     hbool_t     debug_objs;     /* Is the heap storing objects in 'debug' format */
306     hbool_t     write_once;     /* Is heap being written in "write once" mode? */
307     hbool_t     huge_ids_wrapped; /* Have "huge" object IDs wrapped around? */
308     hbool_t     checksum_dblocks; /* Should the direct blocks in the heap be checksummed? */
309 
310     /* Doubling table information (partially stored in header) */
311     /* (Partially set by user, partially derived/updated internally) */
312     H5HF_dtable_t man_dtable;   /* Doubling-table info for managed objects */
313 
314     /* Free space information for managed objects (stored in header) */
315     hsize_t     total_man_free; /* Total amount of free space in managed blocks */
316     haddr_t     fs_addr;        /* Address of free space header on disk */
317 
318     /* "Huge" object support (stored in header) */
319     uint32_t    max_man_size;   /* Max. size of object to manage in doubling table */
320     hsize_t     huge_next_id;   /* Next ID to use for indirectly tracked 'huge' object */
321     haddr_t     huge_bt2_addr;  /* Address of v2 B-tree for tracking "huge" object info */
322 
323     /* I/O filter support (stored in header, if any are used) */
324     H5O_pline_t pline;          /* I/O filter pipeline for heap objects */
325     size_t      pline_root_direct_size;    /* Size of filtered root direct block */
326     unsigned    pline_root_direct_filter_mask; /* I/O filter mask for filtered root direct block */
327 
328     /* Statistics for heap (stored in header) */
329     hsize_t     man_size;       /* Total amount of 'managed' space in heap */
330     hsize_t     man_alloc_size; /* Total amount of allocated 'managed' space in heap */
331     hsize_t     man_iter_off;   /* Offset of iterator in 'managed' heap space */
332     hsize_t     man_nobjs;      /* Number of 'managed' objects in heap */
333     hsize_t     huge_size;      /* Total size of 'huge' objects in heap */
334     hsize_t     huge_nobjs;     /* Number of 'huge' objects in heap */
335     hsize_t     tiny_size;      /* Total size of 'tiny' objects in heap */
336     hsize_t     tiny_nobjs;     /* Number of 'tiny' objects in heap */
337 
338     /* Cached/computed values (not stored in header) */
339     size_t      rc;             /* Reference count of heap's components using heap header */
340     haddr_t     heap_addr;      /* Address of heap header in the file */
341     size_t      heap_size;      /* Size of heap header in the file */
342     unsigned    mode;           /* Access mode for heap */
343     H5F_t      *f;              /* Pointer to file for heap */
344     size_t      file_rc;        /* Reference count of files using heap header */
345     hbool_t     pending_delete; /* Heap is pending deletion */
346     uint8_t     sizeof_size;    /* Size of file sizes */
347     uint8_t     sizeof_addr;    /* Size of file addresses */
348     struct H5HF_indirect_t *root_iblock;    /* Pointer to root indirect block */
349     unsigned    root_iblock_flags;      /* Flags to indicate whether root indirect block is pinned/protected */
350     H5FS_t      *fspace;        /* Free space list for objects in heap */
351     H5HF_block_iter_t next_block;   /* Block iterator for searching for next block with space */
352     H5B2_t      *huge_bt2;      /* v2 B-tree handle for huge objects */
353     hsize_t     huge_max_id;    /* Max. 'huge' heap ID before rolling 'huge' heap IDs over */
354     uint8_t     huge_id_size;   /* Size of 'huge' heap IDs (in bytes) */
355     hbool_t     huge_ids_direct; /* Flag to indicate that 'huge' object's offset & length are stored directly in heap ID */
356     size_t      tiny_max_len;   /* Max. size of tiny objects for this heap */
357     hbool_t     tiny_len_extended; /* Flag to indicate that 'tiny' object's length is stored in extended form (i.e. w/extra byte) */
358     uint8_t     heap_off_size;  /* Size of heap offsets (in bytes) */
359     uint8_t     heap_len_size;  /* Size of heap ID lengths (in bytes) */
360     hbool_t     checked_filters; /* TRUE if pipeline passes can_apply checks */
361 } H5HF_hdr_t;
362 
363 /* Common indirect block doubling table entry */
364 /* (common between entries pointing to direct & indirect child blocks) */
365 typedef struct H5HF_indirect_ent_t {
366     haddr_t     addr;           /* Direct block's address                     */
367 } H5HF_indirect_ent_t;
368 
369 /* Extern indirect block doubling table entry for compressed direct blocks */
370 /* (only exists for indirect blocks in heaps that have I/O filters) */
371 typedef struct H5HF_indirect_filt_ent_t {
372     size_t     size;            /* Size of child direct block, after passing though I/O filters */
373     unsigned	filter_mask;	/* Excluded filters for child direct block */
374 } H5HF_indirect_filt_ent_t;
375 
376 /* Fractal heap indirect block */
377 struct H5HF_indirect_t {
378     /* Information for H5AC cache functions, _must_ be first field in structure */
379     H5AC_info_t cache_info;
380 
381     /* Internal heap information (not stored) */
382     size_t      rc;             /* Reference count of objects using this block */
383     H5HF_hdr_t	*hdr;	        /* Shared heap header info	              */
384     struct H5HF_indirect_t *parent;	/* Shared parent indirect block info  */
385     void        *fd_parent;	/* Saved copy of the parent pointer -- this   */
386 				/* necessary as the parent field is sometimes */
387 				/* nulled out before the eviction notify call */
388 				/* is made from the metadata cache.  Since    */
389 				/* this call cancels flush dependencies, it   */
390 				/* needs this information.		      */
391     unsigned    par_entry;      /* Entry in parent's table                    */
392     haddr_t     addr;           /* Address of this indirect block on disk     */
393     size_t      size;           /* Size of indirect block on disk             */
394     unsigned    nrows;          /* Total # of rows in indirect block          */
395     unsigned    max_rows;       /* Max. # of rows in indirect block           */
396     unsigned    nchildren;      /* Number of child blocks                     */
397     unsigned    max_child;      /* Max. offset used in child entries          */
398     struct H5HF_indirect_t **child_iblocks; /* Array of pointers to pinned child indirect blocks */
399     hbool_t     removed_from_cache;     /* Flag that indicates the block has  */
400                                 /* been removed from the metadata cache, but  */
401                                 /* is still 'live' due to a refcount (rc) > 0 */
402                                 /* (usually from free space sections)         */
403 
404     /* Stored values */
405     hsize_t     block_off;      /* Offset of the block within the heap's address space */
406     H5HF_indirect_ent_t *ents;  /* Pointer to block entry table               */
407     H5HF_indirect_filt_ent_t *filt_ents;    /* Pointer to filtered information for direct blocks */
408 };
409 
410 /* A fractal heap direct block */
411 typedef struct H5HF_direct_t {
412     /* Information for H5AC cache functions, _must_ be first field in structure */
413     H5AC_info_t cache_info;
414 
415     /* Internal heap information */
416     H5HF_hdr_t	*hdr;	        /* Shared heap header info	              */
417     H5HF_indirect_t *parent;	/* Shared parent indirect block info          */
418     void        *fd_parent;	/* Saved copy of the parent pointer -- this   */
419 				/* necessary as the parent field is sometimes */
420 				/* nulled out before the eviction notify call */
421 				/* is made from the metadata cache.  Since    */
422 				/* this call cancels flush dependencies, it   */
423 				/* needs this information.		      */
424     unsigned    par_entry;      /* Entry in parent's table                    */
425     size_t      size;           /* Size of direct block                       */
426     hsize_t     file_size;      /* Size of direct block in file (only valid when block's space is being freed) */
427     uint8_t     *blk;           /* Pointer to buffer containing block data    */
428     uint8_t	*write_buf;	/* Pointer to buffer containing the block data */
429                                 /* in form ready to copy to the metadata       */
430                                 /* cache's image buffer.                       */
431                                 /*                                             */
432                                 /* This field is used by                       */
433                                 /* H5HF_cache_dblock_pre_serialize() to pass   */
434                                 /* the serialized image of the direct block to */
435                                 /* H5HF_cache_dblock_serialize().  It should   */
436                                 /* NULL at all other times.                    */
437                                 /*                                             */
438                                 /* If I/O filters are enabled, the pre-        */
439                                 /* the pre-serialize function will allocate    */
440                                 /* a buffer, copy the filtered version of the  */
441                                 /* direct block image into it, and place the   */
442                                 /* base address of the buffer in this field.   */
443                                 /* The serialize function must discard this    */
444                                 /* buffer after it copies the contents into    */
445                                 /* the image buffer provided by the metadata   */
446                                 /* cache.                                      */
447                                 /*                                             */
448                                 /* If I/O filters are not enabled, the         */
449                                 /* write_buf field is simply set equal to the  */
450                                 /* blk field by the pre-serialize function,    */
451                                 /* and back to NULL by the serialize function. */
452     size_t	write_size;     /* size of the buffer pointed to by write_buf. */
453 
454     /* Stored values */
455     hsize_t     block_off;      /* Offset of the block within the heap's address space */
456 } H5HF_direct_t;
457 
458 /* Fractal heap */
459 struct H5HF_t {
460     H5HF_hdr_t  *hdr;           /* Pointer to internal fractal heap header info */
461     H5F_t      *f;              /* Pointer to file for heap */
462 };
463 
464 /* Fractal heap "parent info" (for loading a block) */
465 typedef struct H5HF_parent_t {
466     H5HF_hdr_t *hdr;                /* Pointer to heap header info */
467     H5HF_indirect_t *iblock;    /* Pointer to parent indirect block */
468     unsigned entry;             /* Location of block in parent's entry table */
469 } H5HF_parent_t;
470 
471 /* Typedef for indirectly accessed 'huge' object's records in the v2 B-tree */
472 typedef struct H5HF_huge_bt2_indir_rec_t {
473     haddr_t addr;       /* Address of the object in the file */
474     hsize_t len;        /* Length of the object in the file */
475     hsize_t id;         /* ID used for object (not used for 'huge' objects directly accessed) */
476 } H5HF_huge_bt2_indir_rec_t;
477 
478 /* Typedef for indirectly accessed, filtered 'huge' object's records in the v2 B-tree */
479 typedef struct H5HF_huge_bt2_filt_indir_rec_t {
480     haddr_t addr;       /* Address of the filtered object in the file */
481     hsize_t len;        /* Length of the filtered object in the file */
482     unsigned filter_mask;   /* I/O pipeline filter mask for filtered object in the file */
483     hsize_t obj_size;   /* Size of the de-filtered object in memory */
484     hsize_t id;         /* ID used for object (not used for 'huge' objects directly accessed) */
485 } H5HF_huge_bt2_filt_indir_rec_t;
486 
487 /* Typedef for directly accessed 'huge' object's records in the v2 B-tree */
488 typedef struct H5HF_huge_bt2_dir_rec_t {
489     haddr_t addr;       /* Address of the object in the file */
490     hsize_t len;        /* Length of the object in the file */
491 } H5HF_huge_bt2_dir_rec_t;
492 
493 /* Typedef for directly accessed, filtered 'huge' object's records in the v2 B-tree */
494 typedef struct H5HF_huge_bt2_filt_dir_rec_t {
495     haddr_t addr;       /* Address of the filtered object in the file */
496     hsize_t len;        /* Length of the filtered object in the file */
497     unsigned filter_mask;   /* I/O pipeline filter mask for filtered object in the file */
498     hsize_t obj_size;   /* Size of the de-filtered object in memory */
499 } H5HF_huge_bt2_filt_dir_rec_t;
500 
501 /* User data for free space section 'add' callback */
502 typedef struct {
503     H5HF_hdr_t *hdr;            /* Fractal heap header */
504 } H5HF_sect_add_ud_t;
505 
506 /* User data for v2 B-tree 'remove' callback on 'huge' objects */
507 typedef struct {
508     H5HF_hdr_t *hdr;            /* Fractal heap header (in) */
509     hsize_t obj_len;            /* Length of object removed (out) */
510 } H5HF_huge_remove_ud_t;
511 
512 /* User data for fractal heap header cache client callback */
513 typedef struct H5HF_hdr_cache_ud_t {
514     H5F_t *f;                   /* File pointer */
515 } H5HF_hdr_cache_ud_t;
516 
517 /* User data for fractal heap indirect block cache client callbacks */
518 typedef struct H5HF_iblock_cache_ud_t {
519     H5HF_parent_t * par_info;   /* Parent info */
520     H5F_t * f;                  /* File pointer */
521     const unsigned *nrows;      /* Number of rows */
522 } H5HF_iblock_cache_ud_t;
523 
524 /* User data for fractal heap direct block cache client callbacks */
525 typedef struct H5HF_dblock_cache_ud_t {
526     H5HF_parent_t par_info;     /* Parent info */
527     H5F_t * f;                  /* File pointer */
528     size_t odi_size;		/* On disk image size of the direct block.
529 				 * Note that there is no necessary relation
530 				 * between this value, and the actual
531 				 * direct block size, as conpression may
532 				 * reduce the size of the on disk image,
533 				 * and check sums may increase it.
534 				 */
535     size_t dblock_size;		/* size of the direct block, which bears
536 				 * no necessary relation to the block
537 				 * odi_size -- the size of the on disk
538 				 * image of the block.  Note that the
539 				 * metadata cache is only interested
540 				 * in the odi_size, and thus it is this
541 				 * value that is passed to the cache in
542 				 * calls to it.
543 				 */
544     unsigned filter_mask;	/* Excluded filters for direct block */
545     uint8_t *dblk;  /* Pointer to the buffer containing the decompressed
546                      * direct block data obtained in verify_chksum callback.
547                      * It will be used later in deserialize callback.
548                      */
549     htri_t decompressed;    /* Indicate that the direct block has been
550                              * decompressed in verify_chksum callback.
551                              * It will be used later in deserialize callback.
552                              */
553 } H5HF_dblock_cache_ud_t;
554 
555 
556 /*****************************/
557 /* Package Private Variables */
558 /*****************************/
559 
560 /* The v2 B-tree class for tracking indirectly accessed 'huge' objects */
561 H5_DLLVAR const H5B2_class_t H5HF_HUGE_BT2_INDIR[1];
562 
563 /* The v2 B-tree class for tracking indirectly accessed filtered 'huge' objects */
564 H5_DLLVAR const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1];
565 
566 /* The v2 B-tree class for tracking directly accessed 'huge' objects */
567 H5_DLLVAR const H5B2_class_t H5HF_HUGE_BT2_DIR[1];
568 
569 /* The v2 B-tree class for tracking directly accessed filtered 'huge' objects */
570 H5_DLLVAR const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1];
571 
572 /* H5HF single section inherits serializable properties from H5FS_section_class_t */
573 H5_DLLVAR H5FS_section_class_t H5HF_FSPACE_SECT_CLS_SINGLE[1];
574 
575 /* H5HF 'first' row section inherits serializable properties from H5FS_section_class_t */
576 H5_DLLVAR H5FS_section_class_t H5HF_FSPACE_SECT_CLS_FIRST_ROW[1];
577 
578 /* H5HF 'normal' row section inherits serializable properties from H5FS_section_class_t */
579 H5_DLLVAR H5FS_section_class_t H5HF_FSPACE_SECT_CLS_NORMAL_ROW[1];
580 
581 /* H5HF indirect section inherits serializable properties from H5FS_section_class_t */
582 H5_DLLVAR H5FS_section_class_t H5HF_FSPACE_SECT_CLS_INDIRECT[1];
583 
584 /* Declare a free list to manage the H5HF_indirect_t struct */
585 H5FL_EXTERN(H5HF_indirect_t);
586 
587 /* Declare a free list to manage the H5HF_indirect_ent_t sequence information */
588 H5FL_SEQ_EXTERN(H5HF_indirect_ent_t);
589 
590 /* Declare a free list to manage the H5HF_indirect_filt_ent_t sequence information */
591 H5FL_SEQ_EXTERN(H5HF_indirect_filt_ent_t);
592 
593 /* Declare a free list to manage the H5HF_indirect_t * sequence information */
594 typedef H5HF_indirect_t *H5HF_indirect_ptr_t;
595 H5FL_SEQ_EXTERN(H5HF_indirect_ptr_t);
596 
597 /* Declare a free list to manage the H5HF_direct_t struct */
598 H5FL_EXTERN(H5HF_direct_t);
599 
600 /* Declare a free list to manage heap direct block data to/from disk */
601 H5FL_BLK_EXTERN(direct_block);
602 
603 
604 /******************************/
605 /* Package Private Prototypes */
606 /******************************/
607 
608 /* Doubling table routines */
609 H5_DLL herr_t H5HF_dtable_init(H5HF_dtable_t *dtable);
610 H5_DLL herr_t H5HF_dtable_dest(H5HF_dtable_t *dtable);
611 H5_DLL herr_t H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off,
612     unsigned *row, unsigned *col);
613 H5_DLL unsigned H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size);
614 H5_DLL unsigned H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size);
615 H5_DLL hsize_t H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row,
616     unsigned start_col, unsigned num_entries);
617 
618 /* Heap header routines */
619 H5_DLL H5HF_hdr_t * H5HF_hdr_alloc(H5F_t *f);
620 H5_DLL haddr_t H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam);
621 H5_DLL H5HF_hdr_t *H5HF__hdr_protect(H5F_t *f, haddr_t addr, unsigned flags);
622 H5_DLL herr_t H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr);
623 H5_DLL herr_t H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr);
624 H5_DLL herr_t H5HF_hdr_finish_init(H5HF_hdr_t *hdr);
625 H5_DLL herr_t H5HF_hdr_incr(H5HF_hdr_t *hdr);
626 H5_DLL herr_t H5HF_hdr_decr(H5HF_hdr_t *hdr);
627 H5_DLL herr_t H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr);
628 H5_DLL size_t H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr);
629 H5_DLL herr_t H5HF_hdr_dirty(H5HF_hdr_t *hdr);
630 H5_DLL herr_t H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt);
631 H5_DLL herr_t H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free);
632 H5_DLL herr_t H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size);
633 H5_DLL herr_t H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry);
634 H5_DLL herr_t H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock,
635     unsigned start_entry, unsigned nentries);
636 H5_DLL herr_t H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size);
637 H5_DLL herr_t H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries);
638 H5_DLL herr_t H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr);
639 H5_DLL herr_t H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off);
640 H5_DLL herr_t H5HF__hdr_empty(H5HF_hdr_t *hdr);
641 H5_DLL herr_t H5HF_hdr_free(H5HF_hdr_t *hdr);
642 H5_DLL herr_t H5HF__hdr_delete(H5HF_hdr_t *hdr);
643 H5_DLL herr_t H5HF_hdr_dest(H5HF_hdr_t *hdr);
644 
645 /* Indirect block routines */
646 H5_DLL herr_t H5HF_iblock_incr(H5HF_indirect_t *iblock);
647 H5_DLL herr_t H5HF__iblock_decr(H5HF_indirect_t *iblock);
648 H5_DLL herr_t H5HF_iblock_dirty(H5HF_indirect_t *iblock);
649 H5_DLL herr_t H5HF__man_iblock_root_create(H5HF_hdr_t *hdr,
650     size_t min_dblock_size);
651 H5_DLL herr_t H5HF__man_iblock_root_double(H5HF_hdr_t *hdr,
652     size_t min_dblock_size);
653 H5_DLL herr_t H5HF__man_iblock_alloc_row(H5HF_hdr_t *hdr,
654     H5HF_free_section_t **sec_node);
655 H5_DLL herr_t H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock,
656     unsigned par_entry, unsigned nrows, unsigned max_rows, haddr_t *addr_p);
657 H5_DLL H5HF_indirect_t *H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock_addr,
658     unsigned iblock_nrows, H5HF_indirect_t *par_iblock, unsigned par_entry,
659     hbool_t must_protect, unsigned flags, hbool_t *did_protect);
660 H5_DLL herr_t H5HF__man_iblock_unprotect(H5HF_indirect_t *iblock, unsigned cache_flags,
661     hbool_t did_protect);
662 H5_DLL herr_t H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry,
663     haddr_t dblock_addr);
664 H5_DLL herr_t H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry);
665 H5_DLL herr_t H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry,
666     haddr_t *child_addr);
667 H5_DLL herr_t H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr,
668     unsigned iblock_nrows, H5HF_indirect_t *par_iblock, unsigned par_entry);
669 H5_DLL herr_t H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr,
670     haddr_t iblock_addr, unsigned nrows, H5HF_indirect_t *par_iblock, unsigned par_entry, hsize_t *heap_size/*out*/);
671 H5_DLL herr_t H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr,
672     hsize_t block_off, hsize_t *ret_par_block_off, unsigned *ret_entry);
673 H5_DLL herr_t H5HF_man_iblock_dest(H5HF_indirect_t *iblock);
674 
675 /* Direct block routines */
676 H5_DLL herr_t H5HF__man_dblock_new(H5HF_hdr_t *fh, size_t request,
677     H5HF_free_section_t **ret_sec_node);
678 H5_DLL herr_t H5HF__man_dblock_create(H5HF_hdr_t *hdr,
679     H5HF_indirect_t *par_iblock, unsigned par_entry, haddr_t *addr_p,
680     H5HF_free_section_t **ret_sec_node);
681 H5_DLL herr_t H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock,
682     haddr_t dblock_addr, hbool_t *parent_removed);
683 H5_DLL H5HF_direct_t *H5HF__man_dblock_protect(H5HF_hdr_t *hdr, haddr_t dblock_addr,
684     size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry,
685     unsigned flags);
686 H5_DLL herr_t H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off,
687     H5HF_indirect_t **par_iblock, unsigned *par_entry, hbool_t *par_did_protect,
688     unsigned flags);
689 H5_DLL herr_t H5HF__man_dblock_delete(H5F_t *f, haddr_t dblock_addr,
690     hsize_t dblock_size);
691 H5_DLL herr_t H5HF_man_dblock_dest(H5HF_direct_t *dblock);
692 
693 /* Managed object routines */
694 H5_DLL herr_t H5HF__man_insert(H5HF_hdr_t *fh, size_t obj_size,
695     const void *obj, void *id);
696 H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
697     size_t *obj_len_p);
698 H5_DLL void H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id,
699     hsize_t *obj_off_p);
700 H5_DLL herr_t H5HF__man_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj);
701 H5_DLL herr_t H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj);
702 H5_DLL herr_t H5HF__man_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op,
703     void *op_data);
704 H5_DLL herr_t H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id);
705 
706 /* 'Huge' object routines */
707 H5_DLL herr_t H5HF_huge_init(H5HF_hdr_t *hdr);
708 H5_DLL herr_t H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size,
709     void *obj, void *id);
710 H5_DLL herr_t H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
711     size_t *obj_len_p);
712 H5_DLL herr_t H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id,
713     hsize_t *obj_off_p);
714 H5_DLL herr_t H5HF__huge_read(H5HF_hdr_t *fh, const uint8_t *id,
715     void *obj);
716 H5_DLL herr_t H5HF__huge_write(H5HF_hdr_t *hdr, const uint8_t *id,
717     const void *obj);
718 H5_DLL herr_t H5HF__huge_op(H5HF_hdr_t *hdr, const uint8_t *id,
719     H5HF_operator_t op, void *op_data);
720 H5_DLL herr_t H5HF__huge_remove(H5HF_hdr_t *fh, const uint8_t *id);
721 H5_DLL herr_t H5HF__huge_term(H5HF_hdr_t *hdr);
722 H5_DLL herr_t H5HF__huge_delete(H5HF_hdr_t *hdr);
723 
724 /* 'Huge' object v2 B-tree function callbacks */
725 H5_DLL herr_t H5HF__huge_bt2_indir_found(const void *nrecord, void *op_data);
726 H5_DLL herr_t H5HF__huge_bt2_indir_remove(const void *nrecord, void *op_data);
727 H5_DLL herr_t H5HF__huge_bt2_filt_indir_found(const void *nrecord, void *op_data);
728 H5_DLL herr_t H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *op_data);
729 H5_DLL herr_t H5HF__huge_bt2_dir_remove(const void *nrecord, void *op_data);
730 H5_DLL herr_t H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data);
731 H5_DLL herr_t H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *op_data);
732 
733 /* 'Tiny' object routines */
734 H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr);
735 H5_DLL herr_t H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj,
736     void *id);
737 H5_DLL herr_t H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
738     size_t *obj_len_p);
739 H5_DLL herr_t H5HF_tiny_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj);
740 H5_DLL herr_t H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id,
741     H5HF_operator_t op, void *op_data);
742 H5_DLL herr_t H5HF_tiny_remove(H5HF_hdr_t *fh, const uint8_t *id);
743 
744 /* Debugging routines for dumping file structures */
745 H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal,
746     FILE *stream, int indent, int fwidth);
747 H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, haddr_t addr,
748     FILE *stream, int indent, int fwidth);
749 H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, haddr_t addr,
750     FILE *stream, int indent, int fwidth, haddr_t hdr_addr, size_t nrec);
751 H5_DLL void H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal,
752     FILE *stream, int indent, int fwidth);
753 H5_DLL herr_t H5HF_iblock_debug(H5F_t *f, haddr_t addr,
754     FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows);
755 
756 /* Block iteration routines */
757 H5_DLL herr_t H5HF_man_iter_init(H5HF_block_iter_t *biter);
758 H5_DLL herr_t H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
759     hsize_t offset);
760 H5_DLL herr_t H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
761     H5HF_indirect_t *iblock, unsigned start_entry);
762 H5_DLL herr_t H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr,
763     H5HF_block_iter_t *biter, unsigned entry);
764 H5_DLL herr_t H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
765     unsigned nentries);
766 H5_DLL herr_t H5HF_man_iter_up(H5HF_block_iter_t *biter);
767 H5_DLL herr_t H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock);
768 H5_DLL herr_t H5HF_man_iter_reset(H5HF_block_iter_t *biter);
769 H5_DLL herr_t H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col,
770     unsigned *entry, H5HF_indirect_t **block);
771 H5_DLL herr_t H5HF_man_iter_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
772     hsize_t *offset);
773 H5_DLL hbool_t H5HF_man_iter_ready(H5HF_block_iter_t *biter);
774 
775 /* Free space manipulation routines */
776 H5_DLL herr_t H5HF__space_start(H5HF_hdr_t *hdr, hbool_t may_create);
777 H5_DLL herr_t H5HF__space_add(H5HF_hdr_t *hdr, H5HF_free_section_t *node,
778     unsigned flags);
779 H5_DLL htri_t H5HF__space_find(H5HF_hdr_t *hdr, hsize_t request,
780     H5HF_free_section_t **node);
781 H5_DLL herr_t H5HF__space_revert_root(const H5HF_hdr_t *hdr);
782 H5_DLL herr_t H5HF__space_create_root(const H5HF_hdr_t *hdr,
783     H5HF_indirect_t *root_iblock);
784 H5_DLL herr_t H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size);
785 H5_DLL herr_t H5HF__space_remove(H5HF_hdr_t *hdr, H5HF_free_section_t *node);
786 H5_DLL herr_t H5HF__space_close(H5HF_hdr_t *hdr);
787 H5_DLL herr_t H5HF__space_delete(H5HF_hdr_t *hdr);
788 H5_DLL herr_t H5HF__space_sect_change_class(H5HF_hdr_t *hdr,
789     H5HF_free_section_t *sect, uint16_t new_class);
790 
791 /* Free space section routines */
792 H5_DLL H5HF_free_section_t *H5HF_sect_single_new(hsize_t sect_off,
793     size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry);
794 H5_DLL herr_t H5HF__sect_single_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect);
795 H5_DLL herr_t H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr,
796     const H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size);
797 H5_DLL herr_t H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
798     size_t amt);
799 H5_DLL herr_t H5HF__sect_row_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect);
800 H5_DLL herr_t H5HF__sect_row_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
801     unsigned *entry_p);
802 H5_DLL H5HF_indirect_t *H5HF_sect_row_get_iblock(H5HF_free_section_t *sect);
803 H5_DLL herr_t H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock,
804     unsigned start_entry, unsigned nentries);
805 H5_DLL herr_t H5HF__sect_single_free(H5FS_section_info_t *sect);
806 
807 /* Internal operator callbacks */
808 H5_DLL herr_t H5HF_op_read(const void *obj, size_t obj_len, void *op_data);
809 H5_DLL herr_t H5HF_op_write(const void *obj, size_t obj_len, void *op_data);
810 
811 /* Testing routines */
812 #ifdef H5HF_TESTING
813 H5_DLL herr_t H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam);
814 H5_DLL int H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2);
815 H5_DLL unsigned H5HF_get_max_root_rows(const H5HF_t *fh);
816 H5_DLL unsigned H5HF_get_dtable_width_test(const H5HF_t *fh);
817 H5_DLL unsigned H5HF_get_dtable_max_drows_test(const H5HF_t *fh);
818 H5_DLL unsigned H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos);
819 H5_DLL hsize_t H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row);
820 H5_DLL hsize_t H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row);
821 H5_DLL herr_t H5HF_get_id_off_test(const H5HF_t *fh, const void *id, hsize_t *obj_off);
822 H5_DLL herr_t H5HF_get_id_type_test(const void *id, unsigned char *obj_type);
823 H5_DLL herr_t H5HF_get_tiny_info_test(const H5HF_t *fh, size_t *max_len,
824     hbool_t *len_extended);
825 H5_DLL herr_t H5HF_get_huge_info_test(const H5HF_t *fh, hsize_t *next_id,
826     hbool_t *ids_direct);
827 #endif /* H5HF_TESTING */
828 
829 #endif /* _H5HFpkg_H */
830 
831