libqcow(3)
π libqcow β bestie's guide to the QEMU Copy-On-Write image format π
okay so you found libqcow(3) and you're like "what is this" β bestie, this is the library that lets you access the QEMU Copy-On-Write (QCOW) image file format. yes. the whole thing. it's a C library, it lives in libqcow.h, and it's genuinely iconic. let's get into it π«Ά
β¨ SYNOPSIS β¨
first things first, the include. literally one line, you got this:
#include <libqcow.h>
πΈ Support functions
const char *
libqcow_get_version(void);
int
libqcow_get_access_flags_read(void);
int
libqcow_get_access_flags_read_write(void);
int
libqcow_get_access_flags_write(void);
int
libqcow_get_codepage(int *codepage, libqcow_error_t **error);
int
libqcow_set_codepage(int codepage, libqcow_error_t **error);
int
libqcow_check_file_signature(const char *filename,
libqcow_error_t **error);
available when compiled with wide character string support:
int
libqcow_check_file_signature_wide(const wchar_t *filename,
libqcow_error_t **error);
available when compiled with libbfio support:
int
libqcow_check_file_signature_file_io_handle(libbfio_handle_t *bfio_handle,
libqcow_error_t **error);
π Notify functions
void
libqcow_notify_set_verbose(int verbose);
int
libqcow_notify_set_stream(FILE *stream, libqcow_error_t **error);
int
libqcow_notify_stream_open(const char *filename,
libqcow_error_t **error);
int
libqcow_notify_stream_close(libqcow_error_t **error);
π¦ Error functions
void
libqcow_error_free(libqcow_error_t **error);
int
libqcow_error_fprint(libqcow_error_t *error, FILE *stream);
int
libqcow_error_sprint(libqcow_error_t *error, char *string, size_t size);
int
libqcow_error_backtrace_fprint(libqcow_error_t *error, FILE *stream);
int
libqcow_error_backtrace_sprint(libqcow_error_t *error, char *string,
size_t size);
π File functions
int
libqcow_file_initialize(libqcow_file_t **file, libqcow_error_t **error);
int
libqcow_file_free(libqcow_file_t **file, libqcow_error_t **error);
int
libqcow_file_signal_abort(libqcow_file_t *file,
libqcow_error_t **error);
int
libqcow_file_open(libqcow_file_t *file, const char *filename,
int access_flags, libqcow_error_t **error);
int
libqcow_file_close(libqcow_file_t *file, libqcow_error_t **error);
int
libqcow_file_is_locked(libqcow_file_t *file, libqcow_error_t **error);
ssize_t
libqcow_file_read_buffer(libqcow_file_t *file, void *buffer,
size_t buffer_size, libqcow_error_t **error);
ssize_t
libqcow_file_read_buffer_at_offset(libqcow_file_t *file, void *buffer,
size_t buffer_size, off64_t offset, libqcow_error_t **error);
off64_t
libqcow_file_seek_offset(libqcow_file_t *file, off64_t offset,
int whence, libqcow_error_t **error);
int
libqcow_file_get_offset(libqcow_file_t *file, off64_t *offset,
libqcow_error_t **error);
int
libqcow_file_set_parent_file(libqcow_file_t *file,
libqcow_file_t *parent_file, libqcow_error_t **error);
int
libqcow_file_get_format_version(libqcow_file_t *file,
uint32_t *format_version, libqcow_error_t **error);
int
libqcow_file_get_encryption_method(libqcow_file_t *file,
uint32_t *encryption_method, libqcow_error_t **error);
int
libqcow_file_set_keys(libqcow_file_t *file, const uint8_t *key,
size_t key_size, libqcow_error_t **error);
int
libqcow_file_set_utf8_password(libqcow_file_t *file,
const uint8_t *utf8_string, size_t utf8_string_length,
libqcow_error_t **error);
int
libqcow_file_set_utf16_password(libqcow_file_t *file,
const uint16_t *utf16_string, size_t utf16_string_length,
libqcow_error_t **error);
int
libqcow_file_get_media_size(libqcow_file_t *file, size64_t *media_size,
libqcow_error_t **error);
int
libqcow_file_get_utf8_backing_filename_size(libqcow_file_t *file,
size_t *utf8_string_size, libqcow_error_t **error);
int
libqcow_file_get_utf8_backing_filename(libqcow_file_t *file,
uint8_t *utf8_string, size_t utf8_string_size,
libqcow_error_t **error);
int
libqcow_file_get_utf16_backing_filename_size(libqcow_file_t *file,
size_t *utf16_string_size, libqcow_error_t **error);
int
libqcow_file_get_utf16_backing_filename(libqcow_file_t *file,
uint16_t *utf16_string, size_t utf16_string_size,
libqcow_error_t **error);
int
libqcow_file_get_number_of_snapshots(libqcow_file_t *file,
int *number_of_snapshots, libqcow_error_t **error);
available when compiled with wide character string support:
int
libqcow_file_open_wide(libqcow_file_t *file, const wchar_t *filename,
int access_flags, libqcow_error_t **error);
available when compiled with libbfio support:
int
libqcow_file_open_file_io_handle(libqcow_file_t *file,
libbfio_handle_t *file_io_handle, int access_flags,
libqcow_error_t **error);
π DESCRIPTION π
so basically: the libqcow_get_version() function is used to retrieve the library version. that's the vibe. that's what it does. no cap.
π RETURN VALUES π
most of these functions return NULL or -1 on error β depends on the return type, so like, check what you're calling bestie. for the actual return values, go look at libqcow.h (iykyk).
π ENVIRONMENT π
None
π§ FILES π§
None
π NOTES π
libqcow can be compiled with wide character support (wchar_t). slay.
to compile libqcow with wide character support, use:
./configure --enable-wide-character-type=yes
or define:
_UNICODE
or:
UNICODE
during compilation. pick your fighter β¨
LIBQCOW_WIDE_CHARACTER_TYPE in libqcow/features.h can be used to figure out whether libqcow was compiled with wide character support. so like, vibe check the build flags before you assume anything π
π BUGS π
please report bugs of any kind on the project issue tracker:
https://github.com/libyal/libqcow/issues
they want to hear from you fr fr.
π AUTHOR π
these man pages are generated from libqcow.h. iconic behavior honestly.
β COPYRIGHT β
Copyright (C) 2010-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 like, no promises bestie, it's giving "as-is" energy π
πΈ SEE ALSO πΈ
- the
libqcow.hinclude file
okay that's the whole page π«Ά go forth and read your QCOW images, main character energy only
this has been libqcow, from the Library Functions Manual, and it's dated December 12, 2020 β version libqcow(3), periodt π
β¨
π¦ where this page comes from
- debian trixie: libqcow-dev 20240308-1+b1 Β· LGPL-3.0-or-later
- opensuse-leap 16.0: libqcow-devel 20240308-bp160.1.13 Β· GFDL-1.1-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- opensuse-leap 16.0: libqcow-devel 20240308-bp160.1.13 Β· GFDL-1.1-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- opensuse-leap 16.0: libqcow-devel 20240308-bp160.1.13 Β· GFDL-1.1-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- opensuse-leap 16.0: libqcow-devel 20240308-bp160.1.13 Β· GFDL-1.1-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- ubuntu questing: libqcow-dev 20240308-1build1
- ubuntu resolute: libqcow-dev 20240308-2build1 Β· LGPL-3.0-or-later
- ubuntu stonking: libqcow-dev 20240308-2build1 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms