libsquashfs: sqfs_super_t Struct Reference

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

Loading...
Searching...
No Matches
sqfs_super_t Struct Reference

The SquashFS super block, located at the beginning of the file system to describe the layout of the filesystem. More...

`#include <super.h>`

Collaboration diagram for sqfs_super_t:

## Public Member Functions
SQFS_API int | sqfs_super_init (sqfs_super_t *super, size_t block_size, sqfs_u32 mtime, SQFS_COMPRESSOR compressor)
| Initialize the SquashFS super block.
SQFS_API int | sqfs_super_write (const sqfs_super_t *super, sqfs_file_t *file)
| Encode and write a SquashFS super block to disk.
SQFS_API int | sqfs_super_read (sqfs_super_t *super, sqfs_file_t *file)
| Read a SquashFS super block from disk, decode it and check the fields.

## Data Fields
sqfs_u32 | magic
| Magic number. Must be set to SQFS_MAGIC.
sqfs_u32 | inode_count
| Total number of inodes.
sqfs_u32 | modification_time
| Last time the filesystem was modified.
sqfs_u32 | block_size
| The data block size in bytes.
sqfs_u32 | fragment_entry_count
| The number of fragment blocks in the data area.
sqfs_u16 | compression_id
| Identifies the compressor that has been used.
sqfs_u16 | block_log
| The log2 of the block_size field for sanity checking.
sqfs_u16 | flags
| A combination of SQFS_SUPER_FLAGS flags.
sqfs_u16 | id_count
| The total number of unique user or group IDs.
sqfs_u16 | version_major
| Must be SQFS_VERSION_MAJOR.
sqfs_u16 | version_minor
| Must be SQFS_VERSION_MINOR.
sqfs_u64 | root_inode_ref
| A reference to the root inode.
sqfs_u64 | bytes_used
| Total size of the file system in bytes, not counting padding.
sqfs_u64 | id_table_start
| On-disk location of the ID table.
sqfs_u64 | xattr_id_table_start
| On-disk location of the extended attribute table (if present).
sqfs_u64 | inode_table_start
| On-disk location of the first meta data block containing the inodes.
sqfs_u64 | directory_table_start
| On-disk location of the first meta data block containing the directory entries.
sqfs_u64 | fragment_table_start
| On-disk location of the fragment table (if present).
sqfs_u64 | export_table_start
| On-disk location of the export table (if present).

## Detailed Description

The SquashFS super block, located at the beginning of the file system to describe the layout of the filesystem.

Examples
  list_files.c.

Definition at line 47 of file super.h.

## Member Function Documentation

## ◆ sqfs_super_init()

SQFS_API int sqfs_super_init | ( | sqfs_super_t * | super,
|  | size_t | block_size,
|  | sqfs_u32 | mtime,
|  | SQFS_COMPRESSOR | compressor )

Initialize the SquashFS super block.

Parameters

  super | A pointer to a super block structure.
  block_size | The uncompressed size of the data blocks in bytes.
  mtime | The modification time stamp to set.
  compressor | The compressor ID to set.

Returns
  Zero on success, an SQFS_ERROR value if one of the fields does not hold a valid value.

## ◆ sqfs_super_read()

SQFS_API int sqfs_super_read | ( | sqfs_super_t * | super,
|  | sqfs_file_t * | file )

Read a SquashFS super block from disk, decode it and check the fields.

Parameters

  super | A pointer to the super block structure to fill.
  file | A file object through which to access the filesystem image.

Returns
  Zero on success, an SQFS_ERROR value if one of the fields does not hold a valid value.

## ◆ sqfs_super_write()

SQFS_API int sqfs_super_write | ( | const sqfs_super_t * | super,
|  | sqfs_file_t * | file )

Encode and write a SquashFS super block to disk.

Parameters

  super | A pointer to the super block structure to write.
  file | A file object through which to access the filesystem image.

Returns
  Zero on success, an SQFS_ERROR value if one of the fields does not hold a valid value.

## Field Documentation

## ◆ block_log

sqfs_u16 block_log

The log2 of the block_size field for sanity checking.

Must be no less than 12 and not larger than 20.

Definition at line 91 of file super.h.

## ◆ block_size

sqfs_u32 block_size

The data block size in bytes.

Must be a power of 2, no less than 4k and not larger than 1M.

Examples
  list_files.c.

Definition at line 72 of file super.h.

## ◆ bytes_used

sqfs_u64 bytes_used

Total size of the file system in bytes, not counting padding.

Definition at line 127 of file super.h.

## ◆ compression_id

sqfs_u16 compression_id

Identifies the compressor that has been used.

Valid identifiers are in the SQFS_COMPRESSOR enum.

Examples
  list_files.c.

Definition at line 84 of file super.h.

## ◆ directory_table_start

sqfs_u64 directory_table_start

On-disk location of the first meta data block containing the directory entries.

This value must point to a location after the inode table but before the fragment, export, ID and xattr tables.

Definition at line 164 of file super.h.

## ◆ export_table_start

sqfs_u64 export_table_start

On-disk location of the export table (if present).

This value must either point to a location after directory table (and if present after the fragment table), but before the ID table, or it must be set to 0xFFFFFFFF to indicate that the table is not present.

Definition at line 183 of file super.h.

## ◆ flags

sqfs_u16 flags

A combination of SQFS_SUPER_FLAGS flags.

Most of the flags that can be set here are informative only.

Definition at line 98 of file super.h.

## ◆ fragment_entry_count

sqfs_u32 fragment_entry_count

The number of fragment blocks in the data area.

Definition at line 77 of file super.h.

## ◆ fragment_table_start

sqfs_u64 fragment_table_start

On-disk location of the fragment table (if present).

This value must either point to a location after the directory table, but before the export, ID and xattr tables, or it must be set to 0xFFFFFFFF to indicate that the table is not present.

Definition at line 173 of file super.h.

## ◆ id_count

sqfs_u16 id_count

The total number of unique user or group IDs.

Definition at line 103 of file super.h.

## ◆ id_table_start

sqfs_u64 id_table_start

On-disk location of the ID table.

This value must point to a location after the directory table and (if present) after the export and fragment tables, but before the xattr table.

Definition at line 136 of file super.h.

## ◆ inode_count

sqfs_u32 inode_count

Total number of inodes.

Definition at line 56 of file super.h.

## ◆ inode_table_start

sqfs_u64 inode_table_start

On-disk location of the first meta data block containing the inodes.

This value must point to a location before the directory table.

Definition at line 155 of file super.h.

## ◆ magic

sqfs_u32 magic

Magic number. Must be set to SQFS_MAGIC.

Definition at line 51 of file super.h.

## ◆ modification_time

sqfs_u32 modification_time

Last time the filesystem was modified.

This field counts seconds (not counting leap seconds) since 00:00, Jan 1 1970 UTC. This field is unsigned, so it expires in the year 2106 (as opposed to 2038).

Definition at line 65 of file super.h.

## ◆ root_inode_ref

sqfs_u64 root_inode_ref

A reference to the root inode.

The bits 16 to 48 hold an offset that is added to inode_table_start to get the location of the meta data block containing the inode. The lower 16 bits hold a byte offset into the uncompressed block.

Definition at line 122 of file super.h.

## ◆ version_major

sqfs_u16 version_major

Must be SQFS_VERSION_MAJOR.

Definition at line 108 of file super.h.

## ◆ version_minor

sqfs_u16 version_minor

Must be SQFS_VERSION_MINOR.

Definition at line 113 of file super.h.

## ◆ xattr_id_table_start

sqfs_u64 xattr_id_table_start

On-disk location of the extended attribute table (if present).

See sqfs_xattr_reader_t for an overview on how SquashFS stores extended attributes on disk.

This value must either point to a location after the ID table, or it must be set to 0xFFFFFFFF to indicate the table is not present.

Definition at line 147 of file super.h.

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

- include/sqfs/super.h