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)  

find.c File Reference
#include "libisofs.h"
#include "node.h"
#include <fnmatch.h>
#include <string.h>
Include dependency graph for find.c:

Go to the source code of this file.

Data Structures

struct  iso_find_condition
 
struct  find_iter_data
 
struct  cond_times
 
struct  logical_binary_conditions
 

Functions

static int get_next (struct find_iter_data *iter, IsoNode **n)
 
static void update_next (IsoDirIter *iter)
 
static int find_iter_next (IsoDirIter *iter, IsoNode **node)
 
static int find_iter_has_next (IsoDirIter *iter)
 
static void find_iter_free (IsoDirIter *iter)
 
static int find_iter_take (IsoDirIter *iter)
 
static int find_iter_remove (IsoDirIter *iter)
 
void find_notify_child_taken (IsoDirIter *iter, IsoNode *node)
 
int iso_dir_find_children (IsoDir *dir, IsoFindCondition *cond, IsoDirIter **iter)
 
static int cond_name_matches (IsoFindCondition *cond, IsoNode *node)
 
static void cond_name_free (IsoFindCondition *cond)
 
IsoFindConditioniso_new_find_conditions_name (const char *wildcard)
 
static int cond_mode_matches (IsoFindCondition *cond, IsoNode *node)
 
static void cond_mode_free (IsoFindCondition *cond)
 
IsoFindConditioniso_new_find_conditions_mode (mode_t mask)
 
static int cond_gid_matches (IsoFindCondition *cond, IsoNode *node)
 
static void cond_gid_free (IsoFindCondition *cond)
 
IsoFindConditioniso_new_find_conditions_gid (gid_t gid)
 
static int cond_uid_matches (IsoFindCondition *cond, IsoNode *node)
 
static void cond_uid_free (IsoFindCondition *cond)
 
IsoFindConditioniso_new_find_conditions_uid (uid_t uid)
 
static int cond_time_matches (IsoFindCondition *cond, IsoNode *node)
 
static void cond_time_free (IsoFindCondition *cond)
 
IsoFindConditioniso_new_find_conditions_atime (time_t time, enum iso_find_comparisons comparison)
 
IsoFindConditioniso_new_find_conditions_mtime (time_t time, enum iso_find_comparisons comparison)
 
IsoFindConditioniso_new_find_conditions_ctime (time_t time, enum iso_find_comparisons comparison)
 
static void cond_logical_binary_free (IsoFindCondition *cond)
 
static int cond_logical_and_matches (IsoFindCondition *cond, IsoNode *node)
 
IsoFindConditioniso_new_find_conditions_and (IsoFindCondition *a, IsoFindCondition *b)
 
static int cond_logical_or_matches (IsoFindCondition *cond, IsoNode *node)
 
IsoFindConditioniso_new_find_conditions_or (IsoFindCondition *a, IsoFindCondition *b)
 
static void cond_not_free (IsoFindCondition *cond)
 
static int cond_not_matches (IsoFindCondition *cond, IsoNode *node)
 
IsoFindConditioniso_new_find_conditions_not (IsoFindCondition *negate)
 

Variables

static struct iso_dir_iter_iface find_iter_class
 

Function Documentation

◆ cond_gid_free()

static void cond_gid_free ( IsoFindCondition cond)
static

Definition at line 396 of file find.c.

References find_iter_data::cond, and iso_find_condition::data.

Referenced by iso_new_find_conditions_gid().

◆ cond_gid_matches()

static int cond_gid_matches ( IsoFindCondition cond,
IsoNode node 
)
static

Definition at line 389 of file find.c.

References find_iter_data::cond, iso_find_condition::data, and Iso_Node::gid.

Referenced by iso_new_find_conditions_gid().

◆ cond_logical_and_matches()

static int cond_logical_and_matches ( IsoFindCondition cond,
IsoNode node 
)
static

◆ cond_logical_binary_free()

static void cond_logical_binary_free ( IsoFindCondition cond)
static

◆ cond_logical_or_matches()

static int cond_logical_or_matches ( IsoFindCondition cond,
IsoNode node 
)
static

◆ cond_mode_free()

static void cond_mode_free ( IsoFindCondition cond)
static

Definition at line 344 of file find.c.

References find_iter_data::cond, and iso_find_condition::data.

Referenced by iso_new_find_conditions_mode().

◆ cond_mode_matches()

static int cond_mode_matches ( IsoFindCondition cond,
IsoNode node 
)
static

Definition at line 337 of file find.c.

References find_iter_data::cond, iso_find_condition::data, and Iso_Node::mode.

Referenced by iso_new_find_conditions_mode().

◆ cond_name_free()

static void cond_name_free ( IsoFindCondition cond)
static

Definition at line 303 of file find.c.

References find_iter_data::cond, and iso_find_condition::data.

Referenced by iso_new_find_conditions_name().

◆ cond_name_matches()

static int cond_name_matches ( IsoFindCondition cond,
IsoNode node 
)
static

Definition at line 295 of file find.c.

References find_iter_data::cond, iso_find_condition::data, and Iso_Node::name.

Referenced by iso_new_find_conditions_name().

◆ cond_not_free()

static void cond_not_free ( IsoFindCondition cond)
static

Definition at line 732 of file find.c.

References iso_find_condition::data, and iso_find_condition::free.

Referenced by iso_new_find_conditions_not().

◆ cond_not_matches()

static int cond_not_matches ( IsoFindCondition cond,
IsoNode node 
)
static

Definition at line 740 of file find.c.

References iso_find_condition::data, and iso_find_condition::matches.

Referenced by iso_new_find_conditions_not().

◆ cond_time_free()

static void cond_time_free ( IsoFindCondition cond)
static

◆ cond_time_matches()

◆ cond_uid_free()

static void cond_uid_free ( IsoFindCondition cond)
static

Definition at line 441 of file find.c.

References find_iter_data::cond, and iso_find_condition::data.

Referenced by iso_new_find_conditions_uid().

◆ cond_uid_matches()

static int cond_uid_matches ( IsoFindCondition cond,
IsoNode node 
)
static

Definition at line 434 of file find.c.

References find_iter_data::cond, iso_find_condition::data, and Iso_Node::uid.

Referenced by iso_new_find_conditions_uid().

◆ find_iter_free()

◆ find_iter_has_next()

static int find_iter_has_next ( IsoDirIter iter)
static

Definition at line 160 of file find.c.

References find_iter_data::current, Iso_Dir_Iter::data, and find_iter_data::iter.

◆ find_iter_next()

static int find_iter_next ( IsoDirIter iter,
IsoNode **  node 
)
static

◆ find_iter_remove()

static int find_iter_remove ( IsoDirIter iter)
static

◆ find_iter_take()

static int find_iter_take ( IsoDirIter iter)
static

◆ find_notify_child_taken()

void find_notify_child_taken ( IsoDirIter iter,
IsoNode node 
)

Definition at line 213 of file find.c.

◆ get_next()

◆ iso_dir_find_children()

int iso_dir_find_children ( IsoDir dir,
IsoFindCondition cond,
IsoDirIter **  iter 
)

Find all directory children that match the given condition.

Parameters
dirDirectory where we will search children.
condCondition that the children must match in order to be returned. It will be free together with the iterator. Remember to delete it if this function return error.
iterIterator that returns only the children that match condition.
Returns
1 on success, < 0 on error
Since
0.6.4

Definition at line 238 of file find.c.

References Iso_Dir_Iter::class, find_iter_data::cond, find_iter_data::current, Iso_Dir_Iter::data, find_iter_data::dir, Iso_Dir_Iter::dir, find_iter_data::err, find_iter_class, find_iter_data::free_cond, iso_dir_get_children(), iso_dir_iter_register(), iso_node_ref(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, find_iter_data::iter, find_iter_data::itersec, find_iter_data::prev, and update_next().

Referenced by get_next(), and update_next().

◆ iso_new_find_conditions_and()

IsoFindCondition* iso_new_find_conditions_and ( IsoFindCondition a,
IsoFindCondition b 
)

Create a new condition that check if the two given conditions are valid.

Parameters
a
bIsoFindCondition to compare
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 668 of file find.c.

References logical_binary_conditions::a, logical_binary_conditions::b, cond_logical_and_matches(), cond_logical_binary_free(), iso_find_condition::data, iso_find_condition::free, and iso_find_condition::matches.

◆ iso_new_find_conditions_atime()

IsoFindCondition* iso_new_find_conditions_atime ( time_t  time,
enum iso_find_comparisons  comparison 
)

Create a new condition that checks the time of last access.

Parameters
timeTime to compare against IsoNode atime.
comparisonComparison to be done between IsoNode atime and submitted time. Note that ISO_FIND_COND_GREATER, for example, is true if the node time is greater than the submitted time.
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 533 of file find.c.

References cond_times::comparison, cond_time_free(), cond_time_matches(), iso_find_condition::data, iso_find_condition::free, iso_find_condition::matches, cond_times::time, and cond_times::what_time.

◆ iso_new_find_conditions_ctime()

IsoFindCondition* iso_new_find_conditions_ctime ( time_t  time,
enum iso_find_comparisons  comparison 
)

Create a new condition that checks the time of last status change.

Parameters
timeTime to compare against IsoNode ctime.
comparisonComparison to be done between IsoNode ctime and submitted time. Note that ISO_FIND_COND_GREATER, for example, is true if the node time is greater than the submitted time.
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 607 of file find.c.

References cond_times::comparison, cond_time_free(), cond_time_matches(), iso_find_condition::data, iso_find_condition::free, iso_find_condition::matches, cond_times::time, and cond_times::what_time.

◆ iso_new_find_conditions_gid()

IsoFindCondition* iso_new_find_conditions_gid ( gid_t  gid)

Create a new condition that checks the node gid.

Parameters
gidDesired Group Id.
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 411 of file find.c.

References find_iter_data::cond, cond_gid_free(), cond_gid_matches(), iso_find_condition::data, iso_find_condition::free, and iso_find_condition::matches.

◆ iso_new_find_conditions_mode()

IsoFindCondition* iso_new_find_conditions_mode ( mode_t  mask)

Create a new condition that checks the node mode against a mode mask. It can be used to check both file type and permissions.

For example:

iso_new_find_conditions_mode(S_IFREG) : search for regular files iso_new_find_conditions_mode(S_IFCHR | S_IWUSR) : search for character devices where owner has write permissions.

Parameters
maskMode mask to AND against node mode.
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 366 of file find.c.

References find_iter_data::cond, cond_mode_free(), cond_mode_matches(), iso_find_condition::data, iso_find_condition::free, and iso_find_condition::matches.

◆ iso_new_find_conditions_mtime()

IsoFindCondition* iso_new_find_conditions_mtime ( time_t  time,
enum iso_find_comparisons  comparison 
)

Create a new condition that checks the time of last modification.

Parameters
timeTime to compare against IsoNode mtime.
comparisonComparison to be done between IsoNode mtime and submitted time. Note that ISO_FIND_COND_GREATER, for example, is true if the node time is greater than the submitted time.
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 570 of file find.c.

References cond_times::comparison, cond_time_free(), cond_time_matches(), iso_find_condition::data, iso_find_condition::free, iso_find_condition::matches, cond_times::time, and cond_times::what_time.

◆ iso_new_find_conditions_name()

IsoFindCondition* iso_new_find_conditions_name ( const char *  wildcard)

Create a new condition that checks if the node name matches the given wildcard.

Parameters
wildcard
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 318 of file find.c.

References find_iter_data::cond, cond_name_free(), cond_name_matches(), iso_find_condition::data, iso_find_condition::free, and iso_find_condition::matches.

◆ iso_new_find_conditions_not()

IsoFindCondition* iso_new_find_conditions_not ( IsoFindCondition negate)

Create a new condition that check if the given conditions is false.

Parameters
negate
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 755 of file find.c.

References cond_not_free(), cond_not_matches(), iso_find_condition::data, iso_find_condition::free, and iso_find_condition::matches.

◆ iso_new_find_conditions_or()

IsoFindCondition* iso_new_find_conditions_or ( IsoFindCondition a,
IsoFindCondition b 
)

Create a new condition that check if at least one the two given conditions is valid.

Parameters
a
bIsoFindCondition to compare
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 709 of file find.c.

References logical_binary_conditions::a, logical_binary_conditions::b, cond_logical_binary_free(), cond_logical_or_matches(), iso_find_condition::data, iso_find_condition::free, and iso_find_condition::matches.

◆ iso_new_find_conditions_uid()

IsoFindCondition* iso_new_find_conditions_uid ( uid_t  uid)

Create a new condition that checks the node uid.

Parameters
uidDesired User Id.
Returns
The created IsoFindCondition, NULL on error.
Since
0.6.4

Definition at line 456 of file find.c.

References find_iter_data::cond, cond_uid_free(), cond_uid_matches(), iso_find_condition::data, iso_find_condition::free, and iso_find_condition::matches.

◆ update_next()

Variable Documentation

◆ find_iter_class

struct iso_dir_iter_iface find_iter_class
static
Initial value:
= {
}
static void find_iter_free(IsoDirIter *iter)
Definition: find.c:168
static int find_iter_has_next(IsoDirIter *iter)
Definition: find.c:160
static int find_iter_next(IsoDirIter *iter, IsoNode **node)
Definition: find.c:142
static int find_iter_remove(IsoDirIter *iter)
Definition: find.c:203
static int find_iter_take(IsoDirIter *iter)
Definition: find.c:192
void find_notify_child_taken(IsoDirIter *iter, IsoNode *node)
Definition: find.c:213

Definition at line 213 of file find.c.

Referenced by iso_dir_find_children().