libsquashfs: sqfs_tree_node_t Struct Reference

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

Loading...
Searching...
No Matches
sqfs_tree_node_t Struct Reference

Encapsulates a node in the filesystem tree read by sqfs_dir_reader_get_full_hierarchy. More...

`#include <dir_reader.h>`

Collaboration diagram for sqfs_tree_node_t:

## Public Member Functions
SQFS_API int | sqfs_tree_node_get_path (const sqfs_tree_node_t *node, char **out)
| Recursively destroy a tree of sqfs_tree_node_t nodes.

## Data Fields
sqfs_tree_node_t * | parent
| Pointer to parent, NULL for the root node.
sqfs_tree_node_t * | children
| For directories, a linked list of children.
sqfs_tree_node_t * | next
| Linked list next pointer for children list.
sqfs_inode_generic_t * | inode
| Inode representing this element in the tree.
sqfs_u32 | uid
| Resolved 32 bit user ID from the inode.
sqfs_u32 | gid
| Resolved 32 bit group ID from the inode.
sqfs_u8 | name []
| null-terminated entry name.

## Detailed Description

Encapsulates a node in the filesystem tree read by sqfs_dir_reader_get_full_hierarchy.

Examples
  list_files.c.

Definition at line 114 of file dir_reader.h.

## Member Function Documentation

## ◆ sqfs_tree_node_get_path()

SQFS_API int sqfs_tree_node_get_path | ( | const sqfs_tree_node_t * | node,
|  | char ** | out )

Recursively destroy a tree of sqfs_tree_node_t nodes.

This function can be used to assemble an absolute path from a tree node returned by sqfs_dir_reader_get_full_hierarchy.

The function recursively walks up the tree to assemble a path string. It returns "/" for the root node and assembles paths beginning with "/" for non-root nodes. The resulting path is slash separated, but (except for the root) never ends with a slash.

While walking the node list, the function enforces various invariantes. It returns SQFS_ERROR_LINK_LOOP if the list of parent pointers is cyclical, SQFS_ERROR_CORRUPTED if any node has an empty name, or a name that contains '/' or equals ".." or ".". The function returns SQFS_ERROR_ARG_INVALID if given NULL node or the root has a name set. Additionally, the function can return overflow or allocation failures while constructing the path.

The returned string needs to be free'd with sqfs_free.

Parameters

  node | A pointer to a tree node.
  out | Returns a pointer to a string on success, set to NULL on failure.

Returns
  Zero on success, an SQFS_ERROR value on failure.

## Field Documentation

## ◆ children

sqfs_tree_node_t* children

For directories, a linked list of children.

Examples
  list_files.c.

Definition at line 123 of file dir_reader.h.

## ◆ gid

sqfs_u32 gid

Resolved 32 bit group ID from the inode.

Definition at line 143 of file dir_reader.h.

## ◆ inode

sqfs_inode_generic_t* inode

Inode representing this element in the tree.

Examples
  list_files.c.

Definition at line 133 of file dir_reader.h.

## ◆ name

sqfs_u8 name[]

null-terminated entry name.

Examples
  list_files.c.

Definition at line 148 of file dir_reader.h.

## ◆ next

sqfs_tree_node_t* next

Linked list next pointer for children list.

Examples
  list_files.c.

Definition at line 128 of file dir_reader.h.

## ◆ parent

sqfs_tree_node_t* parent

Pointer to parent, NULL for the root node.

Examples
  list_files.c.

Definition at line 118 of file dir_reader.h.

## ◆ uid

sqfs_u32 uid

Resolved 32 bit user ID from the inode.

Definition at line 138 of file dir_reader.h.

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

- include/sqfs/dir_reader.h