1 /*
2  * Fork descriptor 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_FORK_DESCRIPTOR_H )
23 #define _LIBFSHFS_FORK_DESCRIPTOR_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "libfshfs_libcdata.h"
29 #include "libfshfs_libcerror.h"
30 
31 #if defined( __cplusplus )
32 extern "C" {
33 #endif
34 
35 typedef struct libfshfs_fork_descriptor libfshfs_fork_descriptor_t;
36 
37 struct libfshfs_fork_descriptor
38 {
39 	/* The (logical) size
40 	 */
41 	uint64_t size;
42 
43 	/* The number of blocks
44 	 */
45 	uint32_t number_of_blocks;
46 
47 	/* The extents
48 	 */
49 	uint32_t extents[ 8 ][ 2 ];
50 
51 	/* The number of blocks in the extents
52 	 */
53 	uint32_t number_of_blocks_in_extents;
54 };
55 
56 int libfshfs_fork_descriptor_initialize(
57      libfshfs_fork_descriptor_t **fork_descriptor,
58      libcerror_error_t **error );
59 
60 int libfshfs_fork_descriptor_free(
61      libfshfs_fork_descriptor_t **fork_descriptor,
62      libcerror_error_t **error );
63 
64 int libfshfs_fork_descriptor_clone(
65      libfshfs_fork_descriptor_t **destination_fork_descriptor,
66      libfshfs_fork_descriptor_t *source_fork_descriptor,
67      libcerror_error_t **error );
68 
69 int libfshfs_fork_descriptor_read_data(
70      libfshfs_fork_descriptor_t *fork_descriptor,
71      const uint8_t *data,
72      size_t data_size,
73      libcerror_error_t **error );
74 
75 int libfshfs_fork_descriptor_has_extents_overflow(
76      libfshfs_fork_descriptor_t *fork_descriptor,
77      libcerror_error_t **error );
78 
79 int libfshfs_fork_descriptor_get_extents(
80      libfshfs_fork_descriptor_t *fork_descriptor,
81      libcdata_array_t *extents,
82      libcerror_error_t **error );
83 
84 #if defined( __cplusplus )
85 }
86 #endif
87 
88 #endif /* !defined( _LIBFSHFS_FORK_DESCRIPTOR_H ) */
89 
90