libfsapfs(3)

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

πŸ¦‹ NAME πŸ¦‹

okay so welcome to libfsapfs β€” the manual page for libfsapfs(3), Library Functions Manual, bestie πŸ’…

  • libfsapfs.h β€” Library to access the Apple File System (APFS) format 🍎✨

that's it, that's the name section. short, sweet, iconic.


✨ SYNOPSIS ✨

so first things first, you gotta include the header, no cap:

#include <libfsapfs.h>

🫢 Support functions

these are the lil guys that just tell you stuff about the library itself:

const char *
libfsapfs_get_version(void);

int
libfsapfs_get_access_flags_read(void);

int
libfsapfs_get_codepage(int *codepage, libfsapfs_error_t **error);

int
libfsapfs_set_codepage(int codepage, libfsapfs_error_t **error);

int
libfsapfs_check_container_signature(const char *filename,
    libfsapfs_error_t **error);

int
libfsapfs_check_volume_signature(const char *filename,
    libfsapfs_error_t **error);

🌈 Available when compiled with wide character string support:

int
libfsapfs_check_container_signature_wide(const wchar_t *filename,
    libfsapfs_error_t **error);

int
libfsapfs_check_volume_signature_wide(const wchar_t *filename,
    libfsapfs_error_t **error);

🌈 Available when compiled with libbfio support:

int
libfsapfs_check_container_signature_file_io_handle(libbfio_handle_t *file_io_handle,
    libfsapfs_error_t **error);

int
libfsapfs_check_volume_signature_file_io_handle(libbfio_handle_t *file_io_handle,
    libfsapfs_error_t **error);

πŸ’¬ Notify functions

for when you want the library to, like, talk to you:

void
libfsapfs_notify_set_verbose(int verbose);

int
libfsapfs_notify_set_stream(FILE *stream, libfsapfs_error_t **error);

int
libfsapfs_notify_stream_open(const char *filename,
    libfsapfs_error_t **error);

int
libfsapfs_notify_stream_close(libfsapfs_error_t **error);

😭 Error functions

the ones you'll get very familiar with, ngl:

void
libfsapfs_error_free(libfsapfs_error_t **error);

int
libfsapfs_error_fprint(libfsapfs_error_t *error, FILE *stream);

int
libfsapfs_error_sprint(libfsapfs_error_t *error, char *string,
    size_t size);

int
libfsapfs_error_backtrace_fprint(libfsapfs_error_t *error,
    FILE *stream);

int
libfsapfs_error_backtrace_sprint(libfsapfs_error_t *error, char *string,
    size_t size);

πŸ‘‘ Container functions

containers are the main character energy of APFS, they hold all the volumes inside:

int
libfsapfs_container_initialize(libfsapfs_container_t **container,
    libfsapfs_error_t **error);

int
libfsapfs_container_free(libfsapfs_container_t **container,
    libfsapfs_error_t **error);

int
libfsapfs_container_signal_abort(libfsapfs_container_t *container,
    libfsapfs_error_t **error);

int
libfsapfs_container_open(libfsapfs_container_t *container,
    const char *filename, int access_flags, libfsapfs_error_t **error);

int
libfsapfs_container_close(libfsapfs_container_t *container,
    libfsapfs_error_t **error);

int
libfsapfs_container_get_size(libfsapfs_container_t *container,
    size64_t *size, libfsapfs_error_t **error);

int
libfsapfs_container_get_identifier(libfsapfs_container_t *container,
    uint8_t *uuid_data, size_t uuid_data_size,
    libfsapfs_error_t **error);

int
libfsapfs_container_is_locked(libfsapfs_container_t *container,
    libfsapfs_error_t **error);

int
libfsapfs_container_get_number_of_volumes(libfsapfs_container_t *container,
    int *number_of_volumes, libfsapfs_error_t **error);

int
libfsapfs_container_get_volume_by_index(libfsapfs_container_t *container,
    int volume_index, libfsapfs_volume_t **volume,
    libfsapfs_error_t **error);

🌸 Available when compiled with wide character string support:

int
libfsapfs_container_open_wide(libfsapfs_container_t *container,
    const wchar_t *filename, int access_flags,
    libfsapfs_error_t **error);

🌸 Available when compiled with libbfio support:

int
libfsapfs_container_open_file_io_handle(libfsapfs_container_t *container,
    libbfio_handle_t *file_io_handle, int access_flags,
    libfsapfs_error_t **error);

πŸŽ€ Volume functions

the volumes living inside the container β€” this is the whole squad, and yes, it goes kinda hard:

int
libfsapfs_volume_free(libfsapfs_volume_t **volume,
    libfsapfs_error_t **error);

int
libfsapfs_volume_unlock(libfsapfs_volume_t *volume,
    libfsapfs_error_t **error);

int
libfsapfs_volume_get_features_flags(libfsapfs_volume_t *volume,
    uint64_t *compatible_features_flags,
    uint64_t *incompatible_features_flags,
    uint64_t *read_only_compatible_features_flags,
    libfsapfs_error_t **error);

int
libfsapfs_volume_get_size(libfsapfs_volume_t *volume, size64_t *size,
    libfsapfs_error_t **error);

int
libfsapfs_volume_get_identifier(libfsapfs_volume_t *volume,
    uint8_t *uuid_data, size_t uuid_data_size,
    libfsapfs_error_t **error);

int
libfsapfs_volume_get_utf8_name_size(libfsapfs_volume_t *volume,
    size_t *utf8_string_size, libfsapfs_error_t **error);

int
libfsapfs_volume_get_utf8_name(libfsapfs_volume_t *volume,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfsapfs_error_t **error);

int
libfsapfs_volume_get_utf16_name_size(libfsapfs_volume_t *volume,
    size_t *utf16_string_size, libfsapfs_error_t **error);

int
libfsapfs_volume_get_utf16_name(libfsapfs_volume_t *volume,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfsapfs_error_t **error);

int
libfsapfs_volume_is_locked(libfsapfs_volume_t *volume,
    libfsapfs_error_t **error);

int
libfsapfs_volume_set_utf8_password(libfsapfs_volume_t *volume,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfsapfs_error_t **error);

int
libfsapfs_volume_set_utf16_password(libfsapfs_volume_t *volume,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfsapfs_error_t **error);

int
libfsapfs_volume_set_utf8_recovery_password(libfsapfs_volume_t *volume,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfsapfs_error_t **error);

int
libfsapfs_volume_set_utf16_recovery_password(libfsapfs_volume_t *volume,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfsapfs_error_t **error);

int
libfsapfs_volume_get_root_directory(libfsapfs_volume_t *volume,
    libfsapfs_file_entry_t **file_entry, libfsapfs_error_t **error);

int
libfsapfs_volume_get_next_file_entry_identifier(libfsapfs_volume_t *volume,
    uint64_t *identifier, libfsapfs_error_t **error);

int
libfsapfs_volume_get_file_entry_by_identifier(libfsapfs_volume_t *volume,
    uint64_t identifier, libfsapfs_file_entry_t **file_entry,
    libfsapfs_error_t **error);

int
libfsapfs_volume_get_file_entry_by_utf8_path(libfsapfs_volume_t *volume,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfsapfs_file_entry_t **file_entry, libfsapfs_error_t **error);

int
libfsapfs_volume_get_file_entry_by_utf16_path(libfsapfs_volume_t *volume,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfsapfs_file_entry_t **file_entry, libfsapfs_error_t **error);

int
libfsapfs_volume_get_number_of_snapshots(libfsapfs_volume_t *volume,
    int *number_of_snapshots, libfsapfs_error_t **error);

int
libfsapfs_volume_get_snapshot_by_index(libfsapfs_volume_t *volume,
    int snapshot_index, libfsapfs_snapshot_t **snapshot,
    libfsapfs_error_t **error);

🧚 Snapshot functions

time travel but make it filesystem πŸ’«:

int
libfsapfs_snapshot_free(libfsapfs_snapshot_t **snapshot,
    libfsapfs_error_t **error);

int
libfsapfs_snapshot_get_utf8_name_size(libfsapfs_snapshot_t *snapshot,
    size_t *utf8_string_size, libfsapfs_error_t **error);

int
libfsapfs_snapshot_get_utf8_name(libfsapfs_snapshot_t *snapshot,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfsapfs_error_t **error);

int
libfsapfs_snapshot_get_utf16_name_size(libfsapfs_snapshot_t *snapshot,
    size_t *utf16_string_size, libfsapfs_error_t **error);

int
libfsapfs_snapshot_get_utf16_name(libfsapfs_snapshot_t *snapshot,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfsapfs_error_t **error);

πŸ’… File entry functions

every file, every dir, every lil metadata crumb β€” it's giving a lot and I'm obsessed:

int
libfsapfs_file_entry_free(libfsapfs_file_entry_t **file_entry,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_identifier(libfsapfs_file_entry_t *file_entry,
    uint64_t *identifier, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_parent_identifier(libfsapfs_file_entry_t *file_entry,
    uint64_t *parent_identifier, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_parent_file_entry(libfsapfs_file_entry_t *file_entry,
    libfsapfs_file_entry_t **parent_file_entry,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_creation_time(libfsapfs_file_entry_t *file_entry,
    int64_t *posix_time, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_modification_time(libfsapfs_file_entry_t *file_entry,
    int64_t *posix_time, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_access_time(libfsapfs_file_entry_t *file_entry,
    int64_t *posix_time, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_inode_change_time(libfsapfs_file_entry_t *file_entry,
    int64_t *posix_time, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_added_time(libfsapfs_file_entry_t *file_entry,
    int64_t *posix_time, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_file_mode(libfsapfs_file_entry_t *file_entry,
    uint16_t *file_mode, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_number_of_links(libfsapfs_file_entry_t *file_entry,
    uint32_t *number_of_links, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_owner_identifier(libfsapfs_file_entry_t *file_entry,
    uint32_t *owner_identifier, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_group_identifier(libfsapfs_file_entry_t *file_entry,
    uint32_t *group_identifier, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_device_identifier(libfsapfs_file_entry_t *file_entry,
    uint32_t *device_identifier, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_device_number(libfsapfs_file_entry_t *file_entry,
    uint32_t *major_device_number, uint32_t *minor_device_number,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_utf8_name_size(libfsapfs_file_entry_t *file_entry,
    size_t *utf8_string_size, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_utf8_name(libfsapfs_file_entry_t *file_entry,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_utf16_name_size(libfsapfs_file_entry_t *file_entry,
    size_t *utf16_string_size, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_utf16_name(libfsapfs_file_entry_t *file_entry,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfsapfs_error_t **error);

okay bestie we made it through the whole synopsis, no skimming, we ate that πŸ’– and that's only part 1 β€” hold tight, there's literally more coming, don't go anywhere 🌸

okay bestie, part two of the synopsis and it's the ✨full protection squad✨ of libfsapfs_file_entry_* and libfsapfs_extended_attribute_* calls. note that they do NOT all return int β€” some hand you back ssize_t or off64_t, so peep the return types as you scroll πŸ‘€

int
libfsapfs_file_entry_get_utf8_symbolic_link_target_size(libfsapfs_file_entry_t *file_entry,
    size_t *utf8_string_size, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_utf8_symbolic_link_target(libfsapfs_file_entry_t *file_entry,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_utf16_symbolic_link_target_size(libfsapfs_file_entry_t *file_entry,
    size_t *utf16_string_size, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_utf16_symbolic_link_target(libfsapfs_file_entry_t *file_entry,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_number_of_extended_attributes(libfsapfs_file_entry_t *file_entry,
    int *number_of_extended_attributes, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_extended_attribute_by_index(libfsapfs_file_entry_t *file_entry,
    int extended_attribute_index,
    libfsapfs_extended_attribute_t **extended_attribute,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_has_extended_attribute_by_utf8_name(libfsapfs_file_entry_t *file_entry,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_has_extended_attribute_by_utf16_name(libfsapfs_file_entry_t *file_entry,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_extended_attribute_by_utf8_name(libfsapfs_file_entry_t *file_entry,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfsapfs_extended_attribute_t **extended_attribute,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_extended_attribute_by_utf16_name(libfsapfs_file_entry_t *file_entry,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfsapfs_extended_attribute_t **extended_attribute,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_number_of_sub_file_entries(libfsapfs_file_entry_t *file_entry,
    int *number_of_sub_file_entries, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_sub_file_entry_by_index(libfsapfs_file_entry_t *file_entry,
    int sub_file_entry_index, libfsapfs_file_entry_t **sub_file_entry,
    libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_sub_file_entry_by_utf8_name(libfsapfs_file_entry_t *file_entry,
    const uint8_t *utf8_string, size_t utf8_string_length,
    libfsapfs_file_entry_t **sub_file_entry, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_sub_file_entry_by_utf16_name(libfsapfs_file_entry_t *file_entry,
    const uint16_t *utf16_string, size_t utf16_string_length,
    libfsapfs_file_entry_t **sub_file_entry, libfsapfs_error_t **error);

ssize_t
libfsapfs_file_entry_read_buffer(libfsapfs_file_entry_t *file_entry,
    void *buffer, size_t buffer_size, libfsapfs_error_t **error);

ssize_t
libfsapfs_file_entry_read_buffer_at_offset(libfsapfs_file_entry_t *file_entry,
    void *buffer, size_t buffer_size, off64_t offset,
    libfsapfs_error_t **error);

off64_t
libfsapfs_file_entry_seek_offset(libfsapfs_file_entry_t *file_entry,
    off64_t offset, int whence, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_offset(libfsapfs_file_entry_t *file_entry,
    off64_t *offset, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_size(libfsapfs_file_entry_t *file_entry,
    size64_t *size, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_number_of_extents(libfsapfs_file_entry_t *file_entry,
    int *number_of_extents, libfsapfs_error_t **error);

int
libfsapfs_file_entry_get_extent_by_index(libfsapfs_file_entry_t *file_entry,
    int extent_index, off64_t *extent_offset, size64_t *extent_size,
    uint32_t *extent_flags, libfsapfs_error_t **error);

πŸŽ€ Extended attribute functions πŸŽ€

and now the extended-attribute branch of the family, doing their own lil thing πŸ’–

int
libfsapfs_extended_attribute_free(libfsapfs_extended_attribute_t **extended_attribute,
    libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_identifier(libfsapfs_extended_attribute_t *extended_attribute,
    uint64_t *identifier, libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_utf8_name_size(libfsapfs_extended_attribute_t *extended_attribute,
    size_t *utf8_string_size, libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_utf8_name(libfsapfs_extended_attribute_t *extended_attribute,
    uint8_t *utf8_string, size_t utf8_string_size,
    libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_utf16_name_size(libfsapfs_extended_attribute_t *extended_attribute,
    size_t *utf16_string_size, libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_utf16_name(libfsapfs_extended_attribute_t *extended_attribute,
    uint16_t *utf16_string, size_t utf16_string_size,
    libfsapfs_error_t **error);

ssize_t
libfsapfs_extended_attribute_read_buffer(libfsapfs_extended_attribute_t *extended_attribute,
    void *buffer, size_t buffer_size, libfsapfs_error_t **error);

ssize_t
libfsapfs_extended_attribute_read_buffer_at_offset(libfsapfs_extended_attribute_t *extended_attribute,
    void *buffer, size_t buffer_size, off64_t offset,
    libfsapfs_error_t **error);

off64_t
libfsapfs_extended_attribute_seek_offset(libfsapfs_extended_attribute_t *extended_attribute,
    off64_t offset, int whence, libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_offset(libfsapfs_extended_attribute_t *extended_attribute,
    off64_t *offset, libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_size(libfsapfs_extended_attribute_t *extended_attribute,
    size64_t *size, libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_number_of_extents(libfsapfs_extended_attribute_t *extended_attribute,
    int *number_of_extents, libfsapfs_error_t **error);

int
libfsapfs_extended_attribute_get_extent_by_index(libfsapfs_extended_attribute_t *extended_attribute,
    int extent_index, off64_t *extent_offset, size64_t *extent_size,
    uint32_t *extent_flags, libfsapfs_error_t **error);

πŸ’… DESCRIPTION πŸ’…

okay so the one and only thing described here: the libfsapfs_get_version() function is used to retrieve the library version 🫢 that's it, that's the whole description, iconic brevity honestly.


✨ RETURN VALUES ✨

most of the functions return NULL or -1 on error, depending on the return type (yeah, it's giving "it depends" but that's fr fr what it says 😭). for the actual return values, go look at "libfsapfs.h" β€” that's the receipts bestie.


🌈 ENVIRONMENT 🌈

None β€” nothing to see here, no env vars, no drama πŸŽ€


πŸ¦‹ FILES πŸ¦‹

None β€” no files involved, we're chilling 🌸


πŸ‘‘ NOTES πŸ‘‘

  • libfsapfs can be compiled with wide character support (wchar_t).
  • to compile libfsapfs with wide character support, use:
./configure --enable-wide-character-type=yes

or define:

_UNICODE

or UNICODE during compilation.

  • LIBFSAPFS_WIDE_CHARACTER_TYPE in libfsapfs/features.h can be used to determine if libfsapfs was compiled with wide character support πŸ’œ

πŸ’€ BUGS πŸ’€

please report bugs of any kind on the project issue tracker:

https://github.com/libyal/libfsapfs/issues

like genuinely, any kind, don't be shy bestie πŸ™ˆ


πŸ–‹οΈ AUTHOR πŸ–‹οΈ

these man pages are generated from "libfsapfs.h".


Copyright (C) 2018-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 yeah, no cap, no promises 😭


πŸ”₯ SEE ALSO πŸ”₯

  • the libfsapfs.h include file

and that's a wrap on this whole glow-up 🫢 this is the libfsapfs man page from the libfsapfs source, dated July 28, 2022, living in section 3 as libfsapfs(3). go forth and slay those API calls βœ¨πŸ’–