MISR Toolkit  1.5.1
H5MPpkg.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@ncsa.uiuc.edu>
16  * Monday, May 2, 2005
17  *
18  * Purpose: This file contains declarations which are visible only within
19  * the H5MP package. Source files outside the H5MP package should
20  * include H5MPprivate.h instead.
21  */
22 #ifndef H5MP_PACKAGE
23 #error "Do not include this file outside the H5MP package!"
24 #endif
25 
26 #ifndef _H5MPpkg_H
27 #define _H5MPpkg_H
28 
29 /* Get package's private header */
30 #include "H5MPprivate.h" /* Memory Pools */
31 
32 /* Other private headers needed by this file */
33 #include "H5FLprivate.h" /* Free Lists */
34 
35 /**************************/
36 /* Package Private Macros */
37 /**************************/
38 
39 /* Alignment macros */
40 /* (Ideas from Apache APR :-) */
41 
42 /* Default alignment necessary */
43 #define H5MP_BLOCK_ALIGNMENT 8
44 
45 /* General alignment macro */
46 /* (this only works for aligning to power of 2 boundary) */
47 #define H5MP_ALIGN(x, a) \
48  (((x) + ((size_t)(a)) - 1) & ~(((size_t)(a)) - 1))
49 
50 /* Default alignment */
51 #define H5MP_BLOCK_ALIGN(x) H5MP_ALIGN(x, H5MP_BLOCK_ALIGNMENT)
52 
53 
54 /****************************/
55 /* Package Private Typedefs */
56 /****************************/
57 
58 /* Free block in pool */
59 typedef struct H5MP_page_blk_t {
60  size_t size; /* Size of block (includes this H5MP_page_blk_t info) */
61  unsigned is_free:1; /* Flag to indicate the block is free */
62  struct H5MP_page_t *page; /* Pointer to page block is located in */
63  struct H5MP_page_blk_t *prev; /* Pointer to previous block in page */
64  struct H5MP_page_blk_t *next; /* Pointer to next block in page */
66 
67 /* Memory pool page */
68 typedef struct H5MP_page_t {
69  size_t free_size; /* Total amount of free space in page */
70  unsigned fac_alloc:1; /* Flag to indicate the page was allocated by the pool's factory */
71  H5MP_page_blk_t *free_blk; /* Pointer to first free block in page */
72  struct H5MP_page_t *next; /* Pointer to next page in pool */
73  struct H5MP_page_t *prev; /* Pointer to previous page in pool */
74 } H5MP_page_t;
75 
76 /* Memory pool header */
77 struct H5MP_pool_t {
78  H5FL_fac_head_t *page_fac; /* Free-list factory for pages */
79  size_t page_size; /* Page size for pool */
80  size_t free_size; /* Total amount of free space in pool */
81  size_t max_size; /* Maximum block that will fit in a standard page */
82  H5MP_page_t *first; /* Pointer to first page in pool */
83  unsigned flags; /* Bit flags for pool settings */
84 };
85 
86 
87 /*****************************************/
88 /* Package Private Variable Declarations */
89 /*****************************************/
90 
91 
92 /******************************/
93 /* Package Private Prototypes */
94 /******************************/
95 #ifdef H5MP_TESTING
96 H5_DLL herr_t H5MP_get_pool_free_size (const H5MP_pool_t *mp, size_t *free_size);
97 H5_DLL htri_t H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp);
98 H5_DLL herr_t H5MP_get_pool_first_page(const H5MP_pool_t *mp, H5MP_page_t **page);
99 H5_DLL herr_t H5MP_get_page_free_size(const H5MP_page_t *mp, size_t *page);
100 H5_DLL herr_t H5MP_get_page_next_page(const H5MP_page_t *page, H5MP_page_t **next_page);
101 #endif /* H5MP_TESTING */
102 
103 #endif /* _H5MPpkg_H */
104 
unsigned fac_alloc
Definition: H5MPpkg.h:70
unsigned is_free
Definition: H5MPpkg.h:61
size_t free_size
Definition: H5MPpkg.h:80
H5MP_page_t * first
Definition: H5MPpkg.h:82
struct H5MP_page_t * prev
Definition: H5MPpkg.h:73
H5MP_page_blk_t * free_blk
Definition: H5MPpkg.h:71
size_t max_size
Definition: H5MPpkg.h:81
#define H5_DLL
Definition: H5api_adpt.h:256
int herr_t
Definition: H5public.h:124
struct H5MP_page_t * next
Definition: H5MPpkg.h:72
struct H5MP_page_t H5MP_page_t
struct H5MP_page_blk_t H5MP_page_blk_t
unsigned flags
Definition: H5MPpkg.h:83
size_t page_size
Definition: H5MPpkg.h:79
struct H5MP_page_blk_t * prev
Definition: H5MPpkg.h:63
size_t size
Definition: H5MPpkg.h:60
H5FL_fac_head_t * page_fac
Definition: H5MPpkg.h:78
size_t free_size
Definition: H5MPpkg.h:69
struct H5MP_page_t * page
Definition: H5MPpkg.h:62
int htri_t
Definition: H5public.h:143
struct H5MP_page_blk_t * next
Definition: H5MPpkg.h:64

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52