| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#if !defined( _LIBBFIO_POOL_H ) |
| 23 |
#define _LIBBFIO_POOL_H |
| 24 |
|
| 25 |
#include <common.h> |
| 26 |
#include <types.h> |
| 27 |
|
| 28 |
#include "libbfio_extern.h" |
| 29 |
#include "libbfio_libcdata.h" |
| 30 |
#include "libbfio_libcerror.h" |
| 31 |
#include "libbfio_libcthreads.h" |
| 32 |
#include "libbfio_types.h" |
| 33 |
|
| 34 |
#if defined( __cplusplus ) |
| 35 |
extern "C" { |
| 36 |
#endif |
| 37 |
|
| 38 |
typedef struct libbfio_internal_pool libbfio_internal_pool_t; |
| 39 |
|
| 40 |
struct libbfio_internal_pool |
| 41 |
{ |
| 42 |
|
| 43 |
|
| 44 |
int number_of_used_handles; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
int number_of_open_handles; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
int maximum_number_of_open_handles; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
libcdata_array_t *handles_array; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
int current_entry; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
libbfio_handle_t *current_handle; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
libcdata_list_t *last_used_list; |
| 71 |
|
| 72 |
#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBBFIO ) |
| 73 |
|
| 74 |
|
| 75 |
libcthreads_read_write_lock_t *read_write_lock; |
| 76 |
#endif |
| 77 |
}; |
| 78 |
|
| 79 |
LIBBFIO_EXTERN \ |
| 80 |
int libbfio_pool_initialize( |
| 81 |
libbfio_pool_t **pool, |
| 82 |
int number_of_handles, |
| 83 |
int maximum_number_of_open_handles, |
| 84 |
libcerror_error_t **error ); |
| 85 |
|
| 86 |
LIBBFIO_EXTERN \ |
| 87 |
int libbfio_pool_free( |
| 88 |
libbfio_pool_t **pool, |
| 89 |
libcerror_error_t **error ); |
| 90 |
|
| 91 |
LIBBFIO_EXTERN \ |
| 92 |
int libbfio_pool_clone( |
| 93 |
libbfio_pool_t **destination_pool, |
| 94 |
libbfio_pool_t *source_pool, |
| 95 |
libcerror_error_t **error ); |
| 96 |
|
| 97 |
LIBBFIO_EXTERN \ |
| 98 |
int libbfio_pool_resize( |
| 99 |
libbfio_pool_t *pool, |
| 100 |
int number_of_handles, |
| 101 |
libcerror_error_t **error ); |
| 102 |
|
| 103 |
int libbfio_internal_pool_open_handle( |
| 104 |
libbfio_internal_pool_t *internal_pool, |
| 105 |
libbfio_handle_t *handle, |
| 106 |
int access_flags, |
| 107 |
libcerror_error_t **error ); |
| 108 |
|
| 109 |
int libbfio_internal_pool_append_handle_to_last_used_list( |
| 110 |
libbfio_internal_pool_t *internal_pool, |
| 111 |
const libbfio_handle_t *handle, |
| 112 |
libcerror_error_t **error ); |
| 113 |
|
| 114 |
int libbfio_internal_pool_move_handle_to_front_of_last_used_list( |
| 115 |
libbfio_internal_pool_t *internal_pool, |
| 116 |
libbfio_handle_t *handle, |
| 117 |
libcerror_error_t **error ); |
| 118 |
|
| 119 |
int libbfio_internal_pool_remove_handle_from_last_used_list( |
| 120 |
libbfio_internal_pool_t *internal_pool, |
| 121 |
const libbfio_handle_t *handle, |
| 122 |
libcerror_error_t **error ); |
| 123 |
|
| 124 |
LIBBFIO_EXTERN \ |
| 125 |
int libbfio_pool_get_number_of_handles( |
| 126 |
libbfio_pool_t *pool, |
| 127 |
int *number_of_handles, |
| 128 |
libcerror_error_t **error ); |
| 129 |
|
| 130 |
LIBBFIO_EXTERN \ |
| 131 |
int libbfio_pool_get_handle( |
| 132 |
libbfio_pool_t *pool, |
| 133 |
int entry, |
| 134 |
libbfio_handle_t **handle, |
| 135 |
libcerror_error_t **error ); |
| 136 |
|
| 137 |
LIBBFIO_EXTERN \ |
| 138 |
int libbfio_pool_append_handle( |
| 139 |
libbfio_pool_t *pool, |
| 140 |
int *entry, |
| 141 |
libbfio_handle_t *handle, |
| 142 |
int access_flags, |
| 143 |
libcerror_error_t **error ); |
| 144 |
|
| 145 |
LIBBFIO_EXTERN \ |
| 146 |
int libbfio_pool_set_handle( |
| 147 |
libbfio_pool_t *pool, |
| 148 |
int entry, |
| 149 |
libbfio_handle_t *handle, |
| 150 |
int access_flags, |
| 151 |
libcerror_error_t **error ); |
| 152 |
|
| 153 |
LIBBFIO_EXTERN \ |
| 154 |
int libbfio_pool_remove_handle( |
| 155 |
libbfio_pool_t *pool, |
| 156 |
int entry, |
| 157 |
libbfio_handle_t **handle, |
| 158 |
libcerror_error_t **error ); |
| 159 |
|
| 160 |
LIBBFIO_EXTERN \ |
| 161 |
int libbfio_pool_get_maximum_number_of_open_handles( |
| 162 |
libbfio_pool_t *pool, |
| 163 |
int *maximum_number_of_open_handles, |
| 164 |
libcerror_error_t **error ); |
| 165 |
|
| 166 |
LIBBFIO_EXTERN \ |
| 167 |
int libbfio_pool_set_maximum_number_of_open_handles( |
| 168 |
libbfio_pool_t *pool, |
| 169 |
int maximum_number_of_open_handles, |
| 170 |
libcerror_error_t **error ); |
| 171 |
|
| 172 |
int libbfio_internal_pool_open( |
| 173 |
libbfio_internal_pool_t *internal_pool, |
| 174 |
int entry, |
| 175 |
int access_flags, |
| 176 |
libcerror_error_t **error ); |
| 177 |
|
| 178 |
LIBBFIO_EXTERN \ |
| 179 |
int libbfio_pool_open( |
| 180 |
libbfio_pool_t *pool, |
| 181 |
int entry, |
| 182 |
int access_flags, |
| 183 |
libcerror_error_t **error ); |
| 184 |
|
| 185 |
LIBBFIO_EXTERN \ |
| 186 |
int libbfio_pool_reopen( |
| 187 |
libbfio_pool_t *pool, |
| 188 |
int entry, |
| 189 |
int access_flags, |
| 190 |
libcerror_error_t **error ); |
| 191 |
|
| 192 |
int libbfio_internal_pool_close( |
| 193 |
libbfio_internal_pool_t *internal_pool, |
| 194 |
int entry, |
| 195 |
libcerror_error_t **error ); |
| 196 |
|
| 197 |
LIBBFIO_EXTERN \ |
| 198 |
int libbfio_pool_close( |
| 199 |
libbfio_pool_t *pool, |
| 200 |
int entry, |
| 201 |
libcerror_error_t **error ); |
| 202 |
|
| 203 |
LIBBFIO_EXTERN \ |
| 204 |
int libbfio_pool_close_all( |
| 205 |
libbfio_pool_t *pool, |
| 206 |
libcerror_error_t **error ); |
| 207 |
|
| 208 |
int libbfio_internal_pool_get_open_handle( |
| 209 |
libbfio_internal_pool_t *internal_pool, |
| 210 |
int entry, |
| 211 |
libbfio_handle_t **handle, |
| 212 |
libcerror_error_t **error ); |
| 213 |
|
| 214 |
LIBBFIO_EXTERN \ |
| 215 |
ssize_t libbfio_pool_read_buffer( |
| 216 |
libbfio_pool_t *pool, |
| 217 |
int entry, |
| 218 |
uint8_t *buffer, |
| 219 |
size_t size, |
| 220 |
libcerror_error_t **error ); |
| 221 |
|
| 222 |
LIBBFIO_EXTERN \ |
| 223 |
ssize_t libbfio_pool_read_buffer_at_offset( |
| 224 |
libbfio_pool_t *pool, |
| 225 |
int entry, |
| 226 |
uint8_t *buffer, |
| 227 |
size_t size, |
| 228 |
off64_t offset, |
| 229 |
libcerror_error_t **error ); |
| 230 |
|
| 231 |
LIBBFIO_EXTERN \ |
| 232 |
ssize_t libbfio_pool_write_buffer( |
| 233 |
libbfio_pool_t *pool, |
| 234 |
int entry, |
| 235 |
const uint8_t *buffer, |
| 236 |
size_t size, |
| 237 |
libcerror_error_t **error ); |
| 238 |
|
| 239 |
LIBBFIO_EXTERN \ |
| 240 |
ssize_t libbfio_pool_write_buffer_at_offset( |
| 241 |
libbfio_pool_t *pool, |
| 242 |
int entry, |
| 243 |
const uint8_t *buffer, |
| 244 |
size_t size, |
| 245 |
off64_t offset, |
| 246 |
libcerror_error_t **error ); |
| 247 |
|
| 248 |
LIBBFIO_EXTERN \ |
| 249 |
off64_t libbfio_pool_seek_offset( |
| 250 |
libbfio_pool_t *pool, |
| 251 |
int entry, |
| 252 |
off64_t offset, |
| 253 |
int whence, |
| 254 |
libcerror_error_t **error ); |
| 255 |
|
| 256 |
LIBBFIO_EXTERN \ |
| 257 |
int libbfio_pool_get_offset( |
| 258 |
libbfio_pool_t *pool, |
| 259 |
int entry, |
| 260 |
off64_t *offset, |
| 261 |
libcerror_error_t **error ); |
| 262 |
|
| 263 |
LIBBFIO_EXTERN \ |
| 264 |
int libbfio_pool_get_size( |
| 265 |
libbfio_pool_t *pool, |
| 266 |
int entry, |
| 267 |
size64_t *size, |
| 268 |
libcerror_error_t **error ); |
| 269 |
|
| 270 |
#if defined( __cplusplus ) |
| 271 |
} |
| 272 |
#endif |
| 273 |
|
| 274 |
#endif |
| 275 |
|