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  *
16  * Created:             H5Fquery.c
17  *                      Jan 10 2008
18  *                      Quincey Koziol <koziol@hdfgroup.org>
19  *
20  * Purpose:             File structure query routines.
21  *
22  *-------------------------------------------------------------------------
23  */
24 
25 /****************/
26 /* Module Setup */
27 /****************/
28 
29 #include "H5Fmodule.h"        /* This source code file is part of the H5F module */
30 
31 
32 /***********/
33 /* Headers */
34 /***********/
35 #include "H5private.h"          /* Generic Functions                        */
36 #include "H5Eprivate.h"         /* Error handling                           */
37 #include "H5Fpkg.h"             /* File access                              */
38 #include "H5FDprivate.h"        /* File drivers                             */
39 
40 
41 /****************/
42 /* Local Macros */
43 /****************/
44 
45 
46 /******************/
47 /* Local Typedefs */
48 /******************/
49 
50 
51 /********************/
52 /* Package Typedefs */
53 /********************/
54 
55 
56 /********************/
57 /* Local Prototypes */
58 /********************/
59 
60 
61 /*********************/
62 /* Package Variables */
63 /*********************/
64 
65 
66 /*****************************/
67 /* Library Private Variables */
68 /*****************************/
69 
70 
71 /*******************/
72 /* Local Variables */
73 /*******************/
74 
75 
76 
77 /*-------------------------------------------------------------------------
78  * Function: H5F_get_intent
79  *
80  * Purpose:  Quick and dirty routine to retrieve the file's 'intent' flags
81  *           (Mainly added to stop non-file routines from poking about in the
82  *           H5F_t data structure)
83  *
84  * Return:   'intent' on success/abort on failure (shouldn't fail)
85  *-------------------------------------------------------------------------
86  */
87 unsigned
H5F_get_intent(const H5F_t * f)88 H5F_get_intent(const H5F_t *f)
89 {
90     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
91     FUNC_ENTER_NOAPI_NOINIT_NOERR
92 
93     HDassert(f);
94 
95     FUNC_LEAVE_NOAPI(f->shared->flags)
96 } /* end H5F_get_intent() */
97 
98 
99 /*-------------------------------------------------------------------------
100  * Function:    H5F_get_low_bound
101  *
102  * Purpose: Quick and dirty routine to retrieve the file's low_bound.
103  *          (Mainly added to stop non-file routines from poking about in the
104  *          H5F_t data structure)
105  *
106  * Return:  low_bound on success/abort on failure (shouldn't fail)
107  *
108  * Programmer:  Vailin Choi; June 2016
109  *
110  *-------------------------------------------------------------------------
111  */
112 H5F_libver_t
H5F_get_low_bound(const H5F_t * f)113 H5F_get_low_bound(const H5F_t *f)
114 {
115     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
116     FUNC_ENTER_NOAPI_NOINIT_NOERR
117 
118     HDassert(f);
119 
120     FUNC_LEAVE_NOAPI(f->shared->low_bound)
121 } /* end H5F_get_low_bound() */
122 
123 
124 /*-------------------------------------------------------------------------
125  * Function:    H5F_get_high_bound
126  *
127  * Purpose: Quick and dirty routine to retrieve the file's high_bound.
128  *          (Mainly added to stop non-file routines from poking about in the
129  *          H5F_t data structure)
130  *
131  * Return:  high_bound on success/abort on failure (shouldn't fail)
132  *
133  * Programmer:  Vailin Choi; June 2016
134  *
135  *-------------------------------------------------------------------------
136  */
137 H5F_libver_t
H5F_get_high_bound(const H5F_t * f)138 H5F_get_high_bound(const H5F_t *f)
139 {
140     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
141     FUNC_ENTER_NOAPI_NOINIT_NOERR
142 
143     HDassert(f);
144 
145     FUNC_LEAVE_NOAPI(f->shared->high_bound)
146 } /* end H5F_get_high_bound() */
147 
148 
149 /*-------------------------------------------------------------------------
150  * Function: H5F_get_open_name
151  *
152  * Purpose:  Retrieve the name used to open a file.
153  *
154  * Return:   Success:    The name of the file.
155  *           Failure:    ? (should not happen)
156  *-------------------------------------------------------------------------
157  */
158 char *
H5F_get_open_name(const H5F_t * f)159 H5F_get_open_name(const H5F_t *f)
160 {
161     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
162     FUNC_ENTER_NOAPI_NOINIT_NOERR
163 
164     HDassert(f);
165     HDassert(f->open_name);
166 
167     FUNC_LEAVE_NOAPI(f->open_name)
168 } /* end H5F_get_open_name() */
169 
170 
171 /*-------------------------------------------------------------------------
172  * Function: H5F_get_actual_name
173  *
174  * Purpose:  Retrieve the actual name of a file, after resolving symlinks, etc.
175  *
176  * Return:   Success:    The name of the file.
177  *           Failure:    ? (should not happen)
178  *-------------------------------------------------------------------------
179  */
180 char *
H5F_get_actual_name(const H5F_t * f)181 H5F_get_actual_name(const H5F_t *f)
182 {
183     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
184     FUNC_ENTER_NOAPI_NOINIT_NOERR
185 
186     HDassert(f);
187     HDassert(f->actual_name);
188 
189     FUNC_LEAVE_NOAPI(f->actual_name)
190 } /* end H5F_get_actual_name() */
191 
192 
193 /*-------------------------------------------------------------------------
194  * Function: H5F_get_extpath
195  *
196  * Purpose:  Retrieve the file's 'extpath' flags
197  *           This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's location
198  *           when searching the target file.
199  *
200  * Return:   'extpath' on success/abort on failure (shouldn't fail)
201  *-------------------------------------------------------------------------
202  */
203 char *
H5F_get_extpath(const H5F_t * f)204 H5F_get_extpath(const H5F_t *f)
205 {
206     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
207     FUNC_ENTER_NOAPI_NOINIT_NOERR
208 
209     HDassert(f);
210     HDassert(f->extpath);
211 
212     FUNC_LEAVE_NOAPI(f->extpath)
213 } /* end H5F_get_extpath() */
214 
215 
216 /*-------------------------------------------------------------------------
217  * Function: H5F_get_shared
218  *
219  * Purpose:  Retrieve the file's 'shared' pointer
220  *
221  * Return:   'shared' on success/abort on failure (shouldn't fail)
222  *-------------------------------------------------------------------------
223  */
224 H5F_file_t *
H5F_get_shared(const H5F_t * f)225 H5F_get_shared(const H5F_t *f)
226 {
227     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
228     FUNC_ENTER_NOAPI_NOINIT_NOERR
229 
230     HDassert(f);
231 
232     FUNC_LEAVE_NOAPI(f->shared)
233 } /* end H5F_get_shared() */
234 
235 
236 /*-------------------------------------------------------------------------
237  * Function: H5F_same_shared
238  *
239  * Purpose:  Determine if two files have the same shared file pointer
240  *
241  * Return:   TRUE/FALSE on success/abort on failure (shouldn't fail)
242  *-------------------------------------------------------------------------
243  */
244 hbool_t
H5F_same_shared(const H5F_t * f1,const H5F_t * f2)245 H5F_same_shared(const H5F_t *f1, const H5F_t *f2)
246 {
247     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
248     FUNC_ENTER_NOAPI_NOINIT_NOERR
249 
250     HDassert(f1);
251     HDassert(f1->shared);
252     HDassert(f2);
253     HDassert(f2->shared);
254 
255     FUNC_LEAVE_NOAPI(f1->shared == f2->shared)
256 } /* end H5F_same_shared() */
257 
258 
259 /*-------------------------------------------------------------------------
260  * Function: H5F_get_nopen_objs
261  *
262  * Purpose:  Retrieve the file's 'nopen_objs' value
263  *
264  * Return:   'nopen_objs' on success/abort on failure (shouldn't fail)
265  *-------------------------------------------------------------------------
266  */
267 unsigned
H5F_get_nopen_objs(const H5F_t * f)268 H5F_get_nopen_objs(const H5F_t *f)
269 {
270     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
271     FUNC_ENTER_NOAPI_NOINIT_NOERR
272 
273     HDassert(f);
274 
275     FUNC_LEAVE_NOAPI(f->nopen_objs)
276 } /* end H5F_get_nopen_objs() */
277 
278 
279 /*-------------------------------------------------------------------------
280  * Function: H5F_get_file_id
281  *
282  * Purpose:  Retrieve the file's 'file_id' value
283  *
284  * Return:   'file_id' on success/abort on failure (shouldn't fail)
285  *-------------------------------------------------------------------------
286  */
287 hid_t
H5F_get_file_id(const H5F_t * f)288 H5F_get_file_id(const H5F_t *f)
289 {
290     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
291     FUNC_ENTER_NOAPI_NOINIT_NOERR
292 
293     HDassert(f);
294 
295     FUNC_LEAVE_NOAPI(f->file_id)
296 } /* end H5F_get_file_id() */
297 
298 
299 /*-------------------------------------------------------------------------
300  * Function: H5F_get_parent
301  *
302  * Purpose:  Retrieve the file's 'parent' pointer
303  *
304  * Return:   'parent' on success/abort on failure (shouldn't fail)
305  *-------------------------------------------------------------------------
306  */
307 H5F_t *
H5F_get_parent(const H5F_t * f)308 H5F_get_parent(const H5F_t *f)
309 {
310     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
311     FUNC_ENTER_NOAPI_NOINIT_NOERR
312 
313     HDassert(f);
314 
315     FUNC_LEAVE_NOAPI(f->parent)
316 } /* end H5F_get_parent() */
317 
318 
319 /*-------------------------------------------------------------------------
320  * Function: H5F_get_nmounts
321  *
322  * Purpose:  Retrieve the file's 'nmounts' value
323  *
324  * Return:   'nmounts' on success/abort on failure (shouldn't fail)
325  *-------------------------------------------------------------------------
326  */
327 unsigned
H5F_get_nmounts(const H5F_t * f)328 H5F_get_nmounts(const H5F_t *f)
329 {
330     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
331     FUNC_ENTER_NOAPI_NOINIT_NOERR
332 
333     HDassert(f);
334 
335     FUNC_LEAVE_NOAPI(f->nmounts)
336 } /* end H5F_get_nmounts() */
337 
338 
339 /*-------------------------------------------------------------------------
340  * Function: H5F_get_read_attempts
341  *
342  * Purpose:  Retrieve the file's 'read_attempts' value
343  *
344  * Return:   '# of read attempts' on success/abort on failure (shouldn't fail)
345  *-------------------------------------------------------------------------
346  */
347 unsigned
H5F_get_read_attempts(const H5F_t * f)348 H5F_get_read_attempts(const H5F_t *f)
349 {
350     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
351     FUNC_ENTER_NOAPI_NOINIT_NOERR
352 
353     HDassert(f);
354 
355     FUNC_LEAVE_NOAPI(f->shared->read_attempts)
356 } /* end H5F_get_read_attempts() */
357 
358 
359 /*-------------------------------------------------------------------------
360  * Function: H5F_get_fcpl
361  *
362  * Purpose:  Retrieve the value of a file's FCPL.
363  *
364  * Return:   Success:    The FCPL for the file.
365  *           Failure:    ? (should not happen)
366  *-------------------------------------------------------------------------
367  */
368 hid_t
H5F_get_fcpl(const H5F_t * f)369 H5F_get_fcpl(const H5F_t *f)
370 {
371     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
372     FUNC_ENTER_NOAPI_NOINIT_NOERR
373 
374     HDassert(f);
375     HDassert(f->shared);
376 
377     FUNC_LEAVE_NOAPI(f->shared->fcpl_id)
378 } /* end H5F_get_fcpl() */
379 
380 
381 /*-------------------------------------------------------------------------
382  * Function: H5F_sizeof_addr
383  *
384  * Purpose:  Quick and dirty routine to retrieve the size of the file's size_t
385  *           (Mainly added to stop non-file routines from poking about in the
386  *           H5F_t data structure)
387  *
388  * Return:   'sizeof_addr' on success/abort on failure (shouldn't fail)
389  *-------------------------------------------------------------------------
390  */
391 uint8_t
H5F_sizeof_addr(const H5F_t * f)392 H5F_sizeof_addr(const H5F_t *f)
393 {
394     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
395     FUNC_ENTER_NOAPI_NOINIT_NOERR
396 
397     HDassert(f);
398     HDassert(f->shared);
399 
400     FUNC_LEAVE_NOAPI(f->shared->sizeof_addr)
401 } /* end H5F_sizeof_addr() */
402 
403 
404 /*-------------------------------------------------------------------------
405  * Function: H5F_sizeof_size
406  *
407  * Purpose:  Quick and dirty routine to retrieve the size of the file's off_t
408  *           (Mainly added to stop non-file routines from poking about in the
409  *           H5F_t data structure)
410  *
411  * Return:   'sizeof_size' on success/abort on failure (shouldn't fail)
412  *-------------------------------------------------------------------------
413  */
414 uint8_t
H5F_sizeof_size(const H5F_t * f)415 H5F_sizeof_size(const H5F_t *f)
416 {
417     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
418     FUNC_ENTER_NOAPI_NOINIT_NOERR
419 
420     HDassert(f);
421     HDassert(f->shared);
422 
423     FUNC_LEAVE_NOAPI(f->shared->sizeof_size)
424 } /* H5F_sizeof_size() */
425 
426 
427 /*-------------------------------------------------------------------------
428  * Function: H5F_get_sohm_addr
429  *
430  * Purpose:  Retrieve the file's 'sohm_addr' value
431  *
432  * Return:   'sohm_addr' on success/abort on failure (shouldn't fail)
433  *-------------------------------------------------------------------------
434  */
435 haddr_t
H5F_get_sohm_addr(const H5F_t * f)436 H5F_get_sohm_addr(const H5F_t *f)
437 {
438     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
439     FUNC_ENTER_NOAPI_NOINIT_NOERR
440 
441     HDassert(f);
442     HDassert(f->shared);
443 
444     FUNC_LEAVE_NOAPI(f->shared->sohm_addr)
445 } /* end H5F_get_sohm_addr() */
446 
447 
448 /*-------------------------------------------------------------------------
449  * Function: H5F_get_sohm_vers
450  *
451  * Purpose:  Retrieve the file's 'sohm_vers' value
452  *
453  * Return:   'sohm_vers' on success/abort on failure (shouldn't fail)
454  *-------------------------------------------------------------------------
455  */
456 unsigned
H5F_get_sohm_vers(const H5F_t * f)457 H5F_get_sohm_vers(const H5F_t *f)
458 {
459     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
460     FUNC_ENTER_NOAPI_NOINIT_NOERR
461 
462     HDassert(f);
463     HDassert(f->shared);
464 
465     FUNC_LEAVE_NOAPI(f->shared->sohm_vers)
466 } /* end H5F_get_sohm_vers() */
467 
468 
469 /*-------------------------------------------------------------------------
470  * Function: H5F_get_sohm_nindexes
471  *
472  * Purpose:  Retrieve the file's 'sohm_nindexes' value
473  *
474  * Return:   'sohm_nindexes' on success/abort on failure (shouldn't fail)
475  *-------------------------------------------------------------------------
476  */
477 unsigned
H5F_get_sohm_nindexes(const H5F_t * f)478 H5F_get_sohm_nindexes(const H5F_t *f)
479 {
480     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
481     FUNC_ENTER_NOAPI_NOINIT_NOERR
482 
483     HDassert(f);
484     HDassert(f->shared);
485 
486     FUNC_LEAVE_NOAPI(f->shared->sohm_nindexes)
487 } /* end H5F_get_sohm_nindexes() */
488 
489 
490 /*-------------------------------------------------------------------------
491  * Function: H5F_sym_leaf_k
492  *
493  * Purpose:  Replaced a macro to retrieve the symbol table leaf size,
494  *           now that the generic properties are being used to store
495  *           the values.
496  *
497  * Return:   Success:    Non-negative, and the symbol table leaf size is
498  *                              returned.
499  *           Failure:    Negative (should not happen)
500  *-------------------------------------------------------------------------
501  */
502 unsigned
H5F_sym_leaf_k(const H5F_t * f)503 H5F_sym_leaf_k(const H5F_t *f)
504 {
505     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
506     FUNC_ENTER_NOAPI_NOINIT_NOERR
507 
508     HDassert(f);
509     HDassert(f->shared);
510     HDassert(f->shared->sblock);
511 
512     FUNC_LEAVE_NOAPI(f->shared->sblock->sym_leaf_k)
513 } /* end H5F_sym_leaf_k() */
514 
515 
516 /*-------------------------------------------------------------------------
517  * Function: H5F_Kvalue
518  *
519  * Purpose:  Replaced a macro to retrieve a B-tree key value for a certain
520  *           type, now that the generic properties are being used to store
521  *           the B-tree values.
522  *
523  * Return:   Success:    Non-negative, and the B-tree key value is
524  *                              returned.
525  *           Failure:    Negative (should not happen)
526  *-------------------------------------------------------------------------
527  */
528 unsigned
H5F_Kvalue(const H5F_t * f,const H5B_class_t * type)529 H5F_Kvalue(const H5F_t *f, const H5B_class_t *type)
530 {
531     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
532     FUNC_ENTER_NOAPI_NOINIT_NOERR
533 
534     HDassert(f);
535     HDassert(f->shared);
536     HDassert(f->shared->sblock);
537     HDassert(type);
538 
539     FUNC_LEAVE_NOAPI(f->shared->sblock->btree_k[type->id])
540 } /* end H5F_Kvalue() */
541 
542 
543 /*-------------------------------------------------------------------------
544  * Function: H5F_get_nrefs
545  *
546  * Purpose:  Retrieve the file's 'nrefs' value
547  *
548  * Return:   'nrefs' on success/abort on failure (shouldn't fail)
549  *-------------------------------------------------------------------------
550  */
551 unsigned
H5F_get_nrefs(const H5F_t * f)552 H5F_get_nrefs(const H5F_t *f)
553 {
554     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
555     FUNC_ENTER_NOAPI_NOINIT_NOERR
556 
557     HDassert(f);
558     HDassert(f->shared);
559 
560     FUNC_LEAVE_NOAPI(f->shared->nrefs)
561 } /* end H5F_get_nrefs() */
562 
563 
564 /*-------------------------------------------------------------------------
565  * Function: H5F_rdcc_nslots
566  *
567  * Purpose:  Replaced a macro to retrieve the raw data cache number of slots,
568  *           now that the generic properties are being used to store
569  *           the values.
570  *
571  * Return:   Success:    Non-negative, and the raw data cache number of
572  *                              of slots is returned.
573  *           Failure:    Negative (should not happen)
574  *-------------------------------------------------------------------------
575  */
576 size_t
H5F_rdcc_nslots(const H5F_t * f)577 H5F_rdcc_nslots(const H5F_t *f)
578 {
579     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
580     FUNC_ENTER_NOAPI_NOINIT_NOERR
581 
582     HDassert(f);
583     HDassert(f->shared);
584 
585     FUNC_LEAVE_NOAPI(f->shared->rdcc_nslots)
586 } /* end H5F_rdcc_nelmts() */
587 
588 
589 /*-------------------------------------------------------------------------
590  * Function: H5F_rdcc_nbytes
591  *
592  * Purpose:  Replaced a macro to retrieve the raw data cache number of bytes,
593  *           now that the generic properties are being used to store
594  *           the values.
595  *
596  * Return:   Success:    Non-negative, and the raw data cache number of
597  *                              of bytes is returned.
598  *           Failure:    Negative (should not happen)
599  *-------------------------------------------------------------------------
600  */
601 size_t
H5F_rdcc_nbytes(const H5F_t * f)602 H5F_rdcc_nbytes(const H5F_t *f)
603 {
604     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
605     FUNC_ENTER_NOAPI_NOINIT_NOERR
606 
607     HDassert(f);
608     HDassert(f->shared);
609 
610     FUNC_LEAVE_NOAPI(f->shared->rdcc_nbytes)
611 } /* end H5F_rdcc_nbytes() */
612 
613 
614 /*-------------------------------------------------------------------------
615  * Function: H5F_rdcc_w0
616  *
617  * Purpose:  Replaced a macro to retrieve the raw data cache 'w0' value
618  *           now that the generic properties are being used to store
619  *           the values.
620  *
621  * Return:   Success:    Non-negative, and the raw data cache 'w0' value
622  *                              is returned.
623  *           Failure:    Negative (should not happen)
624  *-------------------------------------------------------------------------
625  */
626 double
H5F_rdcc_w0(const H5F_t * f)627 H5F_rdcc_w0(const H5F_t *f)
628 {
629     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
630     FUNC_ENTER_NOAPI_NOINIT_NOERR
631 
632     HDassert(f);
633     HDassert(f->shared);
634 
635     FUNC_LEAVE_NOAPI(f->shared->rdcc_w0)
636 } /* end H5F_rdcc_w0() */
637 
638 
639 /*-------------------------------------------------------------------------
640  * Function: H5F_get_base_addr
641  *
642  * Purpose:  Quick and dirty routine to retrieve the file's 'base_addr' value
643  *           (Mainly added to stop non-file routines from poking about in the
644  *           H5F_t data structure)
645  *
646  * Return:   Non-negative on success/Negative on failure
647  *-------------------------------------------------------------------------
648  */
649 haddr_t
H5F_get_base_addr(const H5F_t * f)650 H5F_get_base_addr(const H5F_t *f)
651 {
652     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
653     FUNC_ENTER_NOAPI_NOINIT_NOERR
654 
655     HDassert(f);
656     HDassert(f->shared);
657     HDassert(f->shared->sblock);
658 
659     FUNC_LEAVE_NOAPI(f->shared->sblock->base_addr)
660 } /* end H5F_get_base_addr() */
661 
662 
663 /*-------------------------------------------------------------------------
664  * Function: H5F_grp_btree_shared
665  *
666  * Purpose:  Replaced a macro to retrieve the shared B-tree node info
667  *           now that the generic properties are being used to store
668  *           the values.
669  *
670  * Return:   Success:    Non-void, and the shared B-tree node info
671  *                              is returned.
672  *           Failure:    void (should not happen)
673  *-------------------------------------------------------------------------
674  */
675 H5UC_t *
H5F_grp_btree_shared(const H5F_t * f)676 H5F_grp_btree_shared(const H5F_t *f)
677 {
678     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
679     FUNC_ENTER_NOAPI_NOINIT_NOERR
680 
681     HDassert(f);
682     HDassert(f->shared);
683 
684     FUNC_LEAVE_NOAPI(f->shared->grp_btree_shared)
685 } /* end H5F_grp_btree_shared() */
686 
687 
688 /*-------------------------------------------------------------------------
689  * Function: H5F_sieve_buf_size
690  *
691  * Purpose:  Replaced a macro to retrieve the dataset sieve buffer size
692  *           now that the generic properties are being used to store
693  *           the values.
694  *
695  * Return:   Success:    Non-void, and the dataset sieve buffer size
696  *                              is returned.
697  *           Failure:    void (should not happen)
698  *-------------------------------------------------------------------------
699  */
700 size_t
H5F_sieve_buf_size(const H5F_t * f)701 H5F_sieve_buf_size(const H5F_t *f)
702 {
703     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
704     FUNC_ENTER_NOAPI_NOINIT_NOERR
705 
706     HDassert(f);
707     HDassert(f->shared);
708 
709     FUNC_LEAVE_NOAPI(f->shared->sieve_buf_size)
710 } /* end H5F_sieve_buf_size() */
711 
712 
713 /*-------------------------------------------------------------------------
714  * Function: H5F_gc_ref
715  *
716  * Purpose:  Replaced a macro to retrieve the "garbage collect
717  *           references flag" now that the generic properties are being used
718  *           to store the values.
719  *
720  * Return:  Success:    The "garbage collect references flag" is returned.
721  *          Failure:    (should not happen)
722  *
723  * Programmer:  Quincey Koziol
724  *              koziol@ncsa.uiuc.edu
725  *              Jul  8 2005
726  *
727  *-------------------------------------------------------------------------
728  */
729 unsigned
H5F_gc_ref(const H5F_t * f)730 H5F_gc_ref(const H5F_t *f)
731 {
732     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
733     FUNC_ENTER_NOAPI_NOINIT_NOERR
734 
735     HDassert(f);
736     HDassert(f->shared);
737 
738     FUNC_LEAVE_NOAPI(f->shared->gc_ref)
739 } /* end H5F_gc_ref() */
740 
741 
742 /*-------------------------------------------------------------------------
743  * Function: H5F_get_fc_degree
744  *
745  * Purpose:  Retrieve the 'file close degree' for the file.
746  *
747  * Return:   Success:    Non-negative, the 'file close degree'
748  *           Failure:    (can't happen)
749  *-------------------------------------------------------------------------
750  */
751 H5F_close_degree_t
H5F_get_fc_degree(const H5F_t * f)752 H5F_get_fc_degree(const H5F_t *f)
753 {
754     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
755     FUNC_ENTER_NOAPI_NOINIT_NOERR
756 
757     HDassert(f);
758     HDassert(f->shared);
759 
760     FUNC_LEAVE_NOAPI(f->shared->fc_degree)
761 } /* end H5F_get_fc_degree() */
762 
763 
764 /*-------------------------------------------------------------------------
765  * Function:    H5F_get_evict_on_close
766  *
767  * Purpose:     Checks if evict-on-close is desired for objects in the
768  *              file.
769  *
770  * Return:      Success:    Flag indicating whether the evict-on-close
771  *                          property was set for the file.
772  *              Failure:    (can't happen)
773  *-------------------------------------------------------------------------
774  */
775 hbool_t
H5F_get_evict_on_close(const H5F_t * f)776 H5F_get_evict_on_close(const H5F_t *f)
777 {
778     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
779     FUNC_ENTER_NOAPI_NOINIT_NOERR
780 
781     HDassert(f);
782     HDassert(f->shared);
783 
784     FUNC_LEAVE_NOAPI(f->shared->evict_on_close)
785 } /* end H5F_get_evict_on_close() */
786 
787 
788 /*-------------------------------------------------------------------------
789  * Function: H5F_store_msg_crt_idx
790  *
791  * Purpose:  Retrieve the 'store message creation index' flag for the file.
792  *
793  * Return:   Success:    Non-negative, the 'store message creation index' flag
794  *           Failure:    (can't happen)
795  *-------------------------------------------------------------------------
796  */
797 hbool_t
H5F_store_msg_crt_idx(const H5F_t * f)798 H5F_store_msg_crt_idx(const H5F_t *f)
799 {
800     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
801     FUNC_ENTER_NOAPI_NOINIT_NOERR
802 
803     HDassert(f);
804     HDassert(f->shared);
805 
806     FUNC_LEAVE_NOAPI(f->shared->store_msg_crt_idx)
807 } /* end H5F_store_msg_crt_idx() */
808 
809 
810 /*-------------------------------------------------------------------------
811  * Function: H5F_has_feature
812  *
813  * Purpose:  Check if a file has a particular feature enabled
814  *
815  * Return:   Success:    Non-negative - TRUE or FALSE
816  *           Failure:    Negative (should not happen)
817  *-------------------------------------------------------------------------
818  */
819 hbool_t
H5F_has_feature(const H5F_t * f,unsigned feature)820 H5F_has_feature(const H5F_t *f, unsigned feature)
821 {
822     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
823     FUNC_ENTER_NOAPI_NOINIT_NOERR
824 
825     HDassert(f);
826     HDassert(f->shared);
827 
828     FUNC_LEAVE_NOAPI((hbool_t)(f->shared->lf->feature_flags&feature))
829 } /* end H5F_has_feature() */
830 
831 
832 /*-------------------------------------------------------------------------
833  * Function: H5F_get_driver_id
834  *
835  * Purpose:  Quick and dirty routine to retrieve the file's 'driver_id' value
836  *           (Mainly added to stop non-file routines from poking about in the
837  *           H5F_t data structure)
838  *
839  * Return:   'driver_id' on success/abort on failure (shouldn't fail)
840  *-------------------------------------------------------------------------
841  */
842 hid_t
H5F_get_driver_id(const H5F_t * f)843 H5F_get_driver_id(const H5F_t *f)
844 {
845     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
846     FUNC_ENTER_NOAPI_NOINIT_NOERR
847 
848     HDassert(f);
849     HDassert(f->shared);
850     HDassert(f->shared->lf);
851 
852     FUNC_LEAVE_NOAPI(f->shared->lf->driver_id)
853 } /* end H5F_get_driver_id() */
854 
855 
856 /*-------------------------------------------------------------------------
857  * Function: H5F_get_fileno
858  *
859  * Purpose:  Quick and dirty routine to retrieve the file's 'fileno' value
860  *           (Mainly added to stop non-file routines from poking about in the
861  *           H5F_t data structure)
862  *
863  * Return:   Non-negative on success/Negative on failure
864  *-------------------------------------------------------------------------
865  */
866 herr_t
H5F_get_fileno(const H5F_t * f,unsigned long * filenum)867 H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
868 {
869     herr_t    ret_value = SUCCEED;
870 
871     FUNC_ENTER_NOAPI(FAIL)
872 
873     HDassert(f);
874     HDassert(f->shared);
875     HDassert(f->shared->lf);
876     HDassert(filenum);
877 
878     /* Retrieve the file's serial number */
879     if(H5FD_get_fileno(f->shared->lf, filenum) < 0)
880     HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno")
881 
882 done:
883     FUNC_LEAVE_NOAPI(ret_value)
884 } /* end H5F_get_fileno() */
885 
886 
887 /*-------------------------------------------------------------------------
888  * Function: H5F_get_eoa
889  *
890  * Purpose:  Quick and dirty routine to retrieve the file's 'eoa' value
891  *
892  * Return:   Non-negative on success/Negative on failure
893  *-------------------------------------------------------------------------
894  */
895 haddr_t
H5F_get_eoa(const H5F_t * f,H5FD_mem_t type)896 H5F_get_eoa(const H5F_t *f, H5FD_mem_t type)
897 {
898     haddr_t    ret_value = HADDR_UNDEF;        /* Return value */
899 
900     FUNC_ENTER_NOAPI(HADDR_UNDEF)
901 
902     HDassert(f);
903     HDassert(f->shared);
904 
905     /* Dispatch to driver */
906     if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type)))
907     HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
908 
909 done:
910     FUNC_LEAVE_NOAPI(ret_value)
911 } /* end H5F_get_eoa() */
912 
913 
914 /*-------------------------------------------------------------------------
915  * Function:    H5F_get_vfd_handle
916  *
917  * Purpose:     Returns a pointer to the file handle of the low-level file
918  *              driver.  This is the private function for H5Fget_vfd_handle.
919  *
920  * Return:      Success:        Non-negative.
921  *              Failure:        negative.
922  *-------------------------------------------------------------------------
923  */
924 herr_t
H5F_get_vfd_handle(const H5F_t * file,hid_t fapl,void ** file_handle)925 H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle)
926 {
927     herr_t ret_value = SUCCEED;         /* Return value */
928 
929     FUNC_ENTER_NOAPI(FAIL)
930 
931     /* Sanity check */
932     HDassert(file);
933     HDassert(file_handle);
934 
935     /* Get the VFD handle */
936     if(H5FD_get_vfd_handle(file->shared->lf, fapl, file_handle) < 0)
937         HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver")
938 
939 done:
940     FUNC_LEAVE_NOAPI(ret_value)
941 } /* end H5F_get_vfd_handle() */
942 
943 
944 /*-------------------------------------------------------------------------
945  * Function: H5F_is_tmp_addr
946  *
947  * Purpose:  Quick and dirty routine to determine if an address is in
948  *           the 'temporary' file space.
949  *           (Mainly added to stop non-file routines from poking about in the
950  *           H5F_t data structure)
951  *
952  * Return:   TRUE/FALSE on success/abort on failure (shouldn't fail)
953  *-------------------------------------------------------------------------
954  */
955 hbool_t
H5F_is_tmp_addr(const H5F_t * f,haddr_t addr)956 H5F_is_tmp_addr(const H5F_t *f, haddr_t addr)
957 {
958     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
959     FUNC_ENTER_NOAPI_NOINIT_NOERR
960 
961     HDassert(f);
962     HDassert(f->shared);
963 
964     FUNC_LEAVE_NOAPI(H5F_addr_le(f->shared->tmp_addr, addr))
965 } /* end H5F_is_tmp_addr() */
966 
967 
968 /*-------------------------------------------------------------------------
969  * Function: H5F_use_tmp_space
970  *
971  * Purpose:  Quick and dirty routine to determine if using temporary
972  *           file space is allowed for this file.
973  *           (Mainly added to stop non-file routines from poking about in the
974  *           H5F_t data structure)
975  *
976  * Return:   TRUE/FALSE on success/abort on failure (shouldn't fail)
977  *-------------------------------------------------------------------------
978  */
979 hbool_t
H5F_use_tmp_space(const H5F_t * f)980 H5F_use_tmp_space(const H5F_t *f)
981 {
982     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
983     FUNC_ENTER_NOAPI_NOINIT_NOERR
984 
985     HDassert(f);
986     HDassert(f->shared);
987 
988     FUNC_LEAVE_NOAPI(f->shared->use_tmp_space)
989 } /* end H5F_use_tmp_space() */
990 
991 #ifdef H5_HAVE_PARALLEL
992 
993 /*-------------------------------------------------------------------------
994  * Function: H5F_coll_md_read
995  *
996  * Purpose:  Retrieve the 'collective metadata reads' flag for the file.
997  *
998  * Return:   Success:    Non-negative, the 'collective metadata reads' flag
999  *           Failure:    (can't happen)
1000  *-------------------------------------------------------------------------
1001  */
1002 H5P_coll_md_read_flag_t
H5F_coll_md_read(const H5F_t * f)1003 H5F_coll_md_read(const H5F_t *f)
1004 {
1005     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1006     FUNC_ENTER_NOAPI_NOINIT_NOERR
1007 
1008     HDassert(f);
1009 
1010     FUNC_LEAVE_NOAPI(f->coll_md_read)
1011 } /* end H5F_coll_md_read() */
1012 #endif /* H5_HAVE_PARALLEL */
1013 
1014 
1015 /*-------------------------------------------------------------------------
1016  * Function: H5F_use_mdc_logging
1017  *
1018  * Purpose:  Quick and dirty routine to determine if using MDC logging
1019  *           is enabled for this file.
1020  *           (Mainly added to stop non-file routines from poking about in the
1021  *           H5F_t data structure)
1022  *
1023  * Return:   TRUE/FALSE on success/abort on failure (shouldn't fail)
1024  *-------------------------------------------------------------------------
1025  */
1026 hbool_t
H5F_use_mdc_logging(const H5F_t * f)1027 H5F_use_mdc_logging(const H5F_t *f)
1028 {
1029     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1030     FUNC_ENTER_NOAPI_NOINIT_NOERR
1031 
1032     HDassert(f);
1033     HDassert(f->shared);
1034 
1035     FUNC_LEAVE_NOAPI(f->shared->use_mdc_logging)
1036 } /* end H5F_use_mdc_logging() */
1037 
1038 
1039 /*-------------------------------------------------------------------------
1040  * Function: H5F_start_mdc_log_on_access
1041  *
1042  * Purpose:  Quick and dirty routine to determine if we should start MDC
1043  *           logging on access for this file.
1044  *           (Mainly added to stop non-file routines from poking about in the
1045  *           H5F_t data structure)
1046  *
1047  * Return:   TRUE/FALSE on success/abort on failure (shouldn't fail)
1048  *-------------------------------------------------------------------------
1049  */
1050 hbool_t
H5F_start_mdc_log_on_access(const H5F_t * f)1051 H5F_start_mdc_log_on_access(const H5F_t *f)
1052 {
1053     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1054     FUNC_ENTER_NOAPI_NOINIT_NOERR
1055 
1056     HDassert(f);
1057     HDassert(f->shared);
1058 
1059     FUNC_LEAVE_NOAPI(f->shared->start_mdc_log_on_access)
1060 } /* end H5F_start_mdc_log_on_access() */
1061 
1062 
1063 /*-------------------------------------------------------------------------
1064  * Function: H5F_mdc_log_location
1065  *
1066  * Purpose:  Quick and dirty routine to retrieve the MDC log location
1067  *           for this file.
1068  *           (Mainly added to stop non-file routines from poking about in the
1069  *           H5F_t data structure)
1070  *
1071  * Return:   TRUE/FALSE on success/abort on failure (shouldn't fail)
1072  *-------------------------------------------------------------------------
1073  */
1074 char *
H5F_mdc_log_location(const H5F_t * f)1075 H5F_mdc_log_location(const H5F_t *f)
1076 {
1077     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1078     FUNC_ENTER_NOAPI_NOINIT_NOERR
1079 
1080     HDassert(f);
1081     HDassert(f->shared);
1082 
1083     FUNC_LEAVE_NOAPI(f->shared->mdc_log_location)
1084 } /* end H5F_mdc_log_location() */
1085 
1086 
1087 /*-------------------------------------------------------------------------
1088  * Function: H5F_get_alignment
1089  *
1090  * Purpose:  Retrieve the 'alignment' for the file.
1091  *
1092  * Return:   Success:    Non-negative, the 'alignment'
1093  *           Failure:    (can't happen)
1094  *-------------------------------------------------------------------------
1095  */
1096 hsize_t
H5F_get_alignment(const H5F_t * f)1097 H5F_get_alignment(const H5F_t *f)
1098 {
1099     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1100     FUNC_ENTER_NOAPI_NOINIT_NOERR
1101 
1102     HDassert(f);
1103     HDassert(f->shared);
1104 
1105     FUNC_LEAVE_NOAPI(f->shared->alignment)
1106 } /* end H5F_get_alignment() */
1107 
1108 
1109 /*-------------------------------------------------------------------------
1110  * Function: H5F_get_threshold
1111  *
1112  * Purpose:  Retrieve the 'threshold' for alignment in the file.
1113  *
1114  * Return:   Success:    Non-negative, the 'threshold'
1115  *           Failure:    (can't happen)
1116  *-------------------------------------------------------------------------
1117  */
1118 hsize_t
H5F_get_threshold(const H5F_t * f)1119 H5F_get_threshold(const H5F_t *f)
1120 {
1121     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1122     FUNC_ENTER_NOAPI_NOINIT_NOERR
1123 
1124     HDassert(f);
1125     HDassert(f->shared);
1126 
1127     FUNC_LEAVE_NOAPI(f->shared->threshold)
1128 } /* end H5F_get_threshold() */
1129 
1130 
1131 /*-------------------------------------------------------------------------
1132  * Function: H5F_get_pgend_meta_thres
1133  *
1134  * Purpose:  Retrieve the 'page end meta threshold size' for the file.
1135  *
1136  * Return:   Success:    Non-negative, the 'pgend_meta_thres'
1137  *           Failure:    (can't happen)
1138  *-------------------------------------------------------------------------
1139  */
1140 hsize_t
H5F_get_pgend_meta_thres(const H5F_t * f)1141 H5F_get_pgend_meta_thres(const H5F_t *f)
1142 {
1143     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1144     FUNC_ENTER_NOAPI_NOINIT_NOERR
1145 
1146     HDassert(f);
1147     HDassert(f->shared);
1148 
1149     FUNC_LEAVE_NOAPI(f->shared->pgend_meta_thres)
1150 } /* end H5F_get_pgend_meta_thres() */
1151 
1152 
1153 /*-------------------------------------------------------------------------
1154  * Function: H5F_get_point_of_no_return
1155  *
1156  * Purpose:  Retrieve the 'point of no return' value for the file.
1157  *
1158  * Return:   Success:    Non-negative, the 'point_of_no_return'
1159  *           Failure:    (can't happen)
1160  *-------------------------------------------------------------------------
1161  */
1162 hbool_t
H5F_get_point_of_no_return(const H5F_t * f)1163 H5F_get_point_of_no_return(const H5F_t *f)
1164 {
1165     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1166     FUNC_ENTER_NOAPI_NOINIT_NOERR
1167 
1168     HDassert(f);
1169     HDassert(f->shared);
1170 
1171     FUNC_LEAVE_NOAPI(f->shared->point_of_no_return)
1172 } /* end H5F_get_point_of_no_return() */
1173 
1174 
1175 /*-------------------------------------------------------------------------
1176  * Function: H5F_get_first_alloc_dealloc
1177  *
1178  * Purpose:  Retrieve the 'first alloc / dealloc' value for the file.
1179  *
1180  * Return:   Success:    Non-negative, the 'first_alloc_dealloc'
1181  *           Failure:    (can't happen)
1182  *-------------------------------------------------------------------------
1183  */
1184 hbool_t
H5F_get_first_alloc_dealloc(const H5F_t * f)1185 H5F_get_first_alloc_dealloc(const H5F_t *f)
1186 {
1187     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1188     FUNC_ENTER_NOAPI_NOINIT_NOERR
1189 
1190     HDassert(f);
1191     HDassert(f->shared);
1192 
1193     FUNC_LEAVE_NOAPI(f->shared->first_alloc_dealloc)
1194 } /* end H5F_get_first_alloc_dealloc() */
1195 
1196 
1197 /*-------------------------------------------------------------------------
1198  * Function: H5F_get_eoa_pre_fsm_fsalloc
1199  *
1200  * Purpose:  Retrieve the 'EOA pre-FSM fsalloc' value for the file.
1201  *
1202  * Return:   Success:    Non-negative, the 'EOA pre-FSM fsalloc'
1203  *           Failure:    (can't happen)
1204  *-------------------------------------------------------------------------
1205  */
1206 haddr_t
H5F_get_eoa_pre_fsm_fsalloc(const H5F_t * f)1207 H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f)
1208 {
1209     /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1210     FUNC_ENTER_NOAPI_NOINIT_NOERR
1211 
1212     HDassert(f);
1213     HDassert(f->shared);
1214 
1215     FUNC_LEAVE_NOAPI(f->shared->eoa_pre_fsm_fsalloc)
1216 } /* end H5F_get_eoa_pre_fsm_fsalloc() */
1217 
1218