fu-archive

fu-archive

Functions

Types and Values

Description

Functions

FuArchiveIterateFunc ()

gboolean
(*FuArchiveIterateFunc) (FuArchive *self,
                         const gchar *filename,
                         GBytes *bytes,
                         gpointer user_data,
                         GError **error);

The archive iteration callback.

Parameters

self

a FuArchive

 

filename

a filename

 

bytes

the blob referenced by filename

 

user_data

user data

 

error

a GError or NULL

 

fu_archive_format_to_string ()

const gchar *
fu_archive_format_to_string (FuArchiveFormat format);

Converts an enumerated format to a string.

Parameters

format

a format, e.g. FU_ARCHIVE_FORMAT_ZIP

 

Returns

identifier string

Since: 1.8.1


fu_archive_format_from_string ()

FuArchiveFormat
fu_archive_format_from_string (const gchar *format);

Converts a string to an enumerated format.

Parameters

format

a string, e.g. zip.

[nullable]

Returns

enumerated value

Since: 1.8.1


fu_archive_compression_from_string ()

FuArchiveCompression
fu_archive_compression_from_string (const gchar *compression);

Converts a string to an enumerated compression.

Parameters

compression

a string, e.g. zip.

[nullable]

Returns

enumerated value

Since: 1.8.1


fu_archive_compression_to_string ()

const gchar *
fu_archive_compression_to_string (FuArchiveCompression compression);

Converts an enumerated compression to a string.

Parameters

compression

a compression, e.g. FU_ARCHIVE_COMPRESSION_ZIP

 

Returns

identifier string

Since: 1.8.1


fu_archive_new ()

FuArchive *
fu_archive_new (GBytes *data,
                FuArchiveFlags flags,
                GError **error);

Parses data as an archive and decompresses all files to memory blobs.

If data is unspecified then a new empty archive is created.

Parameters

data

archive contents.

[nullable]

flags

archive flags, e.g. FU_ARCHIVE_FLAG_NONE

 

error

optional return location for an error.

[nullable]

Returns

a FuArchive, or NULL if the archive was invalid in any way.

Since: 1.2.2


fu_archive_add_entry ()

void
fu_archive_add_entry (FuArchive *self,
                      const gchar *fn,
                      GBytes *blob);

Adds, or replaces an entry to an archive.

Parameters

self

a FuArchive

 

fn

a filename.

[not nullable]

blob

a GBytes.

[not nullable]

Since: 1.8.1


fu_archive_lookup_by_fn ()

GBytes *
fu_archive_lookup_by_fn (FuArchive *self,
                         const gchar *fn,
                         GError **error);

Finds the blob referenced by filename

Parameters

self

a FuArchive

 

fn

a filename

 

error

optional return location for an error.

[nullable]

Returns

a GBytes, or NULL if the filename was not found.

[transfer none]

Since: 1.2.2


fu_archive_write ()

GBytes *
fu_archive_write (FuArchive *self,
                  FuArchiveFormat format,
                  FuArchiveCompression compression,
                  GError **error);

Writes an archive with specified format and compression .

Parameters

self

a FuArchive

 

format

a compression, e.g. FU_ARCHIVE_FORMAT_ZIP

 

compression

a compression, e.g. FU_ARCHIVE_COMPRESSION_NONE

 

error

optional return location for an error.

[nullable]

Returns

the archive blob.

[transfer full]

Since: 1.8.1


fu_archive_iterate ()

gboolean
fu_archive_iterate (FuArchive *self,
                    FuArchiveIterateFunc callback,
                    gpointer user_data,
                    GError **error);

Iterates over the archive contents, calling the given function for each of the files found. If any callback returns FALSE scanning is aborted.

Parameters

self

a FuArchive

 

callback

a FuArchiveIterateFunc.

[scope call]

user_data

user data

 

error

optional return location for an error.

[nullable]

Returns

True if no callback returned FALSE

Since: 1.3.4

Types and Values

FU_TYPE_ARCHIVE

#define FU_TYPE_ARCHIVE (fu_archive_get_type())

enum FuArchiveFlags

The flags to use when loading the archive.

Members

FU_ARCHIVE_FLAG_NONE

No flags set

 

FU_ARCHIVE_FLAG_IGNORE_PATH

Ignore any path component

 

enum FuArchiveFormat

The archive format.

Members

FU_ARCHIVE_FORMAT_UNKNOWN

unknown

 

FU_ARCHIVE_FORMAT_CPIO

ASCII cpio

 

FU_ARCHIVE_FORMAT_SHAR

shar

 

FU_ARCHIVE_FORMAT_TAR

tar

 

FU_ARCHIVE_FORMAT_USTAR

POSIX ustar

 

FU_ARCHIVE_FORMAT_PAX

restricted POSIX pax interchange

 

FU_ARCHIVE_FORMAT_GNUTAR

GNU tar

 

FU_ARCHIVE_FORMAT_ISO9660

ISO9660

 

FU_ARCHIVE_FORMAT_ZIP

ZIP

 

FU_ARCHIVE_FORMAT_AR

ar (BSD)

 

FU_ARCHIVE_FORMAT_AR_SVR4

ar (GNU/SVR4)

 

FU_ARCHIVE_FORMAT_MTREE

mtree

 

FU_ARCHIVE_FORMAT_RAW

raw

 

FU_ARCHIVE_FORMAT_XAR

xar

 

FU_ARCHIVE_FORMAT_7ZIP

7-Zip

 

FU_ARCHIVE_FORMAT_WARC

WARC

 

enum FuArchiveCompression

The archive compression.

Members

FU_ARCHIVE_COMPRESSION_UNKNOWN

unknown

 

FU_ARCHIVE_COMPRESSION_NONE

none

 

FU_ARCHIVE_COMPRESSION_GZIP

Gzip (GNU Zip)

 

FU_ARCHIVE_COMPRESSION_BZIP2

Bzip2

 

FU_ARCHIVE_COMPRESSION_COMPRESS

compress (LZW)

 

FU_ARCHIVE_COMPRESSION_LZMA

LZMA

 

FU_ARCHIVE_COMPRESSION_XZ

XZ

 

FU_ARCHIVE_COMPRESSION_UU

Unix-to-Unix

 

FU_ARCHIVE_COMPRESSION_LZIP

LZip (LZMA)

 

FU_ARCHIVE_COMPRESSION_LRZIP

Long Range Zip (LZMA RZIP)

 

FU_ARCHIVE_COMPRESSION_LZOP

LZO

 

FU_ARCHIVE_COMPRESSION_GRZIP

GRZip

 

FU_ARCHIVE_COMPRESSION_LZ4

LZ4

 

FU_ARCHIVE_COMPRESSION_ZSTD

Zstd

 

FuArchive

typedef struct _FuArchive FuArchive;

An in-memory archive decompressor