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  *		Thursday, September 28, 2000
17  *
18  * Purpose:	This file contains declarations which are visible only within
19  *		the H5F package.  Source files outside the H5F package should
20  *		include H5Fprivate.h instead.
21  */
22 #if !(defined H5F_FRIEND || defined H5F_MODULE)
23 #error "Do not include this file outside the H5F package!"
24 #endif
25 
26 #ifndef _H5Fpkg_H
27 #define _H5Fpkg_H
28 
29 /* Get package's private header */
30 #include "H5Fprivate.h"
31 
32 /* Other public headers needed by this file */
33 #include "H5Bpublic.h"          /* B-tree header, for H5B_NUM_BTREE_ID */
34 
35 /* Other private headers needed by this file */
36 #include "H5private.h"		/* Generic Functions			*/
37 #include "H5ACprivate.h"        /* Metadata cache                       */
38 #include "H5FLprivate.h"	/* Free Lists                           */
39 #include "H5FOprivate.h"        /* File objects                         */
40 #include "H5FSprivate.h"	/* File free space                      */
41 #include "H5Gprivate.h"		/* Groups 			  	*/
42 #include "H5Oprivate.h"         /* Object header messages               */
43 #include "H5PBprivate.h"        /* Page buffer                          */
44 #include "H5UCprivate.h"	/* Reference counted object functions	*/
45 
46 
47 /*
48  * Feature: Define this constant on the compiler command-line if you want to
49  *	    see some debugging messages on the debug stream.
50  */
51 #ifdef NDEBUG
52 #  undef H5F_DEBUG
53 #endif
54 
55 /* Superblock status flags */
56 #define H5F_SUPER_WRITE_ACCESS          0x01
57 #define H5F_SUPER_FILE_OK               0x02
58 #define H5F_SUPER_SWMR_WRITE_ACCESS     0x04
59 #define H5F_SUPER_ALL_FLAGS             (H5F_SUPER_WRITE_ACCESS | H5F_SUPER_FILE_OK | H5F_SUPER_SWMR_WRITE_ACCESS)
60 
61 /* Mask for removing private file access flags */
62 #define H5F_ACC_PUBLIC_FLAGS 	        0x007fu
63 
64 /* Free space section+aggregator merge flags */
65 #define H5F_FS_MERGE_METADATA           0x01    /* Section can merge with metadata aggregator */
66 #define H5F_FS_MERGE_RAWDATA            0x02    /* Section can merge with small 'raw' data aggregator */
67 
68 /* Macro to abstract checking whether file is using a free space manager */
69 #define H5F_HAVE_FREE_SPACE_MANAGER(F)  \
70     ((F)->shared->fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR ||                        \
71      (F)->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
72 
73 /* Macros for encoding/decoding superblock */
74 #define H5F_MAX_DRVINFOBLOCK_SIZE  1024         /* Maximum size of superblock driver info buffer */
75 #define H5F_DRVINFOBLOCK_HDR_SIZE 16            /* Size of superblock driver info header */
76 
77 /* Superblock sizes for various versions */
78 #define H5F_SIZEOF_CHKSUM 4     /* Checksum size in the file */
79 
80 /* Fixed-size portion at the beginning of all superblocks */
81 #define H5F_SUPERBLOCK_FIXED_SIZE ( H5F_SIGNATURE_LEN                   \
82         + 1) /* superblock version */
83 
84 /* The H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE is the minimal amount of super block
85  * variable length data guarnateed to load the sizeof offsets and the sizeof
86  * lengths fields in all versions of the superblock.
87  *
88  * This is necessary in the V3 cache, as on the initial load, we need to
89  * get enough of the superblock to determine its version and size so that
90  * the metadata cache can load the correct amount of data from file to
91  * allow the second deserialization attempt to succeed.
92  *
93  * The value selected will have to be revisited for each new version
94  * of the super block.  Note that the current value is one byte larger
95  * than it needs to be.
96  */
97 #define H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE	7
98 
99 /* Macros for computing variable-size superblock size */
100 #define H5F_SUPERBLOCK_VARLEN_SIZE_COMMON                               \
101         (2  /* freespace, and root group versions */			\
102         + 1 /* reserved */                                              \
103         + 3 /* shared header vers, size of address, size of lengths */  \
104         + 1 /* reserved */                                              \
105         + 4 /* group leaf k, group internal k */                        \
106         + 4) /* consistency flags */
107 #define H5F_SUPERBLOCK_VARLEN_SIZE_V0(sizeof_addr, sizeof_size)         \
108         ( H5F_SUPERBLOCK_VARLEN_SIZE_COMMON /* Common variable-length info */ \
109         + (sizeof_addr) /* base address */                              \
110         + (sizeof_addr) /* <unused> */                                  \
111         + (sizeof_addr) /* EOF address */                               \
112         + (sizeof_addr) /* driver block address */                      \
113         + H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size)) /* root group ptr */
114 #define H5F_SUPERBLOCK_VARLEN_SIZE_V1(sizeof_addr, sizeof_size)         \
115         ( H5F_SUPERBLOCK_VARLEN_SIZE_COMMON /* Common variable-length info */ \
116         + 2 /* indexed B-tree internal k */                             \
117         + 2 /* reserved */                                              \
118         + (sizeof_addr) /* base address */                              \
119         + (sizeof_addr) /* <unused> */                                  \
120         + (sizeof_addr) /* EOF address */                               \
121         + (sizeof_addr) /* driver block address */                      \
122         + H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size)) /* root group ptr */
123 #define H5F_SUPERBLOCK_VARLEN_SIZE_V2(sizeof_addr)                      \
124         ( 2 /* size of address, size of lengths */                      \
125         + 1 /* consistency flags */                                     \
126         + (sizeof_addr) /* base address */                              \
127         + (sizeof_addr) /* superblock extension address */              \
128         + (sizeof_addr) /* EOF address */                               \
129         + (sizeof_addr) /* root group object header address */          \
130         + H5F_SIZEOF_CHKSUM) /* superblock checksum (keep this last) */
131 #define H5F_SUPERBLOCK_VARLEN_SIZE(v, sizeof_addr, sizeof_size) (	\
132         (v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(sizeof_addr, sizeof_size) : 0) \
133         + (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(sizeof_addr, sizeof_size) : 0) \
134         + (v >= 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(sizeof_addr) : 0))
135 
136 /* Total size of superblock, depends on superblock version */
137 #define H5F_SUPERBLOCK_SIZE(s) ( H5F_SUPERBLOCK_FIXED_SIZE              \
138         + H5F_SUPERBLOCK_VARLEN_SIZE((s)->super_vers, (s)->sizeof_addr, (s)->sizeof_size))
139 
140 /* For superblock version 0 & 1:
141    Offset to the file consistency flags (status_flags) in the superblock (excluding H5F_SUPERBLOCK_FIXED_SIZE) */
142 #define H5F_SUPER_STATUS_OFF_V01                                                \
143         (2  /* freespace, and root group versions */                    \
144         + 1 /* reserved */                                              \
145         + 3 /* shared header vers, size of address, size of lengths */  \
146         + 1 /* reserved */                                              \
147         + 4) /* group leaf k, group internal k */
148 
149 #define H5F_SUPER_STATUS_OFF(v)   (v >= 2 ? 2 : H5F_SUPER_STATUS_OFF_V01)
150 
151 /* Offset to the file consistency flags (status_flags) in the superblock */
152 #define H5F_SUPER_STATUS_FLAGS_OFF(v) (H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPER_STATUS_OFF(v))
153 
154 /* Size of file consistency flags (status_flags) in the superblock */
155 #define H5F_SUPER_STATUS_FLAGS_SIZE(v)        (v >= 2 ? 1 : 4)
156 
157 /* Forward declaration external file cache struct used below (defined in
158  * H5Fefc.c) */
159 typedef struct H5F_efc_t H5F_efc_t;
160 
161 /* Structure for passing 'user data' to superblock cache callbacks */
162 typedef struct H5F_superblock_cache_ud_t {
163 /* IN: */
164     H5F_t *f;               /* Pointer to file */
165     hbool_t ignore_drvrinfo; /* Indicate if the driver info should be ignored */
166 /* OUT: */
167     unsigned sym_leaf_k;    /* Symbol table leaf node's 'K' value */
168     unsigned btree_k[H5B_NUM_BTREE_ID]; /* B-tree key values for each type */
169     haddr_t stored_eof;     /* End-of-file in file */
170     hbool_t drvrinfo_removed; /* Indicate if the driver info was removed */
171     unsigned    super_vers;   /* Superblock version obtained in get_load_size callback.
172 			       * It will be used later in verify_chksum callback
173 			       */
174 } H5F_superblock_cache_ud_t;
175 
176 /* Structure for passing 'user data' to driver info block cache callbacks */
177 typedef struct H5F_drvrinfo_cache_ud_t {
178     H5F_t   *f;               /* Pointer to file */
179     haddr_t driver_addr;      /* address of driver info block */
180 } H5F_drvrinfo_cache_ud_t;
181 
182 /* Structure for metadata & "small [raw] data" block aggregation fields */
183 struct H5F_blk_aggr_t {
184     unsigned long       feature_flag;   /* Feature flag type */
185     hsize_t             alloc_size;     /* Size for allocating new blocks */
186     hsize_t             tot_size;       /* Total amount of bytes aggregated into block */
187     hsize_t             size;           /* Current size of block left */
188     haddr_t             addr;           /* Location of block left */
189 };
190 
191 /* Structure for metadata accumulator fields */
192 typedef struct H5F_meta_accum_t {
193     unsigned char      *buf;            /* Buffer to hold the accumulated metadata */
194     haddr_t             loc;            /* File location (offset) of the accumulated metadata */
195     size_t              size;           /* Size of the accumulated metadata buffer used (in bytes) */
196     size_t              alloc_size;     /* Size of the accumulated metadata buffer allocated (in bytes) */
197     size_t              dirty_off;      /* Offset of the dirty region in the accumulator buffer */
198     size_t              dirty_len;      /* Length of the dirty region in the accumulator buffer */
199     hbool_t             dirty;          /* Flag to indicate that the accumulated metadata is dirty */
200 } H5F_meta_accum_t;
201 
202 /* A record of the mount table */
203 typedef struct H5F_mount_t {
204     struct H5G_t	*group;	/* Mount point group held open		*/
205     struct H5F_t	*file;	/* File mounted at that point		*/
206 } H5F_mount_t;
207 
208 /*
209  * The mount table describes what files are attached to (mounted on) the file
210  * to which this table belongs.
211  */
212 typedef struct H5F_mtab_t {
213     unsigned		nmounts;/* Number of children which are mounted	*/
214     unsigned		nalloc;	/* Number of mount slots allocated	*/
215     H5F_mount_t		*child;	/* An array of mount records		*/
216 } H5F_mtab_t;
217 
218 /* Structure specifically to store superblock. This was originally
219  * maintained entirely within H5F_file_t, but is now extracted
220  * here because the superblock is now handled by the cache */
221 typedef struct H5F_super_t {
222     H5AC_info_t cache_info;     /* Cache entry information structure          */
223     unsigned    super_vers;     /* Superblock version                         */
224     uint8_t	sizeof_addr;	/* Size of addresses in file                  */
225     uint8_t	sizeof_size;	/* Size of offsets in file                    */
226     uint8_t     status_flags;   /* File status flags                          */
227     unsigned    sym_leaf_k;     /* Size of leaves in symbol tables            */
228     unsigned    btree_k[H5B_NUM_BTREE_ID]; /* B-tree key values for each type */
229     haddr_t     base_addr;      /* Absolute base address for rel.addrs.       */
230                                 /* (superblock for file is at this offset)    */
231     haddr_t     ext_addr;       /* Relative address of superblock extension   */
232     haddr_t     driver_addr;    /* File driver information block address      */
233     haddr_t     root_addr;      /* Root group address                         */
234     H5G_entry_t *root_ent;      /* Root group symbol table entry              */
235 } H5F_super_t;
236 
237 /*
238  * Define the structure to store the file information for HDF5 files. One of
239  * these structures is allocated per file, not per H5Fopen(). That is, set of
240  * H5F_t structs can all point to the same H5F_file_t struct. The `nrefs'
241  * count in this struct indicates the number of H5F_t structs which are
242  * pointing to this struct.
243  */
244 struct H5F_file_t {
245     H5FD_t	*lf; 		/* Lower level file handle for I/O	*/
246     H5F_super_t *sblock;        /* Pointer to (pinned) superblock for file */
247     H5O_drvinfo_t *drvinfo;	/* Pointer to the (pinned) driver info
248                                  * cache entry.  This field is only defined
249                                  * for older versions of the super block,
250                                  * and then only when a driver information
251                                  * block is present.  At all other times
252                                  * it should be NULL.
253                                  */
254     hbool_t drvinfo_sb_msg_exists;  /* Convenience field used to track
255                                      * whether the driver info superblock
256                                      * extension message has been created
257                                      * yet. This field should be TRUE iff the
258                                      * superblock extension exists and contains
259                                      * a driver info message.  Under all other
260                                      * circumstances, it must be set to FALSE.
261                                      */
262     unsigned	nrefs;		/* Ref count for times file is opened	*/
263     unsigned	flags;		/* Access Permissions for file          */
264     H5F_mtab_t	mtab;		/* File mount table                     */
265     H5F_efc_t   *efc;           /* External file cache                  */
266 
267     /* Cached values from FCPL/superblock */
268     uint8_t	sizeof_addr;	/* Size of addresses in file            */
269     uint8_t	sizeof_size;	/* Size of offsets in file              */
270     haddr_t	sohm_addr;	/* Relative address of shared object header message table */
271     unsigned	sohm_vers;	/* Version of shared message table on disk */
272     unsigned	sohm_nindexes;	/* Number of shared messages indexes in the table */
273     unsigned long feature_flags; /* VFL Driver feature Flags            */
274     haddr_t	maxaddr;	/* Maximum address for file             */
275 
276     H5PB_t      *page_buf;                  /* The page buffer cache                */
277     H5AC_t      *cache;		/* The object cache	 		*/
278     H5AC_cache_config_t
279 		mdc_initCacheCfg; /* initial configuration for the      */
280                                 /* metadata cache.  This structure is   */
281                                 /* fixed at creation time and should    */
282                                 /* not change thereafter.               */
283     H5AC_cache_image_config_t
284 		mdc_initCacheImageCfg;  /* initial configuration for the */
285                                         /* generate metadata cache image on     */
286                                         /* close option.  This structure is     */
287                                         /* fixed at creation time and should    */
288                                         /* not change thereafter.               */
289     hbool_t     use_mdc_logging; /* Set when metadata logging is desired */
290     hbool_t     start_mdc_log_on_access; /* set when mdc logging should  */
291                                 /* begin on file access/create          */
292     char        *mdc_log_location; /* location of mdc log               */
293     hid_t       fcpl_id;	/* File creation property list ID 	*/
294     H5F_close_degree_t fc_degree;   /* File close behavior degree	*/
295     hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */
296     size_t	rdcc_nslots;	/* Size of raw data chunk cache (slots)	*/
297     size_t	rdcc_nbytes;	/* Size of raw data chunk cache	(bytes)	*/
298     double	rdcc_w0;	/* Preempt read chunks first? [0.0..1.0]*/
299     size_t      sieve_buf_size; /* Size of the data sieve buffer allocated (in bytes) */
300     hsize_t	threshold;	/* Threshold for alignment		*/
301     hsize_t	alignment;	/* Alignment				*/
302     unsigned	gc_ref;		/* Garbage-collect references?		*/
303     unsigned	latest_flags;	/* The latest version support */
304     hbool_t	store_msg_crt_idx;  /* Store creation index for object header messages?	*/
305     unsigned	ncwfs;		/* Num entries on cwfs list		*/
306     struct H5HG_heap_t **cwfs;	/* Global heap cache			*/
307     struct H5G_t *root_grp;	/* Open root group			*/
308     H5FO_t *open_objs;          /* Open objects in file                 */
309     H5UC_t *grp_btree_shared;   /* Ref-counted group B-tree node info   */
310 
311     /* File space allocation information */
312     H5F_fspace_strategy_t fs_strategy;      /* File space handling strategy	*/
313     hsize_t     fs_threshold;	/* Free space section threshold 	*/
314     hbool_t fs_persist;                     /* Free-space persist or not */
315     hbool_t     use_tmp_space;  /* Whether temp. file space allocation is allowed */
316     haddr_t	tmp_addr;       /* Next address to use for temp. space in the file */
317     hbool_t point_of_no_return;             /* flag to indicate that we can't go back and delete a freespace header when it's used up */
318 
319     H5F_fs_state_t fs_state[H5F_MEM_PAGE_NTYPES];   /* State of free space manager for each type */
320     haddr_t fs_addr[H5F_MEM_PAGE_NTYPES];           /* Address of free space manager info for each type */
321     H5FS_t *fs_man[H5F_MEM_PAGE_NTYPES];            /* Free space manager for each file space type */
322     hbool_t first_alloc_dealloc;            /* TRUE iff free space managers   */
323                                             /* are persistant and have not    */
324                                             /* been used accessed for either  */
325                                             /* allocation or deallocation     */
326                                             /* since file open.               */
327     haddr_t eoa_pre_fsm_fsalloc;	    /* eoa pre file space allocation  */
328                                             /* for self referential FSMs      */
329     haddr_t eoa_post_fsm_fsalloc;           /* eoa post file space allocation */
330                                             /* for self referential FSMs      */
331     haddr_t eoa_post_mdci_fsalloc;          /* eoa past file space allocation */
332                                             /* for metadata cache image, or   */
333                                             /* HADDR_UNDEF if no cache image. */
334 
335     /* Free-space aggregation info */
336     unsigned fs_aggr_merge[H5FD_MEM_NTYPES];    /* Flags for whether free space can merge with aggregator(s) */
337     H5FD_mem_t fs_type_map[H5FD_MEM_NTYPES];    /* Mapping of "real" file space type into tracked type */
338     H5F_blk_aggr_t meta_aggr;   	        /* Metadata aggregation info (if aggregating metadata allocations) */
339     H5F_blk_aggr_t sdata_aggr;                  /* "Small data" aggregation info (if aggregating "small data" allocations) */
340 
341     /* Paged aggregation info */
342     hsize_t fs_page_size;                           /* File space page size */
343     size_t pgend_meta_thres;                        /* Do not track page end meta section <= this threshold */
344 
345     /* Metadata accumulator information */
346     H5F_meta_accum_t accum;     /* Metadata accumulator info           	*/
347 
348     /* Metadata retry info */
349     unsigned 		read_attempts;	/* The # of reads to try when reading metadata with checksum */
350     unsigned		retries_nbins;		/* # of bins for each retries[] */
351     uint32_t		*retries[H5AC_NTYPES];  /* Track # of read retries for metdata items with checksum */
352 
353     /* Object flush info */
354     H5F_object_flush_t 	object_flush;		/* Information for object flush callback */
355 };
356 
357 /*
358  * This is the top-level file descriptor.  One of these structures is
359  * allocated every time H5Fopen() is called although they may contain pointers
360  * to shared H5F_file_t structs.
361  */
362 struct H5F_t {
363     char		*open_name;	/* Name used to open file	*/
364     char		*actual_name;	/* Actual name of the file, after resolving symlinks, etc. */
365     char               	*extpath;       /* Path for searching target external link file */
366     H5F_file_t		*shared;	/* The shared file info		*/
367     unsigned		nopen_objs;	/* Number of open object headers*/
368     H5FO_t              *obj_count;     /* # of time each object is opened through top file structure */
369     hid_t               file_id;        /* ID of this file              */
370     hbool_t             closing;        /* File is in the process of being closed */
371     struct H5F_t        *parent;        /* Parent file that this file is mounted to */
372     unsigned            nmounts;        /* Number of children mounted to this file */
373 #ifdef H5_HAVE_PARALLEL
374     H5P_coll_md_read_flag_t coll_md_read;  /* Do all metadata reads collectively */
375     hbool_t             coll_md_write;  /* Do all metadata writes collectively */
376 #endif /* H5_HAVE_PARALLEL */
377 };
378 
379 
380 /*****************************/
381 /* Package Private Variables */
382 /*****************************/
383 
384 /* Declare a free list to manage the H5F_t struct */
385 H5FL_EXTERN(H5F_t);
386 
387 /* Declare a free list to manage the H5F_file_t struct */
388 H5FL_EXTERN(H5F_file_t);
389 
390 
391 /******************************/
392 /* Package Private Prototypes */
393 /******************************/
394 
395 /* General routines */
396 H5F_t *H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id,
397     hid_t fapl_id, H5FD_t *lf);
398 H5_DLL herr_t H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush);
399 H5_DLL herr_t H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing);
400 H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t meta_dxpl_id, hid_t raw_dxpl_id);
401 H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
402 H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len,
403     hid_t meta_dxpl_id, hid_t raw_dxpl_id);
404 H5_DLL herr_t H5F_close(H5F_t *f);
405 
406 /* File mount related routines */
407 H5_DLL herr_t H5F_close_mounts(H5F_t *f);
408 H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key);
409 H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
410 
411 /* Superblock related routines */
412 H5_DLL herr_t H5F__super_init(H5F_t *f, hid_t dxpl_id);
413 H5_DLL herr_t H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id,
414     hbool_t initial_read);
415 H5_DLL herr_t H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size);
416 H5_DLL herr_t H5F__super_free(H5F_super_t *sblock);
417 
418 /* Superblock extension related routines */
419 H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
420 H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id,
421     void *mesg, hbool_t may_create, unsigned mesg_flags);
422 H5_DLL herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id);
423 H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id,
424     hbool_t was_created);
425 
426 /* Metadata accumulator routines */
427 H5_DLL herr_t H5F__accum_read(const H5F_io_info2_t *fio_info, H5FD_mem_t type,
428     haddr_t addr, size_t size, void *buf);
429 H5_DLL herr_t H5F__accum_write(const H5F_io_info2_t *fio_info, H5FD_mem_t type,
430     haddr_t addr, size_t size, const void *buf);
431 H5_DLL herr_t H5F__accum_free(const H5F_io_info2_t *fio_info, H5FD_mem_t type,
432     haddr_t addr, hsize_t size);
433 H5_DLL herr_t H5F__accum_flush(const H5F_io_info2_t *fio_info);
434 H5_DLL herr_t H5F__accum_reset(const H5F_io_info2_t *fio_info, hbool_t flush);
435 
436 /* Shared file list related routines */
437 H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared);
438 H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf);
439 H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared);
440 
441 /* External file cache routines */
442 H5_DLL H5F_efc_t *H5F_efc_create(unsigned max_nfiles);
443 H5_DLL unsigned H5F_efc_max_nfiles(H5F_efc_t *efc);
444 H5_DLL herr_t H5F_efc_release(H5F_efc_t *efc);
445 H5_DLL herr_t H5F_efc_destroy(H5F_efc_t *efc);
446 H5_DLL herr_t H5F_efc_try_close(H5F_t *f);
447 
448 /* Space allocation routines */
449 H5_DLL haddr_t H5F_alloc(H5F_t *f, hid_t dxpl_id, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size);
450 H5_DLL herr_t H5F_free(H5F_t *f, hid_t dxpl_id, H5F_mem_t type, haddr_t addr, hsize_t size);
451 H5_DLL htri_t H5F_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
452     haddr_t blk_end, hsize_t extra_requested);
453 
454 /* Functions that get/retrieve values from VFD layer */
455 H5_DLL herr_t H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr);
456 H5_DLL herr_t H5F__set_base_addr(const H5F_t *f, haddr_t addr);
457 H5_DLL herr_t H5F__set_paged_aggr(const H5F_t *f, hbool_t paged);
458 
459 /* Functions that flush or evict */
460 H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f, hid_t dxpl_id);
461 
462 /* Testing functions */
463 #ifdef H5F_TESTING
464 H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id,
465     size_t *mesg_count);
466 H5_DLL herr_t H5F_check_cached_stab_test(hid_t file_id);
467 H5_DLL herr_t H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr);
468 H5_DLL herr_t H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr);
469 #endif /* H5F_TESTING */
470 
471 #endif /* _H5Fpkg_H */
472 
473