---
name: "libqcow"
section: "3"
platform: "linux"
package: "libqcow-dev"
version: "20240308-1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libqcow"
---

# libqcow(3)

Library to access the QEMU Copy-On-Write (QCOW) image file format

## NAME

**libqcow.h** – Library to access the QEMU Copy-On-Write (QCOW) image file format

## SYNOPSIS

**#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

The **libqcow\_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 "libqcow.h".

## ENVIRONMENT

None

## FILES

None

## NOTES

libqcow can be compiled with wide character support (wchar\_t).

To compile libqcow with wide character support use: *./configure* *--enable-wide-character-type=yes*\
  or define: *\_UNICODE*\
  or *UNICODE*\
  during compilation.

*LIBQCOW\_WIDE\_CHARACTER\_TYPE*\
  in libqcow/features.h can be used to determine if libqcow was compiled with wide character support.

## BUGS

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

## AUTHOR

These man pages are generated from "libqcow.h".

## 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.

## SEE ALSO

the libqcow.h include file
