1 
2 /* Command line oriented batch and dialog tool which creates, loads,
3    manipulates and burns ISO 9660 filesystem images.
4 
5    Copyright 2007-2017 Thomas Schmitt, <scdbackup@gmx.net>
6 
7    Provided under GPL version 2 or later.
8 
9    This file contains inner declarations of xorriso.
10    The public interface is in xorriso.h
11 */
12 
13 
14 /* For now, #ifdef Xorriso_is_xorriso_selF  has no meaning.
15    But it is already now to be set only by the xorriso.c module.
16 */
17 
18 #ifndef Xorriso_private_includeD
19 #define Xorriso_private_includeD yes
20 
21 
22 /* <<< Disable this to disable pthread_mutex locking on message and result
23        output.
24 */
25 #define Xorriso_fetch_with_msg_queueS yes
26 
27 
28 /* for uint32_t */
29 #ifdef HAVE_STDINT_H
30 #include <stdint.h>
31 #else
32 #ifdef HAVE_INTTYPES_H
33 #include <inttypes.h>
34 #endif
35 #endif
36 
37 /* for pthread_mutex_t on OpenBSD */
38 #include <pthread.h>
39 
40 
41 /** The source code release timestamp */
42 #include "xorriso_timestamp.h"
43 #ifndef Xorriso_timestamP
44 #define Xorriso_timestamP "-none-given-"
45 #endif
46 
47 /** The binary build timestamp is to be set externally by the compiler
48     or by a macro definition in xorriso_buildstamp.h.
49 */
50 #include "xorriso_buildstamp.h"
51 #ifndef Xorriso_build_timestamP
52 #define Xorriso_build_timestamP "-none-given-"
53 #endif
54 
55 
56 #include "sfile.h"
57 #include "misc_funct.h"
58 
59 
60 struct ExclusionS;        /* List of -not_* conditions */
61 struct PermiteM;          /* Stack of temporarily altered access permissions */
62 struct CheckmediajoB;     /* Parameters for Xorriso_check_media() */
63 struct SectorbitmaP;      /* Distiniction between valid and invalid sectors */
64 struct FindjoB;           /* Program and status of a find run */
65 
66 
67 /* maximum number of history lines to be reported with -status:long_history */
68 #define Xorriso_status_history_maX 100
69 
70 
71 /** The list of startup file names */
72 #define Xorriso_rc_nuM 4
73 
74 
75 /* Default setting for the size limit of single data files:
76    100 extents with 4 GB - 2 kB each = 400 GB - 200 kB
77 */
78 #define Xorriso_default_file_size_limiT \
79         (((off_t) 400) * ((off_t) 1024*1024*1024) - (off_t) 204800)
80 
81 
82 /* Maximum number of appended partitions. Effectively usable number depends
83    on system area type.
84 */
85 #define Xorriso_max_appended_partitionS 8
86 
87 
88 /*
89   Maximum length of a disc label text plus 1.
90 */
91 #define Xorriso_disc_label_sizE 129
92 
93 
94 struct XorrisO { /* the global context of xorriso */
95 
96  int libs_are_started;
97 
98  /* source */
99  char progname[SfileadrL];
100  char initial_wdx[SfileadrL];
101  int no_rc;
102 
103  /* Command line argument emulations:
104       0=xorriso mode
105       1=mkisofs mode
106       2=cdrecord mode
107  */
108  int argument_emulation;
109 
110  /** List of startupfiles */
111  char rc_filenames[Xorriso_rc_nuM][SfileadrL];
112  int rc_filename_count;
113 
114  int arrange_args;
115 
116  /* Whether .mkisofsrc has already been read */
117  int mkisofsrc_done;
118 
119  char wdi[SfileadrL];
120  char wdx[SfileadrL];
121  int did_something_useful;
122 
123  int add_plainly;
124  off_t split_size;
125 
126  char list_delimiter[81];
127 
128  /* >>> put libisofs aspects here <<< */
129 
130  int ino_behavior; /* bit0= at image load time:
131                             Do not load PX inode numbers but generate new
132                             unique ones for all loaded IsoNode.
133                       bit1= at image generation time:
134                             Do not consolidate suitable nodes to hardlinks.
135                       bit2= at restore-to-disk time:
136                             Do not consolidate suitable nodes to hardlinks.
137                       bit3= with update:
138                             Do not try to detect hardlink splits and joinings.
139                       bit4= with extract:
140                             Do not create or use hln arrays if sort_lba_on
141                       bit5= with command -lsl
142                             Do not create hln array for hard link count
143                     */
144 
145  int iso_level;
146  int iso_level_is_default;
147  int do_joliet;
148  int do_hfsplus;
149  int do_fat;
150  int do_rockridge;
151  int do_iso1999;
152  int ecma119_map;     /* 0=unmapped , 1=stripped , 2=uppercase , 3=lowercase */
153 
154  int do_aaip; /* bit0= ACL in
155                  bit1= ACL out
156                  bit2= EA in
157                  bit3= EA out
158                  bit4= record dev,inode per node, isofs_st_out in root
159                  bit5= check dev,inode,isofs_st_in
160                  bit6= omit content check if bit5 check is conclusive
161                  bit7= omit dev check with bit5
162                  bit8= store output charset in xattr "isofs.cs"
163                  bit9= set input charset from xattr "isofs.cs"
164                 bit10= if bit2: import from local filesystem all xattr
165                                 namespaces, not only "user."
166                        if bit3: export to local filesystem all xattr
167                                 namespaces, not only "user."
168               */
169 
170  int do_md5;  /* bit0= read MD5 array
171                  bit1= write session MD5
172                  bit2= write MD5 for each data file
173                  bit3= make file content stability check by double reading
174                  bit4= use recorded MD5 as proxy of ISO file
175                  bit5= with bit0: do not check tags of superblock,tree,session
176                */
177 
178  int no_emul_toc; /* bit0= On overwriteables:
179                            write first session to LBA 0 rather than 32.
180                   */
181 
182  int do_old_empty; /* See -compliance old_empty
183                       own data content: range [0,31]. The new way is to have
184                       a dedicated block to which all such files will point.
185                     */
186 
187  char scdbackup_tag_name[81];
188  char scdbackup_tag_time[19];
189  char scdbackup_tag_written[512];
190  char scdbackup_tag_listname[SfileadrL];
191 
192  int relax_compliance;        /* opaque bitfield to be set by xorrisoburn */
193  int allow_dir_id_ext_dflt; /* -compliance allow_dir_id_ext still on default */
194  char rr_reloc_dir[256];
195  int rr_reloc_flags;
196  int untranslated_name_len;
197  int do_follow_pattern;
198  int do_follow_param;
199  int do_follow_links;
200  int follow_link_limit;
201  int resolve_link_rec_count;
202  int resolve_link_rec_limit;
203  int do_follow_concat;
204  int do_follow_mount;
205  int do_global_uid;
206  uid_t global_uid;
207  int do_global_gid;
208  gid_t global_gid;
209  int do_global_mode;
210  mode_t global_dir_mode;
211  mode_t global_file_mode;
212 
213  int do_tao; /* 1= Use TAO resp. Incremental
214                -1= Use SAO resp. DAO
215                 0= let libburn choose */
216 
217  struct Xorriso_lsT *filters;
218  int filter_list_closed;
219 
220  int zlib_level;
221  int zlib_level_default;
222  int zisofs_block_size;
223  int zisofs_block_size_default;
224  int zisofs_by_magic;
225 
226  int do_overwrite; /* 0=off, 1=on, 2=nondir */
227  int do_reassure;  /* 0=off, 1=on, 2=tree */
228 
229  char volid[33];
230  int volid_default;
231  char loaded_volid[33];
232  char assert_volid[SfileadrL];
233  char assert_volid_sev[80];
234 
235  char preparer_id[129];
236 
237  char publisher[129];
238  char application_id[129];
239  char system_id[33];
240  char volset_id[129];
241 
242  char copyright_file[38];
243  char biblio_file[38];
244  char abstract_file[38];
245 
246  char application_use[SfileadrL];
247 
248  char session_logfile[SfileadrL];
249  int session_lba;
250  int session_blocks;
251 
252  /* >>> put libburn/isoburn aspects here */
253 
254  struct Xorriso_lsT *drive_blacklist;
255  struct Xorriso_lsT *drive_greylist;
256  struct Xorriso_lsT *drive_whitelist;
257 
258  int toc_emulation_flag; /* bit0= bit3 for isoburn_drive_aquire()
259                                   scan -ROM profiles for ISO sessions
260                             bit1= bit4 for isoburn_drive_aquire()
261                                   do not emulate TOC on overwriteable media
262                             bit2= bit7 for isoburn_drive_aquire()
263                                   pretend any media to be -ROM
264                             bit3= bit9 for isoburn_drive_aquire()
265                                   Ignore enclosing session at LBA 0
266                          */
267 
268  int image_start_mode;  /* From what address to load the ISO image
269                            bit0-15= addressing mode
270                             0= automatic lba as deduced from media
271                             1= value is session number
272                             2= value is track number
273                             3= value is lba
274                            bit16= with mode 3 : value is possibly 16 too high.
275                                   Let isoburn_set_msc1() adjust it.
276                            bit30= interference with normal msc1 processing
277                                   is enabled. Without this bit,
278                                   isoburn_set_msc1() will not be called.
279                            bit31= image loading has happened,
280                                   setting is kept for rollback only.
281                                   Always apply as 0=auto.
282                         */
283  char image_start_value[81]; /* value according image_start_mode */
284 
285  uint32_t displacement;
286  int displacement_sign;
287 
288  int read_fs;            /* bit0=norock , bit1=nojoliet */
289 
290  int drives_exclusive;   /* burn_preset_device_open() param exclusive */
291 
292  int linux_scsi_dev_family; /* 0= default, 1= sr, 2= scd, (3= st), 4= sg */
293 
294  int early_stdio_test;   /* For burn_allow_drive_role_4():
295                             bit1= Test whether a stdio drive can be opened for
296                                   read-write resp. read-only resp. write only.
297                             bit2= Classify files which cannot be opened at all
298                                   as role 0 : useless dummy.
299                             bit3= Classify non-empty role 5 drives as
300                                   BURN_DISC_APPENDABLE with NWA after the
301                                   end of the file. It is nevertheless
302                                   possible to change this address by call
303                                   burn_write_opts_set_start_byte().
304                           */
305 
306  int cache_num_tiles;     /* -data_cache_size */
307  int cache_tile_blocks;
308  int cache_default;       /* bit0= cache_num_tiles, bit1= cache_tile_blocks */
309 
310  int do_calm_drive;      /* bit0= calm down drive after acquiring it */
311 
312  char indev[SfileadrL];
313  void *in_drive_handle;  /* interpreted only by libburnia oriented modules */
314  void *in_volset_handle; /* interpreted only by libburnia oriented modules */
315  char *in_charset;       /* The charset to interpret the filename bytes */
316  int indev_is_exclusive;
317  char indev_off_adr[SfileadrL]; /* Result of burn_drive_convert_fs_adr(indev)
318                                    when indev gets acquired. */
319 
320  time_t isofs_st_out;    /* A time point at least 1 second before image
321                             composition began. To be stored with image as
322                             xattr "isofs.st". */
323  time_t isofs_st_in;     /* That time point as read from "isofs.st" of the
324                             loaded image. */
325 
326  int volset_change_pending; /* whether -commit would make sense
327                                0= no change pending
328                                1= change pending
329                                2= change pending, but -as misofs -print-size
330                                   was performed on the changed image model
331                                3= change pending, but the attempt to write it
332                                   failed
333                              */
334  int no_volset_present;     /* set to 1 on first failure */
335 
336  struct CheckmediajoB *check_media_default;
337  int check_media_bad_limit;      /* values defined as Xorriso_read_quality_* */
338  struct SectorbitmaP *in_sector_map; /* eventual sector validity bitmap */
339 
340 
341  char outdev[SfileadrL];
342  void *out_drive_handle; /* interpreted only by xorrisoburn.c */
343  char *out_charset;      /* The charset to produce the filename bytes for */
344  int dev_fd_1; /* The fd which substitutes for /dev/fd/1 and is
345                      connected to externaly perveived stdout.
346                   */
347  int outdev_is_exclusive;
348  char outdev_off_adr[SfileadrL]; /* Result of burn_drive_convert_fs_adr(outdev)
349 		        	    when outdev gets acquired. */
350 
351  int grow_blindly_msc2; /* if >= 0 this causes growing from drive to drive.
352                            The value is used as block address offset for
353                            image generation. Like in: mkisofs -C msc1,msc2
354                          */
355 
356  int ban_stdio_write;
357  int do_dummy;
358  int do_close;
359  int auto_close;     /* Whether to let do_close depend on media state */
360 
361  int write_speed;    /* Write speed in libburn units : 1000 bytes/second ,
362                                            0 = Max, -1 = Min, -2= do not set */
363  int read_speed;     /* Read speed. See above */
364 
365  int fs;        /* fifo size in 2048 byte chunks : at most 1 GB */
366  int padding;   /* number of bytes to add after ISO 9660 image */
367  int do_padding_by_libisofs; /* 0= by libburn , 1= by libisofs */
368 
369  int alignment; /* if > 0 : output size alignment in 2048 byte blocks.
370                             This is always done by libburn, i.e. attached
371                             outside the image. Eventual inner alignment of
372                             the image end happens first.
373                 */
374 
375  int do_stream_recording; /* 0=no, 1=yes, 2=for data, not for dir
376                              >=16 means yes with number as start LBA  */
377 
378  int dvd_obs;                 /* DVD write chunk size: 0, 32k or 64k */
379 
380  int modesty_on_drive;        /* "enable" of burn_drive_set_buffer_waiting()
381                                  0= disable , 1= enable waiting ,
382                                  (-1 = do not change setting)
383                                */
384  int min_buffer_usec;         /* The other parameters for this function */
385  int max_buffer_usec;
386  int buffer_timeout_sec;
387  int min_buffer_percent;
388  int max_buffer_percent;
389 
390  int use_immed_bit;           /* 1= on , 0= default , -1 = off */
391  int use_immed_bit_default;   /* 1= on , 0= yet undefined , -1 = off */
392 
393  int stdio_sync;              /* stdio fsync interval: -1, 0, >=32 */
394  int stdio_sync_is_default;   /* 1= is still default , 0= has been set */
395 
396  int keep_boot_image;
397  char boot_image_cat_path[SfileadrL];
398  int boot_image_cat_hidden;   /* bit0= hidden in ISO/RR , bit1= in Joliet ,
399                                  bit2= in HFS+ */
400  int boot_count; /* number of already attached boot images */
401 
402  char boot_image_bin_path[SfileadrL];
403  char boot_image_bin_form[16];
404  int boot_platform_id;
405  int patch_isolinux_image; /* bit0= boot-info-table , bit1= not with EFI
406                               bit2-7= Mentioning in isohybrid GPT
407                                       1=EFI, 2=HFS+
408                               bit8= Mention in isohybrid Apple Partition Map
409                               bit9= GRUB2 boot provisions (patch at byte 1012)
410                             */
411  int boot_image_emul; /* 0=no emulation
412                          1=emulation as hard disk
413                          2=emulation as floppy
414                       */
415  int boot_emul_default;  /* 1= boot_image_emul is still default */
416  off_t boot_image_load_size;
417  int boot_img_size_default;  /* 1= boot_image_load_size is still default */
418  int boot_img_full_size;  /* 1= override boot_image_load_size by image size */
419  unsigned char boot_id_string[29];
420  unsigned char boot_selection_crit[21];
421 
422  int boot_image_isohybrid; /* 0=off , deprecated: 1=auto , 2=on , 3=force */
423 
424  int boot_efi_default; /* 0= no effect ,
425                           1= appy --efi-boot parameters when attaching to img */
426 
427  char system_area_disk_path[SfileadrL];
428  int system_area_clear_loaded;
429  int system_area_options;             /* bit0= "GRUB protective msdos label"
430                                                (a simple partition table)
431                                          bit1= isohybrid boot image pointer
432                                                and partition table
433                                          bit2-7= System area type
434                                                0= with bit0 or bit1: MBR
435                                                   else: unspecified type
436                                                1= MIPS Big Endian Volume Header
437                                                2= MIPS Little Endian Boot Block
438                                                3= SUN Disk Label for SUN SPARC
439                                                4= HP-PA PALO boot sector
440                                                   header version 4
441                                                5= HP-PA PALO boot sector
442                                                   header version 5
443                                          bit8-9= Only with System area type 0
444                                                Cylinder alignment mode
445                                                0 = auto (align if bit1)
446                                                1 = always align
447                                                2 = never align
448                                                3 = align external partitions
449                                          bit10-13= System area sub type
450                                                With type 0 = MBR:
451                                                Gets overridden by bit0 and bit1.
452                                                0 = no particular sub type
453                                                1 = CHRP: A single MBR partition
454                                                    of type 0x96 covers the ISO
455                                                    image. Not compatible with
456                                                    any other feature which
457                                                    needs to have own MBR
458                                                    partition entries.
459                                                2 = generic MBR
460                                          bit14= Only with System area type 0
461                                                GRUB2 boot provisions:
462                                                Patch system area at byte 92 to
463                                                99 with 512-block address + 1
464                                                of the first boot image file.
465                                                Little-endian 8-byte.
466                                                Should be combined with
467                                                options bit0.
468                                          bit15= Only with MBR:
469                                                Enforce MBR "bootable/active"
470                                                flag. In worst case by dummy
471                                                partition of type 0x00 which
472                                                occupies block 0.
473                                        */
474  int patch_system_area;               /* Bits as of system_area_options.
475                                          to be applied to the loaded system
476                                          area of the image, if no
477                                          system_area_disk_path and no
478                                          system_area_options are set.
479                                        */
480 
481  /* The number of unclaimed 2K blocks before start of partition 1 as of
482     the MBR in system area.
483     If not 0 this will cause double volume descriptor sets and double tree.
484  */
485  uint32_t partition_offset;
486  /* Partition table parameter: 1 to 63, 0= disabled/default */
487  int partition_secs_per_head;
488  /* 1 to 255, 0= disabled/default */
489  int partition_heads_per_cyl;
490 
491  /* Disk file paths of content of PreP partition and EFI system partition */
492  char prep_partition[SfileadrL];
493  char efi_boot_partition[SfileadrL];
494 
495  /* Path and type of image files to be appended as MBR partitions */
496  char *appended_partitions[Xorriso_max_appended_partitionS];
497  uint8_t appended_part_types[Xorriso_max_appended_partitionS];
498  /* If 1: With appended partitions: create protective MBR and mark by GPT */
499  int appended_as_gpt;
500  /* If 1: With appended partitions: mark by APM */
501  int appended_as_apm;
502 
503  /* If 1: Apply isohybrid gestures to non-isohybrid situations */
504  int part_like_isohybrid;
505 
506  /* MBR partition type of ISO filesystem partition or protective partition
507     if not real GPT or CHRP.
508  */
509  int iso_mbr_part_type;
510 
511  /* See libisoburn.h isoburn_igopt_set_gpt_guid() */
512  uint8_t gpt_guid[16];
513  int gpt_guid_mode;
514 
515  /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
516  */
517  char ascii_disc_label[Xorriso_disc_label_sizE];
518 
519  /* A data file of which the position and size shall be written after
520     a SUN Disk Label.
521  */
522  char grub2_sparc_core[SfileadrL];
523 
524  /* HFS+ image serial number.
525     00...00 means that it shall be generated by libisofs.
526  */
527  uint8_t hfsp_serial_number[8];
528 
529  /* Allocation block size of HFS+  and APM : 0= auto , 512, or 2048
530  */
531  int hfsp_block_size;
532  int apm_block_size;
533 
534  /* User settable PVD time stamps */
535  time_t vol_creation_time;
536  time_t vol_modification_time;
537  time_t vol_expiration_time;
538  time_t vol_effective_time;
539  /* To eventually override vol_modification_time by unconverted string
540     and timezone 0 */
541  char vol_uuid[17];
542  /* To flatly set all file timestamps to the same value
543     Special value: "set_to_mtime", see -find action "set_to_mtime"
544   */
545  char all_file_dates[80];
546 
547 #ifdef Xorriso_with_libjtE
548  /* Parameters and state of Jigdo Template Export environment */
549  struct libjte_env *libjte_handle;
550 #endif
551 
552  /* List of -jigdo parameters since the most recent -jigdo clear */
553  struct Xorriso_lsT *jigdo_params;
554  struct Xorriso_lsT *jigdo_values;
555  int libjte_params_given; /* bits: 0= outfile , 1= verbosity , 2= template_path
556                                    3= jigdo_path , 4= md5_path , 5= min_size
557                                    6= checksum_iso , 7= checksum_template
558                                    8= compression , 9= exclude , 10= demand_md5
559                                   11= mapping
560                           */
561 
562  /* LBA of boot image after image loading */
563  int loaded_boot_bin_lba;
564  /* Path of the catalog node after image loading */
565  char loaded_boot_cat_path[SfileadrL];
566 
567  /* XORRISO options */
568  int allow_graft_points;   /* if not zero: yes
569                               special options:
570                               bit1= unescape '\\' too,
571                                     continue unescaping after first real '='
572                             */
573 
574  int allow_restore; /* -2=disallowed until special mode "unblock"
575                        -1=permanently disallowed
576                         0=disallowed, 1=allowed, 2=device files allowed */
577  int do_concat_split;  /* 1= restore complete split file directories as
578                              regular files
579                         */
580  int do_auto_chmod;    /* 1= eventually temporarily open access permissions
581                              of self-owned directories during restore
582                         */
583  int do_restore_sort_lba; /* 1= restore via node_array rather than via
584                                 tree traversal. Better read performance,
585                                 no directory mtime restore, needs do_auto_chmod
586                            */
587  int do_strict_acl;       /* bit0= do not tolerate inappropriate presence or
588                                    absence of directory "default" ACL
589                           */
590 
591  int mount_opts_flag; /* bit0= "shared" = not "exclusive"
592                                Try to emit non-exclusive mount command.
593                                Do not give up drives.
594                                Linux: use loop device even on block devices
595                                in order to circumvent the ban to mount a
596                                device twice (with different sbsector=)
597                                FreeBSD: ?
598                        */
599 
600  int dialog;  /* 0=off , 1=single-line , 2=multi-line */
601 
602  struct Xorriso_lsT *buffered_dialog; /* If not NULL : read by dialog */
603 
604  int bsl_interpretation;
605                      /* whether to run input through Sfile_bsl_interpreter():
606                         bit0-1= dialog and quoted file reading
607                           0= no interpretation, leave unchanged
608                           1= only inside double quotes
609                           2= outside single quotes
610                           3= everywhere
611                         bit2-3= reserved as future expansion of bit0-1
612                         bit4= interpretation within program start arguments
613                         bit5= perform backslash encoding with results
614                         bit6= perform backslash encoding with info texts
615                      */
616 
617  int sh_style_result; /* Whether not to wrap into quotation marks the file
618                          addresses reported by:
619                            pwd pwdx ls lsd lsl lsdl lsx lsdx lslx lsdlx
620                            du dus dux dusx findx find
621                          and to make du* numbers left adjusted,
622                          and not to append "/" to pwd*
623                        */
624 
625  /* Pattern matching facility. It still carries legacy from scdbackup/askme.c
626     but is fully functional for xorriso.
627  */
628  int search_mode;
629  /* 0= start text
630     1= fgrep ,
631     2= regular expression
632     3= (eventually structured) shell parser expression
633     4= shell parser expression for leaf name
634  */
635 
636  int structured_search;
637  /* 0= flat text search
638     1= '/' is a significant separator that cannot be matched by wildcards
639     ( 2= like 1 : but report only occurrence in tree, no payload, no location )
640     ( 3= like 2 : but report first content level of matching directories )
641     4= actually not structured but unique find mode (with search_mode 4)
642  */
643 
644  int do_iso_rr_pattern; /* 0=off, 1=on, 2=ls */
645  int do_disk_pattern;   /* 0=off, 1=on, 2=ls */
646 
647  int temp_mem_limit;
648 
649  off_t file_size_limit;
650  int file_name_limit;
651 
652  struct ExclusionS *disk_exclusions;
653  int disk_excl_mode; /* bit0= on (else off)
654                         bit1= parameter too (else rekursion only)
655                         bit2= whole subtree banned (else only exact path)
656                         bit3= when comparing ignore excluded files rather
657                               than to treat them as truly missing on disk
658                      */
659 
660  struct ExclusionS *iso_rr_hidings;
661  struct ExclusionS *joliet_hidings;
662  struct ExclusionS *hfsplus_hidings;
663 
664  int use_stdin; /* use raw stdin even if readline support is compiled */
665  int tolerate_stdin_eof;  /* Do not abort on EOF in Xorriso_dialog_input
666                              but rather return -2. */
667  int result_page_length;
668  int result_page_width;
669  char mark_text[SfileadrL]; /* ( stdout+stderr, M: ) */
670  int packet_output;
671  char logfile[4][SfileadrL];
672  FILE *logfile_fp[4];
673  FILE *pktlog_fp;
674  FILE *stderr_fp;
675  struct Xorriso_lsT *result_msglists[Xorriso_max_outlist_stacK];
676  struct Xorriso_lsT *info_msglists[Xorriso_max_outlist_stacK];
677  int msglist_flags[Xorriso_max_outlist_stacK]; /* bit0= result is redirected
678                                                   bit1= info is redirected
679                                                */
680  int msglist_stackfill;
681 
682  int lib_msg_queue_lock_ini;
683  int result_msglists_lock_ini;
684  pthread_mutex_t lib_msg_queue_lock;
685  pthread_mutex_t result_msglists_lock;
686 
687  int write_to_channel_lock_ini;
688  pthread_mutex_t write_to_channel_lock;
689 
690  int msg_watcher_lock_ini;
691  pthread_mutex_t msg_watcher_lock;
692  int msg_watcher_state; /* 0= inactive
693                            1= registered
694                            2= started
695                            3= request to end
696                         */
697  int (*msgw_result_handler)(void *handle, char *text);
698  void *msgw_result_handle;
699  int (*msgw_info_handler)(void *handle, char *text);
700  void *msgw_info_handle;
701  int msgw_stack_handle;
702  int msgw_msg_pending; /* 0=no, 1=fetching(i.e. maybe) , 2=yes */
703  int msgw_fetch_lock_ini;
704  pthread_mutex_t msgw_fetch_lock;
705 
706  struct Xorriso_msg_sievE *msg_sieve;
707  int msg_sieve_disabled;
708 
709  int status_history_max; /* for -status long_history */
710 
711  /* 0= no logging of SCSI commands, 1= to stderr */
712  int scsi_log;
713 
714  char report_about_text[20];
715  int report_about_severity;
716  int library_msg_direct_print;
717  char abort_on_text[20];
718  int abort_on_severity; /* A severity rank number as threshold */
719  int abort_on_is_default; /* will be set to 0 by first -abort_on */
720  int problem_status; /* Severity rank number. 0= no abort condition present */
721  char problem_status_text[20];
722  int problem_status_lock_ini;
723  pthread_mutex_t problem_status_lock;
724 
725  char errfile_log[SfileadrL]; /* for -errfile_log */
726  int errfile_mode; /* bit0= marked */
727  FILE *errfile_fp;
728 
729  int img_read_error_mode; /* 0=best_effort , 1=failure , 2=fatal */
730  int extract_error_mode; /* 0=best_effort , 1=keep , 2=delete */
731 
732  char return_with_text[20];
733  int return_with_severity;
734  int return_with_value;
735  int eternal_problem_status;
736  char eternal_problem_status_text[20];
737 
738  /* temporary search facilities */
739  regex_t *re;
740  regmatch_t match[1];
741  char **re_constants;
742  int re_count;
743  int re_fill;
744  char reg_expr[2*SfileadrL];
745 
746  /* run state */
747  int run_state; /* 0=preparing , 1=writing image */
748  int is_dialog;
749  int bar_is_fresh;
750  char pending_option[SfileadrL]; /* eventual option entered at page prompt */
751  int request_to_abort; /* abort a single operation like -ls, not the program */
752  int request_not_to_ask; /* suppress reassure and pager */
753  double idle_time;
754  int re_failed_at; /* mismatch position with structured_search */
755  int prepended_wd;
756  double insert_count;
757  double insert_bytes;
758  double error_count; /* double will not roll over */
759  int launch_frontend_banned;
760 
761  /* pacifiers */
762  int pacifier_style; /* 0= xorriso, 1=mkisofs 2=cdrecord */
763  double pacifier_interval;
764  double start_time;
765  double last_update_time;
766  /* optional global counters for brain reduced callback functions */
767  off_t pacifier_count;
768  off_t pacifier_total;
769  off_t pacifier_byte_count; /* auxiliary counter for data bytes */
770  off_t pacifier_prev_count; /* internal counter for speed measurement */
771 
772  void *pacifier_fifo;
773 
774  int find_compare_result; /* 1=everything matches , 0=mismatch , -1=error */
775  int find_check_md5_result; /* bit0= seen mismatch
776                                bit1= seen error
777                                bit2= seen data file without MD5
778                                bit3= seen match
779                              */
780  int find_unique_trunc_result; /* 0= some names are not uniquely truncatable
781                                   1= all names are uniquely truncatable
782                                   2= no names need truncation
783                                 */
784 
785  double last_abort_file_time; /* most recent check for aborting -check_md5 */
786 
787  /* Tree node collection and LBA sorting facility */
788  int node_counter;
789  int node_array_size;
790  void **node_array;
791  struct Xorriso_lsT *node_disk_prefixes;
792  struct Xorriso_lsT *node_img_prefixes;
793 
794  /* Hardlink matching at restore time memorizes hardlink target paths.
795     Array of nodes sorted by LBA. */
796  int hln_count;
797  void **hln_array;
798  void **hln_targets;
799  int hln_change_pending; /* whether a change was made since hln creation */
800 
801  /* >>> this should count all temp_mem and thus change its name */
802  off_t node_targets_availmem;
803 
804  /* Hardlink matching at update time:
805     Array of all nodes in the tree, sorted by disk dev,ino.
806     Bitmap of nodes which possibly got new hardlink siblings.
807     List of involved disk-iso path pairs. */
808  int di_count;
809  void **di_array;
810  char *di_do_widen;
811  struct Xorriso_lsT *di_disk_paths;
812  struct Xorriso_lsT *di_iso_paths;
813 
814  struct PermiteM *perm_stack; /* Temporarily altered dir access permissions */
815 
816  /* bit0= update_merge active: mark all newly added nodes as visited+found
817  */
818  int update_flags;
819 
820  /* For find jobs show_hfs_cmd , show_hfs_as_mkisofs
821  */
822  /* bit0= do not record but only count
823     bit1= as_mkisofs mode
824  */
825  int show_hfs_cmd_flag;
826  int show_hfs_cmd_count;
827  char **show_hfs_cmds;
828 
829  /* result (stdout, R: ) */
830  char result_line[10*SfileadrL];
831  int result_line_counter;
832  int result_page_counter;
833  int result_open_line_len;
834 
835 
836  /* info (stderr, I:) */
837  char info_text[10*SfileadrL];
838 
839 };
840 
841 
842 #include "base_obj.h"
843 #include "aux_objects.h"
844 #include "findjob.h"
845 #include "check_media.h"
846 #include "misc_funct.h"
847 #include "text_io.h"
848 #include "match.h"
849 #include "emulators.h"
850 #include "disk_ops.h"
851 #include "cmp_update.h"
852 #include "parse_exec.h"
853 
854 
855 #endif /* Xorriso_private_includeD */
856 
857