Modulemd Compression Helpers (Private)

Modulemd Compression Helpers (Private) — Internal utility functions for working with compressed files.

Stability Level

Private, unless otherwise indicated

Functions

Description

Functions

mmd_Fclose ()

void
mmd_Fclose (FD_t fd);

Wrapper for rpmio's Fclose() function to use with G_DEFINE_AUTO_CLEANUP_FREE_FUNC()

Parameters

fd

A FD_t from rpmio.h to be closed.

[in]

Since: 2.8


modulemd_detect_compression ()

ModulemdCompressionTypeEnum
modulemd_detect_compression (const gchar *filename,
                             int fd,
                             GError **error);

Parameters

filename

The original filename that matches fd .

[in]

fd

An open file descriptor pointing at a real file.

[in]

error

A GError containing the reason this function failed.

[out]

Returns

The ModulemdCompressionTypeEnum detected from this file descriptor. In the event of an error, returns MODULEMD_COMPRESSION_TYPE_DETECTION_FAILED and sets error appropriately. Returns MODULEMD_COMPRESSION_TYPE_UNKNOWN_COMPRESSION if all detection methods complete but the type is still indeterminate.

Since: 2.8


modulemd_compression_suffix ()

const gchar *
modulemd_compression_suffix (ModulemdCompressionTypeEnum comtype);

Parameters

comtype

A ModulemdCompressionTypeEnum.

[in]

Returns

A static string representing the filename suffix that a file of this compression type should have.

[transfer none]

Since: 2.8


modulemd_get_rpmio_fmode ()

gchar *
modulemd_get_rpmio_fmode (const gchar *mode,
                          ModulemdCompressionTypeEnum comtype);

Parameters

mode

A mode argument that will be passed to fopen(3).

[in]

comtype

A ModulemdCompressionTypeEnum.

[in]

Returns

A string suitable for passing to rpmio's Fopen() function. NULL if mode is NULL or the comtype is invalid.

[transfer full]

Since: 2.8


compressed_stream_read_fn ()

gint
compressed_stream_read_fn (void *data,
                           unsigned char *buffer,
                           size_t size,
                           size_t *size_read);

A ModulemdReadHandler that uses rpmio's Fread() function to handle compressed files.

Parameters

data

A private pointer to the data being read.

[inout]

buffer

The buffer to write the data from the source.

[out]

size

The size of the buffer.

[in]

size_read

The actual number of bytes read from the source.

[out]

Since: 2.8