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 files COPYING and Copyright.html. COPYING can be found at the root * |
---|
9 | * of the source code distribution tree; Copyright.html can be found at the * |
---|
10 | * root level of an installed copy of the electronic HDF5 document set and * |
---|
11 | * is linked from the top-level documents page. It can also be found at * |
---|
12 | * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * |
---|
13 | * access to either file, you may request a copy from help@hdfgroup.org. * |
---|
14 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
---|
15 | |
---|
16 | /* |
---|
17 | * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> |
---|
18 | * Wednesday, July 9, 2003 |
---|
19 | * |
---|
20 | * Purpose: This file contains declarations which are visible |
---|
21 | * only within the H5HG package. Source files outside the |
---|
22 | * H5HG package should include H5HGprivate.h instead. |
---|
23 | */ |
---|
24 | #ifndef H5HG_PACKAGE |
---|
25 | #error "Do not include this file outside the H5HG package!" |
---|
26 | #endif |
---|
27 | |
---|
28 | #ifndef _H5HGpkg_H |
---|
29 | #define _H5HGpkg_H |
---|
30 | |
---|
31 | /* Get package's private header */ |
---|
32 | #include "H5HGprivate.h" |
---|
33 | |
---|
34 | /* Other private headers needed by this file */ |
---|
35 | |
---|
36 | /*****************************/ |
---|
37 | /* Package Private Variables */ |
---|
38 | /*****************************/ |
---|
39 | |
---|
40 | /* The cache subclass */ |
---|
41 | H5_DLLVAR const H5AC_class_t H5AC_GHEAP[1]; |
---|
42 | |
---|
43 | /**************************/ |
---|
44 | /* Package Private Macros */ |
---|
45 | /**************************/ |
---|
46 | |
---|
47 | /* |
---|
48 | * Pad all global heap messages to a multiple of eight bytes so we can load |
---|
49 | * the entire collection into memory and operate on it there. Eight should |
---|
50 | * be sufficient for machines that have alignment constraints because our |
---|
51 | * largest data type is eight bytes. |
---|
52 | */ |
---|
53 | #define H5HG_ALIGNMENT 8 |
---|
54 | #define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ |
---|
55 | H5HG_ALIGNMENT)) |
---|
56 | #define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) |
---|
57 | |
---|
58 | /* |
---|
59 | * The overhead associated with each object in the heap, always a multiple of |
---|
60 | * the alignment so that the stuff that follows the header is aligned. |
---|
61 | */ |
---|
62 | #define H5HG_SIZEOF_OBJHDR(f) \ |
---|
63 | H5HG_ALIGN(2 + /*object id number */ \ |
---|
64 | 2 + /*reference count */ \ |
---|
65 | 4 + /*reserved */ \ |
---|
66 | H5F_SIZEOF_SIZE(f)) /*object data size */ |
---|
67 | |
---|
68 | /****************************/ |
---|
69 | /* Package Private Typedefs */ |
---|
70 | /****************************/ |
---|
71 | |
---|
72 | typedef struct H5HG_obj_t { |
---|
73 | int nrefs; /*reference count */ |
---|
74 | size_t size; /*total size of object */ |
---|
75 | uint8_t *begin; /*ptr to object into heap->chunk*/ |
---|
76 | } H5HG_obj_t; |
---|
77 | |
---|
78 | struct H5HG_heap_t { |
---|
79 | H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ |
---|
80 | /* first field in structure */ |
---|
81 | haddr_t addr; /*collection address */ |
---|
82 | size_t size; /*total size of collection */ |
---|
83 | uint8_t *chunk; /*the collection, incl. header */ |
---|
84 | size_t nalloc; /*numb object slots allocated */ |
---|
85 | size_t nused; /*number of slots used */ |
---|
86 | /* If this value is >65535 then all indices */ |
---|
87 | /* have been used at some time and the */ |
---|
88 | /* correct new index should be searched for */ |
---|
89 | H5HG_obj_t *obj; /*array of object descriptions */ |
---|
90 | }; |
---|
91 | |
---|
92 | /******************************/ |
---|
93 | /* Package Private Prototypes */ |
---|
94 | /******************************/ |
---|
95 | |
---|
96 | #endif |
---|
97 | |
---|