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)  

findjob.h
Go to the documentation of this file.
1 
2 /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
3 
4  Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net>
5 
6  Provided under GPL version 2 or later.
7 
8  This file contains declarations of classes FindjoB, ExprnodE, ExprtesT
9  which perform tree searches in libisofs or in POSIX filesystem.
10 */
11 
12 
13 #ifndef Xorriso_pvt_findjob_includeD
14 #define Xorriso_pvt_findjob_includeD yes
15 
16 
17 #define Xorriso_findjob_on_expR yes
18 
19 #ifdef Xorriso_findjob_on_expR
20 
21 /*
22  A single Testnode.
23 */
24 struct ExprtesT {
25 
26  struct FindjoB *boss;
27 
28  int invert; /* 0=normal 1=invert result */
29 
30  /*
31  0= -false (with invert : -true)
32  1= -name char *arg1 (regex_t in *arg2)
33  2= -type char *arg1
34  3= -damaged
35  4= -lba_range int *arg1 int *arg2
36  5= -has_acl
37  6= -has_xattr
38  7= -has_aaip
39  8= -has_filter
40  9= -wanted_node IsoNode *arg1 (for internal use, arg1 not allocated)
41  10= -pending_data
42  11= -decision char *arg1 ("yes", "no")
43  12= -prune
44  13= -wholename char *arg1 (regex_t in *arg2)
45  14= -has_any_xattr
46  15= -has_md5
47  16= -disk_name char *arg1 (regex_t in *arg2)
48  17= -hidden int *arg1 (bit0=iso_rr, bit1=joliet)
49  18= -has_hfs_crtp char *creator char *type
50  19= -has_hfs_bless int bless_index
51  20= -disk_path char *arg1
52  21= -bad_outname int namespace
53  22= -use_pattern char *arg1 ("on" [or "ls"], "off")
54  23= -or_use_pattern char *arg1 ("on" [or "ls"], "off")
55  24= -name_limit_blocker int *arg1
56  25= -maxdepth int *arg1
57  26= -mindepth int *arg1
58  */
59  int test_type;
60 
61  void *arg1;
62  void *arg2;
63 
64 };
65 
66 
67 /*
68  A computational node.
69  A tree of these nodes forms the expression.
70  Sequences of AND/OR operations form branches, brackets spawn new branches,
71  NOT inverts node's test resp. subtree result.
72 */
73 struct ExprnodE {
74 
75  struct ExprnodE *up;
76 
77  char origin[8];
78 
79  /* Operators */
80  int invert; /* 0=normal 1=invert own result (subtree or test, but not op) */
81 
82  int assoc; /*
83  0= left : compute own value, combine with left value,
84  compute right value, combine with current value
85  1= right: compute own value, compute right value,
86  combine own and right, combine with left value
87  */
88 
89  int use_shortcuts; /* 0= evaluate all tests of -and and -or,
90  1= evaluate only until the combined result is known
91  */
92 
93  struct ExprnodE *left;
94  int left_op; /* 0=OR , 1=AND */
95 
96  struct ExprnodE *right;
97  int right_op; /* see left_op */
98 
99  /* Brackets : a pointer to the first node in a subchain */
100  struct ExprnodE *sub;
101 
105 
106  /* elementary test : if sub!=NULL , test is ignored */
107  struct ExprtesT *test;
108 
109  /* Result */
112 
113 };
114 
115 
116 struct FindjoB {
117 
118  char *start_path;
119 
121 
122  struct ExprnodE *cursor;
123  int invert; /* 0=normal 1=set invert-property for next new test node */
125 
126  /* 0= echo
127  1= rm (also rmdir)
128  2= rm_r
129 >>> 3= mv target
130  4= chown user
131  5= chgrp group
132  6= chmod mode_and mode_or
133  7= alter_date type date
134  8= lsdl
135  9= chown_r user
136  10= chgrp_r group
137  11= chmod_r mode_and mode_or
138  12= alter_date_r type date
139  13= find
140  14= compare disk_equivalent_of_start_path
141  15= in_iso iso_rr_equivalent_of_start_path
142  16= not_in_iso iso_rr_equiv
143  17= update disk_equiv
144  18= add_missing iso_rr_equiv
145  19= empty_iso_dir iso_rr_equiv
146  20= is_full_in_iso iso_rr_equiv
147  21= report_damage
148  22= report_lba
149  23= internal: memorize path of last matching node in found_path
150  24= getfacl
151  25= setfacl access_acl default_acl
152  26= getfattr
153  27= setfattr
154  28= set_filter name
155  29= show_stream
156  30= internal: count by xorriso->node_counter
157  31= internal: register in xorriso->node_array
158  32= internal: widen_hardlinks disk_equiv: update nodes marked in di_do_widen
159  33= get_any_xattr
160  34= get_md5
161  35= check_md5
162  36= make_md5
163  37= mkisofs_r
164  38= sort_weight number
165  39= hide on|iso_rr|joliet|off
166  40= estimate_size
167  41= update_merge disk_equiv
168  42= rm_merge
169  43= clear_merge
170  44= list_extattr
171  45= set_hfs_crtp creator type
172  46= get_hfs_crtp
173  47= set_hfs_bless blessing
174  48= get_hfs_bless
175  49= internal: update creator, type, and blessings from persistent isofs.*
176  50= print_outname namespace
177  51= report_sections
178  52= show_stream_id
179  53= internal: show_hfs_cmd , controlled by xorriso->show_hfs_cmd*
180  54= internal: truncate_names
181  55= internal: unique_trunc_test length
182  test for not uniquely truncatable names,
183  result delivered in XorrisO.find_unique_trunc_result
184  56= like 54 but tolerating existing truncated names
185  57= like 55 but tolerating existing truncated names
186  58= internal: last_data_file_block
187  59= set_to_mtime
188  */
189  int action;
190  int prune;
192 
193  /* action specific parameters */
194  char *target;
195  char *text_2;
196  uid_t user;
197  gid_t group;
198  mode_t mode_and, mode_or;
199  int type; /* see Xorriso_set_time flag,
200  also used as weight and truncate_length */
201  time_t date;
202  char *found_path;
205  struct FindjoB *subjob;
207 
208  /* Errors */
209  char errmsg[4096];
210  int errn; /*
211  >0 = UNIX errno
212  -1 = close_bracket: no bracket open
213  -2 = binary operator or closing bracket expected
214  -3 = unexpected binary operator or closing bracket
215  -4 = unsupported command
216  -5 = -then -elseif -else -endif without -if or at wrong place
217  */
218 
219  /* Counts the test matches */
220  unsigned long match_count;
221 
222  /* Current depth of tree walking. Relative to start path. */
223  int depth;
224 
225 };
226 
227 
228 int Exprnode_destroy(struct ExprnodE **fnode, int flag);
229 
230 int Exprnode_tree_value(struct XorrisO *xorriso, struct ExprnodE *fnode,
231  int left_value, void *node, char *name, char *path,
232  struct stat *boss_stbuf, struct stat *stbuf, int flag);
233 
234 
235 int Findjob_new(struct FindjoB **o, char *start_path, int flag);
236 
237 int Findjob_destroy(struct FindjoB **o, int flag);
238 
239 int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag);
240 
241 int Findjob_get_start_path(struct FindjoB *o, char **start_path, int flag);
242 
243 int Findjob_set_commit_filter_2(struct FindjoB *o, int flag);
244 
245 int Findjob_set_num_filter(struct FindjoB *o, int test_type,
246  int num1, int num2, int flag);
247 
248 int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count,
249  int flag);
250 
251 int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag);
252 
253 /* @param value -1= only undamaged files, 1= only damaged files
254 */
255 int Findjob_set_damage_filter(struct FindjoB *o, int value, int flag);
256 
257 int Findjob_set_test_hidden(struct FindjoB *o, int mode, int flag);
258 
259 int Findjob_set_crtp_filter(struct FindjoB *o, char *creator, char *hfs_type,
260  int flag);
261 
262 int Findjob_set_bless_filter(struct XorrisO *xorriso, struct FindjoB *o,
263  char *blessing, int flag);
264 
265 
266 int Findjob_set_arg1(struct FindjoB *o, int test_type, char *arg1, int flag);
267 
268 int Findjob_open_bracket(struct FindjoB *job, int flag);
269 
270 int Findjob_close_bracket(struct FindjoB *job, int flag);
271 
272 int Findjob_not(struct FindjoB *job, int flag);
273 
274 int Findjob_and(struct FindjoB *job, int flag);
275 
276 int Findjob_or(struct FindjoB *job, int flag);
277 
278 int Findjob_if(struct FindjoB *job, int flag);
279 
280 int Findjob_then(struct FindjoB *job, int flag);
281 
282 int Findjob_else(struct FindjoB *job, int flag);
283 
284 int Findjob_elseif(struct FindjoB *job, int flag);
285 
286 int Findjob_endif(struct FindjoB *job, int flag);
287 
288 int Findjob_test_2(struct XorrisO *xorriso, struct FindjoB *o,
289  void *node, char *name, char *path,
290  struct stat *boss_stbuf, struct stat *stbuf, int flag);
291 
292 int Findjob_set_action_found_path(struct FindjoB *o, int flag);
293 
294 /* @param flag bit0= recursive
295 */
296 int Findjob_set_action_target(struct FindjoB *o, int action, char *target,
297  int flag);
298 
299 /* @param flag bit0= recursive
300 */
301 int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag);
302 
303 /* @param flag bit0= recursive
304 */
305 int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag);
306 
307 /* @param flag bit0= recursive
308 */
309 int Findjob_set_action_chmod(struct FindjoB *o,
310  mode_t mode_and, mode_t mode_or, int flag);
311 
312 /* @param flag bit0= recursive
313 */
314 int Findjob_set_action_chown(struct FindjoB *o, uid_t user,int flag);
315 
316 /* @param flag bit0= -wholename rather than -name
317 */
318 int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag);
319 
320 int Findjob_set_file_type(struct FindjoB *o, char file_type, int flag);
321 
322 /* @param value -1= files without ACL, 1= only files with ACL
323 */
324 int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag);
325 
326 /* @param value -1= files without xattr, 1= only files with xattr
327  @param flag bit0=-has_any_xattr rather than -has_xattr
328 */
329 int Findjob_set_xattr_filter(struct FindjoB *o, int value, int flag);
330 
331 /* @param value -1= files without aaip, 1= only files with aaip
332 */
333 int Findjob_set_aaip_filter(struct FindjoB *o, int value, int flag);
334 
335 /* @param value -1= files without filter, 1= files with filter
336 */
337 int Findjob_set_filter_filter(struct FindjoB *o, int value, int flag);
338 
339 /* @param value -1= only without property, 1= only with property
340  @param flag bit0= pseudo-test:
341  if no operator is open, do nothing and return 2
342 */
343 int Findjob_set_prop_filter(struct FindjoB *o, int test_type, int value,
344  int flag);
345 
346 /* @param value -1= true, 1= false
347  @param flag bit0= pseudo-test:
348  if no operator is open, do nothing and return 2
349 */
350 int Findjob_set_false(struct FindjoB *o, int value, int flag);
351 
352 int Findjob_set_prune(struct FindjoB *o, int flag);
353 
354 
355 int Findjob_set_action_subjob(struct FindjoB *o, int action,
356  struct FindjoB *subjob, int flag);
357 
358 int Findjob_set_action_text_2(struct FindjoB *o, int action, char *target,
359  char* text_2, int flag);
360 
361 int Findjob_set_action_type(struct FindjoB *o, int action, int type, int flag);
362 
363 
364 int Findjob_get_action(struct FindjoB *o, int flag);
365 
366 int Findjob_get_action_parms(struct FindjoB *o, char **target, char **text_2,
367  uid_t *user, gid_t *group,
368  mode_t *mode_and, mode_t *mode_or,
369  int *type, time_t *date, struct FindjoB **subjob,
370  int flag);
371 
372 int Findjob_set_found_path(struct FindjoB *o, char *path, int flag);
373 
374 int Findjob_get_found_path(struct FindjoB *o, char **path, int flag);
375 
376 int Findjob_get_last_data_file_block(struct FindjoB *o, uint32_t *lba,
377  int flag);
378 
379 #else /* Xorriso_findjob_on_expR */
380 
381 
382 struct FindjoB;
383 
384 
385 int Findjob_new(struct FindjoB **o, char *start_path, int flag);
386 
387 int Findjob_destroy(struct FindjoB **job, int flag);
388 
389 
390 /* @return 0=no match , 1=match , <0 = error
391 */
392 int Findjob_test(struct FindjoB *job, char *name,
393  struct stat *boss_stbuf, struct stat *stbuf,
394  int depth, int flag);
395 
396 /* @return <0 error, >=0 see xorriso.c struct FindjoB.action
397 */
398 int Findjob_get_action(struct FindjoB *o, int flag);
399 
400 /* @return <0 error, >=0 see xorriso.c struct FindjoB.action
401 */
402 int Findjob_get_action_parms(struct FindjoB *o, char **target, char **text_2,
403  uid_t *user, gid_t *group,
404  mode_t *mode_and, mode_t *mode_or,
405  int *type, time_t *date, struct FindjoB **subjob,
406  int flag);
407 
408 /* @param flag bit0= recursive
409 */
410 int Findjob_set_action_target(struct FindjoB *o, int action, char *target,
411  int flag);
412 
413 /* @param flag bit0= recursive
414 */
415 int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag);
416 
417 /* @param flag bit0= recursive
418 */
419 int Findjob_set_action_chmod(struct FindjoB *o,
420  mode_t mode_and, mode_t mode_or, int flag);
421 
422 /* @param flag bit0= recursive
423 */
424 int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag);
425 
426 int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag);
427 
428 int Findjob_set_action_found_path(struct FindjoB *o, int flag);
429 
430 int Findjob_get_start_path(struct FindjoB *o, char **start_path, int flag);
431 
432 int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count,
433  int flag);
434 
435 int Findjob_get_lba_damage_filter(struct FindjoB *o, int *start_lba,
436  int *end_lba, int *damage_filter, int flag);
437 
438 int Findjob_get_commit_filter(struct FindjoB *o, int *commit_filter, int flag);
439 
440 int Findjob_get_acl_filter(struct FindjoB *o, int *acl_filter, int flag);
441 
442 int Findjob_get_xattr_filter(struct FindjoB *o, int *xattr_filter, int flag);
443 
444 int Findjob_get_aaip_filter(struct FindjoB *o, int *aaip_filter, int flag);
445 
446 int Findjob_get_filter_filter(struct FindjoB *o, int *value, int flag);
447 
448 int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag);
449 
450 int Findjob_get_wanted_node(struct FindjoB *o, void **wanted_node, int flag);
451 
452 int Findjob_set_found_path(struct FindjoB *o, char *path, int flag);
453 
454 int Findjob_get_found_path(struct FindjoB *o, char **path, int flag);
455 
456 int Findjob_get_last_data_file_block(struct FindjoB *o, uint32_t *lba,
457  int flag);
458 
459 #endif /* ! Xorriso_findjob_on_expR */
460 
461 
462 #endif /* ! Xorriso_pvt_findjob_includeD */
463 
int Findjob_set_arg1(struct FindjoB *o, int test_type, char *arg1, int flag)
Definition: findjob.c:1050
int Findjob_set_found_path(struct FindjoB *o, char *path, int flag)
Definition: findjob.c:1091
int Findjob_then(struct FindjoB *job, int flag)
Definition: findjob.c:644
int Findjob_not(struct FindjoB *job, int flag)
Definition: findjob.c:564
int Findjob_set_action_found_path(struct FindjoB *o, int flag)
Definition: findjob.c:1292
int Findjob_set_xattr_filter(struct FindjoB *o, int value, int flag)
Definition: findjob.c:945
int Findjob_if(struct FindjoB *job, int flag)
Definition: findjob.c:627
int Findjob_set_action_subjob(struct FindjoB *o, int action, struct FindjoB *subjob, int flag)
Definition: findjob.c:1282
int Findjob_get_start_path(struct FindjoB *o, char **start_path, int flag)
Definition: findjob.c:434
int Exprnode_tree_value(struct XorrisO *xorriso, struct ExprnodE *fnode, int left_value, void *node, char *name, char *path, struct stat *boss_stbuf, struct stat *stbuf, int flag)
Definition: findjob.c:249
int Findjob_and(struct FindjoB *job, int flag)
Definition: findjob.c:576
int Findjob_set_action_chown(struct FindjoB *o, uid_t user, int flag)
Definition: findjob.c:1193
int Findjob_get_action(struct FindjoB *o, int flag)
Definition: findjob.c:1120
int Findjob_test_2(struct XorrisO *xorriso, struct FindjoB *o, void *node, char *name, char *path, struct stat *boss_stbuf, struct stat *stbuf, int flag)
Definition: findjob.c:1147
int Findjob_else(struct FindjoB *job, int flag)
Definition: findjob.c:675
int Findjob_set_action_text_2(struct FindjoB *o, int action, char *target, char *text_2, int flag)
Definition: findjob.c:1181
int Findjob_set_aaip_filter(struct FindjoB *o, int value, int flag)
Definition: findjob.c:956
int Findjob_set_test_hidden(struct FindjoB *o, int mode, int flag)
Definition: findjob.c:912
int Findjob_set_commit_filter_2(struct FindjoB *o, int flag)
Definition: findjob.c:1037
int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count, int flag)
Definition: findjob.c:898
int Findjob_set_num_filter(struct FindjoB *o, int test_type, int num1, int num2, int flag)
Definition: findjob.c:876
int Findjob_set_action_target(struct FindjoB *o, int action, char *target, int flag)
Definition: findjob.c:1163
int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag)
Definition: findjob.c:1021
int Findjob_open_bracket(struct FindjoB *job, int flag)
Definition: findjob.c:528
int Findjob_close_bracket(struct FindjoB *job, int flag)
Definition: findjob.c:544
int Findjob_elseif(struct FindjoB *job, int flag)
Definition: findjob.c:707
int Findjob_set_false(struct FindjoB *o, int value, int flag)
Definition: findjob.c:1073
int Findjob_set_damage_filter(struct FindjoB *o, int value, int flag)
Definition: findjob.c:867
int Findjob_set_prop_filter(struct FindjoB *o, int test_type, int value, int flag)
Definition: findjob.c:847
int Findjob_set_action_chmod(struct FindjoB *o, mode_t mode_and, mode_t mode_or, int flag)
Definition: findjob.c:1237
int Findjob_set_action_type(struct FindjoB *o, int action, int type, int flag)
Definition: findjob.c:1172
int Findjob_or(struct FindjoB *job, int flag)
Definition: findjob.c:600
int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag)
Definition: findjob.c:773
int Findjob_set_filter_filter(struct FindjoB *o, int value, int flag)
Definition: findjob.c:967
int Findjob_destroy(struct FindjoB **o, int flag)
Definition: findjob.c:401
int Findjob_endif(struct FindjoB *job, int flag)
Definition: findjob.c:744
int Findjob_new(struct FindjoB **o, char *start_path, int flag)
Definition: findjob.c:355
int Findjob_set_prune(struct FindjoB *o, int flag)
Definition: findjob.c:1082
int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag)
Definition: findjob.c:933
int Findjob_get_last_data_file_block(struct FindjoB *o, uint32_t *lba, int flag)
Definition: findjob.c:1112
int Exprnode_destroy(struct ExprnodE **fnode, int flag)
Definition: findjob.c:126
int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag)
Definition: findjob.c:420
int Findjob_get_found_path(struct FindjoB *o, char **path, int flag)
Definition: findjob.c:1105
int Findjob_set_file_type(struct FindjoB *o, char file_type, int flag)
Definition: findjob.c:820
int Findjob_set_crtp_filter(struct FindjoB *o, char *creator, char *hfs_type, int flag)
Definition: findjob.c:976
int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag)
Definition: findjob.c:1215
int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag)
Definition: findjob.c:1261
int Findjob_set_bless_filter(struct XorrisO *xorriso, struct FindjoB *o, char *blessing, int flag)
Definition: findjob.c:998
int Findjob_get_action_parms(struct FindjoB *o, char **target, char **text_2, uid_t *user, gid_t *group, mode_t *mode_and, mode_t *mode_or, int *type, time_t *date, struct FindjoB **subjob, int flag)
Definition: findjob.c:1128
struct ExprnodE * sub
Definition: findjob.h:100
int left_op
Definition: findjob.h:94
int composed_value
Definition: findjob.h:111
struct ExprnodE * true_branch
Definition: findjob.h:103
int is_if_then_else
Definition: findjob.h:102
int assoc
Definition: findjob.h:82
int own_value
Definition: findjob.h:110
struct ExprnodE * right
Definition: findjob.h:96
char origin[8]
Definition: findjob.h:77
struct ExprnodE * left
Definition: findjob.h:93
int invert
Definition: findjob.h:80
struct ExprnodE * up
Definition: findjob.h:75
int use_shortcuts
Definition: findjob.h:89
struct ExprnodE * false_branch
Definition: findjob.h:104
struct ExprtesT * test
Definition: findjob.h:107
int right_op
Definition: findjob.h:97
struct FindjoB * boss
Definition: findjob.h:26
void * arg2
Definition: findjob.h:62
void * arg1
Definition: findjob.h:61
int invert
Definition: findjob.h:28
int test_type
Definition: findjob.h:59
int use_pattern
Definition: findjob.h:191
char * target
Definition: findjob.h:194
time_t date
Definition: findjob.h:201
struct ExprnodE * cursor
Definition: findjob.h:122
int use_shortcuts
Definition: findjob.h:124
unsigned long match_count
Definition: findjob.h:220
uid_t user
Definition: findjob.h:196
gid_t group
Definition: findjob.h:197
int action
Definition: findjob.h:189
int type
Definition: findjob.h:199
char errmsg[4096]
Definition: findjob.h:209
int errn
Definition: findjob.h:210
uint32_t last_data_file_block
Definition: findjob.h:206
char * start_path
Definition: findjob.h:118
int prune
Definition: findjob.h:190
char * text_2
Definition: findjob.h:195
off_t estim_lower_size
Definition: findjob.h:204
off_t estim_upper_size
Definition: findjob.h:203
struct ExprnodE * test_tree
Definition: findjob.h:120
int invert
Definition: findjob.h:123
mode_t mode_and
Definition: findjob.h:198
struct FindjoB * subjob
Definition: findjob.h:205
mode_t mode_or
Definition: findjob.h:198
int depth
Definition: findjob.h:223
char * found_path
Definition: findjob.h:202