libsquashfs: include/sqfs/predef.h File Reference

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

Loading...
Searching...
No Matches
predef.h File Reference

Includes forward declarations of data structures, macros and integer types. More...

`#include <stdbool.h>`
`#include <stddef.h>`
`#include <stdint.h>`

Go to the source code of this file.

## Data Structures
interface | sqfs_object_t
| Base interface for all libsquashfs in-memory data structures. More...

## Macros
#define | SQFS_API
#define | SQFS_INTERNAL
#define | SQFS_INLINE __inline__ __attribute__((always_inline))

## Typedefs
typedef uint8_t | sqfs_u8
typedef uint16_t | sqfs_u16
typedef uint32_t | sqfs_u32
typedef uint64_t | sqfs_u64
typedef int8_t | sqfs_s8
typedef int16_t | sqfs_s16
typedef int32_t | sqfs_s32
typedef int64_t | sqfs_s64
typedef struct sqfs_block_hooks_t | sqfs_block_hooks_t
typedef struct sqfs_block_writer_stats_t | sqfs_block_writer_stats_t

## Functions
SQFS_API void | sqfs_free (void *ptr)
| Free a block of memory created by the squashfs library.

## Detailed Description

Includes forward declarations of data structures, macros and integer types.

Definition in file predef.h.

## Macro Definition Documentation

## ◆ SQFS_API

#define SQFS_API

Definition at line 57 of file predef.h.

## ◆ SQFS_INLINE

#define SQFS_INLINE __inline__ __attribute__((always_inline))

Definition at line 65 of file predef.h.

## ◆ SQFS_INTERNAL

#define SQFS_INTERNAL

Definition at line 58 of file predef.h.

## Typedef Documentation

## ◆ sqfs_block_hooks_t

typedef struct sqfs_block_hooks_t sqfs_block_hooks_t

Definition at line 90 of file predef.h.

## ◆ sqfs_block_writer_stats_t

typedef struct sqfs_block_writer_stats_t sqfs_block_writer_stats_t

Definition at line 94 of file predef.h.

## ◆ sqfs_s16

typedef int16_t sqfs_s16

Definition at line 74 of file predef.h.

## ◆ sqfs_s32

typedef int32_t sqfs_s32

Definition at line 75 of file predef.h.

## ◆ sqfs_s64

typedef int64_t sqfs_s64

Definition at line 76 of file predef.h.

## ◆ sqfs_s8

typedef int8_t sqfs_s8

Definition at line 73 of file predef.h.

## ◆ sqfs_u16

typedef uint16_t sqfs_u16

Definition at line 69 of file predef.h.

## ◆ sqfs_u32

typedef uint32_t sqfs_u32

Definition at line 70 of file predef.h.

## ◆ sqfs_u64

typedef uint64_t sqfs_u64

Definition at line 71 of file predef.h.

## ◆ sqfs_u8

typedef uint8_t sqfs_u8

Definition at line 68 of file predef.h.

## Function Documentation

## ◆ sqfs_free()

SQFS_API void sqfs_free | ( | void * | ptr | ) |

Free a block of memory created by the squashfs library.

Some objects in the squashfs library allocate temporary chunks of memory and return pointers to them, with the expectation that the user takes care of freeing them memory again.

In the past this worked without hitches, because most sane operating systems have a single, global C library that everything is linked against. On systems like Windows that have a huge fragmentation of runtime libraries this fails, because the library and application can easily end up linked against different runtime libraries, making it impossible for the program to free the memory.

To re-create the same situation on Linux, one would have to link a program and the squashfs library dynamically, while linking at least one of them statically against the C runtime, or intentionally linking against two different runtimes.

This function mitigates the arising problem by exposing the free() function of the libraries runtime to the application, so it can propperly release memory again to the correct heap.

To maintain API/ABI compatibillity, it is guaranteed that for all versions of libsquashfs with major version 1, this function does nothing other than call free() on the C runtime that the library was linked against. If just calling free() works on your system, it will continue to work, and older application will continue to work with newer versions of libsquashfs 1.x. Going forward, new applications using libsquashfs should use this function instead for better portabillity.

Parameters

  ptr | A pointer to a memory block returned by a libsquashfs function.