1 /* 2 * B-tree file functions 3 * 4 * Copyright (C) 2009-2021, 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( _LIBFSHFS_BTREE_FILE_H ) 23 #define _LIBFSHFS_BTREE_FILE_H 24 25 #include <common.h> 26 #include <types.h> 27 28 #include "libfshfs_btree_header.h" 29 #include "libfshfs_btree_node.h" 30 #include "libfshfs_btree_node_vector.h" 31 #include "libfshfs_io_handle.h" 32 #include "libfshfs_libbfio.h" 33 #include "libfshfs_libcdata.h" 34 #include "libfshfs_libcerror.h" 35 #include "libfshfs_libfcache.h" 36 #include "libfshfs_libfdata.h" 37 38 #if defined( __cplusplus ) 39 extern "C" { 40 #endif 41 42 typedef struct libfshfs_btree_file libfshfs_btree_file_t; 43 44 struct libfshfs_btree_file 45 { 46 /* The size 47 */ 48 uint64_t size; 49 50 /* Extents 51 */ 52 libcdata_array_t *extents; 53 54 /* The header 55 */ 56 libfshfs_btree_header_t *header; 57 58 /* The nodes vector 59 */ 60 libfshfs_btree_node_vector_t *nodes_vector; 61 62 /* The nodes cache 63 */ 64 libfcache_cache_t *nodes_cache; 65 }; 66 67 int libfshfs_btree_file_initialize( 68 libfshfs_btree_file_t **btree_file, 69 libcerror_error_t **error ); 70 71 int libfshfs_btree_file_free( 72 libfshfs_btree_file_t **btree_file, 73 libcerror_error_t **error ); 74 75 int libfshfs_btree_file_read_file_io_handle( 76 libfshfs_btree_file_t *btree_file, 77 libfshfs_io_handle_t *io_handle, 78 libbfio_handle_t *file_io_handle, 79 libcerror_error_t **error ); 80 81 int libfshfs_btree_file_get_node_by_number( 82 libfshfs_btree_file_t *btree_file, 83 libbfio_handle_t *file_io_handle, 84 uint32_t node_number, 85 libfshfs_btree_node_t **node, 86 int recursion_depth, 87 libcerror_error_t **error ); 88 89 int libfshfs_btree_file_get_root_node( 90 libfshfs_btree_file_t *btree_file, 91 libbfio_handle_t *file_io_handle, 92 libfshfs_btree_node_t **root_node, 93 int recursion_depth, 94 libcerror_error_t **error ); 95 96 #if defined( __cplusplus ) 97 } 98 #endif 99 100 #endif /* !defined( _LIBFSHFS_BTREE_FILE_H ) */ 101 102