1 /* 2 * The internal definitions 3 * 4 * Copyright (C) 2010-2020, Joachim Metz <joachim.metz@gmail.com> 5 * 6 * Refer to AUTHORS for acknowledgements. 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with this program. If not, see <https://www.gnu.org/licenses/>. 20 */ 21 22 #if !defined( _LIBFDATA_INTERNAL_DEFINITIONS_H ) 23 #define _LIBFDATA_INTERNAL_DEFINITIONS_H 24 25 #include <common.h> 26 27 /* Define HAVE_LOCAL_LIBFDATA for local use of libfdata 28 */ 29 #if !defined( HAVE_LOCAL_LIBFDATA ) 30 #include <libfdata/definitions.h> 31 32 /* The definitions in <libfdata/definitions.h> are copied here 33 * for local use of libfdata 34 */ 35 #else 36 #define LIBFDATA_VERSION 20201129 37 38 /* The libfdata version string 39 */ 40 #define LIBFDATA_VERSION_STRING "20201129" 41 42 /* The library flag definitions 43 */ 44 enum LIBFDATA_FLAGS 45 { 46 /* The data is not managed by the library 47 */ 48 LIBFDATA_FLAG_DATA_NON_MANAGED = 0x00, 49 50 /* The data is managed by the library 51 */ 52 LIBFDATA_FLAG_DATA_MANAGED = 0x01, 53 54 /* The mapped ranges need to be calculated 55 */ 56 LIBFDATA_FLAG_CALCULATE_MAPPED_RANGES = 0x80 57 }; 58 59 /* The area element value flag definitions 60 */ 61 enum LIBFDATA_AREA_ELEMENT_VALUE_FLAGS 62 { 63 LIBFDATA_AREA_ELEMENT_VALUE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 64 LIBFDATA_AREA_ELEMENT_VALUE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 65 }; 66 67 /* The balanced tree leaf value flag definitions 68 */ 69 enum LIBFDATA_BTREE_LEAF_VALUE_FLAGS 70 { 71 LIBFDATA_BTREE_LEAF_VALUE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 72 LIBFDATA_BTREE_LEAF_VALUE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 73 }; 74 75 /* The data handle flag definitions 76 */ 77 enum LIBFDATA_DATA_HANDLE_FLAGS 78 { 79 LIBFDATA_DATA_HANDLE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 80 LIBFDATA_DATA_HANDLE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 81 }; 82 83 /* The key value flag definitions 84 */ 85 enum LIBFDATA_KEY_VALUE_FLAGS 86 { 87 LIBFDATA_KEY_VALUE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 88 LIBFDATA_KEY_VALUE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 89 }; 90 91 /* The list element value flag definitions 92 */ 93 enum LIBFDATA_LIST_ELEMENT_VALUE_FLAGS 94 { 95 LIBFDATA_LIST_ELEMENT_VALUE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 96 LIBFDATA_LIST_ELEMENT_VALUE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 97 }; 98 99 /* The range list value flag definitions 100 */ 101 enum LIBFDATA_RANGE_LIST_VALUE_FLAGS 102 { 103 LIBFDATA_RANGE_LIST_VALUE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 104 LIBFDATA_RANGE_LIST_VALUE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 105 }; 106 107 /* The tree node value flag definitions 108 */ 109 enum LIBFDATA_TREE_NODE_VALUE_FLAGS 110 { 111 LIBFDATA_TREE_NODE_VALUE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 112 LIBFDATA_TREE_NODE_VALUE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 113 }; 114 115 /* The vector element value flag definitions 116 */ 117 enum LIBFDATA_VECTOR_ELEMENT_VALUE_FLAGS 118 { 119 LIBFDATA_VECTOR_ELEMENT_VALUE_FLAG_NON_MANAGED = LIBFDATA_FLAG_DATA_NON_MANAGED, 120 LIBFDATA_VECTOR_ELEMENT_VALUE_FLAG_MANAGED = LIBFDATA_FLAG_DATA_MANAGED 121 }; 122 123 /* The comparison function definitions 124 */ 125 enum LIBFDATA_COMPARE_DEFINITIONS 126 { 127 /* The first value is less than the second value 128 */ 129 LIBFDATA_COMPARE_LESS, 130 131 /* The first value is less equal than the second value 132 */ 133 LIBFDATA_COMPARE_LESS_EQUAL, 134 135 /* The first and second values are equal 136 */ 137 LIBFDATA_COMPARE_EQUAL, 138 139 /* The first value is greater than the second value 140 */ 141 LIBFDATA_COMPARE_GREATER, 142 143 /* The first value is greater equal than the second value 144 */ 145 LIBFDATA_COMPARE_GREATER_EQUAL 146 }; 147 148 /* The range flag definitions 149 */ 150 enum LIBFDATA_RANGE_FLAGS 151 { 152 /* The range is sparse 153 */ 154 LIBFDATA_RANGE_FLAG_IS_SPARSE = 0x00000001UL, 155 156 /* The range is compressed 157 */ 158 LIBFDATA_RANGE_FLAG_IS_COMPRESSED = 0x00000002UL, 159 160 /* User defined flags 161 */ 162 LIBFDATA_RANGE_FLAG_USER_DEFINED_1 = 0x00000100UL, 163 LIBFDATA_RANGE_FLAG_USER_DEFINED_2 = 0x00000200UL, 164 LIBFDATA_RANGE_FLAG_USER_DEFINED_3 = 0x00000400UL, 165 LIBFDATA_RANGE_FLAG_USER_DEFINED_4 = 0x00000800UL, 166 LIBFDATA_RANGE_FLAG_USER_DEFINED_5 = 0x00001000UL, 167 LIBFDATA_RANGE_FLAG_USER_DEFINED_6 = 0x00002000UL, 168 LIBFDATA_RANGE_FLAG_USER_DEFINED_7 = 0x00004000UL, 169 LIBFDATA_RANGE_FLAG_USER_DEFINED_8 = 0x00008000UL, 170 }; 171 172 #define LIBFDATA_RANGE_FLAG_MAXIMUM \ 173 LIBFDATA_RANGE_FLAG_USER_DEFINED_8 174 175 /* The read flag definitions 176 */ 177 enum LIBFDATA_READ_FLAGS 178 { 179 /* Flag to indicate cached data should be ignored 180 */ 181 LIBFDATA_READ_FLAG_IGNORE_CACHE = 0x01, 182 183 /* Internal flag to indicate data should not be cached 184 */ 185 LIBFDATA_READ_FLAG_NO_CACHE = 0x80 186 }; 187 188 /* The tree node flag definitions 189 */ 190 enum LIBFDATA_TREE_NODE_FLAGS 191 { 192 /* The node is a leaf 193 */ 194 LIBFDATA_TREE_NODE_FLAG_IS_LEAF = 0x02, 195 196 /* The node is virtual 197 */ 198 LIBFDATA_TREE_NODE_FLAG_IS_VIRTUAL = 0x04, 199 200 /* The node is deleted 201 */ 202 LIBFDATA_TREE_NODE_FLAG_IS_DELETED = 0x08, 203 204 /* The sub nodes data range was set 205 */ 206 LIBFDATA_TREE_NODE_FLAG_SUB_NODES_DATA_RANGE_SET = 0x10, 207 208 /* The sub nodes have been read 209 */ 210 LIBFDATA_TREE_NODE_FLAG_SUB_NODES_READ = 0x20, 211 212 /* The node data has been read (at least once) 213 */ 214 LIBFDATA_TREE_NODE_FLAG_NOTE_DATA_READ = 0x40 215 }; 216 217 /* The tree node insert flag definitions 218 */ 219 enum LIBFDATA_TREE_NODE_INSERT_FLAGS 220 { 221 /* Allow duplicate sub node values 222 */ 223 LIBFDATA_TREE_NODE_INSERT_FLAG_NON_UNIQUE_SUB_NODE_VALUES = 0x00, 224 225 /* Only allow unique sub node values, no duplicates 226 */ 227 LIBFDATA_TREE_NODE_INSERT_FLAG_UNIQUE_SUB_NODE_VALUES = 0x01 228 }; 229 230 #endif /* !defined( HAVE_LOCAL_LIBFDATA ) */ 231 232 #define LIBFDATA_BTREE_NODE_LEVEL_UNLIMITED -1 233 234 /* The list flag definitions 235 */ 236 enum LIBFDATA_LIST_FLAGS 237 { 238 LIBFDATA_LIST_FLAG_HAS_MAPPED_OFFSET = 0x10 239 }; 240 241 /* The list element flag definitions 242 */ 243 enum LIBFDATA_LIST_ELEMENT_FLAGS 244 { 245 LIBFDATA_LIST_ELEMENT_FLAG_HAS_MAPPED_SIZE = 0x10 246 }; 247 248 #endif /* !defined( _LIBFDATA_INTERNAL_DEFINITIONS_H ) */ 249 250