libsquashfs 1.3.0
A new set of tools and libraries for working with SquashFS images
Loading...
Searching...
No Matches
sqfs_id_table_t Struct Reference

A simple data structure that encapsulates ID to index mapping for user and group IDs. More...

#include <id_table.h>

Inheritance diagram for sqfs_id_table_t:
Inheritance graph
Collaboration diagram for sqfs_id_table_t:
Collaboration graph

Public Member Functions

SQFS_API sqfs_id_table_tsqfs_id_table_create (sqfs_u32 flags)
 Create an ID table object.
 
SQFS_API int sqfs_id_table_id_to_index (sqfs_id_table_t *tbl, sqfs_u32 id, sqfs_u16 *out)
 Resolve a 32 bit ID to a unique 16 bit index.
 
SQFS_API int sqfs_id_table_write (sqfs_id_table_t *tbl, sqfs_file_t *file, sqfs_super_t *super, sqfs_compressor_t *cmp)
 Write an ID table to disk.
 
SQFS_API int sqfs_id_table_read (sqfs_id_table_t *tbl, sqfs_file_t *file, const sqfs_super_t *super, sqfs_compressor_t *cmp)
 Read an ID table from disk.
 
SQFS_API int sqfs_id_table_index_to_id (const sqfs_id_table_t *tbl, sqfs_u16 index, sqfs_u32 *out)
 Resolve a 16 bit index to a 32 bit ID.
 

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

A simple data structure that encapsulates ID to index mapping for user and group IDs.

SquashFS does not store user and group IDs in inodes directly. Instead, it collects the unique 32 bit IDs in a table with at most 64k entries and stores a 16 bit index into the inode. This allows SquashFS to only have 16 bit UID/GID entries in the inodes but actually have 32 bit UIDs/GIDs under the hood (at least 64k selected ones).

Examples
list_files.c.

Member Function Documentation

◆ sqfs_id_table_create()

SQFS_API sqfs_id_table_t * sqfs_id_table_create ( sqfs_u32  flags)

Create an ID table object.

Parameters
flagsCurrently must be set to 0 or creating the table fails.
Returns
A pointer to an ID table object, NULL on allocation failure.

◆ sqfs_id_table_id_to_index()

SQFS_API int sqfs_id_table_id_to_index ( sqfs_id_table_t tbl,
sqfs_u32  id,
sqfs_u16 *  out 
)

Resolve a 32 bit ID to a unique 16 bit index.

Parameters
tblA pointer to an ID table object.
idThe ID to resolve.
outReturns the unique table index.
Returns
Zero on success, an SQFS_ERROR on failure.

◆ sqfs_id_table_index_to_id()

SQFS_API int sqfs_id_table_index_to_id ( const sqfs_id_table_t tbl,
sqfs_u16  index,
sqfs_u32 *  out 
)

Resolve a 16 bit index to a 32 bit ID.

Parameters
tblA pointer to an ID table object.
indexThe table index to resolve.
outReturns the underlying 32 bit ID that the index maps to.
Returns
Zero on success, an SQFS_ERROR on failure.

◆ sqfs_id_table_read()

SQFS_API int sqfs_id_table_read ( sqfs_id_table_t tbl,
sqfs_file_t file,
const sqfs_super_t super,
sqfs_compressor_t cmp 
)

Read an ID table from disk.

Parameters
tblA pointer to an ID table object.
fileThe underlying file to read the table from.
superA pointer to a super block from which to get the ID table location.
cmpA compressor to use to extract compressed table blocks.
Returns
Zero on success, an SQFS_ERROR on failure.

◆ sqfs_id_table_write()

SQFS_API int sqfs_id_table_write ( sqfs_id_table_t tbl,
sqfs_file_t file,
sqfs_super_t super,
sqfs_compressor_t cmp 
)

Write an ID table to disk.

Parameters
tblA pointer to an ID table object.
fileThe underlying file to append the table to.
superA pointer to a super block in which to store the ID table start location.
cmpA compressor to use to compress the ID table.
Returns
Zero on success, an SQFS_ERROR on failure.

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