LIBBFIO(3)

NAME
libbfio.h - Library to support (abstracted) basic file input/output (IO)

SYNOPSIS
#include <libbfio.h>

Support functions
const char *
libbfio_get_version(
void
);
int
libbfio_get_codepage(
int *codepage
, libbfio_error_t **error
);
int
libbfio_set_codepage(
int codepage
, libbfio_error_t **error
);

Error functions
void
libbfio_error_free(
libbfio_error_t **error
);
int
libbfio_error_fprint(
libbfio_error_t *error
, FILE *stream
);
int
libbfio_error_sprint(
libbfio_error_t *error
, char *string
, size_t size
);
int
libbfio_error_backtrace_fprint(
libbfio_error_t *error
, FILE *stream
);
int
libbfio_error_backtrace_sprint(
libbfio_error_t *error
, char *string
, size_t size
);

Handle functions
int
libbfio_handle_initialize(
libbfio_handle_t **handle
, intptr_t *io_handle
, int (*free_io_handle)( intptr_t **io_handle, libbfio_error_t **error )
, int (*clone_io_handle)( intptr_t **destination_io_handle, intptr_t *source_io_handle, libbfio_error_t **error )
, int (*open)( intptr_t *io_handle, int access_flags, libbfio_error_t **error )
, int (*close)( intptr_t *io_handle, libbfio_error_t **error )
, ssize_t (*read)( intptr_t *io_handle, uint8_t *buffer, size_t size, libbfio_error_t **error )
, ssize_t (*write)( intptr_t *io_handle, const uint8_t *buffer, size_t size, libbfio_error_t **error )
, off64_t (*seek_offset)( intptr_t *io_handle, off64_t offset, int whence, libbfio_error_t **error )
, int (*exists)( intptr_t *io_handle, libbfio_error_t **error )
, int (*is_open)( intptr_t *io_handle, libbfio_error_t **error )
, int (*get_size)( intptr_t *io_handle, size64_t *size, libbfio_error_t **error )
, uint8_t flags
, libbfio_error_t **error
);
int
libbfio_handle_free(
libbfio_handle_t **handle
, libbfio_error_t **error
);
int
libbfio_handle_clone(
libbfio_handle_t **destination_handle
, libbfio_handle_t *source_handle
, libbfio_error_t **error
);
int
libbfio_handle_open(
libbfio_handle_t *handle
, int access_flags
, libbfio_error_t **error
);
int
libbfio_handle_reopen(
libbfio_handle_t *handle
, int access_flags
, libbfio_error_t **error
);
int
libbfio_handle_close(
libbfio_handle_t *handle
, libbfio_error_t **error
);
ssize_t
libbfio_handle_read_buffer(
libbfio_handle_t *handle
, uint8_t *buffer
, size_t size
, libbfio_error_t **error
);
ssize_t
libbfio_handle_read_buffer_at_offset(
libbfio_handle_t *handle
, uint8_t *buffer
, size_t size
, off64_t offset
, libbfio_error_t **error
);
ssize_t
libbfio_handle_write_buffer(
libbfio_handle_t *handle
, const uint8_t *buffer
, size_t size
, libbfio_error_t **error
);
ssize_t
libbfio_handle_write_buffer_at_offset(
libbfio_handle_t *handle
, const uint8_t *buffer
, size_t size
, off64_t offset
, libbfio_error_t **error
);
off64_t
libbfio_handle_seek_offset(
libbfio_handle_t *handle
, off64_t offset
, int whence
, libbfio_error_t **error
);
int
libbfio_handle_exists(
libbfio_handle_t *handle
, libbfio_error_t **error
);
int
libbfio_handle_is_open(
libbfio_handle_t *handle
, libbfio_error_t **error
);
int
libbfio_handle_get_io_handle(
libbfio_handle_t *handle
, intptr_t **io_handle
, libbfio_error_t **error
);
int
libbfio_handle_get_access_flags(
libbfio_handle_t *handle
, int *access_flags
, libbfio_error_t **error
);
int
libbfio_handle_set_access_flags(
libbfio_handle_t *handle
, int access_flags
, libbfio_error_t **error
);
int
libbfio_handle_get_offset(
libbfio_handle_t *handle
, off64_t *offset
, libbfio_error_t **error
);
int
libbfio_handle_get_size(
libbfio_handle_t *handle
, size64_t *size
, libbfio_error_t **error
);
int
libbfio_handle_set_open_on_demand(
libbfio_handle_t *handle
, uint8_t open_on_demand
, libbfio_error_t **error
);
int
libbfio_handle_set_track_offsets_read(
libbfio_handle_t *handle
, uint8_t track_offsets_read
, libbfio_error_t **error
);
int
libbfio_handle_get_number_of_offsets_read(
libbfio_handle_t *handle
, int *number_of_read_offsets
, libbfio_error_t **error
);
int
libbfio_handle_get_offset_read(
libbfio_handle_t *handle
, int index
, off64_t *offset
, size64_t *size
, libbfio_error_t **error
);

File functions
int
libbfio_file_initialize(
libbfio_handle_t **handle
, libbfio_error_t **error
);
int
libbfio_file_get_name_size(
libbfio_handle_t *handle
, size_t *name_size
, libbfio_error_t **error
);
int
libbfio_file_get_name(
libbfio_handle_t *handle
, char *name
, size_t name_size
, libbfio_error_t **error
);
int
libbfio_file_set_name(
libbfio_handle_t *handle
, const char *name
, size_t name_length
, libbfio_error_t **error
);

Available when compiled with wide character string support:
int
libbfio_file_get_name_size_wide(
libbfio_handle_t *handle
, size_t *name_size
, libbfio_error_t **error
);
int
libbfio_file_get_name_wide(
libbfio_handle_t *handle
, wchar_t *name
, size_t name_size
, libbfio_error_t **error
);
int
libbfio_file_set_name_wide(
libbfio_handle_t *handle
, const wchar_t *name
, size_t name_length
, libbfio_error_t **error
);

File range functions
int
libbfio_file_range_initialize(
libbfio_handle_t **handle
, libbfio_error_t **error
);
int
libbfio_file_range_get_name_size(
libbfio_handle_t *handle
, size_t *name_size
, libbfio_error_t **error
);
int
libbfio_file_range_get_name(
libbfio_handle_t *handle
, char *name
, size_t name_size
, libbfio_error_t **error
);
int
libbfio_file_range_set_name(
libbfio_handle_t *handle
, const char *name
, size_t name_length
, libbfio_error_t **error
);
int
libbfio_file_range_get(
libbfio_handle_t *handle
, off64_t *range_offset
, size64_t *range_size
, libbfio_error_t **error
);
int
libbfio_file_range_set(
libbfio_handle_t *handle
, off64_t range_offset
, size64_t range_size
, libbfio_error_t **error
);

Available when compiled with wide character string support:
int
libbfio_file_range_get_name_size_wide(
libbfio_handle_t *handle
, size_t *name_size
, libbfio_error_t **error
);
int
libbfio_file_range_get_name_wide(
libbfio_handle_t *handle
, wchar_t *name
, size_t name_size
, libbfio_error_t **error
);
int
libbfio_file_range_set_name_wide(
libbfio_handle_t *handle
, const wchar_t *name
, size_t name_length
, libbfio_error_t **error
);

Memory range functions
int
libbfio_memory_range_initialize(
libbfio_handle_t **handle
, libbfio_error_t **error
);
int
libbfio_memory_range_get(
libbfio_handle_t *handle
, uint8_t **start
, size_t *size
, libbfio_error_t **error
);
int
libbfio_memory_range_set(
libbfio_handle_t *handle
, uint8_t *start
, size_t size
, libbfio_error_t **error
);

Pool functions
int
libbfio_pool_initialize(
libbfio_pool_t **pool
, int number_of_handles
, int maximum_number_of_open_handles
, libbfio_error_t **error
);
int
libbfio_pool_free(
libbfio_pool_t **pool
, libbfio_error_t **error
);
int
libbfio_pool_clone(
libbfio_pool_t **destination_pool
, libbfio_pool_t *source_pool
, libbfio_error_t **error
);
int
libbfio_pool_resize(
libbfio_pool_t *pool
, int number_of_handles
, libbfio_error_t **error
);
int
libbfio_pool_get_number_of_handles(
libbfio_pool_t *pool
, int *number_of_handles
, libbfio_error_t **error
);
int
libbfio_pool_get_handle(
libbfio_pool_t *pool
, int entry
, libbfio_handle_t **handle
, libbfio_error_t **error
);
int
libbfio_pool_append_handle(
libbfio_pool_t *pool
, int *entry
, libbfio_handle_t *handle
, int access_flags
, libbfio_error_t **error
);
int
libbfio_pool_set_handle(
libbfio_pool_t *pool
, int entry
, libbfio_handle_t *handle
, int access_flags
, libbfio_error_t **error
);
int
libbfio_pool_remove_handle(
libbfio_pool_t *pool
, int entry
, libbfio_handle_t **handle
, libbfio_error_t **error
);
int
libbfio_pool_get_maximum_number_of_open_handles(
libbfio_pool_t *pool
, int *maximum_number_of_open_handles
, libbfio_error_t **error
);
int
libbfio_pool_set_maximum_number_of_open_handles(
libbfio_pool_t *pool
, int maximum_number_of_open_handles
, libbfio_error_t **error
);
int
libbfio_pool_open(
libbfio_pool_t *pool
, int entry
, int access_flags
, libbfio_error_t **error
);
int
libbfio_pool_reopen(
libbfio_pool_t *pool
, int entry
, int access_flags
, libbfio_error_t **error
);
int
libbfio_pool_close(
libbfio_pool_t *pool
, int entry
, libbfio_error_t **error
);
int
libbfio_pool_close_all(
libbfio_pool_t *pool
, libbfio_error_t **error
);
ssize_t
libbfio_pool_read_buffer(
libbfio_pool_t *pool
, int entry
, uint8_t *buffer
, size_t size
, libbfio_error_t **error
);
ssize_t
libbfio_pool_read_buffer_at_offset(
libbfio_pool_t *pool
, int entry
, uint8_t *buffer
, size_t size
, off64_t offset
, libbfio_error_t **error
);
ssize_t
libbfio_pool_write_buffer(
libbfio_pool_t *pool
, int entry
, const uint8_t *buffer
, size_t size
, libbfio_error_t **error
);
ssize_t
libbfio_pool_write_buffer_at_offset(
libbfio_pool_t *pool
, int entry
, const uint8_t *buffer
, size_t size
, off64_t offset
, libbfio_error_t **error
);
off64_t
libbfio_pool_seek_offset(
libbfio_pool_t *pool
, int entry
, off64_t offset
, int whence
, libbfio_error_t **error
);
int
libbfio_pool_get_offset(
libbfio_pool_t *pool
, int entry
, off64_t *offset
, libbfio_error_t **error
);
int
libbfio_pool_get_size(
libbfio_pool_t *pool
, int entry
, size64_t *size
, libbfio_error_t **error
);

File pool functions
int
libbfio_file_pool_open(
libbfio_pool_t *pool
, int entry
, const char *name
, int access_flags
, libbfio_error_t **error
);
int
libbfio_file_pool_append_handles_for_names(
libbfio_pool_t *pool
, char * const names[]
, int number_of_names
, int access_flags
, libbfio_error_t **error
);

Available when compiled with wide character string support:
int
libbfio_file_pool_open_wide(
libbfio_pool_t *pool
, int entry
, const wchar_t *name
, int access_flags
, libbfio_error_t **error
);
int
libbfio_file_pool_append_handle_for_names_wide(
libbfio_pool_t *pool
, wchar_t * const names[]
, int number_of_names
, int access_flags
, libbfio_error_t **error
);

DESCRIPTION
The libbfio_get_version() function is used to retrieve the library version.

RETURN VALUES
Most of the functions return NULL or -1 on error, dependent on the return type. For the actual return values see <libbfio.h>.

ENVIRONMENT
None

FILES
None

NOTES
libbfio can be compiled with wide character support (wchar_t).

To compile libbfio with wide character support use: ./configure --enable-wide-character-type or define: _UNICODE or UNICODE during compilation.

LIBBFIO_WIDE_CHARACTER_TYPE in libbfio/features.h can be used to determine if libbfio was compiled with wide character support.

SEE ALSO
<libbfio.h>

AUTHORS
Joachim Metz <joachim.metz@gmail.com>

BUGS
Please report bugs of any kind on the project issue tracker: https://github.com/libyal/libbfio/issues

COPYRIGHT
Copyright (C) 2009-2026, Joachim Metz <joachim.metz@gmail.com>.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.