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.c File Reference
#include "libisofs.h"
#include "image.h"
#include "node.h"
#include "stream.h"
#include "aaip_0_2.h"
#include "messages.h"
#include "util.h"
#include "eltorito.h"
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <stdio.h>
Include dependency graph for node.c:

Go to the source code of this file.

Data Structures

struct  dir_iter_data
 
struct  iter_reg_node
 

Functions

void iso_node_ref (IsoNode *node)
 
void iso_node_unref (IsoNode *node)
 
int iso_node_add_xinfo (IsoNode *node, iso_node_xinfo_func proc, void *data)
 
int iso_node_remove_xinfo (IsoNode *node, iso_node_xinfo_func proc)
 
int iso_node_get_xinfo (IsoNode *node, iso_node_xinfo_func proc, void **data)
 
int iso_node_get_next_xinfo (IsoNode *node, void **handle, iso_node_xinfo_func *proc, void **data)
 
int iso_node_remove_all_xinfo (IsoNode *node, int flag)
 
static int iso_node_revert_xinfo_list (IsoNode *node, int flag)
 
int iso_node_clone_xinfo (IsoNode *from_node, IsoNode *to_node, int flag)
 
enum IsoNodeType iso_node_get_type (IsoNode *node)
 
int iso_node_set_name_trunc (IsoNode *node, const char *in_name, int truncate_length, int flag)
 
int iso_node_set_name (IsoNode *node, const char *name)
 
int iso_image_set_node_name (IsoImage *image, IsoNode *node, const char *name, int flag)
 
const char * iso_node_get_name (const IsoNode *node)
 
int iso_node_set_perms_internal (IsoNode *node, mode_t mode, int flag)
 
void iso_node_set_permissions (IsoNode *node, mode_t mode)
 
mode_t iso_node_get_permissions (const IsoNode *node)
 
mode_t iso_node_get_mode (const IsoNode *node)
 
void iso_node_set_uid (IsoNode *node, uid_t uid)
 
uid_t iso_node_get_uid (const IsoNode *node)
 
void iso_node_set_gid (IsoNode *node, gid_t gid)
 
gid_t iso_node_get_gid (const IsoNode *node)
 
void iso_node_set_mtime (IsoNode *node, time_t time)
 
time_t iso_node_get_mtime (const IsoNode *node)
 
void iso_node_set_atime (IsoNode *node, time_t time)
 
time_t iso_node_get_atime (const IsoNode *node)
 
void iso_node_set_ctime (IsoNode *node, time_t time)
 
time_t iso_node_get_ctime (const IsoNode *node)
 
void iso_node_set_hidden (IsoNode *node, int hide_attrs)
 
int iso_node_get_hidden (IsoNode *node)
 
int iso_dir_add_node (IsoDir *dir, IsoNode *child, enum iso_replace_mode replace)
 
int iso_dir_get_node (IsoDir *dir, const char *name, IsoNode **node)
 
int iso_dir_get_node_trunc (IsoDir *dir, int truncate_length, const char *name, IsoNode **node)
 
int iso_image_dir_get_node (IsoImage *image, IsoDir *dir, const char *name, IsoNode **node, int flag)
 
int iso_dir_get_children_count (IsoDir *dir)
 
static int iter_next (IsoDirIter *iter, IsoNode **node)
 
static int iter_has_next (IsoDirIter *iter)
 
static void iter_free (IsoDirIter *iter)
 
static IsoNode ** iso_dir_find_node (IsoDir *dir, IsoNode *node)
 
int iso_node_take (IsoNode *node)
 
int iso_node_remove (IsoNode *node)
 
int iso_node_remove_tree (IsoNode *node, IsoDirIter *boss_iter)
 
IsoDiriso_node_get_parent (IsoNode *node)
 
static int iter_take (IsoDirIter *iter)
 
static int iter_remove (IsoDirIter *iter)
 
void iter_notify_child_taken (IsoDirIter *iter, IsoNode *node)
 
int iso_dir_get_children (const IsoDir *dir, IsoDirIter **iter)
 
int iso_dir_iter_next (IsoDirIter *iter, IsoNode **node)
 
int iso_dir_iter_has_next (IsoDirIter *iter)
 
void iso_dir_iter_free (IsoDirIter *iter)
 
int iso_dir_iter_take (IsoDirIter *iter)
 
int iso_dir_iter_remove (IsoDirIter *iter)
 
const char * iso_symlink_get_dest (const IsoSymlink *link)
 
int iso_symlink_set_dest (IsoSymlink *link, const char *dest)
 
void iso_node_set_sort_weight (IsoNode *node, int w)
 
int iso_file_get_sort_weight (IsoFile *file)
 
off_t iso_file_get_size (IsoFile *file)
 
IsoStreamiso_file_get_stream (IsoFile *file)
 
dev_t iso_special_get_dev (IsoSpecial *special)
 
int iso_file_get_old_image_lba (IsoFile *file, uint32_t *lba, int flag)
 
int iso_node_get_old_image_lba (IsoNode *node, uint32_t *lba, int flag)
 
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_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)
 
static int attrs_cleanout_name (char *del_name, size_t *num_attrs, char **names, size_t *value_lengths, char **values, 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 iso_node_lookup_attr (IsoNode *node, char *name, size_t *value_length, char **value, int flag)
 
int iso_node_get_attrs (IsoNode *node, size_t *num_attrs, char ***names, size_t **value_lengths, char ***values, int flag)
 
static int attr_enlarge_list (char ***names, size_t **value_lengths, char ***values, size_t new_num, int flag)
 
static int iso_node_merge_xattr (IsoNode *node, size_t num_attrs, char **names, size_t *value_lengths, char **values, size_t *m_num_attrs, char ***m_names, size_t **m_value_lengths, char ***m_values, int flag)
 
int iso_node_set_attrs (IsoNode *node, size_t num_attrs, char **names, size_t *value_lengths, char **values, int flag)
 
static int iso_decode_acl (unsigned char *v_data, size_t v_len, size_t *consumed, char **text, size_t *text_fill, int flag)
 
static int iso_attr_get_acl_text (size_t num_attrs, char **names, size_t *value_lengths, char **values, mode_t st_mode, char **access_text, char **default_text, int flag)
 
int iso_node_get_acl_text (IsoNode *node, char **access_text, char **default_text, 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_node_set_acl_text (IsoNode *node, char *access_text, char *default_text, int flag)
 
mode_t iso_node_get_perms_wo_acl (const IsoNode *node)
 
int zisofs_zf_xinfo_func (void *data, int flag)
 
int zisofs_zf_xinfo_cloner (void *old_data, void **new_data, int flag)
 
int iso_file_zf_by_magic (IsoFile *file, int flag)
 
int iso_node_zf_by_magic (IsoNode *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 iso_node_get_id (IsoNode *node, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id, int flag)
 
static int iso_node_set_ino_xinfo (IsoNode *node, ino_t ino, int flag)
 
int iso_node_set_ino (IsoNode *node, ino_t ino, int flag)
 
int iso_node_set_unique_id (IsoNode *node, IsoImage *image, int flag)
 
int iso_node_cmp_flag (IsoNode *n1, IsoNode *n2, int flag)
 
int iso_node_cmp_ino (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_file_get_md5 (IsoImage *image, IsoFile *file, char md5[16], int flag)
 
int iso_file_make_md5 (IsoFile *file, int flag)
 

Variables

static struct iso_dir_iter_iface iter_class
 
static struct iter_reg_nodeiter_reg = NULL
 

Function Documentation

◆ attr_enlarge_list()

static int attr_enlarge_list ( char ***  names,
size_t **  value_lengths,
char ***  values,
size_t  new_num,
int  flag 
)
static

Definition at line 1804 of file node.c.

References ISO_OUT_OF_MEM.

Referenced by iso_node_merge_xattr(), and iso_node_set_acl_text().

◆ attrs_cleanout_name()

static int attrs_cleanout_name ( char *  del_name,
size_t *  num_attrs,
char **  names,
size_t *  value_lengths,
char **  values,
int  flag 
)
static

Definition at line 1612 of file node.c.

Referenced by iso_aa_get_attrs().

◆ 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_attr_get_acl_text()

static int iso_attr_get_acl_text ( size_t  num_attrs,
char **  names,
size_t *  value_lengths,
char **  values,
mode_t  st_mode,
char **  access_text,
char **  default_text,
int  flag 
)
static

Backend of iso_node_get_acl_text() with parameter node replaced by the attribute list from where to get the ACL and by the associated st_mode permission bits. All other parameter specs apply.

Definition at line 2089 of file node.c.

References aaip_add_acl_st_mode(), ISO_AAIP_BAD_ACL, and iso_decode_acl().

Referenced by iso_aa_get_acl_text(), and iso_node_get_acl_text().

◆ iso_decode_acl()

static int iso_decode_acl ( unsigned char *  v_data,
size_t  v_len,
size_t *  consumed,
char **  text,
size_t *  text_fill,
int  flag 
)
static

Definition at line 2057 of file node.c.

References aaip_decode_acl(), and ISO_OUT_OF_MEM.

Referenced by iso_attr_get_acl_text(), and iso_node_set_acl_text().

◆ iso_dir_add_node()

int iso_dir_add_node ( IsoDir dir,
IsoNode child,
enum iso_replace_mode  replace 
)

Add a new node to a dir. Note that this function don't add a new ref to the node, so you don't need to free it, it will be automatically freed when the dir is deleted. Of course, if you want to keep using the node after the dir life, you need to iso_node_ref() it.

Parameters
dirthe dir where to add the node
childthe node to add. You must ensure that the node hasn't previously added to other dir, and that the node name is unique inside the child. Otherwise this function will return a failure, and the child won't be inserted.
replaceif the dir already contains a node with the same name, whether to replace or not the old node with this.
Returns
number of nodes in dir if success, < 0 otherwise

Definition at line 591 of file node.c.

References iso_dir_find(), iso_dir_insert(), ISO_NODE_ALREADY_ADDED, ISO_NULL_POINTER, ISO_WRONG_ARG_VALUE, Iso_Node::name, and Iso_Node::parent.

Referenced by iso_node_set_name_trunc(), iso_tree_clone_dir(), and Xorriso_rename().

◆ 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_find_node()

static IsoNode** iso_dir_find_node ( IsoDir dir,
IsoNode node 
)
static

Definition at line 791 of file node.c.

References Iso_Dir::children, and dir_iter_data::pos.

Referenced by iso_node_take().

◆ iso_dir_get_children()

int iso_dir_get_children ( const IsoDir dir,
IsoDirIter **  iter 
)

Get an iterator for the children of the given dir.

You can iterate over the children with iso_dir_iter_next. When finished, you should free the iterator with iso_dir_iter_free. You must not delete a child of the same dir, using iso_node_take() or iso_node_remove(), while you're using the iterator. You can use iso_dir_iter_take() or iso_dir_iter_remove() instead.

You can use the iterator in the way like this

IsoDirIter *iter; IsoNode *node; if ( iso_dir_get_children(dir, &iter) != 1 ) { // handle error } while ( iso_dir_iter_next(iter, &node) == 1 ) { // do something with the child } iso_dir_iter_free(iter);

An iterator is intended to be used in a single iteration over the children of a dir. Thus, it should be treated as a temporary object, and free as soon as possible.

Returns
1 success, < 0 error Possible errors: ISO_NULL_POINTER, if dir or iter are NULL ISO_OUT_OF_MEM
Since
0.6.2

Definition at line 1001 of file node.c.

References Iso_Dir_Iter::class, Iso_Dir_Iter::data, Iso_Dir_Iter::dir, dir_iter_data::flag, iso_dir_iter_register(), iso_node_ref(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, iter_class, and dir_iter_data::pos.

Referenced by img_collect_inos(), img_make_inos(), iso_dir_find_children(), iso_dir_zisofs_discard_bpt(), iso_node_remove_tree(), iso_tree_clone_dir(), iso_tree_get_node_of_block(), Xorriso_clone_under(), Xorriso_dir_disk_path(), Xorriso_findi_iter(), Xorriso_identify_split(), Xorriso_ls(), Xorriso_obtain_pattern_files_i(), Xorriso_rmi(), Xorriso_show_du_subs(), Xorriso_sorted_dir_i(), and Xorriso_sorted_node_array().

◆ iso_dir_get_children_count()

int iso_dir_get_children_count ( IsoDir dir)

Get the number of children of a directory.

Returns
>= 0 number of items, < 0 error Possible errors: ISO_NULL_POINTER, if dir is NULL

Definition at line 699 of file node.c.

References ISO_NULL_POINTER, and Iso_Dir::nchildren.

◆ iso_dir_get_node()

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

Locate a node inside a given dir.

Parameters
nameThe name of the node
nodeLocation for a pointer to the node, it will filled with NULL if the dir doesn't have a child with the given name. The node will be owned by the dir and shouldn't be unref(). Just call iso_node_ref() to get your own reference to the node. Note that you can pass NULL is the only thing you want to do is check if a node with such name already exists on dir.
Returns
1 node found, 0 child has no such node, < 0 error Possible errors: ISO_NULL_POINTER, if dir or name are NULL

Definition at line 632 of file node.c.

References iso_dir_exists(), and ISO_NULL_POINTER.

Referenced by iso_dir_get_node_trunc(), iso_image_dir_get_node(), iso_node_set_name_trunc(), iso_tree_clone_trunc(), iso_tree_path_to_node_flag(), make_reloc_dir_if_needed(), and Xorriso_truncate_uniquely().

◆ 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_free()

◆ iso_dir_iter_has_next()

int iso_dir_iter_has_next ( IsoDirIter iter)

Check if there're more children.

Returns
1 dir has more elements, 0 no, < 0 error Possible errors: ISO_NULL_POINTER, if iter is NULL
Since
0.6.2

Definition at line 1043 of file node.c.

References Iso_Dir_Iter::class, iso_dir_iter_iface::has_next, and ISO_NULL_POINTER.

◆ iso_dir_iter_next()

int iso_dir_iter_next ( IsoDirIter iter,
IsoNode **  node 
)

Get the next child. Take care that the node is owned by its parent, and will be unref() when the parent is freed. If you want your own ref to it, call iso_node_ref() on it.

Returns
1 success, 0 if dir has no more elements, < 0 error Possible errors: ISO_NULL_POINTER, if node or iter are NULL ISO_ERROR, on wrong iter usage, usual caused by modiying the dir during iteration
Since
0.6.2

Definition at line 1035 of file node.c.

References Iso_Dir_Iter::class, ISO_NULL_POINTER, and iso_dir_iter_iface::next.

Referenced by get_next(), img_collect_inos(), img_make_inos(), iso_dir_zisofs_discard_bpt(), iso_node_remove_tree(), iso_tree_clone_dir(), iso_tree_get_node_of_block(), Xorriso_clone_under(), Xorriso_dir_disk_path(), Xorriso_findi_iter(), Xorriso_identify_split(), Xorriso_ls(), Xorriso_obtain_pattern_files_i(), Xorriso_rmi(), Xorriso_show_du_subs(), Xorriso_sorted_dir_i(), and Xorriso_sorted_node_array().

◆ 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_remove()

int iso_dir_iter_remove ( IsoDirIter iter)

Removes a child from a directory during an iteration and unref() it. Like iso_node_remove(), but to be used during a directory iteration. The node removed will be the one returned by the previous iteration.

It is not allowed to call this function twice without calling iso_dir_iter_next between the calls.

Returns
1 on success, < 0 error Possible errors: ISO_NULL_POINTER, if iter is NULL ISO_ERROR, on wrong iter usage, for example by calling this before iso_dir_iter_next.
Since
0.6.2

Definition at line 1069 of file node.c.

References Iso_Dir_Iter::class, ISO_NULL_POINTER, and iso_dir_iter_iface::remove.

Referenced by iso_node_remove_tree(), and Xorriso_rmi().

◆ iso_dir_iter_take()

int iso_dir_iter_take ( IsoDirIter iter)

Removes a child from a directory during an iteration, without freeing it. It's like iso_node_take(), but to be used during a directory iteration. The node removed will be the last returned by the iteration.

If you call this function twice without calling iso_dir_iter_next between them is not allowed and you will get an ISO_ERROR in second call.

Returns
1 on success, < 0 error Possible errors: ISO_NULL_POINTER, if iter is NULL ISO_ERROR, on wrong iter usage, for example by call this before iso_dir_iter_next.
Since
0.6.2

Definition at line 1061 of file node.c.

References Iso_Dir_Iter::class, ISO_NULL_POINTER, and iso_dir_iter_iface::take.

◆ 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_get_md5()

int iso_file_get_md5 ( IsoImage image,
IsoFile file,
char  md5[16],
int  flag 
)

Eventually obtain the recorded MD5 checksum of a data file from the loaded ISO image. Such a checksum may be stored with others in a contiguous array at the end of the loaded session. The data file eventually has an xattr "isofs.cx" which gives the index in that array.

Parameters
imageThe image from which file stems.
fileThe file object to inquire
md5Eventually returns 16 byte of MD5 checksum
flagBitfield for control purposes bit0= only determine return value, do not touch parameter md5
Returns
1= md5 found , 0= no md5 available , <0 indicates error
Since
0.6.22

Definition at line 3027 of file node.c.

References Iso_Image::checksum_array, Iso_Image::checksum_idx_count, checksum_md5_xinfo_func(), iso_node_get_xinfo(), and iso_node_lookup_attr().

Referenced by Xorriso_check_md5(), and Xorriso_get_md5().

◆ iso_file_get_old_image_lba()

int iso_file_get_old_image_lba ( IsoFile file,
uint32_t *  lba,
int  flag 
)

Get the block lba of a file node, if it was imported from an old image.

Parameters
fileThe file
lbaWill be filled with the kba
flagReserved for future usage, submit 0
Returns
1 if lba is valid (file comes from old image), 0 if file was newly added, i.e. it does not come from an old image, < 0 error
Since
0.6.4

Definition at line 1194 of file node.c.

References iso_file_section::block, iso_file_get_old_image_sections(), ISO_NULL_POINTER, and ISO_WRONG_ARG_VALUE.

Referenced by iso_node_get_old_image_lba().

◆ iso_file_get_size()

◆ iso_file_get_sort_weight()

int iso_file_get_sort_weight ( IsoFile file)

Get the sort weight of a file.

Definition at line 1136 of file node.c.

References Iso_File::sort_weight.

◆ iso_file_get_stream()

IsoStream* iso_file_get_stream ( IsoFile file)

Get the IsoStream that represents the contents of the given IsoFile.

If you open() the stream, it should be close() before image generation.

Returns
The IsoStream. No extra ref is added, so the IsoStream belong to the IsoFile, and it may be freed together with it. Add your own ref with iso_stream_ref() if you need it.
Since
0.6.4

Definition at line 1161 of file node.c.

References Iso_File::stream.

Referenced by add_zf_field(), Exprtest_match(), gzip_add_filter(), iso_dir_zisofs_discard_bpt(), iso_file_add_external_filter(), iso_file_zf_by_magic(), iso_image_eval_boot_info_table(), iso_read_mipsel_elf(), make_mips_volume_header(), Xorriso_is_plain_image_file(), Xorriso_iso_file_open(), Xorriso_restore_is_identical(), Xorriso_retrieve_disk_path(), Xorriso_set_filter(), Xorriso_show_stream(), ziso_add_filter(), and ziso_add_osiz_filter().

◆ iso_file_make_md5()

int iso_file_make_md5 ( IsoFile file,
int  flag 
)

Read the content of an IsoFile object, compute its MD5 and attach it to the IsoFile. It can then be inquired by iso_file_get_md5() and will get written into the next session if this is enabled at write time and if the image write process does not compute an MD5 from content which it copies. So this call can be used to equip nodes from the old image with checksums or to make available checksums of newly added files before the session gets written.

Parameters
fileThe file object to read data from and to which to attach the checksum. If the file is from the imported image, then its most original stream will be checksummed. Else the eventual filter streams will get into effect.
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
1= ok, MD5 is computed and attached , <0 indicates error
Since
0.6.22

Definition at line 3072 of file node.c.

References checksum_md5_xinfo_func(), Iso_File::from_old_session, ISO_ERROR, iso_node_add_xinfo(), iso_node_remove_xinfo(), ISO_OUT_OF_MEM, iso_stream_make_md5(), and Iso_File::stream.

Referenced by Xorriso_make_md5().

◆ 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_image_dir_get_node()

int iso_image_dir_get_node ( IsoImage image,
IsoDir dir,
const char *  name,
IsoNode **  node,
int  flag 
)

Locate a node inside a given dir.

The IsoImage context defines a maximum permissible name length and a mode how to react on oversized names. See iso_image_set_truncate_mode(). If the caller looks for an oversized name and image truncate mode is 1, then this call looks for the truncated name among the nodes of dir.

Parameters
imageThe image object to which dir belongs.
dirThe dir where to look for the node.
nameThe name of the node. (Will not be changed if truncation happens.)
nodeLocation for a pointer to the node, it will filled with NULL if the dir doesn't have a child with the given name. The node will be owned by the dir and shouldn't be unref(). Just call iso_node_ref() to get your own reference to the node. Note that you can pass NULL is the only thing you want to do is check if a node with such name already exists on dir.
flagBitfield for control purposes. bit0= do not truncate name but lookup exactly as given.
Returns
1 node found 0 no name truncation was needed, name not found in dir 2 name truncation happened, truncated name not found in dir < 0 error, see iso_dir_get_node().
Since
1.4.2

Definition at line 679 of file node.c.

References iso_dir_get_node(), iso_dir_get_node_trunc(), Iso_Image::truncate_length, and Iso_Image::truncate_mode.

Referenced by Xorriso_graft_in(), and Xorriso_tree_graft_node().

◆ iso_image_set_node_name()

int iso_image_set_node_name ( IsoImage image,
IsoNode node,
const char *  name,
int  flag 
)

Set the name of a node. Note that if the node is already added to a dir this can fail if dir already contains a node with the new name. The IsoImage context defines a maximum permissible name length and a mode how to react on oversized names. See iso_image_set_truncate_mode().

Parameters
imageThe image object to which the node belongs or shall belong in future.
nodeThe node of which you want to change the name. One cannot change the name of the root directory.
nameThe new name for the node. It may not be empty. If it is oversized then it will be handled according to iso_image_set_truncate_mode().
flagbit0= issue warning in case of truncation
Returns
1 on success, < 0 on error
Since
1.4.2

Definition at line 401 of file node.c.

References iso_node_set_name_trunc(), ISO_RR_NAME_TOO_LONG, Iso_Image::truncate_length, and Iso_Image::truncate_mode.

Referenced by Xorriso_graft_in(), Xorriso_rename(), Xorriso_rename_suffix(), Xorriso_set_filter(), and Xorriso_truncate_uniquely().

◆ iso_node_add_xinfo()

int iso_node_add_xinfo ( IsoNode node,
iso_node_xinfo_func  proc,
void *  data 
)

Add extended information to the given node. Extended info allows applications (and libisofs itself) to add more information to an IsoNode. You can use this facilities to associate new information with a given node.

Each node keeps a list of added extended info, meaning you can add several extended info data to each node. Each extended info you add is identified by the proc parameter, a pointer to a function that knows how to manage the external info data. Thus, in order to add several types of extended info, you need to define a "proc" function for each type.

Parameters
nodeThe node where to add the extended info
procA function pointer used to identify the type of the data, and that knows how to manage it
dataExtended info to add.
Returns
1 if success, 0 if the given node already has extended info of the type defined by the "proc" function, < 0 on error

Definition at line 136 of file node.c.

References iso_extended_info::data, ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, iso_extended_info::next, iso_extended_info::process, and Iso_Node::xinfo.

Referenced by checksum_prepare_nodes(), default_create_node(), iso_file_make_md5(), iso_file_zf_by_magic(), iso_node_clone_xinfo(), iso_node_set_attrs(), iso_node_set_ino_xinfo(), src_aa_to_node(), Xorriso_mark_update_merge(), and Xorriso_set_hfsplus_crtp().

◆ 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_cmp_ino()

int iso_node_cmp_ino ( IsoNode n1,
IsoNode n2,
int  flag 
)

Compare two nodes whether they are based on the same input and can be considered as hardlinks to the same file objects.

Parameters
n1The first node to compare.
n2The second node to compare.
Returns
-1 if n1 is smaller n2 , 0 if n1 matches n2 , 1 if n1 is larger n2
Parameters
flagBitfield for control purposes, unused yet, submit 0
Since
0.6.20

Definition at line 2879 of file node.c.

References iso_node_cmp_flag().

Referenced by Xorriso__findi_sorted_ino_cmp().

◆ iso_node_get_acl_text()

int iso_node_get_acl_text ( IsoNode node,
char **  access_text,
char **  default_text,
int  flag 
)

Get the eventual ACLs which are associated with the node. The result will be in "long" text form as of man acl and acl_to_text(). Call this function with flag bit15 to finally release the memory occupied by an ACL inquiry.

Parameters
nodeThe node that is to be inquired.
access_textWill return a pointer to the eventual "access" ACL text or NULL if it is not available and flag bit 4 is set.
default_textWill return a pointer to the eventual "default" ACL or NULL if it is not available. (GNU/Linux directories can have a "default" ACL which influences the permissions of newly created files.)
flagBitfield for control purposes bit4= if no "access" ACL is available: return *access_text == NULL else: produce ACL from stat(2) permissions bit15= free memory and return 1 (node may be NULL)
Returns
2 *access_text was produced from stat(2) permissions 1 *access_text was produced from ACL of node 0 if flag bit4 is set and no ACL is available < 0 on error
Since
0.6.14

Definition at line 2154 of file node.c.

References iso_attr_get_acl_text(), iso_node_get_attrs(), and iso_node_get_permissions().

Referenced by iso_node_get_perms_wo_acl(), iso_node_set_attrs(), Xorriso_getfacl(), and Xorriso_ls_filev().

◆ iso_node_get_atime()

time_t iso_node_get_atime ( const IsoNode node)

Get the time of last access to the file

Definition at line 537 of file node.c.

References Iso_Node::atime.

Referenced by Xorriso_fake_stbuf(), and Xorriso_restore_properties().

◆ iso_node_get_attrs()

int iso_node_get_attrs ( IsoNode node,
size_t *  num_attrs,
char ***  names,
size_t **  value_lengths,
char ***  values,
int  flag 
)

Get the list of xattr which is associated with the node. The resulting data may finally be disposed by a call to this function with flag bit15 set, or its components may be freed one-by-one. The following values are either NULL or malloc() memory: *names, *value_lengths, *values, (*names)[i], (*values)[i] with 0 <= i < *num_attrs. It is allowed to replace or reallocate those memory items in order to to manipulate the attribute list before submitting it to other calls.

If enabled by flag bit0, this list possibly includes the ACLs of the node. They are eventually encoded in a pair with empty name. It is not advisable to alter the value or name of that pair. One may decide to erase both ACLs by deleting this pair or to copy both ACLs by copying the content of this pair to an empty named pair of another node. For all other ACL purposes use iso_node_get_acl_text().

Parameters
nodeThe node that is to be inquired.
num_attrsWill return the number of name-value pairs
namesWill return an array of pointers to 0-terminated names
value_lengthsWill return an array with the lengths of values
valuesWill return an array of pointers to strings of 8-bit bytes
flagBitfield for control purposes bit0= obtain eventual ACLs as attribute with empty name bit2= with bit0: do not obtain attributes other than ACLs bit15= free memory (node may be NULL)
Returns
1 = ok (but *num_attrs may be 0) < 0 = error
Since
0.6.14

Definition at line 1776 of file node.c.

References aaip_xinfo_func(), iso_aa_get_attrs(), and iso_node_get_xinfo().

Referenced by iso_node_get_acl_text(), iso_node_merge_xattr(), iso_node_set_acl_text(), Xorriso_get_attrs(), and Xorriso_restore_properties().

◆ iso_node_get_ctime()

time_t iso_node_get_ctime ( const IsoNode node)

Get the time of last status change of the file

Definition at line 553 of file node.c.

References Iso_Node::ctime.

Referenced by Xorriso_fake_stbuf().

◆ iso_node_get_gid()

gid_t iso_node_get_gid ( const IsoNode node)

Get the group id of the node.

Definition at line 505 of file node.c.

References Iso_Node::gid.

Referenced by Xorriso_fake_stbuf(), Xorriso_getfacl(), and Xorriso_restore_properties().

◆ iso_node_get_hidden()

int iso_node_get_hidden ( IsoNode node)

Get the hide_attrs as eventually set by iso_node_set_hidden().

Parameters
nodeThe node to inquire.
Returns
Or-combination of values from enum IsoHideNodeFlag which are currently set for the node.
Since
0.6.34

Definition at line 566 of file node.c.

References Iso_Node::hidden.

Referenced by Exprtest_match(), and Xorriso_node_eff_hidden().

◆ iso_node_get_id()

◆ iso_node_get_mode()

mode_t iso_node_get_mode ( const IsoNode node)

Get the mode of the node, both permissions and file type, as specified in 'man 2 stat'.

Definition at line 471 of file node.c.

References Iso_Node::mode.

◆ iso_node_get_mtime()

time_t iso_node_get_mtime ( const IsoNode node)

Get the time of last modification of the file

Definition at line 521 of file node.c.

References Iso_Node::mtime.

Referenced by Xorriso_fake_stbuf(), Xorriso_restore_properties(), and Xorriso_set_to_mtime().

◆ iso_node_get_name()

const char* iso_node_get_name ( const IsoNode node)

◆ iso_node_get_next_xinfo()

int iso_node_get_next_xinfo ( IsoNode node,
void **  handle,
iso_node_xinfo_func proc,
void **  data 
)

Get the next pair of function pointer and data of an iteration of the list of extended information. Like: iso_node_xinfo_func proc; void *handle = NULL, *data; while (iso_node_get_next_xinfo(node, &handle, &proc, &data) == 1) { ... make use of proc and data ... } The iteration allocates no memory. So you may end it without any disposal action. IMPORTANT: Do not continue iterations after manipulating the extended information of a node. Memory corruption hazard !

Parameters
nodeThe node to inquire
handleThe opaque iteration handle. Initialize iteration by submitting a pointer to a void pointer with value NULL. Do not alter its content until iteration has ended.
procThe function pointer which serves as key
dataWill be filled with the extended info corresponding to the given proc function
Returns
1 on success 0 if iteration has ended (proc and data are invalid then) < 0 on error
Since
1.0.2

Definition at line 236 of file node.c.

References iso_extended_info::data, ISO_NULL_POINTER, ISO_SUCCESS, iso_extended_info::next, iso_extended_info::process, and Iso_Node::xinfo.

Referenced by iso_node_clone_xinfo().

◆ iso_node_get_old_image_lba()

int iso_node_get_old_image_lba ( IsoNode node,
uint32_t *  lba,
int  flag 
)

Definition at line 1227 of file node.c.

References iso_file_get_old_image_lba(), ISO_NODE_IS_FILE, and ISO_NULL_POINTER.

Referenced by dir_update_size().

◆ iso_node_get_parent()

◆ iso_node_get_permissions()

mode_t iso_node_get_permissions ( const IsoNode node)

◆ iso_node_get_perms_wo_acl()

mode_t iso_node_get_perms_wo_acl ( const IsoNode node)

Like iso_node_get_permissions but reflecting ACL entry "group::" in S_IRWXG rather than ACL entry "mask::". This is necessary if the permissions of a node with ACL shall be restored to a filesystem without restoring the ACL. The same mapping happens internally when the ACL of a node is deleted. If the node has no ACL then the result is iso_node_get_permissions(node).

Parameters
nodeThe node that is to be inquired.
Returns
Permission bits as of stat(2)
Since
0.6.14

Definition at line 2390 of file node.c.

References aaip_cleanout_st_mode(), iso_node_get_acl_text(), and iso_node_get_permissions().

Referenced by Xorriso_fake_stbuf(), and Xorriso_restore_properties().

◆ iso_node_get_type()

◆ iso_node_get_uid()

uid_t iso_node_get_uid ( const IsoNode node)

Get the user id of the node.

Definition at line 488 of file node.c.

References Iso_Node::uid.

Referenced by Xorriso_fake_stbuf(), Xorriso_getfacl(), and Xorriso_restore_properties().

◆ iso_node_get_xinfo()

int iso_node_get_xinfo ( IsoNode node,
iso_node_xinfo_func  proc,
void **  data 
)

Get the given extended info (defined by the proc function) from the given node.

Parameters
dataWill be filled with the extended info corresponding to the given proc function
Returns
1 on success, 0 if node does not have extended info of the requested type, < 0 on error

Definition at line 213 of file node.c.

References iso_extended_info::data, ISO_NULL_POINTER, ISO_SUCCESS, iso_extended_info::next, iso_extended_info::process, and Iso_Node::xinfo.

Referenced by add_aa_string(), add_zf_field(), checksum_copy_old_nodes(), checksum_prepare_nodes(), Exprtest_match(), hfsplus_writer_write_data(), iso_file_get_md5(), iso_file_src_create(), iso_file_zf_by_magic(), iso_node_cmp_flag(), iso_node_get_attrs(), iso_node_get_id(), iso_node_lookup_attr(), iso_node_set_ino(), process_preserved_cx(), susp_calc_nm_sl_al(), Xorriso_findi_action(), and Xorriso_mark_update_merge().

◆ 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)

◆ iso_node_lookup_attr()

int iso_node_lookup_attr ( IsoNode node,
char *  name,
size_t *  value_length,
char **  value,
int  flag 
)

Obtain the value of a particular xattr name. Eventually make a copy of that value and add a trailing 0 byte for caller convenience.

Parameters
nodeThe node that is to be inquired.
nameThe xattr name that shall be looked up.
value_lengthWill return the length of value
valueWill return a string of 8-bit bytes. free() it when no longer needed.
flagBitfield for control purposes, unused yet, submit 0
Returns
1= name found , 0= name not found , <0 indicates error
Since
0.6.18

Definition at line 1757 of file node.c.

References aaip_xinfo_func(), iso_aa_lookup_attr(), and iso_node_get_xinfo().

Referenced by checksum_copy_old_nodes(), checksum_prepare_nodes(), ecma119_writer_write_dirs(), iso_file_get_md5(), iso_root_get_isofsca(), iso_root_get_isofsnt(), Xorriso__get_di(), and Xorriso_grasp_loaded_aaip().

◆ iso_node_merge_xattr()

static int iso_node_merge_xattr ( IsoNode node,
size_t  num_attrs,
char **  names,
size_t *  value_lengths,
char **  values,
size_t *  m_num_attrs,
char ***  m_names,
size_t **  m_value_lengths,
char ***  m_values,
int  flag 
)
static

Definition at line 1839 of file node.c.

References attr_enlarge_list(), iso_node_get_attrs(), and ISO_OUT_OF_MEM.

Referenced by iso_node_set_attrs().

◆ 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_ref()

◆ iso_node_remove()

int iso_node_remove ( IsoNode node)

Removes a child from a directory and free (unref) it. If you want to keep the child alive, you need to iso_node_ref() it before this call, but in that case iso_node_take() is a better alternative.

Returns
1 on success, < 0 error

Definition at line 850 of file node.c.

References iso_node_take(), iso_node_unref(), and ISO_SUCCESS.

Referenced by find_iter_remove(), iso_node_remove_tree(), and Xorriso_rmi().

◆ iso_node_remove_all_xinfo()

int iso_node_remove_all_xinfo ( IsoNode node,
int  flag 
)

Remove all extended information from the given node.

Parameters
nodeThe node where to remove all extended info
flagBitfield for control purposes, unused yet, submit 0
Returns
1 on success, < 0 on error
Since
1.0.2

Definition at line 258 of file node.c.

References iso_extended_info::data, ISO_SUCCESS, iso_extended_info::next, iso_extended_info::process, and Iso_Node::xinfo.

Referenced by iso_node_clone_xinfo().

◆ iso_node_remove_tree()

int iso_node_remove_tree ( IsoNode node,
IsoDirIter boss_iter 
)

Removes a node by iso_node_remove() or iso_dir_iter_remove(). If the node is a directory then the whole tree of nodes underneath is removed too.

Parameters
nodeThe node to be removed.
boss_iterIf not NULL, then the node will be removed by iso_dir_iter_remove(boss_iter) else it will be removed by iso_node_remove(node).
Returns
1 is success, <0 indicates error
Since
1.0.2

Definition at line 861 of file node.c.

References iso_dir_get_children(), iso_dir_iter_free(), iso_dir_iter_next(), iso_dir_iter_remove(), iso_node_remove(), iso_node_remove_tree(), iso_node_unref(), LIBISO_DIR, and Iso_Node::type.

Referenced by iso_node_remove_tree(), and iso_tree_clone_dir().

◆ iso_node_remove_xinfo()

int iso_node_remove_xinfo ( IsoNode node,
iso_node_xinfo_func  proc 
)

Remove the given extended info (defined by the proc function) from the given node.

Returns
1 on success, 0 if node does not have extended info of the requested type, < 0 on error

Definition at line 172 of file node.c.

References iso_extended_info::data, ISO_NULL_POINTER, ISO_SUCCESS, iso_extended_info::next, iso_extended_info::process, and Iso_Node::xinfo.

Referenced by checksum_copy_old_nodes(), iso_file_make_md5(), iso_file_zf_by_magic(), iso_node_set_attrs(), iso_node_set_ino_xinfo(), iso_node_zf_by_magic(), process_preserved_cx(), Xorriso_mark_update_merge(), and Xorriso_remove_hfsplus_crtp().

◆ iso_node_revert_xinfo_list()

static int iso_node_revert_xinfo_list ( IsoNode node,
int  flag 
)
static

Definition at line 272 of file node.c.

References ISO_SUCCESS, iso_extended_info::next, and Iso_Node::xinfo.

Referenced by iso_node_clone_xinfo().

◆ iso_node_set_acl_text()

int iso_node_set_acl_text ( IsoNode node,
char *  access_text,
char *  default_text,
int  flag 
)

Set the ACLs of the given node to the lists in parameters access_text and default_text or delete them.

The stat(2) permission bits get updated according to the new "access" ACL if neither bit1 of parameter flag is set nor parameter access_text is NULL. Note that S_IRWXG permission bits correspond to ACL mask permissions if a "mask::" entry exists in the ACL. Only if there is no "mask::" then the "group::" entry corresponds to to S_IRWXG.

Parameters
nodeThe node that is to be manipulated.
access_textThe text to be set into effect as "access" ACL. NULL will delete an eventually existing "access" ACL of the node.
default_textThe text to be set into effect as "default" ACL. NULL will delete an eventually existing "default" ACL of the node. (GNU/Linux directories can have a "default" ACL which influences the permissions of newly created files.)
flagBitfield for control purposes bit0= Do not change the stat(2) permissions. Caution: This can make the node's permission set inconsistent. bit1= Ignore text parameters but rather update the "access" ACL to the stat(2) permissions of node. If no "access" ACL exists, then do nothing and return success. bit2= Be verbose about failure causes.
Since
1.5.2
Returns
> 0 success < 0 failure
Since
0.6.14

Definition at line 2205 of file node.c.

References aaip_cleanout_st_mode(), aaip_encode_both_acl(), attr_enlarge_list(), ISO_AAIP_BAD_ACL, ISO_AAIP_BAD_ACL_TEXT, iso_decode_acl(), iso_node_get_attrs(), iso_node_get_permissions(), iso_node_set_attrs(), iso_node_set_perms_internal(), and ISO_OUT_OF_MEM.

Referenced by iso_node_set_attrs(), iso_node_set_perms_internal(), and Xorriso_setfacl().

◆ iso_node_set_atime()

void iso_node_set_atime ( IsoNode node,
time_t  time 
)

◆ iso_node_set_attrs()

int iso_node_set_attrs ( IsoNode node,
size_t  num_attrs,
char **  names,
size_t *  value_lengths,
char **  values,
int  flag 
)

Set the list of xattr which is associated with the node. The data get copied so that you may dispose your input data afterwards.

If enabled by flag bit0 then the submitted list of attributes will not only overwrite xattr but also both eventual ACLs of the node. Eventual ACL in the submitted list have to reside in an attribute with empty name.

Parameters
nodeThe node that is to be manipulated.
num_attrsNumber of attributes
namesArray of pointers to 0 terminated name strings
value_lengthsArray of byte lengths for each value
valuesArray of pointers to the value bytes
flagBitfield for control purposes bit0= Do not maintain eventual existing ACL of the node. Set eventual new ACL from value of empty name. bit1= Do not clear the existing attribute list but merge it with the list given by this call. The given values override the values of their eventually existing names. If no xattr with a given name exists, then it will be added as new xattr. So this bit can be used to set a single xattr without inquiring any other xattr of the node. bit2= Delete the attributes with the given names bit3= Allow to affect non-user attributes. I.e. those with a non-empty name which does not begin by "user." (The empty name is always allowed and governed by bit0.) This deletes all previously existing attributes if not bit1 is set. bit4= Do not affect attributes from namespace "isofs". To be combined with bit3 for copying attributes from local filesystem to ISO image.
Since
1.2.4
Returns
1 = ok < 0 = error
Since
0.6.14

Definition at line 1973 of file node.c.

References aaip_encode(), aaip_xinfo_func(), ISO_AAIP_NON_USER_NAME, ISO_ERROR, iso_node_add_xinfo(), iso_node_get_acl_text(), iso_node_merge_xattr(), iso_node_remove_xinfo(), and iso_node_set_acl_text().

Referenced by iso_file_set_isofscx(), iso_node_set_acl_text(), iso_root_set_isofsca(), iso_root_set_isofsnt(), Xorriso_setfattr(), and Xorriso_transfer_properties().

◆ iso_node_set_ctime()

◆ iso_node_set_gid()

void iso_node_set_gid ( IsoNode node,
gid_t  gid 
)

Set the group id for the node. This attribute is only useful when Rock Ridge extensions are enabled.

Definition at line 497 of file node.c.

References Iso_Node::gid.

Referenced by default_create_file(), default_create_node(), iso_tree_add_new_dir(), iso_tree_add_new_file(), iso_tree_add_new_special(), iso_tree_add_new_symlink(), Xorriso_graft_in(), Xorriso_mkisofs_lower_r(), Xorriso_set_gid(), and Xorriso_transfer_properties().

◆ iso_node_set_hidden()

void iso_node_set_hidden ( IsoNode node,
int  hide_attrs 
)

Set whether the node will be hidden in the directory trees of RR/ISO 9660, or of Joliet (if enabled at all), or of ISO-9660:1999 (if enabled at all).

A hidden file does not show up by name in the affected directory tree. For example, if a file is hidden only in Joliet, it will normally not be visible on Windows systems, while being shown on GNU/Linux.

If a file is not shown in any of the enabled trees, then its content will not be written to the image, unless LIBISO_HIDE_BUT_WRITE is given (which is available only since release 0.6.34).

Parameters
nodeThe node that is to be hidden.
hide_attrsOr-combination of values from enum IsoHideNodeFlag to set the trees in which the node's name shall be hidden.
Since
0.6.2

Definition at line 558 of file node.c.

References Iso_Node::hidden, and Iso_Node::parent.

Referenced by iso_image_set_boot_catalog_hidden(), iso_tree_add_new_dir(), iso_tree_add_new_file(), iso_tree_add_new_special(), iso_tree_add_new_symlink(), and Xorriso_set_hidden().

◆ iso_node_set_ino()

◆ iso_node_set_ino_xinfo()

static int iso_node_set_ino_xinfo ( IsoNode node,
ino_t  ino,
int  flag 
)
static

◆ iso_node_set_mtime()

void iso_node_set_mtime ( IsoNode node,
time_t  time 
)

◆ iso_node_set_name()

int iso_node_set_name ( IsoNode node,
const char *  name 
)
                       *** Deprecated ***
              use iso_image_set_node_name() instead

Set the name of a node without taking into respect name truncation mode of an IsoImage.

Parameters
nodeThe node whose name you want to change. Note that you can't change the name of the root.
nameThe name for the node. If you supply an empty string or a name greater than 255 characters this returns with failure, and node name is not modified.
Returns
1 on success, < 0 on error
Since
0.6.2

Definition at line 396 of file node.c.

References iso_node_set_name_trunc().

Referenced by iso_tree_add_new_cut_out_node().

◆ iso_node_set_name_trunc()

int iso_node_set_name_trunc ( IsoNode node,
const char *  in_name,
int  truncate_length,
int  flag 
)

Set the name of a node.

Parameters
nameThe name in UTF-8 encoding
truncate_length(<64 = return on oversized name )
flagbit0= issue warning in case of truncation

Definition at line 333 of file node.c.

References iso_dir_add_node(), iso_dir_get_node(), iso_node_is_valid_name(), ISO_NODE_NAME_NOT_UNIQUE, iso_node_take(), ISO_OUT_OF_MEM, ISO_SUCCESS, iso_truncate_rr_name(), ISO_WRONG_ARG_VALUE, Iso_Node::name, and Iso_Node::parent.

Referenced by iso_image_set_node_name(), and iso_node_set_name().

◆ iso_node_set_permissions()

void iso_node_set_permissions ( IsoNode node,
mode_t  mode 
)

Set the permissions for the node. This attribute is only useful when Rock Ridge extensions are enabled.

Parameters
modebitmask with the permissions of the node, as specified in 'man 2 stat'. The file type bitfields will be ignored, only file permissions will be modified.

Definition at line 453 of file node.c.

References iso_node_set_perms_internal().

Referenced by default_create_file(), iso_tree_add_new_dir(), iso_tree_add_new_file(), iso_tree_add_new_symlink(), isoburn_root_defaults(), Xorriso_mkisofs_lower_r(), Xorriso_set_st_mode(), and Xorriso_transfer_properties().

◆ 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_sort_weight()

void iso_node_set_sort_weight ( IsoNode node,
int  w 
)

Sets the order in which a node will be written on image. High weihted files will be written first, so in a disc them will be written near the center.

Parameters
nodeThe node which weight will be changed. If it's a dir, this function will change the weight of all its children. For nodes other that dirs or regular files, this function has no effect.
wThe weight as a integer number, the greater this value is, the closer from the beginning of image the file will be written.

Definition at line 1119 of file node.c.

References iso_node_set_sort_weight(), LIBISO_DIR, LIBISO_FILE, Iso_Node::next, and Iso_Node::type.

Referenced by iso_node_set_sort_weight(), and Xorriso_findi_action().

◆ iso_node_set_uid()

void iso_node_set_uid ( IsoNode node,
uid_t  uid 
)

Set the user id for the node. This attribute is only useful when Rock Ridge extensions are enabled.

Definition at line 480 of file node.c.

References Iso_Node::uid.

Referenced by default_create_file(), default_create_node(), iso_tree_add_new_dir(), iso_tree_add_new_file(), iso_tree_add_new_special(), iso_tree_add_new_symlink(), Xorriso_graft_in(), Xorriso_mkisofs_lower_r(), Xorriso_set_uid(), and Xorriso_transfer_properties().

◆ 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_node_take()

int iso_node_take ( IsoNode node)

Removes a child from a directory. The child is not freed, so you will become the owner of the node. Later you can add the node to another dir (calling iso_dir_add_node), or free it if you don't need it (with iso_node_unref).

Returns
1 on success, < 0 error

Definition at line 810 of file node.c.

References ISO_ASSERT_FAILURE, iso_dir_find_node(), ISO_NODE_NOT_ADDED_TO_DIR, iso_notify_dir_iters(), ISO_NULL_POINTER, ISO_SUCCESS, Iso_Dir::nchildren, Iso_Node::next, Iso_Node::parent, and dir_iter_data::pos.

Referenced by find_iter_take(), iso_image_remove_boot_image(), iso_image_set_boot_image(), iso_node_remove(), iso_node_set_name_trunc(), iso_tree_clone_dir(), iter_take(), and Xorriso_rename().

◆ iso_node_unref()

◆ iso_node_zf_by_magic()

int iso_node_zf_by_magic ( IsoNode node,
int  flag 
)

Check for the given node or for its subtree whether the data file content effectively bears zisofs file headers and eventually mark the outcome by an xinfo data record if not already marked by a zisofs compressor filter. This does not install any filter but only a hint for image generation that the already compressed files shall get written with zisofs ZF entries. Use this if you insert the compressed results of program mkzftree from disk into the image.

Parameters
nodeThe node which shall be checked and, if appropriate, be marked.
flagBitfield for control purposes bit0= prepare for a run with iso_write_opts_set_appendable(,1). Take into account that files from the imported image do not get their content filtered. bit1= permission to overwrite existing zisofs_zf_info bit2= if no zisofs header is found: create xinfo with parameters which indicate no zisofs bit3= no tree recursion if node is a directory bit4= skip files which stem from the imported image bit8-bit15= maximum zisofs version to be recognized (0 means 1)
Returns
0= no zisofs data found 1= zf xinfo added 2= found existing zf xinfo and flag bit1 was not set 3= both encountered: 1 and 2 <0 means error
Since
0.6.18

Definition at line 2508 of file node.c.

References Iso_Dir::children, iso_stream::class, Iso_File::from_old_session, iso_file_zf_by_magic(), iso_msg_submit(), iso_node_remove_xinfo(), iso_node_zf_by_magic(), LIBISO_DIR, LIBISO_FILE, Iso_Node::next, Iso_File::stream, IsoStream_Iface::type, Iso_Node::type, and zisofs_zf_xinfo_func().

Referenced by iso_node_zf_by_magic(), and Xorriso_make_iso_write_opts().

◆ 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().

◆ iso_special_get_dev()

dev_t iso_special_get_dev ( IsoSpecial special)

Get the device id (major/minor numbers) of the given block or character device file. The result is undefined for other kind of special files, of first be sure iso_node_get_mode() returns either S_IFBLK or S_IFCHR.

Since
0.6.6

Definition at line 1174 of file node.c.

References Iso_Special::dev.

Referenced by Xorriso_node_get_dev().

◆ iso_symlink_get_dest()

const char* iso_symlink_get_dest ( const IsoSymlink link)

Get the destination of a node. The returned string belongs to the node and should not be modified nor freed. Use strdup if you really need your own copy.

Definition at line 1082 of file node.c.

References Iso_Symlink::dest.

Referenced by Xorriso_ls(), Xorriso_ls_filev(), and Xorriso_tree_restore_node().

◆ iso_symlink_set_dest()

int iso_symlink_set_dest ( IsoSymlink link,
const char *  dest 
)

Set the destination of a link.

Definition at line 1090 of file node.c.

References Iso_Symlink::dest, iso_node_is_valid_link_dest(), ISO_OUT_OF_MEM, and ISO_SUCCESS.

◆ iter_free()

static void iter_free ( IsoDirIter iter)
static

Definition at line 781 of file node.c.

References Iso_Dir_Iter::data, iso_node_unref(), and dir_iter_data::pos.

◆ iter_has_next()

static int iter_has_next ( IsoDirIter iter)
static

Check if there're more children.

Returns
1 dir has more elements, 0 no, < 0 error Possible errors: ISO_NULL_POINTER, if iter is NULL

Definition at line 766 of file node.c.

References Iso_Dir::children, Iso_Dir_Iter::data, Iso_Dir_Iter::dir, ISO_NULL_POINTER, Iso_Node::next, and dir_iter_data::pos.

◆ iter_next()

◆ iter_notify_child_taken()

void iter_notify_child_taken ( IsoDirIter iter,
IsoNode node 
)

Definition at line 959 of file node.c.

◆ iter_remove()

static int iter_remove ( IsoDirIter iter)
static

◆ iter_take()

static int iter_take ( IsoDirIter iter)
static

◆ 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().

Variable Documentation

◆ iter_class

struct iso_dir_iter_iface iter_class
static
Initial value:
= {
}
static int iter_has_next(IsoDirIter *iter)
Definition: node.c:766
static int iter_remove(IsoDirIter *iter)
Definition: node.c:939
static int iter_next(IsoDirIter *iter, IsoNode **node)
Definition: node.c:708
static int iter_take(IsoDirIter *iter)
Definition: node.c:915
void iter_notify_child_taken(IsoDirIter *iter, IsoNode *node)
Definition: node.c:959
static void iter_free(IsoDirIter *iter)
Definition: node.c:781

Definition at line 959 of file node.c.

Referenced by iso_dir_get_children().

◆ iter_reg

struct iter_reg_node* iter_reg = NULL
static

Definition at line 1411 of file node.c.

Referenced by iso_dir_iter_register(), iso_dir_iter_unregister(), and iso_notify_dir_iters().