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     struct H5HF_indirect_t
386 		*fd_parent;	/* Saved copy of the parent pointer -- this   */
387 				/* necessary as the parent field is sometimes */
388 				/* nulled out before the eviction notify call */
389 				/* is made from the metadata cache.  Since    */
390 				/* this call cancels flush dependencies, it   */
391 				/* needs this information.		      */
392     unsigned    par_entry;      /* Entry in parent's table                    */
393     haddr_t     addr;           /* Address of this indirect block on disk     */
394     size_t      size;           /* Size of indirect block on disk             */
395     unsigned    nrows;          /* Total # of rows in indirect block          */
396     unsigned    max_rows;       /* Max. # of rows in indirect block           */
397     unsigned    nchildren;      /* Number of child blocks                     */
398     unsigned    max_child;      /* Max. offset used in child entries          */
399     struct H5HF_indirect_t **child_iblocks; /* Array of pointers to pinned child indirect blocks */
400 
401     /* Stored values */
402     hsize_t     block_off;      /* Offset of the block within the heap's address space */
403     H5HF_indirect_ent_t *ents;  /* Pointer to block entry table               */
404     H5HF_indirect_filt_ent_t *filt_ents;    /* Pointer to filtered information for direct blocks */
405 };
406 
407 /* A fractal heap direct block */
408 typedef struct H5HF_direct_t {
409     /* Information for H5AC cache functions, _must_ be first field in structure */
410     H5AC_info_t cache_info;
411 
412     /* Internal heap information */
413     H5HF_hdr_t	*hdr;	        /* Shared heap header info	              */
414     H5HF_indirect_t *parent;	/* Shared parent indirect block info          */
415     H5HF_indirect_t *fd_parent;	/* Saved copy of the parent pointer -- this   */
416 				/* necessary as the parent field is sometimes */
417 				/* nulled out before the eviction notify call */
418 				/* is made from the metadata cache.  Since    */
419 				/* this call cancels flush dependencies, it   */
420 				/* needs this information.		      */
421     unsigned    par_entry;      /* Entry in parent's table                    */
422     size_t      size;           /* Size of direct block                       */
423     hsize_t     file_size;      /* Size of direct block in file (only valid when block's space is being freed) */
424     uint8_t     *blk;           /* Pointer to buffer containing block data    */
425     uint8_t	*write_buf;	/* Pointer to buffer containing the block data */
426                                 /* in form ready to copy to the metadata       */
427                                 /* cache's image buffer.                       */
428                                 /*                                             */
429                                 /* This field is used by                       */
430                                 /* H5HF_cache_dblock_pre_serialize() to pass   */
431                                 /* the serialized image of the direct block to */
432                                 /* H5HF_cache_dblock_serialize().  It should   */
433                                 /* NULL at all other times.                    */
434                                 /*                                             */
435                                 /* If I/O filters are enabled, the pre-        */
436                                 /* the pre-serialize function will allocate    */
437                                 /* a buffer, copy the filtered version of the  */
438                                 /* direct block image into it, and place the   */
439                                 /* base address of the buffer in this field.   */
440                                 /* The serialize function must discard this    */
441                                 /* buffer after it copies the contents into    */
442                                 /* the image buffer provided by the metadata   */
443                                 /* cache.                                      */
444                                 /*                                             */
445                                 /* If I/O filters are not enabled, the         */
446                                 /* write_buf field is simply set equal to the  */
447                                 /* blk field by the pre-serialize function,    */
448                                 /* and back to NULL by the serialize function. */
449     size_t	write_size;     /* size of the buffer pointed to by write_buf. */
450 
451     /* Stored values */
452     hsize_t     block_off;      /* Offset of the block within the heap's address space */
453 } H5HF_direct_t;
454 
455 /* Fractal heap */
456 struct H5HF_t {
457     H5HF_hdr_t  *hdr;           /* Pointer to internal fractal heap header info */
458     H5F_t      *f;              /* Pointer to file for heap */
459 };
460 
461 /* Fractal heap "parent info" (for loading a block) */
462 typedef struct H5HF_parent_t {
463     H5HF_hdr_t *hdr;                /* Pointer to heap header info */
464     H5HF_indirect_t *iblock;    /* Pointer to parent indirect block */
465     unsigned entry;             /* Location of block in parent's entry table */
466 } H5HF_parent_t;
467 
468 /* Typedef for indirectly accessed 'huge' object's records in the v2 B-tree */
469 typedef struct H5HF_huge_bt2_indir_rec_t {
470     haddr_t addr;       /* Address of the object in the file */
471     hsize_t len;        /* Length of the object in the file */
472     hsize_t id;         /* ID used for object (not used for 'huge' objects directly accessed) */
473 } H5HF_huge_bt2_indir_rec_t;
474 
475 /* Typedef for indirectly accessed, filtered 'huge' object's records in the v2 B-tree */
476 typedef struct H5HF_huge_bt2_filt_indir_rec_t {
477     haddr_t addr;       /* Address of the filtered object in the file */
478     hsize_t len;        /* Length of the filtered object in the file */
479     unsigned filter_mask;   /* I/O pipeline filter mask for filtered object in the file */
480     hsize_t obj_size;   /* Size of the de-filtered object in memory */
481     hsize_t id;         /* ID used for object (not used for 'huge' objects directly accessed) */
482 } H5HF_huge_bt2_filt_indir_rec_t;
483 
484 /* Typedef for directly accessed 'huge' object's records in the v2 B-tree */
485 typedef struct H5HF_huge_bt2_dir_rec_t {
486     haddr_t addr;       /* Address of the object in the file */
487     hsize_t len;        /* Length of the object in the file */
488 } H5HF_huge_bt2_dir_rec_t;
489 
490 /* Typedef for directly accessed, filtered 'huge' object's records in the v2 B-tree */
491 typedef struct H5HF_huge_bt2_filt_dir_rec_t {
492     haddr_t addr;       /* Address of the filtered object in the file */
493     hsize_t len;        /* Length of the filtered object in the file */
494     unsigned filter_mask;   /* I/O pipeline filter mask for filtered object in the file */
495     hsize_t obj_size;   /* Size of the de-filtered object in memory */
496 } H5HF_huge_bt2_filt_dir_rec_t;
497 
498 /* User data for free space section 'add' callback */
499 typedef struct {
500     H5HF_hdr_t *hdr;            /* Fractal heap header */
501     hid_t dxpl_id;              /* DXPL ID for operation */
502 } H5HF_sect_add_ud_t;
503 
504 /* User data for v2 B-tree 'remove' callback on 'huge' objects */
505 typedef struct {
506     H5HF_hdr_t *hdr;            /* Fractal heap header (in) */
507     hid_t dxpl_id;              /* DXPL ID for operation (in) */
508     hsize_t obj_len;            /* Length of object removed (out) */
509 } H5HF_huge_remove_ud_t;
510 
511 /* User data for fractal heap header cache client callback */
512 typedef struct H5HF_hdr_cache_ud_t {
513     H5F_t *f;                   /* File pointer */
514     hid_t dxpl_id;              /* DXPL ID for operation (in) */
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, hid_t dxpl_id, const H5HF_create_t *cparam);
621 H5_DLL H5HF_hdr_t *H5HF_hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr,
622     unsigned flags);
623 H5_DLL herr_t H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr);
624 H5_DLL herr_t H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr);
625 H5_DLL herr_t H5HF_hdr_finish_init(H5HF_hdr_t *hdr);
626 H5_DLL herr_t H5HF_hdr_incr(H5HF_hdr_t *hdr);
627 H5_DLL herr_t H5HF_hdr_decr(H5HF_hdr_t *hdr);
628 H5_DLL herr_t H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr);
629 H5_DLL size_t H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr);
630 H5_DLL herr_t H5HF_hdr_dirty(H5HF_hdr_t *hdr);
631 H5_DLL herr_t H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt);
632 H5_DLL herr_t H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free);
633 H5_DLL herr_t H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size);
634 H5_DLL herr_t H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry);
635 H5_DLL herr_t H5HF_hdr_skip_blocks(H5HF_hdr_t *hdr, hid_t dxpl_id,
636     H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries);
637 H5_DLL herr_t H5HF_hdr_update_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_size);
638 H5_DLL herr_t H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries);
639 H5_DLL herr_t H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id,
640     haddr_t dblock_addr);
641 H5_DLL herr_t H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off);
642 H5_DLL herr_t H5HF_hdr_empty(H5HF_hdr_t *hdr);
643 H5_DLL herr_t H5HF_hdr_free(H5HF_hdr_t *hdr);
644 H5_DLL herr_t H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id);
645 H5_DLL herr_t H5HF_hdr_dest(H5HF_hdr_t *hdr);
646 
647 /* Indirect block routines */
648 H5_DLL herr_t H5HF_iblock_incr(H5HF_indirect_t *iblock);
649 H5_DLL herr_t H5HF_iblock_decr(H5HF_indirect_t *iblock);
650 H5_DLL herr_t H5HF_iblock_dirty(H5HF_indirect_t *iblock);
651 H5_DLL herr_t H5HF_man_iblock_root_create(H5HF_hdr_t *hdr, hid_t dxpl_id,
652     size_t min_dblock_size);
653 H5_DLL herr_t H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id,
654     size_t min_dblock_size);
655 H5_DLL herr_t H5HF_man_iblock_alloc_row(H5HF_hdr_t *hdr, hid_t dxpl_id,
656     H5HF_free_section_t **sec_node);
657 H5_DLL herr_t H5HF_man_iblock_create(H5HF_hdr_t *hdr, hid_t dxpl_id,
658     H5HF_indirect_t *par_iblock, unsigned par_entry, unsigned nrows,
659     unsigned max_rows, haddr_t *addr_p);
660 H5_DLL H5HF_indirect_t *H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id,
661     haddr_t iblock_addr, unsigned iblock_nrows,
662     H5HF_indirect_t *par_iblock, unsigned par_entry, hbool_t must_protect,
663     unsigned flags, hbool_t *did_protect);
664 H5_DLL herr_t H5HF_man_iblock_unprotect(H5HF_indirect_t *iblock, hid_t dxpl_id,
665     unsigned cache_flags, hbool_t did_protect);
666 H5_DLL herr_t H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry,
667     haddr_t dblock_addr);
668 H5_DLL herr_t H5HF_man_iblock_detach(H5HF_indirect_t *iblock, hid_t dxpl_id, unsigned entry);
669 H5_DLL herr_t H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry,
670     haddr_t *child_addr);
671 H5_DLL herr_t H5HF_man_iblock_delete(H5HF_hdr_t *hdr, hid_t dxpl_id,
672     haddr_t iblock_addr, unsigned iblock_nrows, H5HF_indirect_t *par_iblock,
673     unsigned par_entry);
674 H5_DLL herr_t H5HF_man_iblock_size(H5F_t *f, hid_t dxpl_id, H5HF_hdr_t *hdr,
675     haddr_t iblock_addr, unsigned nrows, H5HF_indirect_t *par_iblock, unsigned par_entry, hsize_t *heap_size/*out*/);
676 H5_DLL herr_t H5HF_man_iblock_dest(H5HF_indirect_t *iblock);
677 
678 /* Direct block routines */
679 H5_DLL herr_t H5HF_man_dblock_new(H5HF_hdr_t *fh, hid_t dxpl_id, size_t request,
680     H5HF_free_section_t **ret_sec_node);
681 H5_DLL herr_t H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr,
682     H5HF_indirect_t *par_iblock, unsigned par_entry, haddr_t *addr_p,
683     H5HF_free_section_t **ret_sec_node);
684 H5_DLL herr_t H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id,
685     H5HF_direct_t *dblock, haddr_t dblock_addr);
686 H5_DLL H5HF_direct_t *H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id,
687     haddr_t dblock_addr, size_t dblock_size,
688     H5HF_indirect_t *par_iblock, unsigned par_entry,
689     unsigned flags);
690 H5_DLL herr_t H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id,
691     hsize_t obj_off, H5HF_indirect_t **par_iblock,
692     unsigned *par_entry, hbool_t *par_did_protect, unsigned flags);
693 H5_DLL herr_t H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr,
694     hsize_t dblock_size);
695 H5_DLL herr_t H5HF_man_dblock_dest(H5HF_direct_t *dblock);
696 
697 /* Managed object routines */
698 H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, size_t obj_size,
699     const void *obj, void *id);
700 H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
701     size_t *obj_len_p);
702 H5_DLL void H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id,
703     hsize_t *obj_off_p);
704 H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
705     void *obj);
706 H5_DLL herr_t H5HF_man_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
707     const void *obj);
708 H5_DLL herr_t H5HF_man_op(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
709     H5HF_operator_t op, void *op_data);
710 H5_DLL herr_t H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id);
711 
712 /* 'Huge' object routines */
713 H5_DLL herr_t H5HF_huge_init(H5HF_hdr_t *hdr);
714 H5_DLL herr_t H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size,
715     void *obj, void *id);
716 H5_DLL herr_t H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id,
717     const uint8_t *id, size_t *obj_len_p);
718 H5_DLL herr_t H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id,
719     const uint8_t *id, hsize_t *obj_off_p);
720 H5_DLL herr_t H5HF_huge_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
721     void *obj);
722 H5_DLL herr_t H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
723     const void *obj);
724 H5_DLL herr_t H5HF_huge_op(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
725     H5HF_operator_t op, void *op_data);
726 H5_DLL herr_t H5HF_huge_remove(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id);
727 H5_DLL herr_t H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id);
728 H5_DLL herr_t H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id);
729 
730 /* 'Huge' object v2 B-tree function callbacks */
731 H5_DLL herr_t H5HF__huge_bt2_indir_found(const void *nrecord, void *op_data);
732 H5_DLL herr_t H5HF__huge_bt2_indir_remove(const void *nrecord, void *op_data);
733 H5_DLL herr_t H5HF__huge_bt2_filt_indir_found(const void *nrecord, void *op_data);
734 H5_DLL herr_t H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *op_data);
735 H5_DLL herr_t H5HF__huge_bt2_dir_remove(const void *nrecord, void *op_data);
736 H5_DLL herr_t H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data);
737 H5_DLL herr_t H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *op_data);
738 
739 /* 'Tiny' object routines */
740 H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr);
741 H5_DLL herr_t H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj,
742     void *id);
743 H5_DLL herr_t H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
744     size_t *obj_len_p);
745 H5_DLL herr_t H5HF_tiny_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj);
746 H5_DLL herr_t H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id,
747     H5HF_operator_t op, void *op_data);
748 H5_DLL herr_t H5HF_tiny_remove(H5HF_hdr_t *fh, const uint8_t *id);
749 
750 /* Debugging routines for dumping file structures */
751 H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hid_t dxpl_id,
752     hbool_t dump_internal, FILE *stream, int indent, int fwidth);
753 H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
754     FILE *stream, int indent, int fwidth);
755 H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
756     FILE *stream, int indent, int fwidth, haddr_t hdr_addr, size_t nrec);
757 H5_DLL void H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal,
758     FILE *stream, int indent, int fwidth);
759 H5_DLL herr_t H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
760     FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows);
761 
762 /* Block iteration routines */
763 H5_DLL herr_t H5HF_man_iter_init(H5HF_block_iter_t *biter);
764 H5_DLL herr_t H5HF_man_iter_start_offset(H5HF_hdr_t *hdr, hid_t dxpl_id,
765     H5HF_block_iter_t *biter, hsize_t offset);
766 H5_DLL herr_t H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
767     H5HF_indirect_t *iblock, unsigned start_entry);
768 H5_DLL herr_t H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr,
769     H5HF_block_iter_t *biter, unsigned entry);
770 H5_DLL herr_t H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
771     unsigned nentries);
772 H5_DLL herr_t H5HF_man_iter_up(H5HF_block_iter_t *biter);
773 H5_DLL herr_t H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock);
774 H5_DLL herr_t H5HF_man_iter_reset(H5HF_block_iter_t *biter);
775 H5_DLL herr_t H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col,
776     unsigned *entry, H5HF_indirect_t **block);
777 H5_DLL herr_t H5HF_man_iter_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
778     hsize_t *offset);
779 H5_DLL hbool_t H5HF_man_iter_ready(H5HF_block_iter_t *biter);
780 
781 /* Free space manipulation routines */
782 H5_DLL herr_t H5HF_space_start(H5HF_hdr_t *hdr, hid_t dxpl_id, hbool_t may_create);
783 H5_DLL herr_t H5HF_space_add(H5HF_hdr_t *hdr, hid_t dxpl_id,
784     H5HF_free_section_t *node, unsigned flags);
785 H5_DLL htri_t H5HF_space_find(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t request,
786     H5HF_free_section_t **node);
787 H5_DLL herr_t H5HF_space_revert_root(const H5HF_hdr_t *hdr, hid_t dxpl_id);
788 H5_DLL herr_t H5HF_space_create_root(const H5HF_hdr_t *hdr, hid_t dxpl_id,
789     H5HF_indirect_t *root_iblock);
790 H5_DLL herr_t H5HF_space_size(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t *fs_size);
791 H5_DLL herr_t H5HF_space_remove(H5HF_hdr_t *hdr, hid_t dxpl_id,
792     H5HF_free_section_t *node);
793 H5_DLL herr_t H5HF_space_close(H5HF_hdr_t *hdr, hid_t dxpl_id);
794 H5_DLL herr_t H5HF_space_delete(H5HF_hdr_t *hdr, hid_t dxpl_id);
795 H5_DLL herr_t H5HF_space_sect_change_class(H5HF_hdr_t *hdr, hid_t dxpl_id,
796     H5HF_free_section_t *sect, uint16_t new_class);
797 
798 /* Free space section routines */
799 H5_DLL H5HF_free_section_t *H5HF_sect_single_new(hsize_t sect_off,
800     size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry);
801 H5_DLL herr_t H5HF_sect_single_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
802     H5HF_free_section_t *sect);
803 H5_DLL herr_t H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr,
804     H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size);
805 H5_DLL herr_t H5HF_sect_single_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id,
806     H5HF_free_section_t *sect, size_t amt);
807 H5_DLL herr_t H5HF_sect_row_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
808     H5HF_free_section_t *sect);
809 H5_DLL herr_t H5HF_sect_row_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id,
810     H5HF_free_section_t *sect, unsigned *entry_p);
811 H5_DLL H5HF_indirect_t *H5HF_sect_row_get_iblock(H5HF_free_section_t *sect);
812 H5_DLL herr_t H5HF_sect_indirect_add(H5HF_hdr_t *hdr, hid_t dxpl_id,
813     H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries);
814 H5_DLL herr_t H5HF_sect_single_free(H5FS_section_info_t *sect);
815 
816 /* Internal operator callbacks */
817 H5_DLL herr_t H5HF_op_read(const void *obj, size_t obj_len, void *op_data);
818 H5_DLL herr_t H5HF_op_write(const void *obj, size_t obj_len, void *op_data);
819 
820 /* Testing routines */
821 #ifdef H5HF_TESTING
822 H5_DLL herr_t H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam);
823 H5_DLL int H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2);
824 H5_DLL unsigned H5HF_get_max_root_rows(const H5HF_t *fh);
825 H5_DLL unsigned H5HF_get_dtable_width_test(const H5HF_t *fh);
826 H5_DLL unsigned H5HF_get_dtable_max_drows_test(const H5HF_t *fh);
827 H5_DLL unsigned H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos);
828 H5_DLL hsize_t H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row);
829 H5_DLL hsize_t H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row);
830 H5_DLL herr_t H5HF_get_id_off_test(const H5HF_t *fh, const void *id, hsize_t *obj_off);
831 H5_DLL herr_t H5HF_get_id_type_test(const void *id, unsigned char *obj_type);
832 H5_DLL herr_t H5HF_get_tiny_info_test(const H5HF_t *fh, size_t *max_len,
833     hbool_t *len_extended);
834 H5_DLL herr_t H5HF_get_huge_info_test(const H5HF_t *fh, hsize_t *next_id,
835     hbool_t *ids_direct);
836 #endif /* H5HF_TESTING */
837 
838 #endif /* _H5HFpkg_H */
839 
840