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 #define H5F_PACKAGE /*suppress error about including H5Fpkg */
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 * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
87 * September 29, 2000
88 *
89 *-------------------------------------------------------------------------
90 */
91 unsigned
H5F_get_intent(const H5F_t * f)92 H5F_get_intent(const H5F_t *f)
93 {
94 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
95 FUNC_ENTER_NOAPI_NOINIT_NOERR
96
97 HDassert(f);
98
99 FUNC_LEAVE_NOAPI(f->shared->flags)
100 } /* end H5F_get_intent() */
101
102
103 /*-------------------------------------------------------------------------
104 * Function: H5F_get_open_name
105 *
106 * Purpose: Retrieve the name used to open a file.
107 *
108 * Return: Success: The name of the file.
109 * Failure: ? (should not happen)
110 *
111 * Programmer: Neil Fortner
112 * December 15 2008
113 *
114 *-------------------------------------------------------------------------
115 */
116 char *
H5F_get_open_name(const H5F_t * f)117 H5F_get_open_name(const H5F_t *f)
118 {
119 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
120 FUNC_ENTER_NOAPI_NOINIT_NOERR
121
122 HDassert(f);
123 HDassert(f->open_name);
124
125 FUNC_LEAVE_NOAPI(f->open_name)
126 } /* end H5F_get_open_name() */
127
128
129 /*-------------------------------------------------------------------------
130 * Function: H5F_get_actual_name
131 *
132 * Purpose: Retrieve the actual name of a file, after resolving symlinks, etc.
133 *
134 * Return: Success: The name of the file.
135 * Failure: ? (should not happen)
136 *
137 * Programmer: Quincey Koziol
138 * November 25 2009
139 *
140 *-------------------------------------------------------------------------
141 */
142 char *
H5F_get_actual_name(const H5F_t * f)143 H5F_get_actual_name(const H5F_t *f)
144 {
145 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
146 FUNC_ENTER_NOAPI_NOINIT_NOERR
147
148 HDassert(f);
149 HDassert(f->actual_name);
150
151 FUNC_LEAVE_NOAPI(f->actual_name)
152 } /* end H5F_get_actual_name() */
153
154
155 /*-------------------------------------------------------------------------
156 * Function: H5F_get_extpath
157 *
158 * Purpose: Retrieve the file's 'extpath' flags
159 * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location
160 * when searching the target file.
161 *
162 * Return: 'extpath' on success/abort on failure (shouldn't fail)
163 *
164 * Programmer: Vailin Choi, April 2, 2008
165 *
166 *-------------------------------------------------------------------------
167 */
168 char *
H5F_get_extpath(const H5F_t * f)169 H5F_get_extpath(const H5F_t *f)
170 {
171 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
172 FUNC_ENTER_NOAPI_NOINIT_NOERR
173
174 HDassert(f);
175 HDassert(f->extpath);
176
177 FUNC_LEAVE_NOAPI(f->extpath)
178 } /* end H5F_get_extpath() */
179
180
181 /*-------------------------------------------------------------------------
182 * Function: H5F_get_shared
183 *
184 * Purpose: Retrieve the file's 'shared' pointer
185 *
186 * Return: 'shared' on success/abort on failure (shouldn't fail)
187 *
188 * Programmer: Quincey Koziol, July 20, 2011
189 *
190 *-------------------------------------------------------------------------
191 */
192 H5F_file_t *
H5F_get_shared(const H5F_t * f)193 H5F_get_shared(const H5F_t *f)
194 {
195 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
196 FUNC_ENTER_NOAPI_NOINIT_NOERR
197
198 HDassert(f);
199
200 FUNC_LEAVE_NOAPI(f->shared)
201 } /* end H5F_get_shared() */
202
203
204 /*-------------------------------------------------------------------------
205 * Function: H5F_same_shared
206 *
207 * Purpose: Determine if two files have the same shared file pointer
208 *
209 * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
210 *
211 * Programmer: Quincey Koziol, July 19, 2011
212 *
213 *-------------------------------------------------------------------------
214 */
215 hbool_t
H5F_same_shared(const H5F_t * f1,const H5F_t * f2)216 H5F_same_shared(const H5F_t *f1, const H5F_t *f2)
217 {
218 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
219 FUNC_ENTER_NOAPI_NOINIT_NOERR
220
221 HDassert(f1);
222 HDassert(f1->shared);
223 HDassert(f2);
224 HDassert(f2->shared);
225
226 FUNC_LEAVE_NOAPI(f1->shared == f2->shared)
227 } /* end H5F_same_shared() */
228
229
230 /*-------------------------------------------------------------------------
231 * Function: H5F_get_nopen_objs
232 *
233 * Purpose: Retrieve the file's 'nopen_objs' value
234 *
235 * Return: 'nopen_objs' on success/abort on failure (shouldn't fail)
236 *
237 * Programmer: Quincey Koziol, July 20, 2011
238 *
239 *-------------------------------------------------------------------------
240 */
241 unsigned
H5F_get_nopen_objs(const H5F_t * f)242 H5F_get_nopen_objs(const H5F_t *f)
243 {
244 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
245 FUNC_ENTER_NOAPI_NOINIT_NOERR
246
247 HDassert(f);
248
249 FUNC_LEAVE_NOAPI(f->nopen_objs)
250 } /* end H5F_get_nopen_objs() */
251
252
253 /*-------------------------------------------------------------------------
254 * Function: H5F_get_file_id
255 *
256 * Purpose: Retrieve the file's 'file_id' value
257 *
258 * Return: 'file_id' on success/abort on failure (shouldn't fail)
259 *
260 * Programmer: Quincey Koziol, July 20, 2011
261 *
262 *-------------------------------------------------------------------------
263 */
264 hid_t
H5F_get_file_id(const H5F_t * f)265 H5F_get_file_id(const H5F_t *f)
266 {
267 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
268 FUNC_ENTER_NOAPI_NOINIT_NOERR
269
270 HDassert(f);
271
272 FUNC_LEAVE_NOAPI(f->file_id)
273 } /* end H5F_get_file_id() */
274
275
276 /*-------------------------------------------------------------------------
277 * Function: H5F_get_parent
278 *
279 * Purpose: Retrieve the file's 'parent' pointer
280 *
281 * Return: 'parent' on success/abort on failure (shouldn't fail)
282 *
283 * Programmer: Quincey Koziol, July 19, 2011
284 *
285 *-------------------------------------------------------------------------
286 */
287 H5F_t *
H5F_get_parent(const H5F_t * f)288 H5F_get_parent(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->parent)
296 } /* end H5F_get_parent() */
297
298
299 /*-------------------------------------------------------------------------
300 * Function: H5F_get_nmounts
301 *
302 * Purpose: Retrieve the file's 'nmounts' value
303 *
304 * Return: 'nmounts' on success/abort on failure (shouldn't fail)
305 *
306 * Programmer: Quincey Koziol, July 20, 2011
307 *
308 *-------------------------------------------------------------------------
309 */
310 unsigned
H5F_get_nmounts(const H5F_t * f)311 H5F_get_nmounts(const H5F_t *f)
312 {
313 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
314 FUNC_ENTER_NOAPI_NOINIT_NOERR
315
316 HDassert(f);
317
318 FUNC_LEAVE_NOAPI(f->nmounts)
319 } /* end H5F_get_nmounts() */
320
321
322 /*-------------------------------------------------------------------------
323 * Function: H5F_get_fcpl
324 *
325 * Purpose: Retrieve the value of a file's FCPL.
326 *
327 * Return: Success: The FCPL for the file.
328 *
329 * Failure: ? (should not happen)
330 *
331 * Programmer: Quincey Koziol
332 * koziol@ncsa.uiuc.edu
333 * May 25 2005
334 *
335 *-------------------------------------------------------------------------
336 */
337 hid_t
H5F_get_fcpl(const H5F_t * f)338 H5F_get_fcpl(const H5F_t *f)
339 {
340 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
341 FUNC_ENTER_NOAPI_NOINIT_NOERR
342
343 HDassert(f);
344 HDassert(f->shared);
345
346 FUNC_LEAVE_NOAPI(f->shared->fcpl_id)
347 } /* end H5F_get_fcpl() */
348
349
350 /*-------------------------------------------------------------------------
351 * Function: H5F_sizeof_addr
352 *
353 * Purpose: Quick and dirty routine to retrieve the size of the file's size_t
354 * (Mainly added to stop non-file routines from poking about in the
355 * H5F_t data structure)
356 *
357 * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail)
358 *
359 * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
360 * September 29, 2000
361 *
362 *-------------------------------------------------------------------------
363 */
364 uint8_t
H5F_sizeof_addr(const H5F_t * f)365 H5F_sizeof_addr(const H5F_t *f)
366 {
367 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
368 FUNC_ENTER_NOAPI_NOINIT_NOERR
369
370 HDassert(f);
371 HDassert(f->shared);
372
373 FUNC_LEAVE_NOAPI(f->shared->sizeof_addr)
374 } /* end H5F_sizeof_addr() */
375
376
377 /*-------------------------------------------------------------------------
378 * Function: H5F_sizeof_size
379 *
380 * Purpose: Quick and dirty routine to retrieve the size of the file's off_t
381 * (Mainly added to stop non-file routines from poking about in the
382 * H5F_t data structure)
383 *
384 * Return: 'sizeof_size' on success/abort on failure (shouldn't fail)
385 *
386 * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
387 * September 29, 2000
388 *
389 *-------------------------------------------------------------------------
390 */
391 uint8_t
H5F_sizeof_size(const H5F_t * f)392 H5F_sizeof_size(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_size)
401 } /* H5F_sizeof_size() */
402
403
404 /*-------------------------------------------------------------------------
405 * Function: H5F_get_sohm_addr
406 *
407 * Purpose: Retrieve the file's 'sohm_addr' value
408 *
409 * Return: 'sohm_addr' on success/abort on failure (shouldn't fail)
410 *
411 * Programmer: Quincey Koziol, July 20, 2011
412 *
413 *-------------------------------------------------------------------------
414 */
415 haddr_t
H5F_get_sohm_addr(const H5F_t * f)416 H5F_get_sohm_addr(const H5F_t *f)
417 {
418 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
419 FUNC_ENTER_NOAPI_NOINIT_NOERR
420
421 HDassert(f);
422 HDassert(f->shared);
423
424 FUNC_LEAVE_NOAPI(f->shared->sohm_addr)
425 } /* end H5F_get_sohm_addr() */
426
427
428 /*-------------------------------------------------------------------------
429 * Function: H5F_get_sohm_vers
430 *
431 * Purpose: Retrieve the file's 'sohm_vers' value
432 *
433 * Return: 'sohm_vers' on success/abort on failure (shouldn't fail)
434 *
435 * Programmer: Quincey Koziol, July 20, 2011
436 *
437 *-------------------------------------------------------------------------
438 */
439 unsigned
H5F_get_sohm_vers(const H5F_t * f)440 H5F_get_sohm_vers(const H5F_t *f)
441 {
442 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
443 FUNC_ENTER_NOAPI_NOINIT_NOERR
444
445 HDassert(f);
446 HDassert(f->shared);
447
448 FUNC_LEAVE_NOAPI(f->shared->sohm_vers)
449 } /* end H5F_get_sohm_vers() */
450
451
452 /*-------------------------------------------------------------------------
453 * Function: H5F_get_sohm_nindexes
454 *
455 * Purpose: Retrieve the file's 'sohm_nindexes' value
456 *
457 * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail)
458 *
459 * Programmer: Quincey Koziol, July 20, 2011
460 *
461 *-------------------------------------------------------------------------
462 */
463 unsigned
H5F_get_sohm_nindexes(const H5F_t * f)464 H5F_get_sohm_nindexes(const H5F_t *f)
465 {
466 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
467 FUNC_ENTER_NOAPI_NOINIT_NOERR
468
469 HDassert(f);
470 HDassert(f->shared);
471
472 FUNC_LEAVE_NOAPI(f->shared->sohm_nindexes)
473 } /* end H5F_get_sohm_nindexes() */
474
475
476 /*-------------------------------------------------------------------------
477 * Function: H5F_sym_leaf_k
478 *
479 * Purpose: Replaced a macro to retrieve the symbol table leaf size,
480 * now that the generic properties are being used to store
481 * the values.
482 *
483 * Return: Success: Non-negative, and the symbol table leaf size is
484 * returned.
485 *
486 * Failure: Negative (should not happen)
487 *
488 * Programmer: Raymond Lu
489 * slu@ncsa.uiuc.edu
490 * Oct 14 2001
491 *
492 *-------------------------------------------------------------------------
493 */
494 unsigned
H5F_sym_leaf_k(const H5F_t * f)495 H5F_sym_leaf_k(const H5F_t *f)
496 {
497 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
498 FUNC_ENTER_NOAPI_NOINIT_NOERR
499
500 HDassert(f);
501 HDassert(f->shared);
502 HDassert(f->shared->sblock);
503
504 FUNC_LEAVE_NOAPI(f->shared->sblock->sym_leaf_k)
505 } /* end H5F_sym_leaf_k() */
506
507
508 /*-------------------------------------------------------------------------
509 * Function: H5F_Kvalue
510 *
511 * Purpose: Replaced a macro to retrieve a B-tree key value for a certain
512 * type, now that the generic properties are being used to store
513 * the B-tree values.
514 *
515 * Return: Success: Non-negative, and the B-tree key value is
516 * returned.
517 *
518 * Failure: Negative (should not happen)
519 *
520 * Programmer: Raymond Lu
521 * slu@ncsa.uiuc.edu
522 * Oct 14 2001
523 *
524 *-------------------------------------------------------------------------
525 */
526 unsigned
H5F_Kvalue(const H5F_t * f,const H5B_class_t * type)527 H5F_Kvalue(const H5F_t *f, const H5B_class_t *type)
528 {
529 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
530 FUNC_ENTER_NOAPI_NOINIT_NOERR
531
532 HDassert(f);
533 HDassert(f->shared);
534 HDassert(f->shared->sblock);
535 HDassert(type);
536
537 FUNC_LEAVE_NOAPI(f->shared->sblock->btree_k[type->id])
538 } /* end H5F_Kvalue() */
539
540
541 /*-------------------------------------------------------------------------
542 * Function: H5F_get_nrefs
543 *
544 * Purpose: Retrieve the file's 'nrefs' value
545 *
546 * Return: 'nrefs' on success/abort on failure (shouldn't fail)
547 *
548 * Programmer: Quincey Koziol, July 20, 2011
549 *
550 *-------------------------------------------------------------------------
551 */
552 unsigned
H5F_get_nrefs(const H5F_t * f)553 H5F_get_nrefs(const H5F_t *f)
554 {
555 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
556 FUNC_ENTER_NOAPI_NOINIT_NOERR
557
558 HDassert(f);
559 HDassert(f->shared);
560
561 FUNC_LEAVE_NOAPI(f->shared->nrefs)
562 } /* end H5F_get_nrefs() */
563
564
565 /*-------------------------------------------------------------------------
566 * Function: H5F_rdcc_nslots
567 *
568 * Purpose: Replaced a macro to retrieve the raw data cache number of slots,
569 * now that the generic properties are being used to store
570 * the values.
571 *
572 * Return: Success: Non-negative, and the raw data cache number of
573 * of slots is returned.
574 *
575 * Failure: Negative (should not happen)
576 *
577 * Programmer: Quincey Koziol
578 * koziol@ncsa.uiuc.edu
579 * Jun 1 2004
580 *
581 *-------------------------------------------------------------------------
582 */
583 size_t
H5F_rdcc_nslots(const H5F_t * f)584 H5F_rdcc_nslots(const H5F_t *f)
585 {
586 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
587 FUNC_ENTER_NOAPI_NOINIT_NOERR
588
589 HDassert(f);
590 HDassert(f->shared);
591
592 FUNC_LEAVE_NOAPI(f->shared->rdcc_nslots)
593 } /* end H5F_rdcc_nelmts() */
594
595
596 /*-------------------------------------------------------------------------
597 * Function: H5F_rdcc_nbytes
598 *
599 * Purpose: Replaced a macro to retrieve the raw data cache number of bytes,
600 * now that the generic properties are being used to store
601 * the values.
602 *
603 * Return: Success: Non-negative, and the raw data cache number of
604 * of bytes is returned.
605 *
606 * Failure: Negative (should not happen)
607 *
608 * Programmer: Quincey Koziol
609 * koziol@ncsa.uiuc.edu
610 * Jun 1 2004
611 *
612 *-------------------------------------------------------------------------
613 */
614 size_t
H5F_rdcc_nbytes(const H5F_t * f)615 H5F_rdcc_nbytes(const H5F_t *f)
616 {
617 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
618 FUNC_ENTER_NOAPI_NOINIT_NOERR
619
620 HDassert(f);
621 HDassert(f->shared);
622
623 FUNC_LEAVE_NOAPI(f->shared->rdcc_nbytes)
624 } /* end H5F_rdcc_nbytes() */
625
626
627 /*-------------------------------------------------------------------------
628 * Function: H5F_rdcc_w0
629 *
630 * Purpose: Replaced a macro to retrieve the raw data cache 'w0' value
631 * now that the generic properties are being used to store
632 * the values.
633 *
634 * Return: Success: Non-negative, and the raw data cache 'w0' value
635 * is returned.
636 *
637 * Failure: Negative (should not happen)
638 *
639 * Programmer: Quincey Koziol
640 * koziol@ncsa.uiuc.edu
641 * Jun 2 2004
642 *
643 *-------------------------------------------------------------------------
644 */
645 double
H5F_rdcc_w0(const H5F_t * f)646 H5F_rdcc_w0(const H5F_t *f)
647 {
648 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
649 FUNC_ENTER_NOAPI_NOINIT_NOERR
650
651 HDassert(f);
652 HDassert(f->shared);
653
654 FUNC_LEAVE_NOAPI(f->shared->rdcc_w0)
655 } /* end H5F_rdcc_w0() */
656
657
658 /*-------------------------------------------------------------------------
659 * Function: H5F_get_base_addr
660 *
661 * Purpose: Quick and dirty routine to retrieve the file's 'base_addr' value
662 * (Mainly added to stop non-file routines from poking about in the
663 * H5F_t data structure)
664 *
665 * Return: Non-negative on success/Negative on failure
666 *
667 * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
668 * December 20, 2002
669 *
670 *-------------------------------------------------------------------------
671 */
672 haddr_t
H5F_get_base_addr(const H5F_t * f)673 H5F_get_base_addr(const H5F_t *f)
674 {
675 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
676 FUNC_ENTER_NOAPI_NOINIT_NOERR
677
678 HDassert(f);
679 HDassert(f->shared);
680 HDassert(f->shared->sblock);
681
682 FUNC_LEAVE_NOAPI(f->shared->sblock->base_addr)
683 } /* end H5F_get_base_addr() */
684
685
686 /*-------------------------------------------------------------------------
687 * Function: H5F_grp_btree_shared
688 *
689 * Purpose: Replaced a macro to retrieve the shared B-tree node info
690 * now that the generic properties are being used to store
691 * the values.
692 *
693 * Return: Success: Non-void, and the shared B-tree node info
694 * is returned.
695 *
696 * Failure: void (should not happen)
697 *
698 * Programmer: Quincey Koziol
699 * koziol@ncsa.uiuc.edu
700 * Jul 5 2004
701 *
702 *-------------------------------------------------------------------------
703 */
704 H5RC_t *
H5F_grp_btree_shared(const H5F_t * f)705 H5F_grp_btree_shared(const H5F_t *f)
706 {
707 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
708 FUNC_ENTER_NOAPI_NOINIT_NOERR
709
710 HDassert(f);
711 HDassert(f->shared);
712
713 FUNC_LEAVE_NOAPI(f->shared->grp_btree_shared)
714 } /* end H5F_grp_btree_shared() */
715
716
717 /*-------------------------------------------------------------------------
718 * Function: H5F_sieve_buf_size
719 *
720 * Purpose: Replaced a macro to retrieve the dataset sieve buffer size
721 * now that the generic properties are being used to store
722 * the values.
723 *
724 * Return: Success: Non-void, and the dataset sieve buffer size
725 * is returned.
726 *
727 * Failure: void (should not happen)
728 *
729 * Programmer: Quincey Koziol
730 * koziol@ncsa.uiuc.edu
731 * Jul 8 2005
732 *
733 *-------------------------------------------------------------------------
734 */
735 size_t
H5F_sieve_buf_size(const H5F_t * f)736 H5F_sieve_buf_size(const H5F_t *f)
737 {
738 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
739 FUNC_ENTER_NOAPI_NOINIT_NOERR
740
741 HDassert(f);
742 HDassert(f->shared);
743
744 FUNC_LEAVE_NOAPI(f->shared->sieve_buf_size)
745 } /* end H5F_sieve_buf_size() */
746
747
748 /*-------------------------------------------------------------------------
749 * Function: H5F_gc_ref
750 *
751 * Purpose: Replaced a macro to retrieve the "garbage collect
752 * references flag" now that the generic properties are being used
753 * to store the values.
754 *
755 * Return: Success: The "garbage collect references flag"
756 * is returned.
757 *
758 * Failure: (should not happen)
759 *
760 * Programmer: Quincey Koziol
761 * koziol@ncsa.uiuc.edu
762 * Jul 8 2005
763 *
764 *-------------------------------------------------------------------------
765 */
766 unsigned
H5F_gc_ref(const H5F_t * f)767 H5F_gc_ref(const H5F_t *f)
768 {
769 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
770 FUNC_ENTER_NOAPI_NOINIT_NOERR
771
772 HDassert(f);
773 HDassert(f->shared);
774
775 FUNC_LEAVE_NOAPI(f->shared->gc_ref)
776 } /* end H5F_gc_ref() */
777
778
779 /*-------------------------------------------------------------------------
780 * Function: H5F_use_latest_format
781 *
782 * Purpose: Retrieve the 'use the latest version of the format' flag for
783 * the file.
784 *
785 * Return: Success: Non-negative, the 'use the latest format' flag
786 *
787 * Failure: (can't happen)
788 *
789 * Programmer: Quincey Koziol
790 * koziol@hdfgroup.org
791 * Oct 2 2006
792 *
793 *-------------------------------------------------------------------------
794 */
795 hbool_t
H5F_use_latest_format(const H5F_t * f)796 H5F_use_latest_format(const H5F_t *f)
797 {
798 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
799 FUNC_ENTER_NOAPI_NOINIT_NOERR
800
801 HDassert(f);
802 HDassert(f->shared);
803
804 FUNC_LEAVE_NOAPI(f->shared->latest_format)
805 } /* end H5F_use_latest_format() */
806
807
808 /*-------------------------------------------------------------------------
809 * Function: H5F_get_fc_degree
810 *
811 * Purpose: Retrieve the 'file close degree' for the file.
812 *
813 * Return: Success: Non-negative, the 'file close degree'
814 *
815 * Failure: (can't happen)
816 *
817 * Programmer: Quincey Koziol
818 * koziol@hdfgroup.org
819 * Mar 5 2007
820 *
821 *-------------------------------------------------------------------------
822 */
823 H5F_close_degree_t
H5F_get_fc_degree(const H5F_t * f)824 H5F_get_fc_degree(const H5F_t *f)
825 {
826 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
827 FUNC_ENTER_NOAPI_NOINIT_NOERR
828
829 HDassert(f);
830 HDassert(f->shared);
831
832 FUNC_LEAVE_NOAPI(f->shared->fc_degree)
833 } /* end H5F_get_fc_degree() */
834
835
836 /*-------------------------------------------------------------------------
837 * Function: H5F_store_msg_crt_idx
838 *
839 * Purpose: Retrieve the 'store message creation index' flag for the file.
840 *
841 * Return: Success: Non-negative, the 'store message creation index' flag
842 *
843 * Failure: (can't happen)
844 *
845 * Programmer: Quincey Koziol
846 * koziol@hdfgroup.org
847 * Mar 6 2007
848 *
849 *-------------------------------------------------------------------------
850 */
851 hbool_t
H5F_store_msg_crt_idx(const H5F_t * f)852 H5F_store_msg_crt_idx(const H5F_t *f)
853 {
854 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
855 FUNC_ENTER_NOAPI_NOINIT_NOERR
856
857 HDassert(f);
858 HDassert(f->shared);
859
860 FUNC_LEAVE_NOAPI(f->shared->store_msg_crt_idx)
861 } /* end H5F_store_msg_crt_idx() */
862
863
864 /*-------------------------------------------------------------------------
865 * Function: H5F_has_feature
866 *
867 * Purpose: Check if a file has a particular feature enabled
868 *
869 * Return: Success: Non-negative - TRUE or FALSE
870 * Failure: Negative (should not happen)
871 *
872 * Programmer: Quincey Koziol
873 * koziol@ncsa.uiuc.edu
874 * May 31 2004
875 *
876 *-------------------------------------------------------------------------
877 */
878 hbool_t
H5F_has_feature(const H5F_t * f,unsigned feature)879 H5F_has_feature(const H5F_t *f, unsigned feature)
880 {
881 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
882 FUNC_ENTER_NOAPI_NOINIT_NOERR
883
884 HDassert(f);
885 HDassert(f->shared);
886
887 FUNC_LEAVE_NOAPI((hbool_t)(f->shared->lf->feature_flags&feature))
888 } /* end H5F_has_feature() */
889
890
891 /*-------------------------------------------------------------------------
892 * Function: H5F_get_driver_id
893 *
894 * Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value
895 * (Mainly added to stop non-file routines from poking about in the
896 * H5F_t data structure)
897 *
898 * Return: 'driver_id' on success/abort on failure (shouldn't fail)
899 *
900 * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
901 * October 10, 2000
902 *
903 *-------------------------------------------------------------------------
904 */
905 hid_t
H5F_get_driver_id(const H5F_t * f)906 H5F_get_driver_id(const H5F_t *f)
907 {
908 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
909 FUNC_ENTER_NOAPI_NOINIT_NOERR
910
911 HDassert(f);
912 HDassert(f->shared);
913 HDassert(f->shared->lf);
914
915 FUNC_LEAVE_NOAPI(f->shared->lf->driver_id)
916 } /* end H5F_get_driver_id() */
917
918
919 /*-------------------------------------------------------------------------
920 * Function: H5F_get_fileno
921 *
922 * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value
923 * (Mainly added to stop non-file routines from poking about in the
924 * H5F_t data structure)
925 *
926 * Return: Non-negative on success/Negative on failure
927 *
928 * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
929 * March 27, 2002
930 *
931 *-------------------------------------------------------------------------
932 */
933 herr_t
H5F_get_fileno(const H5F_t * f,unsigned long * filenum)934 H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
935 {
936 herr_t ret_value = SUCCEED;
937
938 FUNC_ENTER_NOAPI(FAIL)
939
940 HDassert(f);
941 HDassert(f->shared);
942 HDassert(f->shared->lf);
943 HDassert(filenum);
944
945 /* Retrieve the file's serial number */
946 if(H5FD_get_fileno(f->shared->lf, filenum) < 0)
947 HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno")
948
949 done:
950 FUNC_LEAVE_NOAPI(ret_value)
951 } /* end H5F_get_fileno() */
952
953
954 /*-------------------------------------------------------------------------
955 * Function: H5F_get_eoa
956 *
957 * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value
958 *
959 * Return: Non-negative on success/Negative on failure
960 *
961 * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
962 * June 1, 2004
963 *
964 *-------------------------------------------------------------------------
965 */
966 haddr_t
H5F_get_eoa(const H5F_t * f,H5FD_mem_t type)967 H5F_get_eoa(const H5F_t *f, H5FD_mem_t type)
968 {
969 haddr_t ret_value;
970
971 FUNC_ENTER_NOAPI(HADDR_UNDEF)
972
973 HDassert(f);
974 HDassert(f->shared);
975
976 /* Dispatch to driver */
977 if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type)))
978 HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
979
980 done:
981 FUNC_LEAVE_NOAPI(ret_value)
982 } /* end H5F_get_eoa() */
983
984
985 /*-------------------------------------------------------------------------
986 * Function: H5F_get_vfd_handle
987 *
988 * Purpose: Returns a pointer to the file handle of the low-level file
989 * driver. This is the private function for H5Fget_vfd_handle.
990 *
991 * Return: Success: Non-negative.
992 * Failure: negative.
993 *
994 * Programmer: Raymond Lu
995 * Sep. 16, 2002
996 *
997 *-------------------------------------------------------------------------
998 */
999 herr_t
H5F_get_vfd_handle(const H5F_t * file,hid_t fapl,void ** file_handle)1000 H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle)
1001 {
1002 herr_t ret_value = SUCCEED; /* Return value */
1003
1004 FUNC_ENTER_NOAPI(FAIL)
1005
1006 /* Sanity check */
1007 HDassert(file);
1008 HDassert(file_handle);
1009
1010 /* Get the VFD handle */
1011 if(H5FD_get_vfd_handle(file->shared->lf, fapl, file_handle) < 0)
1012 HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver")
1013
1014 done:
1015 FUNC_LEAVE_NOAPI(ret_value)
1016 } /* end H5F_get_vfd_handle() */
1017
1018
1019 /*-------------------------------------------------------------------------
1020 * Function: H5F_is_tmp_addr
1021 *
1022 * Purpose: Quick and dirty routine to determine if an address is in
1023 * the 'temporary' file space.
1024 * (Mainly added to stop non-file routines from poking about in the
1025 * H5F_t data structure)
1026 *
1027 * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
1028 *
1029 * Programmer: Quincey Koziol <koziol@hdfgroup.org>
1030 * June 11, 2009
1031 *
1032 *-------------------------------------------------------------------------
1033 */
1034 hbool_t
H5F_is_tmp_addr(const H5F_t * f,haddr_t addr)1035 H5F_is_tmp_addr(const H5F_t *f, haddr_t addr)
1036 {
1037 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1038 FUNC_ENTER_NOAPI_NOINIT_NOERR
1039
1040 HDassert(f);
1041 HDassert(f->shared);
1042
1043 FUNC_LEAVE_NOAPI(H5F_addr_le(f->shared->tmp_addr, addr))
1044 } /* end H5F_is_tmp_addr() */
1045
1046
1047 /*-------------------------------------------------------------------------
1048 * Function: H5F_use_tmp_space
1049 *
1050 * Purpose: Quick and dirty routine to determine if using temporary
1051 * file space is allowed for this file.
1052 * (Mainly added to stop non-file routines from poking about in the
1053 * H5F_t data structure)
1054 *
1055 * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
1056 *
1057 * Programmer: Quincey Koziol <koziol@hdfgroup.org>
1058 * July 1, 2009
1059 *
1060 *-------------------------------------------------------------------------
1061 */
1062 hbool_t
H5F_use_tmp_space(const H5F_t * f)1063 H5F_use_tmp_space(const H5F_t *f)
1064 {
1065 /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
1066 FUNC_ENTER_NOAPI_NOINIT_NOERR
1067
1068 HDassert(f);
1069 HDassert(f->shared);
1070
1071 FUNC_LEAVE_NOAPI(f->shared->use_tmp_space)
1072 } /* end H5F_use_tmp_space() */
1073
1074