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: H5HFprivate.h 17 * Feb 24 2006 18 * Quincey Koziol <koziol@ncsa.uiuc.edu> 19 * 20 * Purpose: Private header for library accessible fractal heap routines. 21 * 22 *------------------------------------------------------------------------- 23 */ 24 25 #ifndef _H5HFprivate_H 26 #define _H5HFprivate_H 27 28 /* Include package's public header */ 29 #include "H5HFpublic.h" 30 31 /* Private headers needed by this file */ 32 #include "H5Fprivate.h" /* File access */ 33 #include "H5Oprivate.h" /* Object headers */ 34 35 /**************************/ 36 /* Library Private Macros */ 37 /**************************/ 38 39 /* Limit heap ID length to 4096 + 1, due to # of bits required to store 40 * length of 'tiny' objects (12 bits) 41 */ 42 #define H5HF_MAX_ID_LEN (4096 + 1) 43 44 45 /****************************/ 46 /* Library Private Typedefs */ 47 /****************************/ 48 49 /* Creation parameters for doubling-tables */ 50 typedef struct H5HF_dtable_cparam_t { 51 unsigned width; /* Number of columns in the table (must be power of 2) */ 52 size_t start_block_size; /* Starting block size for table (must be power of 2) */ 53 size_t max_direct_size; /* Maximum size of a direct block (must be power of 2) */ 54 unsigned max_index; /* Maximum ID/offset for table (integer log2 of actual value, ie. the # of bits required) */ 55 unsigned start_root_rows; /* Starting number of rows for root indirect block */ 56 /* 0 indicates to create the full indirect block for the root, 57 * right from the start. Doesn't have to be power of 2 58 */ 59 } H5HF_dtable_cparam_t; 60 61 /* Fractal heap creation parameters */ 62 typedef struct H5HF_create_t { 63 H5HF_dtable_cparam_t managed;/* Mapped object doubling-table creation parameters */ 64 hbool_t checksum_dblocks; /* Whether the direct blocks should be checksummed */ 65 uint32_t max_man_size; /* Max. size of object to manage in doubling table */ 66 /* (i.e. min. size of object to store standalone) */ 67 uint16_t id_len; /* Length of IDs to use for heap objects */ 68 /* (0 - make ID just large enough to hold length & offset of object in the heap) */ 69 /* (1 - make ID just large enough to allow 'huge' objects to be accessed directly) */ 70 /* (n - make ID 'n' bytes in size) */ 71 H5O_pline_t pline; /* I/O filter pipeline to apply to direct blocks & 'huge' objects */ 72 } H5HF_create_t; 73 74 /* Fractal heap metadata statistics info */ 75 typedef struct H5HF_stat_t { 76 /* 'Managed' object info */ 77 hsize_t man_size; /* Size of 'managed' space in heap */ 78 hsize_t man_alloc_size; /* Size of 'managed' space allocated in heap */ 79 hsize_t man_iter_off; /* Offset of "new block" iterator in 'managed' heap space */ 80 hsize_t man_free_space; /* Free space within 'managed' heap blocks */ 81 hsize_t man_nobjs; /* Number of 'managed' objects in heap */ 82 83 /* 'Huge' object info */ 84 hsize_t huge_size; /* Size of 'huge' objects in heap */ 85 hsize_t huge_nobjs; /* Number of 'huge' objects in heap */ 86 87 /* 'Tiny' object info */ 88 hsize_t tiny_size; /* Size of 'tiny' objects in heap */ 89 hsize_t tiny_nobjs; /* Number of 'tiny' objects in heap */ 90 } H5HF_stat_t; 91 92 /* Fractal heap info (forward decl - defined in H5HFpkg.h) */ 93 typedef struct H5HF_t H5HF_t; 94 95 /* Typedef for 'op' operations */ 96 typedef herr_t (*H5HF_operator_t)(const void *obj/*in*/, size_t obj_len, 97 void *op_data/*in,out*/); 98 99 /*****************************/ 100 /* Library-private Variables */ 101 /*****************************/ 102 103 104 /***************************************/ 105 /* Library-private Function Prototypes */ 106 /***************************************/ 107 108 /* General routines for fractal heap operations */ 109 H5_DLL H5HF_t *H5HF_create(H5F_t *f, const H5HF_create_t *cparam); 110 H5_DLL H5HF_t *H5HF_open(H5F_t *f, haddr_t fh_addr); 111 H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/); 112 H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/); 113 H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, 114 void *id/*out*/); 115 H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, const void *id, size_t *obj_len_p/*out*/); 116 H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p/*out*/); 117 H5_DLL herr_t H5HF_read(H5HF_t *fh, const void *id, void *obj/*out*/); 118 H5_DLL herr_t H5HF_write(H5HF_t *fh, void *id, hbool_t *id_changed, 119 const void *obj); 120 H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, 121 void *op_data); 122 H5_DLL herr_t H5HF_remove(H5HF_t *fh, const void *id); 123 H5_DLL herr_t H5HF_close(H5HF_t *fh); 124 H5_DLL herr_t H5HF_delete(H5F_t *f, haddr_t fh_addr); 125 126 /* Statistics routines */ 127 H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats); 128 H5_DLL herr_t H5HF_size(const H5HF_t *fh, hsize_t *heap_size/*out*/); 129 130 /* Debugging routines */ 131 H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, 132 int indent, int fwidth); 133 #ifdef H5HF_DEBUGGING 134 H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, 135 int fwidth); 136 #endif /* H5HF_DEBUGGING */ 137 138 #endif /* _H5HFprivate_H */ 139 140