HDF5  1.12.0
H5HLpkg.h
Go to the documentation of this file.
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@hdfgroup.org>
16  * Wednesday, July 9, 2003
17  *
18  * Purpose: This file contains declarations which are visible
19  * only within the H5HL package. Source files outside the
20  * H5HL package should include H5HLprivate.h instead.
21  */
22 #if !(defined H5HL_FRIEND || defined H5HL_MODULE)
23 #error "Do not include this file outside the H5HL package!"
24 #endif
25 
26 #ifndef _H5HLpkg_H
27 #define _H5HLpkg_H
28 
29 /* Get package's private header */
30 #include "H5HLprivate.h"
31 
32 /* Other private headers needed by this file */
33 #include "H5FLprivate.h" /* Free lists */
34 
35 
36 /*****************************/
37 /* Package Private Variables */
38 /*****************************/
39 
40 /* Declare extern the free list to manage the H5HL_free_t struct */
42 
43 /* Declare extern the PQ free list to manage the heap chunk information */
44 H5FL_BLK_EXTERN(lheap_chunk);
45 
46 
47 /**************************/
48 /* Package Private Macros */
49 /**************************/
50 
51 /* If this package header is being included in one of the H5HL source files,
52  * define the proper control macros for the generic FUNC_ENTER/LEAVE and
53  * error reporting macros.
54  */
55 #ifdef H5HL_PACKAGE
56 #define H5_MY_PKG H5HL
57 #define H5_MY_PKG_ERR H5E_HEAP
58 #define H5_MY_PKG_INIT NO
59 #endif /* H5HL_PACKAGE */
60 
61 #define H5HL_SIZEOF_HDR(F) \
62  H5HL_ALIGN(H5_SIZEOF_MAGIC + /* heap signature */ \
63  1 + /* version */ \
64  3 + /* reserved */ \
65  H5F_SIZEOF_SIZE(F) + /* data size */ \
66  H5F_SIZEOF_SIZE(F) + /* free list head */ \
67  H5F_SIZEOF_ADDR(F)) /* data address */
68 
69 /* Value indicating end of free list on disk */
70 #define H5HL_FREE_NULL 1
71 
72 
73 /****************************/
74 /* Package Private Typedefs */
75 /****************************/
76 
77 typedef struct H5HL_free_t {
78  size_t offset; /* offset of free block */
79  size_t size; /* size of free block */
80  struct H5HL_free_t *prev; /* previous entry in free list */
81  struct H5HL_free_t *next; /* next entry in free list */
83 
84 /* Forward declarations */
85 typedef struct H5HL_dblk_t H5HL_dblk_t;
86 typedef struct H5HL_prfx_t H5HL_prfx_t;
87 
88 struct H5HL_t {
89  /* General heap-management fields */
90  size_t rc; /* Ref. count for prefix & data block using this struct */
91  size_t prots; /* # of times the heap has been protected */
92  size_t sizeof_size; /* Size of file sizes */
93  size_t sizeof_addr; /* Size of file addresses */
94  hbool_t single_cache_obj; /* Indicate if the heap is a single object in the cache */
95  H5HL_free_t *freelist; /* the free list */
96 
97  /* Prefix-specific fields */
98  H5HL_prfx_t *prfx; /* The prefix object for the heap */
99  haddr_t prfx_addr; /* address of heap prefix */
100  size_t prfx_size; /* size of heap prefix */
101  hsize_t free_block; /* Address of first free block */
102 
103  /* Data block-specific fields */
104  H5HL_dblk_t *dblk; /* The data block object for the heap */
105  haddr_t dblk_addr; /* address of data block */
106  size_t dblk_size; /* size of heap data block on disk and in mem */
107  uint8_t *dblk_image; /* The data block image */
108 };
109 
110 /* Struct for heap data block */
111 struct H5HL_dblk_t {
112  H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
113  /* first field in structure */
114  H5HL_t *heap; /* Pointer to heap for data block */
115 };
116 
117 /* Struct for heap prefix */
118 struct H5HL_prfx_t {
119  H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
120  /* first field in structure */
121  H5HL_t *heap; /* Pointer to heap for prefix */
122 };
123 
124 /* Callback information for loading local heap prefix from disk */
125 typedef struct H5HL_cache_prfx_ud_t {
126  size_t sizeof_size; /* Size of file sizes */
127  size_t sizeof_addr; /* Size of file addresses */
128  haddr_t prfx_addr; /* Address of prefix */
129  size_t sizeof_prfx; /* Size of heap prefix */
131 
132 
133 /******************************/
134 /* Package Private Prototypes */
135 /******************************/
136 
137 /* Heap routines */
138 H5_DLL H5HL_t *H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size);
142 
143 /* Heap prefix routines */
146 
147 /* Heap data block routines */
150 H5_DLL herr_t H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size);
151 
152 #endif /* _H5HLpkg_H */
H5HL_cache_prfx_ud_t::prfx_addr
haddr_t prfx_addr
Definition: H5HLpkg.h:128
H5HL_dblk_t
Definition: H5HLpkg.h:111
H5HL_t::prfx_size
size_t prfx_size
Definition: H5HLpkg.h:100
H5HL_t::sizeof_size
size_t sizeof_size
Definition: H5HLpkg.h:92
H5HL_dblk_t::cache_info
H5AC_info_t cache_info
Definition: H5HLpkg.h:112
prfx
CATCH prfx
Definition: H5HLprfx.c:161
f
hdr f
Definition: H5EA.c:755
H5HL_t::prots
size_t prots
Definition: H5HLpkg.h:91
H5HL_t::prfx_addr
haddr_t prfx_addr
Definition: H5HLpkg.h:99
haddr_t
CATCH haddr_t
Definition: H5EAdblock.c:162
H5HL_t
Definition: H5HLpkg.h:88
H5HL__prfx_dest
H5_DLL herr_t H5HL__prfx_dest(H5HL_prfx_t *prfx)
H5HL_t::single_cache_obj
hbool_t single_cache_obj
Definition: H5HLpkg.h:94
H5HLprivate.h
H5HL__prfx_new
H5_DLL H5HL_prfx_t * H5HL__prfx_new(H5HL_t *heap)
H5HL_cache_prfx_ud_t::sizeof_size
size_t sizeof_size
Definition: H5HLpkg.h:126
uint8_t
unsigned char uint8_t
Definition: H5private.h:429
H5HL_t::dblk_addr
haddr_t dblk_addr
Definition: H5HLpkg.h:105
H5HL_cache_prfx_ud_t
struct H5HL_cache_prfx_ud_t H5HL_cache_prfx_ud_t
H5HL__inc_rc
H5_DLL herr_t H5HL__inc_rc(H5HL_t *heap)
H5HL_t::rc
size_t rc
Definition: H5HLpkg.h:90
H5HL_t::prfx
H5HL_prfx_t * prfx
Definition: H5HLpkg.h:98
H5HL__dblk_new
H5_DLL H5HL_dblk_t * H5HL__dblk_new(H5HL_t *heap)
H5HL_prfx_t::cache_info
H5AC_info_t cache_info
Definition: H5HLpkg.h:119
H5HL_t::freelist
H5HL_free_t * freelist
Definition: H5HLpkg.h:95
H5HL_t::sizeof_addr
size_t sizeof_addr
Definition: H5HLpkg.h:93
H5HL_cache_prfx_ud_t::sizeof_prfx
size_t sizeof_prfx
Definition: H5HLpkg.h:129
H5FL_EXTERN
H5FL_EXTERN(H5HL_free_t)
H5HL_prfx_t
Definition: H5HLpkg.h:118
H5HL_t::dblk_image
uint8_t * dblk_image
Definition: H5HLpkg.h:107
H5HL_free_t::size
size_t size
Definition: H5HLpkg.h:79
H5HL_prfx_t::heap
H5HL_t * heap
Definition: H5HLpkg.h:121
H5FL_BLK_EXTERN
H5FL_BLK_EXTERN(lheap_chunk)
H5HL_dblk_t::heap
H5HL_t * heap
Definition: H5HLpkg.h:114
H5HL__dblk_realloc
H5_DLL herr_t H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size)
H5HL_t::dblk_size
size_t dblk_size
Definition: H5HLpkg.h:106
H5HL_t::free_block
hsize_t free_block
Definition: H5HLpkg.h:101
H5HL_free_t::prev
struct H5HL_free_t * prev
Definition: H5HLpkg.h:80
H5_DLL
#define H5_DLL
Definition: H5api_adpt.h:234
dblk
CATCH dblk
Definition: H5HLdblk.c:162
H5HL__new
H5_DLL H5HL_t * H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
heap
CATCH unable to release unprotect heap
Definition: H5HLdbg.c:119
H5HL_free_t::offset
size_t offset
Definition: H5HLpkg.h:78
H5HL__dest
H5_DLL herr_t H5HL__dest(H5HL_t *heap)
H5HL_cache_prfx_ud_t::sizeof_addr
size_t sizeof_addr
Definition: H5HLpkg.h:127
H5F_t
Definition: H5Fpkg.h:374
H5HL_free_t
struct H5HL_free_t H5HL_free_t
H5HL__dblk_dest
H5_DLL herr_t H5HL__dblk_dest(H5HL_dblk_t *dblk)
H5FLprivate.h
herr_t
int herr_t
Definition: H5public.h:128
H5HL_t::dblk
H5HL_dblk_t * dblk
Definition: H5HLpkg.h:104
hbool_t
bool hbool_t
Definition: H5public.h:159
H5HL_cache_prfx_ud_t
Definition: H5HLpkg.h:125
H5C_cache_entry_t
Definition: H5Cprivate.h:1597
hsize_t
hsize_t
Definition: H5overflow.txt:44
H5HL_free_t
Definition: H5HLpkg.h:77
H5HL__dec_rc
H5_DLL herr_t H5HL__dec_rc(H5HL_t *heap)
H5HL_free_t::next
struct H5HL_free_t * next
Definition: H5HLpkg.h:81