libsquashfs 1.3.0
A new set of tools and libraries for working with SquashFS images
|
Encapsulates a node in the filesystem tree read by sqfs_dir_reader_get_full_hierarchy. More...
#include <dir_reader.h>
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. | |
Encapsulates a node in the filesystem tree read by sqfs_dir_reader_get_full_hierarchy.
Definition at line 114 of file dir_reader.h.
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.
node | A pointer to a tree node. |
out | Returns a pointer to a string on success, set to NULL on failure. |
sqfs_tree_node_t* children |
For directories, a linked list of children.
Definition at line 123 of file dir_reader.h.
sqfs_u32 gid |
Resolved 32 bit group ID from the inode.
Definition at line 143 of file dir_reader.h.
sqfs_inode_generic_t* inode |
Inode representing this element in the tree.
Definition at line 133 of file dir_reader.h.
sqfs_u8 name[] |
sqfs_tree_node_t* next |
Linked list next pointer for children list.
Definition at line 128 of file dir_reader.h.
sqfs_tree_node_t* parent |
Pointer to parent, NULL for the root node.
Definition at line 118 of file dir_reader.h.
sqfs_u32 uid |
Resolved 32 bit user ID from the inode.
Definition at line 138 of file dir_reader.h.