libfshfs(3)

πŸ“¦
this version Β· 2 versions
, in debian trixie, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– libfshfs β€” Library Functions Manual πŸ’–

okay bestie, you opened the libfshfs manual and honestly? taste. this is the library you reach for when you wanna access the Hierarchical File System (HFS) format β€” yes, that HFS, the Apple one. it's giving low-level C, it's giving "i read manpages for fun", it's giving main character energy. let's get into it. πŸ¦‹βœ¨


πŸŽ€ NAME πŸŽ€

libfshfs.h β€” the library that lets you access the Hierarchical File System (HFS) format. that's it, that's the whole vibe. πŸ’…


✨ SYNOPSIS ✨

first things first, you gotta pull it in, no cap:

#include <libfshfs.h>

and then... okay so there are a LOT of functions. i'm not gonna gatekeep, we're doing all of them. buckle up, queen. πŸ‘‘

🌸 Support functions 🌸

the little helpers that just vibe and tell you stuff:

const char *
libfshfs_get_version(void);

int
libfshfs_get_access_flags_read(void);

int
libfshfs_get_codepage(int *codepage, libfshfs_error_t **error);

int
libfshfs_set_codepage(int codepage, libfshfs_error_t **error);

int
libfshfs_check_volume_signature(const char *filename,
    libfshfs_error_t **error);

available when compiled with wide character string support:

int
libfshfs_check_volume_signature_wide(const wchar_t *filename,
    libfshfs_error_t **error);

available when compiled with libbfio support:

int
libfshfs_check_volume_signature_file_io_handle(libbfio_handle_t *file_io_handle,
    libfshfs_error_t **error);

πŸ”” Notify functions πŸ””

for when you want the library to actually talk to you (verbose mode, a custom stream, whatever):

void
libfshfs_notify_set_verbose(int verbose);

int
libfshfs_notify_set_stream(FILE *stream, libfshfs_error_t **error);

int
libfshfs_notify_stream_open(const char *filename,
    libfshfs_error_t **error);

int
libfshfs_notify_stream_close(libfshfs_error_t **error);

😭 Error functions 😭

because things WILL go wrong and you WILL want to know why:

void
libfshfs_error_free(libfshfs_error_t **error);

int
libfshfs_error_fprint(libfshfs_error_t *error, FILE *stream);

int
libfshfs_error_sprint(libfshfs_error_t *error, char *string,
    size_t size);

int
libfshfs_error_backtrace_fprint(libfshfs_error_t *error, FILE *stream);

int
libfshfs_error_backtrace_sprint(libfshfs_error_t *error, char *string,
    size_t size);

πŸ’Ώ Volume functions πŸ’Ώ

the whole entire volume moment. init it, open it, name it, browse it, close it, free it:

int
libfshfs_volume_initialize(libfshfs_volume_t **volume,
    libfshfs_error_t **error);

int
libfshfs_volume_free(libfshfs_volume_t **volume,
    libfshfs_error_t **error);

int
libfshfs_volume_signal_abort(libfshfs_volume_t *volume,
    libfshfs_error_t **error);

int
libfshfs_volume_open(libfshfs_volume_t *volume, const char *filename,
    int access_flags, libfshfs_error_t **error);

int
libfshfs_volume_close(libfshfs_volume_t *volume,
    libfshfs_error_t **error);

int
libfshfs_volume_get_utf8_name_size(libfshfs_volume_t *volume,
    size_t *utf8_string_size, libfshfs_error_t **error);

int
libfshfs_volume_get_utf8_name(libfshfs_volume_t *volume,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfshfs_error_t **error);

int
libfshfs_volume_get_utf16_name_size(libfshfs_volume_t *volume,
    size_t *utf16_string_size, libfshfs_error_t **error);

int
libfshfs_volume_get_utf16_name(libfshfs_volume_t *volume,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfshfs_error_t **error);

int
libfshfs_volume_get_root_directory(libfshfs_volume_t *volume,
    libfshfs_file_entry_t **file_entry, libfshfs_error_t **error);

int
libfshfs_volume_get_file_entry_by_identifier(libfshfs_volume_t *volume,
    uint32_t identifier, libfshfs_file_entry_t **file_entry,
    libfshfs_error_t **error);

int
libfshfs_volume_get_file_entry_by_utf8_path(libfshfs_volume_t *volume,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfshfs_file_entry_t **file_entry, libfshfs_error_t **error);

int
libfshfs_volume_get_file_entry_by_utf16_path(libfshfs_volume_t *volume,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfshfs_file_entry_t **file_entry, libfshfs_error_t **error);

available when compiled with wide character string support:

int
libfshfs_volume_open_wide(libfshfs_volume_t *volume,
    const wchar_t *filename, int access_flags,
    libfshfs_error_t **error);

available when compiled with libbfio support:

int
libfshfs_volume_open_file_io_handle(libfshfs_volume_t *volume,
    libbfio_handle_t *file_io_handle, int access_flags,
    libfshfs_error_t **error);

🌈 File entry functions 🌈

and here's the BIG one β€” every single thing you could possibly wanna know about a file entry. names, times, ids, symlinks, resource forks, extended attributes, sub-file entries, reads, seeks, sizes... she does it all, fr fr:

int
libfshfs_file_entry_free(libfshfs_file_entry_t **file_entry,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_identifier(libfshfs_file_entry_t *file_entry,
    uint32_t *identifier, libfshfs_error_t **error);

int
libfshfs_file_entry_get_parent_identifier(libfshfs_file_entry_t *file_entry,
    uint32_t *parent_identifier, libfshfs_error_t **error);

int
libfshfs_file_entry_get_parent_file_entry(libfshfs_file_entry_t *file_entry,
    libfshfs_file_entry_t **parent_file_entry,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_link_identifier(libfshfs_file_entry_t *file_entry,
    uint32_t *link_identifier, libfshfs_error_t **error);

int
libfshfs_file_entry_get_creation_time(libfshfs_file_entry_t *file_entry,
    uint32_t *hfs_time, libfshfs_error_t **error);

int
libfshfs_file_entry_get_modification_time(libfshfs_file_entry_t *file_entry,
    uint32_t *hfs_time, libfshfs_error_t **error);

int
libfshfs_file_entry_get_entry_modification_time(libfshfs_file_entry_t *file_entry,
    uint32_t *hfs_time, libfshfs_error_t **error);

int
libfshfs_file_entry_get_access_time(libfshfs_file_entry_t *file_entry,
    uint32_t *hfs_time, libfshfs_error_t **error);

int
libfshfs_file_entry_get_backup_time(libfshfs_file_entry_t *file_entry,
    uint32_t *hfs_time, libfshfs_error_t **error);

int
libfshfs_file_entry_get_added_time(libfshfs_file_entry_t *file_entry,
    int32_t *posix_time, libfshfs_error_t **error);

int
libfshfs_file_entry_get_file_mode(libfshfs_file_entry_t *file_entry,
    uint16_t *file_mode, libfshfs_error_t **error);

int
libfshfs_file_entry_get_number_of_links(libfshfs_file_entry_t *file_entry,
    uint32_t *number_of_links, libfshfs_error_t **error);

int
libfshfs_file_entry_get_owner_identifier(libfshfs_file_entry_t *file_entry,
    uint32_t *owner_identifier, libfshfs_error_t **error);

int
libfshfs_file_entry_get_group_identifier(libfshfs_file_entry_t *file_entry,
    uint32_t *group_identifier, libfshfs_error_t **error);

int
libfshfs_file_entry_get_device_identifier(libfshfs_file_entry_t *file_entry,
    uint32_t *device_identifier, libfshfs_error_t **error);

int
libfshfs_file_entry_get_device_number(libfshfs_file_entry_t *file_entry,
    uint32_t *major_device_number, uint32_t *minor_device_number,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf8_name_size(libfshfs_file_entry_t *file_entry,
    size_t *utf8_string_size, libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf8_name(libfshfs_file_entry_t *file_entry,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf16_name_size(libfshfs_file_entry_t *file_entry,
    size_t *utf16_string_size, libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf16_name(libfshfs_file_entry_t *file_entry,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf8_symbolic_link_target_size(libfshfs_file_entry_t *file_entry,
    size_t *utf8_string_size, libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf8_symbolic_link_target(libfshfs_file_entry_t *file_entry,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf16_symbolic_link_target_size(libfshfs_file_entry_t *file_entry,
    size_t *utf16_string_size, libfshfs_error_t **error);

int
libfshfs_file_entry_get_utf16_symbolic_link_target(libfshfs_file_entry_t *file_entry,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfshfs_error_t **error);

int
libfshfs_file_entry_has_resource_fork(libfshfs_file_entry_t *file_entry,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_resource_fork(libfshfs_file_entry_t *file_entry,
    libfshfs_data_stream_t **data_stream, libfshfs_error_t **error);

int
libfshfs_file_entry_get_number_of_extended_attributes(libfshfs_file_entry_t *file_entry,
    int *number_of_extended_attributes, libfshfs_error_t **error);

int
libfshfs_file_entry_get_extended_attribute_by_index(libfshfs_file_entry_t *file_entry,
    int extended_attribute_index,
    libfshfs_extended_attribute_t **extended_attribute,
    libfshfs_error_t **error);

int
libfshfs_file_entry_has_extended_attribute_by_utf8_name(libfshfs_file_entry_t *file_entry,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfshfs_error_t **error);

int
libfshfs_file_entry_has_extended_attribute_by_utf16_name(libfshfs_file_entry_t *file_entry,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_extended_attribute_by_utf8_name(libfshfs_file_entry_t *file_entry,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfshfs_extended_attribute_t **extended_attribute,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_extended_attribute_by_utf16_name(libfshfs_file_entry_t *file_entry,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfshfs_extended_attribute_t **extended_attribute,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_number_of_sub_file_entries(libfshfs_file_entry_t *file_entry,
    int *number_of_sub_file_entries, libfshfs_error_t **error);

int
libfshfs_file_entry_get_sub_file_entry_by_index(libfshfs_file_entry_t *file_entry,
    int sub_file_entry_index, libfshfs_file_entry_t **sub_file_entry,
    libfshfs_error_t **error);

int
libfshfs_file_entry_get_sub_file_entry_by_utf8_name(libfshfs_file_entry_t *file_entry,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfshfs_file_entry_t **sub_file_entry, libfshfs_error_t **error);

int
libfshfs_file_entry_get_sub_file_entry_by_utf16_name(libfshfs_file_entry_t *file_entry,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfshfs_file_entry_t **sub_file_entry, libfshfs_error_t **error);

ssize_t
libfshfs_file_entry_read_buffer(libfshfs_file_entry_t *file_entry,
    void *buffer, size_t buffer_size, libfshfs_error_t **error);

ssize_t
libfshfs_file_entry_read_buffer_at_offset(libfshfs_file_entry_t *file_entry,
    void *buffer, size_t buffer_size, off64_t offset,
    libfshfs_error_t **error);

off64_t
libfshfs_file_entry_seek_offset(libfshfs_file_entry_t *file_entry,
    off64_t offset, int whence, libfshfs_error_t **error);

int
libfshfs_file_entry_get_offset(libfshfs_file_entry_t *file_entry,
    off64_t *offset, libfshfs_error_t **error);

int
libfshfs_file_entry_get_size(libfshfs_file_entry_t *file_entry,
    size64_t *size, libfshfs_error_t **error);

okay pausing here bestie, that's the end of part one. so many functions, so much slay, and we're literally not even done yet β€” there's more coming. 🫢✨

okay bestie, we're back and we're still in the SYNOPSIS because this library has a LOT of functions and honestly? iconic. πŸ’… here are the rest of the libfshfs_file_entry_* ones you didn't get in part one:

       int
       libfshfs_file_entry_get_number_of_extents(libfshfs_file_entry_t *file_entry,
           int *number_of_extents, libfshfs_error_t **error);

       int
       libfshfs_file_entry_get_extent_by_index(libfshfs_file_entry_t *file_entry,
           int extent_index, off64_t *extent_offset, size64_t *extent_size,
           uint32_t *extent_flags, libfshfs_error_t **error);

and now the data stream functions ✨ they're giving 'read, seek, size, extents, the whole vibe':

       int
       libfshfs_data_stream_free(libfshfs_data_stream_t **data_stream,
           libfshfs_error_t **error);

       ssize_t
       libfshfs_data_stream_read_buffer(libfshfs_data_stream_t *data_stream,
           void *buffer, size_t buffer_size, libfshfs_error_t **error);

       ssize_t
       libfshfs_data_stream_read_buffer_at_offset(libfshfs_data_stream_t *data_stream,
           void *buffer, size_t buffer_size, off64_t offset,
           libfshfs_error_t **error);

       off64_t
       libfshfs_data_stream_seek_offset(libfshfs_data_stream_t *data_stream,
           off64_t offset, int whence, libfshfs_error_t **error);

       int
       libfshfs_data_stream_get_offset(libfshfs_data_stream_t *data_stream,
           off64_t *offset, libfshfs_error_t **error);

       int
       libfshfs_data_stream_get_size(libfshfs_data_stream_t *data_stream,
           size64_t *size, libfshfs_error_t **error);

       int
       libfshfs_data_stream_get_number_of_extents(libfshfs_data_stream_t *data_stream,
           int *number_of_extents, libfshfs_error_t **error);

       int
       libfshfs_data_stream_get_extent_by_index(libfshfs_data_stream_t *data_stream,
           int extent_index, off64_t *extent_offset, size64_t *extent_size,
           uint32_t *extent_flags, libfshfs_error_t **error);

and finally the extended attribute functions πŸŽ€ because every file deserves a little extra, y'know? πŸ’…

       int
       libfshfs_extended_attribute_free(libfshfs_extended_attribute_t **extended_attribute,
           libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_utf8_name_size(libfshfs_extended_attribute_t *extended_attribute,
           size_t *utf8_string_size, libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_utf8_name(libfshfs_extended_attribute_t *extended_attribute,
           uint8_t *utf8_string, size_t utf8_string_size,
           libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_utf16_name_size(libfshfs_extended_attribute_t *extended_attribute,
           size_t *utf16_string_size, libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_utf16_name(libfshfs_extended_attribute_t *extended_attribute,
           uint16_t *utf16_string, size_t utf16_string_size,
           libfshfs_error_t **error);

       ssize_t
       libfshfs_extended_attribute_read_buffer(libfshfs_extended_attribute_t *extended_attribute,
           void *buffer, size_t buffer_size, libfshfs_error_t **error);

       ssize_t
       libfshfs_extended_attribute_read_buffer_at_offset(libfshfs_extended_attribute_t *extended_attribute,
           void *buffer, size_t buffer_size, off64_t offset,
           libfshfs_error_t **error);

       off64_t
       libfshfs_extended_attribute_seek_offset(libfshfs_extended_attribute_t *extended_attribute,
           off64_t offset, int whence, libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_offset(libfshfs_extended_attribute_t *extended_attribute,
           off64_t *offset, libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_size(libfshfs_extended_attribute_t *extended_attribute,
           size64_t *size, libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_number_of_extents(libfshfs_extended_attribute_t *extended_attribute,
           int *number_of_extents, libfshfs_error_t **error);

       int
       libfshfs_extended_attribute_get_extent_by_index(libfshfs_extended_attribute_t *extended_attribute,
           int extent_index, off64_t *extent_offset, size64_t *extent_size,
           uint32_t *extent_flags, libfshfs_error_t **error);

✨ DESCRIPTION ✨

so basically, libfshfs_get_version() is your go-to for, like, the library version? it's giving 'who am I, what's my version' energy. πŸ’β€β™€οΈ


✨ RETURN VALUES ✨

most of these functions hit you with NULL or -1 when something goes wrong, depending on what type they return. if you wanna know the exact return values, bestie, you gotta peek at libfshfs.h. no cap. πŸ“–


✨ ENVIRONMENT ✨

None. literally nothing. it's giving minimal. πŸ§˜β€β™€οΈ


✨ FILES ✨

None. also nothing. we love a low-maintenance lib. πŸ’…


✨ NOTES ✨

okay so here's the tea: libfshfs can be compiled with wide character support (wchar_t).

to do that, you run:

./configure --enable-wide-character-type=yes

or you can define _UNICODE or UNICODE during compilation.

and if you wanna know if it was compiled with wide character support, check LIBFSHFS_WIDE_CHARACTER_TYPE in libfshfs/features.h. periodt. πŸ’–


✨ BUGS ✨

found a bug? don't be shy, report it on the project issue tracker: https://github.com/libyal/libfshfs/issues they wanna hear from you, bestie. πŸ›πŸ’–


✨ AUTHOR ✨

these man pages are generated from libfshfs.h. so like, the author is the header file, basically. iconic. πŸ‘‘


Copyright (C) 2009-2024, 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. so basically, use at your own risk, no promises. πŸ’€


✨ SEE ALSO ✨

the libfshfs.h include file. that's it. that's the see also. πŸ€·β€β™€οΈ


and that's the whole vibe, bestie. this page is from the libfshfs project, dated August 31, 2022, and it's the libfshfs(3) man page. slay. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from