libsquashfs: sqfs_frag_table_t Struct Reference

libsquashfs 1.3.2 A new set of tools and libraries for working with SquashFS images

Loading...
Searching...
No Matches
sqfs_frag_table_t Struct Reference

Abstracts reading, writing and management of the fragment table. More...

`#include <frag_table.h>`

Inheritance diagram for sqfs_frag_table_t:
Collaboration diagram for sqfs_frag_table_t:

## Public Member Functions
SQFS_API sqfs_frag_table_t * | sqfs_frag_table_create (sqfs_u32 flags)
| Create a fragment table.
SQFS_API int | sqfs_frag_table_read (sqfs_frag_table_t *tbl, sqfs_file_t *file, const sqfs_super_t *super, sqfs_compressor_t *cmp)
| Load a fragment table from a SquashFS image.
SQFS_API int | sqfs_frag_table_write (sqfs_frag_table_t *tbl, sqfs_file_t *file, sqfs_super_t *super, sqfs_compressor_t *cmp)
| Write a fragment table to a SquashFS image.
SQFS_API int | sqfs_frag_table_lookup (sqfs_frag_table_t *tbl, sqfs_u32 index, sqfs_fragment_t *out)
| Resolve a fragment block index to its description.
SQFS_API int | sqfs_frag_table_append (sqfs_frag_table_t *tbl, sqfs_u64 location, sqfs_u32 size, sqfs_u32 *index)
| Append a table entry to a fragment table.
SQFS_API int | sqfs_frag_table_set (sqfs_frag_table_t *tbl, sqfs_u32 index, sqfs_u64 location, sqfs_u32 size)
| Modify an existing entry in a fragment table.
SQFS_API size_t | sqfs_frag_table_get_size (sqfs_frag_table_t *tbl)
| Get the number of entries stored in a fragment table.

## Additional Inherited Members
Static Public Member Functions inherited from sqfs_object_t
static SQFS_INLINE void | sqfs_destroy (void *obj)
| Destroy an object and free all its memory.
static SQFS_INLINE void * | sqfs_copy (const void *obj)
| Create a deep copy of an object if possible.
Data Fields inherited from sqfs_object_t
void(* | destroy )(struct sqfs_object_t *instance)
struct sqfs_object_t *(* | copy )(const struct sqfs_object_t *orig)

## Detailed Description

Abstracts reading, writing and management of the fragment table.

## Member Function Documentation

## ◆ sqfs_frag_table_append()

SQFS_API int sqfs_frag_table_append | ( | sqfs_frag_table_t * | tbl,
|  | sqfs_u64 | location,
|  | sqfs_u32 | size,
|  | sqfs_u32 * | index )

Append a table entry to a fragment table.

Parameters

  tbl | A pointer to the fragmen table object.
  location | The absolute on-disk location of the new fragment block.
  out | The size of the block. Has bit 24 set if compressed.
  index | If not NULL, returns the allocated table index.

Returns
  Zero on success, an SQFS_ERROR on failure (e.g. allocation failure).

## ◆ sqfs_frag_table_create()

SQFS_API sqfs_frag_table_t * sqfs_frag_table_create | ( | sqfs_u32 | flags | ) |

Create a fragment table.

Parameters

  flags | Currently must be set to 0, otherwise this function fails.

Returns
  A pointer to a new fragment table object on success, NULL on failure.

## ◆ sqfs_frag_table_get_size()

SQFS_API size_t sqfs_frag_table_get_size | ( | sqfs_frag_table_t * | tbl | ) |

Get the number of entries stored in a fragment table.

Parameters

  tbl | A pointer to the fragmen table object.

Returns
  The number of entries currently stored in the table.

## ◆ sqfs_frag_table_lookup()

SQFS_API int sqfs_frag_table_lookup | ( | sqfs_frag_table_t * | tbl,
|  | sqfs_u32 | index,
|  | sqfs_fragment_t * | out )

Resolve a fragment block index to its description.

Parameters

  tbl | A pointer to the fragmen table object.
  index | The index into the table.
  out | Returns the data from the table on success.

Returns
  Zero on success, an SQFS_ERROR on failure (e.g. index is out of bounds).

## ◆ sqfs_frag_table_read()

SQFS_API int sqfs_frag_table_read | ( | sqfs_frag_table_t * | tbl,
|  | sqfs_file_t * | file,
|  | const sqfs_super_t * | super,
|  | sqfs_compressor_t * | cmp )

Load a fragment table from a SquashFS image.

Parameters

  tbl | The fragment table object to load into.
  file | The file to load the table from.
  super | The super block that describes the location and size of the table.
  cmp | The compressor to use for uncompressing the table.

Returns
  Zero on success, an SQFS_ERROR on failure.

## ◆ sqfs_frag_table_set()

SQFS_API int sqfs_frag_table_set | ( | sqfs_frag_table_t * | tbl,
|  | sqfs_u32 | index,
|  | sqfs_u64 | location,
|  | sqfs_u32 | size )

Modify an existing entry in a fragment table.

Parameters

  tbl | A pointer to the fragmen table object.
  index | The fragment table index.
  location | The absolute on-disk location of the fragment block.
  out | The size of the block. Has bit 24 set if compressed.

Returns
  Zero on success, an SQFS_ERROR on failure (e.g. out of bounds).

## ◆ sqfs_frag_table_write()

SQFS_API int sqfs_frag_table_write | ( | sqfs_frag_table_t * | tbl,
|  | sqfs_file_t * | file,
|  | sqfs_super_t * | super,
|  | sqfs_compressor_t * | cmp )

Write a fragment table to a SquashFS image.

The data from the table is compressed and appended to the given file. The information about the tables size and location are stored in the given super block. Super block flags are updated as well.

Parameters

  tbl | The fragment table object to store on disk.
  file | The file to append the table to.
  super | The super block that should be updated with the location and size of the table.
  cmp | The compressor to use for compressing the table.

Returns
  Zero on success, an SQFS_ERROR on failure.

The documentation for this struct was generated from the following file:

- include/sqfs/frag_table.h