xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

node.h File Reference
#include "libisofs.h"
#include "stream.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for node.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  iso_extended_info
 
struct  Iso_Node
 
struct  Iso_Dir
 
struct  Iso_File
 
struct  Iso_Symlink
 
struct  Iso_Special
 
struct  iso_dir_iter_iface
 
struct  Iso_Dir_Iter
 
struct  zisofs_zf_info
 

Macros

#define LIBISOFS_NODE_NAME_MAX   255
 
#define LIBISOFS_NODE_PATH_MAX   1024
 

Typedefs

typedef struct iso_extended_info IsoExtendedInfo
 

Functions

int iso_node_new_root (IsoDir **root)
 
int iso_node_new_dir (char *name, IsoDir **dir)
 
int iso_node_new_file (char *name, IsoStream *stream, IsoFile **file)
 
int iso_node_new_symlink (char *name, char *dest, IsoSymlink **link)
 
int iso_node_new_special (char *name, mode_t mode, dev_t dev, IsoSpecial **special)
 
int iso_node_is_valid_name (const char *name)
 
int iso_node_is_valid_link_dest (const char *dest)
 
void iso_dir_find (IsoDir *dir, const char *name, IsoNode ***pos)
 
int iso_dir_exists (IsoDir *dir, const char *name, IsoNode ***pos)
 
int iso_dir_insert (IsoDir *dir, IsoNode *node, IsoNode **pos, enum iso_replace_mode replace)
 
int iso_dir_iter_register (IsoDirIter *iter)
 
void iso_dir_iter_unregister (IsoDirIter *iter)
 
void iso_notify_dir_iters (IsoNode *node, int flag)
 
int iso_node_set_perms_internal (IsoNode *node, mode_t mode, int flag)
 
int iso_aa_get_acl_text (unsigned char *aa_string, mode_t st_mode, char **access_text, char **default_text, int flag)
 
int iso_aa_get_attrs (unsigned char *aa_string, size_t *num_attrs, char ***names, size_t **value_lengths, char ***values, int flag)
 
int iso_aa_lookup_attr (unsigned char *aa_string, char *name, size_t *value_length, char **value, int flag)
 
int zisofs_zf_xinfo_func (void *data, int flag)
 
int iso_file_zf_by_magic (IsoFile *file, int flag)
 
int iso_node_get_id (IsoNode *node, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id, int flag)
 
int iso_node_set_unique_id (IsoNode *node, IsoImage *image, int flag)
 
int iso_node_set_ino (IsoNode *node, ino_t ino, int flag)
 
int iso_node_cmp_flag (IsoNode *n1, IsoNode *n2, int flag)
 
int iso_file_set_isofscx (IsoFile *file, unsigned int checksum_index, int flag)
 
int iso_root_set_isofsca (IsoNode *node, uint32_t start_lba, uint32_t end_lba, uint32_t count, uint32_t size, char *typetext, int flag)
 
int iso_root_get_isofsca (IsoNode *node, uint32_t *start_lba, uint32_t *end_lba, uint32_t *count, uint32_t *size, char typetext[81], int flag)
 
int iso_root_set_isofsnt (IsoNode *node, uint32_t truncate_mode, uint32_t truncate_length, int flag)
 
int iso_root_get_isofsnt (IsoNode *node, uint32_t *truncate_mode, uint32_t *truncate_length, int flag)
 
int iso_node_clone_xinfo (IsoNode *from_node, IsoNode *to_node, int flag)
 
int iso_px_ino_xinfo_func (void *data, int flag)
 
int iso_px_ino_xinfo_cloner (void *old_data, void **new_data, int flag)
 
int zisofs_zf_xinfo_cloner (void *old_data, void **new_data, int flag)
 
int iso_dir_get_node_trunc (IsoDir *dir, int truncate_length, const char *name, IsoNode **node)
 

Macro Definition Documentation

◆ LIBISOFS_NODE_NAME_MAX

#define LIBISOFS_NODE_NAME_MAX   255

Definition at line 43 of file node.h.

◆ LIBISOFS_NODE_PATH_MAX

#define LIBISOFS_NODE_PATH_MAX   1024

Definition at line 53 of file node.h.

Typedef Documentation

◆ IsoExtendedInfo

The extended information is a way to attach additional information to each IsoNode. External applications may want to use this extension system to store application specific information related to each node. On the other side, libisofs may make use of this struct to attach information to nodes in some particular, uncommon, cases, without incrementing the size of the IsoNode struct.

It is implemented like a chained list.

Definition at line 1 of file node.h.

Function Documentation

◆ iso_aa_get_acl_text()

int iso_aa_get_acl_text ( unsigned char *  aa_string,
mode_t  st_mode,
char **  access_text,
char **  default_text,
int  flag 
)

Like iso_node_get_acl_text() with param node replaced by aa_string and st_mode from where to obtain the ACLs. All other parameter specs apply.

Definition at line 2180 of file node.c.

References iso_aa_get_attrs(), and iso_attr_get_acl_text().

Referenced by default_create_node(), and src_aa_to_node().

◆ iso_aa_get_attrs()

int iso_aa_get_attrs ( unsigned char *  aa_string,
size_t *  num_attrs,
char ***  names,
size_t **  value_lengths,
char ***  values,
int  flag 
)

Backend of iso_node_get_attrs() with parameter node replaced by the AAIP string from where to get the attribute list. All other parameter specs apply.

Definition at line 1647 of file node.c.

References aaip_count_bytes(), aaip_decode_attrs(), aaip_get_decoded_attrs(), attrs_cleanout_name(), and ISO_AAIP_BAD_AASTRING.

Referenced by iso_aa_get_acl_text(), iso_aa_lookup_attr(), and iso_node_get_attrs().

◆ iso_aa_lookup_attr()

int iso_aa_lookup_attr ( unsigned char *  aa_string,
char *  name,
size_t *  value_length,
char **  value,
int  flag 
)

Search given name. Eventually calloc() and copy value. Add trailing 0 byte for caller convenience.

Returns
1= found , 0= not found , <0 error

Definition at line 1724 of file node.c.

References iso_aa_get_attrs(), and ISO_OUT_OF_MEM.

Referenced by iso_image_import(), and iso_node_lookup_attr().

◆ iso_dir_exists()

int iso_dir_exists ( IsoDir dir,
const char *  name,
IsoNode ***  pos 
)

Check if a node with the given name exists in a dir.

Parameters
dirA valid dir. It can't be NULL
nameThe node name to search for. It can't be NULL
posIf not NULL, will be filled with the position where to insert. If the node exists, (**pos) will refer to the given node.
Returns
1 if node exists, 0 if not

Definition at line 1338 of file node.c.

References iso_dir_find().

Referenced by iso_add_dir_src_rec(), iso_dir_get_node(), iso_tree_add_new_cut_out_node(), iso_tree_add_new_dir(), iso_tree_add_new_file(), iso_tree_add_new_node(), iso_tree_add_new_special(), iso_tree_add_new_symlink(), iso_tree_add_node_builder(), and make_really_unique_name().

◆ iso_dir_find()

void iso_dir_find ( IsoDir dir,
const char *  name,
IsoNode ***  pos 
)

Find the position where to insert a node

Parameters
dirA valid dir. It can't be NULL
nameThe node name to search for. It can't be NULL
posWill be filled with the position where to insert. It can't be NULL

Definition at line 1330 of file node.c.

References Iso_Dir::children.

Referenced by iso_dir_add_node(), and iso_dir_exists().

◆ iso_dir_get_node_trunc()

int iso_dir_get_node_trunc ( IsoDir dir,
int  truncate_length,
const char *  name,
IsoNode **  node 
)

◆ iso_dir_insert()

int iso_dir_insert ( IsoDir dir,
IsoNode node,
IsoNode **  pos,
enum iso_replace_mode  replace 
)

Inserts a given node in a dir, at the specified position.

Parameters
dirDir where to insert. It can't be NULL
nodeThe node to insert. It can't be NULL
posPosition where the node will be inserted. It is a pointer previously obtained with a call to iso_dir_exists() or iso_dir_find(). It can't be NULL.
replaceWhether to replace an old node with the same name with the new node.
Returns
If success, number of children in dir. < 0 on error

Definition at line 1349 of file node.c.

References ISO_ASSERT_FAILURE, ISO_NODE_NAME_NOT_UNIQUE, iso_node_unref(), ISO_REPLACE_ALWAYS, ISO_REPLACE_IF_NEWER, ISO_REPLACE_IF_SAME_TYPE, ISO_REPLACE_IF_SAME_TYPE_AND_NEWER, ISO_REPLACE_NEVER, Iso_Node::mode, Iso_Node::mtime, Iso_Node::name, Iso_Dir::nchildren, Iso_Node::next, and Iso_Node::parent.

Referenced by iso_add_dir_src_rec(), iso_dir_add_node(), iso_tree_add_new_cut_out_node(), iso_tree_add_new_dir(), iso_tree_add_new_file(), iso_tree_add_new_node(), iso_tree_add_new_special(), iso_tree_add_new_symlink(), and iso_tree_add_node_builder().

◆ iso_dir_iter_register()

int iso_dir_iter_register ( IsoDirIter iter)

Add a new iterator to the registry. The iterator register keeps track of all iterators being used, and are notified when directory structure changes.

Definition at line 1418 of file node.c.

References ISO_OUT_OF_MEM, ISO_SUCCESS, iter_reg_node::iter, and iter_reg.

Referenced by iso_dir_find_children(), and iso_dir_get_children().

◆ iso_dir_iter_unregister()

void iso_dir_iter_unregister ( IsoDirIter iter)

Unregister a directory iterator.

Definition at line 1434 of file node.c.

References iter_reg_node::iter, iter_reg, and iter_reg_node::next.

Referenced by iso_dir_iter_free().

◆ iso_file_set_isofscx()

int iso_file_set_isofscx ( IsoFile file,
unsigned int  checksum_index,
int  flag 
)

Set the checksum index (typically coming from IsoFileSrc.checksum_index) of a regular file node. The index is encoded as xattr "isofs.cx" with four bytes of value.

Definition at line 2887 of file node.c.

References iso_node_set_attrs().

Referenced by checksum_prepare_nodes(), iso_file_src_create(), and process_preserved_cx().

◆ iso_file_zf_by_magic()

int iso_file_zf_by_magic ( IsoFile file,
int  flag 
)

Checks whether a file effectively bears a zisofs file header and eventually marks this by a struct zisofs_zf_info as xinfo of the file node.

Parameters
flagbit0= inquire the most original stream of the file bit1= permission to overwrite existing zisofs_zf_info bit2= if no zisofs header is found: create xinfo with parameters which indicate no zisofs
Returns
1= zf xinfo added, 0= no zisofs data found , 2= found existing zf xinfo and flag bit1 was not set <0 means error

Definition at line 2448 of file node.c.

References zisofs_zf_info::block_size_log2, zisofs_zf_info::header_size_div4, iso_file_get_stream(), iso_node_add_xinfo(), iso_node_get_xinfo(), iso_node_remove_xinfo(), ISO_OUT_OF_MEM, iso_stream_get_input_stream(), zisofs_zf_info::uncompressed_size, ziso_is_zisofs_stream(), zisofs_zf_info::zisofs_algo, and zisofs_zf_xinfo_func().

Referenced by iso_node_zf_by_magic().

◆ iso_node_clone_xinfo()

int iso_node_clone_xinfo ( IsoNode from_node,
IsoNode to_node,
int  flag 
)

Copy the xinfo list from one node to the another.

Definition at line 286 of file node.c.

References iso_node_add_xinfo(), iso_node_get_next_xinfo(), iso_node_remove_all_xinfo(), iso_node_revert_xinfo_list(), iso_node_xinfo_get_cloner(), and ISO_XINFO_NO_CLONE.

Referenced by iso_tree_copy_node_attr().

◆ iso_node_cmp_flag()

◆ iso_node_get_id()

◆ iso_node_is_valid_link_dest()

int iso_node_is_valid_link_dest ( const char *  dest)

Check if a given path is valid for the destination of a link.

Returns
1 if yes, 0 if not

Definition at line 1283 of file node.c.

References iso_node_is_valid_name(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_RR_NAME_RESERVED, ISO_RR_PATH_TOO_LONG, and LIBISOFS_NODE_PATH_MAX.

Referenced by iso_node_new_symlink(), and iso_symlink_set_dest().

◆ iso_node_is_valid_name()

int iso_node_is_valid_name ( const char *  name)

Check if a given name is valid for an iso node.

Returns
1 if yes, <0 if not. The value is a specific ISO_* error code.

Check if a given name is valid for an iso node.

Returns
1 if yes, 0 if not

Definition at line 1245 of file node.c.

References ISO_NULL_POINTER, ISO_RR_NAME_RESERVED, ISO_RR_NAME_TOO_LONG, and LIBISOFS_NODE_NAME_MAX.

Referenced by iso_node_is_valid_link_dest(), iso_node_new_dir(), iso_node_new_file(), iso_node_new_special(), iso_node_new_symlink(), iso_node_set_name_trunc(), and iso_tree_add_boot_node().

◆ iso_node_new_dir()

int iso_node_new_dir ( char *  name,
IsoDir **  dir 
)

Create a new IsoDir. Attributes, uid/gid, timestamps, etc are set to default (0) values. You must set them.

Parameters
nameName for the node. It is not strdup() so you shouldn't use this reference when this function returns successfully. NULL is not allowed.
dir
Returns
1 on success, < 0 on error.

Definition at line 1481 of file node.c.

References iso_node_is_valid_name(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, and LIBISO_DIR.

Referenced by default_create_node(), and iso_tree_add_new_dir().

◆ iso_node_new_file()

int iso_node_new_file ( char *  name,
IsoStream stream,
IsoFile **  file 
)

Create a new file node. Attributes, uid/gid, timestamps, etc are set to default (0) values. You must set them.

Parameters
nameName for the node. It is not strdup() so you shouldn't use this reference when this function returns successfully. NULL is not allowed.
streamSource for file contents. The reference is taken by the node, you must call iso_stream_ref() if you need your own ref.
Returns
1 on success, < 0 on error.

Definition at line 1507 of file node.c.

References iso_node_is_valid_name(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, and LIBISO_FILE.

Referenced by default_create_file(), default_create_node(), and iso_tree_add_new_file().

◆ iso_node_new_root()

◆ iso_node_new_special()

int iso_node_new_special ( char *  name,
mode_t  mode,
dev_t  dev,
IsoSpecial **  special 
)

Create a new special file node. As far as libisofs concerns, an special file is a block device, a character device, a FIFO (named pipe) or a socket. You can choose the specific kind of file you want to add by setting mode properly (see man 2 stat).

Note that special files are only written to image when Rock Ridge extensions are enabled. Moreover, a special file is just a directory entry in the image tree, no data is written beyond that.

Owner and hidden atts are taken from parent. You can modify any of them later.

Parameters
namename for the new special file. It is not strdup() so you shouldn't use this reference when this function returns successfully. NULL is not allowed.
modefile type and permissions for the new node. Note that you can't specify any kind of file here, only special types are allowed. i.e, S_IFSOCK, S_IFBLK, S_IFCHR and S_IFIFO are valid types; S_IFLNK, S_IFREG and S_IFDIR aren't.
devdevice ID, equivalent to the st_rdev field in man 2 stat.
specialplace where to store a pointer to the newly created special file.
Returns
1 on success, < 0 otherwise

Definition at line 1573 of file node.c.

References iso_node_is_valid_name(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, ISO_WRONG_ARG_VALUE, and LIBISO_SPECIAL.

Referenced by default_create_node(), and iso_tree_add_new_special().

◆ iso_node_new_symlink()

int iso_node_new_symlink ( char *  name,
char *  dest,
IsoSymlink **  link 
)

Creates a new IsoSymlink node. Attributes, uid/gid, timestamps, etc are set to default (0) values. You must set them.

Parameters
namename for the new symlink. It is not strdup() so you shouldn't use this reference when this function returns successfully. NULL is not allowed.
destdestination of the link. It is not strdup() so you shouldn't use this reference when this function returns successfully. NULL is not allowed.
linkplace where to store a pointer to the newly created link.
Returns
1 on success, < 0 otherwise

Definition at line 1538 of file node.c.

References iso_node_is_valid_link_dest(), iso_node_is_valid_name(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, and LIBISO_SYMLINK.

Referenced by default_create_node(), and iso_tree_add_new_symlink().

◆ iso_node_set_ino()

◆ iso_node_set_perms_internal()

int iso_node_set_perms_internal ( IsoNode node,
mode_t  mode,
int  flag 
)

See API function iso_node_set_permissions()

Parameters
flagbit0= do not adjust ACL
Returns
>0 success , <0 error

Definition at line 430 of file node.c.

References iso_node_set_acl_text(), and Iso_Node::mode.

Referenced by default_create_node(), iso_node_set_acl_text(), and iso_node_set_permissions().

◆ iso_node_set_unique_id()

int iso_node_set_unique_id ( IsoNode node,
IsoImage image,
int  flag 
)

Definition at line 2718 of file node.c.

References img_give_ino_number(), and iso_node_set_ino().

Referenced by img_update_ino().

◆ iso_notify_dir_iters()

void iso_notify_dir_iters ( IsoNode node,
int  flag 
)

◆ iso_px_ino_xinfo_cloner()

int iso_px_ino_xinfo_cloner ( void *  old_data,
void **  new_data,
int  flag 
)

Definition at line 2571 of file node.c.

References ISO_OUT_OF_MEM, and ISO_XINFO_NO_CLONE.

Referenced by iso_init_with_flag().

◆ iso_px_ino_xinfo_func()

int iso_px_ino_xinfo_func ( void *  data,
int  flag 
)

The iso_node_xinfo_func instance which governs the storing of the inode number from Rock Ridge field PX.

Definition at line 2559 of file node.c.

Referenced by iso_init_with_flag(), iso_node_get_id(), iso_node_set_ino(), and iso_node_set_ino_xinfo().

◆ iso_root_get_isofsca()

int iso_root_get_isofsca ( IsoNode node,
uint32_t *  start_lba,
uint32_t *  end_lba,
uint32_t *  count,
uint32_t *  size,
char  typetext[81],
int  flag 
)

Get the checksum area description. node should be the root node. It is encoded as xattr "isofs.ca".

Definition at line 2941 of file node.c.

References iso_node_lookup_attr(), ISO_SUCCESS, and iso_util_decode_len_bytes().

Referenced by iso_image_import().

◆ iso_root_get_isofsnt()

int iso_root_get_isofsnt ( IsoNode node,
uint32_t *  truncate_mode,
uint32_t *  truncate_length,
int  flag 
)

Definition at line 3001 of file node.c.

References iso_node_lookup_attr(), ISO_SUCCESS, and iso_util_decode_len_bytes().

Referenced by iso_image_import().

◆ iso_root_set_isofsca()

int iso_root_set_isofsca ( IsoNode node,
uint32_t  start_lba,
uint32_t  end_lba,
uint32_t  count,
uint32_t  size,
char *  typetext,
int  flag 
)

Set the checksum area description. node should be the root node. It is encoded as xattr "isofs.ca".

Definition at line 2910 of file node.c.

References iso_node_set_attrs(), and iso_util_encode_len_bytes().

Referenced by checksum_prepare_image(), checksum_writer_compute_data_blocks(), and ecma119_writer_write_dirs().

◆ iso_root_set_isofsnt()

int iso_root_set_isofsnt ( IsoNode node,
uint32_t  truncate_mode,
uint32_t  truncate_length,
int  flag 
)

Record and get truncation parameters as of iso_image_set_truncate_mode() by "isofs.nt".

Definition at line 2982 of file node.c.

References iso_node_set_attrs(), and iso_util_encode_len_bytes().

Referenced by ecma119_image_new().

◆ zisofs_zf_xinfo_cloner()

int zisofs_zf_xinfo_cloner ( void *  old_data,
void **  new_data,
int  flag 
)

Definition at line 2423 of file node.c.

References ISO_OUT_OF_MEM, and ISO_XINFO_NO_CLONE.

Referenced by iso_init_with_flag().

◆ zisofs_zf_xinfo_func()

int zisofs_zf_xinfo_func ( void *  data,
int  flag 
)

Function to identify and manage ZF parameters which do not stem from ZF fields (those are known to the FileSource) and do not stem from filters ("ziso" knows them globally, "osiz" knows them individually) but rather from an inspection of the file content header for zisofs magic number and plausible parameters. The parameters get attached in struct zisofs_zf_info as xinfo to an IsoNode.

Definition at line 2411 of file node.c.

Referenced by add_zf_field(), iso_file_zf_by_magic(), iso_init_with_flag(), and iso_node_zf_by_magic().