libsquashfs: sqfs_file_t Interface Reference

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

Loading...
Searching...
No Matches
sqfs_file_t Interface Reference

Abstracts file I/O to make it easy to embedd SquashFS. More...

`#include <io.h>`

Inheritance diagram for sqfs_file_t:
Collaboration diagram for sqfs_file_t:

## Data Fields
sqfs_object_t | base
int(* | read_at )(sqfs_file_t *file, sqfs_u64 offset, void *buffer, size_t size)
| Read a chunk of data from an absolute position.
int(* | write_at )(sqfs_file_t *file, sqfs_u64 offset, const void *buffer, size_t size)
| Write a chunk of data at an absolute position.
sqfs_u64(* | get_size )(const sqfs_file_t *file)
| Get the number of bytes currently stored in the file.
int(* | truncate )(sqfs_file_t *file, sqfs_u64 size)
| Extend or shrink a file to a specified size.
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)

## 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.

## Detailed Description

Abstracts file I/O to make it easy to embedd SquashFS.

Files are only copyable if they are read only, i.e. if a file has been opened with write access, sqfs_copy will always return NULL. The other data types inside libsquashfs assume this to hold for all implementations of this interface.

Examples
  list_files.c.

Definition at line 94 of file io.h.

## Field Documentation

## ◆ base

sqfs_object_t base

Definition at line 95 of file io.h.

## ◆ get_size

sqfs_u64(* get_size) (const sqfs_file_t *file)

Get the number of bytes currently stored in the file.

Parameters

  file | A pointer to the file object.

Definition at line 132 of file io.h.

## ◆ read_at

int(* read_at) (sqfs_file_t *file, sqfs_u64 offset, void *buffer, size_t size)

Read a chunk of data from an absolute position.

Parameters

  file | A pointer to the file object.
  offset | An absolute offset to read data from.
  buffer | A pointer to a buffer to copy the data to.
  size | The number of bytes to read from the file.

Returns
  Zero on success, an SQFS_ERROR identifier on failure that the data structures in libsquashfs that use this return directly to the caller.

Definition at line 109 of file io.h.

## ◆ truncate

int(* truncate) (sqfs_file_t *file, sqfs_u64 size)

Extend or shrink a file to a specified size.

Parameters

  file | A pointer to the file object.
  size | The new capacity of the file in bytes.

Returns
  Zero on success, an SQFS_ERROR identifier on failure that the data structures in libsquashfs that use this return directly to the caller.

Definition at line 144 of file io.h.

## ◆ write_at

int(* write_at) (sqfs_file_t *file, sqfs_u64 offset, const void *buffer, size_t size)

Write a chunk of data at an absolute position.

Parameters

  file | A pointer to the file object.
  offset | An absolute offset to write data to.
  buffer | A pointer to a buffer to write to the file.
  size | The number of bytes to write from the buffer.

Returns
  Zero on success, an SQFS_ERROR identifier on failure that the data structures in libsquashfs that use this return directly to the caller.

Definition at line 124 of file io.h.

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

- include/sqfs/io.h